Getting my daily news from a dot matrix printer 2024

· coding · Source ↗

TLDR

  • A Raspberry Pi Zero W runs a PHP cron job each morning to fetch news, weather, stocks, and Reddit posts and print them on a vintage dot matrix printer.

Key Takeaways

  • Hardware stack: Star NP-10 dot matrix (mid-80s, ~$40 used), Raspberry Pi Zero W, serial-to-USB adapter; printer exposed at /dev/usb/lp0 after chmod 666.
  • Character output uses IBM Code Page 437 hex values sent via fwrite() to the device file; box-drawing characters handle section headers and borders at 80-char page width.
  • Data is entirely free or near-free: Open-Meteo (no key), TwelveData free tier (stocks), NYTimes API free tier, Reddit JSON endpoint with spoofed User-Agent.
  • A word-wrap function splits headline and Reddit post strings on word boundaries before writing to avoid mid-word line breaks the printer cannot handle.
  • Cron triggers php print.php at 8am; output is a single rip-off sheet covering weather, stocks, top headlines, and subreddit picks.

Hacker News Comment Review

  • The sole comment points to a prior HN thread on the same or similar project, suggesting this is a repost or revival with previous discussion worth reading there instead.

Original | Discuss on HN