Environment Monitoring From Scratch

Requirements

 

ds18s20 Temperature Sensor

Download http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip and copy it to your libs directory. On OSX its the following:

 

wget http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip

unzip OneWire.zip

mv OneWire ~/Documents/arduino/libraries/

 

You can test if this is installed correctly by restarting the Arduino IDE and you should see the following from the Sketch -> Include Library from the top menu. 

location of installed library to check

 

Next grab the drivers for the light sensor, I am using a TSL2561.

 

wget https://github.com/adafruit/Adafruit_Sensor/archive/1.0.2.zip

unzip Adafruit_Sensor-1.0.2.zip

mv Adafruit_Sensor-1.0.2 ~/Documents/arduino/libraries/Adafruit_Sensor

 

wget https://github.com/adafruit/Adafruit_TSL2561/archive/1.0.0.zip

unzip Adafruit_TSL2561-1.0.0.zip

mv Adafruit_TSL2561-1.0.0 ~/Documents/arduino/libraries/Adafruit_TSL2561

 

You can test these are installed correctly as they will appear in the “Recommended libraries” section in the screenshot above once you restart the Arduino IDE.

 

The following code is mostly from http://playground.arduino.cc/Learning/OneWire I have a few really minor changes.

 

The code below is all will read from the two sensors and output JSON over the serial port.