Shop OBEX P1 Docs P2 Docs Learn Events
Xbee works in activity board socket but not when hard wired — Parallax Forums

Xbee works in activity board socket but not when hard wired

solder_fumessolder_fumes Posts: 18
edited 2015-02-24 15:22 in Accessories
I have a reason to want to use two xbee modules on my activity bot.

The purpose of the "second" xbee (the one that will be hard-wired, i.e. not using the xbee socket on the activity board) is to report the bot's battery pack voltage.

The problem I'm running into is that the code works fine when I have the xbee plugged into the activity bot socket...it sends the data as expected. But when I hard wire it, and change the code to use the DO and DI pins I've selected (in my case DO pin 6 and DI pin 5), I don't see any received data. If I plug the xbee back into the activity board socket and change the DO and DI's accordingly, it works as expected.

From looking at the activity board schematic, it seems that the only connects are supply voltage, ground, DO and DI (I see that RTS and CLS are also used, but I'm not jumping those to anything when the xbee is in the socked, so essentially it seems that I have it hard wired just as it's wired when it's in the socket, yet it doesn't transmit.

I have no reason to think it's a coding problem, and the code doesn't change from one scenario to the other. I just move the xbee from the socket to jumper wires.

Any thoughts?

Thanks,

John

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2015-02-23 16:23
    John,

    It could be any number of reasons. How are you hard-wiring it? Do you have a schematic and/or photos of how it is connected?
  • solder_fumessolder_fumes Posts: 18
    edited 2015-02-24 04:48
    Sure. You can see some details in the attached photos "doesn't work" and "works".

    FYI, for a receiver I'm using an xbee with the usb adaptor, and watching the data on the XCTU terminal.

    For clarification, xbee pin 3.3v pin goes to 3.3v header on the board, DO on the xbee goes to pin 6 on the board, DI on xbee goes to pin 5 on the board, and vss on the xbee goes to vss on the board. This doesn't work. Oh, I have a jumper going from the board 3.3v connection to the ADC 3 socket, just to give the program something to work with.

    With the same code, when I plug the same xbee into the activity board xbee socket and jumper DO and DI to pin 6 and pin 5 respectively, it works.
    /*
     Transmit voltage alias from robot
    */
    
    #include "simpletools.h"                      // Include simpletools
    #include "adcDCpropab.h"                      // Include adcDCpropab
    #include "fdserial.h"
    
    fdserial *xbee;
    
    int main()                                    // main function
    {
      xbee = fdserial_open (6, 5, 0, 9600);  
      
      adc_init(21, 20, 19, 18);                   // CS=21, SCL=20, DO=19, DI=18
    
      float v3;                                   // Voltage variables
    
      while(1)                                    // Loop repeats indefinitely
      {     
        v3 = adc_volts(3);                        // Check A/D 3
           
        putChar(HOME);                            // Cursor -> top-left "home"
       
       print("A/D3 = %f V%c\n", v3);              // Display volts
       
       if (v3 > 4)                                
      
       { 
          print("a");                             // prints voltage alias to terminal
          dprint(xbee, "a");                      // sends voltage alias to xbee
          high(0);                                // raises appropriate pins high to control 10 bar led
          high(1);
          high(2);
          high(3);
          high(4);
          high(5);
          high(6);
          high(7);
          high(8);
          high(9);
       }    
         
        else if (v3 >= 3.875 && v3 < 4.0)         // and so on per the above remarks...
        
       {
          print("b");
          dprint(xbee, "b");
          low(0);
          high(1);
          high(2);
          high(3);
          high(4);
          high(5);
          high(6);
          high(7);
          high(8);
          high(9);
       }
       
       else if (v3 >= 3.75 && v3 < 3.875)
       
       {
         print("c");
         dprint(xbee, "c");
         low(0);
         low(1);
         high(2);
         high(3);
         high(4);
         high(5);
         high(6);
         high(7);
         high(8);
         high(9);
       }
       
       else if (v3 >= 3.625 && v3 < 3.75)
       
       {
         print("d");
         dprint(xbee, "d");
         low(0);
         low(1);
         low(2);
         high(3);
         high(4);
         high(5);
         high(6);
         high(7);
         high(8);
         high(9);
       }
       
       else if (v3 >= 3.5 && v3 < 3.625)
       
       {
         print("e");
         dprint(xbee, "e");
         low(0);
         low(1);
         low(2);
         low(3);
         high(4);
         high(5);
         high(6);
         high(7);
         high(8);
         high(9);
       }
       
        else if (v3 >= 3.325 && v3 < 3.5)
       
       {
         print("f");
         dprint(xbee, "f");
         low(0);
         low(1);
         low(2);
         low(3);
         low(4);
         high(5);
         high(6);
         high(7);
         high(8);
         high(9);
       }
       
      else if (v3 >= 3.25 && v3 < 3.325)
       
       {
         print("g");
         dprint(xbee, "g");
         low(0);
         low(1);
         low(2);
         low(3);
         low(4);
         low(5);
         high(6);
         high(7);
         high(8);
         high(9);
       } 
       
        else if (v3 >= 3.125 && v3 < 3.25)
       
       {
         print("h");
         dprint(xbee, "h");
         low(0);
         low(1);
         low(2);
         low(3);
         low(4);
         low(5);
         low(6);
         high(7);
         high(8);
         high(9);
       } 
       
       else if (v3 >= 3 && v3 < 3.125)
       
       {
         print("i");
         dprint(xbee, "i");
         low(0);
         low(1);
         low(2);
         low(3);
         low(4);
         low(5);
         low(6);
         low(7);
         high(8);
         high(9);
       } 
       
        else if (v3 >= 0 && v3 < 3)
       
       {
         print("j");
         dprint(xbee, "j");
         low(0);
         low(1);
         low(2);
         low(3);
         low(4);
         low(5);
         low(6);
         low(7);
         low(8);
         high(9);
       }             
       pause(1000);
      }
    }   
       
    

    Thanks,

    John

    doesnt_work.JPG
    works.JPG
    640 x 480 - 186K
    640 x 480 - 181K
  • twm47099twm47099 Posts: 867
    edited 2015-02-24 07:28
    This is only a guess since I don't have my ActivityBot or Xbee documentation with me.
    I've been bitten a couple of times by the DO/DI connections when using a Bluetooth module.

    DO on the device (radio) has to go DI on the micro. I don't recall if the labels on the radio header by the breadboard are labeled with the Xbee pin labels or the micro labels. Comparing the ActivityBot schematic with the pin locations for the Xbee might help or with everything disconnected check the continuity of the Xbee socket DO/DI pins (DO and DI marked on the radio module or pinouts from the Xbee data sheet) with those on the the Xbee header.

    Hope this helps.

    Tom
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-02-24 07:41
    I can't really see the connections on the XBee well but I'm not sure all the pins are connected correctly. Based on my interpretation of the photo, it looks like Vdd isn't connected on the XBee.

    Are you connecting the jumper wires directly to the 2mm pitched pins of the XBee? If so, they might not be making a good connecting.

    Those jumper wires sure look long. Long wires can cause problems. In general one wants to keep connecting wires as short as possible.

    I think it's pretty safe to assume you have some sort of connection problem.

    I don't understand why you want two XBees. Can't you send battery voltage information from the same XBee you're already using?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2015-02-24 10:12
    I agree with Duane. Pins 1, 2 and 3 are the VCC, DOUT and DIN but it looks like you're connected to pins 2, 3 and 4. Pin 1 looks unconnected. I also agree about the pluggable wires. The pins on the XBee module are much smaller than those wires were made to connect to. I would recommend using an adapter board (#32403) to connect to the module.
  • solder_fumessolder_fumes Posts: 18
    edited 2015-02-24 15:22
    Problem solved (sort of), thanks to all for the useful comments.

    I was using the xbee adapter board as my "guide" to the pinouts on the xbee. Turns out (as you all know) that the top left connection when looking down on the board is VSS. I looked at it and thought since the top connector on the xbee adaptor board is VSS, I should use the second connector on the xbee as 3.3 volts. My bad. By moving all the connectors up one, I now have comm.

    A small problem still remains. The first "if" statement in my coding should be causing an "a" to be sent if the voltage on ADC pin 3 is greater than 4 volts. If I have ADC pin 3 jumpered to the 3.3 volt bus on the activity board, I see that a "g" is being transmitted as expected. But if I move the jumper from the ADC pin from the 3.3 volt bus to the 5 volt bus on the activity board, I don't see an "a" being transmitted. The voltage on my 5 volt bus is 4.99 volts. Shouldn't "if (v3 >4) cause that condition to be true, and an "a" to be transmitted, at any voltage over 4 volts?

    Oh, the use of two xbees was more of a Saturday afternoon experiment than anything else. I will be using just one ultimately, I just became perplexed when it quickly hooked it up and it didn't work as expected :-)

    Thanks in advance,

    John
  • BleuBoxBleuBox Posts: 13
    edited 2016-05-23 01:47
    I have resolved my issue.
Sign In or Register to comment.