Showing posts with label Xbee. Show all posts
Showing posts with label Xbee. Show all posts

Monday, April 15, 2013

Arduino Radio Communications: Current Trends

Efforts to allow Arduinos and other microcontrollers to communicate via radio frequency (RF) continue to grow.  This article summarizes some trends in the field.
New Platforms

New devices built on Atmel chips which include RF capability within the microcontroller are growing.  The recently successful Pinoccio on Kickstarter is the leader.  Others are coming out including miniSWARM on indiegogo.  These are compact and have power management built in so they make great nodes in a wireless network.  These all seem to be able to talk using the 802.15.4 protocol. An issue is the radio protocol stacks may not have been written to support interoperable communications (for example to a 802.15.4 XBee Series 1 radio) so you really have to review your needs - until these radios talk in an interoperable protocol, mixing and matching may not be possible.

XBee

XBee continues to be a very popular choice with strong support via books like Making Things Talk.  The platform is well supported with boards and shields.  But innovation using XBee is not growing - device cost, 3.3 volt power, and lack of design wins contribute to a bit of stagnation.  I like XBees alot and I recommend them for designs.  I'd like to see others design current circuits and I'd like to see Digi lower prices to remain competitive.

Wifi

Wifi continues to be a popular method of communications.  The Pinoccio includes a Wifi add-on to connect a local network to a larger Internet network.  Other notes:

  • The Official Arduino Wifi Shield (802.11b/g) continues to sell at about $85 (Maker Shed)
  • DFRobot has a new shield with 802.11 b/g/n also at $85
  • Many b/g units in shield, board, and "Bee" form factors
  • Prices do not seem to be going down over the last few months.
GSM
  • The Official Arduino GSM Shield was released into a market with other such cards on the market.  There has not been much of an uptake in resellers.  The website states Arduino distributors will have it after March 25th but a survey of Sparkfun (which carries other products), Maker Shed, Adafruit, Radioshack all do not have it.
  • Yourduino has a shield ($75) and a board ($69)
  • SeeedStudio board (Radioshack $90)
  • Generic - eBay $45
RF24

Small boards based on the nRF24L01+ continue to rise in popularity due to low cost and better software.  A new library came out recently from Greg Copeland.  Cost for unamplified/chip antenna units are under $3 and modules with an amp and 2dB antenna are around $17-$20 (eBay, Sparkfun and yourduino.com). 

Other
  • Bluetooth grows in popularity.  The new Bluetooth 4.0 low energy is a promising development.  The Maker Shed has a nice Arduino Shield at $35
  • 315 or 433 MHz transmitters/receivers are also low cost - these are carried by yourduino.com (433), Adafruit (315) and others including eBay.
It's never been a better time to cut the cord on your project and use radio communications.  Do research the capabilities of various radios to ensure they'll do what you want.

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?

Monday, December 31, 2012

Arduino Esplora interfaced to an Xbee Radio

Third in a series, I expand on my previous post documenting the Arduino Esplora expansion header and using the hardware and software serial capabilities of the Arduino on the Esplora platform.
For this post, I use a small perfboard and some header to make a plug-in platform for the Xbee project.  To aid prototyping, I use a small breadboard available from most electronic outlets.  You can use the same concept to prototype any circuit you like with the Esplora using the expansion pins I document here.
A perfboard with headers used to anchor it as a base

On the breadboard, I mount an Xbee adapter board (similar to Sparkfun board, also use headers).  As the Xbee operates at 3.3 volts and the Esplora is a 5 volt system at the expansion header, I use a voltage regulator (one from Adafruit was handy but you can make your own 5v to 3v3 circuit, see Igoe Making things Talk, pages 200-201).  Per Igoe, the Xbee data lines are 5 volt tolerant so I interface them directly.

Esplora connections: Pin 10 ground (black), Pin 9 +5 volts (red), Pin 8 Transmit (orange), Pin 7 Receive (green).  +5 goes to the regulator input and the regulator output goes to Xbee pin 1 VCC.  Connect ground to the regulator and XBee grounds.  Note: The receive line pin 7 from Esplora goes to Xbee transmit pin 2, transmit line from Esplora header 8 connects to Xbee receive pin 3.  That's basically it on wiring, not fancy when you know what you are connecting to.
Mounted breadboard with regulator, Xbee carrier and Xbee.  Wiring from the Esplora right header to the breadboard.

For software, I take the lead from my previous post on pin mapping.  The Esplora hardware serial line follows Leonardo conventions.  The Serial function talks to the USB.  The Serial1 function talks to the "D0/D1" hardware serial line we know from programming older Arduinos like the Uno.  These are on Esplora header pins 7 and 8.  Software serial is possible too although the receive pin must be another data line that supports the softwareserial library's interrupt function.  Here I stick with the hardware serial and it is simpler.

I took the Arduino software IDE example sketch "EsploraRemote" and added just the tiniest tweeks to change use of the serial port (USB) to the hardware serial line Serial1.  The code is available as EsploraXbeeRemote at https://github.com/TheKitty/EsploraSerial .  The code is simple but cool - it takes input to either change the buzzer or LED on the Esplora or return Esplora input values.

On radios, I use two Xbee Series 1 radios.  The MY addresses are set to 1 on #1, 2 on #2.  Destinations are set to the other (2 for #1, 1 for #2.  They are also set for serial communications 9600, 8, N, 1.  For Xbee basics, see Making Things Talk or the digi examples website.

Esplora with Xbee and another Xbee talking to it wirelessly
For the transmitter, I use the Foca board I used yesterday - you can use equivalent boards from Adafruit and Sparkfun - they turn a USB port into serial to talk to the Xbee or to talk TTL serial.  You can use any Xbee transmit/receive project to speak to the Esplora - the example just uses a serial terminal to talk to the Xbee which wirelessly sends and receives characters to the Esplora via the other Xbee.  I use the PuTTY serial terminal on Windows - it is available on Mac & Linux or use your favorite serial program.  I set communications to the same as the example program and my Xbees at 9600 baud.  I enabled local echo on the terminal to see what I was typing.

Upload the ExampleXbeeRemote sketch from my Github repository.  Upload the sketch to the Esplora.  Now the USB will only power the unit and we will not use USB to talk to it.  In PuTTY, you type any of the commands listed in the example code headet, for example T440 (which turns the Esplora buzzer on at a frequency of 440Hz).  If it is all connected right and the Bees are set right the annoying buzz will start (use T0 to turn it off).  The Rxxx, Gxxx, and Bxxx commands set the color of the onboard RGB LED.  Very cool.
Screen shot with PuTTY terminal left and Arduino IDE right
With this you can wirelessly communicate with your Esplora, one step closer to making a truly wireless controller (the last step being battery power).  If you use other radios, post your links to your project as a standard serial line will "speak" to nearly any radio link.  Enjoy.

PS Yes the Esplora schematic has a small 3 .3 volt regulator for limited use by one sensor, I did not try to hack into it as it is not readily available and most likely very low current - the 5 volt system has many milliamps for use so a regulator from 5 volt to 3.3 volt (especially an efficient one) is a good solution.  The one I use is a more expensive Adafruit buck converter, overkill at $15 but I had it.  A 78xx or similar regulator and a couple of capacitors like in Making Things Talk works just as well at a lower cost but higher parts count.