/now-playing-printer

🎧🔥🖨️🖼️ print out the album art music to a thermal printer receipt

Primary LanguageJavaScript

now playing printer

🎧🔥🖨️🖼️ print out the album art music you're currently listening to

Uses Last.fm to get the tracks you're listening to and then prints them out on a thermal receipt printer.

Picture of a song printed out

here's a vid of it working: https://www.youtube.com/watch?v=ElmxS7iTNQ4

I did a talk about this, here are my slides: https://docs.google.com/presentation/d/1gCsklfmLf14PuasJexWyZcEoaQp72HyZ2LuIPDJe1Ys/edit

what you need

  • thermal printer
  • 57mm thermal paper
  • Arduino Uno (Works with other devices that can use serial port too use the corresponding RX and TX)
  • Arduino IDE
  • some jumper wires
  • 9V power supply (splice wires and shove into thermal printer)
  • Last.fm API key

installation

  1. upload the StandardFirmata example code to your Arduino Uno (File/Examples/Firmata/StandardFirmata -> Upload)
  2. set-up your thermal printer

Visual set-up

you will probably need to tweak the settings for your printer, see the thermalprinter module comments

  1. add environment variables. (Copy .env-sample to .env)
 LASTFM_API= # sign-up for a key at http://www.last.fm/api
 LASTFM_SECRET= # also at http://www.last.fm/api
 LASTFM_USERAGENT= # this is to tell last.fm who is requesting info
 LASTFM_USERNAME= # your last fm username to track what music is playing

 PRINTER_USB= # this is where the arduino is mounted at, see your Arduino IDE (Tools/Port)
 PRINTER_BAUDRATE= # hold the power button and plug the power in, the baudrate is printed on the test page
 PRINTER_ROTATION= # this changes the orientation of the print, 180 is upside down for example
  1. install non-node dependencies: GraphicsMagick
sudo apt-get update
sudo apt-get install graphicsmagick
  1. install node dependencies
npm install

run

listen to music and then run the script:

sudo node main.js

everytime Last.fm picks up a new song streaming it'll print it out!

you probably need to run a root to get access to the USB port