I thought it would be fun to create a small prototype that would tell me when my plants need water. Here it the final result:
The red LED flashed to indicate the battery is not dead. The blue LED indicates that the plant needs water. The longer it flashes, the more I should take a few seconds to water that plant!
I already had all the required components, including the Attiny13a and a soil humidity sensor. If you don’t have one, simply search for “soil humidity sensor” on eBay and you will find many like this one:
The whole list:
- 1X Attiny13A-SU
- 2X SMT single row pin headers (2 pins)
- 1X SMT single row pin headers (3 pins)
- 1X SMT dual row pin headers (2X3 pins)
- 2X SMT 0805 162 ohms resistors
- 1 each SMT 0805 blue & red LEDs
- 1X SMT 4.7uF electrolytic capacitor
- 1X SMT 330NF ceramic capacitor
- 1X Through hole single row header (2 pins)
- 1X M1 SMT Diode (equivalent to 1N4001)
- 1X soil moisture sensor kit (sensor + small board)
- 4X AA batteries + casing
- 1X Copper clad PCB
- Optional: liquid tin
So, I started by thinking about what I wanted my project to do:
– Let me know that the batteries are not dead
– Try to use as little energy as possible, so batteries will last for a long time
– Give me an idea of the current humidity level instead of just warning me when I must water the plant
I planned to use 4XAA batteries. With the 1N4001 rectifier diode, I should never have more than 5.5volts, which is the maximum the Attiny can handle. I wasn’t sure if the 2 LED would interfere with the ISP programmer, so I included jumpers to be able to disable the LED (in the end, it was useless). Also, pay attention to the fact that the sensor is powered by an Attiny pin. I was wondering if I should use a transistor to power on/off the sensor but I read that it takes less than 20mA, so it should be ok like that. The schematic says the 2 resistors are 165 ohms, but it should read 162 ohms instead…
I generated gcode for my ShapeOko 3 CNC, using Eagle, and milled the PCB. If you are wondering, I am using a 0.5mm engraving bit (straight ones) to mill my boards, not the V-shape ones. That way, I don’t have to care as much about how deep the tool goes in the PCB. Once the CNC finished machining the PCB, I cleaned it with some acetone. Then, I dipped it in liquid tin which is why the board finish is grey instead of looking like copper. I do that to protect the copper. It serves the same purpose as a solder mask, except that it is conductive.
Then, I printed a layout of my board and added all the components on it. I do that instead of trying to do PCB silk screen (have the component names written on the PCB). Once I have all the components on that sheet, in the right orientation, I am ready to put the solder paste on the board. I forgot to take a picture of that step, sorry about that.
I added solder paste to the board, then I added all the components to the board and sent everything in my reflow oven.
It was my 1st time using that reflow oven for real. The solder paste I bought was supposed to melt at 137C degrees but I had to use a much higher temperature (200C) to obtain good results. This is something I will have to look into, to figure out if the problem is with the soldering paste or with the oven.
Once the PCB was cold, I did a few tests and realized that I placed the M1 (equivalent to 1N4001 diode) and the red LED backwards. I desoldered them using a hand soldering iron and placed them back properly. It’s definitively not perfect but this is acceptable enough as a first prototype.
The next step was to program the Attiny properly. This is what I will share with you in Part 2 of this post!