|
3 | 3 | Components:
|
4 | 4 |
|
5 | 5 | - SDS011 particulate sensor
|
6 |
| -- Wemos D1 mini pro (ESP8266) |
| 6 | +- Wemos D1 mini pro (based on ESP8266) |
7 | 7 | - Some wires
|
8 | 8 |
|
9 | 9 | Ultra simple wiring and ultra simple programming with Micropython! The SDS011 communicates over serial with a protocol detailed here http://cl.ly/ekot:
|
10 | 10 |
|
11 |
| -SDS011 Wemos |
| 11 | +SDS011 -- Wemos |
12 | 12 |
|
13 |
| - TX --> RX |
14 |
| - RX <-- TX |
15 |
| - 5v <-- 5v |
16 |
| - GND --> GND |
| 13 | + TX -- RX |
| 14 | + RX -- TX |
| 15 | + 5v -- 5v |
| 16 | + GND -- GND |
17 | 17 |
|
18 | 18 | Wemos has only one serial-in and Micropython has no software serial library, so the device cannot be accessed when it is connected to the sensor. Luckily, the webrepl can be used to interact with the device instead.
|
19 | 19 |
|
20 |
| -Ideally, the sensor would be put to sleep and woken periodically. While the sleep command works, I CANNOT GET THE SENSOR TO WAKE UP! |
| 20 | +Ideally, the sensor would be put to sleep and woken periodically. There are some issues with this: |
| 21 | + - Printing anything to webrepl wakes the sensor up and it ceases to interpret sleep and wake signals properly |
| 22 | + - Sending the Wemos into deep sleep also wakes up the sensor! |
21 | 23 |
|
22 |
| -Entering deep sleep on the Wemos does not help as the SDS011 continues to draw power. |
| 24 | +As a temporary workaround, I am using the dutycycle mode on the SDS011. This helps to preserve the life of the sensor and is fine for indoor use, but is not a good solution for battery operation because: |
| 25 | + - The sensor periodically wakes up, waits 60 secs, then issues a single reading before sleeping again. Since the documented initialization time of the sensor is 30 secs (and in my experience more like 10), that's a lot of wasted fan-time. |
| 26 | + - The Wemos remains fully powered, drawing 50-200mA (although light sleep might be possible for around 1mA) |
23 | 27 |
|
24 |
| -As a temporary workaround, I am using the dutycycle mode: the Wemos remains on and the sensor kicks in every minute or so. |
| 28 | +## Going outdoors |
25 | 29 |
|
26 |
| -TODO: investigate having the sensor wake up the Wemos from deep sleep when the dutycycle kicks in. |
| 30 | +Some possible solutions for an immobile battery-operated version: |
| 31 | +1) Use the dutycycle mode with a sleeping Wemos, but have the sensor initialization wake up the Wemos with a low pulse to RST (may not work if deep sleep interferes with the dutycycle). Requires a flip-flop circuit (https://github.com/esp8266/Arduino/issues/1488)? |
| 32 | +2) Use something (relay? MOSFET?) between the Wemos and the SDS011 to cut the connection before entering deep sleep. |
| 33 | +3) Hook the whole circuit to a MOSFET controlled by an ATiny85 or similar. This would provide better efficiency (because we would be sleeping the ATiny85 instead of the Wemos, which would be completely powered down), but is more complicated. |
27 | 34 |
|
| 35 | +Let's evaluate some options assuming a 10 minute wake interval, 30 sec working period (so 3 minutes / hour awake), and the following power factors: |
| 36 | + - SDS011 consumes 70mA (awake) or <4mA (asleep) |
| 37 | + - Wemos consumes 150mA on average when awake or 5mA in light sleep |
| 38 | + - Deepsleep on Wemos consumes 2/3 times more than on esp8266 because of the USB-TTL converter: probably equates to around 0.1mA in total |
| 39 | + - At 1MHz the ATTiny85 consumes 2.5mA (awake) or 0.0005mA (asleep) |
| 40 | + - 3 AA batteries providing 7200mAh total |
| 41 | + - 70% efficiency |
| 42 | + |
| 43 | +As is: (7200 * 60 * 0.7) / (3 * (70 + 150) + 57 * (150 + 4) = 32 hours |
| 44 | + |
| 45 | +Without ATTiny but with relay: (7200 * 60 * 0.7) / (3 * (70 + 150) + 57 * 0.1) = 454 hours or 19 days |
| 46 | + |
| 47 | +With ATTiny: (7200 * 60 * 0.7) / (3 * (70 + 150 + 2.5) + 57 * 0.0005) = 453 hours |
| 48 | + |
| 49 | +What about using the ATTiny and turning on the Wemos only for last 7 secs of 30sec working period (say, 0.7 mins / hour @ 200mA)? (7200 * 60 * 0.7) / (3 * (70 + 2.5) + 0.7 * 200 + 57 * 0.0005) = 845 hours or 35 days. |
| 50 | + |
| 51 | +If the Wemos can request time and pass it to ATTiny85, we can sleep 6 hours at night as well, bringing us up to around 1120 hours. |
| 52 | + |
| 53 | +## Portability |
| 54 | + |
| 55 | +Another desideratum is the ability pair with a phone and transmit on the fly, or store measurements for transmission later. |
| 56 | + |
| 57 | +Storing: by default we get 6 bytes of data every second. After 30 mins that's 11kb. The Wemos has 96 kb of data RAM so we should be fine... We could also move into the 4 mb of flash, but must be careful as it is limited to 100,000 write/erase cycles. |
| 58 | + |
| 59 | +For gps data we need the phone. It should be possible for the phone to connect to the Wemos set up as an access point. Battery life on wifi might be expected to be 7200 * 0.7 / 200 = 25 hours. But it might make more sense to move to the ESP32 (which also has bluetooth) for this. |
0 commit comments