Calling all electronics wizards!

Status
Not open for further replies.

MadOtis

Full Member
Verified Member
Oct 16, 2013
44
26
Georgia
Hello, all!

I have an idea for a mod, and would like to add a little "bling" to it. I'm trying to come up with a small circuit or chip schematic that would illuminate a multi-color LED when the mod is fired, but, the color of the LED would change based on the voltage available in the 18650 battery. Is this possible? I know most (if not all) the iTaste VV/VM mods have this, but I want to add it to a mechanical.

I've seen a few schematics for something similar by googling, but it seems that all the schematics I've found rely on a standard 5v power source.

Any suggestions? Has it already been done? Is it possible with a varying voltage source (4.1v down to 3.2v)?

Again, any help with a schematic would be most welcome.
 
Because of the variable source, the fact that LEDs object to varying voltage, and the complexity and lack of reliability in a transistor-run system directly, I'd go with a microchip for this one.

You could get very clever with it and have something like an ATTiny45 or ATTiny85 (PIC or PICAXE if you're a total purist) compare its internal voltage reference against the incoming voltage (it's not very accurate, but close enough for this purpose). With three legs of a tri-color LED attached to 3 different pins, you could turn on red, yellow, or green depending on the power level (or any other set of colors you prefer).
 

MadOtis

Full Member
Verified Member
Oct 16, 2013
44
26
Georgia
Thank you for the really quick reply!

Lol... I may have immediately dived into the deep end and can barely dog-paddle... I've fiddled with some basic circuitry and understand what capacitors, resistors, etc. do based on a 30 y/o electronics experiment kit from when I was a kid. But I've never done anything using microchips, so, I may have to buy a dozen or so of them so i can fry a few trying to get what I want. :)

Thanks for the suggestion, I'll see what I can burn... er.. create with it!
 
Believe it or not, while LEDs are not off the deep end, turning one on or off conditionally is. Actually, as soon as you say, "I'd like it if project X did this under this circumstance..." you're probably heading off the deep end. Any conditional action tends to be complicated.

I currently have a set of gifts on my desk where I'd like the light to flicker like a candle flame--and not using a flickering LED, just a regular one. There's another random conditional that demands a microchip.

If you do choose the ATTiny series (I'm a fan for the versatility, low power usage, and low cost at $2 or less per chip), you'll either want an Arduino Uno to program it or (much more complicated) build your own serial or parallel programmer. While the ATMega series of microchips will work fine here, they're larger, have more pins, and are much more complicated than they need to be for something this simple. Save the few bucks and just get the tiny.
 
You'll find the Arduino/ATTiny programming a snap, then.

The Arduino acts as the chip programmer in this instance, and the little ATTiny goes into the device. The Arduino can then be used for other projects or to program other chips and stays independent...good thing, too, as it's pretty big (comparatively speaking).

If you choose the Due over the Uno, that's fine. Either board is capable of burning a chip. The Uno's more basic and cheaper, and still quite good for basic electronics projects if you're interested in them. The Due has the capability to handle a lot more inputs and outputs, plus a 32 bit processor and larger memory and flash program space, but only accepts 3.3V power (it comes with a linear voltage regulator to supply this built in).

The Uno has a slightly more robust 5V limit, so it can work with more inputs as many are 5V.
 

Alexander Mundy

Ribbon Twister
ECF Veteran
Verified Member
Apr 1, 2013
4,408
26,100
Springfield, MO
I used an LM3914 in dot mode in the past to make a battery charge indicator with different color LEDs.
Very simple to work with chip that takes care of the LED driving for you and just needs a handful of passive components.
LED brightness varies very little with the voltage input range you want to monitor with the LM3914.
 
There's a ton of similar solutions, some involving specialized chips. I could do this with a series of transistors where the rising voltage trips out each successive light by triggering the base to drain to ground. It's inefficient, of questionable accuracy, and kind of wasteful of battery power, but it can be done.

In this case, it sounds like it'll be a fun challenge for MadOtis and a nice way to expand programming skills to include small ICs.

Just don't forget to order the ATTiny45 (4k programmable) or ATTiny85 (8k programmable) for the actual project. :) Those are available through Mouser and work out to about $1.10 per chip if you order 10 at a time (given the shipping, I would).

The ATTiny85 link is here: ATtiny85-20PU Atmel | Mouser

That's the PDIP version, you can get SMD if you want to shrink it even further.

While even the ATTiny13 would probably do (I'm not sure if that wee one has the Vcc detector and internal voltage, though), the price on the 85 is so similar that you might as well just get that one.

You'll also need a tri-color LED...I'm not sure if common cathode or common anode is best with these chips. You can probably get that at Radio Shack fairly cheaply.

Besides, you can now think of half a thousand things to do with it.
 
I used an LM3914 in dot mode in the past to make a battery charge indicator with different color LEDs.
Very simple to work with chip that takes care of the LED driving for you and just needs a handful of passive components.
LED brightness varies very little with the voltage input range you want to monitor with the LM3914.

(whack head) I'm so used to having to create boost transformers to run LEDs from low voltages that I didn't twig on the lithium voltage. Yes, a simple resistor would work fine on each leg, and illumination won't vary greatly over the range for the standard indicator LED (which you want visible but not blinding anyway). I also tend to be building things that are for use as light sources, hence blinding. Also hence the illumination dropping rather severely from 1.2 volts to 0.7 volts, a pretty tight range.

So yes, while the challenge of changing the colors by voltage remains, the challenge of properly powering your LED does not.

Interestingly, I think I can see a way of doing this with a simple set of Zener diodes (and some regular/Schottky diodes to get the voltages right as there's NEVER a Zener in the exactly right range!). It's, again, inefficient, and I can see some other neat things to do with an ATTiny in a mod (like shut down if battery power drifts under 3.2), but it would work.
 

MadOtis

Full Member
Verified Member
Oct 16, 2013
44
26
Georgia
It just dawned on me... won't I have to add an amperage limiter and voltage booster if I want to power the circuit(s) with the same 18650 battery powering the mod? I'm thinking I would need to limit the amperage to whatever the IC's circuit needs, and boost the variable voltage output of the loaded/draining battery to a constant 5v (or whatever the circuits require).
 
It just dawned on me... won't I have to add an amperage limiter and voltage booster if I want to power the circuit(s) with the same 18650 battery powering the mod? I'm thinking I would need to limit the amperage to whatever the IC's circuit needs, and boost the variable voltage output of the loaded/draining battery to a constant 5v (or whatever the circuits require).

Not necessarily. With the ATTiny series, voltage can be anything from 2.7 to 5.5V and it'll work just fine. Your lithium battery will always supply a voltage in this range (if it's dropping under 2.7 you're really pushing it). That's the only way a comparison to internal VRef (1.1 volts) would be able to determine which LED to light.

The LM3914 looks like it runs on anything from 6.8 to 18V per the diagram on Page 2 (Edit, nope, I found a version on Mouser that runs 3V to 20V). On the up side, it'll run the LEDs directly, whereas the ATTiny will require using either the PWM pins, appropriate programming on an analog output (you can define the output voltages), or output resistors if you're lazy.

Current limiting devices aren't necessary on most ICs, which limit their own currents. If it requires it, it'll be mentioned in the specs...but I can't think of a single IC that wants one. Certainly neither of these do; provide the appropriate voltage and it does its thing, moderating its own power usage.
 
Last edited:
Actually, Mr. MadOtis, that's a good question.

Are you looking for a trio of LEDs (Red, Green, Yellow), or do you want something like a three-legged, single LED (Red, Green, Blue) like this: https://www.sparkfun.com/products/10820 ?

If the latter, it'll need to be common anode for the LM3914 as I'm not seeing that it can sink power, just source it. While it doesn't matter for the ATTiny (which can source or sink up to 40ma per pin), common anode is so...well, common...that they're trivial to source.

One minor issue with using a common anode is that yellow isn't a simple color--it requires both red and green to be on fully. That's trivial in either design but you do need to know that.
 
Status
Not open for further replies.

Users who are viewing this thread