Menu Close

How to Design a Cheap Plant Watering Sensor (Part 5)

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 firstsecondthird 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.

The Tools

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.

I described some issues of Eagle in this post:

12 Time Wasting Issues in Autodesk EAGLE

As you can see, these are not very advanced features and are supported by almost all good board editors. I never use the auto router, because I do not have time pressure or have to do repetitive tasks. Continue Reading

12 Time Wasting Issues in Autodesk EAGLE

I am a machine engineer and very used to work with CAD software. The abbreviation CAD stands for Computer Aided Design. I personally think, Autodesk Eagle fails with the ‘A’, because often it does not give you any aid. On the contrary it often puts a spoke in the wheel and makes your life horrible.

Please do not get me wrong, there are many aspects I like and the alternatives I know have other issues. I would really like to work with Altium Designer, but a license is way to expensive for me as hobbyist. There is also KiCAD, a very promising program. I will try to do a whole project design in this software soon, to see where the strengths and weaknesses are.

I hope the Eagle developers will be able to add the described features to the software. They develop Eagle using C++ and the Qt framework – I personally really like this language and framework combination and use it for most of my own software.

1. Inadequate Layer Handling

Even if you only work with a two layer board, the board display quickly gets crowded and it is very hard to see all details.


It is not only the visual representation, as soon objects are close, selecting a specific one gets really hard. In some locations, you always have to cycle through many objects, until you find the right one. This is slowing down your work and is really annoying.

Hide some of the layers is the solution for this, but you have to do this either via text commands, or create many own keyboard shortcuts to work efficient. Just for the simple action to only show the top layer, you have to enter display none top and shortly after this display last to restore the previous view. There is a panel, where you can do this actions graphically, but this is a modal dialog and blocks further user input – it is useless for efficient work.

For a software, where layers play an such important role, the layer handling is inadequate. Every modern vector drawing program already demonstrates, how an efficient layer handling can be implemented.


There should be a permanent visible panel, docked in the window, where the list of all layers is visible:

  • It should be possible so view only a single layer and restore the previous view easily.
  • A special combination of layers should be save- and loadable.
  • Layer presets should be accessible via keyboard shortcut.
  • All layer should be made visible with one click.
  • There should be a default view to restore at any time.
  • The panel should be easily hidden and shown with a keyboard shortcut.

Another important missing feature is locking. Each layer should be lockable, so no objects on this layer can be selected or modified.

  • Each layer should be lockable.
  • All layers except one, should be easily lockable and the previous state restored easily.
  • There should be an option to allow modification of attached objects, even if the layer of these is locked.

It could look like this in Eagle:


Ideally a little bit more sophisticated and smaller. Continue Reading

How to Design a Cheap Plant Watering Sensor (Part 4)

This is the fourth part of the meta-tutorial, where I talk about designing a cheap plant watering sensor. If you did not already read the firstsecond and third part please do it now. These parts contain a lot information which lead to this point of the tutorial.

The third part ended with step 18, planing the final firmware. There a decision was made about the language and style of the firmware. This article will focus on the code of the firmware itself.

Step 19: Write a Preliminary Firmware

In order to be able to do some final tests with the prototypes and be able to work on the final PCB, I need a firmware which is is very close to the final one. In the Atmel Studio, I start a new C++ project in a new folder.

The first thing I do is checking the chosen compiler options for the project. Everything looks reasonable, I just add the option --std=c++11 to the C++ compiler options to get the latest language features.

In a section below I will describe all modules I wrote and will point details about the functions. I obviously did not wrote the whole firmware sequentially in that order, instead I use a incremental approach to develop the software:

  1. Create empty frameworks for all modules.
    • Create a header and implementation file for each module with the correct name.
    • Add the header comments, the namespace, #pragma once and the #include for the own header file.
    • At this point, each module should be ready, so I can easily add new functions to each module.
  2. Start with the hardware module.
    • Write the initialisation for the hardware, like CPU speed, port directions and other important stuff.
    • Layout the interface for the hardware module and prepare empty implementation blocks to be filled with code.
    • At each place where code is missing, I write a comment // FIXME!! to be reminded that there is something missing.
  3. Start the logic module.
    • Write the main entry point of the logic.
    • Call this entry point in the main() method of the firmware.
    • Add the hardware initialisation to the logic.

At this point, I have the structure of the firmware prepared as planed. This structure will lead me through the development process. Continue Reading

How to Design a Cheap Plant Watering Sensor (Part 3)

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.

lucky-resistor-1 Continue Reading

A Versatile ATtiny Programming Adapter

As mentioned in my article about designing a cheap plant watering sensor, I built a small adapter which can be used to pre-program the ATtiny13A. This is necessary, because once soldered on the board, I only have a debugWire interface, which has to be enabled first.


The adapter has a small 50mil JTAG header, where the Atmel ICE can be connected with the board. There is also room for a USB mini jack, which is used to power the MCU while programming. A small on-off switch is used to power the MCU and a LED is placed as indicator to see if the MCU has power. The assembled board looks like this:


One of the DIL/ZIF adapters is mounted on top of the female headers. Most of the adapters for SO-8, SO-14 and SO-16 will work with this board. Continue Reading

Plant Watering Sensor – Precise Current Measurement

As I wrote in the first part of my article, how to design a cheap plant watering sensor, I had troubles to get exact measurements of the current, using my Testo multimeter. I searched for a solution and found the µCurrent Gold device, from David L. Jones known for the EEVblog. Later a little bit more about the device, first the measurements.


I could do the measurements using the oscilloscope and not only measure the static current consumption, but the current consumption over time. The graph shown in the diagram, is the reading of if the sensor does one single measurement and flashes the LED. Continue Reading

SMD LEDs Tests

Today I tested a number of SMD LEDs for the plant watering sensor project. I soldered all 13 LEDs I shortlisted onto a small board and connected it to an Arduino Zero Pro. So I could try the different flashing styles I planed to use more or less automatically. That way I could focus on the LED flashing itself, without being distracted by switching cables.


This is the board I made. Very simple but functional. I used red and blue male header to mark the anode and cathode of the LEDs. There is a sticker on the bottom with the LED numbers on it.


I mounted everything on a very small breadboard and did all connections to the Arduino.

Continue Reading

How to Design a Cheap Plant Watering Sensor (Part 2)

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.


Just running, doing the measurement of the oscillator, the second part of the circuit uses at maximum ~1.2mA. This measurement phase should be as short as possible. Later we will analyse the timing. Continue Reading

The Fan Controller Wrapped Up

Yesterday I found some time to put the fan controller in a casing. I used a very cheap no-name case with the dimensions 130 × 68 × 44 mm. First I drilled some 2.5mm holes into the lid, and fastened the Arduino board on it using M2.5 spacers. You see the bottom of the case in the photo – I mounted everything top down, because this simplified everything.

I experimented with the spacer size, until I found the right height, so the display is more or less at the same height as the case bottom. Next I put very small bits of double sided tape onto the corners of the display and put the case bottom on top of the lid. After removing the bottom, the exact position of the display was marked at the bottom with these double sided tape bits.

First I drilled four holes at the expected corners to see the position from the other side. Next I used a Dremel tool to cut the rectangle out of the case.

As usual: This was my expectation of the result… 😉


…, and this was the actual result:


No, seriously, I did not expect much. I just hoped the controller will fit into the case and I cut the rectangle at the right place. So, this worked out very well.

How to Design a Cheap Plant Watering Sensor (Part 1)

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:

Step 1: Define the Expectations and Goals

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.

Continue Reading

Newer Posts
Older Posts