Close
0%
0%

Green Detect

Wireless Sensor Network Platform (WSN) , for enviromental monitoring

Public Chat
Similar projects worth following
Green Detect project was created with the aim of providing the community with a tool to monitor and control the environment.
The Green Detect network is independent of the Internet, so it can work even in geographic areas where the Internet is not present.
In the Green Detect local network it is possible to connect from 1 to 60 sensors that transmit their data via wireless through the ESP-NOW protocol to a computer where through the Green Detect application it is possible to monitor each individual sensor, detect alarm conditions, locate the sensors in an animated geographic map and record all acquisitions in order to collect all data for preventive and statistical purposes.
Each individual sensor module is powered by a supercapacitor (or Nimh batteries) charged by a solar panel.
Green Detect is Opensource: anyone can modify and improve the project, for example by adding new types of sensors.




The Network

Each individual sensor module has a specific address that can be programmed by the user using the buttons on the module's electronic board.

The first sensor module transmits its data via 4 bytes to the second module every 30 seconds.

Each module receives the data of the previous modules and retransmits them to the next module adding its own 4 bytes.

The network can include from a minimum of 1 to a maximum of 60 sensors.

This maximum limit is to stay within the transmission limit of the ESP-NOW protocol which is 250 bytes (60x4 = 240).

The maximum suggested distance between one sensor and the next is 100 meters

Therefore the network can develop linearly for a total length of 6 km, for example along a river.

Or you can arrange the sensors in a grid covering for example an area of 1 km x 600 m, such as a field or a portion of a forest.

The last module of the network communicates with the gateway module connected via USB serial to the supervisor computer.

The network is completely independent from the Internet, so it can work even in remote and connectionless areas.

However, if the supervision PC is connected to the internet, the collected data can be shared in IOT applications together with the data of other Green Detect local networks, in order to create a global monitoring!

Sensor Module failure

What happens in the event of a module failure?

In the event of a module failure, communication is interrupted and the acquisition of all sensors is momentarily lost.

After a delay time of 2 minutes, the module following the faulty one begins to transmit data to the following modules, informing the supervisory system of the fault to the previous module.

This condition generates a specific alarm and it is therefore possible to go promptly to replace or repair the faulty module and restore the network in a very short time.

Sensor Module description

The sensor module is based on the Wemos Mini PRO board, containing the ESP8266 microcontroller.

The Microcontroller programming software was developed with Arduino IDE.

The power supply to the microcontroller and the sensors connected to it is provided by a 400F supercapacitor, whose output between 1.5v and 2.7v is raised to 5V by a step-up converter.

The supercapacitor is charged during the day by a 6v 3.5W solar panel.

The supercapacitor is not soldered to the board, but is fixed by a clip and connected by a connector, in order to make its possible replacement quick and easy.

In critical geographic areas (low light, rainy areas) or in case of high consumption sensors, where the supercapacitor may not be able to meet the energy needs, it can be replaced with 2 Nimh batteries in series, without modifying the board, just plug into the same connector.

The module works according to the following steps:

1. sensor signal acquisition

2. receiving data from the previous form

3. data transmission to the next module

4. Deep sleep mode (30 seconds)

All modules connected to the network are synchronized with each other.

Using the buttons and leds on the board, it is possible to program the module by defining the address and the type of sensor used.

The settings are stored in the flash memory of the microcontroller.

The Sensors 

The module can accept digital, analog (10 bit), Onewire and I2C sensors.

Two or more sensors can be combined and connected to the same module, the limit is represented by the fact that we can transmit a maximum of 3 bytes.

Each type of sensor (single or combined) is associated with a unique number, up to a maximum of 99 sensor types.

The addition of new sensors involves updating both the microcontroller software and the supervision application: everyone can do it because the project is Opensource!

If you set sensor type = 0, the module is used just as repeater.

Here are some examples of sensors that can be connected:

Sensor type 1: SR01 Ultrasonic...

Read more »

04 Win application.zip

Installation files for Green Detect Windows application

Zip Archive - 29.64 MB - 06/27/2022 at 22:05

Download

03 Solar panel.zip

Solar Panel electrical drawings and 3d file to print the solar panel case

Zip Archive - 171.55 kB - 06/27/2022 at 22:03

Download

02 Sensors.zip

Sensors electrical drawings and 3d file to print the sensors case

Zip Archive - 534.52 kB - 06/27/2022 at 22:02

Download

01 Module software Arduino ide.zip

Arduino IDE ESP8266 code

Zip Archive - 8.55 kB - 06/27/2022 at 21:59

Download

00 Module PCB Kicad files.zip

Module PCB Kicad files + gerber files and BOM

Zip Archive - 2.18 MB - 06/27/2022 at 21:58

Download

View all 18 components

  • How much does it cost?

    Sergio Ghirardelli10/22/2022 at 09:37 0 comments

    Here's how much I paid for the prototype of a complete sensor module:

    • Module board: $ 45.00 
    • Wemos Mini D1 PRO board: 7.00 
    • Max8815_1 step up converter: $ 13.00 
    • Supercapacitor 400F XV3560-2R7407-R Eaton:  13.00 
    • Supercapacitor mounting clip: $ 1.00 
    • Wifi Antenna 8dBi: 5.00 
    • Module box Gewiss 44006 150x110x70: $ 12.00 
    • Solar Panel 6V 3,5 W: $ 12.00 
    • Solar Panel mounting support: $ 11.00 

    TOTAL:  119.00 

    To this must be added the solar panel box, the sensor box and the cost of the sensor applied, which can range from  $ 5.00 to $ 40.00

    (depending on the sensor and the evolution of the system).

    So it can be said that a complete sensor module can cost between $ 125.00 and $ 165.00

    So if we want to create, for example, a network of 60 sensors capable of covering a portion of forest one kilometer wide and 600 meters long, this application would cost us about $ 9,000.00.

    In my opinion it is a  cheap price!

    Furthermore, the prices indicated are those of a prototype per unit quantity, so this price can go down considerably if you optimize the design and if you produce the components in large quantities.

  • Supervision application

    Sergio Ghirardelli10/19/2022 at 17:02 0 comments

    The longest activity for me was the design of the supervision application.

    Green Detect allows you to create a local network that is totally independent from the Internet, so I wanted to create a supervision software capable of working offline, through a simple USB connection to the gateway controller.

    I wanted to create a versatile and easily customizable tool for those who intend to improve the project.

    The Opensource application was created using Visual Studio in C # language.

    I studied a lot to create this application, I spent a lot of time on the testing phase.

    It was difficult to manage the parameters that can be customized by the user, the management of maps and numbered sensor flags on them, the management of alarms and the creation of the .csv file with the measured data.

    A hard work that has led Green Detect to be a complete system that starts from the sensor hardware and arrives at the supervision software.

    I made 3 video tutorials that describe the application, enjoy:

  • The boxes

    Sergio Ghirardelli10/15/2022 at 17:08 0 comments

    Another important design phase was the box of the three devices that make up the sensor module.

    Being an outdoor project, each box must be watertight to protect the electronics from rain.

    The module.

    I decided to install the module board inside a 150x110x70 standard watertight box.

    The layout of the electronic board has been designed to be fixed inside the box, near the fixing holes.

    The solar panel.

    For the solar panel, I decided to design the box with Thinkercad and print it in 3D.

    I aimed for a particular look, with rounded corners

    For the support arm, I left the user the option of using the standard support for surveillance cameras, in order to allow fixing to the wall or to a possible pole, here is the result:

    The sensors

    Also for the sensors I decided to design the boxes with Thinkercad:

    I tried to give an original and unique look.

    This is the final result:


  • The types of sensors

    Sergio Ghirardelli10/13/2022 at 20:47 0 comments

    On November 10, 2014, the Entella river, which flows near my house, overflowed, causing a lot of damage, including the flooding of my cellar, in which I had set up my small electronics laboratory. I had to throw everything away: oscilloscope, function generator, bench power supply, soldering station and hundreds of components.

    Green Detect project, is my answer to that day, it is my contribution to the Community to be able to prevent events of this type all over the world.

    In fact, the first idea was to create a wireless network for measuring the level of watercourses, using the SR04 ultrasonic sensor

    But thinking about it I said to myself: why not create an open system to accommodate sensors of various types to give the community a more complete, open and versatile tool?

    So I designed the sensor module to be able to acquire sensors of various types.

    The big challenge was to prepare the board and the few channels of the micro ESP8266 to receive such a wide range of possibilities.

    Terminals and fuses.

    First I thought about connecting the sensors and I decided to use the connectors in the figure, providing various terminals to be used depending on the type of sensor.

    Another important thing I wanted to do was to make it possible to use both sensors powered at 5v and sensors at 3.3v.

    I therefore provided special terminals for both power supplies, each with its own standard 5x20 0.5A extractable fuse.

    In an application like this with sensors external to the module, installed in various environments, it is essential to have protection fuses that can be easily and quickly replaced.

    Digital, I2C, Onewire sensors

    I gave the user the ability to set the type of connection via the 4 dip switches SW4.

    Analog sensors

    The Wemos Mini has only one analog input, already used to acquire the voltage of the supercapacitor (or batteries)...how to receive analog sensors?

    I therefore chose to take advantage of the I2C connection to install the MCP3221 ADC chip on the board, through which to acquire the analog sensor.

    Future evolutions

    Green Detect is a project open to new changes. The system can manage 99 types of sensors and at the moment only 4 are managed !!!

    Various types of sensors can be added, such as the PH sensor to be installed for example on a buoy in the sea.

    or the sensor to measure the turbidity of the water ...

    or the excellent BME280 for measuring barometric pressure, temperature and humidity...

    Each new sensor will lead to a new software version to be shared.

    Green Detect is open to many solutions and everyone can contribute because Green Detect is Opensource!

  • Address setting

    Sergio Ghirardelli10/05/2022 at 20:50 0 comments

    The Green Detect network can include 60 nodes, each of which has its own communication address.

    The address in the ESP-NOW network is the Mac Address of the ESP8266 and is unique for each microcontroller.

    In order to facilitate communication between the various modules, I decided to manually preset the address, in order to establish a common root for all modules belonging to the network.

    In practice, the first 5 bytes are the same for all nodes, while the value of the sixth byte has an initial value of 0x00.

    The numbers assigned to the first 5 bytes are decided by the user who writes them only once directly into the Arduino IDE sketch to be loaded into all the microcontrollers on the network.

    Address setting

    The last byte is the one that will identify the node within the network: this number is the sensor address that is programmed by the user directly on the module board.

    The first module on the network (the one that initiates data synchronization) must have address # 1. The subsequent modules must have a progressive address (2... 3 ... 4….) up to a maximum of 60.

    Therefore each intermediate module ( with address #n) is automatically set to receive data from node # n-1 and to transmit data to node # n + 1.

    How to set the address?

    The easiest way would have been to install dip switches in which to set the address directly, but to get to 60, I needed 6 bits, so I occupied 6 digital inputs only for the address!

    It would have been a waste, which would have prevented me from using ESP8266.

    So I decided to do this:

    I used 2 buttons and 2 LEDs.

    I have created a "program" mode that can be activated by pressing the 2 buttons (SW1 and SW2) simultaneously.

    The first programming step is for setting the module address.

    User can press SW1 to increment the ones and press SW2 to increment the tens (second button).

    The number of blinks of the LEDs is the feedback that indicates to the user how many ones and how many tens.

    When the user press again both buttons, the address programming step is over.

    The address value is stored on microcontroller flash memory at the end of program mode.

    Last module setting

    The last module of the network communicates directly with the gateway to which I have decided to give address # 99.

    So the last node on the network must not transmit data to # n + 1, but to address # 99.

    To set a module as the last one, I decided to add a step to the program mode, in which the user can set the module as "last" by pressing SW2 (led 2 blinks quickly) or as "not last" by pressing Sw1 (led 1 blinks quickly)

    In the next log I will describe the next programming step, the one to set the sensor type.

  • Timing and synchrony with self adapting deep sleep time

    Sergio Ghirardelli10/01/2022 at 16:08 0 comments

    Another great challenge was to find the right timing and synchrony between all the modules in the network.

    The reboot after deep sleep had to be right.

    If in advance it would cause high power consumption, if delayed it would result in information loss or blocking.

    After struggling with mA, I also had to struggle with milliseconds ...

    Communication description

    The module that is programmed with address 1 is the one that controls the synchronization by periodically transmitting its 4 bytes + 2 bytes communication control packet used by all the modules:

    • Sync time = offset parameter programmed by the user, to improve synchronization by anticipating or delaying it

    • Life = number that increases with each sending of packets

    The next module, after reading the sensor, performs the following functions:

    1. Begins to receive data and when the "Life" byte
      increases in the correct way, it begins to transmit the data to the next module: therefore there is no transmission unless the data has been fully received before
    2. Repeatedly transmits the "Life" control byte
      until the OK arrives from the receiving module, using the OnDataSent function: therefore, in order not to lose data, there is no complete transmission of the packet until the next module is ready to receive. 
    3. Transmits the complete data packet, after which it enables Deep Sleep mode


    Deep sleep time

    The first important thing to define was the Deep sleep Time.

    Green Detect is a project open to various objectives.

    If our network aims to detect urgent environmental data for the prevention of disasters (for example: forest fires, floods), where it is necessary to be quick to detect any anomalies, it becomes essential to acquire the sensors very frequently.

    If our network is used to acquire statistical data (such as ambient temperature, humidity), it is sufficient to read the sensors less frequently.

    Clearly more frequent is the reading, higher is the power consumption of the module.

    After a lot of tests, I decided to acquire the sensors every 30 seconds, so I set the deep sleep time to this value, here's why:

    • It 's a time that allows a quick detection of catastrophic events, without consuming too much, for me it is the right compromise
    • For slower processes, I know that I acquire and record more data than necessary... but what's the problem?
    • RTC built into the ESP8266 controller is not very precise
      and I have verified that above 60 seconds, the deepsleep time varied significantly from sensor to sensor, making synchronization very complicated.

    Sensor start up time and reading

    The sensors require an initialization time to function, before which the reading is not reliable. In the various tests I have tried to minimize this time, but I have not been able to go below 100 msec.

    The sensor reading time depends on the sensor itself and its libraries and I was not able to act on this task to improve synchrony.

    Data waiting from previous module

    This task is the one where I could act to improve the synchrony and reduce the awake time of the controller.

    This time depends exclusively on how you set the deep sleep time.

    In the first tests I set a constant deep sleep time at 30 sec.

    This route proved to be immediately unsuccessful, with modules waiting to receive or transmit even for 3 or 4 seconds: unacceptable.

    Why?

    Because the network can include different sensors, with different reading times.

    Because the clock of the microcontrollers is not perfectly accurate and within 30 seconds it can accumulates differences between the various modules.

    Because transmission and reception don't always last exactly the same time.

    How to solve this challenge?

    Self adapting deep sleep time

    The only effective solution was to dynamically vary the deep sleep time at each cycle, adding or subtracting an offset time to the 30 seconds of deep sleep.

    To do this, I decided to measure the time from the controller awakening to the reception...

    Read more »

  • Consumption reduction

    Sergio Ghirardelli09/26/2022 at 19:40 0 comments

    One of the most complicated and at the same time most fascinating challenges of my project was to reduce the current consumption of the single sensor module to a minimum, in order to reach and improve the energy autonomy of the module with supercapacitor loaded during the day. from solar panel.

    It was a tough fight against every single mA !!!

    Now I'll explain what I did.

    Operating mode and Deep Sleep mode.

    First of all, it must be explained that every single module works in 2 ways:

    • The operating mode, in which the microcontroller reads the data coming from the sensor, receives the data packet from the previous module and transmits the data to the next module
    • Deep sleep mode, in which the microcontroller goes into energy saving.

    Action # 1: disable WIFI while reading the sensors

    In operating mode, the Wemos mini card consumes about 70 mA with Wifi running and about 25 mA without Wifi enabled, so I decided to disable Wifi when reading the sensor with the instruction:

    and to enable wifi after acquisition, through instruction:

    Action # 2: reduction of operating mode time

    The second action to reduce consumption was to reduce as much as possible the time it takes the microcontroller to perform each phase of the operating mode: I carried out many tests with the various sensors, to reduce these times, while still maintaining a margin of reliability. ..I have managed to reduce the awake status of the controller to about 1 second!

    This result was possible thanks to the ESP-NOW protocol which becomes instantly operational and does not require long times to initialize: this is the main reason why I chose to communicate via ESP-NOW!

    Action # 3: cut sensor and LED power supply

    This action was perhaps the most decisive to achieve the desired result of reducing consumption.

    During the Deep Sleep mode, while the controller was in power safe, the sensors connected to the module and the D1 led continued to draw current, in some cases even up to 10 mA! Unacceptable!

    How can I solve this problem? Here's how I did it:

    I decided to enable / disable the power supply to the sensors (sen_gnd) and to the LED, via an N-channel Mosfet (AO3400A), driven by a digital output of the microcontroller.

    Before acquiring the sensor signal, I enable the power supply through the instruction:

    After reading the sensor, I disable the power supply with the instruction:

    The result was fantastic!

    Action # 4: MAX8815 step-up converter

    To power the Wemos mini and the sensors (5V), it was necessary to use a Step up converter to raise the voltage supplied by the supercapacitor (from 1.5V to 2.7V).

    The first tests with low cost converters were disappointing, due to the performance.

    I therefore decided to make a Step Up converter based on the MAX8815 chip (https://hackaday.io/project/183512-max8815-step-up-converter)

    This chip has an efficiency of up to 97%, which is great for a project like mine.

    Action # 5: no absorption of the charging circuit

    Another action to reduce consumption was to prevent the passage of current in the charging circuit of the supercapacitor, by adding diode D2.

    Action # 6: Wifi power setting of the Wemos Mini PRO

    The Wifi circuit of the Wemos Mini PRO, at maximum power, consumed too much for my project (about 125 mA).

    For this reason, I decided to reduce the power of the wifi, using the command:

     I set the value to 10, which represents about half of the deliverable power (max 20.5).

    The value chosen is a valid compromise that allowed me to reach a communication distance of 150 meters (so I can guarantee 100 meters) without consuming too much.

    Discharge Endurance test without solar panel

     After all these actions I carried out two endurance test of a module in normal operation, without solar panel, with a deep sleep of 30 seconds, to measure the duration of operation before discharging, obtaining the following results:

    First test: Module powered by supercapacitor. Result: duration about 25 hours before turning off

    Considering the very...

    Read more »

  • Wemos Mini PRO

    Sergio Ghirardelli09/24/2022 at 15:06 0 comments

    To build my wireless sensor network, I chose the Wemos mini board, based on the ESP8266 chip, for the following features:

    • Compact dimensions

    • Low price (around 6 euros)

    • Possibility of being programmed with Arduino IDE

    • Very low consumption: 70 mA with active wifi, 250 uA in deep sleep mode

    • Built-in WiFi

    • Possibility of using the ESP-NOW protocol

    • Possibility of connecting I2C and Onewire sensors, through libraries available on the network

    Project sizing and I / O list.

    In order to confirm the choice, I made a preliminary study to understand if the Wemos mini was adequate for my needs.

    Test bench.

    The next step was to build a portable test bench consisting of: 

    • n.4 breadboards in each of which I simulated the single sensor module, installing the wemos mini controller with the various buttons, LEDs and sensors added during the evolution of the project 
    • n.1 breadboard where I simulated the gateway module

    On this test bench I developed all the hardware and software part of the project.

    PCB design and construction

     When I finished testing all the functions, I designed and built the PCB.

    I chose to make the Wemos mini card removable, to simplify installation and possible replacement in case of failure.

    Switching to Wemos mini PRO

    For the final product, i chose the PRO version, which allows the use of an external antenna, essential for reaching the minimum distance of 100 meters between one sensor module and the next.

    In order to use the external antenna, it is necessary to move the position of the resistance from 0 ohm as in the figure below.

  • Compact layout or not?

    Sergio Ghirardelli09/01/2022 at 15:00 0 comments

    My first sensor module layout idea was to design a compact box that would enclose in a single object: module, sensor and solar panel, something like this:

    But I immediately realized that it was not the most suitable solution, because it was not versatile.

    A wireless sensor network platform that has the main function of preventing dangerous natural events (such as fires and floods) must be more flexible, in order to allow the solar panel to be positioned in the sunniest point for maximum efficiency, even at higher heights than the ground. While the electronic board must be placed in a convenient position for configuration and maintenance operations, furthermore the sensor used must have the possibility of being placed in the most appropriate position.

    For this reason, I abandoned the idea of a single compact box and decided to divide each node into 3 independent parts:

    1) Solar panel, with its adjustment bracket

    2) Sensor module

    3) Sensor.

    The drawing below shows an example of how in a sensor network  for the detection of forest fires, it is of fundamental importance to have a flexible layout like the one I have chosen for my project.

    In the next videos I show how to install the solar panel and one of the sensors.

  • Module failure test

    Sergio Ghirardelli07/12/2022 at 20:38 0 comments

    What happens when one of the sensor modules fails?
    The answer is in the following video ...

View all 12 project logs

  • 1
    Definition of quantity and type of sensors, order material

    Define the number of sensors that will make up the network and the type, considering that some modules can be used as signal repeaters without connected sensors (sensor type = 0).

    Then proceed with ordering all the necessary material, following the list in the "components" section. 

    Don't forget to order the additional Wemos D1 mini for Gateway.

  • 2
    Component assembly

    For each sensor carry out assembly of:

    • Sensor Module.
    • Solar Panel.
    • Sensors
    • Unit assembly according to sensor electrical drawing
  • 3
    Load software into the microcontroller and set Network address

    Download latest Green Detect sw version from Github repository.

    With Arduino IDE, open the file .ino and set set your unique network address.

    Save, compile and Install last software version on each module Wemos Mini pro microcontroller by Arduino IDE.

View all 9 instructions

Enjoy this project?

Share

Discussions

Sergio Ghirardelli wrote 09/30/2022 at 13:11 point

Thank you!

  Are you sure? yes | no

Dusan Petrovic wrote 09/30/2022 at 12:24 point

Love your project, very cool.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates