This article is about a small sensor node with a decorative case. It is based on the Raspberry Pi Zero W board with a custom sensor shield on top.
I publish all hardware files for a simple version of the sensor, so you should be able to build this kind of sensor nodes and use it to monitor anything you like. You can also extend/modify the design easily with additional sensors. Nevertheless, the case lid design is based around the Plantower PMSA003 particle sensor. It has all required air vents for this use.
The term “node” is used, because the idea of this sensor is to use a large number of these nodes in a network to monitor location and time based sensor data.
I cannot publish any software at this point, until I have a simplified and redacted version which I can publish under an open source license. Yet, accessing the sensors of this node is dead simple and can be easily done.
The Required Hardware
The simplified design is assemble using the following components:
Raspberry Pi Zero W with soldered headers.
Minimalistic Custom Shield (see description below)
Four short M2.5 screws and nuts to fasten the Raspberry Pi in the case.
Optional four M2.5 10mm long spacer to also fasten the shield.
One or two short M2 screw to fasten the Plantower sensor to the shield.
USB Cable and power supply to power the node.
The Raspberry Pi Zero W
I use the Raspberry Pi Zero W because of the very compact size and computing power. Each node can prepare the sensor data, which takes a lot of load from the central processing unit. Also, using a platform like the Raspberry Pi easily allows to run a whole web server on each node – so one can query the sensor data of each node independently. This makes testing a breeze.
This is the sixth part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the first, second, third, fourth and fifth part please do it now. These parts contain a lot information which lead to this point of the tutorial.
The fifth part ended with step 24, where I talked about calculating the total bill of materials. This part will focus on preproduction of a small batch of sensors to solve some final details.
Just note, I obviously do not follow these steps in a perfect sequential way. Often I start with some tasks earlier and things are running in parallel. There are various dependencies and it would make no sense to wait with some task just to follow a strict sequence. 🙂
If you follow my blog you may already read some details about ongoing tasks. I will just briefly talk about them in this article. You will find more details in the other blog posts.
Step 25: Build an Alpha Series
Everything looks very promising, so its time to build a small batch of the final devices to see if they work as expected. This is also a test to see how a larger number of these devices can be produced and what kind of tools are needed for this task.
Order the Components
First I order the components. This is very important, because the availability of electronic components changes all the time. It is nice to have all required components, so you can order the boards with the correct footprints. If you order the boards first and are unlucky, an important component is suddenly unavailable and you have lots of boards with wrong component footprints on it.
I started a second take on the long term tests for the plant watering sensor. This tests are required to be sure, the measurements follow the expected cycles. After watering the sensor, the frequency should go down and while the soil is drying up, the frequency should go up the the initial value.
Logging this measurements is very important to get a good overview of the measurements and be sure if every aspect of the device works as expected. At this point, I especially test the sealing of the foot part of the sensor. If it keeps completely sealed against water, I should get very consistent and repeatable readings.
The curve on the right side shows the measurements of the last 48 hours. These small variations are normal and are most likely caused by the plant itself or because of temperature changes of the board.
If you have questions, miss some information or just have any feedback, feel free to add a comment below.
This is the fifth part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the first, second, third and fourth part, please do it now. These parts contain a lot information which lead to this point of the tutorial.
The fourth part ended with step 20, where I did usability tests and stability tests using the preliminary firmware. This article will focus on designing the final board for the project.
Step 21: Design the Final Board
Designing a good board is like one of these puzzles with quadratic tiles, where you try to lay down a 3✕3 set where all edges match. Often a small change result in many follow up changes, so you have to rip-up a lot of routes and design them in a new way.
My goals for the board were:
Everything, except the two LEDs, should go to the top side of the board.
Reduce the amount of vias to the absolute minimum.
Create a ground pour, especially around the oscillator part, to reduce noise.
Move the button as far as possible from the oscillator to minimise the influence if the user presses the button.
Make it as small as possible.
I worked with small iterations, checking the design after each iteration and checked the design against my goals. To keep track of the changes, I versioned each larger iteration. This way I could go back at a later stage for comparison or if a change did not turn out well.
I worked with Autodesk Eagle to create the board. This tool is in the current state far from perfect, but it is cheap and has all required features for the task. For me personally, these are the features I need to design a board:
Smart routing editor which is linked to the schema.
Quick and easy way to create vias and see the required connections.
Good library support for symbols and packages.
Design rule checks.
Quick board preview to check label placement and design.
This is the third part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the first and second part, please do it now. These parts contain a lot information which lead to this point of the tutorial.
The second part ended with step 14, designing a first prototype PCB. So let us start with the next steps in this journey. This article will be the smooth transition from prototyping to the initial planing for a final design.
Step 15: Assemble and Check the Prototype
After receiving the prototype PCBs from OSH Park, I assemble one completely, including the cable and with one of the sensor plate prototypes as foot part.
Set the Fuses of the Microcontroller
The microcontroller ATtiny13A requires programming using SPI before it can be soldered to the board. There are special bits in the memory, called “fuses”, which control very basic settings of the chip. One of this fuse controls if the chip can be programmed and debugged via the debugWire protocol. This protocol just uses one single wire to program and debug the chip, bus has to be enabled first.
So I put the microcontroller into the programming adapter and connect everything via the Atmel ICE to the computer.
This is the second part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the first part, please do it now. It contains a lot information about constraints and decisions made which lead to this point.
The first part ended with step 11, building a working prototype with the selected key components. So let us start with the next steps in this journey.
Step 12: Analyse and Measure the Prototype
Never forget why you actually built a prototype. It is your tool to verify all assumptions you made in the design phase. To do this you need the right measuring instruments.
The Power Usage
I start measuring the current of the circuit. This will show if my assumptions about the battery life will be true. For this test I use a multimeter which has a good resolution measuring in the µA range. The multimeter I use is the Testo 760-3 which is not a very well known brand. Multimeters are usually really poor at measuring low currents on low voltages, so let us see if this will work.
I also use a Fluke 114, but this one has no current measurement. It is sometimes very handy to have two multimeters, one to measure the voltage and a second one to measure the current.
For the first test I program the MCU to do all the tests in a loop and connect the power directly to the second part of the circuit. Now the power is always on and I can measure the current used by the MCU while doing the measurement.
In this article I will talk about how I designed a cheap plant watering sensor. My goal is some kind of meta tutorial, where you can see the steps involved from the initial idea to the final sensor. If you ever planed to create a own device, I hope this article give you some inspiration to start your own project soon.
Why a Plant Watering Sensor?
I have a couple of plants in flowerpots and this plants not only like some light, they also need water from time to time. Watering this plants is something I often forget, with sad results. There are ready made solutions for this, but I have some objections with all of them. To be clear: There are really smart products out there – it is absolutely nothing wrong with them. It is just as I like to build my own fan controller, I like to build my own plant watering sensor in my very own fashion.
Here a list of already existing projects and devices I own or checked out:
After deciding to create a own plant watering sensor, I spend some days to think about my expectations and goals for this sensor.
For my personal case, I like to put a small sensor in each flowerpot. There will be five and more pots, therefore that number of sensors are required. A single sensor should be really cheap, so I can distribute as many of them as I like. Battery life should be at least one year, better two years. I collected all this thoughts into the following list:
Cheap: Ideally less than €5 including the PCB.
Visual Signal: A flashing LED, simple to notice but easy to ignore.
Simple: Easy and simple to build with few components.
Beautiful: It should ideally look like a decoration.
Long Battery Life: The battery should last at least 1 year or longer.
Small: The sensor should be almost invisible from far away.
Reliable: The measurement should be reliable and the sensor must not corrode or degrade over years.
Safe: The sensor must be safe for the plant and environment.
Low Battery Indicator: The sensor should detect if the battery is at end of life and signal this.
After fixing the timing problem with the sensor library, I started the data logger and recorded data in 10 seconds intervals until the memory was full. This time the AM2302 (DHT22) sensor was read every time, no cached values were used.
It created a really interesting data set you can see in the diagram below (click on the diagram to see all details):
The actual measured data values are the small dots in the background, and the lines are polynomial interpolated over these values.
For the temperature (blue) you can see the sensor precision limit of 0.1 and an interesting jitter when the value makes the transition from one value to another. In contrast, the humidity values (orange) do not have the same jitter like the temperature values, but you can see something strange at the crossing point of the two series.
I created a new diagram where you can see this point in detail:
The jitter of the humidity values is minimal, but suddenly there are huge jumps of the values. Compare the jumps with the corresponding temperature values. Because the humidity value depends on the temperature, the jitter from the temperature causes the humidity values to jump.
The test was successful: There is now real sensor data for each measurement.
If this sensor is used for a real time display of humidity and temperature values, there has to be some integrated interpolation to flatten the jitter of the read values. This is no big deal for the data logger, because you can easily do all the corrections and interpolations afterwards.
You can download the CSV file with the measurements and the Excel sheet I used with the links below: