Tuesday, July 30, 2013

Another

Another project I've been working on is this:



The picture above is of an early prototype.  On the bread board you are looking at:
  • an Arduino Uno
  • Sainsmart 4 Channel Relay
  • LCD shield made from the Maker Shed Kit     
  • a bunch of wires.
It's called an Environmental Controller.  The plan is for this device to control and monitor the grow tent.




 When I'm finished I'd like the controller to:

  • Turn the lights on/off
  • Control the temperature/humidity
  • Turn the water pump on/off
  • Display useful information
  • Record and Send data to Cosm.org or Twitter (preferably Cosm)


As I write this post I've been able to accomplish most of what I want the controller to do.  Below I'll elaborate on the each of the bullets above and some the challenges that have arisen.

Turn the Lights on/off

Controlling the amount of sunlight hours my tree received was the actual impetus for this entire project.  The changes in the length of day light hour throughout the year send signals the plants letting them know the season.  The jargon for what I'm describing is "photo-period".  Normal light timers aren't smart enough to do this and simply turn on and off at the same times every single day.  

I used the Time Lord Library by SWFL Tek to accomplish this.  This library allows you to plug in the latitude and longitude of any spot on earth and it spits out the time of sunrise and sunset for the day.  In testing the library I found that the times it generated lined up with the times generated from the US Naval Observatory.  

I am very pleased that this is working and pleased with its performance thus far.  The library also has the ability to calculate the phases of the moon, so if I ever want to go all out and simulate moonlight it's within in the realm of possibility.  


 Control the temperature/humidity

This is the most difficult thing to control.  Using the timers, the best I could do was turn on a humidifier every 15 minutes and hope for the best.  It was likewise with the temperature, it's hard to time when you need to activate the fans.  Too long and you get wind damage, too short and the heat will cook the leaves.

I've attached a DHT11, which is a basic temperature-humidity sensor and a "swamp cooler" type humidifier  a Holmes 1100 cool mist humidifier.  This unit can raise the humidity from 30% to 50%

 I'm also employing a Vicks Ultrasonic Humidifier.  This is what I use to reach the optimal  humidity of 70%


I use both because, the swamp cooler move air very well but won't go over 50% humidity and the ultrasonic humidifier adds a lot of moisture to the air but doesn't move the air enough to circulate.  So the the swamp cooler is a acting as an intake fan that also raises the base humidity.

The code for this section of the sketch, came from the Adafruit tutorials.  However, I am having trouble getting this sensor to interact with the SD card. (more on that later)


Display useful Information



Above is the display that I'm using.  It's a 16x2 serial LCD with a blue backlight.  On the top row, starting from the left is the current time, using the 24 hour scale. (it is displaying 12:48pm, I've since fixed the extra 9) Next, is the temperature in Fahrenheit.  On bottom row, the "L+/-" indicated whether the light on or off.  The  "H+/-" indicates whether the humidifier is on.  The "144" is the countdown in minutes till the water pump cycle.  Finally, the 35% is the current humidity.

I've been able to get everything work except for the countdown timer.  It counts down once but instead of resetting, the count continues by counting negatives.  

The next step for this is to include buttons to turn the backlight on and off, and also to show the  sunrise/sunset times.  
  

Record and Send Data to Cosm.org  or Twitter


This objective is still eluding me.  I'm using the Data logging shield from adafruit.  This shield contains an SD card, a real-time-clock, among other things.  The shield is working correctly and all the example sketches work.  The problem is that I can't get the SD card to talk to read from the DHT22.

As for sending info to Cosm or twitter, most the info out there is written for the wifi or ethernet shield.  This a way to use Processing and a laptop, but that is was designed for an older version of Cosm.  I will continue to get this working.

The code


I'll post the code in another post.  

In Conclusion


Lychee Shishi version 1.0 is complete.  The next version may require an Arduino Mega for more I/O ports.  









   


No comments: