Society of Robots - Robot Forum

Mechanics and Construction => Mechanics and Construction => Topic started by: maitkaa on January 20, 2013, 05:26:38 PM

Title: Need help with Visual basics and xbee
Post by: maitkaa on January 20, 2013, 05:26:38 PM
Hello

I need to make a robot that i can control via pc (with arrows). The mikrocontroller that i got for this project : ATmega2561 , this http://home.roboticlab.eu/en/hardware/homelab/combo (http://home.roboticlab.eu/en/hardware/homelab/combo) and a seperate sensor board and motor board and a screen with 3 buttons. I have never used xbee before and i have 5 days to compleate the project. So i really would like some help. you can even point me to some tutorials.

PS. i am not trying to get the whole code! just how the connection between xbee and vb will look like .

Thanks in advance!
Title: Re: Need help with Visual basics and xbee
Post by: waltr on January 20, 2013, 07:13:03 PM
Xbees uses asynchronous serial (look up in Wiki for what this is).
The XBee would connect to your PC's RS232 Com port through a TTL to RS232 level translator.
The other XBee would connect to your ATmega's UART pins. Assuming you are using Series 1 XBees running 802.15.4 in 'transparent mode' (see the XBee's document). If you are using any other XBee module then you need to post the exactly model number and the firmware version.

In the VB code you 'open' the Comm port and send/receive data. Google will find you examples on how.

All the XBees do is put an RF link between the ATmega's UART and the PC's Comm port. What you should do first is connect the ATmega to the PC's Com port (with an RS232 level translator like a MAZ232 chip). Then get the code working on both.
Once the PC is talking correctly to the ATmega then, and only then insert the XBees. The ATmega code and PC VB code is exactly the same whether the XBees are there or not.

Also, do search and read the many other threads here on using XBee RF modules.
Title: Re: Need help with Visual basics and xbee
Post by: Mastermime on January 21, 2013, 12:21:04 AM
I don't know if you HAVE to use Xbees, but in my opinion, bluetooth would be a lot easier.  You could even use Admins example code as a template and change the code to your application.  Admin's code is attached.  Just another option if Xbee doesn't work out for you.
Title: Re: Need help with Visual basics and xbee
Post by: jwatte on January 21, 2013, 11:59:39 AM
Xbees in "transparent" mode (firmware type 1) are super simple. If you have a serial port (UART) on the microcontroller, and an adapter for the PC, then it's as easy as a wire. Bluetooth is nice, too, but it doesn't go as far as Xbees, and it's no simpler than Xbees.
The one thing with the Xbees is that you first need to set them up to find each other (similar to Bluetooth pairing) -- you do this in the Xbee software in Windows. Once they "see" each other, they are a wireless wire.
Title: Re: Need help with Visual basics and xbee
Post by: maitkaa on January 21, 2013, 02:52:18 PM
wow thnx for the fast and good responses , really helped me out , will try to get it working