John Shovic's Google Plus Switch: Project Curacao - Environmental Subsystem - Part 4

Project Curacao - Environmental Subsystem - Part 4



Project Curacao - Environmental Subsystem

What is Project Curacao?

This article is part of a series discussing the design and building of Project Curacao, a sensor filled project that will hang on a radio tower on the island nation of Curacao. Curacao is a desert island 12 degrees north of the equator in the Caribbean.

Project Curacao is designed to monitor the local environment unattended for six months. It operates on solar power cells and will communicate with the designer via an iPad App called RasPiConnect. All aspects of this project are designed to be monitored remotely.


The Environmental Subsystem

This subsystem consists of an indoor humidity sensor (indoor here refers to inside the box), an indoor temperature & barometric pressure sensor, and a luminosity sensor. An outdoor temperature and  humidity sensor is placed on the outside of the bottom of the box.  All of these sensors are connected to the Raspberry Pi Model A with the exception of the AM2315 outdoor temperature and humidity sensor which is connected to the Arduino based battery watchdog for reasons given below.  A small computer fan under Raspberry Pi control is also connected to provide airflow through the box when inbox temperatures get too high or the inbox humidity gets too high.


What hardware to use?


We are using the following hardware for the Evnironmental subsystem:
1 Adafruit BMP085 Temp/Baro Sensor (I2C)
1 Adafruit  DHT22 Temp/Humidity Sensor
1 AM2315 - Encased Temp/Humidity Sensor
1 Adafruit TSL2561 Digital Luminosity Sensor
1 Akust 5V-12V 8cm Computer Fan
1 Evil Mad Scientist Simple Relay Shield


What to measure?

To be able to see what is happening in the local environment, we want to measure the temperature, humidity and local light levels both inside and outside of the containing box. All of this information will be placed in a MySQL databse for later analysis.




Putting in the sensors

The BMP085 and TSL2561 are soldered into a prototype board with I2C coming in from the Raspberry Pi. there is a plug to further extend the I2C bus to an encased temperature and humidty sensor outside of the box (the AM2315).  The AM2315 proved to be problematic (see below), but the other I2C sensors worked like champs.  The DHT22 inexpensive indoor temp and humidity sensor worked well with some additional software to filter out bad readings, but caused problems with the RasPiConnect control software because of the unreliable delay to good readings (see below).  We control the fan with a relay that connects the fan directly to the output of the solar cells (6.5V on a good day).  We figured that the fan would be used on the sunniest days.  The fan takes 70ma and the relay coil takes 70ma.  We are investigating replacing the relay with a lower energized coil current (see Sainsmart for example).  140ma really hurts our power budget.  Following is a picture of the bottom of the Project Curacao Box

Note the fan on the left and the AM2315 in the middle




Monitoring the sensors and fan remotely

Project Curacao is monitored remotely through the Internet by the use of SSH and by the use of an iPad / iPhone app called RasPiConnect.  Each of the main subsystems has a different display.  The environmental display has a graph for temperature/humidity and luminosity/barometric pressure/fan state (shown). The software for generating this display is also on github/projectcuracao.

The Environment Page in RasPiConnect
Project Curacao Summary Page showing Highs and Lows


















Problems with sensors

There were two major problems with sensors in this design.  First of all the AM2315 is an odd duck.  It has a power down sequence that requires it to be addressed twice (once to wake up and once to read - for example it takes two invocations of i2cdetect to see the sensor) and secondly, it just isn't reliable using 3.3V for I2C.  A solution might be putting a level converter in for the device, but since we had a 5V I2C on the battery watchdog Arduino, we decided to add it to the watchdog.  Secondly, the DHT22 has some very tricky timing in order to read it from the Raspberry Pi.  Since the Raspberry Pi is a multitasking machine, you can't depend on the timing 100%.  This means that readings from the DHT22 fail on a regular basis.  The way to fix this prolem is to keep reading it until the correct format is received.  However, you can only read it every 3 seconds.  This plays havoc with an HTTP based monitoring system such as RasPiConnect with 10-15 second timeouts.  This problem was fixed by reading the DHT22 in the main software and having RasPiConnect read the last reading from the MySQL database.


What is coming up?

Part 5 goes through the Raspberry Pi Camera Subsystem and Part6 describes the software system used for Project Curacao. All of the code used in these articles are posted on GitHub at github.com/projectcuracao.

No comments:

Post a Comment