Sunday, September 14, 2014

The Lightning Simulator/Breathalyzer/Graphic Equalizer - Arduino Powered [Full Tutorial]



*** UPDATE: A portable version of the Talking Breathalyzer is here http://talkingbreathalyzer.com ***

The LED strips are mounted on an outdoor trellace which functions as a lightning simulator, outdoor breathalyzer, graphic equalizer synced to music, and a few other effects with sound.

Materials:

8 12v RGB Waterproof Flexible LED Strips 10ft long (usledsupply.com) - $800
8 RGB 4A/Ch Amps (usledsupply.com) - $200
8 RGB 4A/Ch Amps with TTL input (usledsupply.com) - $200
RGB Controller 8 Key Touch (Wall Plate) - $25
1 Arduino Mega - $60
1 Arduino Mega ProtoShield - $15
1 AdaFruit WaveShield - $22
1 Electrical panel enclosure to house the Arduino and LED Strip amps - $30
18-4 cable for wiring the LED strips - $30
2 Power Supply 12v 48W 4A
1 5VDC Power Supply
Waterproof Butt Connectors
Standard CAT5 wire
2 pairs of Audio Baluns
Molex connectors and crimping pins
Alcohol Sensor
Various switches and two 10K potentiometers
Other sensors of your choice
Speakers
Audio Amplifier or Whole House Audio System
Electro-Seal by Ducky (waterproof, flexible rubber coating)  - Optional

Step 1: The Schematic & Audio Solution

I needed to be able to control each of the 8 LED strips (each strip is 10 feet long) individually. Controlling each LED in the strip individually would have been nice but was not required for this project.

After a bit of research, I landed on the folks over at usledsupply.com. Their service was great, they answered all of my questions even the dumb ones in a timely manner. They also did a custom wiring schematic based on my requirements and pre-cut the LED strips to the lengths I needed.

The project also needed sound for the Breathalyzer feature as well as some of the other effects, the Adafruit WaveShield fit the bill for this. Line level audio comes out of the WaveShield and goes into an existing whole house audio sound system (the Nuvo Grand Concerto). It was a 70ft run to the Grand Concerto audio system and unfortunately line level audio picks up noise very quickly on long runs so audio baluns over CAT5 were used to eliminate the noise.

For the Graphic Equalizer (VU Meter) feature, line level audio goes out from the Grand Concerto audio system into an analog input pin on the Arduino Mega.

usledsupply.com had an off the shelf LED controller for controlling the colors, dimming, flashing, etc. So I wanted to be able to use this controller along with the Arduino Mega for the lightning simulator/breathalyzer/graphic equalizer functions. The way this works is you simply turn on the controller you want and turn the other one off.

A higher resolution pic of the schematic



Step 2: Digging the Trenches & Running the Power & Audio

I had decided at the beginning I didn't want a lot of wires and power cords showing so I housed the power supplies downstairs in my basement and ran the +12VDC power for the LED strips and +5VDC power for the Arduino Mega over standard sprinkler 18/5 wire (70 foot run).

Also ran CAT5 for the audio baluns mentioned in step 1.



Step 3: Mounting the LED strips

Mounting the LED strips was pretty easy although time consuming. Mount them using a caulking gun with a tube of 100% Silicone from your local home improvement store.

Lay down a bead of the Silicone and then attach the strips. You'll need to secure them with staples or in my case, painter's tape until the Silicone has dried and hardened.

It's also a good idea to power at least one of the strips so you know you've got your wiring right and the strips are not defective before permanently attaching them.


Step 4: Wiring the LED Strips and Sensors to the Arduino Mega

Now the hardest and most time consuming part, wiring up the LED strips and various sensors to the Arduino Mega. I soldered the LED strip and sensors to the Arduino Mega Protoshield for permanent connections.

There are a few minor tweaks needed to get the AdaFruit WaveShield to work with the Arduino Mega which is well documented in the AdaFruit support forums.

The LED Amps from usledsupply.com came with screw terminals connections as opposed to solder points which is nice for moving things around but a little more work for permanent installations.

I also used Molex connectors so the controller board can be removed later for future modifications without the need to cut wires.

The RGB amps were secured to a piece of wood using RTV silicon and then the wood board was mounted inside the off the shelf electrical panel (spray painted black).

I then ran standard CAT5 cable to the knobs and buttons enclosure in the next step. CAT5 wire is great for this purpose as you get 8 wires in one nice clean run and the wires are color coded already.

Step 5: The Outdoor Breathalyzer

My wife and I throw a Halloween party every year and we'd thought it'd be cool to have an outdoor Breathalyzer where the LED strips light up proportionally based on how much you've had to drink and also talks to you giving a different response based on your alcohol intake.

The potentiometer with the knob on the right changes the voice of the Breathalyzer character. The Breathalyzer has four characters, an old English voice, a Pirate, a scary Halloween character, and an insulting New York cabbie character. I used the same characters and voices for this Breathalyzer as from a different project of mine, the Magic Mirror at diymagicmirror.com.

The potentiometer with the knob on the left is used to toggle the mode from Lightning Simulator, to Breathalyzer, and to Graphic Equalizer.

There are two CAT5 cables running into this box from the controller in the previous step. The big red button is from Seeedstudio and really has a nice sturdy feel to it, this triggers the Breathalyzer.



Step 6: Arduino Code

With all the sample code out there on the Internet, this part is pretty easy. Attached is the Arduino code for this project.

What's cool about having the Arduino Mega is there are enough digital pins available (24 to be exact) where the red, green, or blue colors for each strip can be controlled by each of the 24 digital pins. So if you want to make yellow for example, then just turn on red and green at the same time. To make white, turn on red, green, and blue all at the same time.

I'd like to thank the guys who posted this VU meter Instructable, I was able to use that code for the Graphic Equalizer piece.

On other funny thing about these LED strips is that to turn them on, use this

digitalWrite(red1, LOW);

not this:

digitalWrite(red1, HIGH);

Took me awhile to figure that one out as LOW normally turns something off and HIGH turns it on. It's the opposite in this case with the LED strips.

In addition to the attached code, you'll also need the WaveHC library

0 comments:

Post a Comment