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:
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:
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
Still to come: photos of report output which show how important this test bench is... and a youtube video. Maybe.