Arduino: from prototype to product

When I first got into working with Arduino, I had a hard time finding examples of projects that made it all the way to the ‘finished product’ stage.  Hopefully this information will benefit someone looking to see what can be involved with bringing a simple prototype full circle.  The following information is for background and does not have anything to do with the prototyping process itself:

The problem: We have an ‘instant’ water heater that also runs a hydronic air handler and radiant slab in the garage.  In the winter, the system gets overloaded, and shower temps fluctuate.

The project:  Reset switch for domestic/hydronic water heater.  The device senses flow from a flow switch and intelligently shuts off power to pumps connected to the air handler after a preset amount of time.  The device also resets itself if it’s locked out for too long.

So, here’s what I started out with:

The first version of the device is big, bulky, and (relatively) expensive.  It consists of an arduino, a protoshield (which is unnecessary in this case), a breadboard, a large terminal block, and a collection of components.  As you can see, this is not portable, at least not easily.  As well, it’s got lots and lots of places where something could fall out, be pulled out, or otherwise experience a failure.

So, I decided to put it all in a box:

By moving the necessary components off of the arduino/breadboard and onto a prototyping board, I was able to condense the whole device into a more usable form factor.  I used this instructables tutorial to get all of the necessary components off the Arduino.  This intermediate step would have been fine if the goal was a one-off, but I was looking to design an easily repeatable ‘product-like’ final version.

In order to do this, it was necessary to design a printed circuit board that incorporated all of the components and circuit paths.  After some research, I found that many hobbyists use an application called Eagle PCB Design to do this.  Below, you can see what a PCB looks like in Eagle:

Eagle has a bit of a learning curve, but there are many great tutorials out there. Just do a youtube search and you’ll get quite a few examples.  It took me a few nights of working with my design to get it the way I wanted.  The next step is to find a PCB fabrication company to fabricate your boards.  I chose to go with seeedstudio, there are many others. Unfortunately (but somewhat expectedly), some errors on my first design caused my first run of boards to be unusable (Tip: make sure to be extra careful about the orientation of all parts you place into your design, top/bottom orientation can be very confusing for a newbie).  So, I made the necessary corrections and sent the board designs off again.

A few weeks later, my new boards arrived.  Below, you can see the results:

Above: Intermediate prototype next to finished product.  Quite a difference in size and complexity.

So as you can see, even someone with very little experience can go from prototype to (sort-of) final product.  I have found the design of PCBs to be one of the most enjoyable parts of this hobby.

 

First attempt: Controlling the LED driver brightness via PWM/arduino

This video shows an example sketch that controls the dimming on each channel (blue and white) independently.  You’ll see it go from 100% to 50% to low on each channel, and then slowly fade from 0 to 100% and then back down again, then repeat:

I now have pwm dimming set up and working on my tank via Arduino.  The whole system is operated by a regular programmable timer.  The timer turns the whole system on at 10:00 and off at 22:00.  The Arduino turns on with the timer (5v power is fed to the arduino via the Steve’s LEDs controller), and ramps from 0 to 100% on both channels over the course of six hours, and back down to 0% during the next six hours.  This, of course, is the first draft of the Arduino sketch and has one major shortcoming (outside of lack of on-the-fly programmability and user-feedback): if the power goes out, it starts back over at 0% output and begins ramping up again.  This isn’t a big deal if you rarely experience power outages, but could really mess up your tank’s usual light cycle if there are any power interruptions.

Here’s the Arduino code:

// This skectch brings LEDs from off to full brightness over a period of 6 hrs
// Then it dims down to off over a period of 6 hrs allowing for a full 12 hour
// cycle when controlled via an external timer.
int BluePin = 9; //this is the pwm output for the blue channel
int WhitePin = 10; //this is the pwm output for the white channel
void setup()
{
 pinMode(BluePin, OUTPUT);
 pinMode(WhitePin, OUTPUT);
}
void loop()
{
 for (int i = 0; i<255; i++)
 {
 analogWrite(BluePin, i);
 analogWrite(WhitePin, i);
 //delay for 84.375 seconds.
 delay(30000);
 delay(30000);
 delay(24375);
 }

 for (int i = 255; i>0; i--)
 {
 analogWrite(BluePin, i);
 analogWrite(WhitePin, i);
 //delay for 84.375 seconds
 delay(30000);
 delay(30000);
 delay(24375);
 }

}

In case you are wondering, the ’84.375 seconds’ value in the sketch corresponds to 256 slices of six hours.  The analogWrite method accepts values from 0 to 255.

Schematic: