This is an interface board built around the Atmel ATMEGA328PB microcontroller. It accepts input, and sends messages, via a serial port that can talk to any other device. Text sent by the remote host is printed via a Centronics (DB-25) parallel port.
My aim in building it was to allow a Raspberry Pi, acting as a printer server, to print to my venerable Epson MX-80 F/T III dot matrix printer.
Using a microcontroller allows me to reconfigure the interface any way I see fit. That’s what makes it ‘smart’.
The board features:
- Three status LEDs under the control of the microcontroller.
- Four LEDs showing the status of certain printer signals ( Error, Busy, Paper End and Autofeed).
- An I2C header to allow the connection of a display – I’m using a 20 char by two line LCD.
- An ISP header to allow programming of the ATMEGA328PB on the board.
- TTL-level (5V) serial port. This uses the CTS line for flow control. I’m not using RTS, but it does connect to a GPIO on the microcontroller, so it’s available.
I’ve written Go code to run on the Raspberry Pi which will take the contents of a text file and print it, line by line, to the SmartParallel.
I’ve also created a web interface, but that was some time ago and probably needs work.
Along the way, I also hacked up a Centronics breakout board with shift register for the data signals as a kind of half-way house.
And I designed a serial level shifter daughterboard to allow the SmartParallel to be used with devices that have 3.3V signals.
Software
ATMEGA328PB : C++
The main function of this code is to sit and wait for incoming messages on the serial port. It also sends updates and status messages as appropriate via serial to the host.
Incoming messages are assumed to be one of two types:
- A command – to define a setting on the SmartParallel, ask for information about printer status etc.
- A line of text to print.
Either way, the message must be terminated with a null character (ASCII 0). If bytes are received on the serial port but no null terminator arrives within a given time, the program times out and dumps the characters received. Also, if the incoming buffer fills without having received a null byte, the final char is replaced with the null byte and we go with what we’ve got.
Commands are sent by making the first byte ASCII 1. The next byte is the command. The details of the commands are (or will be) on the GitHub page.
Any incoming bytes where the first one isn’t a 1 are assumed to be text to print.
The commands and other details of the code are more fully detailed in the README.md file on the GitHub page.
This code also manages an LCD display which shows similar messages to those sent via serial.
spprintfile : Go
This is a command line utility for the Raspberry Pi. It accepts a filename input and assumes that given file is a plain text file. It prints this file via the SmartParallel. Full details are in the README.md file on the GitHub page, linked below.
Resources
- SmartParallel posts
- KiCad schematics and PCB design files (GitHub)
- AVR code for the ATMEGA328PB (GitHub)
- Supporting ATMEGA libraries (GitHub)
- Go code (spprintfile) for Raspberry Pi, on GitHub.
- Go libraries on GitHub.
- Centronics breakout board KiCad schematics and PCB design files (GitHub) – to come
- Serial level shifter board KiCad schematics and PCB design files (GitHub)
Updates
Minor updates to the project will be added here. Major updates (if any) will also probably get their own blog posts.