### Building a soil humidity sensor for pot plant

#### Humidity soil sensor with ESP8266

The product of this section is building a humidity monitor powered by battery, push data to home server by Wi-Fi using MQTT protocol.
###### Shopping list:
1. Project Box, water proof, $0.81 (+1.59) 2. WeMos ESP8266,$2.12 (+0.21)
3. A cellphone Lithium battery, $3.05(+56.23, lithium shipping is not very convenient between China and Vietnam) like this one. I salvaged mine from a 7.4V pack, about 1000mAh 4. 5V step-up converter from lithium battery,$1.77/5pcs(+0.74)
5. 1S PCB for 18650 protection circuit, $3.59/3PCS(+1.58) 6. Watering larm humidity sensor (Chirp),$1.38(+0.28)
7. Waterproof temperature proof (ds18b20), $1.04(+0.21) 8. Wires, shrink tubes, resistors (300Ω, 4.7kΩ, 5.1kΩ, 10kΩ), blue led (optional), hot glue gun, toggle switches (x2), Dremel 9. 12hours ++ (for my case), built time (2hours), lots of testing A total of$10-12

###### Wiring parts together

I used a 5.1kΩ and a 10kΩ for a voltage divider, but a 4.7kΩ for 5.1kΩ works as well. The only difference is the maximum voltage for A0 pin when the battery fully charged (4.2V). For 5.1kΩ value, that maxium voltage is 2.78V or 862/1023 for the output for analogRead(A0) function. For 4.7kΩ the maximum of A0 output is 2.86V or 885/1023.

If you use other generic ESP8266, the maxium voltage for A0 is 1V. You need to use a pair of 3.3k and 10k Ω with 3.3k one connected to the GND. This pair gives the maxium voltage for A0 is 1.04V which is fine with a generic ESP8266.

###### Here is the fun part: Building
• Use a cutter with a sharp nose to remove the USB header from battery-5V boost board. Soldering a pair of wire to the blobs marked as G and V (5V out).
• Connect 1S 18650 protection circuit with B+ to the positive pole, B- to the negative pole. P- on the circuit is the negative out that is connected to the GNV in of the boost board.
• Cut 3-4 holes: one for miniUSB charging, one for a power switch, one for the wires to DS18B20 and the Chirp. The forth is needed if later you want to charge the battery with a solar panel.
• Wiring parts as in the diagram above. Apply hot glue to fix and seal the hole to the box.
• Cover the top of Chirp by a plastic bag