Pages

Friday, September 4, 2015

SXAM: A Spark.io Indoor Ambient Quality Monitor


SXAM is a Spark.io indoor ambient quality monitor.


SXAM (Spark to Xively AMbient quality monitor), is an ambient quality monitor that logs 4 environmental parameters to the xively.com and display the ambient status by using for RGB leds.

SXAM logs:
  • Humidity
  • Temperature
  • Ambient noise
  • Brightness
Note: Spark.io is now Particle.io.


This project it is built upon the spark xivelylib you can found here: https://github.com/davidegironi/spark-xivelylib

A web page can be used to set the xively feed and API token.

The WiFi network connection can be configured through the Spark.io app.


For humidity and temperature a DHT22 sensor it is used.
To measure ambient noise an analogic noise sensor built with a electret microphone and a opamp it is used.
Brightness it is measured by a BH1750 sensor board.

I would like to thank my friend Matteo for cutting me the beautifull vinyl sticks for this project.


RGB leds are WS2812B, that types of leds are easy to drive.


For each of those sensor appropriate library are used.

Ambient noise and brightness are sampled 10 times per second, in order to give the led feedback almost instantly. Humidity and temperature have slower samplerate.
Ambient levels average it is computed and then posted to xively.com every minute.



Each parameter can be changed at compile time.

To run this project you have to create a new app in the Spark Build environment. Then you should add that libraries:
  • NeoPixel
  • AdaFruit_DHT
  • XivelyLIB
  • BH1750LIB
  • AudioGetAverageLIB
Add a config.h file to your project.
Copy and past the source of this project (see below for the project code), to your newly created file.
Edit the config.h according to your needs.
Now you should be able to compile this code and run it on your device.

It will be be easy to add new sensors.




Code

Notes
  • read risk disclaimer
  • excuse my bad english