Sensor Development - OilSlick/coffee_tree_monitor GitHub Wiki

Here I am documenting the why's and wherefore's of how the unit develops over time. If you want to get straight to the nitty-gritty of the latest unit, see the section in the sidebar on the right titled "Sensor Documentation."


To have a sensor connected to the Internet is one of the larger hurdles of this project. I am currently considering an Arduino-compatible board from Adafruit that has a built-in cell phone module that will allow me to connect to the Internet over the aging 2G network. This 2G limitation is significant, as I can't find any 2G SIM cards in Singapore (Singapore is turning off all 2G service on April 1st).

Current Prototype

In order to get started with something I chose Adafruit's Feather series boards. I'd like to stick to a 3V system to minimize power usage, given that the sensors will be deployed in the field and running on solar power.

I hope to ultimately use a Feather Fona so that each sensor can upload data to the Internet independently. Unfortunately, Adafruit's 3G version isn't ready for mainstream use and 2G is quickly being phased out of cellular networks. Here in Singapore, 2G cards are no longer available and the network itself will be turned off on April 1st. So my best option right now to test most things is the Adafruit Feather Huzza, which utilizes an ESP8266 chip as the main processor and for WiFi access. It's a great platform to use but one problem is the difference in the size of available flash. With the Huzzah, I have 4MB of space available for code and libraries and with the Fona I only have 32KB. Quite a difference!

However, using the Huzzah allows me to attach some sensors and connect the unit to the Internet to test with online data logging. I currently have the prototype connected and uploading three data sets to Adafruit's IO page, which graphs the data.

Lux Graph at Adafruit IO

The prototype also logs all data to a local, micro SD card. Currently the sensor reads and records data every sixty seconds, both locally and to the Internet. But to save power, I imagine I'll eventually change the Internet logging to every hour during daylight and less frequently at night (when the sensor is running solely on limited battery power).

Parts List

These are the current parts I have installed:

TSL2561 Light Sensor

This was a case of "I didn't know what I didin't know." I knew very little about Lux. I assumed a sensor that detects light can measure all light. Then I started experimenting with the chip and have learned a bit...

This chip was designed for use in LCD displays, lighted keyboards, etc, to measure the ambient light in order to adjust the display brightness accordingly. It can measure infrared and broad-spectrum light (light visible to the human eye).

I have found that this sensor is not appropriate for what I need. The dynamic range of light detection for this unit is from 1 to 17,000 Lux and in full sun it is possible to reach 130,000+ lux. It works great indoors but regularly becomes saturated when placed in direct sunlight.

I am currently looking for replacement options.

Update October 7, 2017: I am testing a liquid crystal light valve to restrict the amount of light that reaches the TSL2561 sensor in a controlled manner. The hope is that I can restrict the amount of light by a defined value, take a reading, then calculate an estimate of the actual amount of light.

BMP180 Pressure/Temperature Sensor

After purchasing this chip and playing around with it, I wonder if it will be useful in this application. The chip measures the barometric pressure and air temperature. Currently I am using it to measure the temperature inside the unit.

A couple of things that factor into my decision: 1) the BMP180 has been discontinued (end of life) by Bosch and most chip companies like Adafruit, Grove, etc are running out of the breakout boards. 2) After soldering the breakout board to the Feather ProtoWing, the sensor failed to initialize. It would correctly report its I2C address in a scan, but would not initialize. The fix for me was to load Sparkfun's BMP180 library temporarily, which was able to initialize the sensor. While researching the problem, I found a Github issue in which someone suspects the problem lies in the components used for the breakout board.

Having this issue while the unit is deployed to the field would prove difficult to manage.