To continue the project of automation with the Raspberry, the first important step for me is to have a sensor able to send wireless data. Here I present to you an example of a probe measuring temperature and humidity.
In this article (very very long), I warn you that you will might not create the best probe in the world. Many sites offer extensive methods to arrive at an optimal solution. Here I introduce the results of my tests. Je compte sur les experts pour proposer des améliorations via les commentaires ?
To recap my probe runs on two AA batteries, with an Atmega328, a LED to indicate the operation and a 433 Mhz transmitter. The LED is optional because it uses energy but useful to confirm that everything is working.
16 17 18 19 20 days of work (the writing of the article took me time), my probe still emits the data with a distance of 5m between the sensor and the Gateway (an arduino connected to a Raspberry Pi), without walls but with a wooden furniture. Here is the evolution of the level of the batteries on the two weeks :
The probe has the following operating : all the 5 seconds (Yes this is for testing), the DHT11 probe is activated, the temperature and humidity are read as well as the battery level. These data constitute the message to send. The message is sent 4 time at an interval of 160ms. Each sending done turn on then turn off LED.
You can therefore imagine that by decreasing the number of messages’ send, removing the LED and by increasing the time between each measurement, your battery can last easily a year (I would soon do an article on the subject).
Before embark you on the adventure, you need a bit of hardware and a ready to use working environment.
You will need :
- An atmega328 (just the chip) with or without bootloader, No matter because we will install our. You can easily find on ebay or Chinese sites in the €1.5 / piece or Amazon. In commissioning several you can still somewhat decrease the price.
An Arduino UNO where you can remove the atmega. It will be used to send the bootloader and probe management program. You can use this Arduino (or another) as receiver. Count in the €10 (official but legal version), a little more on Amazon (faster). The Arduino can be used to build other probes.
A temperature sensor. I used a DHT11 I had at home. This really isn’t the best, the DHT22 is much better, but I only had it at the time. Count € 1.40 the DHT11 or € 4.5 the DHT22 (but ca is worth the cost)
- Rest to burn the bootloader with the command “Burn the bootloader”
You have now configured your node to operate in 3.3V using the internal oscillator which operates at 8 Mhz. This is the first step to optimize the use of energy !
You can now add your sensor and transmitter. If you have a resonator, You can remove it (as well as the capacitors) :
For more detail: With an Atmega, create a wireless temperature sensor
Low cost PCB at PCBWay - only $5 for 10 PCBs and FREE first order for new members
PCB Assembly service starts from $30 with Free shipping all around world + Free stencil
Extra 15% off for flex and rigid-flex PCB