Mechanics and Construction > Mechanics and Construction

Need help with Visual basics and xbee



I need to make a robot that i can control via pc (with arrows). The mikrocontroller that i got for this project : ATmega2561 , this 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!

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.

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.

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.

wow thnx for the fast and good responses , really helped me out , will try to get it working


[0] Message Index

Go to full version