Build Your Own Arcade Controls Forum
Main => Main Forum => Topic started by: Neverending Project on July 10, 2008, 12:41:47 pm
-
This question is not specific to arcade controls, so it may not belong here. It probably doesn't even belong on this forum, but since I frequent this forum (and I like the community) I thought I would give it a try.
A few weeks ago I built my kids a rocket ship in their playroom. And what rocket would be complete without a control panel? So I will be making some sort of instrument cluster comprised of leftover arcade pushbuttons and joysticks (aha! a link to this forum!). I have this idea of making a picture of an instrument gauge, and then putting LEDs around the outside like the numbers on a clock. In the middle I want a dial that as you turn it up, the LEDs will light in sequence - similar to a power meter.
So I googled around a bit and came across the LM3914 (http://www.national.com/mpf/LM/LM3914.html) IC. It seems perfect for my application. Basically it has 10 current regulated output pins that drive LEDs based on an input signal of 0-5V. The chip takes care of the 10-step voltage divider and the current limiting and everything. It can even be set to output a bar style or a single light at a time.
Great, so now I need to figure out out to take my input voltage (11.5V from a wall adapter) and make a 0-5V range, controlled by a potentiometer so I can make my gauge work. I also came across the LM317 (http://www.national.com/mpf/LM/LM317.html), which is an adjustable regulator. There is an example circuit to output a voltage range from 1.5V to a little less than the input voltage. I can modify this circuit to give me a range of 1.5V-5V, which is almost there.
So now (finally) my question. Is there an easier way to do this? Is there an obvious way to get a variable voltage from a 11.5V source from 0V to 5V? Has anyone done anything similar?
-
Is the wall wart going to be driving anything else besides this circuit?
-
My guess is you need a resistor to bring the maxium down to 5v. THEN add a potentiometer (or variable resistor) to handle the remaining 5v to 0v
-
Short answer: yes.
I forget the current rating of the wall-wart, but it was my intention to have at least two of these "instrument gauges" hooked up to the wall wart. And throw some additional push-button controlled LEDs into the mix as well. So I would take the +11.5V input and feed it to the VCC of two LM3914 chips, as well as any additional LEDs I hook up (a few). If the wart I have is not regulated, I guess I will need a little voltage regulating circuit on the VCC rail as well. I plan on making sure it has enough current to drive it all, but all I am really driving is LEDs so it shouldn't be too bad.
-
My guess is you need a resistor to bring the maxium down to 5v. THEN add a potentiometer (or variable resistor) to handle the remaining 5v to 0v
It was my (basic) understanding that adding a resistor to the input voltage will reduce the current available, not drop the voltage, right?
-
yea you need a voltage regulator... not a resistor
-
What you need to do is make a voltage divider
All you need are two resistors or another pot. Using another pot would be easier since i doubt that the 11.5v wall wart will actually put out exactly 11.5v.
Time for some ASCII drawings
pot1
11.5V-----/\/\/\/\/---------------GND
^
|
|
|
|
| POT2
|---/\/\/\/\-----GND
^
|
|
|
SIG pin on lm3914
POT1 is the pot used for bringing the voltage down and POT2 is the DIAL.
simply adjust pot1 to read 5V between its wiper and GND
-
What you need to do is make a voltage divider
All you need are two resistors or another pot. Using another pot would be easier since i doubt that the 11.5v wall wart will actually put out exactly 11.5v.
Time for some ASCII drawings
pot1
11.5V-----/\/\/\/\/---------------GND
^
|
|
|
|
| POT2
|---/\/\/\/\-----GND
^
|
|
|
SIG pin on lm3914
POT1 is the pot used for bringing the voltage down and POT2 is the DIAL.
simply adjust pot1 to read 5V between its wiper and GND
This idea is on the right track, but replace the upper potentiometer with a 3 terminal regulator like the 7805. It functions like the lm317 but is configured for a fixed output, making it a bit easier to use. Other than that, you should be able to follow the typical lm3914 circuit diagram and get good results.
-
Thanks for the suggestions. My project just got much more complicated, however, as I decided to control it all with a microcontroller like the ATMega168. It's not that I need to - but more that it interests me, and this is a good excuse to learn how to interface something like the Arduino (http://www.arduino.cc/).
I plan on adding a button pad with 3-color leds in addition to the rest of the buttons and controls on this panel. It may be a while, but stay tuned if you want updates...
-
My suggestion is to scrap the 12V wall wart unless you need it for some other purpose and use a 5V regulated wall wart. That saves you some work. If you do need 12V for other purposes, you may want to look into a dual output wall wart. These normally use much more efficient switch mode supplies internally. If you use a linear regulator to drop 12V to 5V, you burn more power in heat in the regulator than you deliver to the load! Don't use a pot for this purpose. The power dissipation will be high, and regulation will be very poor (i.e. non-existent beyond what you set). Also, the voltage at the wiper of the pot will vary slightly with load, i.e. as you turn LEDs on and off.
My suggestion is to use a single pot bridged between GND and 5V as your "knob of doom". Hook the wiper directly up to the A/D input on your microcontroller. Make sure you keep the pot below 10k, otherwise you'll need an analog buffer (aka voltage follower) to keep sample/hold times reasonable. A 1k pot should work well and will only have 5mA going through it. The input impedance on the micro's A/D input (at least the AVRs you're talking about - I like your micro choice, btw) is fairly high, so you don't have to worry about current being drawn off the wiper. Digitize that, divide it up into levels, then use IOs to drive your LEDs.
For driving the LEDs, you may be able to get by with driving it low-side (LED anode at 5V, through a resistor, to the uC I/O line) directly off the I/O lines. Check your desired LED current vs. the I/O max sink current. If you have bright LEDs and need more current, there are several options out there that are transistor arrays usually 7 in a package. Something like the MC1413 which is even available with base resistors to let you drive it directly off your uC I/O lines (in this case, logic high would be LED on).
Since you have reasonably small LEDs that are well characterized, you don't really need the dedicated constant current driver. You can of course use it if you want to, but a simple resistor to set the current is probably easier.
If you use output compare (timer) channels on your micro, you can even PWM the LEDs to set brightness.
The other way to do this is with a bunch of comparators. The functionality is the same, but you're using analog electronics rather than digitizing the pot position and making decisions that way. The uC solution also lets you do "attract mode" if you want (yet another use for brightness control).
-
Wow. Thanks for all the great suggestions.
@MonMotha: I like the idea of using a transistor array. I have some parts on order, so I should be able to start experimenting next week. My problem (already!) is that I have run out of pins on the Arduino. The 4x4 button pad I will be using has a matrix of 4x4 buttons, and a matrix of 4x4 RGB LEDs. I will be using 2 AD5206 digital pots to control them all via PWM, but I am afraid I have used up all my pins.
So I will either use a second µM for the rest of my control panel interface doohickeys, or perhaps I will switch to some serial controlled shift registers to be able to control a whole mess of leds/switches. The problem with that approach will be that I won't be able to dim each RGB led independently.
But first I need to play a bit and get something working, before I go declaring the design inadequate.
-
You can easily matrix the LEDs and pushbuttons. This makes your software a wee bit more complicated, but reduces the number of IOs drastically (8 for a 4x4 array instead of 16). Modern micros are even fast enough that you can do individual PWM (dimming) control of LEDs even in a matrix configuration, albeit perhaps with only 5-7 bits of intensity control and somewhat reduced full brightness compared to individually driving them. Since you have RGB LEDs, you could even make a bigger matrix, perhaps 12x4, controlling each color as though it is another row of the matrix. This means you need 16 IOs rather than 48. If you clock your micro's timers fast enough (there are some AVRs with high-speed PWM output you could look into that can clock their timers up to something like 64MHz), you could still get plenty of dimming precision, though the peak current would be high enough that you'd probably need external switches (transistors).
The AD5206 isn't overly suitable for this in any way. You'd have to buffer the outputs to drive enough current into the LED (which comes free with a V-I converter for current mode control). PWMing is easy - just turn it on and off really quick (use a timer if you have one) and use a transistor in saturation to switch the higher current if your uC IO can't handle it. No need to deal with any analog electronics, and you waste less power since device losses are substantially lower outside linear operating regions needed for analog methods.
-
I wouldn't be surprised if you've seen this before, but sparkfun electronics had this in their news section a few weeks ago:
http://www.hackaday.com/2008/06/12/how-to-make-an-rgb-combination-door-lock-part-1/
Uses RGB buttons to unlock a door - not exactly what you want, but provides some interesting ideas on controlling a button matrix and LEDs via an Ardiono.