I’m separating environmental sampling into two sensor nodes, the air
air: report on the temperature, humidity, LUX, and color temperature
and Water Sensor Node.
water: report on the pH, EC, and water temperature. Adjust pH and EC to optimize a plant’s intake of nutrients.
This post focuses on the air sensor node.
The Goals
In this post I will:
- identify and discuss the choice of components for my Air Hydroponics Sensor Node.
- run the air sensor node through a sample sketch to show its features.
The Air Sensor Node’s Job
The job requirements include:
- measuring the air temperature, humidity, LUX, and color temperature at the location it is placed. To make the measurements the photo sensors from the light sensor need to be exposed to the light.
- repeated measurement at a “reasonable” time period. These measurements will most likely not change much within an hour. There will be notable differences between readings made in the daytime versus nighttime. As well as when the grow lights are on and when they are off.
- sending the sensor data to the base system. The data may need to travel through walls and a couple hundred feet. Although eventually I envision a base system to be collocated with sensor nodes.
The Parts List
Components |
Task |
DHT22 + 1 10K Resistor |
measure Air Temp and Humidity |
measure LUX and color temperature |
|
read measurements and send to the base system |
|
USB-Serial bridge to load sketches onto the Moteino |
|
Battery (TBD) |
provide power for at least one year |
5mm RGB LED + 3 330 ohm R |
provide feedback on the state of the node |
I have discussed the DHT22 and TCS3472 in earlier posts. Since I come from no understanding of RF options for in-home networks, I explored a variety of options. Most of which I discuss here. Based on these explorations, I have chosen the Moteino with the RFM69HW (data sheet for the RFM69HW) to provide wireless communication between the Base System and a Sensor Node.
The Moteino
Felix Rusu‘s small business, lowpowerlab.com created and builds the Moteino. It includes an ATMega328, either an RFM69HW or RFM69W, and optionally a 4Mbit (512 KByte) flash chip. The Moteino appears to be an evolution of the JeeNode. Both have a focus on low power consumption in an effort to minimize the power consumption of the battery. Like JeeLab’s, it has a strong, helpful (and growing) community and excellent support.
The RFM69
I noted above the Moteino comes with either the RFM69W or RFM69HW chip. The “HW” at the end of RFM69 refers to the chip that boosts the transmit range at the expense of power consumption. This video provides a good overview of the differences between the two chips as well as the differences with it’s predecessor, the RFM12B.
RFM69HW
While it was not essential why, I was curious why there were two GND pins. So I asked the element14 community and got what I took as a reasonable explanation. It greatly helps my understanding of electronics to put a chip design’s feature choice in context.:
From Dave M.:
Usually in a RF module you will find multiple grounds. RF can be very temperamental, Sometimes the Digital GND and Power GND and RF GND are isolated from each other. It could be due to a RF noise, it could be that they had an extra pin and decided to use it for GND and not leave it floating. Only the RF Engineer and PWB layout Designer will have that specific answer. You could experiment and use only one and see if it operates correctly. From a user stand point, tie both to the GND on the Arduino. Working in the Test Engineering field for over 20 years and working with RF for 30 years now. More GNDS in RF the better…..
Air Sensor Node’s Job Requirements
In order to perform these jobs, the air sensor must:
- Run on a battery. The battery must power the node for a minimum of one year before needing a change.
- Provide trouble shooting visual clues about the state of the node. The Node states include:
- cannot read sensors
- cannot find the base system
- working
- not working
- low battery
The Sketch
The Sketch I used for the Air Sensor Node can be found here.
Pseudocode
I thought it would be easiest to follow the code if I also included pseudocode.
One Time Setup
- initialize sensors and wiFi
- Set the state of the device to WORKING.
Loop
- If the device is working:
- (FUTURE) Check to see if the battery level is low. If it is, give a visual clue through the RGB.
- Read sensors and send readings to the Base System. If acceptable readings can’t be made, set the state to NOT_WORKING_SENSORS. Give a visual clue if there was an error reading the sensors
- (FUTURE) Tell the Base System to send a notification/alert If the air temperature or humidity is above or below what is healthy for the plant.
- Send the sensor readings to the Base System. If the Base System could not receive the sensor readings, set the state to DATA_NOT_SENT. Give a visual clue if there was an error sending data.
- Give a visual clue if both reading and sending were successful.
- wait some amount of time before repeating
Reflections
The RFM69 chip is what I am ending up as my RF of choice for in-home networking requirements. Exploring the other options helped me gain a firmer grasp on communications between a node and a base station. I come from a software background. I am getting a better appreciation of the difference between software and hardware prototypes. The main difference is in cost for parts and debugging. I order most of the parts. This adds both a cost for the part and shipping. Then there is waiting around for the part. On top of that, the IDE (development environment) is much more rich for software debugging. While the Arduino IDE and the amazing assortments of libraries available are well done, they do not have the depth and richness I enjoy when programming using Xcode to build iOS apps. On the other hand, building these sensors is more inspirational to me than building just an iOS app because the sensors solve in home challenges in new ways.
I really like dividing up the nodes into an air and water. I am excited to get the water node going. I will be automating the feeding of nutrients and pH adjustments above readings and notifications.
While I have learned a lot, I am continually amazed at how much I don’t know. It certainly motivates me to get up in the morning!
What’s Next
Areas I will be working on include:
- Minimizing a node’s power consumption (and choice of battery): I’m just starting to get my head around power consumption. I will explore ways to figure out the amount of voltage left in a battery as well as minimizing the amount of current used.
- Eat my own dog food. I will be using the Air Sensor node on a new hydroponics system I am in the process of building. I expect to make adjustments to the node as I learn more in day to day usage.
- Take another pass at the Base System. This will include adding notifications/alerts (noted above in the pseudocode as FUTURE).
- Start the Water Sensor Node. I can’t wait to automate the feeding of nutrients and adjustment of pH!
- Making a PCB of the node. I’ve never made a PCB. After the “dog food” phase, I want to go through the process of using either KiCad or Eagle Cad to create the Gerber files. I also want to figure out the source for parts and the CoGs to make a small batch of PCBs.
Contextual Electronics is set of two 8 week online courses meant to teach you how to build your own hardware. Students will work in groups to design printed circuit boards using the open source CAD program KiCad; in the second half of the course, students will also build the hardware as a community, working to piece together theoretical knowledge and practical application. At the end of the course, students will feel confident taking an idea from concept all the way through to construction of a prototype.