I find reading the news and Twitter to be too stressful.  Since I must practice BE KIND and I found this stress impeding my BE KIND practice, I disabled my Twitter account, unsubscribed to my favorite news source, and found a machine learning course to occupy my brain….besides, if I want more folks growing plants, I need to make growing plants “dirt” simple.  Why not apply machine learning? 🙂  (umm…yes, first I need to figure out how to use a 4 channel relay….).

# Machine Learning Course

I’m just starting out.  The first lecture is on Supervised Learning.  Andrew briefly discusses two ways of predicting through Supervised Learning.  The key to Supervised Learning comes in knowing and using historical outcomes.

## Regression

Regression is fitting known data with an equation so that predictions are continuous (interpolated in how I see stuff).  Here he shows an example of a linear fit and a quadratic fit.  Pick an equation that you think best fits the known data, then interpolate where the data is not available.    Since I have this equation, I can predict “the continuous valued output.”  Ah prediction…the challenge is just that…it’s a prediction.  I do like that it starts off with history and informed data.  But then…it veers off into a person deciding how to make a prediction…I’m already liking this course better than reading the news..but there is nothing magical – it is based on a guesstimate made by someone on what equation best fits the data.

## Classification

Instead of interpolating data points through a regression analysis, Andrew says Supervised Learning predictions can be made on discrete values such as 0,1

There can be other discrete values.  This reminds me of different states.

Andrew goes on to say a classification algorithm could have an infinite number of attributes to refine the prediction.

Here’s the question we’re given at the end of the lecture to let us know if we learned the material:

The first prediction made sense as a regression analysis since it is predicting on sales.  I assume I have past sales (values like 150 for January, etc.) I’d look at how the “correct data” plotted, then fit an equation.  While the second prediction is assigning a 0/1 (hacked/compromised) based on customer account attributes.  Well, that’s what I’m telling myself….

And…SURPRISE!  All will be revealed through…wait for it…MATH!!!!!

# Relay

It is still early in the AM – which means I am working on my desk treadmill.

After a couple of hours I’ll move over to working on the Grow Chamber.  For now it’s stuff I can do at my desk treadmill.  I’ll start with the 4 channel relay.

As I noted in this build log post, relays will be used to:

• set the photoperiod of the LED lights (turn the LEDs off for some hours during the night
• periodically turning on/off the water pump so the roots don’t drown.
• adjusting the CO2 level to ~ 1200ppm.

I need 3 relays but decided to get this 4 channel relay board (I don’t know if it is any good):

# Test the Input Side

YIPPEE!

I mentioned the helpful Harry’s Bench post in a previous build log.  Here is a helpful entry showing the relay’s inputs:

GND goes to the Arduino GND and VCC goes to Arduino 5V.  There are four inputs controlled by Arduino pins.  The inputs map to the numbers on the relay.  To test the input side, I hooked up an Arduino to the input side of the relay and ran the Simple4ChannelRelayTest.ino sketch.

YIPPEE!  Worked the first time.  Switches with light indicator on for 3 seconds then off for 3 seconds:

# Moving Right Along

After ignoring warnings that playing around with 120 VAC will kill me, I move on to connecting a 120VAC powered device so that I can turn the thing on/off with the 4 channel relay.  First I should make sure I understand how to wire stuff on the output side up.  Harry’s  Bench Post had this on the output side:

He notes: “…each relay provides a common (COM) , normally open (NO) and a normally closed (NC) terminal.”  Yah right. OK.  I’m new to NC | NO | COM terminology.  The explanation provided by Giorgos Lazaridis on his PCBheaven web site titled “How Relays Work” worked well for me.

I’m really liking this drawing Giorgos has. “Now, imagine that someone wants to control a 220Volts 1 K-Watt load with a command that comes from a 5 Volts battery. A load-Relay should be used for this application. The Coil of the relay is driven with the 5 Volts. The contacts from this relay (NO) will be connected in series with the power supply of the load. Thus, the load will only operate when the relay is actuated. Our friend bellow will turn on an electric oven bare-handed!!!”

OOOHHH – Now we’re cooking NOT with gas!

I also liked the explanation MKme Lab did in his YouTube video.

Great.  Now the terminology of NC, NO, and COM makes sense.  But what about wiring up the LED lights, water pump, and CO2 regulator?  Now that I have a slightly better idea of what is going on, what I need is something like what Carl Rectenwalk Jr. showed in his YouTube video:

only for 3 outlets instead of 6.

Taking a break and browsing one of my favorite sites (Home Depot 🙂 )…I’m thinking the components I will need include:

this

I’m thinking the 4 channel relay box will fit below these

and this will cover up the sockets:

I’ll start by getting the wall socket since Home Depot has these in stock.  The other two items require online purchase which I should do pretty soon.

OOH – Shopping…I immediately run over to Amazon.com to order to cable tubing for the DC wires (input).  I’ll cram ‘em all into here:

then I’ll feed ’em through the Relay Box like Carl did:

And so the day went.