Pages: [1] 2   Go Down
Author Topic: How to connect sensors, xbee modules and xbee shield to an Arduino board?  (Read 2876 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have the following components which i need to function together as a single module.

*Arduino UNO board
*Arduino XBEE shield
*XBEE Module

Now i need to connect a few sensors to the board. How do i do that?

I have gone through a few links and could manage to pull up some information:

Sensor: http://www.hobbyking.com/hobbyking/store/__26874__Universal_Sensor_Adapter_for_Arduino.html
Sensor expansion board: http://www.hobbyking.com/hobbyking/store/__26837__Arduino_Sensor_Shield_V5_0_Sensor_Expansion_Board.html?gclid=CNWhq523qrUCFeZFMgoduC0AqA
Sensor shield: http://www.emartee.com/product/41798/Arduino-Sensor-Shield-V4.0

I am a bit confused about how to use/ which ones to use/ how to integrate them?

Also is it possible to mount multiple sensors? So that i could mount an xbee module with a shield as well as a sensor shield with sensors?

Please help me.

Regards,
Priyankar Bhattacharjee



 








Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2263
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming you want to use more than one sensor at a time, simply wiring them into the headers of the shield is not really enough and proper terminals are required.

I know nothing about Xbee shields. I assume they are made to take the Xbee module and therefore you have that side of things sorted. I think the sensor adapter is just a piece of junk.  The two others are much the same as each other. I have the second one, you can get that for half the price on eBay. I found it useless. Quite aside from the fitting problems, I have never seen any plugs that fit in the sockets provided and I could do a better job making my own.  You probably would too.

Googling Xbee shield, I see the red Sparkfun looks fairly, if not very, sensible. It has a prototyping area on which you can put your own headers to take your own sensors. If your shield is one of those or similar, you don't need to waste your money on the other stuff.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have this one : http://www.digikey.com/product-detail/en/A000021/1050-1006-ND/2638994
(Clearly, only some pins surface out)

But i think this is the one i should have bought : http://www.digikey.com/product-detail/en/A000064/1050-1023-ND/2784004

Now all the pins do not surface up. So what are we supposed to do to connect sensors as well as communicate (with xbee shield + module) over the uno?


Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2263
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


But i think this is the one i should have bought

So what are we supposed to do to connect sensors as well as communicate (with xbee shield + module) over the uno?
Um, yes, well... A principle reason why I don't know much about Xbee is that the only thing I do know is that the Xbee shield manufacturers have no idea about what they are doing, and your first example is fair evidence of that.

Having said that, your second example looks fine to me, and I'm sure you are right. Perhaps not perfect in theory, but it has the three vital assets

1.  a row of proper holes for wiring to the headers

2. twelve holes across means four 3-wire headers in a row.

3. stackable headers.

Most importantly, it has other relevant peripherals that would deter me from making my own.  The main reason why I don't know about Xbee is that I have managed to avoid it - so far. If I eventually have to indulge in it, this is the sort of board I would get.

Thank you.
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been where you are and made a bunch of mistakes, so a couple of suggestions:  I like this board for an XBee shield

http://www.ebay.com/itm/XBee-shield-for-Arduino-/220982906382?ssPageName=ADME:L:OC:US:3160

It lets you connect the serial input on the XBee to any pin on the arduino, and if you use a mega2560, you add a couple of wires and can get to any pin on it as well.  It has leds, reset switch, and prototype area so you can mess around a bit on the board itself.  You can piggy back another shield on top of it also.

As for sensors, visit Terry King's site at http://arduino-direct.com/sunshop/ , he has a bunch of sensors, shields, and most importantly, examples of using a lot of the stuff.  Even though you already have some items, the articles and description of the devices will help you understand how this stuff works.

XBee, I didn't see where you mentioned which XBee you got, but I hope it's a Series 2 or 2.5 device.  The series 1 are marginally easier to use, but they don't have anywhere near the capabilities of the later devices.

To get you started, decide what you want to do.  Maybe measure the temperature in your main room.  For this you need a temperature sensor to plug into the arduino.  Then you will want to see what it's reading, so you'll probably want to get an LCD display.  Then you'll want to do something else.  As you decide what you want to monitor or control, you'll understand what you need to have to do it.

As for multiple sensors, yes you can have multiple sensors.  The arduino can sample a number of them and then format a message to send through the XBee to another one hooked to some device you want to get the data to.

Basically, think about what you want to do, gather some information on doing it, then go have fun.
Logged

Trying to keep my house under control http://www.desert-home.com/

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3679
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With your xBee shield, it looks like you need it to be on top of your shield stack, with whatever stackable sensor shield you can find making the filling in an arduino/xBee sandwich. I used the Sparkfun prototyping shield for this purpose, to mount a temperature sensor. I don't like that shield much - the prototyping area was hard to use because all the nodes are electrically separate so it was a very fiddly job wiring it up. Much more durable than the breadboard it replaced though!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks guys...the sandwich according to me should be arduino board + sensor shield + some headers (to raise the level up a little bit to allow enough room for multiple sensors) + xbee shield + xbee module. What do you guys think?
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The only way you're going to know for sure is to stack them up and see what happens.  The answer will probably be obvious.
Logged

Trying to keep my house under control http://www.desert-home.com/

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2263
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the sandwich according to me should be arduino board + sensor shield + some headers (to raise the level up a little bit to allow enough room for multiple sensors) + xbee shield + xbee module.
This implies it is appropriate for the sensors to go on the board, and the Arduino will be in the right place to do the sensing. Only you can make that judgement.

Similarly, only you can decide on the need for extra stackers. Note though, if you make your sensor shield, extra long legs can be had from here:

http://www.ebay.com/itm/130802267649?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

but note also they are not really long enough to clear an EtherNet socket!

I put clock modules on standard pinrows and an ordinary shield will just clear it

 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now i have everything set up...Just a bit apprehensive about whether or not i should put the x-bee module all the way down into the shield...Because it takes quite a lot of effort to pull that thing up and plug into the spark fun explorer to program it...I am scared that it might damage the module if i went doing it for a couple of times.
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I plug and unplug mine all the time.  After a while, the sockets loosen up enough so that it doesn't take as much force to get it out.  Be careful of bending pins on the XBee though, it's really easy for it to let go on one end as you pull it out, bending the pins on the other end.  Don't worry too much though if you do bend them, they don't break too easily.  Just don't make a habit of it.
Logged

Trying to keep my house under control http://www.desert-home.com/

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2263
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are probably just being paranoid and, the more you plug/unplug, the easier it is likely to get. If I understand you correctly, the Xbee module has to go into another device in order to be programmed, and I guess you only do that once anyway.

I have noticed variation int the way a shield installs. I have wondered if some have harder brass in the pins and it takes a bit more to straighten them.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure. Maybe over a period of time, will overcome the fear  smiley-grin

Also now that i am setting up one arduino to be the sender and the other to be the receiver.

What i am trying to achieve is to blink an led on and off on the receiver based on inputs (1's and 0's) from sender.

Steps for sender:

1)Write the code for the sender.
2)Compile it.
3)Burn the code into the arduino uno.
4)Load the xbee shield with xbee module

Steps for receiver:

1)Write the code for receiver.
2)Compile it.
3)Burn the code into the arduino uno.
4)Load the xbee shield with xbee module.

Then plug them onto diferent computers. (Just for power supply i am assuming)

But it does not seem to work. I am copy pasting the code below.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sender:

int data = 0;
int ledPin = 13;

void setup(){
         Serial.begin(9600);
         pinMode(ledPin, OUTPUT); 
 
}

void loop(){
 
  if(data == 0){
    Serial.write(0);
    digitalWrite(ledPin, LOW);
    data = 1;
  } 
 
  delay(1000);
 
  if(data == 1){
   
   Serial.write(0);
   digitalWrite(ledPin, HIGH);
   data = 0;
   
  }
 
 delay(1000);
 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Receiver:

int ledPin = 13;


void setup(){
         Serial.begin(9600);
         pinMode(ledPin, OUTPUT);
 
}

void loop(){
 
  //while(Serial.available() == 0);
 
  if(Serial.read() - '0'){
   digitalWrite(ledPin, HIGH);
   delay(1000);   
  } 
 
 
  else{
   digitalWrite(ledPin, LOW);
   delay(1000);
  } 
 
 Serial.flush();
 
   

 

Logged

Pages: [1] 2   Go Up
Jump to: