OSHWA Certification Logo is Official

This post originally appeared on the OSHWA blog.

We at OSHWA are excited to announce that the OSHWA Certification process has an officially registered trademark. This registration will make it easier for OSHWA to prevent people from using the OSHWA Open Source Hardware Certification logo if they have not actually gone through the certification process. We hope this will give the community more confidence when they see the OSHWA certification logo on hardware out in the world.

While there are many good faith ways to describe something as “open source hardware,” OSHWA considers certified projects to have met the gold standard of open source hardware by formally committing to comply with all of the elements of the community definition.

Are Trademarks Compatible with Open Source Hardware?

Trademarks are not in conflict with open source hardware. Trademarks are designed to indicate the origins of goods, not to control their reproduction. Knowing who produced something is especially important with hardware, because who actually manufactured hardware can be just as important to its reliability as who designed it.

Trademarks also do not prevent someone else from building on or using hardware that is protected by the mark. Companies like Lulzbot, Evil Mad Scientist, Adafruit, and Sparkfun all make open source hardware that anyone can copy, improve, or build upon. What people cannot do is pretend that their version of the hardware came from one of those companies by selling their version under the brand name of the original creator. That makes sense, because the original creator is no longer responsible for the new versions.

When creators have invited the world to make use of their open hardware, trademarks are how we know which pieces of hardware still come from the original designer. OSHWA believe that strong brand identities are compatible with a vibrant open source hardware ecosystem.

What OSHWA’s Trademark Means

The OSHWA Open Source Hardware Certification process is designed to make it easy for end users to quickly tell if their hardware meets the community definition of Open Source Hardware. When you see the OSHWA certification logo, you know what “open source hardware” really means.

image

The trademark will allow us to control how people use the certification logo out in the world. In concrete terms, it means that someone who fraudulently uses the OSHWA certification logo on hardware that does not meet the community definition is infringing on the OSHWA trademark. That means that OSHWA could bring a trademark infringement action against that person. This will allow OSHWA to protect the integrity of the certification mark.

What OSHWA’s Trademark Doesn’t Mean

As we noted in a post at the outset of the certification development process, OSHWA has no interest in controlling, nor ability to control, who gets to use the term “open source hardware.” Similarly, OSHWA does not have, nor desire, any control over who gets to use the Gear Logo and when they get to use it. Open Source Hardware is a concept that was developed by the community and continues to evolve as the community evolves.

Instead, OSHWA’s trademark will allow OSHWA to control the OSHWA-specific certification process. If the community definition of open source hardware is important to you, the OSHWA certification logo will be an easy way to know that the hardware you are holding matches that definition.

What is Next?

We are getting excited to launch version 2.0 of the certification process at the Summit this September. One of the big goals of 2.0 is to make it even easier to understand how licensing works with open source hardware, and make it easy to explore hardware that has already been certified. If you are at the Summit you will be able to see that launch in person. If you can’t make it, keep an eye on this space for updates.

Also, a huge thank you to the students of the Juelsgaard Intellectual Property and Innovation Clinic at Stanford University Law School for guiding OSHWA through the registration process.

Thoughts? Questions? You can always find OSHWA on Twitter, Facebook, and in the forums.

Unlocking 3D Printer Hearing at the US Copyright Office

I originally wrote this post on April 14, immediately after the hearing it describes. At the time I assumed that the video of the proceeding would be released soon, so I held it in drafts until I could add the relevant videos. As it is now early July, I decided to post what I have as is. I’ll add the videos if/when the Copyright Office ever posts them.

Update July 29: the videos are live

On April 13 the US Copyright Office held a hearing on my petition for a rule to make it clear that unlocking 3D printers does not violate copyright law. Specifically, the request is for a rule to make it clear that using consumables (filament, powder, whatever) that do not come from the company that made the printer does not violate copyright law. Background on this process starts here. You can watch the entire video of the proceeding here:

I’ll pull out some clips and explain what happened in the rest of this post.

How We Got Here

As always, it is worth noting that it is strange to even imagine that copyright law would have anything to say about what kind of stuff you put in a 3D printer. In fact, I don’t believe that it does. However, there is enough ambiguity around the question that I think it is worth asking for clarification from the Copyright Office on the issue. The connection with copyright law is this: the same law that makes it illegal to break digital locks on DVDs so you can rip them might also make it illegal to trick a 3D printer into using material that did not come from the company that manufactured it. (These locks are often referred to as “DRM” - Digital Rights Management - or “TPM” - technical protection measures.)

In 2015 the Copyright Office issued a rule that exempted tricking 3D printers into using third party materials from that law. However, the Copyright Office’s rule was narrow. It did not apply if the printer was making things that are used in commerce and whose physical production is subject to legal or regulatory oversight. Those qualifications are pretty broad. This hearing was reducing or eliminating them.

I have argued that the carve out swallowed the rule because all physical production is subject to some sort of legal or regulatory oversight. The 3D printing company Stratasys argued that the carve out was important because it helped protect the safety of manufactured physical parts. My response to that argument is that the safety of manufactured physical parts is entirely unrelated to copyright law.

The Hearing

Prior to the hearing, the entire debate had taken place in the form of written petitions and comments to the Copyright Office. In my comments I had largely argued my position on policy grounds: the carve out language was unreasonably broad and appeared to address a concern that 1) was not supported in the record, and 2) better addressed by the expert regulatory agencies such as the FAA and FDA. Essentially I was arguing that the carve out imposed costs in the form of ambiguity without any corresponding (copyright-related) benefits.

The Less Good Parts of the Hearing

At the start of the hearing, the Copyright Office immediately called me out for not providing specific examples of individuals harmed by what I feel is a problematic carve out:

(This is clip starts the last time they called me out - check out the 5:50, 8:40, 11:36, and 14:37 marks for some other examples)

They repeatedly asked for specific instances of non-theoretical harm. I had not provided any in the record and was not prepared to provide any during the hearing. In part this was because I felt at the time that it was unreasonably burdensome to require an individual to provide that level of evidentiary support as part of a request.

Nonetheless, I am sympathetic with the idea that the Copyright Office may feel that they need evidence of specific, non-theoretical harm in order to grant an exception to a law. By the end of the hearing it appeared that if the Copyright Office felt that they needed specific examples of harm they would request it from me. At that point I will ask the community to help me identify those examples. (note 7/5/18 - the Copyright Office has sent out post-hearing follow up questions to some participants. They did not send any to me or Stratasys. Only time will tell what that means.)

The Better Parts of the Hearing

Fortunately, that was not the extent of the hearing. The Copyright Office took time to try and understand why the supply chain integrity arguments made by Stratasys were relevant to a copyright rulemaking. There were two specific lines of questioning that struck me as encouraging.

First, there was a discussion focusing on the harms that would occur if the digital locks (the TPMs) were broken on the 3D printer software. As it had in its written comments, Stratasys focused on the impact that broken TPMs would have on the physical integrity of printed parts. When the Copyright Office asked Stratasys about the impact that broken TPMs would have on infringement of the software itself, Stratasys stated that it had never really considered that question.

Since the entire purpose of the copyright law against breaking TPMs is to prevent infringement of the work protected by the TPM, this was a telling admission from Stratasys. To me it highlighted how unrelated Stratasys’ concerns were to copyright law. Hopefully the Copyright Office sees it that way.

Second, there was a discussion around testing of parts. Stratasys provided examples of parts that had failed various quality checks (the nice thing about 3D printing hearings is that there are always physical things to pass around). Stratasys explained how important it was to do testing of physical parts and how third party materials might result in parts that failed to meet the quality standards.

At that point the Copyright Office asked if the same quality testing needed to be done on parts printed with Stratasys material and third party material. Stratasys answered that it did.

I also found this to be an encouraging answer. If Stratasys had stated that its materials allowed manufacturers to skip the quality testing, then it might be able to argue that third party materials could introduce undetected defects into the supply chain. However, if every part needs to be tested no matter where the input material comes from, it is unlikely that third party material will introduce hidden defects into the supply chain.

It is, of course, worth noting again that supply chain integrity has nothing to do with copyright law. Nonetheless, it is still helpful when an opposing argument falls apart, even if that argument is not particularly relevant.

Next Steps

Now, we wait. At some point the Copyright Office will make a recommendation to the Librarian of Congress. The Librarian will then issue a final decision. I’ll add a new post when that happens.

This project is designed to answer the question “if I leave my house now, how long will I have to wait for my subway train?”  One way to answer that question is “if you leave right now you won’t have to wait at all”.

The project uses a raspberry pi zero to connect the NYC MTA real time arrival data with neopixels.  The neopixels give you an indication of how far trains are away from the station.  Importantly, the alerts are  not based on the absolute time until the train arrives at the station (”A train will arrive at the station in 5 minutes”).  Instead, the alerts are aware of how long it takes to walk to the station from my apartment and are therefore based on the time from the station when you get there (”If you leave now and walk to the station, there will be a train arriving in the station 5 minutes after you get there.”).

A few quick notes before getting into the details.  First, the way you arrange the indicator lights is essentially arbitrary.  We happened to abstract them out into strips.  However, you could do spirals or overlay them on a map or whatever you want.  Second, and speaking of maps, this project builds on the never quite finished metro-and-bikeshare map project from when I lived in DC. That one combines reading from the WMATA api and the DC bikeshare API with an eye towards lights integrated into a map.  If you are in DC it may or may  not be helpful for you. Third, the parts of this that parse the MTA’s API is 100% reliant on Chris Griffin’s real time countdown subway display.  The NYC subway API is more robust than DC’s, which means it is like a million times harder to parse if you (like me) don’t know what you are doing.  Chris’ code made everything a lot easier.

The basic outline of the project is as follows: 

  1. Poll the MTA API to find out when trains will arrive at your station
  2. Pull out the trains you care about
  3. Assign them to the relevant indicator lights
  4. Repeat

Bill of Materials

If you decide to go with the physical layout I used you will also need

  • Mirrored acrylic (I got mind at Canal Plastics)
  • The brackets (available in the repo and on thingiverse)

Software

I’m assuming you already have your pi connected to your home network to get this rolling. One thing that I did discover is that you can transfer an SD card from a regular pi to a pi zero. That allowed me to prototype this entire thing on a full sized pi (with headers) before shifting it onto the zero.

Tumblr is bad at formatting code so I’ll just point to the github repo here for the entire code.  I’ll use this section to walk through important parts of the code.

#variables to hold the lists
arrival_times_york_south = []
arrival_times_york_north = []
arrival_times_high_south_a = []
arrival_times_high_north_a = []
arrival_times_high_south_c = []
arrival_times_high_north_c = []

This section creates the station lists.  For my purposes I care about three stations: York, High Street (A line), and High Street (C line).  Each station has two directions.  Modify these as relevant for the stations you care about.

#variables to hold the station IDs
HighS = [‘A40S’]
HighN = ['A40N’]
YorkS = ['F18S’]
YorkN = ['F18N’]

These hold the UIDs for the stations within the MTA API.  Someone made a helpful heroku app to help you find the ids that you care about.

#variables to hold the walk times
HighWalk = 13
YorkWalk = 7

This is how  long it takes you to walk to the station.  This is used to customize the alert time for your location.

def grabber(station_ID, station_URL, station_line):

This function adds the arrival times to the station for every train that is in they system.  Since the MTA API has data for when every train running will reach every station, the output here can be a dozen or so numbers that are as  high as 60 minutes out.

def lighter(arrival_list, time_start, light_one, light_two, light_three, light_four, light_five, line_R, line_G, line_B):

This function decides which of the neopixels to turn on.  “arrival_list” is the output from grabber, “time_start” will be how long it takes to walk to the station, the “light_x” is the the neopixels associated with that station in that direction, and “line_X” are the RGB colors associated with the line.  The idea here is that you tell the function when trains are coming, how to correct those arrival times for you walking to the station, what the indicator lights are, and what color they should be when they are on.

The block of if statements in this function that start with 

if  int(item) == time_start:

decide what these lights mean.  I decided to make five lights for each direction.  They are:

  • leave now
  • 1-2 minutes until leave  now
  • 3-4 minutes until leave now
  • 5-7 minutes until leave now
  • 8-12 minutes until leave now

These are relatively arbitrary categories can you can change them so that they work for you.  As noted above, the basic idea is to get a sense of how long you have until you need to leave and how many trains are coming reasonably soon.  Note that the lights can’t tell the difference between 1 train being in a category and 2 or more trains being in that category.  Also, I suppose this is where I should mention that these lights are only as accurate as the MTA info they are based on.

def blackout():

This function turns off the lights at night.  It has slightly different times for weekdays and weekends.

def pause_button(channel):

This function is for a pause button that temporarily turns off the lights during a time when they would otherwise be on.  I don’t know if I’m going to use it (as of this moment the off time is set to 30 seconds) but if the lights are somewhere that you’ll want to be able to shut them off for random reasons this allows you to do so.

while True:


Having  built these functions, this loop actually runs them. It ends by pausing for 5 seconds.  This is a shorter amount of time than necessary and was originally 30 seconds (this probably doesn’t need to be updated more than once a minute).  However, I’ve found that the actual downloading and parsing of the MTA data can take 15-20 seconds (sometimes even more) so I shortened it to 5 seconds.

Hardware

Here’s the wiring diagram:

image

I ended up putting the diodes every fourth neopixel.

After drilling the holes in the acrylic sheet I put the neopixel through the hole and soldered in the wires:

image

Here’s an image of all of them chained together:

image

Wired together with the harness:

image

And soldered in with the pi:

image

And that’s more or less it. Once you have things connected to your network just pick a place to hag it up.  Now you may or may not be late to a subway train again, depending on the accuracy of the MTA API data.

Update 3/15/18: I filed this brief reply to Stratasys’ comments in the proceeding as well. This blog post is a better reply.

I was kind of hoping that this wouldn’t happen, but has Stratasys filed an opposition to my request to make it easier to unlock 3D printers.  The background is here, but the short version is that the petition is about making it clear that copyright law should not prevent people from using third party materials in their 3D printers.  If you read that and thought to yourself “why would copyright law prevent someone from using third party material in their 3D printer?” you have arrived at the crux of this issue.  You have also grasped something that Stratasys appears to have missed.  From its opposition, Stratasys appears to believe that copyright law is well suited to industrial health and safety, preventing airplanes from falling out of the sky, and keeping out hackers.

To be clear (again, background) on its face this petition, which is in front of the US Copyright Office as part of the “1201 Triennial” process is pretty narrow.  It is only about removing qualifying language from an existing rule that clarifies that using third party materials in 3D printers does not violate copyright law.  The problem with the qualifying language is that it is highly ambiguous and could be read to swallow the entire rule.  Since the qualifying language appears to be intended to address a concern that does not actually exist, it should be safe to remove it. 

Stratasys’ Opposition

Stratasys explicitly does not oppose renewing that existing rule on unlocking 3D printers to use third party materials (the rule needs to be renewed every three years - hence the “Triennial”).  However, Stratasys opposes removing the qualifying language from that rule.  Unfortunately, its opposition does not really address the qualifying language (which is probably good because Stratasys effectively advised against inserting the language three years ago).  

Instead Stratasys’ opposition quasi-re-litigates the original exemption, defends the concept of closed systems as a thing, and urges the Copyright Office to address selected ills of the world.  The opposition never addresses one of the key points of the petition: to eliminate copyright law from any discussion about third party materials in 3D printers because copyright law does not belong there.

I’m not going to dwell on that first section of the opposition.  It is strange to me that Stratasys spends time trying to re-litigate the terms of an exemption that it does not oppose, but Stratasys does not appose the renewed exemption so that’s Stratasys’ problem.  Stratasys also raises a number of procedural arguments that every opponent of every exemption always raises.  While I appreciate the liberal use of italics to show which party properly carriers which burdens in those sections, it isn’t worth dwelling on those here either.

Instead, I want to focus on what I see as the real problem with the opposition.  That’s Stratasys’ belief that copyright law should be used for things that are totally unrelated to the purpose of copyright law.

Copyright Law Should Protect Industrial Supply Chains?

Stratasys first argues that closed industrial systems have significant benefits.  For the purposes of this discussion I will note, but not dwell upon, the fact that Stratasys seems unable to conceive of a world where an informed operator of a 3D printer weighs the value of closed industrial systems against the value of third party materials for their printer and concludes that they prefer third party materials.

Stratasys describes three benefits of closed systems in commercial applications:

  • “The ability to consistently produce outputs that match established benchmarks by controlling system inputs”
  • “A closed-loop feedback process that produces real-time quality and performance data to pinpoint performance issues and speed innovation”
  • “Steady improvement in reliability and service levels permitting expansion to new classes of customers”

These benefits have a few things in common.  The most obvious is that they are concerns that are completely beyond the scope of copyright law.  A related similarity is that they are unrelated to protecting the software that runs 3D printers from infringement.  A nexus with the purpose of copyright law would be the type of thing you might expect an opponent to raise in this type of proceeding.  Stratasys appears unable to find one here.

Copyright Law Should Protect Airplane Safety?

Airplane safety was actually raised in the 2015 round of this proceeding, although it was largely abandoned by the time the final exemptions were issued.  In this opposition, Stratasys details the work it has done to create the “Aircraft Interior Certification Solution” to provide “aerospace companies with a detailed verification process that tracks down the material and standards needed to install 3D printed parts in aircraft.”

That’s great! However, the integrity of components in airplane parts is totally unrelated to copyright law.  We have a number of other regulatory regimes (and regulatory agencies - more on that below) specifically dedicated to making sure planes are safe.  Which is good because a law passed to make it harder to rip DVDs is ill suited for that purpose.

Copyright Law Should Protect Occupational Safety And Cybersecurity?

Similarly, Stratasys points out that it has created closed systems to address the “need to mitigate risks involved in the use of a specific material, such as fire hazards or hazardous fumes.”  This could be a pretty compelling reason for someone to not hack their 3D printer and change all the settings.  It is totally unrelated to copyright law.

Stratasys also raises the specter of some sort of cybersecurity catastrophe, stating that “[a] 3D printer in a commercial setting with compromised or disabled TPMs would likely be more vulnerable to hackers, disgruntled employees, and other malicious actors.”  Again, this may or may not be true.  But we have entire branches of law designed to address hackers, disgruntled employees, and other malicious actors.  In the context of any one of those groups monkeying with the settings on a 3D printer, copyright law is not one of those branches.

The Copyright Office Should Regulate Everything To Relieve Other Agencies of Their Burdens

This is probably my favorite argument.  Stratasys describes my argument that the Copyright Office should stick to its knitting and leave things like regulating medical device safety to other expert agencies in this way: 

“In essence, Petitioners want the Copyright Office to pass the buck, putting the burden on other agencies to anticipate and regulate the hacking of 3D printers.”

This characterization of my desires is totally accurate.  I believe that we have government agencies besides the Copyright Office for a reason and that those agencies should decide how to handle the problems within their purview.  

Stratasys actually describes exactly this concept of other agencies deciding how to handle the problems within their purview, although it attempts to frame the behavior as some sort of doomsday scenario:

“This would force federal agencies not only to grapple with the changes brought by 3D printers, but to contemplate scenarios where TPMs are legally circumvented, and possibly to pass new regulations to ban the circumvention of TPMs on 3D printers within their regulatory arena.”

(note that if the TPM - that’s DRM or digital lock - was circumvented for a purose other than using third party material in the printer, such a circumvention would fall beyond the scope of this exemption).

I agree with this vision of the future as well.  Federal agencies should be forced to grapple with the changes brought by 3D printers within their regulatory arena.  That is what we pay them to do.  In fact, Stratasys immediately goes on to cite an example where the FDA ran a multi-year process to grapple with changes brought by 3D printing and then issued guidance within its area of regulatory expertise.

Stratasys’ kicker to this point is kind of beautiful: “In the current environment, this [agencies grappling with challenges and addressing them with regulation] would be a challenge to accomplish” (citing here as evidence). 

What Now?

Where does this leave us?  One of the major purposes of this entire process was to try and keep copyright law out of an area where it had no business.  Stratasys’ opposition - presumably its strongest argument - effectively gives up the game.  Its arguments are far removed from the world of copyright law because they have to be.  Within the narrow context of copyright law there is no reason to object to this exemption request.

The next stop is will be hearings in DC on this petition in the spring.  In the meantime, keep on eye on organizations like Public Knowledge.  They (along with a number of other advocacy organizations and law school clinics) are helping to organize ways for everyone to get involved in this process.

This is a quick tutorial on how to set up a simple web controlled relay using Adafruit’s Huzzah ESP8266 board and Adafruit’s Latching Relay Featherwing.  When you are done you will be able to open a web page while on your local network (on your phone, on your laptop, on anything with a browser) and turn lights plugged into the wall on or off. 

95% of this is pieced together from other places online, but when I was piecing I couldn’t quite find it all in one place.  Hence this blog post.  The entire process is pretty easy as these things go.

In order to make this work you need 1) something connected to your home network that hosts the website and turns inputs on the website into action, and 2) something to translate that “action” into power going on or off.  That’s the Huzzah ESP8266 board and the Latching Relay Featherwing, respectively.

Practically, you will need:

  • An ESP8266 breakout board (I used the Adafruit Huzzah because I knew it would be well documented)
  • A USB to TTL serial cable (I used the Adafruit one too) to program the Huzzah.  Note that it will also power the board during development.

  • Some LEDs to turn on (I grabbed these).  
  • Some wires, a breadboard, and a soldering iron will also help

For the purposes of this project you could use pretty much anything that uses a moderate amount of electricity as the thing that is turned on (you are just creating a remote controlled switch).  The most appealing features of the LEDs I chose were 1) that they plugged into the wall instead of being battery powered (relevant to the long term use I have in mind), and 2) that it was easy to access the power cord downstream from the power adapter so that the loads were less dangerous.

Programming

I very much recommend using the Adafruit tutorial for setting up the Huzzah.  Once you’ve successfully blinked a light with the Arduino IDE come back here.

The code is taken from this post, which is also a great post about using the ESP8266 boards as simple web servers.  The only thing I added as the CSS styling, which I’ll get to in a second.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

// Replace with your network credentials
const char* ssid = “YOUR_SSID”;
const char* password = “YOUR_WIFI_PASSWORD”;

ESP8266WebServer server(80);   //instantiate server at port 80 (http port)

String page = “”;
int LEDUnsetPin = 0;
int LEDSetPin = 2;
void setup(void){
 //the HTML of the web page
 //don’t forget you need estapes (") around the quotes
 page = “<style>  .button{    background-color:red;    color:blue;    border-radius: 8px;    padding: 12px 24px;  }</style><h1>Simple NodeMCU Web Server</h1><p>    <a href="LEDOn"><button class="button">ON</button></a>    &nbsp;    <a href="LEDOff"><button>OFF</button></a></p>”;
 //make the LED pins output and initially turned off
 pinMode(LEDUnsetPin, OUTPUT);
 digitalWrite(LEDUnsetPin, LOW);
 pinMode(LEDSetPin, OUTPUT);
 digitalWrite(LEDSetPin, LOW);

 delay(1000);
 Serial.begin(115200);
 WiFi.begin(ssid, password); //begin WiFi connection
 Serial.println(“”);

 // Wait for connection
 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(“.”);
 }
 Serial.println(“”);
 Serial.print(“Connected to ”);
 Serial.println(ssid);
 Serial.print(“IP address: ”);
 Serial.println(WiFi.localIP());

 server.on(“/”, [](){
   server.send(200, “text/html”, page);
 });

 //turn on the on pin and turn off the off pin
 server.on(“/LEDOn”, [](){
   server.send(200, “text/html”, page);
   digitalWrite(LEDUnsetPin, LOW);
   digitalWrite(LEDSetPin, HIGH);
   delay(1000);
 });

 //turn off the on pin and turn on the off pin
 server.on(“/LEDOff”, [](){
   server.send(200, “text/html”, page);
   digitalWrite(LEDUnsetPin, HIGH);
   digitalWrite(LEDSetPin, LOW);
   delay(1000);
 });
 server.begin();
 Serial.println(“Web server started!”);
}

void loop(void){
 server.handleClient();
}

Make sure to replace “YOUR_SSID” and “YOUR_WIFI_PASSWORD” with your wifi network ssid and wifi password.

As I noted above, the only modification I made to the code was to add styling to the server.  The code above isn’t the final styling - it is just a first cut to verify that the way I thought styling would work was the way that styling actually worked.

The “page=“ part of the code is the HTML for the webpage you will visit with your browser to control the lights. It may look more familiar once it is converted from a string into a more standard layout (apologies - tumblr is very bad with tabs but this may be a bit better):

<style>  .button{   

background-color:red;   

 color:blue;    

border-radius: 8px;    

padding: 12px 24px;  

}

</style>

<h1>Simple NodeMCU Web Server</h1>

<p>    <a href="LEDOn"><button class="button">ON</button></a>    &nbsp;    <a href="LEDOff"><button>OFF</button></a></p>

The links to LEDOn and LEDOff trigger the server.on functions further down in the code.  Since the latching relay has two pins, each function turns off and turns on the appropriate pins on the relay so that the relay is either open or closed.  If you were using a non-latching relay there would only be one pin that was either HIGH or LOW as necessary.  Those pins were defined in LEDUnsetPin and LEDSetPin at the start of the code.

The nice thing about mapping LEDUnsetPin and LEDSetPin to pins 0 and 2 is that those pins are also mapped to leds on the Huzzah board.  That means that you can test the sketch to make sure it works by just seeing if the lights turn from blue to red.  Of course, to do that you’ll need to go to the webpage that the Huzzah is hosing.

Finding the Huzzah on the Network

In theory the serial monitor in the Arduino IDE will return a message with your Huzzah’s IP address.  I found that to be a somewhat unreliable action.  Instead, I just went to the connected devices section of my router and looked for it in the table.  Once all of this is set up I’ll use the router to assign the Huzzah a static IP address so it is easy to find.  For the development period I just track it down in the router every time.

Once you have the IP address (probably some variation of 192.168.1.X) you can just type it into your browser.  If everything is going well you’ll see the webpage with two buttons (one with ugly styling):

image

Clicking on or off will turn on a red or blue LED on the Huzzah.  If that is happening things are working out just fine so far.

Hooking up the Relay

Now that the Huzzah is connected to your network, serving up a web page, and responding to clicks on that web page, it is time to connect the Huzzah to the relay.  

Note that I’ve been having problems uploading scripts to the Huzzah when it is connected to the relay.  That means it is probably best to have the final version of the code loaded into the Huzzah before you solder it all together (obviously you can breadboard it to your heart’s content).

There are four connections between the Huzzah and the relay to  make this work.  Unfortunately fritzing does not have the latching relay featherwing in its library, so we’re stuck with my description and this picture:

Fortunately there are only four connections so words should be able to get us most of the way.

  • Connect the GND pin on the huzzah to the GND pin on the relay
  • Connect the 3V pin on the huzzah to the 3V pin on the relay
  • Connect the #2 pin on the huzzah to the SET pin on the relay
  • Connect the #0 pin on the huzzah to the UNSET pin on the relay

Once you have that up and running try controlling it all with the webpage again.  If things are working every time you click a button on the webpage you will switch the LED on the huzzah and hear a nice click from the relay.

Connecting the Relay to the Lights

The last step is to make that click impact something you care about.  Cut the live wire on the LED power cable (obvious notes about electricity plugs into walls apply - make sure you know what you are doing and take appropriate precautions) and plug it into the “COM” and “NO” ports on the relay.  Plug the lights into an outlet.  

At this point if everything is working when you click a button on the webpage you should get

  1. An LED switch on the huzzah
  2. A satisfying click on the relay
  3. Lights on or off

And that’s pretty much it.  At some point you’ll need to switch the power for the huzzah/relay from the computer you are using for debugging to a real power supply.  I haven’t done that yet but will update when I do.