User Tools

Site Tools


proiecte:environment-monitoring

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
proiecte:environment-monitoring [2018/06/07 16:06]
cristian.cocioaba [Nodes power consumption]
proiecte:environment-monitoring [2018/06/07 16:37] (current)
cristian.cocioaba headers
Line 60: Line 60:
  
 ===== Gathering data ===== ===== Gathering data =====
-=== Temperature and humidity ===+==== Temperature and humidity ====
  
 <code cpp> <code cpp>
Line 79: Line 79:
 </code> </code>
  
-=== Battery ===+==== Battery ====
 <code cpp> <code cpp>
 typedef float sensor_battery_t; typedef float sensor_battery_t;
Line 85: Line 85:
  
 ===== Usage === ===== Usage ===
-=== Software serial example on Sparrow ===+==== Software serial example on Sparrow ====
 <code cpp> <code cpp>
 #include <SoftwareSerial.h> #include <SoftwareSerial.h>
Line 120: Line 120:
  
 </code> </code>
 +
 +
 +----
  
 ====== ESP8266 solar energy harvesting ====== ====== ESP8266 solar energy harvesting ======
Line 131: Line 134:
 Although both protocols operate at 2.4 GHz frequency, 802.15.4 is low-speed and low-rate and ATmega128RFA1 has Ultra Low Power consumption as we can see below. Although both protocols operate at 2.4 GHz frequency, 802.15.4 is low-speed and low-rate and ATmega128RFA1 has Ultra Low Power consumption as we can see below.
  
-== ATmega128RFA1 power consumption ==+=== ATmega128RFA1 power consumption ==
 {{:proiecte:atmega128rfa1_power_consumption.png?500|}} {{:proiecte:atmega128rfa1_power_consumption.png?500|}}
  
-== ESP8266 power consumption when radio is on ==+=== ESP8266 power consumption when radio is on ===
  
 In contrast, ESP8266 has more processing power and together with the power required by the bandwidth and data rate of Wi-Fi, it utilizes almost 10 times more energy, as we can see below. In contrast, ESP8266 has more processing power and together with the power required by the bandwidth and data rate of Wi-Fi, it utilizes almost 10 times more energy, as we can see below.
Line 168: Line 172:
  
 ===== Estimating battery life for an ESP node ===== ===== Estimating battery life for an ESP node =====
 +
 +If the ESP runs in the default mode, it draws a current of approximately 75mA. And when running continuously, the total power consumptions is about **75mAh**. 
 +We will further use the same battery capacity as a reference for comparing the power consumption of different modes, i.e. popular LiPo battery of 3800mAh. The above current consumption will drain the reference battery in around **50.6 hours**, i.e. **2 days and 2 hours**, considering an ideal battery.
 +
 +In our test, the total power consumption for this test, considering the maximum wait time for the Wi-Fi connection of 10 seconds is:
 +
 +<note tip>0.35s * 80mA + 10s * 17mA + 10s * 75mA + 0.05s * 250mA ~= **0,285mAh per cycle**</note>
 +
 +This is a total of 20.4 active seconds per cycle. In a real-life scenario, we will want to extend the deep-sleep period to minimum 5 minute for measuring an environment parameter, like temperature. This will add another 0.25mA * 300s = 75mAs = 0.02mAh to the total calculated above and will extend the cycle total period to 320 seconds, to a total of around **11 cycles per hour**.
 +
 +And so, the total amount of capacity needed is around **0.305mAh per cycle** and a **total of 3.355mAh**. This consumption will last with the reference 3800 mAh battery for about **47 days**.
 +
 +This a good improvement over the previous consumption when running continuously, but it can still be improved.
  
 ===== Optimizing power consumption ===== ===== Optimizing power consumption =====
 +
 +The first thing a node should do is to read sensors data and then decide either to send the data or go back to sleep. In this case, we do not want the Wi-Fi radio to be on, without the need to use it.
 +
 +The code to disable the Wi-Fi is the following:
 +<code cpp>
 +WiFi.mode( WIFI_OFF );
 +WiFi.forceSleepBegin();
 +delay( 1 );
 +</code>
 +
 +Then, just before the call to establish the Wi-Fi connection, we turn the radio back on:
 +<code cpp>
 +WiFi.forceSleepWake();
 +delay( 1 );
 +
 +// Bring up the Wi-Fi connection
 +WiFi.mode( WIFI_STA );
 +WiFi.begin( WLAN_SSID, WLAN_PASSWD );
 +</code>
 +
 +At boot time, before we can disable the Wi-Fi radio, the ESP chip still turns it on, resulting in a sharp power peak. This default behavior can be changed by setting the WAKE_RF_DISABLED flag in //ESP.deepSleep()// call.
 +
 +<code cpp>
 +WiFi.disconnect( true );
 +delay( 1 );
 +ESP.deepSleep( SLEEPTIME, WAKE_RF_DISABLED );
 +</code>
 +
 +This saves another 0.007mAh for each cycle, to a **total of 0.077mAh**.
 +
 +Furthermore, disabling network persistence will save around 1.2 seconds on Wi-Fi connection initialization at 71mA, which in turn saves **0.023mAh**.
 +
 +Also, by setting a -static IP, the DHCP time will be reduced, but this will depend on each network. It most cases, the time was reduced to an average of 6 seconds. This will reduce another 4 seconds from the initial estimation. Which means another **0.083mAh**.
 +
 +As we can see in the figure below, the first peak was eliminated, and the connection time was reduced.
 +
 {{:proiecte:screenshot_15.png?500|}} {{:proiecte:screenshot_15.png?500|}}
  
 +The total power consumption for a cycle is now down to:
 +
 +<note tip>10s * 17mA + 6s * 75mA + 0.05s * 250mA + 300s * 0.25mA ~= **0.197 mAh per cycle** ⇒ **2.167 mAh**</note>
 +
 +With this, the ESP chip will last with the reference 3800 mAh battery for about **73 days**.
 +
 +<note>
 +We must notice, that although the power peaks are not present in the figure above, during our tests, we observed multiple times that they happen to appear randomly, as seen in Figure 6. and that is the reason that we included them in the above calculation.
 +</note>
 +
 +<note>
 +Also, the 10 seconds of modem-sleep we set in this test which operates at around 17 mA, can be reduced greatly in real-life scenario, when acquiring data from sensor, either digital ones through I2C interface or analog ones. The wait time for calibration depends on each sensor, but, for example, the DHT22 temperature sensor needs an average of 2 seconds to calibrate and be available for data read. This adds, of course, another consumer on the battery, but it is a low-power sensor, operating at 1mA or maximum 1.5 mA.
 +</note>
 ===== Keeping data after Deep-Sleep ===== ===== Keeping data after Deep-Sleep =====
  
Line 247: Line 313:
 ===== Solar energy harvesting ===== ===== Solar energy harvesting =====
  
-{{:proiecte:solar.png?500|}}+We used a solar panel with the dimensions of 160x116x2.5(±0.2) mm. This, in theory, should provide a 2.5W power at 5V voltage when the Solar radiation is the most powerful
  
 +When testing it, we observed that the solar panel was not giving a steady current and voltage, but instead both varied based on how much Solar radiation strikes the panel and the orientation of the panel. This means that it cannot safely charge the LiPo battery. To overcome this problem, we used the TP4056  regulator, which can charge a LiPo battery, in theory, at a steady voltage of 4.2 V and a 1A current
 +
 +We then measured the battery charger output with both the battery and ESP chip connected and got a maximum of 420 mA at 4.12 V, meaning 1.73 W, and an average of around 300 mA at 4.12 V, meaning 1.236 W between 1pm and 6 pm (see below).
 +
 +{{ :proiecte:solar.png?600 |}}
 +
 +This will total to **950mAh**, representing **3.9Wh for 14 hours per day**. This represents an approximation of the power gained and stored in the battery, and at the same time running the ESP. 
 +
 +Considering the previous results of ESP power consumption of 2.167mAh at 3.3 V, representing around 0.0072Wh. This means that it will consume around 0.1Wh in the 14 hours of sunlight and 0.072Wh in the remaining 10 hours of night. 
 +
 +Regarding this, the solar panel can store in the battery approximately 3.8Wh in the time of the sunlight. The remaining 3.8Wh should allow the ESP chip to run for about **22 days without recharging**. 
 ===== Results ===== ===== Results =====
  
-{{:proiecte:solar-panel-battery-esp.png?500|}}+For testing the theoretical results, we measured the voltage of the VCC voltage from the ESP. It was connected to a 3800mAh LiPo battery, which was charged from the solar panel. 
 + 
 +We present in the figure below tree days of measurement, starting with a relatively low charged battery, at around 3.7 V. 
 + 
 +{{ :proiecte:solar-panel-battery-esp.png?500 |}}
  
 +The voltage increases at the first day sunrise, followed by a discharge at night. After that, we encountered a cloudy weather, followed by another sunny day, which kept the battery fully charged. Our test suggests that the theoretical results are correct and that the ESP can run on battery and harvest solar energy.
 ===== Resources ===== ===== Resources =====
 - [[https://github.com/w01f6/esp8266-wsn-protocol | WSN Protocol for ESP8266 ]] - [[https://github.com/w01f6/esp8266-wsn-protocol | WSN Protocol for ESP8266 ]]
proiecte/environment-monitoring.1528376782.txt.gz · Last modified: 2018/06/07 16:06 by cristian.cocioaba