Didn’t hear from Sparkfun yesterday…hmmm…hmmm…I could bumble more with this but I’ve learned from my past at some point to seek advice from the company supporting. This also gives me an opportunity to gauge if I want to purchase other stuff from the company. I like being loyal to a company (like Excalibur, OSH Park, Adafruit) when I agree with the company’s values even if products might cost more. I don’t mind paying more if I am getting excellent support, a community of giving, and an opportunity for ongoing learning.
If this isn’t resolved today, I’ll look into moving from the Arduino Uno to the Feather Huzzah. I got one last summer for another project.
There I go, getting on a soapbox yet again.
Since the rain was coming down pretty hard yesterday, I didn’t take my Mac out to my backyard to calibrate the Grove CO2 sensor. I’m going to quit calling it the Grove CO2 sensor since Grove references Seeed Studio’s connector and start using the name of the sensor – the Winsen MH-Z16. I contacted their sales about getting a sensor directly from Winsen and received this reply as part of an email message:
Here we offer price for our MH-Z16 samples :
- 100pcs:usd 32.00/pc
We suggest that you can try 5 pcs to check the sensor perforamce.
There would also be a charge for using Paypal and a significant shipping charge. I have no idea if these are good prices. (As in “Hello – I’m Lady Ada and I’d like to purchase….” or “Hello – I’m really good at cutting deals because I’m <some type of relationship with the seller or have some really cool negotiation skill set or perhaps work for a company that buys a lot of sensors like digikey> ….” ) I assume it works out less than what I paid for the Grove CO2 sensor ($100). There are also other options for the future that I might look into.
I have learned to favor getting a prototype working over price and efficiency. So for now I’ll probably stick with the Winsen MH-Z16 I got from Seeed Studio.
Neato GitHub Key Shortcut I’ll Forget
I wanted to get January 17th version of the Arduino sketch. To get a permanent URL (permalink), go to this version and press the y key. A YIPPEE moment!
Calibrating the CO2 Sensor
Yesterday I calibrated and measured the CO2 using the Extech CO2 meter. While it is still raining very hard, I guess I’ll stand out under our umbrella…in the dark…in the back yard to calibrate the CO2 sensor using the code I found on the Seed Studio CO2 sensor wiki page (I copied the code to the Leaf Spa GitHub). There is a warning on the page: Please preheat the sensor for at least 5 minutes before calibrating and make sure the sensor in fresh air. Not sure what is meant by preheat. Just have it plugged in? Plugged in and getting measurements? My steps to calibrate:
- run the CO2 sensor using yesterday’s sketch for at least five minutes at my treadmill station.
- after this time, upload the CO2 calibration code and run it to make sure it works. If it does…
- take my Mac and the Arduino with sensors plugged in (all attached to my Mac) outdoors and run the CO2 calibration code a few times.
- take my Mac to the spot I took CO2 measurements with the Extech CO2 meter and run the January 17 CO2 sensor code.
- compare the results to the Extech CO2 meter’s readings.
Here are the results from the Winsen sensor:
I’m ok with the temperature and humidity differences. However, there seems to me to be a fairly big difference between 580ppm and ~710ppm.
Perhaps this goes to the quality of the Winser sensor? I’m making the decision to calibrate the Winsen to the Extech’s readings by subtracting 100ppm from the Winsen readings when determining if it is below 1200ppm. The bottom line is neither reading is extremely accurate. For this prototype I believe this method is good enough. I’m updating the Leaf Spa Arduino code to subtract 100ppm from a CO2 reading from the Winsen CO2 sensor.
Here are results after subtracting 100ppm:
OK. I have the code running to read the sensors. Now on to the automation side.
As I get further ( 😉 ) into this prototype, automation has evolved to mean:
- setting the photoperiod of the LED lights.
- periodically turning on/off the water pump so the roots don’t drown.
- adjusting the CO2 level to ~ 1200ppm.
I plan to use three relays. Towards the end of the day yesterday, I ordered a 4 channel relay model to get things going:
I found a wonderfully written post on Henry’s Bench that makes it easy to use this relay.
Periodically Turning ON/OFF The Water Pump
The goal for drip watering is to keep the rock wool moist but not drenched. A secondary goal is to decrease the amount of power used by the pump by not having it on so much. I will start with having the pump on twice per hour for two minutes each time. These settings are just a guess. I’ll refine as I learn more.
What can go wrong with this automation?
- No water/nutes in the Coleman. This is a water pump and not an air pump.
- The pump doesn’t turn off.
- The pump doesn’t turn on.
Better Next Time
I’ll think about this some more…what makes sense to me is to add 1-3 moisture sensors placed randomly in a net pot touching the rockwool to inform the code the state of the rock wool – drenched, moist, or dry. If the state is dry or drenched, the code shuts off the pump and sends a notification (…somewhere… 🙂 ).
For this prototype, I will feign being a hobbyist and ignore the error states. The code will assume the pump works all the time…while I know this is not ideal I tend to lean towards “we can fix it later” rather than “get it right the first time.” Perhaps because I feel more competent at evolving knowledge than predicting. If I was building the Leaf Spa for someone else I would take error states more seriously.
It has been awhile since I used an Arduino with a relay to turn the power of an appliance on/off. So I’m going to:
- absorb the article on Henry’s Bench.
- make a design drawing.
- write a tester script.
- hook up the pump and relay once I get these based on the design drawing.
- try the tester code.
Henry’s Bench Post
There is a great drawing on the Henry’s Bench post:
And the sample sketch based on this drawing:
Actually, Henry did such a great job with his drawing. I will base what I say here off of that. Instead of the Yellow LED /24 VDC, I’ll be hooking up the water pump/120 VAC.
First, checking what pins I am currently using. I am using the Grove Base Shield V2.
I moved the CO2 sensor to D5. D5 on the Grove uses Arduino Uno’s pins 5 and 6. I did this with optimism that the Sparkfun esp8266 Shield will work. It seems to hard code software serial to pins 7,8…hmmmm…hmmm…
Here is the Grove Base Shield V2 schematic:
I would have liked the schematic to better reflect the Base Shield. Luckily, the silk screen of the Base Shield makes it easy to determine what Arduino Uno pins are being used by a Grove connector.
Connecting Relays to Grove Shield
Oooh – a YIPPEE! moment. Guess what? OK…I wouldn’t be able to guess either….ooh..awhile back I ordered some Grove connectors.
…I should be able to connect the relays to the Base Shield with these…but…I have to wait until around Saturday. Drat.
Back to the Tester Script
The script I wrote is located at this GitHub location. Now I wait for the relay board……