I have 3 ball pythons and I need to ensure they are temperature regulated, too hot and they will not thrive, too cold and they will sleep and eventually die from starvation.
Pythons (Python Regius) are cold blooded reptiles originating from central Africa, which live in a vivarium (as it's normally too cold for them in the UK) with a heater on one side (known as the warm side) and hides on both the warm and opposite side (the cool side). This warm / cold side provides a gradient temperature shift between so allowing the snake to move freely between in order to regulate it's own temperature - Sir David Attenborough would be proud!
Snakes don't have eyelids, so need moisture in the air to protect their eyes, and keep them hydrated, at around 50% - 60% moisture content.
They are covered in overlapping scales which need to be shed approximately every 4-6 weeks, known as ecdysis. End to end shedding cycles last about a week, and during this time it's best to have the moisture elevated (up to about 60% - 65% moisture), this aids in them shedding as the snake skin is moisturised. If the moisture level is just right, the skin comes off in one. If the moisture is too low, the skin comes off in chunks known as a"blow out", in which case you may need to intervene in order to remove any old skin which remains after the shed cycle has completed.
Wikipedia has some good stuff on Pythons, if you fancy a read.
As We need to measure the humidity across the vivarium and the temperature at both ends, we will need 2 sensors per vivarium - so by my maths, that's 6 temperature sensors (+ spares to replace any faulty ones).
In the interest of being completely open and transparent, and as I don't believe in being underhanded, dishonest or hiding any facts. The following links in the Components and Tools sections are setup to take you to Amazon via their Amazon Affiliate Programme, and every purchase you make using them will mean I get a small amount back without plastering ads all over the place.
These are not the most expensive products, I have intentionally tried to keep the costs down for you and as I find alternative products will revise these.
The only reason I am doing this is to give you a chance to show me that you appreciate the content I am producing and if you find it helpful, give a little back to me which doesn't come out of your own pocket.
Here is a list of components used in the creation of this project, you can probably source them from elsewhere (please see Disclosure above).
- ESP32 with Wi-Fi and Bluetooth
- External antenna (as wifi is not great on ESP32s)
- DHT22 temperature/humidity probe - I will need 6 of them as a minimum.
- 10K resistors - one per DHT22.
- 16 GB Micro SD Card - any capacity will be fine.
- Micro SD Card Memory shield
- ESP32 Breakout board
- Micro USB regualted power supply
- Wire
- USB A to Micro USB cable
- 1/2 inch Heat shrink tubing
- Case - I need to build it before I recommend a case.
- Solderless Breadboard
Here is a list of tools used in the creation of this project, you can probably source them from elsewhere (please see Disclosure above).
- Soldering Iron Kit
- Side Snips
- Needle nose pliers
- Flathead Precision screwdriver
- Heat Gun
- Wire strippers
- Crimping Tool and plugs
So I'm running Ubuntu Linux as my primary operating system, so I'm going to provide instructions based upon this.
Using the following as rough plan of action.
We then need the ability to add one or more temperature / humidity sensors. Each sensor is connected to a specific GPIO port, this will need defining in the configuration.
Each sensor will be housed in a vivarium, and the vivarium will have a name and location.
Each sensor will have a location, and will need a min & max temperature and humidity.
Temperature data will be recorded to the SD card in predefined intervals (as defined in the configuration)
More detailed instructions on the sensors and how to connect the sensors can be found here
Now we need some code to be able to read the temperature and display it on a web interface.
We will need to use the SD card for storing configuration / data. We need to ensure this is connected to the ESP32 and we have the right libraries installed so we can:
- Read and parse a JSON configuration file.
- Write the JSON configuration file back to SD card.
- Create a folder to store data in, if it doesn't exist.
- Create a CSV file to store the temperatures and humidities of all the attached sensors, which rolls over on a daily basis.
- Delete any data files which are over a specific time period, as defined in the configuration.
The SD card will contain configuration information, which will be loaded once on boot-up.
To connect the card reader use the following instructions
A nice little webpage to allow me to view the sensors would be ideal.
We will use the Wi-Fi Manager library to create an ad-hoc Access Point so that the user can configure Wi-Fi access. Once configured it will store the Wi-Fi settings on the SD card
The webpage, JS and CSS will be stored on the SD card under a folder, so we can easily make amendments by putting it into a laptop and editing the files directly.
The webpage will display the current temperatures / humidities of the vivarium's and allow the user to view the history.
It would be nice if the user could amend settings by using the web interface. This could be almost any part of the system (anything stored in the JSON configuration file).
Backup / Restore the configuration (to allow it to be downloaded / uploaded to the client) are also required.
We also need the ability to reboot / restore a factory configuration.
Now that each sensor has a minimum and maximum temperature and humidity, we would like to provide the ability to turn an LED amber (warning) or red (error) when different incidents occur.
We will need to attach LED's or an RGB LED to accomplish this.
We could also attach a buzzer to sound audible warnings.
Adding a screen (or e-ink digusplay) to display similar visuals to the web page would mean I don't need to take my phone out to check the temperatures.
Start small - make it big.
Start by creating a simple temperature and humidity monitoring which can monitor one vivarium, which I can check on using a browser over my local Wi-Fi network.
To do this, we will need to connect the DHT22 to the ESP32 as per this document
Add an SD Card to the project to store the website so I'm using less memory on the ESP32.
Move the settings into a configuration file on the SD Card, have the startup process read the settings and initialise itself.
Add additional sensors (I have 3 pythons so need 6 sensors in total), all configured through the SD Card and all visible on the interface. It should not matter how many sensors I add, it should all just work.
Add an initialisation routine so that when the monitor starts up to begin with it creates it's own local network so you can connect to it and configure it.
Store and view historic data on the SD card - ensuring it does not run out of disk space, so self cleaning is needed.
Add the ability to reconfigure certain parts of the system through a web based admin interface.
Add more steps once I've completed this lot.