View Full Version : Need some xbee to PROP Help!

Kevin Pace
05-28-2010, 03:38 AM
I am a school teacher working in Va Beach and have been working on running robots with the PROP.·
I currently have had success running the Robots with the PS2 Controller thanks to some help from the Parallax crew!·

Anyway, I am attaching some code I have been using for running the Robots through the wireless pS2 link.· What I would prefer to do is run the serial data from a PS2 Wired controller into a PROP/XBee Transmitter board and over to a PROP/Xbee Receiver board.·

I already have a pair of boards constructed and have been able to test my xbee units in the xctu software.· I have been able to use the Parallax Serial Terminal to receive the packet of 11111's on the receiver side, but I can't get any data from the controller when I push the buttons.·

I'm attaching the files I am currently working with.·

I'm moderately familiar with Spin Code and I do have the "Offical Guide to Programming and Customizing the Multicore Propeller Microcontroller.·

I have been combing over the chapter on Wirelessly networking Prop Chips and although I have completed several of the xbee tasks such as the PC to xbee communications·where the xbee's were recognized and restored to default configuration as well as the Sending data from the prop to PC section Im a bit lost on what code I will need in the PS2.xbee Test file I have attached.·

Any help would be appreciated as well as any guide to resources.


05-28-2010, 03:41 AM
You can only transmit serial, not PS2 commands. I haven't viewed your code, but you will need a micro on the PS2 side to send as serial.

Check out my new website!! (http://microcontrolled.propmodule.com/home.html)

Use the Propeller icon!! http://www.proptools.org/images/Propeller.gif

Follow me on Twitter! Search "Microcontrolled"

John Abshier
05-28-2010, 04:11 AM
On the transmitter I would do something like:

buttons := !ps2.Get_Data1

On the receiver:

buttons := xb.rxDecTime(ms)
then do what you need with buttons checking for -1 as a timeout

John Abshier

05-28-2010, 04:27 AM

Why wouldn't you be able to send PS2 commands as a serial string?

Microcontrolled said...
You can only transmit serial, not PS2 commands. I haven't viewed your code, but you will need a micro on the PS2 side to send as serial.

Kevin Pace
05-28-2010, 08:30 PM
Ill give this a try today. I do have a PROP on the transmit and on the receive side. I have the Xbee Rx connected to Pin 3 on the PROP and the xbee RX connected to pin 2 on the PROP. I have the LEd's on the TX and RX pins to monitor signals as well.

I am trying to send the PS2 (SERIAL DATA) from the transmitter xbee to the reciever xbee.

I have had some issues with trying to determine how to assign the xbee pins to PROP pins.

xbee pin 2 is PROP pin 3 and xbee pin 3 is PROP pin 2.

I have seen the examples of the assignment for the xbee pins but not the xbee connected to the PROP.

Thanks for the help!

05-28-2010, 11:18 PM
I am Mr. Pace's student working with the XBee and we have comunication working with sending as a decimal but we would like to send the data as binary. Is it possible to send the data read in from the PS2 controller in binary to the recieving XBee?

John Abshier
05-29-2010, 05:18 AM
I would read the Propeller Book chapter on using XBee. There might be a way to use API mode. The following is not tested. For transmitter

repeat 4
XB.tx(buttons & $FF)
buttons >>= 8 ' destroys variable buttons use a copy if you need to perserve it.

For receiver
buttons := 0
repeat 4
buttons >>= 8
buttons |= XB.rx << 24

I would probably send a start of data flag for synchronization, idealy something that could never be a valid value of buttons. THE BIG QUESTION IS, if it is working with decimal, why do you want to change to binary?

John Abshier

Chad George
05-29-2010, 10:26 AM
The TBOT uses xbee for wireless communications between robots and between Robot/PC.

We are still doing a lot of active work on the wireless drivers, but if you're willing to hop on board a moving project ... I think we have enough functionality currently in place to do what you need.

We use API mode because the AT serial emulation quickly becomes more of a problem than a help (like transmitting packets of binary data)

The simplest place for you to start is with our global memory mechanism. We setup a shared block of memory that is kept synchronized in all connected propellers (every XBEE with same PAN ID)

Say you have 10 longs of shared memory in an array called world[]

The transmitter will set world[0..3] to be output periodically.
then just fill this array on the transmitter with data from joystick (axis + buttons)

on the receivers just read from world[0..3]

simple and efficient ... perfect for remote control like you are doing.

there's other things our wireless driver can do like send / receive mail messages and create private "terminal" connections (kinda like the serial emulation mode, but between arbitrary xbee nodes)

also we're going to have remote programming and tight integration with 12blocks ... but for now the shared memory works well and I think that is sufficient for what you are trying to do.

You'll need to be able to run the X-CTU utility to reconfigure the xbees for API mode ... and you will need at least to have the XBEE TX, RX and RTS line connected to a propeller pin (connect CTS also but I don't think we're really using that right now)

If this sounds like something you'd like to try out let me know and I'll get you setup.