Saturday, January 19, 2013

Arduino Esplora Tinkerkit Outputs

The new Arduino Esplora has two orange output connectors at the top left of the device.  They have been identified as for connection to Tinkerkit devices.  I'm here to help the hacker use these connectors like they might on traditional Arduinos.
Turning it sideways and magnifying:

To connect, you'll want 3-pin molex connectors.  They are commonly used for PC fans.  You can find them at Sparkfun Electronics and other suppliers.  If you make your own connector, take the pins off, crimp a wire on, solder, then gently slip it in bump side upto the molex hole side up until it clicks in.  If you need to remove pins, get a paper clip tip and gently press on the pin through the connector while gently tugging out.  The completed molex connector will slide onto the orange male on the Esplora and click on.  To take your connectors off the Esplora, you might have to pry on the orange molex tab, then wiggle your female connector off.

Once you have connectors wired, connect to your devices or sensors.  Left, I show connecting an XBee on a Sparkfun XBee Explorer Regulated breakout board which handles the power step down to 3.3 volts for the Bee and the 5 volt to 3.3 volt signal line difference.  With my setup, I can use the SoftwareSerial library to define a software serial connection.  See http://arduino.cc/en/Reference/SoftwareSerial  for more information.



Programming: the pins are used as any digital pin in the Arduino software.  They are digital pin 3 and digital pin 11.  Both support pulse-width modulation (PWM) so you can connect LEDs, servos, etc. and vary the pulses to brighter/speedup or dim/slow down your connected device (usually done with analogWrite even though it is a digital pin). Do NOT connect a regular (non-Tinkerkit) servo directly to the pins, the pinout is different.  See http://arduino.cc/en/Reference/AnalogWrite for more information.  As with all connections, be careful of the power you draw.

You can power the Esplora by putting 5 volts into the Tinkerkit connectors.  I highly suggest you ensure the polarity is correct several times before you actually do this as a reversed connection could destroy your device.  I (carefully) do this using a LiPo battery circuit described in a previous post.

If you need more digital pins for your project than these two, you can use the ones that have been reserved for a display.  See this post for more information.

Let me know what projects you build with these connectors.

Thursday, January 17, 2013

LiPo powered Arduino Esplora Game Platform

The Arduino Esplora plus Display handheld gaming device gets a portable power supply in the form of an Adafruit LiPo battery, charger, and Mintyboost to power up to 5 volts.
A nice flat LiPo battery powers the Esplora in this version
In my last post, the Arduino Esplora was mated with an Adafruit 1.8" TFT color LCD display and a ball-level bounce game by R0d0t made the Esplora a portable gaming device.  Sort-of.  As stated, the Esplora power cord was cut using an Energizer cell phone battery eliminator, a bulky, non-ideal solution.
The previous battery into the USB port was a stopgap
Researching how to power the Esplora in an elegant way, I found the Adafruit LiPo battery and charger board.  This solution will only power out 3.6 volts or so.  The Esplora is a 5 volt board so we need a way to boost the voltage.  Not easily done.  Adafruit also has their Mintyboost which boosts 3 volts to 5 volts for USB devices.  Perfect.  The combination of the LiPoly battery, charge board, and Montyboost gives the Esplora a relatively flat battery capability.  When I completed the mounting, I wished to power the board via the Tinkerkit connector instead of the USB port (it frees the USB for programming and provides a slimmer profile for gaming).  Triple-checking the polarity, I placed the 5 volts from the Mintyboost into the positive and negative terminals (observe polarity!) and it worked fine.
The battery is mounted and non-conductive foam placed on the Esplora back
The components are mounted on the Esplora via non-conductive foam to separate the PC board contacts to prevent unintended contact.  The connectors up top are standard 3 pin Molex connectors like the ones often used on PC fans.  Sparkfun also carries these.  The pinout of each looking below is (left to right): +5 volts, signal, ground.
The finished Esplora+Display Game obtains power via the left Tinkerkit  "output".
The Tinkerkit output pins are Digital 3 and 11 which we use for send and receive to a wireless radio.
The XBee is wired to the signal lines fron the two Orange Tinkerkit connectors.  These map to digital pins 3 and 11.  These pins can communicate with the radio via the Arduino Software Serial library.  This frees the display header pins to control, er, a display.  Those pins are the only free pins (the two white Tinkerkit connectors are inputs and are multiplexed into the Esplora so using them via a standard Arduino library is near impossible).
The red Sparkfun XBee Regulated can take nearly any radio that has a "Bee" pinout
You will see a socket between the LiPo battery and the power boards.  This is a Sparkfun XBee Explorer Regulated board which will power a radio in the XBee pinout via 5 volts and ensure the 5 volt signals of the Arduino will not harm a radio expecting 3.3 volt signals.

I have four types of radios - the XBee series 1 and 2 (Zigbee), a bluetooth radio in Bee pinout and a Sparkfun WiFly wi-fi radio also in Bee pinout.  This makes connecting the Esplora via radio a matter of plugging in the desired radio.

The only thing now would be a custom case, probably via 3D printing but I rely on my readers to discuss this as I do not have a printer and making one to the Esplora front and the battery back would be quite a task.  Possibly if it could be 3D scanned then input to a printer it would work.

Sunday, January 13, 2013

First Self-Contained Arduino Esplora Game

Ok, the Arduino Esplora has been out about 3 weeks.  It's time we had some cool software for it and what better than a fun game.  Today I publish a game for running on the Esplora with an Adafruit 1.8" display.
Esplora with an Adafruit display and 5 volt battery 

The Esplora comes with an example where you may use it as a wired controller for a Tux Kart game.  Not much fun.  With my definition of the "Display Header" and my supposition that the Esplora is a pin match for the Adafruit 1.8" TFT LCD Display make it possible to have the Esplora with display as a standalone game machine.  Make sure you get the Adafruit display breakout and not the Arduino shield version.  The Esplora's AT32U4 chip (Leonardo derivative) is not a powerhouse but many creative people have coded good games for classic Arduinos.

This project originated by R0D0T with his engineered handheld game consisting of a AT328 (classic Arduino processor) with a 1.8" TFT display, accelerometer, buzzer, buttons, and battery.  Details are on his blog and on Hackaday.  He was hoping to engineer his hardware as an ultracheap gaming platform.  Then the Arduino Team released the Esplora with nearly the same hardware set (minus battery).  I really feel for him.

Gameplay, flick your wrist to control the ball
I was looking for a game that was more than the basics to show off the Esplora + Display combo.  I found R0D0T's code and with accelerometer, music, and display, it was a great match.  As I use the Arduino IDE, I merged the code, changed the display library to Adafruit's, and recreated a couple library routines that R0D0T had used but had no Adafruit equivalent.  Then I had to map the buttons (which required Esplora library calls), and the accelerometer (which I originally used hardware but changed over to library calls).  I mapped the SPI interface to the display and it worked!  Some small tweeks to color and alignment but it is basically still R0D0T's original (a tribute to his ninja-coding).

I strapped a 5V battery to it for portability.  You can use USB power (keep a loose cord as you will be flicking your wrist).  Orient the Esplora with the joystick at top and buttons below.  Then the right button (top in landscape mode) is the "bonus effects" on button.  The bonus effects are Jet Pack, Frog Legs, Testosterone, and Low gravity.  After turning bonus on via the button, you strike a colored platform to get the bonus to activate.

You can get the code on my public Github account at https://github.com/TheKitty/EsploraApps.

For gameplay, I refer to R0D0T's original Youtube Video and a short Youtube Video I did today.

-
-

I'm sorry my video is sideways, I need to learn yet again if I use the camera in portrait mode that it will not look right.

I hope you all download the code and have some fun with your Esplora!

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.

Thursday, January 3, 2013

Wireless Arduino Esplora controls robotic head

This project expands on the XBee/Battery/Wireless Arduino Esplora project.  I motorized a robotic head on +hackfriday with an Arduino Uno and an +Adafruit motorshield.  I combine these projects today.

The Esplora sketch was modified to poll the joystick (4 directions) and the right button cluster.  When they are activated, an appropriate ASCII character is sent via serial to the XBee which sends it to the Uno which controls the head via a Motorshield.  An XBee shield (mine from iteadstudio, but there are many comparable ones from Sparkfun, etc.) only uses the hardware serial lines on D0 and D1 and power.  The Motorshield uses many digital pins but leaves D0/D1 free so the two shields stack without interference.

The robotic head is from +Mark Miller which comes with the head and base, two motors and two servos.

The Uno sketch takes the character and moves the appropriate motor (neck and chin) or stepper (eyes or mouth).

The code for the Esplora (EsploraXbeeRobot) and the Motorshield/head (BobSerial) is on GitHub for your downloading pleasure at https://github.com/TheKitty/EsploraSerial.

Youtube video of the project in action:


This is but one use for the Esplora as a controller.  You can expand this to make radio controlled vehicles, robots, mechanical arms, or mod your Furby for remote action.


Tuesday, January 1, 2013

Arduino Esplora as a fully wireless controller

I have finally cobbled together a fully wireless two-way controller using the Arduino Esplora board released in December.  It uses an XBee radio for two way communications, straps on a battery pack, and has a sketch to send and receive commands and send joystick & button presses.

In previous posts, I documented the Arduino Esplora "display" interface headers and I interfaced an XBee radio to two of the data lines on that header (which happen to be the hardware TTL level serial port).  The program communicated to a PC connected to another XBee via a USB board.  The solution was not truly "wireless" as the Esplora was still connected to a PC for USB 5 volt power (the designers did not make any known provisions for power beyond the USB port on the board).

Today I extended the Esplora project on two fronts.  First I used portions of the Arduino example code "EsploraKart" to map Esplora button presses and joystick movements to ASCII characters.  These are sent out via the XBee on Serial1 rather than the stock Keyboard method though.  I left in the two-way communication with the Esplora for sending sensor state and receiving RGB LED and buzzer commands to show the two-way functionality of the radio.

I also needed a battery source for 5 volts.  A nice Lithium Ion battery pack would be ideal but again attaching such is not in the current Esplora design.  So I hacked it.  I took an Energizer USB battery, usually used to power a cell phone in a jam and fed power into the USB port.  I attached it with a rubber band as time was rather short.

I loaded the new sketch and it worked.  It sends ASCII letters when the buttons are pressed and the joystick moves.  This can be used to control a computer game that expects such characters.  The Esplora may also be polled by the computer (all this wirelessly) for sensor info or to set the LED or buzzer.  Maybe a game creator would have the Esplora buzz when a game was lost or time up?  Or have the LED green for good progress, red otherwise?  The possibilities for expansion are quite large.

The code is again available as Open Source on my GitHub repository at https://github.com/TheKitty/EsploraSerial under in the EsploraXbeeController directory.  I think it's about 10 kilobytes or so, plenty of room to expand the functionality.

Here is a video of the controller in action:



Where should the project go next?