ESP8266 ESP Easy MEGA 2.0

ESP8266 and SMOG part four: Sleep mode for SDS011 in ESPEasy MEGA 2.0

The SMOG sensor project became a bit complex – along with the addition of relay. In the mean time thanks to Gijs Noorlander and yours- since you build, ask and use the sensor – we got updated version of ESPEasy MEGA 2.0 for ESP8266.

Why the new blog entry? That’s because Gijs added the included in SDS011 function that when sent over serial connections allows to put SDS011 to sleep. Simple, elegant solution to extend the life and quality of the measurements of the SDS011 – better than relay approach.

ESP8266 ESP Easy MEGA 2.0
ESP8266 ESP Easy MEGA 2.0

Now, just by means of connecting extra jumper cable we can go back to a simpler version of the sensor – a union of first version with addition of the temperature and humidity sensor form the second one.

Pros and cons of the new design:
Pros:

  • simplification of the project, same software
  • using the included solution for sensor protection form SDS011 – to turn off fan and laser (reminder – the DIY_SMOG_15 gives you 15% of the price)
  • less power drawn (always good for battery powered projects)
  • less CPU power consumed on ESP8266
  • the same longevity as the relay version

Cons:

  • if you would like to move to the next project in future – the relay will still be needed to power the heater

What’s changed then? In previous project the communication was just one-way the SDS011 will now be instructed to go to sleep, turn off fan and laser and wake in intervals (30 minutes + 30 seconds) to make correct measurement.

What will you need?

Hardware:

  • ready project either first, second version
  • jumper cable 1 (yes, just one)

Software:

  • update of the ESPEasy softwar to the MEGA-dev 2.0 (we’re using today version from 26 January 2018: https://github.com/letscontrolit/ESPEasy/releases/). Your configuration of the ESP will be kept, but it’s always good to perform a backup along with “Rules” contents copy to separate file.

Let’s do it!

If you haven’t yet switched to ESPEasy on ESP8266 on Wemos D1 mini please check out the instructions form first SMOG and ESP project.

If you’ve already built the first version (or second) lets start by updating the software. Assuming you’ve got the recommended 4MB ESP version (i.e. the depicted here Wemos D1 mini) – updating the software is as easy as downloading the ZIP from pliku https://github.com/letscontrolit/ESPEasy/releases/tag/mega-20180126 unpacking and using the firmnware Update button from Tools menu of our ESP (any will do – CUBE, LoLin etc):

ESP8266 upgrade - ESPEasy MEGA 2.0
ESP8266 upgrade – ESPEasy MEGA 2.0

Let’s move to the hardware part.
Conections:

Connecting SDS011, BME280 i ESP8266
Connecting SDS011, BME280 i ESP8266

Connect the new jumper cable with the RX of the SDS011 (the green and yellow on the picture), then both TX i RX to ESP8266 – D7 and D6). Power: +5V from 5V pin and the blue cable is GND.

SDS011 RX/TX - Wemos D1 mini
SDS011 RX/TX – Wemos D1 mini

Connections from the ESP8266:

ESP8266 - SDS011 - połączenia
ESP8266 – SDS011 – connections

The BME280 is to be connected via white and gray cables, power from 3V pin and GND is blue again:

ESP8266 - BME280- connections
ESP8266 – BME280- connections

Let’s configure now the SDS011 – anew – do mind the new field for RX :

SDS011 ESP Easy MEGA 2.0 - configuration
SDS011 ESP Easy MEGA 2.0 – configuration

The Sleep Time: 30 means that the data will be gathered every 30 minutes (+30 seconds to spin-up). If you set it at 0 – SDS011 will work just as before in continuous mode.

The BME280 configuration – no changes:

BME280 ESP Easy MEGA 2.0 - configuration
BME280 ESP Easy MEGA 2.0 – configuration

If all went well, the Domoticz address is set, we should be getting similar results:

Devices - ESP Easy MEGA 2.0
Devices – ESP Easy MEGA 2.0

Last but not least – let’s configure the rules to update the SMOG sensors in Domoticz. BME280 is done in classic mode.

Rules - ESP Easy MEGA 2.0
Rules – ESP Easy MEGA 2.0

This is all. You can still use the OLED – by means of parallel connection with BME280.