Since I’m not sure why the solenoid on the CO2 regulator isn’t working with the PowerSwitchTail II and I decided to go with a relay box, I want to get the relay box going as a priority to debug the CO2 regulator on/off.

Parts for Relay Box

Here is the link to the Google Spreadsheet for the Relay Box BoM.


Putting Relay Box Together

Wiring DC Side

Yesterday’s build log covered how to wire the DC (input) side of the relay.  I’ll use the wire I currently have and put them together by feeding them through this:


Wiring the AC Side

Harry’s  Bench Post had this on the output side:

 It looks like the silk screen diagrams this for each relay.  I’ll test by

  • building a power cord with a relay spliced in.  I’ll splice a cord then connect the live wire to NO and neutral to COM. I’ll start with NO because as I understand it, HIGH will make the connection, LOW breaks connection.  
  • connect a lamp to the power cord.
  • Run the Simple4ChannelRelayTest.ino Arduino sketch changes such that HIGH turns on power.

Building the Power Cord

Following this diagram:

I was looking for small prong versus larger prong on a three prong plug adapter.  Here’s an answer I’m assuming ( 🙂 ) is correct: …The smaller prong is hot and the larger one is neutral.

I went to Home Depot and got three of these:



From here:

Black (hot) wire, brass screw (small blade)
White (neutral) wire, silver screw (wide blade).
Ground (bare or green) wire, green screw. (U blade)

I’m ignoring earth for now which may not be a great idea.


POP  SPITZ…the smell of burning plastic.  These were the immediate feedback my 120VAC hookup made.  Clearly, I didn’t get something right with the wiring.  As an electrician in a Darwinian world – I would definitely be unselected.  Well – this “event” freaked me out enough to go do something else for awhile…Speaking of unsupervised learning… 🙂  

Machine Learning

Andrew talked about Unsupervised Learning.  I thought I was doing that (see how I can almost blow up my house above).  Here’s the course’s description of unsupervised learning:

Unsupervised Learning

Unsupervised learning allows us to approach problems with little or no idea what our results should look like. We can derive structure from data where we don’t necessarily know the effect of the variables.

We can derive this structure by clustering the data based on relationships among the variables in the data.

With unsupervised learning there is no feedback based on the prediction results.


Clustering: Take a collection of 1,000,000 different genes, and find a way to automatically group these genes into groups that are somehow similar or related by different variables, such as lifespan, location, roles, and so on.

Non-clustering: The “Cocktail Party Algorithm”, allows you to find structure in a chaotic environment. (i.e. identifying individual voices and music from a mesh of sounds at a cocktail party).


Hmmm….check this slide out:


You know what this reminds me of?  I struggled with math (among other things) when I was getting my MSc. at Stanford…this slide so reminds me of my professor at the time adamantly pointing at his white board where he had delighted himself with some triple integral formula – pretty much screaming at me “SHIIIEEEEIIIT Margaret…it’s RIGHT THERE ON THE BOARD.”  OKIDOKI.  DOI-DEE-DOI on my part… :-)….


I got the PyBoard V1.1 the other day.  Here is an image of the pin out:




Reading CO2 Levels

YIPPEE!!! Check out results I got hooking up the CO2 monitor to the PyBoard v1.1:

>>> from pyb import UART
>>> uart = UART(2,9600)
>>> gasdata = bytearray(9)
>>> uart.write(b’\xFF\x01\x86\x00\x00\x00\x00\x00\x79′)
>>> uart.readinto(gasdata)
>>> for vale..[Kue in gasdata:
… print(value)


It worked using CoolTerm!  So my thought the PyBoard would be a more stable environment for MicroPython / sensors / access to the Web was right.


A couple of bummer things in setup:

  • The PyBoard does not have a regulated 5V power.  I ended up using a breadboard power source.
  • I taped a Grove connector to the breadboard in order to connect the CO2.  The pins on the Grove connector are short.  This makes it difficult to keep a connection with the 4 pins (RX,TX,GND,5V+).