Monday, April 4, 2011

Wireless communication - Part I

After hours of reading multiple setup guides, I finally have achieved wireless communication between my controller and my laptop via two XBee radios!  It seems as if I was doing it right everytime I tried a new tutorial, but something wasn't working.  I found out that two things were wrong:  1) Some idiot mounted the XBee into the Arduino Fio incorrectly and had it in backwards... >.>   and 2) I was initially trying to setup the computer XBee as the sender and the arduino XBee as the receiver, when in actuality my project is going to require the opposite.

The one page that best sums up the necessary steps is this page from AdaFruit (the most important part is getting the X-CTU software to allow you to modify the settings on the radio(s)):

http://www.ladyada.net/make/xbee/point2point.html

Except that since I have an Arduino Fio, I did not need to rig a connection to the board... that's already been done for me.  I was also having some issues with the sketch sample at the bottom of the page (sometimes when I tried to transmit more than one character at a time it would garble them i.e. if I sent "1", I got back "1", but if I sent "123", I got back "12c").  So I went for broke and just re-uploaded my PS2 controller sketch, mounted the transmitting XBee to the Fio, connected up the serial port on my laptop via FTDI cable, and hit reset on the Fio.  BINGO!  Serial communication achieved.  Next up, modifying my motor demo sketch to look for serial input and hope my luck can continue...

No comments:

Post a Comment