Airpi

Last year, following an article from raspberrypi.org's Blog I decided to support the project of these teenagers and pre-order a kit on Tindie.

A few months later, I indeed received the board (v1.2) and the sensors. In the meantime, the design had changed (some of the sensors too) and if everything works, the lack of calibration on analogue sensors make them almost useless.

Code is sometimes a bit messy (actually a sort of mashup from Adafruit examples), and two things are surprising on this project: The active main loop (without sleep) which mean that the microcontroller is busy 100% (hence becomes hot) and the fact the temperature sensor is bang above it!

But hey, I should have investigated more before and after all it got me started thus I can't really complain.

So I decided the use the card but aside from main board. It will be outside the box and linked by a ribbon cable.

Sensors installed on the Airpi board

BMP085

  • Temperature + Pressure
  • I²C

DHT22

  • Temperature (unused) + Humidity
  • Specific 1-wire protocol

LDR

  • Light sensor
  • Via the ADC MCP3008

Microphone

  • Noise
  • Via MCP6283 (op-amp) and ADC MCP3008

MiCS-2710

  • Nitrogen Dioxide (NO2)
  • Via the ADC MCP3008
  • Datasheet

MiCS-5525

  • Carbon Monoxide (CO)
  • Via the ADC MCP3008
  • Datasheet

Python 3

The main sections were rewritten to Python 3. For example, py-smbus for which I found a patch on a forum or Adafruit DHT.

RRD

Once again, data will be stored using RRD.

Main difference with gas and electricity readings is the use of Gauge datastores since values here are not counters nor rates.

Depending on the values, sometimes I keep the min and max for the day, sometimes I don't.

RRD creation parameters

rrdtool create temperature_in1.rrd --step 300 \
DS:temperature:GAUGE:600:0:U \
RRA:AVERAGE:0.9:1:24 \
RRA:AVERAGE:0.9:6:35064 \
RRA:MIN:0.9:288:1826 \
RRA:AVERAGE:0.9:288:1826 \
RRA:MAX:0.9:288:1826

rrdtool create pressure.rrd --step 300 \
DS:pressure:GAUGE:600:950:1050 \
RRA:AVERAGE:0.9:1:24 \
RRA:AVERAGE:0.9:6:35064 \
RRA:AVERAGE:0.9:288:1826

rrdtool create humidity_in1.rrd --step 300 \
DS:humidity:GAUGE:600:0:100 \
RRA:AVERAGE:0.9:1:24 \
RRA:AVERAGE:0.9:6:35064 \
RRA:MIN:0.9:288:1826 \
RRA:AVERAGE:0.9:288:1826 \
RRA:MAX:0.9:288:1826

rrdtool create light_level.rrd --step 300 \
DS:light_level:GAUGE:600:0:U \
RRA:AVERAGE:0.9:1:24 \
RRA:AVERAGE:0.9:6:35064 \
RRA:AVERAGE:0.9:288:1826

rrdtool create nitrogen_dioxide.rrd --step 300 \
DS:no2:GAUGE:600:0:U \
RRA:AVERAGE:0.9:1:24 \
RRA:AVERAGE:0.9:6:35064 \
RRA:AVERAGE:0.9:288:1826

rrdtool create carbon_monoxide.rrd --step 300 \
DS:co:GAUGE:600:0:U \
RRA:AVERAGE:0.9:1:24 \
RRA:AVERAGE:0.9:6:35064 \
RRA:AVERAGE:0.9:288:1826

rrdtool create noise.rrd --step 300 \
DS:noise:GAUGE:600:0:U \
RRA:AVERAGE:0.9:1:24 \
RRA:AVERAGE:0.9:6:35064 \
RRA:AVERAGE:0.9:288:1826