DIY Remote Control XBee controller for Robotics

I’ve always intended to build myself a wireless robot controller, once I have a robot to control (WALTER is getting closes to operational again now). However, I am more interested in using an Atmega series micro and XBee modules. I already have two of the Series 2.5 RPSMA XBee modules, and can use them as a simple serial cable replacement.

I’m just starting to look at the possibilities for this, and am reading all the stuff you and others have already done. For prototyping, I will use my AXON controller (Atmega640). It has 16 I/Os (all analog capable) that are set for 5V power, and three available UARTs.

8-Dale

I’m much more interested in developing software for this, so it would be great if I could get a kit with all the parts and case. I’d need a different cutout for the display though, because I want to use an AXON (Atmega640, 3 available UARTs, 16 analog capable I/Os) interfaced with something like a TouchShield Slide (320x240) display as the main processor. I’d use the Webbot library.

8-Dale

Has anyone considered taking a game controller apart, like maybe the PS/3 Six Axis controller, PS/2 controller, or other game controller, and interfacing the sticks and buttons to make a smaller robot remote? I’m talking about something just large enough to house the controller electronics, buttons and sticks, a microcontroller board, display, and an XBee.

I’ve been looking at my Lyxmotion wireless controller, and wondering what exactly is inside and how it’s put together…

8-Dale

Hi Dale,

I have had a lot of fun playing with the DIY controller, especially when I converted it to Xbee. There are still many things that I would like to enhance in both the Remote as well as the robot code.

It is currently using XBee 1s. When I get back around to it, I would like to convert this code to use the API packet mode instead of serial replacement mode. This would make it easier to do things like: have your robot talk to the controller and at the same time send status information back to your PC, to some VB app. While at it update the VB app to also include downloading sequences and the like. Also might integrate in something like the PS2 controller for the PC If I figure out how to get it to talk to VB… Having the ability to talk to multiple destinations without having to go through command mode, may make it easier to try things like have the remotes control multiple robots or maybe have a robot send commands to another robot… Lots of possibilities.

I was going to look into trying out version 2 XBees, I have a couple but one of them was bricked and no luck so far unbricking it… Also since V1 and V2 can not talk to each other and I now have probably something like 6 version 1s…

Yes it might be fun to convert the code to C and run on on an AVR based system like the Axon/Axon2 with webbotlib or maybe even to something like an Arduino or an Arduino Mega . It would not be hard to get it running on Webbotlib as I already have a Brat running with an Axon2 with DIY XBee code.

The current BAP28 system has more or less maxed out the IO ports, especially Zentas who has now sacrificed his speaker. Currently we use:
20 Buttons (keypad plus 4 others: 4 rows x 5 col = 9 pins
2 Joysticks with 2 axis: 4 Analog pins
2 sliders 2 Analog pins
1 speaker 1 pin
LCD display: 1 pin - Move to UART
XBEE 2 pins - Move to UART
(Was using 3 on Xbee for flow control… - Not needed with UART)

So it looks like you could do the current configuration with your Axon and maybe Arduino, but not sure about the serial IO on that one…
As the Axon has maybe 55 total IO pins, you could easily expand to add the two extra pots (or more) like Zenta did. As you mentioned you could convert over to something like Touch shield Slide to take over the buttons with only 2 IOs required which would also help. My guess is that you would still want some other real buttons near the joysticks to use for controlling things while you are doing things. Like fire weapons or the like.

I have also thought about trying out some different configurations. I like the current one as it is easy to move around with it (IE all in one). There are a few things I wish I could change, like being able to switch the joysticks from self centering to throttle types depending on what I want to do… IE when in tank mode I would like for both joysticks to self center, likewise if I wish to control the Arm on the rover using the controller like Backhoe type controls. By default I would rather have both joysticks be self centering as we can use the sliders for things like throttle control. Might also be fun to build a version that you can plug in two PC style joysticks, or maybe WII controlls…

Let me know if decide to do this, and maybe I will play along and build a second one. As I mentioned earlier it would be great if someone would package the whole thing up as a product or at least all of the hard to get pieces for DIY. I earlier did buy a cheap controller on Ebay that I was able to salvage a couple of joysticks from. Good Luck

Kurt

I see a lot of potential for upgrades also! :smiley:

My two XBees are the latest Series 2.5 units. Yes, indeed, being able to have the robot send status info back would be a great advantage. You could even switch robots back and forth on the fly this way, to temporarily take control of a wanderer. :slight_smile:

This would be really interesting! You might be able to dynamically alter a robot’s behaviors this way…

Yes, indeed! You could even monitor a robot swarm this way, with each being able to send info back to the wireless remote. :slight_smile: You could sit back and listen to what a swarm of robots are talking about, and step in and take control if needed. :smiley:

I will be adding XBee to all of my robots as I get them operational. Sometime next month I should have WALTER roaming around again as a 2WD. I finally found my Sabertooth 2x5 motor controller, and have at least one (maybe both are OK, not sure yet) working SSC-32 I need to upgrade to an Atmega168. I need to get WALTER all wired up and get back to writing the control code for my AXON.

I took a much closer look at the documentation for Webbotlib last night, and am not sure it would be appropriate for the DIY controller. I think a LOT of low level development might be required for converting to C on a controller like the AXON, and then you still have limited usable I/O (16 pins with regulated 5V and the rest unregulated battery power). I still wish Jim would create a good Atmega based robot controller in the same format as the BotBoard II - based on the Atmega1280 or Atmega2560 (only differences is amout of flash and ram). Basically, I’d like to see an Arduino Mega setup for robotics with all 3 pin headers, UARTs brough out to headers, I2C and SPI on headers, etc. But, I wander, :wink:

OK, now you’ve gone and done it! It looks like the only way to progress with this project, and still be able to leverage existing code, is to move everything to an Arc32 board. OK, now I am sold on getting an Arc32 board and getting back into working with Atoms. I dusted off my BotBoard II with the Atom Pro on it last night, and I have Basic Micro Studio already installed - but am sure it isn’t the absolute latest alpha/beta.

At minimum, I’d want to go with an Arduino Mega compatible board, but the Mega is not set up for robotics at all. I’m draming of an Arduino Mega compatible board that is still 100% Arduino Mega compatible (as in all current and future shields work with it) that also has 3 pin headers for all I/Os as well as what I specified above. It would be programmable using the Arduino IDE as well as in straight C using AVRStudio and WinAVR. This would be one seriously rocking controller! :smiley:

The trick would be how to enable/disable the self centering of the sticks. I’m not sure that is workable.

I’ve already considered the possibility of adding a Wii Nunchuk controller. :slight_smile: It’s an I2C slave device. :smiley: I just spotted a BlueTooth module on SparkFun that can do HID and pretty much anything else doable with BlueTooth. The WiMote is a HID device. :smiley:

I really think I could add to this project, and I really want a good wireless robot controller. I really like the idea of having a larger (320x240) graphics capable display. There is a smaller display shield based on the Nokia 128x128 unit that’s only $39.95 at SparkFun that might be a way to experiment at a reasonable cost. I plan to get one of these to try out some ideas I have. I’ve already been working on code that allows an Arduino (Atmega328), Sanguino (Atmega644), or Arduino Mega (Atmega1280) to be remotely controlled over a serial link. I just squashed the last bug in my current software this morning. :slight_smile: I want to make this work via I2C also. I/m am starting to experiment with I2C on my Arduino now and have four different I2C slave devices to work with now.

This is a great project, and it would give me something to work on when I can’t do anything on one of my robots. I am getting so many ideas that I’d like to experiment with. Now, I need to connect up my BotBoard II/AtomPro and make sure everything is working. I may need to get a new BotBoard II though, because I may have some unusable pins.

8-Dale

The code is already in place to allow you to switch which robot you are going to control. Zenta showed it in operation in has latest Podcast :smiley:

But to do this, I have to have the Xbee enter into command mode, which implies waiting a certain amount of time with no IO to the XBEE, then output +++ and wait for some amount of time (Guard time), then enter the appropriate commands, like: ATDL … And finally exit command mode: ATCN. I then send off a message packet to the new robot saying he is active and he should talk back to me on a specific ID. It would be simplier with API mode where each packet contains the ID of who I am sending the packet to as well as my own id so they can talk back to me…

I have XBees on most of my robots, on some of them I still have PS2 controllers on them as well…

I understand what you are saying, but I do think the Axon would work fine for the DIY. For example the 9 inputs we currently use for the keypad and other buttons would work fine on the digital pins with VS. You would use the internal pull-up resistors on the input pins(4 or 5 depending on which way). On the logical output pins, you would walk through each pin setting it LOW and let the others be INPUT pins. This way if you push a button, the appropriate input pin will go LOW and the others will stay high by the internal pull-ups. And by setting the other output pins to be input pins instead of setting them to HIGH, you don’t have the risk of a dead short if you push multiple buttons at the same time. I think would setup an Arduino the same way. In Webbotlib you can use the functions in iopin.h to do this and my quick look through the Arduino SDK this is handled by PinMode(…), DigitalWrite, DigitalRead.

For the Sliders and Joysticks, would use AtoDConvert10Bit to get the readings and likewise AnalogRead() on the Arduino.

I have most of the stuff in place for the XBees using UART stuff as well as rprintf. On Arduino, use Serial class? Have not looked into this much. Would probably take over my Printf functions from C on Bap28… The same goes for LCD, as it would be simple UART code plus RPRINTF. Nice thing here again is that for both of these we can turn on IO buffering with interrupts, so don’t have to worry about losing anything, nor worry about interrupts screwing up our bit bang serial output.

It sounds like Walter is coming along well.

Yah, as you mentioned it would be great if someone would come out with an Arduino Pro type board with 3 pin headers and the like. I resisted playing with Arduinos up till now because of the pain to more or less have to use a breadboard to make them do anything… But I ordered one last week when I found one for under $40. nkcelectronics.com/seeeduino … mbled.html Not sure what I will do with it, but thought it would be fun to play with. :smiley:

Got to go!
Kurt

I saw that. :smiley:

It definitely sounds like API mode is really the way to go. Dealing with the wireless serial cable mode seems like it will be holding back progress, or at least make it a lot harder to do stuff.

I have not yet done anything with PS2 control, but I do have the nice Lynxmotion wireless controller here. I just need to get some batteries for it and start tinkering with it.

There is another way to go for handling buttons also. The Microchip MCP23017 (I2C) and MCP23S17 (SPI) is a digital input expander that has 16 bi-directional I/Os. It works very well!. No need to use precious I/Os - just I2C (my preference) to talk to the chip.

Yes, that’s the way to do it. I also have some nice 8 channel analog input chips, but I think they require SPI - I’ll have to check.

I posted my latest code for the Arduino serial slave in my “Meet ASTRID” thread earlier. It shows how to do serial I/O with Arduino. The nice thing about the AXON is it does have rprintf() which can be directed to any of the 4 UARTs. I switch between the SSC-32, XBee, and console ports as needed and then just rprintf() whatever I want. It’s nice to have the formatting capability.

I’m to the point where I can wire everything up and start writing control software for the AXON. :smiley:

You can get a Sanguino kit for $25.00 that is completely breadboard friendly - just plug it in and start wiring things up. I use my regular Arduino for wiring up stuff to play with remotely. The Sanguino lives on my breadboard. There is a shield kit available for the Sanguino that brings all the I/Os out to screw terminals. I bet it would not be too difficult for a knowledgeable Eagle user to replace the screw terminals with 3 pin headers. At first, when I got my Arduino, it just sat unused, but now I am finding it is a real pleasure to work with, even though the IDE 018 has several problems (still).

If I knew where to get the parts, I’d pick up at least some stuff for the DIY, but the case would be the real issue for me because I have no way to make one or make the cutouts in the front panel. However, I already have my hobby money allocated for next month, so it’s going to be awhile before I can start making a DIY for myself. :frowning:

8-Dale

I have been thinking about the Arduino Mega a bit more. The better way to go would be to design a shield that accomplishes all the things we require for robotics. It probably would not be difficult for one who is proficient with Eagle to modify the Mega schematic and board layout to provide all the 3 pin and other headers required for robotics or to design a shield to accomplish all that.

I’m completely sold on helping with the Atom Pro based code but also want to work on a version for the Arduino Mega. I think the only way to progress with the Atom based code is to go to the Arc32 board because it has so much more I/O (digital and analog) available and remains compatible with current Atom Pro based code, except possibly for timing based routines due to its increased clock speed (another benefit).

I’ll shy away from the AXON for this, at least for now, because there would be much more low level work that would have to be done, such as writing routines like pulseIn(), pulseOut(), and others. These are already available within the Arduino environment and there are already many addon libraries that might be useful.

8-Dale

Sounds good.

Not that I am trying to talk you into the Axon, but webbotlib does also have those functions as well. They are in iopin.h.

Can not say much (yet) about the Arduino and/or shields, still learning. But it does look like fun. Currently reading Getting Started with Ardino book by Massimo Banzi, and browsing through some of the code. The Arduino Pros sparked my interest as they are Atmega1280 based like the Axon2. I like the 4 UARTS, lots of IO, lot of 16 bit PWM channels… Will be fun to see how well the default code make use of the features of the processor or do you need to extend it to get to all of the features.

I also like the Arc32 board. It has lots of IO pins and two UARTS, 20mhz doesn’t hurt either :slight_smile:

Lots of stuff to play with.
Kurt

I will take a closer look. I really do like the Webbotlib, and v1.19 is available now.

The Sanguino kit is the least expensive way to get into Arduino at $25.00 plus s&h and it has a valuable second UART as well as more I/O than a standard Arduino board. I do all new development on my Sanguino. It’s connected to four sensors right now. I’ve put a set of six 3 pin headers on my breadboard. :slight_smile:

So, should this be our next path - to get everything working on an Arc32 with no more change than necessary and then start tinkering? I don’t know when they are going to be officially available, but I will put my Trossen order on hold and wait to get one if this is where you want to go next. I think the Arc32 is pretty much a no brainer for this. :slight_smile: I’m majorly interested in this DIY project, so am willing to do what I need to do in order to participate and contribute. There are a couple small joysticks I would like to get from SparkFun and try out. With all that analog I/O on an Arc32, we could add a 3-axis accelerometer (I have the SparkFun ADXL330) too!

For sure! :smiley:

8-Dale

P.S. I just plugged my BotBoard II/Atom Pro in and successfully programmed it. :smiley: If you send me your current code, I can start looking at it. :slight_smile:

Hi Zenta (and others),

I think this should be the complete VB 2010 version of the PC remote control stuff… :blush:
Let me know if this loads properly…

Kurt
DIY XBEE VB APP.zip (157 KB)

Thanks for the update Kurt! That’s much better, I got a successful build. No errors this time. :smiley:

BTW: Are you using the latest 2010 (10.0.30319) or one of the beta releases? I’m asking because I got a question of conversion at first.

I think I am using the released…

Kurt

I have a question about building this DIY remote. I am pretty sure I can handle installing all the components into the case/front panel and wiring of components inside to the controller board and such. However, I think getting a good front panel made is my real problem. I have no way to make the front panel the way I want it. For instance, I would like three sticks instead of two, and a different display. If I get the dimensions of the front panel and the size of the various holes for components, I can easily design the panel the way I want it, but would need to get somebody to make the panel for me.

Would somebody be willing to make the panel from my design?

8-Dale

Hi Dale,

I probably would not be much help here. I only have things like table saw, chop saw, scroll saw and hand drills… I can make holes, but they would not be pretty :laughing:

Kurt

I know the feeling. :slight_smile: All I have is a Dremel Tool to work with. Where do you get your components, like the sticks?

8-Dale

Robot Dude made maybe 5 of these DIY remote controls and I was lucky enough to get one one them!

I did get some more sticks to maybe build another one and I did it by going up to EBAY to buy a cheap VEX transmitter. The problem is that personally I would prefer that both sticks self centered, so to do that I would need to buy two of these… You might also look for some Hitec or futaba… receivers on ebay as well.

Kurt

Yep, I made the DIY radios as an expression of thanks to several of the more helpful forum members. I dropped the ball last year and didn’t do anything special. But I intended to continue to do things like that as time and resources permit. Unfortunately I am not able to make any more of these radios until I get a good source for the gimbals. Hitec teased me about making them available, but nothing has materialized yet.

If you go up to ebay and do a search: RC transmitter, you will find that you can order some new receivers from places like Hong Kong for about $18, which you can probably tear apart to extract the gimbals. Obviously this would not be a viable way for Lynxmotion to build a product, but would work for someone who wants to build their own.

I have also thought about trying some of these: sparkfun.com/commerce/produc … ts_id=9032
or maybe: sparkfun.com/commerce/produc … ts_id=9426

Then add some sliders: sparkfun.com/commerce/produc … ts_id=9119 and the knob…

Grab your favorite LCD display and keypad and/or touch screen

Then back to the hard part, building a case and top panel, with machetes and pitch forks :laughing:

Kurt

Kurt,

The questionable quality of the little PS2 joysticks are the reason Zenta made the switch to his modified Futaba and eventually to my making the DIY radio in the first place. :wink: