Sunday, July 20, 2014

Arduino LED Strip Controller Build

This weekend, I decided I wanted to take an RGB LED strip controller that I'd been working on and make it a little more permanent. I took everything off of my breadboard and added it to a proto shield that I had, and I'm pretty happy with the results.  I plan on bringing it back to school with me in the fall and using it to control lights in my room.

a basic outline of what I used for a circuit
I'm controlling a 5050 LED strip with my circuit. This type of strip contains red, blue, and green LEDs in each of its modules, so I'm able to change its colors by varying how much each LED is turned on.  The strip is controlled through four pins; a positive rail and a ground for each color.  I've made it so that I can control the colors of the strip using pulse-width modulation from three digital PWM pins on an Arduino Uno. 

The three n-channel transistors shown in the circuit act as switches that I control through the Arduino, allowing me to turn the red, green, and blue LEDs in the strip on or off.  When I send a high signal to the base of one of the transistors, I allow for current to flow through its other two pins, effectively turning on one color in the LED strip. On the power supply side of things, the 5 volt regulator and capacitors allow me to create a smooth 5 volt signal from the 12 volt power supply that came with my strip.  This way I can run both the Arduino and the strip with the same supply.

Since my Arduino is 8-bit, I'm able to vary each color by 256 increments of brightness.  In order to produce colors other than red, green, and blue, I turn on each of the three colors at different values between 0 and 255. So in other words, I can produce a lot of colors. In order to clear things up a bit, here's an example of how this would work. Say I want to produce white light. In order to do so, I would set the values for my red, green, and blue outputs all equal.  For a dim light I would set them to low values, such as 50. For maximum brightness, I'd set them all equal to 255. It's that simple.  

using PWM to control color!

So far I've been using example code from Adafruit to control my strip, but I'm in the process of writing my own code that will allow the strip's colors and brightness to be controlled by music.  This is why there's an audio adapter in my schematic.

I'll be doing another writeup on my code for music synchronization sometime in the near future, so stay tuned! 

  

Wednesday, July 16, 2014

Installing Ubuntu On An Old Desktop (Fail)

For the past week or so, I've been trying to install Ubuntu on an old desktop that I got from the dump.  For those who are interested- it's a Dell Optiplex GX620 with a 3.0 GHZ Intel Pentium CPU, 2.0GB RAM, and 160GB SATA Hard Drive. It's been a bit of a process.

Attempting to install Ubuntu on my desktop, shown cracked open on the right
I decided to try download a 32-bit version of Ubuntu desktop install it using a DVD, but I ran into several problems along the way. One message that I consistently get while running the installer is "the ext4 file system creation in partition #1 of SCSI3 (0,0,0) (sda) failed." For one reason or another, Ubuntu's installer just does not want to partition my hard drive for me. I've tried setting it up manually several times so that I have set partitions for my /root and /home directories as well as swap space, but to no avail.

When I do manage to get past having the installer format the drive and the "Install" window appears with a loading bar, it will either freeze or crash midway through. Score!


Tuesday, July 8, 2014

Audio Amplifier Power Supply Circuit


As you've probably gathered from my previous posts, I'm working on building myself a high-power audio amplifier.  I've found that both the two books I own and the internet share a common method of documenting amplifier builds. This method showcases the circuitry that revolves around the amplification, and often glosses over building a power supply for said circuitry. I mean, go figure right?  What I've wanted for a while now, not just with this project, is a reliable method for building an amplifier power supply.  In the past, I've looked at schematics for audio amplifiers and realized how they function for the most part, and then felt stuck when I saw rails for power. After spending some time reading and searching the internet, I've come to a few conclusions, and feel that I have a few new tools at my disposal.

When it comes to building a power supply, the first thing you need to do is find out what supply voltages the amplifier circuit can run off of, as well as what you want your max output power (in watts) to be.  In my case, I'm using solid state amplifier IC's that require positive and negative voltage sources, as well as a ground connection. So along with providing the right amount of output power, I'll also need a supply that can put out both a positive and negative voltage. You'll be able to perform all of the necessary calculations to build your power supply by knowing the required values of these voltage sources.

For example, say I want to build a stereo amplifier that can put out 60 watts RMS per channel running off of a supply voltage of +/- 20-45 volts.  In order to calculate what I need for a power supply, I'll first use the equations Power = Amps * Volts [P=IV] and Volts = Amps * Resistance [V=IR] to get P = (V^2) / R, or V = sqrt(RP) to calculate the RMS voltage I'll need from my supply. Using my desired output of 60 watts through 8 ohms:
           
 V = sqrt(60*8) = sqrt(480) = 22 volts.     (1)

I then convert this value from RMS voltage to standard voltage by multiplying it by sqrt(2), or 1.414.

1.414 * 22 = 31.1 volts = 31 volts.     (2)

Next, I need to account for any drops in voltage that will occur from my power supply circuit.  This includes the approximate values of a 5 volt power supply droop if running at full power, a 2 volt drop from the amplifier circuit itself, and a 1 volt drop from the power supply circuit's rectifier, bringing the total drop to 8 volts. I also need to convert my voltage back to an RMS value. 

(31 volts + 8 Volts) * 1/sqrt(2) = 39 volts * .707 = 28 volts RMS.     (3)

This is the number I've been looking for! In order to provide the output power that I want, I'll need a transformer with +/- 28 volt dual secondary rails.  In order to buy the correct transformer, I also need to know its VA rating.  This is simply volts*amps, and should be specified with the transformer's specs.  Using ohm's law and our voltage value from (1) and Ohm's law, we can calculate that:

22 volts / 8 Ohms = 2.75 Amps.     (4)

We then need to increase this value by 20% to account for approximate losses, and then double our answer because we'll be powering two channels at 60 watts each.

2.75 Amps * 1.2 * 2 channels = 6.6 Amps.     (5)

Next, we multiply this number by the voltage value that we obtained through (3) in order to get the desired VA rating of our supply.  In case 4 ohm speakers are used with the amplifier, this rating should be doubled.

6.6 Amps * 28 Volts = 184.8 VA * 2 = 370 VA.     (4)

You now have the power requirements for your transformer! 370VA, with +/- 30V dual secondaries.  I'd recommend getting a toroidal transformer in order to keep electromagnetic noise to a minimum.

In order to complete your calculations for making a power supply circuit, you'll need to figure out what values you want to use for your reserve capacitors (CR). You can do so using the rule of thumb of 1000 microfarads per 10-15 watts output. In the case of my above example, I'd use capacitors rated for (120 watts / 15 watts/microfarad) * 1000 = 8000 microfarads at minimum.

As a side note, based on my schematic, CE is used to reduce external noise, and the four CS capacitors are used to reduce noise from bridge rectifier BR. Both the CE and CS capacitors are ceramic.

Wednesday, July 2, 2014

Boombox Circuit- Spontaneous Build of the Day

Today when I got home from work I decided I wanted to build myself a little boombox. I've been looking at small Bluetooth speakers and "boomboxes", if you will, for a while now. I did some scavenging through my parts drawer, and stumbled upon an old Toshiba TA7230P IC. I looked up its datasheet and decided it would be perfect for my needs. The TA7230P is designed to power a small set of speakers with minimal external components. If I remember correctly, I got it out of a junked radio several years ago. 

The example circuit from the datasheet (pictured at the top) is what I ended up building. All that I needed other than the chip was several capacitors and a pair of speakers, all of which I already had available to me. I decided that I would go with point-to-point soldering to put it all together; both as an experiment for testing my soldering skills and as a way of keeping noise to a minimum. My end result is what you see below. 

I was really impressed with the sound of the circuit, especially considering every single part I used was scavenged from old boards. The sound quality was cleaner than I had expected, and there was little to no detectable distortion at reasonably loud volumes. Overall, I powered the circuit off of 6 volts, which is on the low end of the possible 5.5-20 volts that the IC can run on. I used the circuit to power a small pair of 4 ohm, 3 watt speakers. My next steps are to find a good case for it all, and to interface the circuit with my Bluetooth audio adapter. I'll be saving that for another day though.