Showing posts with label Arduino. Show all posts
Showing posts with label Arduino. Show all posts

Thursday, April 13, 2017

Temperature and hygrometer with FlashAir + Arduino + Raspberry Pi (4) : Visualize on Raspberry Pi

Table of contents.
  1. Read values from sensor
  2. Read from SD card with iSDIO
  3. Send values from arduino to Raspbery Pi
  4. Visualize on Raspberry Pi

It is the final round!
The data sent from Arduino is received by Raspberry Pi and made visible by Java Script.

Source code is on GitHub.

The below is connection sequence.


Data collection API receives data from arduino.
Received data is written in a log file, and then, Java Script of a display page refers the data.

Web API works on Raspberry Pi

Make Web API with Apache and PHP.
Just install some packages.
pi@raspberrypi ~ $ sudo apt-get install apache2
pi@raspberrypi ~ $ sudo apt-get install php
pi@raspberrypi ~ $ sudo systemctl start apache2
After installation, files under /var/www/html/ can be accepted via HTTP.

Data collection API

Temperature and hygrometer with FlashAir + Arduino + Raspberry Pi (3) : Send measured data from Arduino to Raspberry Pi

Table of contents.
  1. Read values from sensor
  2. Read from SD card with iSDIO
  3. Send values from arduino to Raspbery Pi
  4. Visualize on Raspberry Pi

It's readied to use FlashAir from Arduino.
Let's send data via Flash Air to Raspberry Pi.
The all of following source code is put in Github.

Connect arduino and Flash Air



The each function of SD card pins is as follows.
I use 4th pin as the chip select pin.
SilkFunction
CDDo not use
CSChip select
CLKClock
SDOOutput
SDIInput
GNDGround
3.3V3.3V power
5V5V power


Read a parameter file from FlashAir storage

Read a parameter from a file on SD card volume.

Temperature and hygrometer with FlashAir + Arduino + Raspberry Pi (2) : Read SD card with using iSDIO

Table of contents.
  1. Read values from sensor
  2. Read from SD card with iSDIO
  3. Send values from arduino to Raspbery Pi
  4. Visualize on Raspberry Pi

Last time we measured temperature and humidity with DHT22.

Before sending measurement results, Modify FlashAir's iSDIO library.

Support FlashAir iSDIO and SD card function both

Following the FlashAir Developers tutorial, you can connect to HTTP using iSDIO with FlashAir.
FlashAir Developers:Arduino tutorial

However, in this tutorial, the SD card access function is killed.
So, we have to enhance the library by our selves.

Temperature and hygrometer with FlashAir + Arduino + Raspberry Pi (1) : Read values from sensor

Table of contents.
  1. Read values from sensor
  2. Read from SD card with iSDIO
  3. Send values from arduino to Raspbery Pi
  4. Visualize on Raspberry Pi

I made a thermo-hygrometer sensing with arduino.
It sends values via Toshiba FlashAir to Raspberry Pi, and visualizes on a web page.

[ Points ]
  • Visualize sensor data using FlashAir, arduino and Raspberry Pi
  • Measure temperature and humidity using DHT22 sensor.
  • Convert from float to number text on arduino.
  • Support iSDIO WiFi connection and SD card read/write at the same time.
  • Show a bubble chart with Chart.js.


Final image.


The data of multiple rooms are displayed, but the temperature and humidity meter is one.
I only want to compare the rooms, so I measured the data one by one and overlapped the data.

The hardware of the thermo-hygrometer.



Basic Design