Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Physical Computing with Arduino: XBee Wireless

0 (0 Likes / 0 Dislikes)
[ringing sound] [ADOBE DEVELOPER CONNECTION] [Kevin Hoyt - Platform Evangelist] Hi, I'm Adobe Platform Evangelist Kevin Hoyt. In this series we've been talking about connecting hardware with Flash, [Wireless Transmitting from Arduino to Flash] specifically Arduino hardware electronics prototyping platform into Flash. We've done a lot of really amazing things in this series: putting a variety of sensors on top of this guy and then connecting it via this USB cable, so something like this, which is our tri-axis accelerometer, which we've been able to put on top of the Arduinoi board via the shield mounting and then plug that in via USB to the computer. Now that's done some pretty cool stuff so far. But the problem is this guy, really. If I'm playing a game and I put this in a controller and if I get excited and it's attached to my computer, the obvious is going to happen. It's going to get yanked out, it's going to break the computer. Or maybe if I'm doing something like measuring temperature and humidity over a long-term duration, I don't want to put the Arduino attached to my computer out in the snow and rain. That's not going to be any good either. So having that USB cord is cool but kind of limiting. So the good thing about this is that the Arduino can run on its own using the power adapter instead of USB power. So we can plug power in here and then go ahead and power this guy's standalone, and that might be a wall jack, it might be a battery pack or what have you. So then we can run this guy separately off in its own little world and we then need to get the data from the Arduino board back into Flash to visualize it and do stuff with it. I already have the accelerometer program from a previous session already on the board, the accelerometer hooked up. What I'm going to use for wireless connectivity is this guy. This is another shield that pops on top of the Arduino, and I'm just going to go ahead and do that now. This particular shield is what's called an XBee shield. An XBee is a short-range, battery conscious, if you will, version of your traditional WiFi. These little guys have their own little antenna built in, they are very wise about the amount of power they consume, and they have various ranges. You can get them at a lower cost for a few hundred feet, or you can get them at a higher cost for a mile or more type of range. So some interesting potential capabilities coming out of that. Then I'll go ahead and put my prototyping shield on top of that, and now I've got this deck that essentially can stand alone and transmit data when it has power. Now, getting that into the computer since it's not traditional WiFi-- we'll cover that in another session at a later date-- but since this is not traditional WiFi, I'm going to need to actually get that into the computer somehow, and I'm still going to use a USB cord, but in this case I'm going to use its little brother chip over here, and we'll plug that into the USB and then put this into the system. So what happens is this is the little RF radios that are really indifferent. When you get them, you can program them to either be receivers or broadcasters. There's more information about how to program them on my blog, blog.kevinhoyt.org But in this case, this guy attached to the computer is a receiver, and the guy on board this deck is a broadcaster. This guy sends out, this guy receives, and it goes into our computer. Getting data from the serial port into our Flash program means using a serial to socket proxy. We've been using serproxy, also called TinkerProxy, for that to date in all the other sessions, just kind of behind the scenes. But this time we've actually changed the interface. It's no longer the USB from the Arduino that's connected; it's now the USB from this XBee short-range RF radio that's connected. So we have to change our TinkerProxy or serproxy settings. I've opened up the configuration file here, and I have the XBee settings already commented out. I'm going to uncomment them and comment out the traditional Arduino lines. You might again wonder where I got the [/dev/cu.usbserial - ] number, number, letter, letter, whatever. There are lots of different ways to do it, but I got that by going to Arduino, the IDE, going up to my Tools menu, going over to the Serial Port, and then actually seeing the listing of what's there. It's not actually technically Arduino attached, but the menu still tells you what's attached to the system, and so it's helpful for gathering that information. I'll save my configuration file, go the command line, where I'll go ahead and run that serproxy or TinkerProxy go-between for this USB into the application. That's running, so now the only thing I need to do is power this guy up, give it some power. So I have a battery pack here, a little 9-volt battery, and I'll go ahead and connect it to the power port and turn it on. So I was telling you this guy is very battery conscious, so it doesn't take much to keep him going. Now we've got this guy transmitting, this guy receiving, so now we can go over into our Flash program. This is the same Flash program that we used in the previous accelerometer session. I'm just going to go ahead and run it again because it's connecting off to TinkerProxy and gathering that data. Now as I have this standalone unit and tilt it, the image in the application gets tilted as well. Left, right, up, down. I think actually it's this way. There, there, there, there. [chuckles] All right. So now we're broadcasting wireless, so now this guy can stay safely indoors or remote from the action and then we can go ahead and put this guy elsewhere, in this case using a battery. You might use solar panels, you might use a wall outlet, an outdoors wall outlet with an extension cord or whatever the case may be. Now all you have to worry about is how to protect this guy itself from the rest of the damage. Personal tip here: I like to use Tupperware containers. You just screw it in to the Tupperware, a really nice, seamless, watertight container. But you might have other options you enjoy as well. So that's it for wireless enabling our hardware for Arduino to Flash communication. [For more information - sparkfun.com, arduino.cc] Lots more to come in this hardware series. I'll catch you next time. Until then, I'm Kevin Hoyt. [ADOBE DEVELOPER CONNECTION]

Video Details

Duration: 7 minutes and 4 seconds
Country:
Language: English
License: All rights reserved
Genre: None
Views: 232
Posted by: adobetv on Oct 21, 2010

Connecting your Arduino to your computer via USB presents limitations. Join Kevin Hoyt as he removes those limitations using XBee wireless for remote data capture into Adobe Flash applications.

Caption and Translate

    Sign In/Register for Dotsub to translate this video.