Ever looked at a set of Thermal Receipt Printer Guts from Adafruit but wondered what useful thing can I make with this? Well look no further: timePrntr is a digital/analog word clock that prints the current date and time at the push of a button and regular intervals. It is simple to wire, no problem to build, and easy to program. You'll never have to wonder what time it was again with a semi-continuous printed record of the passage of time!
Step 1: Step 1: Procure the Materials and Print Case
This project requires a little Arduino programming knowledge, some familiarity with prototyping and testing circuits and some basic mechanical skills. To really build it out a 3D printer is also useful and even an older model like my Replicator 2 can print the included case. The rest of the materials are commonly available from Adafruit:
- 1XThermal Receipt Printer Guts
- 1X DS1307 Real-Time-Clock Breakout
- 1X Pro Trinket 5v 16MHz
- 1X 1/2 Size Bread Board
- 1X7.5v 3A DC Power Supply
- 1X 6mm Square Tactile Switch
- Hookup wire (24ga)
- Male breakaway header pins
- M/F, M/M, F/F jumper wires
Optional Parts: (for mounting in case)
- 1X2.1mm Panel Mount Barrel Jack
- 1XAdafruit Perma-Proto 1/2 Size Bread Board
- 2XShort Header Kit for Feather
- 3D Printed Case (.stl files attached)
- #4 x 1/4" Flat Head Machine Screws
- #2 x 1/4" Pan Head Sheet Metal Screws
The prints take about six hours total on my Replicator 2 so now would be a good time to get them going while you do the rest of the electronics work!
Step 2: Step 2: Read and Understand the Circuit Diagram
This a very simple circuit that requires no additional components other than those listed. That said, it is worth your while to look at the attached circuit diagrams and understand how the device is laid out. It is fairly simple and easy to customize for those with intermediate to advanced skills with an Arduino.
The basic outline is like this: The device utilizes SoftwareSerial on the Pro Trinket as well as Adafruit's Thermal Printer Library, and Adafruit's RTC (Real Time Clock) Library.
The Trinket will communicate with the thermal printer over serial using the SoftwareSerial library with the Trinket's pin 6 defined as TX (transmit) and pin 5 defined as RX (receive). Those pins are connected to the RX and TX pins on the thermal printer respectively. Remember that this is a cross-over situation where Trinket's TX pin connects to the printer's RX pin and vice-versa. Adafruit has an excellent hookup-guide for the printer if you want a more in-depth look at its capabilities.
The real time clock module is a continuous time keeper so your printer will know the time even when it is unplugged! The Trinket will poll the time from the RTC module via I2C and the wire.h library. The Trinket's default I2C SDA and SCL pins are A4 and A5 respectively. These are simply connected to the SDA and SCL pins on the RTC board.
Finally the momentary contact switch is connected to pin A2 and ground and initialized in the code with Input_Pullup.
The power is easy enough as well. The thermal printer must be connected directly to the +7.5VDC from the power supply and ground. It is a power-hungry device and 2A is a must. The supply here is 3A and works great. The Trinket's Bat (battery or Vin) pin is connected to +7.5VDC as well. The RTC module will get its power from the Trinket's +5V pin.
Step 3: Step 3: Test Printer, Build the Circuit on a Bread Board
The Fritzing image will help you build and test the circuit on a solderless breadboard. This step will require some soldering though as you will first solder a set of male header pins onto the Pro Trinket and RTC module. Remember to point the long pins down on the Pro Trinket and long pins UP on the RTC. Once they are soldered you can use M/F M/M pins to make the connections on the breadboard. The V+ and Ground rails on the top of the bread board should be connected to the +/- pins respectively on the 2.1mm barrel jack adapter with M/M jumper wires.
On my bread board I used long male header pins to give the rtc and thermal printer a convenient plug. This may be more clear in later images of the circuit attached to the perma-proto bread board, so look ahead if it seems confusing.
If you look closely at the diagram I sneaked the connection wire for the 5V pin on the RTC behind the Pro Trinket. This is not necessary but it keeps the board clean and easy to trace. The ground pin for the RTC is hooked to the ground wire on the switch. The SDA and SCL pins to the RTC module are crossed over in my diagram, which is correct, just make sure they are hooked-up SDA-SDA and SCL-SCL on your breadboard.
If you plan to solder this circuit to the perma-proto board and mount it in the case it is important that you place the switch near the middle of the board! Following the diagram from Fritzing will place it exactly right.
Before you do any of this it is advisable to follow Adafruit's Thermal Printer Guide to test the thermal printer and find it's baud rate. According to Adafruit this rate can vary from printer to printer!
Once it is all hooked up and working you can upload the code from the next step to try it out!
Step 4: Step 4: Upload the Code!
You are now ready to program the Pro Trinket! Before you start, read and follow the USB bootloader section of Adafruit's Pro Trinket guide. Make sure you are able to upload the Blink code before proceeding.
Once that is done you can download the timePrntr code in the attached .zip file. Unzip it into your Arduino IDE library folder and open the program. There should be three tabs in the program with two header files for some graphics the code uses to print the device introduction. Upload the code to the Pro Trinket and test your timePrntr!
One important note here: the code uses the system time at compile to set the clock on the RTC module. For this to work the RTC module must be wired correctly to the Pro Trinket. If the time is not correct, it may be that the SDA and SCL pins are not properly connected.
Step 5: Step 5: Solder the Components to the Perma-Proto Board
To make this device permanent and ready to mount in the 3D-printed case all you need to do now is solder everything to the Perma-Proto Board. I chose this board for my first electronics Instructable because it lets you simply move parts from one bread board to another! Follow the layout in the photos and previous diagrams exactly and you won't have an issue fitting it in the case.
The Pro Trinket, wires, and header pins for the printer and RTC module will sit on the front of the board. The button will be soldered to the back of the board.
First mark the rows where the two 12-pin short female headers will be mounted on the perma-proto board (Rows C and G). These headers makes it so the Pro Trinket is removable! Nothing else should be connected and soldered in these rows!
Cut wires to length and strip them so they are well insulated and temporarily attach them to the board by bending the leads over on the back of the board. Place the swtich, but know that it will eventually be soldered to the Back side of the board.
To solder the male and female headers just use a small bread board to hold the pins in place while you solder the first few points. You should also solder on a pair of header pins (straight or 90 will work) for the power connector on the top +/- rails of the perma-proto. This will allow you to connect the power with a pair of female jumpers soldered to a panel mount barrel jack during final assembly.
If you follow the diagram the 5 pin cable for the printer will plug in with the tabs facing the Pro Trinket. The RTC is wired as shown with F/F jumpers.
Don't forget to test everything!
Step 6: Step 6: Final Assembly
Barring any unforeseen issues with your prints everything should be ready to go when the electronics are done and soldered.
On the top side of the case the button's three spring wings can be carefully glued with CA glue into the three corresponding indents on the inside of the case. The dished side of the button should face outward.
To prepare for final assembly you need to do is attach some wires to your 2.1mm panel mount barrel jack. Just clip one end off a one black and one red F/F or M/F jumper wires (6" length will work, make sure you leave a Female end on both). Strip the cut end and solder it to the appropriate pins on the barrel jack.
If you are not sure which pins to solder to, you can use a multi-meter to find polarity with the middle post and the inner wall of the jack. The post on the inside of the jack is the +Positive side!
Once that is soldered up, screw the barrel jack into the case with the included nut and lock washer.
Loosely place the components in the final positions as shown. All wires should be on the bottom connect all of the wires to their appropriate headers.
Screw the printer in with the small #2 screws and screw the proto-board in with a #4 pan head.
Screw the RTC in with a single #2 screw on the right hand side. The other hole is pinned to a post.
Slide the printer controller into its bracket (it is vertical) and the brown ribbon cable should be down with the smoother side of the board toward the printer.
Slide the perma-proto board into its bracket with the button facing forward. the Pro Trinket should be on the left.
Place the top on the case and screw it together with 4X #4 Flat-head screws on the bottom and you are done, ready to print the time at the push of a button!
Runner Up in the