Go Down

Topic: Remote control tank via PC program and arduino (Read 3 times) previous topic - next topic

drejcek


Hello to everyone!

I read some very interesting topics on forum and I decided to make one project. I have some experience with Arduino but not to be an expert :D I get one remote control tank which didn't work well. I take it to repair it, make some changes to control it via PC program and Arduino. I am thinking to control tank from PC program using Arduino MEGA and 2x XBee shield to control it wireless. Arduino MEGA will be in tank connected to LED lights and motors. There will be also some sensors for battery status, GPS and etc. I was thinking to connect one XBee on Arduino MEGA, and another XBee connect to computer and control tank via program programmed in Visual Basics (here is link: http://www.acraigie.com/programming/firmatavb/default.html ) using computer USB joystick. I would like to control not only movements but also lights and some other thinks with push buttons on joystick.

USB joystick--> PC program <--> XBee connected on PC via USB <--> XBee connected on Arduino <-->Arduino MEGA <--> dc motors, lights, some sensors

I already make lights control and motor controlled program in Arduino via joystick and push buttons.  I saw on Arduino main page under examples that there is Firmata libary to implements the Firmata protocol for communicating with software on the host computer. But all this things are physically wired and connected on Arduino board via USB cabel and my question is if does anybody know if is possible to make it wirelessly using XBee? To be honest, I didn't read much about XBee :D and I don't know much. Are there any tricks to be carefull? Can it communicate in both ways?

If anybody have any questions please ask me!

Be good, have fun!

Andrej Z.

PaulS

Quote
But all this things are physically wired and connected on Arduino board via USB cabel and my question is if does anybody know if is possible to make it wirelessly using XBee? To be honest, I didn't read much about XBee and I don't know much. Are there any tricks to be carefull? Can it communicate in both ways?

The physical connections you speak of are the motors, LEDs, etc. that are connected to the Arduino. The USB cable is how serial data is transmitted between the PC and the Arduino. The (properly chosen and configured) XBees replace that cable. They wouldn't be very useful if they didn't communicate both ways, would they? Of course, they do, so they are very useful.

Properly chosen, in this case, means Series 1 NOT Series 2/2.5.

J.C. Woltz

#2
Oct 16, 2011, 06:41 pm Last Edit: Oct 16, 2011, 06:44 pm by J.C. Woltz Reason: 1
@drejcek,

If you do not already have the XBee modules, I would suggest looking into and getting RF100 or RF200 modules made by Synapse Wireless. The advantage over an XBee is the Synapse Wireless modules are programmable, have further range, and are competitively priced with XBees. Since the RFEngines (RF100 or RF200) are wirelessly programmable, you can upload a simple script to do what is called transparent serial to start off with. This will allow you to use them like an XBee to start off with. As you get more comfortable with them, you can program them to do more. So from the very start you can wirelessly program you arduino using them.

Here is an article someone wrote about them:
http://skaterj10.hackhut.com/2011/10/03/theres-a-new-sheriff-in-town-and-their-name-is-synapse-wireless/

I don't know why Future says "Call for pricing", but my last set of RF200's were less than $30 when I bought them:
http://www.futureelectronics.com/en/technologies/semiconductors/wireless-rf/rf-modules-solutions/802154-zigbee/Pages/6469811-RF200PD1.aspx

The RF200s use an ATMega128RFA1 as the main chip. They allow for a 2Mbit radio rate, use less power than the RF100, and have more flash space than the RF100.

The RF200P81 uses a chip antenna is you do not need long range, and are a little bit cheaper. My last order of those was around $20:
http://www.futureelectronics.com/en/technologies/semiconductors/wireless-rf/rf-modules-solutions/802154-zigbee/Pages/2012215-RF200P81.aspx

Like the XBees, these radios use 2mm pitch headers and you will need a board to plug them into.

Solarbotics makes an adapter so you can plug an RFEngine into an XBee socket if you already have a board with an XBee socket:
http://www.solarbotics.com/products/39252/
They also make a USB->RfEngine adapter for the computer side:
http://www.solarbotics.com/products/39250/

Synapse Wireless make a module (based on the RF200) to plug right into an xbee socket too:
http://www.synapse-wireless.com/documents/products/Synapse_RF_Engine_RF266PC1_Data_Sheet.pdf

Then, I make two board for RFEngine modules. The one I would recommend for you is the Breakout Board:
https://www.jcwoltz.com/breakout-board-for-synapse-wireless-rf-engine/
More details and pictures:
https://www.jcwoltz.com/2011/02/synapse-breakout-boards-updated/
The Breakout board is meant more as a "proto-typing" board. Where you can solder components directly onto it, or solder headers on and plug into a bread board.

Anyhow, my point is, if you have not bought XBee modules already, please consider the Synapse Wireless modules. I think you will be pleasently surprised by them. Synapse has a 3 minute intro video on this page:
http://www.synapse-wireless.com/index.php?mainID=3&subID=30&type=default
It is slightly dated, is a good into if you have not looked at Synapse Wireless before.

EDIT:
One more thing:
With the Synapse wireless modules, you do not have to worry about the whole Xbee Series 1 or Series 2/2.5 issues. It is very easy to have multiple node in a self healing mesh network. The RFEngine also have what are called RPC (remote procedure calls), so that any node can call a function on any other node. It is a very nice setup.

drejcek

Quote
The USB cable is how serial data is transmitted between the PC and the Arduino. The (properly chosen and configured) XBees replace that cable.


What did you mean with "properly chosen and configured"? How could I configure it?? Do you know for good tutorial how to configure it?? These days I read some pages and on every one I became confused :D

J.C. Woltz

Thank you for informations about RF100 or RF200 modules. I was looking on the market if there is anythink else like XBee.

Why would you like to recommend the Breakout Board? Is this like a XBee module to put on Arduino Board? And how much it costs? I was looking on product page and I couldn't found any informations about costs.

PaulS

Quote
What did you mean with "properly chosen and configured"? How could I configure it??

There are two basic kinds of XBees - Series 1 (point to point) and Series 2/2.5 (mesh network).

Properly chosen means you get the right kind of XBees for your project. If you want one point to talk to exactly one other point, then Series 2/2.5 are the wrong kind.

How to configure the XBees depends on the series. For series 1, PAN ID, MY and DL need to be set on each XBee. PAN ID is the same on both XBees. MY on one XBee needs to match DL on the other XBee. The exact value doesn't matter, except that neither can be 0 and they can't be the same (otherwise one XBee would be talking to itself).

J.C. Woltz


J.C. Woltz

Thank you for informations about RF100 or RF200 modules. I was looking on the market if there is anythink else like XBee.

Why would you like to recommend the Breakout Board? Is this like a XBee module to put on Arduino Board? And how much it costs? I was looking on product page and I couldn't found any informations about costs.


I've been using Synapse Wireless rf engine for a year and a half now. When I started using them, there were not any breakout boards available cheaply (around 10). On this page: https://www.jcwoltz.com/breakout-board-for-synapse-wireless-rf-engine/, If you click the Buy Now button under the breakout board, it is $12.50 with the smt (vreg and power filtering) assembled. I will sell Bare PCB + 12 pin 2mm headers for $7. If you have your own 3.3v supply, you do not need the vreg and caps. With that said, the Breakout Board is designed for multiple purposes:

  • Plug into arduino through FTDI Connector

  • Solder components directly onto headers inside or outside of the rfengine headers

  • Solder male headers on the bottom to plug into a breadboard or .600 wide 24 pin IC Socket



The breakout board measure 2 inches x 2 inches. You do not have to go with my breakout board. You can go with something else. My breakout board is meant to be an affordable and multipurpose. One nice thing about the RF200 (or RF100) series is that you can use them with arduinos to wirelessly program them. You can also Use an rfengine by itself as it has a programmable MCU. I used to have a bunch of XBee/Arduino combos. For my simpler nodes, I have replaced them with just a RF200. They are programmable in a stripped down python called SNAPpy. So Lets say you want to read an ADC every second (or every minute, or whenever you want), It is a simple program to read the ADC and send the data where you want.

As I said before, you do not have to use my breakout board. You could use Solarbotics boards if you want. Synapse Wireless makes some boards, but they are too specific and cost too much for my use. Also, If you are comfortable with Eagle and want to make your own boards, my design files are released under a CC BY-SA license. However, I really think you will like the Synapse Wireless modules. They provide example code for different purposes. One of the most basic examples is what is called "transparent serial" where serial into one node comes out the other and vice-verse.

Synapse Wireless also has some software they call Portal. They release it for Windows, Mac, and Linux. It compiles and uploads your scripts to the nodes over the air. The RF100/200 nodes have 2 serial ports, 8 ADCs, 20 GPIO pins, I2C, and SPI. (maybe more features than that. That is just off the top of my head of what I use)

I briefly mentioned RPCs before, here is a simple, but more thorough example:

  • Node 1: A refrigerator with a CDS (light based variable resistor) and a temp sensor. It can be programmed to sleep for one minute (to save the battery). Every minute it can read the temperature and light level. After it does that, it can send an RPC to portal (or any other node you want). Portal can take that RPC and log it to a file. Depending on how your light sensor is hooked up, it could be on an interrupt pin to wake up and log when the door is opened.

  • Node 2: Hook up to your computer. Serial port 1 can goto Portal (but does not have to) for script changes, or arduino code upload

  • Node 2: Continued. Serial port 0 can goto another serial port on your computer to read an transmit the data from your program (that sends the joystick commands)

  • Node 3: On your tank. One UART can goto the arduino UART. This can be for wirelessly programming you arduino and serial data from your computer program during normal operations. In portal you can call RPCs on any node if you want. You could have lights or other switches on the GPIOs on the rfengine if you wanted.



With XBee series 1, you can set up two XBees in a wireless Serial mode, but only those two xbees talk to each other. With Xbee Series 2/2.5 you can do a mesh, but for what you want, you can not really have more than 2 xbees talking serial to each other.

With the Synapse Wireless modules, you can have 2 or more units talking to each other. You could have 2 main units doing what is called transparent serial. You could also program them that when a pin changes on one unit it can change a pin on another unit, send out a serial message, call an rpc on any other unit, etc... The possibilities are too many to list.

All I can really say, the RF200 units are nice. Their prices are very close to the XBee when you compare similar units. Here is a product brief for the RF200 including pinouts:
http://www.synapse-wireless.com/documents/products/Synapse_RF200PD1_RF_Engine_Data_Sheet.pdf
If you do not need the 3 mile LOS range, the RF200P81 uses a chip antenna:
http://www.synapse-wireless.com/documents/products/Synapse_RF_Engine_RF200P81_SM200P81_Data_Sheet.pdf


Another thought: If you do not need the USB Joystick and computer program, you could make a handheld remote control:
you could use a thumb joystick like this: http://www.sparkfun.com/products/9032
with a breakout board like this: http://www.sparkfun.com/products/9110
wire up a couple of push buttons, put it all in a project enclosure.
on the rfengine side, use two of the ADCs to read the joystick, hook the push buttons into GPIOs on the rfengine. It would be a fairly simple program to read the state of the ADCs and GPIOs, then send an rpc to the other rfengine. You could code the receiver to send out serial commands to the arduino mega. just a thought.


drejcek

Hey!

Thank you PaulS for all you informations how to configure XBee modules. My friend borrowed me two XBee modules and they both working fine until now.


And thank you J. C. Woltz to let me know about RF200. You give me a lot informations. You told me a lot of good things why to buy it. I will think about it!


Thank you both! Have fune, be good!

Regards, Drejcek

skater_j10

Hey drejcek I'm glad that you were able to get the Xbees figured out! It's tricky sometimes. I just wanted to add to all the great info that J.C. Woltz had suggested to help anyone else wanting to do this kind of project. Myself and freind of mine ended up doing this exact kind of project just recently and posted the results here.

The gist of it is that you can use the Synapse nodes with or without an Arduino, it all depends on how much python code you'd like to write as opposed to Wiring, and also how much you're willing to spend on hardware. Using synapse modules alone can save you quite a bit as you wouldn't need to adapt your node to the Arduino with extra hardware or use an Arduino at all. The trade off is that you'd have to learn how to write SNAPpy (python based) scripts, which truth be told isn't all that bad, there are lots of examples included with the Synapse wireless software: Portal, plus more user submitted examples in the Synapse forums.

Go Up