This instructable shows how to build a rather special pool sensor measuring the pool temperature and transmitting it via WiFi to Blynk App and to a MQTT broker. I call it the "Crocodile Solar Pool Sensor".
It uses the Arduino programming environment and an ESP8266 board (Wemos D1 mini pro).
What's so special about this project?
- The look is just great
- Fully independent from power sources (solar panel feeds the LiPo battery)
- Low power ESP8266 WiFi connected sensor
- Rather high precision temperature sensor
- Data transmission of temp and voltage to Blynk APP for your mobile phone
- Data transmission of temp and voltage to a MQTT broker
- Can be reprogrammed
Your skill level: intermediate to experienced
For this build you will need to know how work with:
- Arduino IDE (programming environment)
- a soldering iron
- a drill
- a sharp knife
- epoxy glue
- hot glue
- industrial spray foam
- spray color
Step 1: Components Needed
- The crocodile head (foamed plastic) found here: Amazon: Crocodile Head
- ESP8266 Wemos D1 mini pro: (Aliexpress)
- Solar Panel 0.25W 45x45mm: (Aliexpress)
- 3.7V 1000mAh LiPo rechargeable battery: (Aliexpress)
- Battery charger module TP4056: (Aliexpress)
- Waterproof temperature sensor DS 18b20: (Aliexpress)
- 22 AWG wire (Aliexpress)
- Prototype PCB board 5x7cm (Aliexpress)
- 220 Ohm and 4.7 kOhm resistors
- a short USB to MicroUSB cable
- Insolating foam sealant @ DIY market or here: (Amazon)
- Waterproof paint @ DIY market or here: (Amazon)
- Filler primer spray @ DIY market or here: (Amazon)
- Car paint spray for finishing @ DIY market
- 5 Minutes 2 component epoxy glue (Aliexpress)
- Hot glue
You might need to use a 3D printer to print a waterproof cover for the USB port.
Step 2: Electronics
I thought it is easiest to start with some of these DIY universal prototype PCBs and I found that a 5x7cm is just perfect for this purpose.
- Prepare the D1 mini pro for using an external antenna:
- Unsolder 0 Ohm resistor next to ceramic antenna
- Turn 0 Ohm resistor downwards and solder the connection to external antenna (good explanation found here - Step5)
Please note: For putting the ESP8266 to sleep it is necessary to connect pin D1 with pin RST. Sometimes the D1 mini pro causes problems with the serial port if port D0 and RST are connected. The one I used (see Aliexpress link above) did not have this problem.
If you are facing this problem you might need to use a jumper or a switch to deconnect the two pins for uploading new code. But (!) then you have no chance to reprogram once the crocodile head has been sealed. In this case you also do not need to bring the USB port to the outside (e.g. to drill a third hole).
Step 3: Hardware Part 1 (Preparation of the Crocodile Head)
In this step we prepare the backside of the crocodile head to get enough space for the electronics. And we are drilling some holes for the antenna, the solar panel and the USB port.
I planned my project first without the USB port. But then I thought that it would be impossible for me to do some software updates once the crocodile has been sealed again. Therefore I decided to use a short USB cable micro-USB to USB to allow an outside access to the ESP8266 board.
Next steps to do:
- Use a sharp knife to cut a little more than 7x5 cm (size of your prototype board) off the hard surface
- Use a spoon to remove the softer foam from the inside
- Just make sure that you have enough space for your cables and your board
- Try out if it fits and that there is still some space to cover it later
Now drill two or three holes into the head:
- for the solar panel
- for the antenna
- (optional) for the USB port for enabling later programming
Use 2 component epoxy (5 minutes) to glue and seal these holes again. Use enough epoxy glue! Make sure that it will be waterproof afterwards!
- Glue the solar panel cable to the head and properly seal the hole
- Glue the solar panel between the eyes
- Glue the antenna socket to the head and properly seal the hole
- Glue the USB plug and properly seal the hole
To avoid any water causing corrosion to the USB port I 3D-printed a little protective cap.
Step 4: Software
You need to have a running Arduino environment. If not, please check this.
Hardware setup is straight forward (on my Mac):
LOLIN(WEMOS) D1 mini Pro, 80 MHz, Flash, 16M (14M SPIFFS), v2 Lower Memory, Disable, None, Only Sketch, 921600 on /dev/cu.SLAB_USBtoUART
Get the Arduino code here:Arduino code at Github
The code is sending the temperature and the voltage of the battery to Blynk. Just load Blynk app to your mobile phone and create a new project. Blynk will send you an Auth Token for this project. Enter this token into the Settings.h file. The default settings will send
- the temperature to VIRTUAL PIN 11
- the voltage to VIRTUAL PIN 12
but it is easy to change these pins in the code. Just play around with all the Blynk widgets using V11 and V12 it is fun. If you are new to this just read my friend Debasish's instructable - most of this is explained there in Step19.
In the Settings.h there is a global variable called MQTT. This needs to be set to true or false depending if your are using MQTT or not.
In my case I am using an MQTT broker (Orange PI Zero, Mosquitto, Node-Red) and a dashboard where all my sensor data comes together. If you are new to MQTT then let Google help you to set it up.
If you are familiar with MQTT, I am pretty sure that you will understand the code.
Step 5: Hardware Part 2 (Sealing Again)
In this step we need to pack all the electronics (software loaded and tested) and seal the belly of our crocodile again. I personally see two possible solutions:
- Using a acrylic glass and glue it with epoxy glue waterproof to the belly. For the temperature sensor cable use a waterproof cable duct (I regret that I did not chose this option - after all I went through I would highly recommend to go this way.)
- Using an industrial foam and fill the gaps again, then use waterproof paint to seal. And finish it with filler and paint.
So I decided for option 2. The steps are as follows:
- Solder solar panel cable to the board
- Connect antenna cable
- Connect USB cable to ESP8266 board (AND NOT to the charging board)
- Squeeze all cable and the board into the hole
- Leave 5-10cm of the temperature sensor cable hanging out
- Use the industrial foam to fill all the gaps (Watch out - the foam expands heavily)
- Let it dry and cut the foam afterwards with a sharp knife
- Now use some waterproof paint (is used to fix roofs) and paint it all over
- Let it dry and use the filler paint spray to produce a hard crust (you need to do this over and over)
- After this dried - use some shiny car paint to give a finishing coating.
- Let it dry - FINISHED!
This is an entry in the