From now on I’ll refer to the Arduino + sensors + RF (i.e.: no 802.11 connectivity) as the Sensors Node.
This post is a follow-on to the posts:
Sensors for Plant Growth
The sensors I want to have on a Sensors node for my hydroponicsproject include:
Each of these sensors will provide valuable information that will help me grow delicious fruits and vegetables. This post focuses on sensors for (air) temperature, humidity, and light characteristics.
Light sensing is given the most attention because the measuring and calculations are more complex than those for sensing humidity and temperature. Perhaps the reason for this is my lack of context regarding key concepts of light characteristics. For those that are experts in this area I have a favor to ask. Can you please correct any information you read is incorrect or…it would be great if you could enhance understanding of this amazing and rich topic (light characteristics)?
After publishing this post, a member of the hydro subreddit forum
made a comment that got me thinking about what sensors the Sensor node really needs for day to day operation versus setup and maintenance. I will ignore maintenance for now (usually a bad thing to do…?) and focus on day to day operations. I really only need to know the color temperature, LUX, and PAR value for setup. These are important – and worthy of more exploration, but I would rarely raise an event or be interested in the day-to-day change UNLESS the Color Temperature, LUX, or PAR changed dramatically. I see the light being ON as the most significant event. More common than drastic changes in LUX, Color Temperature, or PAR. Moving forward I will use a very simple and inexpensive photoresistor
Examples of Photoresistors
I’m using the DHT22 temperature-humidity sensor from Adafruit. This seems to be a popular sensor for measuring temperature and humidity through an Arduino. Not surprising, Adafruit has an easy to follow tutorial on using the sensor.
The DHT22 is simple to use. Check out Adafruit’s wiring diagram. It is so easy I’ll leave the wiring up to you.
Because my journey is to enhance my family’s food with fresh fruits and vegetables grown indoors, I am interested in measuring light characteristics as they relate to plant growth. I chose Adafruit’s TCS34725 color sensor breakout board because it provides not only the LUX value of the light source but also the color temperature. I was hoping to also get the PAR value – a more interesting light characteristic than LUX values for plants given the photosynthesis process of plants.
While this chip returns RGB values, alas – RGB values cannot be reliably converted into PAR values.
I did find options for PAR measurements:
I ended up purchasing the DIY PAR meter. As noted earlier, I don’t need a sensor for each sensor node. Rather a PAR reading during initial setup and occasional check-up.
According to Apogee’s excellent technical support, the SQ-225 seems very simple to use with an Arduino. The sensor has 3 wires. The white goes to 5V, black to GND, and green to an analog pin.
I2C to Communicate
For many of you, all the delightful ways for chips to communicate with an Arduino are well known. Being new to it all, I like to briefly look at the pros and cons when I start using a new way to communicate over a bus. Unlike the nRF24L01 which used the SPI to communicate with the Arduino or the DHT22 which uses a digital pin, the TCS34725 uses the I2C.
This section of The Arduino Cookbook has a clear explanation of the scenarios in which it might be more beneficial to use one over the other communication bus implementations:
“I2C has the advantage that it only needs two signal connections to Arduino—using multiple devices on the two connections is fairly easy, and you get acknowledgment that signals have been correctly received. The disadvantages are that the data rate is slower than SPI and data can only be traveling in one direction at a time, lowering the data rate even more if two-way communication is needed….
The advantages of SPI are that it runs at a higher data rate, and it has separate input and output connections, so it can send and receive at the same time. It uses one additional line per device to select the active device, so more connections are required if you have many devices to connect.”
As with the other breakout boards I’ve purchased from Adafruit, the TCS34725’s is very easy to wire up to the Arduino. This tutorial does an excellent job helping you wire up and test the chip. There is no reason to repeat it, so go for it if you are following along. I wired the LED pin to GND to turn off the LED that is on the chip.
Integration Time and Gain – Setup Variables
Perhaps many of you run across adjusting the integration time and gain in other projects. I find how folks word a sentence and how I interpret the same sentence can drastically vary. So I wanted to understand the ramifications of these two parameters.
I noticed when the TCS34725 is being initialized, the amount of integration time and gain can be set. As noted in Adafruit’s library reference for the Adafruit_TCS34725 library,
“Longer integration times can be used for increased sensitivity at low light levels.“
As adafruit_support_bill notes in an answer to my question in the adafruit forum about Table 6. RGBC Timing Register in the TCS34725 data sheet:
…It is pretty much the same as camera exposure time. This can help in low-light. It can also make a difference with non-constant sources like fluorescents. You need to integrate over some number of 60Hz cycles to get an accurate average measurement. The term “count” in the context of sensors usually means the raw ADC output. I would interpret “MAX COUNT” to be the full-scale reading for the specified integration cycle setting I set the integration time to 700 ms with the intent of optimizing for sensitivity since speed is not a concern.
Most of you have most likely run across adjusting the gain in your other projects. I have both in low light photography and also voice recording. Still – after years of making assumptions I knew what something was and then finding out I did not have the right meaning, I asked what the meaning of gain on the adafruit forum. adafruit_support_bill was quick to respond (another shout out to Adafruit. The folks that work there care and are knowledgable. I find myself buying more and more of my exploration hardware from them. They seem to truly try to make sure we have a great experience with their products) with:
“Gain amplifies the signal so it is in the range where the A/D converter can measure it with reasonable resolution. Yes, noise is amplified too. But without gain, you would not be able to distinguish some signals from noise.”
Bill also noted:
The 3.8 million-to-one dynamic range of the sensor means that measurements at the lower end of that range would only be using 1 or 2 bits of the A/D resolution.
(the 3.8 number is found in the TCS34725 data sheet, page 1 – under features)
Given we’re looking at lights on and not dim lighting conditions, using gain is not a concern. I set the gain at 1X.
The table below shows five different light setups. I measured the LUX for each using the TCS34725 light sensor as well as a LX1010B Light Meter . I also recorded the Color Temperature readings gathered from the TCS34725.
Light A is early morning light that I have the pleasure of observing from my desktop.
Light B is a “natural light” CF reading lamp.
Light C is an AeroGrow 3.
Light D is a T5 above my DIY DWC hydroponic system.
Light E is the “warm white” CREE LED array that is part of the LED system I was building in this post. A “warm white” color temperature look yellow-orangish. I got readings of around 2150. This particular LED array is specified to be 2,500. “Warm white” helps achieve a more abundant amount of veggies and fruits because it enhances the flowering stage of plant growth. Why aren’t these values exactly the same? I assume for a variety of differences used in measurement – differences in temperature, calibration (or lack of in the case of the TCS34725), precision of measurement, algorithm(s) used to calculate the Color Temperature, and most likely others I can’t think of. I feel the Color Temperature readings from TCS34725 are “good enough” for now. They are in the ball park that are needed for optimizing flowering of plants. Yet I do not have enough information to say anything about whether this particular led array has or does not have a Color Temperature of 2,500.
|TCS34725 – Color Temperature
|TCS34725 – LUX
|LX1010B – LUX
The LUX readings differ on an average of 1:1.76, with the TCS34725 always giving the larger readings. This different strikes me as too different to ignore. Yet they are probably explained by a lack of calibration of either the Light Meter or TCS34725. So do I calibrate and if so – what should I use?
When I have questions such as this I have a tendency to reach out to the super sharp and helpful folks that make up the hydro subreddit. My favorite answers tend to come from superangryguy. I was not disappointed this time with superangryguy’s comment on calibration:
“Calibration of light meters is tricky. My spectrometer costs $250 to calibrate with a NIST traceable standard and to buy a calibration light source is $500-600 and above. I then calibrate everything to my spectrometer. The diffusion disk should be a cosine correction piece. Most all light meters have either a flat or round white piece of plastic depending on the sensor characteristic and placement. Different sensors can also have different spectral responses. I know of no cheap way to accurately calibrate these sensors or meters. I would try to calibrate the TCS34725 sensor to the LX1010B meter with the sensor and meter directly facing the light source. I’d also use a 5000-6000k (day light neutral) white light source. The problem here is that you want a true broad band light source. CFLs, for example, have sharp spectral spike as does the TCS34725’s response curves. This is why lights such as halogens are used in calibration. I’d use a blue “cooling” filter to try to flatten the halogen’s light curve. You’d need to look up the spectral response of the halogen then pick up the appropriate gel filter at a photography pro shop. If you go to a pro shop, someone may be able to pick out the right filter gel for you. Glazer’s in Seattle would be an example of a photo pro shop that has a wide range of gel filters in stock. Look at page 6 of the sensor data sheet and you’ll see that the different diodes have different spectral sensitivity and they’re pretty narrow. The clear diode appears to be a normal silicon photo diode judging from its response curve. It does appear to be close to cosine correct. http://www.adafruit.com/datasheets/TCS34725.pdf“
As pointed out by adafruit_support_bill:
“Like all sensors, there is variability between units and they need to be calibrated against a standard. But there are other factors that can account for the discrepancy. These sensors both measure incident light, but the LX1010B has a large diffusing disc in front of the sensor. This will alter the effective angular responsivity of the sensor. They may also be differences in the spectral response of the two sensors. These are documented for the TCS34725 here: http://www.adafruit.com/datasheets/TCS34725.pdf.”
For now I’m going to move on and accept the readings of the TCS34725 without adjustments. Right now I want to explore and get to a reasonable understanding of challenges that would need further investigation if more precision is required.
Next up: exploring signal strength of the nRF24L01’s. On the good and bad news front – my cc3000 has decided not to play anymore. Adafruit is sending me a replacement. Once I get that, I’ll be sending the data from the Sensor Nodes to the PHP service.
I also want to try out the JeeNode and JeeLink I recently purchased after becoming an avid follower of JeeLabs.