This system monitors temperature, UV index, pump status and drain level for my chameleon's terrarium.
The system is built using the LinkIt 7688 Duo, temperature sensor, UV sensor, moisture sensor (for drain level), and a relay for controlling the pump on the misting system.
UVB is invisible to the human eye but critical to the formation of vitamin D3 in the skin of reptiles, which allows them to absorb calcium from their food. This system ensures the user will know exactly when their UV bulb is no longer emitting the proper levels of UV. The aim is to prevent Metabolic Bone Disease that can arise from lack of exposure to UVB and promote healthy husbandry.
The User Interface is a web page that is accessible to any device running on the same network as the LinkIt 7688 Duo. The user is presented with the current temperature and UV index along with a graph displaying the 30 most recent measurements. There is also a status light for the pump on the misting system. Clicking the light toggles the pump on and off. In the event the drain level for the pump reaches a high level, the light turns red and the pump is shut off. The user can no longer turn the pump on until the high level is cleared by emptying the drain. The user can also setup email notifications for when the drain level reaches a high level.
Clicking on the current readings allows the user to view the historical data for that particular type of reading. When the user selects a section of the bottom chart it populates the top chart. This allows for users to view certain sections of historical data in fine detail.
This system utilizes the following software:
Firmata is running on the LinkIt 7688 Duo MCU. This will allow us to access the analog and digital pins using Johnny-Five.
The Node Express server runs on the LinkIt 7688 Duo serving an html page for the client to access the dashboard. Once connected, the user establishes a websocket connection using socket.io and the readings are emitted to the client every second. These readings also get saved in our RethinkDB instance so we can access them later on the historical data page.
Below are images from the main app file
Here we setup the routes for our express server.
Here we set up the sensors using Johnny-Five.
These are the socket events for users count and turning the pump on and off.
This system utilizes the following hardware:
- LinkIt 7688 Duo
- LM35 Temperature Sensor
- UV Index sensor (Adafruit)
- Moisture sensor (for high level on drain)
- Relay (turning pump on and off)
- 24v DC Pump (misting system)
Linkit 7688 Duo pin connections:
- Analog 0 connected to LM35 temperature sensor.
- Analog 1 connected to UV index sensor.
- Analog 2 connected to moisture sensor.
- Digital 0 connected to relay. (moved to pin 12 on final design)
The hardest part of this project was building the dependencies for the node application. Normally you would run
and all the dependencies would be installed for you but this doesn't work on the LinkIt 7688 Duo. Instead you have to cross-build each dependency using their guide here.
Their guide requires you to set up a new OS running Ubuntu 14.04 with Node version 0.12.7 and install a bunch of packages, clone their repo, and finally run a script to build dependencies. OMG, I just wanted to use Express...
Docker to the rescue. I wrote a Docker file to do just that. It starts with Ubuntu 14.04, pulls in all the required packages and clones their repo. I ran the Docker file to create the container and then attached to that container. I changed directories into the cloned repo and ran their script to cross build all my dependencies. Below is an example of running the command to build johnny-five npm module which includes serialport. Run the following command from inside the cross-build repo root directory.
bash npm_install.sh johnny-five
This would build johnny-five and place it as a tar inside
folder. You would then need to transfer the tar to your host machine and move the contents to the LinkIt 7688 Duo. Place the folder of each dependency in the app's
Overall we need the following to run this app:
- Firmata sketch running on MCU of LinkIt 7688 Duo
- LinkIt 7688 Duo connected to wifi in Station Mode (make note of IP address)
- RethinkDB --> local server or cloud instance
- cross-build these dependencies:
- Chameleon-Monitor repo from here
1. Run RethinkDB locally with
rehtinkdb --bind all
(make note of IP)
- access RethinkDB GUI with any web browser at the IP address and port
8080. If running locally use
- create a database named
- create a table named
2. SSH onto the LinkIt 7688 Duo
ssh email@example.com(your ip will be different)
3. Clone the chameleon-monitor repo.
git clone https://github.com/ryanjgill/chameleon-monitor.git
4. Create a folder called
in the cloned directory.
cd chameleon-monitor && mkdir node_modules
5. Copy all the dependencies you built using the cross-build repo to the
- example of coping express. run from host terminal
scp -r express/ firstname.lastname@example.org:/root/chameleon-monitor/node_modules/express
and change the variable
to match the IP address of your RethinkDB instance.
7. Run the app:
Email notification of high level alert is sent once every hour until the drain bucket is emptied. To enable this functionality I registered an app password for my Gmail account at this link. Then update the
variable in file
with your email address and password that was generated from the link above. Do not share this password or commit it to your repo as it will grant anyone full access to your account.