Build report of my favorite Adafruit parts; TFT & printer
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Build report of my favorite Adafruit parts; TFT & printer

by technerdchris on Mon Oct 14, 2013 8:41 pm

Build parts:
1.8" TFT Shield with Joystick
chipKIT uC32
Thermal Printer
And parts from Sparkfun
DS1307 Real Time Clock (Adafruit's version)
NKC Electronics ProtoShield for Arduino
"Easy Driver" board
12v + 5v Power Supply
Pololu #1208 stepper motor

» The enclosure is of my design and I made almost everything you see on a 3D printer.
» The "doghouse" which the TFT screws to and houses everything is open source and shared on GrabCAD.
» I also did a pretty good CAD model of the Thermal Printer on there too.

And about 500 hours of build time and experimenting to get it "Right".

Updated: video demonstration!

tps2_pf09_good_640.jpg (93.66 KiB) Viewed 4319 times

The test bench uses the stepper motor to turn a "throttle shaft" approx 90°, stopping every 0.75° to take an ADC measurement of the Throttle Position Sensor being tested. Usually, 120 or more values are measured and then put in an array and analyzed for standard deviation and also some strict bounding to make sure the plot doesn't wave around too much. The bench decides if it's good or bad. If it's good, the response plot is printed out on the Thermal Printer with a summary of the analysis.
Close-up of the screen:
tps2_pf09_good_tft_640.jpg (100.3 KiB) Viewed 4319 times

My company sells aftermarket parts for Ducati motorcycles and I started supplying TPSs. Two of the 4 models we sell I had custom made for us; they're not currently available via retail channels. During my normal OCD understanding of how and why things work, I came to learn that the manufacturing industry considers a 4 point test to be the standard QC. And it doesn't matter what continent the parts are coming from, that's normal. After having a customer receive a TPS that had wonky output, I built a crude v1 test bench. Using a Mega and a crappy salvage store stepper, this bench was good enough to help us eliminate TPSs that slipped through the normal 4 point QC. I used my 3D printer to make the 54T gear and input to the TPS. This setup with the 1:3 gearing and crappy stepper was able to measure 33 to 35 points in each TPS. I basically checked that the change between steps' measurements was within some range of bounds.

But to SEE the plot of the TPS, I had to use the serial monitor, copy the values as measured, paste them into a spreadsheet, then create a graph; in other words too much work! Then I discovered the 1.8" TFT Shield with Joystick glowy thing. Upon the completion of this other crazy project, I knew it would be great to see the plot. Then when I saw the serial thermal printer I needed to make V2 of the TPS bench happen -- I could print this part's plot and include with it! No one gives 3 cares about quality, let alone like this. A little bit of effort on my part ensures no customer or shop will have to go through the painstaking process of replacing a TPS I sold them because it was built poorly! (well, never again after that first guy)

Here's the Fritzing:
tps_bench_640.png (223.45 KiB) Viewed 4319 times

to be continued... gotta get to the pub. Still to come: explanation of the choices of equipment, pics of the guts, and some gotchya's I learned along the way.
Last edited by technerdchris on Thu Mar 06, 2014 5:26 am, edited 5 times in total.

Posts: 46
Joined: Sun Nov 25, 2012 4:08 am

Re: Build report using my favorite Adafruit parts

by technerdchris on Mon Oct 14, 2013 11:56 pm

chipKIT and the 1.8" TFT shield:
I went with the uC32 so I could get more RAM. I previously used Megas, so that was my goto platform. Then I found out that a Mega could only make a 192x192 bitmap from a dynamic array in memory. Research found the uC32 appeared to be an Arduino with 32k of SRAM!! Sweet - that's got 19k for the array I need to dynamically draw 384x384 pixel plots! There was a little bit of a learning curve and big thanks to majenko on chipKIT forums for his help with the TFT and my other various problems. He loves this TFT so much he's developed a chipKIT library around it! Further, he's the guy who developed the uecide development platform. With his help, I started a library to make the 1.8" TFT Shield work on the chipKIT.

While chipKIT says its boards and mpide are Arduino compatible, it's not all roses. 1st off, Digilent is awesome for dedicating developers to work on mpide, but it is in the land of pre-Arduino-1.0. So all of my Arduino programming experience isn't 100% backwards compatible. Once I got over this hurdle, chipKIT-land is pretty awesome! I basically made the Adafruit GFX and ST7735 libs de-AVRd and it ran without any excuses or delays. Majenko was so impressed, he's working on a frame buffer and really advanced stuff to show the best of the 1.8" TFT Shield! This youtube demo of what he's done with that shield is simply amazing!

All of this 1.8" TFT code is open source and hosted on Github here. His framebuffer stuff is in Experimental. The more-or-less direct Adafruit GFX and ST7735 ports I did are in Libraries. I did make some usability improvements with the port, like handling text color inversion and getCursor. The TFT is so fast on chipKIT, compared to an AVR mega, it almost blinks when clearing the screen.

Overall, I consider the chipKIT uC32 (and Uno32 with less SRAM) to be superior equivalents to anything AVR based. Same-ish pricing, 10x the processor speed, moar RAM, moar inputs than God, moar hardware things like UARTs and all that. Truly impressive.

The Printer:
I had the printer working with the Mega but did find the limit of SRAM pretty quickly. I was starting to research having the bitmap stored on the SDCARD and how to dynamically write to each byte to draw in my plot for the printout. About the same time, I discovered the whole Netduino thing with all its SRAM. Then I discovered how miserably slow & difficult it is to load new code into the target. Looking at its processor (the PIC32) I then found the chipKIT and tried it out.

The problem I had with the printer in Arduino-land was that everyone and their brother had different ideas about how to do the "wire library", so examples kinda sucked. Here's where chipKIT's more primitive pre-Arduino-1.0 environment helped me. I was able to port the Adafruit Thermal library and make it work on my first try. I might have been a professional software engineer, but I have amazing capacity to screw things up, so I'm proud of that achievement and also it reflects well upon Ada's development.

BTW, I did end up moving the printer's pins from 2 and 3 (as shown in the pic below) to UART2 on pins 39 and 40, which are inboard of Arduino D13 and the GND pin above it. chipKIT just uses double rows of pins on each side for a easy cheat bringing out all those extra pins!

Only use 9V on the printer! Don't even bother with 5V. I initially used the "computer molex type" power supply to feed the 12V to the Mega and the stepper's Easy Driver board and then sent the 5V to the printer. When I read about improved performance with 9V, I tried a wall wart and verified the incredible improvement. So then I bought a 12V -> 9V converter from eBay to hang off the 12V from the original power supply.

Power Distribution:
As it turns out, the chipKIT's voltage regulator runs really really hot with 12V and with 9V. Not even comparable to all of the Arduinos I've had experience with. It really only wants 6 or 7 volts. Since I'm feeding it 5V, I needed to supply the I2C real time clock with a separate 5V directly from the 5V source and not use the 5V arduino pin from the shields. Kinda sucky, but that's life.

Pic of the power grid:
power_dist_640.jpg (132.56 KiB) Viewed 4303 times

The 3 pin connector with red, black, and yellow are the 9V and 12V lines to power the printer and Easy Driver boards. The separate red wire in the back ground is +5V from the original power supply which powers the twisted wires powering the chipKIT uC32 & there's a separate jumper powering I2C on the other side. In the foreground, you can see the two pull up resistors for the I2C communication lines. The chipKIT doesn't have pull-ups on those lines, so they need to be explicitly added somewhere.

NKC Proto Shield:
My all time favorite proto shield has been Adafruit's own part. I can replace the included headers with stacking headers and I've got about the most awesomest proto shield that exists. I really love the 2nd row of through holes for each pin! That helps a lot with my poor soldering!! The Arduino AVR Mega initial version of this test bench used this Adafruit Proto Shield. It's one of few that let me sneak two sensor connectors ahead of the header with the power pins.

When I set out developing the chipKIT, I didn't want to take apart the Adafruit shield that was already working, so I went to my parts bin. The NKC is actually very similar to the Adafruit proto shield, but for this exact project, wins out because they dedicated an area in the bottom corner for I2C and broke out the pins in a 4 x 4 grid. I found this awesome because I was able to solder in the 90° header, and the pull-up resistors, as well as the separately routed +5V without a lot of effort or hacking! I did end up cutting the +5V trace on their shield which originally feeds I2C, but they helped out and showed me the trace to cut.

I've gotten to where I'm using proto shields for all of my interconnectivity and hacking. This way, the TFT and the uC32 are maintained in original condition.

Pic of the proto shield:
nkc_proto_shield_640.jpg (115.56 KiB) Viewed 4303 times

Notes about the proto shield and this pic:
» The +5V is running from the arduino pin. That was before I realized feeding the chipKIT +5V led to 4.3 or so going to I2C and it only worked when hooked up to the USB port. So I removed this jumper and ran my supply's 5V to it.
» The two sensor sockets forward of the power header.
» Under those sensor sockets, there is connection for a jumper to select the voltage that feeds the entire shield's power grid: 3.3 or 5V. I cut a header pin and soldered it across the 3.3V connection. The chipKIT uses 3.3V for its inputs and ADCs.
» Easy Driver board mounted in the middle: wow, I've tried almost everyone's "stepper motor" shields and they make me feel like an idiot. This board really is easy. It was the only time I was able to get consistent results on the stepper from within my code. Everything else I tried didn't just work. This does. Give it volts, then send it 2 signals: direction and step. So easy! I also used its enable input so I turn off the stepper motor when not actually sweeping through a test.
» 4 pin connector at top: powers the stepper.
» 3 pin and 2 pin connectors to the right: thermal printer connections. I chopped off the original 3pin connector and fitted a sensor-type connector to it. Those female sockets are almost impossible to find.
» Blue wires: connections of Easy Driver board to comm pins on uC32.
» Yellow wires: connections of sensors to uC32 A1 and A2. Sensors' GND and +3.3V are fed via the main rails on the middle of the board.

The spaghetti mess: the heart of the whole test bench
proto_shield_installed_640.jpg (96.9 KiB) Viewed 4303 times

Still to come: photos of report output which show how important this test bench is... and a youtube video. Maybe.
Last edited by technerdchris on Thu Oct 31, 2013 1:27 am, edited 1 time in total.

Posts: 46
Joined: Sun Nov 25, 2012 4:08 am

Re: Build report using my favorite Adafruit parts

by adafruit_support_bill on Tue Oct 15, 2013 5:49 am

Impressive project! Thanks for posting: :)

Posts: 84355
Joined: Sat Feb 07, 2009 10:11 am

Re: Build report of my favorite Adafruit parts; TFT & printe

by technerdchris on Tue Oct 04, 2016 11:48 am

BTW, here's a YouTube video of the test bench in operation:

After a couple years of using this test bench, here are some thoughts:
  • While the joystick on the TFT shield is awesome, it isn't the most robust for frequent operator input. Save it for mode changes and then add a separate more robust button for "GO".
  • Operators will always handle stuff roughly. Sometimes a 1 year old is more careful. The wires for one of the sensor inputs got ripped out. And the other sensor input broke the solder joints where the socket meets the proto shield. I used a nylon P strap to affix the sensor wiring to the housing.
  • The printer could be faster... Now this is a high class problem, but still, in the procedure for testing parts, it's easy to find yourself waiting on the printer to finish the print. A solution might be to use a faster POS receipt printer. They're only slightly more expensive than this thermal and are self contained so you won't need to manage its power supply.
  • Always leave 1/2" extra room for things. My housing for the electronics is too compact; it's like an engineer designed it not realizing real world implications! :-) Now that I've had to go back into it a few times, I'd definitely do things differently. One consideration would be to NOT affix the shield to the "Arduino stack" and instead run wires up to the display and then put the other boards in the lower compartment.
  • Always have an on-off switch. My bench uses the 3 prong IEC computer cable and has to be unplugged to turn off.

:) Chris

Posts: 46
Joined: Sun Nov 25, 2012 4:08 am

Please be positive and constructive with your questions and comments.