Tags

, , , ,

Exciting…here in the Seattle area we got snow:

NewImage

Actually, my family lived in the Boston area for a few years.  I was more thrilled with snow at my house prior to having to shovel it ALL WINTER LONG.  On the other hand, it was good outdoor exercise…but….sadly, my Yoga class has been cancelled for the last two days (something the hardened winter folks in Boston would never do – close an activity due to snow 🙂 ).

The Enclosure

I finished the enclosure.  Here’s the top piece:

NewImage       NewImage

The second picture gives an idea of how the Arduino and Shields will fit in as well as placing the DC cables from the Relay box inside the enclosure.  One challenge I had was the slot for the SD card was vertically too small:

NewImage

I clipped some of the plastic layers around the enclosure…given the layers, this caused a bit of tear…but not enough.  I’m adjusting the F360 model to have a higher opening for the SD card.  I’m thinking about covering the case with something like a silicone spray or spray paint to give the layers a strong adherence to each other.  But it seems to be ok.  I could make the enclosure a tad shorter, but that is not a big deal.   So…

ChallengesBringOpportunitesYIPPEE!  I’ll use this enclosure

 Moving on the ToDo list I posted in the February 2nd build log, the next task I will tackle is: 

  • Code and test reading the sensors, adjusting the CO2, and logging readings to an SD card.

The Code

The code – TheLeafSpa.ino – is located at this GitHub location.

Let’s see what do I want to do?

  • Water plants for the amount of time that will keep the rock wool wet, but not so much the roots drown.  Making sure the roots get enough oxygen is extremely important.
    • In the code this means turning the water pump on/off throughout the 24 hours.  In previous testing, I found turning the pump on for 1 minute every 30 minutes is a good setting.  I will start these as the defaults.  For this build, I will not be able to adjust the pump on/off timing.  I will also log when the pump turn on/off.
  • Measure and log temperature and humidity.  I am only monitoring these in the current design.  These environment variables are very important to healthy growing.  I plan to evolve the design to adjust the environment to the temperature and humidity that works best for the plants being grown.
  • Adjust CO2.  Keep the CO2 around 1200ppm when the LEDs are on and log readings.  I’ll start with the testing results I documented in the February 1st build log.
  • Maintain LED photoperiod.  Turn the LEDs on for 20 hours and off for 4 hours.  This will be the photoperiod I will use. Log when the LEDs are on and when they are off.

Thanks to Those That Went Before

I am very grateful for Dr. Monk’s timer library.  The timer library (GitHub location) is core to how TheLeafSpa.ino works. http://github.com/JChristensen/Timer

TheLeafSpa.ino

I’m hoping the code is (mostly?) self explanatory.  Perhaps setting the context adds to code explanation:

  • I take full advantage of Dr. Monk’s timer library.  Just love it.  Again, thank you Dr. Monk!
  • It is unfortunate the Arduino IDE does not have a great debug environment.  E.g.: there is no source line debugging.  No matter how hard I try, I make a lot of mistakes.  This is why there is an emphasis on the DEBUG macro and using the stuff in DebugLib.h.
  • I added in TEST_ACTIONS to deviate from the code path for the final run of code when it came to turning a relay on/off.  How I view the code, turning a relay ON or OFF is an action.
I came up with this function that I ended up not needing but wanted to keep it somewhere I could find it.  Maybe this isn’t the best way to convert a float to an unsigned int, but I understanding it and it works….I dunno floor(), ceil()…if I recall these functions didn’t get what I wanted.  Hey – I’m self trained and there is a good chance I am clueless on this.
unsigned long doubleToUL(float fNumToRound) {
  unsigned long ulToReturn;
  static char outstr[8];
  dtostrf(fNumToRound, 7, 2, outstr);
  int truncatedNumber = int(fNumToRound);
  float temp = fNumToRound - truncatedNumber + .51;
  if (temp >= 1.) {
    ulToReturn = int(fNumToRound + 1);
  } else {
    ulToReturn = int (fNumToRound);
  }
  return ulToReturn;
}

I dunno floor(), ceil()…if I recall these functions didn’t get what I wanted.  Hey – I’m self trained and there is a good chance I am clueless on this. 

So far, so good….I’ve got a bit to go.  Hopefully, there will be a beautiful tomorrow!

Advertisements