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:

Aquapod 24 LED Retrofit

I have been wanting to upgrade the lighting on my Aquapod 24 gallon.  In doing my research, I didn’t find many other writeups on retrofitting this tank with LEDs.  I’m not even sure if this tank is being manufactured anymore.  I’ve detailed the steps I took to perform the retrofit here for anyone else who owns one of these tanks.  Of course, the process should be similar for other pod-style tanks as well.

Design Requirements:

  • ability to independently dim each ‘channel’, that is, blue/white.
  • ability to control dimming via Arduino / PWM
  • low heat generation
  • As OEM – looking as possible (didn’t want a bunch of new wires or holes drilled into the hood)
  • Low noise from any active cooling
  • Remote power supply and drivers (to reduce cooling need and complexity inside the hood)

System specs:

I chose to go with a setup from www.stevesleds.com.  This system uses tubular heatsinks (square aluminum tubing) and a blower-style fan to achieve active cooling.  I liked this because it would allow me to keep the necessary low profile to keep everything contained in the original hood and still use the stock light-cover.  I’m sure this could still be done with a standard block-fin style heatsink, but it seems like it would be more challenging.

Parts used:

  • 3′ 1.5″ Aluminum heatsink tubing
  • 7 Royal Blue Luxeon ES LED
  • 4 Cool White Luxeon ES LED
  • 3 Neutral White Luxeon ES LED
  • 1 Pressurized cooling fan
  • 2 Single Drivers (these are manufactured by Steve’s LEDs)
  • 1 200w 24v switching power supply

You’ll notice above that I have a mix of two different white LED types.  After doing some research on forums such as reefcentral.com and nano-reef.com I noticed that some people like the look of a warmer white than the standard cool whites that are being used (see this thread for a very detailed discussion on LED color aesthetics).  After some consideration and viewing both, I found the color temperatures of the Luxeon Cool and Neutrals to be fairly similar.  I decided to just use both on the white ‘channel’ in order to give a little more warmth to the color.

The Build:

This is the hood before installation, 2x 32w Power Compacts:

The thing I really like about the blower fans that come with this kit is that they are easily mounted by removing the cover and drilling mounting holes as appropriate:

As you can see, the intake doesn't line up perfectly with the fan grate on the tank hood (the bottom of the fan hits the edge of the hood), but it's good enough.

Below, you can see the back-side of the hood.  I’ve had this tank for about 4 years now, and there is a lot of salt creep inside here.  Kind of scary considering that this is all high voltage (for now).  I decided to just strip off the ends of the 120v cords and use them to power each channel of the LED setup.  This will keep a stock look.  All drivers/power supply/controllers will be remote.

The heat sinks were very easy to install into the hood using pre-existing screw holes.  I just drilled an access hole into the top of the heatsink (to get a screwdriver through) and a screw hole through the bottom and used hardware scavenged from dis-assembly.  And now for the part of the build that I am not particularly proud of, I used JB weld to attach the heat-sink pieces together.  Welding the pieces together would have been superior both in terms of structural integrity and thermal management.  Frankly, I just didn’t feel like making the effort.  I drilled holes through the sides of the adjoining tubing pieces that met at 90 degree angles and capped the end of the tube coming out of the blower-fan with tape.  Below you can see the heat-sinks installed and blower-fan mounted.  Sorry for the lack of intermediate photographs.  As you can see, I also added a piece of scrap aluminum tubing to help with rigidity and as an additional thermal mass.

Below, all LEDs are mounted n the heatsink and wired.  The color of the wires does not correspond with anything.

A note about the LED pattern.  After reading about color-shadowing issues (the effect of point-light sources of different colors leaving multicolor shadows in the tank) on reef-central, I decided to locate the blue and white LEDs as close to eachother as possible.  What you see above are groups of one blue and one white butted (where possible) to one another.

The Power Supply unit:

I lucked out on finding a ‘project box’ for the power supply and drivers.  I had an old SFF PC case laying around that I just couldn’t bring myself to throw away.  It worked out perfectly in that it’s big enough to put all the components in, and it’s made of aluminum.  So it looks good and should be easy enough to keep cool.  It’s pretty big, but for this application that will be allright.  I plan on adding an arduino to control the drivers via PWM later, so having some extra space will be helpful:

LED channels plug into the terminal block, Pots for dimming stick out of already machined holes in the case.
Power supply mounted perfectly in the HDD tray.
Kind of hard to make this out in the picture, but the LED drivers are both mounted to the bottom of a cpu cooler which hangs from the same assembly the Power Supply sits in.
Complete, with panels on.

One thing I wanted to mention is that I wired the blower fan in series with the two fans inside the power supply case.  That is, the two power supply fans are parallel and then in series with the blower.  I did this because while the blower fan has a voltage regulator built in, it gets quite hot when throttling the 24v from the power supply down to the needed 12v.  As well, I found that I didn’t need the blower running at full speed to keep things cool. This setup runs very quietly and still moves quite a bit of air.  All temps so far seem to be okay so far (haven’t measured exit temps above 90 degrees on the heat sinks).

Here is the setup installed and operational:

Yes, I am aware that this picture is horrible.

Results

I’m very pleased with both the light quality and output of this retrofit.  The perceivable brightness has been greatly increased.  I would say that running the dimmers at about 50% is about comparable to stock.  I have not yet run this setup at 100% for a long period of time (my understanding is that corals should be acclimated to more intense lighting provided by LEDs).  Even once the corals are acclimated, I don’t think I’d want to have the setup running at 100% for too long, it’s just a bit too bright for my liking.  Besides, this tank is all softies and LPS right now.  Also, being able to dim each channel independently is a must-have, in my opinion.  Being able to set the color temperature at will is very cool.
I had quite a bit of success with avoiding color-shadowing by placing the whites and blues right next to each other.  However, there is still some perceivable color-shadowing in some areas, but it’s not distracting.  I think a certain amount of this is unavoidable in a tank like this.

Next steps:

I plan on controlling the dimming via Arduino at some point.  The drivers have both the option for potentiometer dimming (as currently setup) or PWM.

 

Arduino air-horn alarm

Using an Arduino to detect light, sound alarm.

Just wanted to share a very simple setup for sounding an air-horn using a servo connected to an Arduino.  I found that it can be tricky to get the mounting just right, and that  the servo (I’m using a standard issue Hitec HS-322HD) can have trouble pressing the trigger.  It takes a fair amount of effort (for a servo) to press the button and sound the horn.  You may have to play with the mounting to get it just right and take advantage of the best position for leverage.

You can see above I’ve fashioned a mount and some zip ties to fasten the servo.  I made this out of high density urethane which can be found at sign supply shops.  I’m sure results will vary depending on the brand of air horn you buy as I would guess they all have different tolerances and need more/less pressure to actuate the horn.

Above, you’ll see the Arduino with a protoshield mounted to the top along-side the airhorn.

Parts needed:

Arduino (any, I’m using a Duemilanove)
Photocell (also known as an LDR, or light-dependent resistor), Iike this one: https://www.adafruit.com/products/161
resistor (I’m using a 220 ohm,  but it will depend on the value of your Photocell)
Servo: You’ll need one that will run happily on the 40ma of current an Arduino pin will provide.

Here’s a schematic:

Here’s the Arduino code:

 //this sketch measures the light level of a room when powered up, sets a thresshold value, and waits for lights to be turned on to trigger the servo.
#define LDRpin 0
#include <Servo.h>
Servo myservo;
int AlarmHasSounded = 0;
int LDRval = 0;
int ThreshholdValue = 0;
void setup() {
 Serial.begin(9600);
 myservo.attach(11);
 myservo.write(90);
 ThreshholdValue=analogRead(LDRpin); //get original light level of the room
 delay(60000);

}
void loop() {

 LDRval = analogRead(LDRpin);
 Serial.println(LDRval);
 delay(100);
if (LDRval > (20+ThreshholdValue) ) {
 if (AlarmHasSounded == 0) { //check to make sure alarm has not sounded yet
 delay(3000); //how long to wait from the time of lights turning on to triggering the servo
 myservo.write(0);
 delay(1000);
 myservo.write(90);
 AlarmHasSounded = 1;
 Serial.println("Alarm Triggered!");
 }

}

}

The code above will need to be modified for your particular ambient light settings.  Depending on how much the amount of light fluctuates under normal conditions, you will need to modify the line that contains :

if (LDRval > (20+ThreshholdValue)

where the value ’20’ is a representation of the fluctuation you expect.

Additionally, you can modify the code to sense a laser beam from a laser pointer such that it acts as a trip-wire, as shown below:

Here’s a tip if you wish to do the laser tripwire thing, wrap some black electrical tape around a drinking straw and cover the photocell with it.  That way, the photocell will not be receiving much input from stray ambient light and it makes your program much easier to tune.  You could use this for the regular light-sensing alarm code posted above as well if you needed to shield the photocell from a specific light source.

-shane