Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Series 2 Boot Time on: February 26, 2013, 12:37:05 am
Thanks.

I'm pretty sure it is the LED as they are lit even on sleep modes to indicate that they are still powered. Do you have a way to operate Xbee with an Arduino which is at 5V? I'm thinking of using resistors to make a level converter, will it work?

I'll refer to the product manual on the pin hibernate. Thanks again. Let me know if you think the resistors or other methods will work. I hope to buy as little as possible and resistors are available to me quite readily. =)

2  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Series 2 Boot Time on: February 25, 2013, 09:48:55 pm
Thanks for the suggestion. I agree that Xbee should be main powered. The reason why I want to use switch on-off is because of a rather high current consumption even on sleep modes. Previously I was using cyclic sleep mode and it draws about 1.8mA. I was using Xbee Explorer for easy connections. I think the issue with the current consumption is the small LEDs on the Explorer. I could use a breakout board for Xbee to minimise the current draw but I don't have idea how to properly eliminate the 5V to 3.3V difference between Xbee and Arduino.

For now, I will test to use Arduino to sleep and wake Xbee using pin hibernate. Is there any site that I can refer to for this setup? Thanks.
3  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Series 2 Boot Time on: February 25, 2013, 01:06:54 am
Hi,

Thanks for the reply! I understand that ZNET 2.5 is an old firmware version. I just tried to use Zigbee firmware and got a similar result.

I got the idea of switching on-off the setup from this site.
http://alanbmitchell.wordpress.com/2011/10/02/operate-arduino-for-year-from-batteries/

Below I put some of the code i used for further examination.
Basically, the informPin switches my Xbee on.
Code:
char temp_str[6];
char rh_str[6];
uint8_t payload[12];

        float h = dht.readHumidity();
        float t = dht.readTemperature();
        if (isnan(t) || isnan(h)) {
          Serial.println("Failed to read from DHT");
        } else {
          Serial.print("Humidity: ");
          Serial.print(h);
          Serial.print(" %\t");
          Serial.print("Temperature: ");
          Serial.print(t);
          Serial.println(" *C");
        }
        dtostrf(t, 6, 2, temp_str);
        dtostrf(h, 6, 2, rh_str);
        int plcount = 0;
        for (int i =0; i < strlen(temp_str); i++){
          payload[i] = temp_str[i] & 0xff;
          plcount++;
        }
        for (int i =plcount; i < plcount+strlen(rh_str); i++){
          payload[i] = rh_str[i-plcount] & 0xff;
        }

       digitalWrite(informPin, HIGH);
       
       delay(3500);

       xbee.send(zbTx);

       if (xbee.readPacket(500)) {
       // got a response!
       Serial.print("Response Received!"); }
       digitalWrite(informPin, LOW);
4  Using Arduino / Networking, Protocols, and Devices / Xbee Series 2 Boot Time on: February 23, 2013, 06:49:57 am
Hi,

As I'm working on Xbee Series 2, I noticed that they seemed to have a long boot time. Below I'll try to explain what I'm trying to do.

I'm working with Arduino to use one of its digital pin as a switch for Xbee. Using a transistor(2N2222a), I can control the Xbee to on/off as and when I need it to. My code is such that it will switch on the Xbee for a duration of time (a.k.a Xbee boot time) before trying to transmit information with the Xbee. Once acknowledgement is received, I'll shut off the Xbee.

I have tested the Xbee with different boot time and realised that using anything below 3.5sec will fail a transmission. Between 3.5sec to 15sec will result in periodic transmission errors. Beyond 15sec it will transmit without error.

As I'm working on a project with battery constraints, I find 15sec too long. Thus, would like to check if it is true that Xbee Series 2 requires such a long boot time. I'm using ZNET2.5 Coordinator/Router setup without sleep mode.

Thanks!
5  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Series 2 Unicast to Multiple Units on: February 04, 2013, 11:59:58 am
Hi,

I've successfully made it to work. The problem lies with the Xbee settings. I've been using Zigbee Coordinator/Router API settings. This doesn't work for multiple unicast. Anyway the forum post below speaks about switching over to ZNET2.5 Coordinator/Router API settings.

http://arduino.cc/forum/index.php?action=printpage;topic=111207.0

Once I switched over, it worked like a charm. =) Hope this info can help others too.

6  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Series 2 Unicast to Multiple Units on: February 03, 2013, 09:00:02 am
Hi,

I suddenly thought I should clarify something too...

What I am trying to resolve is this: I want Coordinator to unicast to both End Devices and then start to wait to receive from the End Devices when they wake up. This is not really working. (sometimes it works for one or two tries and then it fails all the way.)

What is working: I made the Coordinator unicast to ONE End Device and wait to hear it. Upon receiving, I made the Coordinator unicast to the next End Device and wait to hear again. This is working very well.

However, my project requires simultaneous transmissions which is the first one. I have tried to increase the time between the unicasts and it kind of improve a bit but still fails after that. (gives me a few more successful transmissions sometimes) I couldn't pinpoint the error especially since there are sometimes successful transmissions at the start. (means that this isn't entirely wrong)

Anyway, I'll test out without cyclic sleep tomorrow. Just my thoughts as I'm thinking to make clearer my issue. =)
7  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Series 2 Unicast to Multiple Units on: February 03, 2013, 03:29:38 am
Hi,

Thanks for the reply!

@PaulS: I understand what you mean. I've yet to test that and will test it on Monday back in school. I'll post again the results without cyclic sleep. =)

@draythomp: It's my pleasure to help provide info. =) I'm trying to "broadcast" in a sense. In actual fact, I'm just trying to uni-cast to all the end device nodes by transmitting to all the addresses. I'm working in API mode using xbee-python for Coordinator side. For End Device, it's Atmega328p optiboot that does the work. I don't actually look at the real broadcast method as I've seen bad results about using that from the forums. Since I've to setup each Xbee properly, I can just store a dictionary of addresses in the python code easily after the Xbee setup. I haven't really look at the transmit response code as I'm not sure how to do it using the xbee-python.

Thanks too for the help in the past month that got me to this stage. My project is really progressing properly. =)
8  Using Arduino / Networking, Protocols, and Devices / Xbee Series 2 Unicast to Multiple Units on: February 02, 2013, 11:18:44 am
Hi,

I'm working on broadcasting from a Coordinator Xbee S2 to 2 Router/End Device Xbee S2. These end devices act as wireless sensor unit with an arduino,xbee and a sensor. I've successfully enabled a point to point communication between Coordinator and End Device in cyclic sleep mode of both 10minutes(actual timing) and 40 seconds(testing timing). What I need to do is to "broadcast" this instead of just unicasting to one End Device.

The method I intend to use is to unicast to all existing sensor units (2 of them) to act as a "broadcast". I encountered some weird issues such that sometimes it works for 1-2 "broadcasts" before failing and sometimes it fails totally all the time.

Thus, would like to ask what I might be missing out on about uni-casting to multiple devices on top of uni-casting to a single device. Do take note that the Xbee Series 2 are all on cyclic sleep. Thanks!
9  Using Arduino / Networking, Protocols, and Devices / UartSbee/Explorer Regulated/Breakout Board in Sleep Mode on: January 19, 2013, 02:29:14 am
Hi,

I'm testing out on these 3 systems on Xbee recently. Gonna interface them with the Arduino Board but now testing them as they are.

I'm using cyclic sleep mode and what happened is this - For the UartSbee, it works fine. For Explorer Regulated and Breakout Board, both of them are unable to sleep it seems.

Here's how I test them.
I use some python code to write and read frames across API mode. First, the Coordinator Xbee will continuously send then receive frames with interval between each cycle of 5 seconds. Next, the Router Xbee will continuously receive and send frames with interval between each cycle of 5 seconds too.

However, the Router and Coordinator Xbee set the Sleep time to be 25seconds (9C4 on SP).

This means that there'll be a 20second lag for the Router Xbee to receive the sent packets from Coordinator Xbee.

I've timed for UartSbee for 20 cycles and they are fine. However, for the other two setups, they simply keep sending and receiving almost oblivious of the sleep mode. The only thing I do is pluck the Xbee out of each setup and pluck it into the next one. This means that no settings are changed. Is it possible that the other two setups aren't able to work in cyclic sleep mode?
10  Using Arduino / Project Guidance / Re: Power consumption on Arduino Uno and Xbee on: January 17, 2013, 11:10:31 am
Hi!

Thanks for the reply! I just wanna ask about some of the suggestions you made.

1) How to slow down the oscillator? I'm using 16Mhz currently
2) I can do that through programming at the setup right?
3) What are the features such as bod? (sorry, I'm new to this..)
4) I'm running at 5V step-down from 9V Battery. Can I run at lower voltage..? I bought 5V linear volt reg...
5) How to use mosfet as output devices? Put them through a resistor to a gate?
6) I'm using this setup -  http://arduino.cc/en/Main/Standalone ... What's the value that will be suitable..?

Sorry for asking these weird questions...

But one thing I think is bothering me more... Isn't the promised sleep current consumption supposed to be less than 100uA? I'm thinking why I'm getting 7mA... Because I really think that that is the one that is draining my power away since most of the time my setup is sleeping. Btw, I follow this site to build the breadboard arduino with the voltage regulator I mentioned in the first post.
11  Using Arduino / Project Guidance / Power consumption on Arduino Uno and Xbee on: January 17, 2013, 02:26:59 am
Hi,

I'm working on a project on Arduino Uno and Xbee. I have read on the datasheet for both current consumption.

I know that Xbee consumes about 40-50mA on active state and 30-50uA on cyclic sleep. For Arduino Uno, it consumes about 30-40mA on active state and 150uA on deep sleep mode.

Currently, I did the Arduino Uno on the breadboard and use MCP1702-5002E/TO as my voltage regulator for low Q-current.

http://sg.element14.com/microchip/mcp1702-5002e-to/ic-v-reg-ldo-250ma-to-92-3/dp/1331487

For Xbee, I connect up with UartSbee for easy voltage regulation of 5V.

The issue is this...
I checked the current consumption for the Arduino Uno. It is 7mA when asleep and 40mA when awake. (I put the multimeter in series with the 5V power and Vcc pin of the Atmega328p)
For the Xbee, it is also 7mA when asleep and about 50mA when awake.(I put the meter in series with the general ground and ground pin of UartSbee)

I think the current consumption when awake is fine but it is odd for the Xbee and Atmega328 to consume so much during sleep...

Btw, Xbee is on cyclic sleep. Atmega328 is on pin interrupt sleep. (Xbee wakes Atmega328 up through an inverter from Sleep Pin to Pin 2 Interrupt).

Hope someone can help me to unravel the mystery of this sleep power consumption. Now it takes only 6 hours to kill my 9V GP Heavy Duty Battery. Heehee. I need to make it about a week or so.
12  Using Arduino / Microcontrollers / Re: stk500_getsync() not in sync resp=0x00 error for arduino uno breadboard on: January 11, 2013, 10:59:34 am
Hi,

No problem about mistakes. I'm also learning! =)

@Tom
Yep, I think I connect them accordingly. I have removed the chip from the Arduino. Took me like 20minutes because I was so scared it'll spoil...

13  Using Arduino / Microcontrollers / Re: stk500_getsync() not in sync resp=0x00 error for arduino uno breadboard on: January 11, 2013, 05:24:13 am
Hey thanks for the reply.

The picture is slightly misleading. Because it's meant for bootloading.

The connection for uploading is just the following:
D0 to D0
D1 to D1
Reset to Reset
5V to 5V
Gnd to Gnd

The rest of the setup is left untouched. Only connection between Uno and breadboard is changed.
14  Using Arduino / Microcontrollers / Re: stk500_getsync() not in sync resp=0x00 error for arduino uno breadboard on: January 10, 2013, 10:43:42 am
Hi!

@Larry

The voltage is 4.94V between pin 20 and 22.
What was written on the crystal is 16.000M.
The datasheet is as follows:
http://www.farnell.com/datasheets/75357.pdf

The blue wire connects X2 to one of the pin of the crystal.
The brown wire connects X1 to the other pin of the crystal.
Just a question...there's no real differentiation between the pins right...? I don't know about crystals that much...

15  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Uno + Zigbee S2 on: January 10, 2013, 08:09:03 am
Hi,

Just gonna round up the last bit and thank everyone for helping out!

This is my transmitter/router code to send data. I've made it such that it's easy to do debugging on Serial by changing some of the codes.
It basically send 'aa' over. Thanks to Paul's SoftwareSerial codes, I can line the Xbee on pin8 and 9. =)

Code:
#include <XBee.h>
#include <SoftwareSerial.h>

/*
This example is for Series 2 XBee
 Sends a ZB TX request with the value of analogRead(pin5) and checks the status response for success
*/
char data = 'a';

// Connect Arduino pin 8 to TX of usb-serial device
uint8_t ssRX = 8;
// Connect Arduino pin 9 to RX of usb-serial device
uint8_t ssTX = 9;
// Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device
SoftwareSerial nss(ssRX, ssTX);

// create the XBee object
XBee xbee = XBee();

uint8_t payload[] = { 0, 0 };

// SH + SL Address of receiving XBee
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x4079a7f9);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
ZBTxStatusResponse txStatus = ZBTxStatusResponse();

int pin5 = 0;

int statusLed = 13;
int errorLed = 13;

void flashLed(int pin, int times, int wait) {

  for (int i = 0; i < times; i++) {
    digitalWrite(pin, HIGH);
    delay(wait);
    digitalWrite(pin, LOW);

    if (i + 1 < times) {
      delay(wait);
    }
  }
}

void setup() {
  pinMode(statusLed, OUTPUT);
  pinMode(errorLed, OUTPUT);
 
  nss.begin(9600);
  Serial.begin(9600);
  xbee.setSerial(nss);
}

void loop() {   
  // break down 10-bit reading into two bytes and place in payload
  payload[0] = data & 0xff;
  payload[1] = data & 0xff;
  //pin5 = analogRead(5);
  //payload[0] = pin5 >> 8 & 0xff;
  //payload[1] = pin5 & 0xff;

  xbee.send(zbTx);

  // flash TX indicator
  flashLed(statusLed, 1, 100);

  // after sending a tx request, we expect a status response
  // wait up to half second for the status response
  if (xbee.readPacket(500)) {
    // got a response!

    // should be a znet tx status           
    if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE) {
      xbee.getResponse().getZBTxStatusResponse(txStatus);

      // get the delivery status, the fifth byte
      if (txStatus.getDeliveryStatus() == SUCCESS) {
        // success.  time to celebrate
        flashLed(statusLed, 5, 50);
      } else {
        // the remote XBee did not receive our packet. is it powered on?
        flashLed(errorLed, 3, 500);
      }
    }
  } else if (xbee.getResponse().isError()) {
    Serial.print("Error reading packet.  Error code: "); 
    Serial.println(xbee.getResponse().getErrorCode());
  } else {
    // local XBee did not provide a timely TX Status Response -- should not happen
    flashLed(errorLed, 2, 50);
  }

  delay(1000);
}

And this is for the receiver. I notice Dray did something similar in the past when I was surfing the web. Great minds think alike!

Code:
#include <XBee.h>
#include <SoftwareSerial.h>

/*
This example is for Series 2 XBee
Receives a ZB RX packet and sets a PWM value based on packet data.
Error led is flashed if an unexpected packet is received
*/

XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
// create reusable response objects for responses we expect to handle
ZBRxResponse rx = ZBRxResponse();
ModemStatusResponse msr = ModemStatusResponse();

// Define NewSoftSerial TX/RX pins
// Connect Arduino pin 8 to TX of usb-serial device
uint8_t ssRX = 8;
// Connect Arduino pin 9 to RX of usb-serial device
uint8_t ssTX = 9;
// Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device
SoftwareSerial nss(ssRX, ssTX);


void setup() { 
  // start serial
  Serial.begin(9600);
  nss.begin(9600);
  xbee.setSerial(nss);
  Serial.println("starting up here!");
}

// continuously reads packets, looking for ZB Receive or Modem Status
void loop() {
   
    xbee.readPacket();
   
    if (xbee.getResponse().isAvailable()) {
      // got something
           
      if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
        // got a zb rx packet
       
        // now fill our zb rx class
        xbee.getResponse().getZBRxResponse(rx);
     
        Serial.println("Got an rx packet!");
           
        if (rx.getOption() == ZB_PACKET_ACKNOWLEDGED) {
            // the sender got an ACK
            Serial.println("packet acknowledged");
        } else {
          Serial.println("packet not acknowledged");
        }
       
        Serial.print("checksum is ");
        Serial.println(rx.getChecksum(), HEX);

        Serial.print("packet length is ");
        Serial.println(rx.getPacketLength(), DEC);
       
         for (int i = 0; i < rx.getDataLength(); i++) {
          Serial.print("payload [");
          Serial.print(i, DEC);
          Serial.print("] is ");
          Serial.println(rx.getData()[i], HEX);
        }
       
       for (int i = 0; i < xbee.getResponse().getFrameDataLength(); i++) {
        Serial.print("frame data [");
        Serial.print(i, DEC);
        Serial.print("] is ");
        Serial.println(xbee.getResponse().getFrameData()[i], HEX);
      }
      }
    } else if (xbee.getResponse().isError()) {
      Serial.print("oh no!!! error code:");
      Serial.println(xbee.getResponse().getErrorCode());
    }
}

And I will add that I use xbee-python library to solve the api problem on PC. It was really good and easy to use and I love PYTHON! =)
Pages: [1] 2