Lucky Resistor
Menu
  • Home
  • Learn
    • Learn C++
    • Product Photography for Electronics
      • Required Equipment and Software
    • Soldering for Show
  • Projects
  • Libraries
  • Applications
  • Shop
  • About
    • About Me
    • Contact
    • Stay Informed
  •  
Menu

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

Posted on 2017-03-092017-05-01 by Lucky Resistor

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.

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.

Create the Board Shape

Eagle lacks any tools for design, so I create the initial draft of the board in Adobe Illustrator. Here I convert all curves into straight lines and export everything in DXF format. From there, with a little bit luck, it can be imported into Eagle.

Shape V3.png

In Eagle, I first move everything to the right place. Next I change the board outline to the Dimension layer and everything else to the Document layer.

Now I had to create all the polygons, because Eagle lacks any usable polygon import. Here I just used a very fine raster and traced the polygons for all copper pours and the solder mask areas where the points should be visible.

The Components

The prototype board was quickly made, so when I started designing the final board, I started from scratch. After importing the outline I placed the components in a way to reduce the route distances. Here I focused on the chips and these elements which have some location restrictions, like the battery holder and the pads for the wire at the bottom.

All small components, like the resistors and capacitors, can be placed in a more flexible way. Therefore I just place them near the place where they are used. When I start to draw routes, I have a better view for good locations of them.

I started with the power routes, because they tend to split the board into sections and are hard to place in a easy way. I also drew routes for all ground connections, these will get obsolete with the ground pour, but I like to be sure there are short connections between all ground pins on the board.

Iterations

In the next sections I will briefly point out the changes I did between the different versions of the board. These iterations are sometimes very small.

Version 2 (Protoype)

version2b
version2t

This was the prototype board, I just added it for comparison. It has a width of 49mm and is therefore more than 10mm larger than the final board. There was no size pressure and I could place the components freely without any troubles.

Version 3

version3b
version3t

In the first version of the final board, I added the foot of the sensor as a break-apart part below the head. You can see even the traces which connect to this part. It is an idea I dismissed later, because of various problems with the production.

This version still has one LED, because I created the board before the final tests with the prototype to see how small I can go with the board.

Version 4

version4b
version4t

With this iteration I added the second LED to the design and had to change the routes slightly to do this. I also connected the fourth pin of the debug adapter to the battery power, so I am able to read this voltage in a reliable way.

Version 5

version5b
version5t

This version was an immediate step to optimise the break-apart section of the foot.

Version 6

version6b
version6t

In version 6, I worked on the debug connector. Because it will rarely be used in the final product, I changed it to a small pad based version. It will be connected using an adapter which is normally used to connect to a SOIC chip on the board. It is some kind of clamp I modified, so only one side of the clamp connects to the four pads.

As you can see, changing the debug adapter freed a lot of space, which I use in the next version to optimise the routes.

At this point I also removed resistor R2. Instead of using the perfect value to get a 10 second interval, I use a single resistor which will generate a 9.5s interval.

Version 7

version7b
version7t

Here I changed the layout of the LEDs to move them to the center. I also worked on the copper pours of the top and bottom side of the board. With the free space from the new debug adapter, I could move the resistors into better positions. Especially resistor R11 was too close to the battery. I like to have some space around the battery to prevent any shorts, even the battery is inserted with too much force.

I added optical alignment points, just to be able to compare the boards easier. Nothing to last for the final version.

Version 8

version8b
version8t

This version was focused on removing the foot part from the board. I added this milling gaps at the bottom to provide room for the insulation of the wires which are soldered to these pads. The wire will lay absolute flat on the pads this way, this makes any bending obsolete after soldering. It also helps to place the wire at the right position.

I ordered a prototype board from this version (without the misplaced via) from Eurocircuits, to get one board for further testing and have some reference for the final size.

lucky-resistor-1
lucky-resistor-2

Version 9

version9b
version9t

In this version I fixed all problems I found on the ordered board. My original idea, the LED will reflect nicely from the bare copper in the middle was a bad idea. These two LEDs need to be hand soldered, and it is very tricky to do this without a proper solder mask there.

I also added the decoration elements to make the board look more like a flower.

Version 10

version10b
version10t

In this version, after all components settled into the right positions and testing was successful, I started optimising the routing. I also had the final BOM defined, so I went and updated the package layouts to exactly match the ordered parts.

As you can see, I replaced the hand solder resistor pads with ones for reflow soldering. The gap between the pads allowed a more aggressive reduction of vias and routes on the bottom layer.

On the bottom layer I especially removed all routes I could, and added better markings for the LEDs in the middle.

Another focus was the readability of all labels and their placing on the board. The lines of the vector fonts were a little bit small, so I increased all lines to the recommended minimums.

Version 11

version11b
version11t

Here I only focused on the copper pours and optimised them to especially enclose all routes which carry any frequency from the oscillator.

This is almost the final design for production. All further changes are barely noticeable. I added more markings to make the locations of the components better visible and shifted the labels slightly. I also removed the optical marks in preparation for the production.

Step 22: Define the Final Bill of Materials

Step 21 and 22 are actually something I did in parallel. You need to fix the final components so you can use the correct pad layout – and without the final design of the board, it makes no sense to fixing the BOM.

I use the BOM tool from Octopart to manage the list of components. It is incredible useful, because you always have the total cost and availability of all your components in plain sight.

Here the list of components for the first batch of devices:

Qty Manufacturer
MPN
Reference Distributor
Unit Price
Total
1 Texas Instruments
TPL5110DDCR
IC1 Mouser
EUR 0.58
EUR 0.58
1 Microchip
ATTINY13A-SSHR
IC2 Mouser
EUR 0.46
EUR 0.46
1 Microchip
MCP6L01T-E/OT
IC3 Mouser
EUR 0.18
EUR 0.18
1 Fairchild Semiconductor
BSS84
Q1 Mouser
EUR 0.06
EUR 0.06
1 KOA Speer
RK73H2ATTD1102F
R1 Mouser
EUR 0.007
EUR 0.007
2 KOA Speer
RK73H2ATTD1502F
R2;R4 Mouser
EUR 0.007
EUR 0.015
2 KOA Speer
RK73H2ATTD82R0F
R5;R11 Mouser
EUR 0.007
EUR 0.015
6 KOA Speer
RK73H2ATTD4702F
R10;R3;R6;
R7;R8;R9
Mouser
EUR 0.007
EUR 0.040
2 Murata
GRM21BR71C105KA01L
C1;C2 Mouser
EUR 0.025
EUR 0.051
1 SloanLED
SMD-G0805-02
LED1 Distrelec
EUR 0.16
EUR 0.16
1 SloanLED
SMD-R0805-02
LED2 Distrelec
EUR 0.05
EUR 0.05
1 Linx
BAT-HLD-001
BT1 Mouser
EUR 0.22
EUR 0.22
1 ALPS
SKQGAKE010
S1 Mouser
EUR 0.11
EUR 0.11
Total per Unit (Batch Size 100-999) EUR 1.96

Starting from a batch size of 100, the price difference gets minimal until you reach 1000 and more. The next diagram shows the unit price, related to the batch size:

prices-per-batch-size

Step 23: Plan the Assembly

To assemble a small batch of devices in a fast an efficient way, the best would be to let a manufacturer produce the boards and assemble them. This would be nice and easy, but would take the fun, of assembling the boards by hand, out of the project. 🙂

The fastest way to assemble the device by myself is using panels with a stencil and hot air. So I can prepare one or more panels with solder paste, add all components to them and flow soldering most of the components. There is a little bit work left to solder the battery holder, the two LEDs and the wires in place, but this is fast and easy work – compared to all the small resistors and chips.

I found out, the most economic panel size for the project is a grid of 4×2 boards for the head part. For the foot parts with the sensor plates, best is to let the manufacturer produce them as single boards and panel them as he likes.

Each sensor plate (foot) also requires a heat shrink tube, to protect it from the microorganism in the soil and protect them from the copper in the board. Copper is toxic for microorganisms, so it should never come into contact with the soil.

Step 24: Calculate the Total Cost

“Hidden” Costs

The table does not contain costs for additional material like the two pieces (=40cm) of wire for each sensor (~EUR 0.1) and for the solder paste for each board. The solder paste is: ~56mm² × 130µm = 7.28mm³ per unit. This is just a very rough estimation, there is always some waste and paste stuck in the stencil.

With a cost of EUR 0.0013 per mm³ for the solder paste, there is additional ~EUR 0.01 per unit for the solder. Also a small amount of solder is used for the LEDs and to solder the wire to the device, here I found this is just additional ~EUR 0.001, nothing to worry about.

Each sensor foot needs 40mm hot shrink tube to protect the PCB from microorganism in the soil. This is additional EUR 0.07 per unit.

I do not calculate any cost for the labour used to assemble and develop this project, because this is no commercial enterprise and I do this for fun. But this would be part of any professional calculation.

There are also other costs which are not included here, but can get important for a real calculation:

  • Shipping fees for component and board orders.
  • Energy costs (Soldering, Hot Air, Heating, Light)
  • Storage, working place costs (Rent)
  • Amortisation of tools (Things will break, you need to buy new or newer ones)
  • Software license costs
  • Manual (Print costs, translations)
  • Packaging (Print costs, packaging costs)
  • Packaging for shipping.
  • Costs for sales system (Webhosting, etc.)
  • Taxes

As mentioned in the sections above and below, just to make the list complete:

  • Labour cost for preparation, assembly and packing.
  • Labour cost for development.

Board Prices

For the board, I have two components: The “head” and the “foot”. I found out, the cheapest way to produce them is to panelize the head into a 4×2 grid and produce the foot as single boards by the manufacturer.

With these parameters I get EUR 1.51 per unit for the head part and EUR 1.16 per unit for the foot part. All boards are produced at a very high quality, with blue solder mask from Eurocircuits.

Development Costs

It is important to add the development cost to the calculation. This is not a factor for the calculation of the unit cost for production, but an important value to calculate a price for sale. The price to sell one unit should always be based on the production unit cost + development cost divided by the first batch of sold products. Calculating the price this way, you ensure you get the development costs back by selling the first batch of products. Obviously the final price contains other factors as well.

In my case, there are prototype boards and initial test component orders. Also I created a programming adapter to pre-program the microcontroller. All this will sum up, including various shipping fees.

Unit Cost Summary

With all this collected costs, we get the following summary. Best is if you create some dynamic spreadsheet, where all this costs automatically are calculated based on batch sizes. The following table is calculated for a batch size of 100-200 units.

Item Cost per Unit
Components €1.96
Boards €2.67
Wires €0.10
Solder Paste €0.01
Hot Shrink Tube €0.07
Assembly Labour €0.00
Development Material €2.00
Development Labour €0.00
Total €6.81

Epilogue

Thank you for reading this article! I hope it was insightful as the last parts and will help you with your own projects.

Continue Reading Part 6 of the Article

In a few weeks I will publish the sixth part, which will talk about assembly, product testing and production of a small batch of devices.

If you have questions, miss some information or just have any feedback, feel free to add a comment below.

Have fun!

21 thoughts on “How to Design a Cheap Plant Watering Sensor (Part 5)”

  1. fleebow8 says:
    2017-03-24 at 03:10

    If you could upload the schematic and board files I would greatly appreciate it! I really want to produce a couple of my own but I’ve been having some trouble laying out the board (I’m pretty new to Eagle).

    Reply
    1. Lucky Resistor says:
      2017-03-24 at 08:44

      I will publish the files later under an open source license, after this series is finished. Currently, you have to create your own variant. 🙂 A complete schema is published in part one of the article – there the second LED and a resistor from S1 to the MCU is missing. It would be a very good training for your PCB design skills!

      Reply
      1. fleebow8 says:
        2017-03-24 at 15:27

        Thanks! You’re right, it will be good practice.

  2. Adrian says:
    2017-03-26 at 17:14

    Nice project, I like it and I would like to see part six.
    Good job!

    Reply
    1. Lucky Resistor says:
      2017-03-26 at 17:16

      Thank you! The next part will be published soon. 🙂

      Reply
  3. fleebow8 says:
    2017-04-01 at 04:11

    Hi again,
    Do you have an estimate for about when you will post the part 6? I don’t mean to nag I’m just really looking forward to the next part!
    Thanks!

    Reply
    1. Lucky Resistor says:
      2017-04-01 at 15:54

      There is no fixed time schedule. 😉 The series actually covers the development of a real project – so it can not be faster than reality. Also creating nice images of the progress takes some time and I always prefer quality over speed. Currently I do some important research for the final product, with plants involved – it is something really slow. 🙂

      Reply
      1. fleebow8 says:
        2017-04-01 at 16:48

        No problem! I’m with you on quality over speed.

  4. Dirk Janssens says:
    2017-04-12 at 06:32

    Great project and superb documenting!

    I am planning to design and build a similar sensor device, but with also an air temperature/humidity sensor and network connectivity (LoRaWAN). That way, the measurement data can be processed ‘in the cloud’ and all kinds of extra’s are possible (notifications when dry soil, too cold/hot, graphs…). The idea is to use it at my work for monitoring all the office plants.

    If you’re interested, I can post our design when it’s finished (couple of months). It will be using a atmel328p and also a nano timer (TPL5010), but in a different configuration where the mcu stays in deep sleep (with ram retention) instead of power-off. When awake, the mcu controls mosfet switches to power the peripherals (radio module, soil and air sensor) in a way to minimize the total current consumption.

    I have 2 questions:

    I really like your capacitive soil sensor design for it’s robustness and would like to use it in my design. Would it be possible to share the prototype electrode pcb design (from part 1)? That way, I can start with reproducing your results/measurements.
    What software did you use for creating the use-case and flowcharts in part3? They look really nice 🙂

    Reply
    1. Lucky Resistor says:
      2017-04-12 at 10:18

      Hi Dirk!
      Yes, definitely it would be interesting if you publish your project. I think it is always good to publish projects, so others can compare and learn.
      About your questions:
      1. Currently I do long term tests with exact that design. I actually use the final PCBs and electronics in plants and record a few watering cycles to see if everything works as expected. If you have some time left, I would recommend to wait until I publish these results.
      At this point I will also discuss the results of sealing the foot part of the sensor. Here I am currently doing experiments with many different materials as well.
      The principle is very simple and you can create own ones easily. The most important part is the total area of the sensor plate. For my sensor I use an area of 150mm² per plate. I use two such plates for each polarity on both sides of the board, connected with a via at the top part of the board. So there are four plates 5mm x 30mm on the board.
      If you look at the photo from my post from 2017-03-28, you see the whole simple design – there is no magic about it. The plates on the bottom side of the board have exact the same shape and are aligned to the top side.
      There are 3.5mm between the plates as insulation. Minimum here is about half the size of the plates.
      Every component, wire, route on the way from the oscillator to the plates will add up and lower the frequency – here you have to be careful what to use.
      In my case I use two insulated 0.8mm diameter wires with a length of 20cm.
      The whole foot plate has to be completely air-tight and water-tight insulated. Water must never touch the copper plates on the board, and the solder mask is only a short term protection for this – microbes in the soil will eventually destroy it (after months).
      You you like to reproduce the exact board, you can use the file here: https://luckyresistor.files.wordpress.com/2017/04/plantsensorfootv14.zip
      2. These diagrams were made in OmniGraffle for Mac.

      Reply
  5. jam5151 says:
    2017-04-20 at 01:28

    Hello,
    First of all, amazing project and great documentation. It’s been a joy to read these posts.

    Anyway, my dad’s birthday is coming up and I would really like to give him a present like this plant watering sensor for his birthday. He is really into technology AND gardening so it seems like a perfect match! However, his birthday is soon enough that I don’t have time to make the schematic and board files given that I still have to solder everything and get the boards made. I know you said you were going to wait to give this files until your next blog post but I was wondering if you could make an exception. Even if there are a few problems with it that is fine. It might be a fun project for us to debug together. Anyway, I would be really grateful if you could post the files (schematic and board) for the watering sensor.
    Thanks!

    Reply
    1. Lucky Resistor says:
      2017-04-20 at 09:23

      Hi! This would sure be a wonderful gift for your dad. At the current point in time it makes no sense for me to publish the versions of the board I use for testing. On the other hand, the complete schema is already published in part one of this article, here only a resistor between the push button and the MCU and the second LED is missing. These are simple to add.
      So you could create a prototype for him, which would IMO be a very nice idea.
      Another critical point is the firmware of the sensor, which has some room for improvement. This is the reason I am currently doing some long term tests to check if there are parts which should be improved.
      I will eventually publish all material under an open source/hardware license, so everyone can simple copy the design and create a clone of the sensor, but my idea behind the article is to motivate people to design their own devices.

      Reply
      1. jam5151 says:
        2017-04-21 at 12:45

        That makes sense. And I like your idea for the prototype. Do you think you could post the EAGLE library files that you used? There don’t seem to be many libraries online for these parts and it would really speed things up if you could post those files so I don’t need to manually create the parts. Thanks!

      2. Lucky Resistor says:
        2017-04-21 at 13:10

        Hi! I will look into it. It will take some time to prepare the library to publish it.

  6. Alan Lord (@opensourcerer) says:
    2017-04-24 at 17:37

    Thanks for the very thorough and comprehensive write up. My own design processes thus far have really just been to try stuff and see if it works 😉

    I’ve been designing a similar project for some time now but using an ESP8266 and sending the data over Wifi/MQTT for analysis. The frequency readings I am getting from my soil probe are not as precise as yours unfortunately. With the probe in a pot of compost I get one reading. When I add water the frequency goes down, but then it never seems to go up again unless I remove the probe from the soil and sort of restart the whole process… I am wondering how you determined the capacitance of your probe?

    Any feedback you might have would be gratefully received.

    All info for my project is here: https://github.com/theopensourcerer/esp8266-cap-soil-sensor

    Reply
    1. Lucky Resistor says:
      2017-04-24 at 18:28

      As you can see in the schema in part one of the article, I use a simple op-amp based oscillator to determine the capacitance. It will flip in both directions, so the electrons will be pushed in and removed from both sensor plates in an equal way. But it seems you use a very similar way for measurement.

      I assume the problem with your probe has a different reason. Water creeps even into smallest cracks. If the capacitance goes up, but not down, I just imagine there is still an amount of water in the probe.

      Heat the probe for some time and check if this brings the capacitance down.

      To solve the problem, you have to perfectly water seal the probe before you put it into the flower pot.

      I hope this helps. 🙂

      Reply
      1. Alan Lord (@opensourcerer) says:
        2017-04-24 at 18:40

        Ahhh – Good thinking! Thanks… I had been thinking about using something like a balloon as an insulator – the PCB does have a decent solder-mask but yes – maybe it is permeable.

      2. Lucky Resistor says:
        2017-04-24 at 21:18

        This is one of the reasons why the delay to the next part of this series takes that long. I experimented with quite an amount of different materials and methods to seal the probe in a permanent but efficient way. Things like hot shrink tubes will not work because of the water creep effect. I ended up dipping the probes into epoxy, which gave me the best results.

  7. Alan Lord (@opensourcerer) says:
    2017-04-25 at 18:40

    Yes – I have read another source where they sprayed the probe with a polyurethane PCB spray (Kontact 71) which seemed to work best. An acrylic spray (Kontact 70) did not last very long. My balloon idea failed. So I guess I will be ordering some 71 spray 😉 I have put it in a plastic bag for now just to see and it looks like the frequency is increasing over time – although it only 1 day so far 🙂

    Reply
    1. Lucky Resistor says:
      2017-04-25 at 18:42

      I tested it by putting the probe into a glass of water for some days.

      Reply
  8. Alan Lord (@opensourcerer) says:
    2017-04-25 at 18:42

    Sorry a link might have been good: http://www.n8chteule.de/zentris-blog/2017/01/30/erdfeuchtemessung-giess-o-mat-mit-polyurethan-beschichtung/ (In German, but Google translate is good enough)

    Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay Updated

Join me on Mastodon!

Top Posts & Pages

  • Storage Boxes System for 3D Print
  • Use Enum with More Class!
  • Simple Box with Lid for 3D-Print
  • Fan Controller
  • Shop
  • Real Time Counter and Integer Overflow
  • How and Why to use Namespaces
  • The Hinges and its Secrets for Perfect PETG Print
  • Extreme Integers – Doom from Below
  • Build a 3D Printer Enclosure

Latest Posts

  • The Importance of Wall Profiles in 3D Printing2023-02-12
  • The Hinges and its Secrets for Perfect PETG Print2023-02-07
  • Better Bridging with Slicer Guides2023-02-04
  • Stronger 3D Printed Parts with Vertical Perimeter Linking2023-02-02
  • Logic Gates Puzzle 1012023-02-02
  • Candlelight Emulation – Complexity with Layering2023-02-01
  • Three Ways to Integrate LED Light Into the Modular Lantern2023-01-29
  • The 3D Printed Modular Lantern2023-01-17

Categories

  • 3D Printing
  • Build
  • Common
  • Fail
  • Fun
  • Learn
  • Projects
  • Puzzle
  • Recommendations
  • Request for Comments
  • Review
  • Software
Copyright (c)2022 by Lucky Resistor. All rights reserved.
 

Loading Comments...