2015-04-23

Gather Data on Raspberry Pi with Cassandra and Arduino

Intro

In the previous post we went over the steps necessary to make a sensor for a small greenhouse for the balcony.

  1. Arduino Greenhouse
In this section we are going to concentrate on how to gather the data coming in from the Greenhouse. The approach is applicable for any kind of telemetry data or something similar. The parts list is simpler than in the previous section but as a "concentrator" node we are going to use a raspberry pi. Here are the parts:
  • Arduino Uno
  • USB cable
  • Raspberry PI
  • nRF24L01+
  • 7 Wires
To install Arduino libraries please consult the previous post. The wiring for the nRF24 is the same as in the previous post.

Persisting the data

To persist the data I opted for Apache Cassandra. It's a good fit even for a low powered Raspberry Pi. Cassandra is java technology. So before installing Cassandra you have to install java. It's all written up nicely in the following posts:

  1. Install Java
  2. Installing Cassandra

Overview of the process

The code

  1. Data Gathering in Arduino
  2. Python serial to Cassandra bridge
To be continued ...

Arduino Greenhouse

Intro

I built a small greenhouse for the balcony. I decided to arm it with an Arduino sensor just to make sure if it's of some use. I found some interesting data and will describe the whole process in the following posts. The first post will be about building a sensor. Let's start with a simple parts list:

  • Arduino Uno
  • USB cable
  • Power bank
  • 10K Ohm NTC 5mm Thermistor
  • DHT11 temperature and humidity sensor.
  • GL5528 Photo Resistor (we'll bind it with 1K Ohm Resistor)
  • nRF24L01+
  • 10K Ohm resistor
  • 1K Ohm resistor
  • 17 Wires

Installing the libraries

To send the data over the nRF we'll use a library. To install the library download the file https://github.com/maniacbug/RF24/archive/master.zip. Create a new sketch or open the example from gitHub and click on Sketch - Import Library - Add Library. Select the zip archive and the Arduino IDE should install the library. Repeat the same steps for the temperature and humidity sensor https://github.com/adafruit/DHT-sensor-library/archive/master.zip

Wiring

The example has two temperature sensors. One is for the outside and will be connected with longer wires. You'll have to compare the readings from both sensors in the same environment and see the offset in the readings. The humidity sensor can also read the temperature but it is not very precise and is relatively slow. We'll use this value simply as a check value.

The wiring of the nRF24L01+ is a bit complex so simply use this scheme to connect it:

The code

The example is available on GitHub under https://github.com/msval/arduino_greenhouse/tree/master/arduino_temp_sensor

The result

To be continued ...