Introduction: 16 X 2 LCD I2c Displaying MQTT Data
Thanks to Random Nerd Tutorials and 3KU_Delta for their inspiration, help and code.
Step 1: The Crocodile Pool Sensor
3KU_Delta published a great project here on instructables: Entire Croc Project
The project included posting the temperature, time of last update, and battery condition via Blynk and MQTT. He later added an appendix for creating a large LED display and seeing the data on Node Red for a Raspberry Pi.
I changed a few things:
I wanted to have more power and more charging capability. I therefore:
1. I put a larger (6V 1W Solar Cell array) on top of the croc; even though this was 6V as oppose to 3.7V, the TP4056 kept the voltage to the battery and the circuit to the correct value.
2. I put a larger (2000mAh Rechargeable Lithium Polymer ion Battery Pack inside the croc. In a revision from his original post, 3KU_Delta recommended this larger battery.
The larger battery did not fit on the 5cm by 7cm circuit board 3KU_Delta used, but I used that size board anyway; it gave me more room to mount the components than a smaller circuit board as well as putting the TP4056 voltage regulator on the same board.
To be certain that the ESP8266 Wemos D1 mini pro and the TP4056 would not have any possibility of getting pool water on them, I sealed the entire circuit board using "Food Saver" material. I closed the material using a small Mini bag sealer available on Amazon. I fed the wires for the Solar Cell, the battery, the antenna, and the ds18b20 through one end of the "bag" and then sealed that hole with Silicone sealer.
By the way, (as 3KU_Delta says in a comment) be sure to seal the ds1820b with a thin layer of epoxy to insure that the pool water will not damage the sensor.
Step 2: Display on a Small (16 X 2) LCD
I wanted to retrieve the data from my raspberry pi MQTT broker and see the data on a small LCD display. Random Nerd Tutorials published two projects as well as the steps to get multiple MQTT publishes in a single Arduino ide program. Here are the links to those items:
I am thankful to Rui Santos for allowing me to publish the code I created by modifying and using all three of his entries.
Parts needed all easily available on Amazon or Ebay:
1. ESP8266 NodeMCU board
2. 16 X 2 LCD display with i2c board attached - be sure to get a display with an i2c board attached. That will save you lots of time soldering the i2c board to the LCD display.
3. Plastic baseball display case - I found a very inexpensive one on Amazon and used only half of the case. Unfortunately, the LCD is slightly larger than the baseball case. If you want to put your project in a closed case, the least expensive softball case found was at The Container Store.
4. Short hookup wires
5. Heat shrink tubing to hold wires in place.
As you can see in the image above, I used only one half of the case. If you want a larger case which closes, I suggest a softball case. The least expensive I found was from The Container Store (sku#:44070).
I posted my code on GitHub: Code
Thanks to 3KU_Delta and Rui and Sara Santos of Random Nerd Tutorials for their help and inspiration.