Thursday, January 10, 2013

Esplora+Adafruit 1.8" TFT Display Works - Making Esplora Wireless Version 2

I wrapped up my wireless Arduino Esplora build (Version 1) on Saturday night by demonstrating it controlling my robotic head on the Adafruit Show and Tell show.  It was fun demonstrating the project and talking to Limor and Phil.
On to display news.  I ordered parts to add a display like I previously blogged and to make the wireless and power more usable rather than a breadboard and rubber band hack.  One order to Adafruit and one to Sparkfun.

Well the day before my parts arrive, Dave Pentecost, with some guidance from my previous blog post and advice from me and Craig Ruaux, got his Adafruit 1.8" display snapped into his Esplora and sample code loaded.  You can use the Adafruit display libraries (which are excellent albeit a bit slow).  But, you need to define the pins the display uses.  Remember the Esplora is an Arduino Leonardo class device so pin mappings are not the same as the older Uno class devices (see http://openenergymonitor.blogspot.com/2012/06/arduino-leonardo-atmega32u4-and-rfm12b.html#!/2012/06/arduino-leonardo-atmega32u4-and-rfm12b.html and http://arduino.cc/en/Hacking/PinMapping32u4 for documentation).

You'll be ok if you make the following definitions for the Adafruit 1.8" display.  These will not work on other Adafruit displays mind you:

#define sclk 15
#define mosi 16
#define cs   7
#define dc   0
#define rst  1  

Also to have the text display across the display rather than "on top", the library needs to know you've rotated the display to landscape with the following command:

   tft.setRotation(1);

Here's a picture of my Esplora and the parts to make Wireless Esplora Version 2.  You'll see my As Seen on Show and Tell sticker (yay!!) and a new twist, a wifi module in a Bee format (WiFly from Sparkfun) to switch out an XBee to Wifi if I desire (I have a Bluetooth module in Bee pinout also from a previous purchase so I could swap radios to suit needs).  
More parts for Wireless Esplora Version 2 including the Adafruit 1.8" display.  Also the cool As Seen on Show & Tell Sticker.
You'll also note some power parts: Adafruit LiPo battery, LiPo charger, and Mintyboost.  Power is tricky, the Esplora needs 5 volts but LiPo batteries output 3.7 volts and need special charging circuitry.  Also the radios run off of 3.3 volts.  So I have the LiPo, LiPo board, a Mintyboost to boost voltage to 5 volts and 3.3 volt 3-terminal regulators.  Very complicated - this could have been simplified greatly if the ARduino team had added 3.3 volt onboard like on the Uno (or made Esplora a 3.3 volt board like the Leonardo and Due).

I'll work on it all this weekend.  Any suggestions on direction to go welcomed.