A few weeks ago I bought a Madagascar hissing cockroach (Kratos) is an exotic pet with needs like other pets, I live in Bogotá a cold city (15°C-19°C all year), and the pet need 23°C of temperature, and take care with the humidity, light level and air quality, I'm a maker and I want a smart home for Kratos.
- The humidity in the Earth need be the less possible, but in the air the humidity need be upper than 50 percent, this is possible using fresh food (generally lettuce).
- The light is a factor important for a happy cockroach, they not like the light, then we need an obscure place.
- The air quality depends of two factors, the cleanliness of the terrarium and the food because the terrarium have a top then the gases are confined sometimes.
- the temperature is the most important factor, a happy cockroach need a temperature upper than 23° C for a good physical activity and maybe reproduction.
For make a solution we go to connect the NXP Rapid IoT to the Raspberry Pi, the system have two programs a program for the NXP Rapid IoT made in the Rapid IoT studio and another one for the Raspberry Pi written in Python.
For the NXP Rapid IoT program, we modified the Rapid IoT Weather Station example and we make this connections.
Interval for read the sensors, the sensors, a function for a correct reading then a Lines Display for visualize all the values, and finally 4 debug prints this is for send the values trough Serial communication (in the cable), ans this is all. (and a little item for the backlight).
in each debug print element we send a "flag" for know the data incoming, for example, in the debug print for the temperature the system send a 'T' before the sensor value, the others are, 'H' for Humidity, 'A' for Air Quality, 'L' for Light Sensor
In the computer when we connect the NXP Rapid IoT we can see the messages using a serial terminal like cutecom.
That is all for the NXP Rapid IoT program.
in python using the libraries Tkinter and Pyserial, we can obtained the sensors data and show them in a desktop app.
The program make four things:
- Show the outputs (for a Fan and a Heater that we see later)
- Show the sensor values and compare to the range
- Show recommendations for make better the values
- Turn on or off the fan and the heater
The recommendations depends the sensor value are:
- Put fresh food
- Food are good
- Clean the house
- House clean
- A lot of Light
- Lights cool
And all this can be seen trough any VNC client in the LAN and in the future version the data can be send to a MQTT server, Firebase, or another IoT platform.
For control the temperature we will use a heater (it was make using a transformer and a metal spring) and a fan.
The heater and the fan are controlled by the pin 14 and 15 of the raspberry using a transistor and a relay
We put the NXP Rapid IoT in the terrarium connected to the raspberry and in the raspberry we execute the program in the initial applications of the operating system and that its all, in every dispositive can see the data trough VNC