2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Tue Feb 19, 2013 12:30 pm

Hello !

I have 2 Xbees Series 1. They communicate and send a packet with no problem, FiNALLY. :D

My Remote/Transmitter Xbee has an Adafruit Joystick with Sel Button and a common 3.3 volt supply and common ground to all (no arduino). I connected X wire to pin 20 on the Xbee, Y wire connected to pin 19 Xbee and in the setup I'm using those as ADC.

My Receiving/Coordinator Xbee will be connected to an arduino and control motors from the Xbee ADC signal of the remote eventually :D Still have to figure out how to extract the information from the packet in an arduino sketch. Every book and post I read never give a clear example of actually showing how to identify the part of the packet that came from a particular pin of the transmitting Xbee. But, that's another post................don't understand how to change from hex to decimal in a sketch.

For now the Receiving Xbee is connected to the PC via X-CTU. When I turn on the remote packets come through the receiver side, but when I push the joystick none of the values for the adc change. 00 00 03 FF 03 FF are the values I get and I have the settings to monitor any pin on the receiving side. I've uploaded my settings from each module.

Is it true that ADC only takes 1.2V because when I check the voltage of my joystick it registers 1.6V centered, 0V all the way to the left, and 3V all the way to the right. Is this OK ? If not how do I get the voltage on the joystick down to 1.2V for the first 2 wires that are ADC ? I hope someone can help me. I'm losing hair,.........pulling it out for days :x

Oh, do I need the Pull-Up Resistor on the transmitter end activated ? Does that setting cover all the pins ? I'm a Xbee noob, so thanks for your patience. If you live in Austin, TX and help me get this going - FREE LUNCH REWARD ! :D Thanks AGAIN EVERYONE !!!
Attachments
transmitter.txt
If you change file name to "transmitter.pro" you can load in X-CTU
(615 Bytes) Downloaded 26 times
receiver.txt
If you change file name to "receiver.pro" you can load in X-CTU
(622 Bytes) Downloaded 32 times
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Wed Feb 20, 2013 10:56 am

Please, I just want to know if I need 1.2V maximum to go to an ADC enabled pin on the Xbee ? Please help...........adafruit support ?

Thanks
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by adafruit_support_rick on Wed Feb 20, 2013 11:40 am

Have you got a voltage reference attached to pin 14?

You don't need a pull-up for analog inputs.
User avatar
adafruit_support_rick
 
Posts: 8575
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Wed Feb 20, 2013 12:26 pm

No voltage reference on pin14. Wouldn't know how to add such a reference. Could you elaborate? Thx about pull up resistor.
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by adafruit_support_rick on Wed Feb 20, 2013 12:32 pm

The voltage reference is what the joystick readings are compared against. If you have nothing connected there, then your joystick readings are being compared against 0V, which is why they're stuck at the maximum value of 0x3FF.

Connect a jumper from 3.3V to the VREF pin. Your joystick readings will come back as a fraction of 3.3V, multiplied by 1023. For instance, if your X has a value of 1.2V, then the reading will come back as ((1.2/3.3) * 1023) = 372 = 0x174.
User avatar
adafruit_support_rick
 
Posts: 8575
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Wed Feb 20, 2013 1:33 pm

Thanks Driverblock !! That makes a whole lot of sense now you have explained it clearly and simply. I'm going to try and let you know either way. I really appreciate it ! :D
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by adafruit_support_rick on Wed Feb 20, 2013 2:54 pm

You're welcome. The XBee docs don't do a real good job of explaining it, do they?
Good luck! :D
User avatar
adafruit_support_rick
 
Posts: 8575
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Wed Feb 20, 2013 3:36 pm

That worked !!! However, I think the pins it's monitoring is off. I have X axis on pin 20 ADC (AD0 - 10k pot), Y axis on pin 19 ADC (AD1 - 10K pot), and pushbutton on pin 18 (AD3 - DI).

Here is my packet:

7E 00 0E 83 12 34 25 00 01 06 04 00 00 02 08 01 FB 00

Am I supposed to have 22 bits in the packet and not 18 ?

12th thru 18th bit seems off. After the 06 04 there is a 00 00 then it appears the 2 pots are in a neutral position of around 500 which is GREAT ! But, when I press the pushbutton that first value never changes after the 06 04. The 10th and 11th bits tell the channels that are open right ? I think this is off somehow. Thanks for ALL assistance ! :D
Last edited by Shaputer on Wed Feb 20, 2013 4:09 pm, edited 1 time in total.
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Wed Feb 20, 2013 3:38 pm

driverblock wrote:You're welcome. The XBee docs don't do a real good job of explaining it, do they?
Good luck! :D


Xbee docs make good toilet paper :lol:
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Thu Feb 21, 2013 11:50 am

HELP PLEASE !???

When I push the joystick on the Adafruit Selection switch shorts to ground. As far as Xbee pin connection would the selection button be DO LOW or DO HIGH on the transmitter side ? On the receiver side I have the pin set to DI. Nothing happens for that pin DIO2 in the packet. It just says 00 00 no matter how many times I press the joystick button. Bits 12 and 13 should be the DI information is that correct ? Thanks a lot !! :o
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by adafruit_support_rick on Thu Feb 21, 2013 1:58 pm

If the joystick is on the transmitter side, then that XBee pin should be set to digital input, and the receiver pin should be digital output.

When you push the button, the select line will go low. Do you have a pull-up resistor on the select line? If not, the voltage on the select line will float when the button is not pushed, and you won't get reliable readings.
User avatar
adafruit_support_rick
 
Posts: 8575
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Thu Feb 21, 2013 2:12 pm

Ah, my thinking was reversed. I'll try it and get back to you. Thanks Again !!!


Was trying to get the arduino Xbee sample IO sketch to work on the analogs. Nothing..........I'll keep trying on that one. Does the Xbee have to be plugged into PWM pins on the receiver side ? I'm using 2 and 13 cause I'm using Adafruit motorshield and those are the only 2 pins I have. Gonna remove the shield until I get the program working. One baby step at a time :)
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by Shaputer on Thu Feb 21, 2013 2:42 pm

On Transmitter Side:
PR = 2 (for DIO2)
DIO2 = DI

On Receiver side:
DIO2 = DO LOW

Still nothing works for that button and I check the select wire to make sure it's securely soldered to pin 18. :twisted:
Shaputer
 
Posts: 22
Joined: Tue Feb 19, 2013 12:03 pm

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by adafruit_support_rick on Thu Feb 21, 2013 3:18 pm

What about the pullup resistor on the select line? You gots?
User avatar
adafruit_support_rick
 
Posts: 8575
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: 2 XBEES - -1 Arduino - 1 AdaFruit Joystick ID: 512

by adafruit_support_rick on Thu Feb 21, 2013 3:41 pm

Have you looked at this page? The first section covers I/O line passing, like you're trying to do.

Also, I just noticed on Page 34 of the user guide that you can enable an internal pullup on a digital input:
Code: Select all
ull-up Resistor Enable. Set/Read bitfield to configure internal pull-up resistor status for I/O lines
Bitfield Map:
bit 0 - AD4/DIO4 (pin11)
bit 1 - AD3 / DIO3 (pin17)
bit 2 - AD2/DIO2 (pin18)
bit 3 - AD1/DIO1 (pin19)
bit 4 - AD0 / DIO0 (pin20)
bit 5 - RTS / AD6 / DIO6 (pin16)
bit 6 - DTR / SLEEP_RQ / DI8 (pin9) bit 7 - DIN/CONFIG (pin3)
Bit set to “1” specifies pull-up enabled; “0” specifies no pull-up
User avatar
adafruit_support_rick
 
Posts: 8575
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY