Advice on setting up a sensor network with Xbee and ESP32s

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
billtubbs
 
Posts: 11
Joined: Thu Nov 18, 2021 3:17 am

Advice on setting up a sensor network with Xbee and ESP32s

Post by billtubbs »

After some trials using Adafruit sensors with Stemma QT cables connected to a Raspberry Pi, I'm planning to install a more permanent sensor data logging system with a combination of Stemma QT (for nearby sensors) but also a Xbee (ZigBee) mesh network for communicating with one or possibly a few other sensors over a longer range (e.g. one on the roof).

I can't seem to find any guides on how to set up XBee transmitters/receivers with ESP32s. (I want to use the ESP32s for reliability, low maintenance, low power consumption, and longer life in a harsh environment (a greenhouse) because I don't think a Raspberry Pi will survive in there).

The XBee wireless modem adapter (https://learn.adafruit.com/xbee-radios) seems to be geared to connecting to a computer with USB cable. Is it supposed to work with an Arduino device like an ESP32 and if so how do I connect them?

Other details:
  • I want a battery back-up supply to power the ESP and sensor network for short periods in case of power outage.
    One of the remote sensors + ESP32s may be running its own battery and solar panel.
    I want to connect the main central ESP32 to ethernet for transmitting data to a server.
Any advice appreciated (including if I'm not going about this the right way).

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Advice on setting up a sensor network with Xbee and ESP3

Post by adafruit_support_mike »

The XBee usually communicates though a Serial interface. Most of our ESP32 dev boards are configured with a Serial interface, so that would be the connection to use.
billtubbs wrote:I want a battery back-up supply to power the ESP and sensor network for short periods in case of power outage.
Our ESP32 Feathers are designed to run from a LiPo, and will automatically switch between external and battery power as needed:

https://www.adafruit.com/?q=esp32+feath ... =BestMatch
billtubbs wrote:One of the remote sensors + ESP32s may be running its own battery and solar panel.
Solar power is challenging because it's so variable. In most cases, you use the solar array to charge a battery, then use the battery to power a load.

If you have a solar system that already charges a battery, you can ignore the solar issues and use the sensor and ESP32 normally. If you don't have a solar power solution, our Solar LiPo Charger will work:

https://www.adafruit.com/product/4755
billtubbs wrote:I want to connect the main central ESP32 to ethernet for transmitting data to a server.
We have an Ethernet FeatherWing:

https://www.adafruit.com/product/3201

The code in the associated library only works as a network client, not as a host, so you'll need to adapt your design around that.

User avatar
billtubbs
 
Posts: 11
Joined: Thu Nov 18, 2021 3:17 am

Re: Advice on setting up a sensor network with Xbee and ESP3

Post by billtubbs »

Thanks, this is great information.
adafruit_support_mike wrote: If you don't have a solar power solution, our Solar LiPo Charger will work:

https://www.adafruit.com/product/4755
This looks ideal for the remote data logging unit in my application. Thanks.
adafruit_support_mike wrote:We have an Ethernet FeatherWing:

https://www.adafruit.com/product/3201
This looks ideal for the central/main data processor in my application. Thanks.
adafruit_support_mike wrote:Our ESP32 Feathers are designed to run from a LiPo, and will automatically switch between external and battery power as needed:

https://www.adafruit.com/?q=esp32+feath ... =BestMatch
For the remote data logger, I think the low power / automatic power management features will be the most important requirement.

I've looked at the specs for the FeatherS2 and FeatherS3 and having trouble deciding which is more suitable. As far as I can tell:
  • Both are low power consumption – but which is the best
    Both have WiFi and Bluetooth, neither of which I need
    The S3 has "Ultra low deep sleep current" which sounds like something very advantageous for my application (only need to sample temperature sensor every 2-5 mins or so).
    Both support CircuitPython which is nice.
Four questions:
  • 1. Presumably, the WiFi and Bluetooth increase power consumption quite a bit. Is there an equivalent board without WiFi or is there a way to completely disable them so they don't add to power consumption when the ESP is on?
    2. Will using CircuitPython increase power consumption? E.g. by increasing processing work during wake-from-sleep and sleep, or by increasing the duration of the data capture process?
    3. Is there any information or would you be able to hazard a guess as to whether both of these feathers would operate overnight doing intermittent sampling (e.g. once a minute) on a single battery charge? (allowing for some power consumption by the sensors and XBee transmitter).
    4. Or should I be looking at other ESPs for this application? (Other than the S2 or S3).
Thanks.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Advice on setting up a sensor network with Xbee and ESP3

Post by adafruit_support_mike »

If you don't need WiFi or BLE, any version of the ESP32 will be a waste of hardware. They're SOCs specifically designed for wireless.

A Feather M0 Express would probably be the simplest alternative with equivalent processing power and CircuitPython support. It has the same LiPo charging/changeover features, and its nominal operint current is 11mA (3mA of whch is the power LED).

https://www.adafruit.com/product/3403
billtubbs wrote:Presumably, the WiFi and Bluetooth increase power consumption quite a bit.
Yes.
billtubbs wrote:is there a way to completely disable them so they don't add to power consumption when the ESP is on?
No. All versions of the ESP8266 and ESP32 have a ROM operating system that keeps the radios running and happy.
billtubbs wrote:Will using CircuitPython increase power consumption? E.g. by increasing processing work during wake-from-sleep and sleep, or by increasing the duration of the data capture process?
CircuitPython doesn't change the current consumption, but as a rule of thumb you can expect any interpreted language to run about 1/10th as fast as compiled code. That will only have an effect on long-term battery life if you put the microcontroller to sleep between readings, and will be negligible compared to the cost of running the XBee's radio (120mA while transmitting).
billtubbs wrote:Is there any information or would you be able to hazard a guess as to whether both of these feathers would operate overnight doing intermittent sampling (e.g. once a minute) on a single battery charge? (allowing for some power consumption by the sensors and XBee transmitter).
It depends on the amount of energy stored in your battery.

If both boards run continuously (11mA for the Feather and 1mA for an XBee's quiescent current) the combined energy load is 12mAh per hour. If the XBee spends 1 second per minute transmitting, that amortizes down to 120mAs * 60s * 1h/3600s = 2mAh per hour. Adding a bit of safety margin,we can call the overall load 15mAh per hour. Running that for 12 hours would have a total energy cost of 180mAh.

That means a 250mAh LiPo should be able to keep the system running at least 12 hours from a full charge:

https://www.adafruit.com/product/328

If you step up to a 2200mAh 18650 LiPo, you should be able to get about 10 days from a full charge:

https://www.adafruit.com/product/1781

Since you mentioned periodic sampling, you might also want to look a the TPL5110 low-power timer:

https://www.adafruit.com/product/3435

It controls power to a circuit, and uses less than 100nA if you cut the trace to the power LED. With the trace uncut, leakage through the LED is about 20uA.

The TPL5110 wakes up at regular intervals (which you can set from 100ms to about 2 hours), and on its own will stay awake until 50ms before the next counting period. It has a DONE pin though, so a microcontroller can shut off its own power any time it wants. The TPL5100 will drop back to low-power mode until the next counting period.

If we assume it takes 4 seconds for the Feather M0 and XBee to wake up, take a measurement, and transmit the reading, the amortized 2mAh per hour for the XBee remains the same, but the quiescent load for the Feather and XBee drops from 15mAh per hour to 1mAh per hour. The total energy load would be around 3mAh per hour, and the 250mAh LiPo linked above should keep it running for about 9 weeks.

And frankly, that's a pessimistic estimate. It only takes ~100 microseconds for a Feather to wake up and start running code, and you can do a lot in a few tenths of a second. An XBee only needs about 250ms to wake up and make a radio connection to its network, so you could probably do the whole measure-and-transmit process in less than 1 second.

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”