Accéder au contenu principal

Low cost, low power 6uA garden 433Mhz sensor with temperature, humidity ,hygrometer and voltage

I have built an external sensor so as to monitor temperature, air humidity, soil humidity of my garden and the battery voltage. The requirements was:
  • waterproof
  • long battery life, the atmega328p run at 8mhz with minimal components and functions
  • under 10€
  • wireless (433Mhz) with good range (2 walls to cross and 10 meters)
Here is the final view:


And some reports from OpenHab displaying the sensor data:

Air humidity

Soil humidity

Air temperature

We can of course imagine to use these values to control a water pump. Now let's see hpw to build this.


Bill of material

The sensors is based on atmega328p(3€), 
  • a 433 Mhz transmitter (1,5€) ,
  • a DHT11(1€) or a DHT22 temperature and humidity sensor,
  • a soil moisture sensor (1,6€),
  • an electrical box (1€) 
  • a 433 mhz antenna (0,18€)
  • DIP socket adaptor for the ATmega (1€)
  • an electronic prototype printed circuit board (0,5€)
  • a recycled tube
At total we are around 10€


Principle

Every hour the sensor send the data to a 433Mhz gateway so as to be stored in OpenHAB, the data sent are:
  • air temperature
  • air humidity
  • soild humidity
  • voltage of the power supply
The library used to send the data is RCSwitch.

The program to load to atmega328p on the sensor is here Low power sensor

The main principle of the architecture is to power ON the components on needs by using the digital pins of the ATmega328p as power supplies. The dht, the RF emitter and the moisture sensor are powered from pins directly. With this architecture they are consumming only when activated by the program and reducing by the way the power consumption of the whole system.

The current consumption of the system in sleep mode with 3 AA batteries giving 5V is around 6uA (yes 0,006mA), when retrieving and sending data we reach at maximum 20mA . If we consider that the system is going to wake up every hour 3 seconds so as to measure and send data. The theoretical life of this sensor with AA Alkaline battery (2000mAh) is around 10 years !! For this duration i'm not taking into account the discharge rate of this type of battery that can be significant compared to the consumption of the sensor. If we take into account the self discharge of typical alkaline battery (3% per year) the duration of our system go down to 7-8 years. Remaining quite interesting for my use.

After these theroretical things let's go to the practical side of this project.


Steps to follow

1) First we need to set the extended fuses of the ATMega 328p to disable brown out detection permanently and run at 8mhz, this will be done by a bootloader update

      newlFuse = 0xE2;  // internal 8 MHz oscillator

      newhFuse = 0xDA;  //  2048 byte bootloader, SPI enabled

      newextFuse = 0xFF; // disable Brown Out Detection to save power



So as to do that we will lean on the excellent tutorials of Nick Gammon:
  • Load this program on an arduino uno and wire it like that you can follow the chapter Alternate clock source to avoid the use of quartz on the breadboard. I forked the program of Nick Gammon and modified the valued of extended fuse so as to run disable BOD on the chip bootloader.
  • Once wired link your arduino uno to the pc, launch the arduino IDE and open the serial monitor at 115200 baud
  • If the ATMega328p is detected you will get the details of its current bootloader
Atmega chip programmer.
Written by Nick Gammon.
Version 1.36
Compiled on Jun 21 2016 at 21:40:08 with Arduino IDE 10605.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xE2
HFuse = 0xDA
EFuse = 0xFF
Lock byte = 0xEF
Clock calibration = 0x9B
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...
  • Type L and enter
Using Lilypad 8 MHz loader.
Bootloader address = 0x7800
Bootloader length = 1932 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...
  • Type G and enter
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x7800
Committing page starting at 0x7880
Committing page starting at 0x7900
Committing page starting at 0x7980
Committing page starting at 0x7A00
Committing page starting at 0x7A80
Committing page starting at 0x7B00
Committing page starting at 0x7B80
Committing page starting at 0x7C00
Committing page starting at 0x7C80
Committing page starting at 0x7D00
Committing page starting at 0x7D80
Committing page starting at 0x7E00
Committing page starting at 0x7E80
Committing page starting at 0x7F00
Committing page starting at 0x7F80
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xE2 
HFuse = 0xDA 
EFuse = 0xFF 
Lock byte = 0xEF 
Clock calibration = 0x9B 
Done.
Programming mode off.

Your atmega328p is now ready to welcome the sensor program!


2) Load the program

So as to load the program into the ATMega328p I use the following methods:
  • remove the Atmega328p chip of an arduino Uno
  • place your modified Atmega328p in the place of the stock one
  • on the arduino IDE select "Lilypad Arduino"
  • Connect the usb to the arduino Uno
  • Select the good port
  • Load this program:


3) Prototype the sensor

Now we need to do a little bit of hardware, here is the schematic:



and how it looks like on the breadboard:


And on a prototype PCB:




Once packaged in a standard electric box:



Once this is done you need to receive the data and store it to have some charts about your garden environment, so as to receive the data I use the 433Mhz MQTT Gateway sending the data to OpenHab.
Here is how it looks like on the webUI:




And the big question is ; how much does it last?
It is runningsince june 2016, now we need to wait so as to have more feedback in particular I will need to take into account other factor than the system itself like the influence of the temperature to the battery life.










Commentaires

Posts les plus consultés de ce blog

433toMQTTto433 - Bidirectional ESP8266 NodeMCU gateway between RF 433Mhz signal and MQTT

The goal  is to act as a gateway between 433Mhz sensors and a MQTT broker or between the MQTT broker and 433Mhz actuators, It enables to:
receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data publish MQTT data to a different topic related to received 433Mhz signal 
It can be an interesting part in an home automation system so as to interface sensors and actuators (wall sockets) with software like openhab.

List of compatible sensors here

The interest of putting this gateway to an ESP8266 and not on a raspberry pi is to be able to manage security actions at gateway level (power on a siren, cut power to certain devices) following RF data received by sensors without being dependent to the PI for security related actions.

[EDIT] all infos are now centralized into the github repository take a look at it you will find up to date info about OpenMQTTGateway

You need:

Software:

MosquittoArduino IDE latest version (tested ok with 1.6.10)esp8266 board added to t…

Infrared IR, 433mhz and MQTT on ESP8266 bidirectional gateway 433nIRtoMQTTto433nIR

Following discussions on the home assistant forum people gave me the idea to add Infrared communication to the 433mhz gateway. 

The goal is to act as a gateway between 433Mhz sensors, infrared remote controls and a MQTT broker or between the MQTT broker and 433Mhz actuators, infrared devices, It enables to:
receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data publish MQTT data to a different topic related to received 433Mhz signal receive MQTT data from a topic and send infrared signal corresponding to the received MQTT data publish MQTT data to a different topic related to received infrared signal 
It can be an interesting part in an home automation system so as to interface sensors and actuators (wall sockets), your tv, home cinema, hifi ... with software like openhab or home assistant.

List of compatible RF sensors here

[EDIT] all infos are now centralized into the github repository take a look at it you will find up to date info about OpenMQT…

433toMQTTto433 - Bidirectional Arduino gateway between RF 433Mhz signal and MQTT

The goal of the Arduino 433toMQTTto433 is to act as a gateway between 433Mhz sensors and a MQTT broker or between the MQTT broker and 433Mhz actuators, It enables to:
receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data publish MQTT data to a different topic related to received 433Mhz signal 
It can be an interesting part in an home automation system so as to interface sensors and actuators with software like openhab.

The interest of putting this gateway to an arduino and not on a raspberry pi is to be able to manage security actions at arduino level (power on a siren, cut power to certain devices) following RF data received by sensors without being dependent to the PI for security related actions.

[EDIT] all infos are now centralized into the github repository take a look at it you will find up to date info about OpenMQTTGateway

You need:
Arduino UNO W5100 Ethernet shield 433Mhz Receiver XD RF 5V and transmitter FS1000A 
Transmitter VCC must be p…