Author Archives: Jasu H Viding

Internet of Things: Le Farmanator

I know exactly how lazy you are. That’s why Farmanator was brought into this world.
You wake up in the morning and couldn’t care less about your plants. “Let them die” you think the moment you realise how soft your pillow is today.
But then you remember… Le Farmanator. You pull out your laptop from underneath your pillow and open it up. Air temperature, humidity, loudness and light levels – it’s all there, it’s all good. And you may sleep another day knowing the winter didn’t come quite yet.
Also no need to worry about remembering to check the data out on a daily basis. It’s stored to Firebase and you can view it for up to 30 days.

 

Hardware

Temperature & Humidity sensor pro v1.1
Loudness sensor v0.9b
Digital Light sensor v1.1
Arduino Uno
Base Shield
USB-power-cable

 

Wiring

Base Shield is attached to the Arduino Uno.
Temperature & Humidity sensor goes to A0 on the Base Shield.
Loudness sensor goes to A1 on the Base Shield.
Digital Light sensor goes to 12C on the Base Shield.
Arduino Uno is connected to the PC with a USB-cable.

 

Software

Code running on Arduino Uno:
https://github.com/jviding/GreenArduino

Code for reading data from Arduino Uno and managing Firebase:
https://github.com/jviding/GreenBack

Code for the webapp representing data from Firebase:
https://github.com/jviding/GreenFront

Check out the Readmes for more details about software.

 

How to use

Prepare all the software by following up the instructions written on the projects’ github pages.
Start by deploying or running locally the webapp, GreenFront. It might be a good idea to run it locally before deploying by just typing “grunt serve” in the root of the project directory.
Then push GreenArduino source code to your Arduino Uno after attaching the Arduino Uno to your computer with a USB-cable.
Now you may start executing GreenBack on your computer. After a while you should start seeing data appearing to your charts on GreenFront.

 

In case no data is appearing to the charts on your GreenFront webapp check Firebase if anything is getting stored there. In case Firebase remains empty still after 10 minutes it is likely your computer is not able to read the values from Arduino Uno. This might be due to that your serial port is wrong – check GreenBack for more info to solve this problem.

 

Problems encountered

  1. Problem, with Arduino Uno’s sensors

One of the main problems with Arduino Uno was to read the sensor data and send it out without any data losses. For example the Digital Light sensor is rather slow which had to be taken into account when handling the results.
As it might take even up to 0.5 seconds to get the readings from the Digital Light sensor the code had to be written so that the value was requested long enough before it was needed. The way-around for the problem was to request the new readings immediately after using the current readings so that after 0.5 seconds when we want to use the new digital light value we have had the whole 0.5 seconds for the sensor to use.

  1. Problem, reading data from Arduino Uno

Another problem was that if too much data was sent too fast to the PC we started to suffer of data losses because the PC needed more processing time.
The problem was solved by timing the outputs so that there was always a short delay between each print of a value. Now the PC could handle the data safely before receiving already a new value.

  1. Problem, flooding Firebase

Storing values to Firebase every 2 minutes would drown us in data already in one week.
The problem was solved by compressing the data from each full day to 4 data events: average of morning, average of day, average of evening and average of night. Now instead of 24*30 data events for example for Loudness for one day we instead have 4 data events. This lightens up the burden on Firebase quite a lot as the amount of data stored is minimized.
Furthermore we could improve our solution by maybe deleting all data events older than 30 days or by after a week compressing even the 4 data events from a day to only into a 1 data event.

 

Testing

While working on the project Arduino Uno was almost constantly running. In some cases it ran even a few days without interrupts.
The web app then was a good way to view how our data was getting gathered. Also a look on Firebase gave us a good perspective on how our solutions were working. And in some cases thanks to this method some bugs got noticed and fixed on time.

 

Project members

Jasu Viding