Using slinktool and the SeedLink protocol, I pull data supplied by the rtserve.iris.washington.edu
server, from Fort Macarthur Park, California, USA station "CI_FMP", channel "BHZ" STS-2 seismometer:
slinktool -s BHZ.D -S CI_FMP rtserve.iris.washington.edu -p -u | ./thermal-printer.py -p '-2000 3000' > /dev/serial0
Chusmiza, Chile, Nanometrics Trillium 240 Broadband Sensor:
slinktool -s BHZ.D -S C_GO01 rtserve.iris.washington.edu -p -u | ./thermal-printer.py -p '-1000 1000' > /dev/serial0
./thermal-printer.py -b 'ITF HN-VIGNOLLES ' > /dev/serial0
./thermal-printer -i imagefile > /dev/serial0
# Another example:
qrencode "WIFI:S:<SSID>;T:WPA;P:<PASSWORD>;;" -s 30 -o qr_wifi.png
./thermal-printer -i qr_wifi.png > /dev/serial0
R-Pi
─────┐
1 2 │
■ ● │
● ● │ ┌──────────────
● ●─┼─GND──┤GND TTL level
● ●─┼─TX───┤RX Printer
● ●─┼─RX───┤TX
│
... │ ┌────────────┐ ┌──────────────
├───┤ USB-to GND├──────┤GND RS-232
│ │ RS-232 TX├──────┤RX Printer
│ │ RX├──────┤TX
│ └────────────┘
- My printer model:
JP-QR701-RS232
- Power Supply for the printer: 5-9V, >=2A
- The peak current consumption can reach 3.89A
- I have tested the LM2596 module at 9v with good results
- Baud rate typically 9600 or 19200
Using socat
and nc
.
On the thermal-printer side (Raspberry Pi):
socat -gx TCP-LISTEN:3000,fork,max-children=10,reuseaddr OPEN:/dev/serial0
On the "client" side:
./thermal-printer.py [options] | nc <raspberrypi-ip> 3000
./thermal-printer.py [options] 2> /dev/null | hexdump -e '52/1 "%02X "" "' -e '8/1 "%_p""\n"'