0
\$\begingroup\$

Getting back into electronics as a hobby, and I'm giving myself some breadboard tasks and drills to do to refamiliarize myself with both simple analog and digital circuitry.

Here's what I want to do: 5VDC source, with a pot (say, 100k). I want to take that analog signal and drive 8 leds which light up between 1 and 8 of them at a time depending on the relative output of the analog signal.

My first thought is 8 bit analog to digital. Got ahold of the ADC0804 chip (https://circuits-diy.com/adc0804lcn-8-bit-a-d-converter-datasheet/)

Simple hookup with a pot driving the V+ relative input, and my output was hooked to 8 leds through some current limiting resistors. I turn the POT and the output is 8 bit binary value displayed on the 8 leds.

Success!

But now my thought is, rather than displaying an 8 bit binary value, let's drive 8 leds which turn on successively more lights as the 8 bit output goes up. At first glance it might SEEMS like the same thing, but it's not.

For example, let's say the 8 bit output is 0b10000000. When displaying binary, of course, bit 7 is on, and bits 0-6 are off.

But I don't want to do that. That value is 128, which is half of 255, so the lowest 4 lights out of 8 should be on instead.

I'm racking my brain as to how to convert this without a simple microprocessor, which I can easily do. Probably could do it with TON of logic gates, but is there a 1 or 2 chip solution for this? I'm going through a bunch of data sheets, but since I don't know what this might be called it's difficult to find a prepackaged solution. Maybe I didn't need to convert to 8 bit digital in the first place, and there's a simple driver to accomplish this already?

This truth table might help (I've added some logic tables below the truth table). The logic table is how I could accomplish this with AND and OR gates. Would still love to know if there's a chip designed for something like this.

enter image description here

\$\endgroup\$
9
  • 1
    \$\begingroup\$ Decode the three high bits to seven of the LEDs and the last LED to the fourth most significant bit? \$\endgroup\$ Jan 27 at 2:20
  • \$\begingroup\$ @GrapefruitIsAwesome sounds like a winner, make that an answer. \$\endgroup\$
    – hobbs
    Jan 27 at 2:28
  • \$\begingroup\$ decode it using what? Understood the high 3 bits essentially count from 0 to 7, how do I convert that to 8 separate leds? This pointed me closer to the right direction. the 74238 gets me CLOSE, as it will light up between 0 and 7 lines, but only 1 at a time... \$\endgroup\$
    – LarryBud
    Jan 27 at 2:31
  • \$\begingroup\$ I had written an answer only to realize I that decodes logarithmically. Rather than that maybe using a 74xx series bar driver, I'll write that up instead. \$\endgroup\$ Jan 27 at 2:41
  • \$\begingroup\$ I'm being dumb (long day, I was linear to begin with...) \$\endgroup\$ Jan 27 at 2:47

1 Answer 1

2
\$\begingroup\$

As you want to (I assume linearly) may the 8 bit level to having one of the 8 LEDs on I would suggest the following mapping: decode the 3 highest bits to one each of 7 of the LEDs and then map the fourth most significant bit to the 8th LED. You won't need to ever consider the lowest 4 bits. See the truth table below.

ADC Bits LEDs
111xxxxx 10000000
110xxxxx 01000000
101xxxxx 00100000
100xxxxx 00010000
011xxxxx 00001000
010xxxxx 00000100
001xxxxx 00000010
0001xxxx 00000001
0000xxxx 00000000

You can decode the top 3 bits with a 3 to 8 decoder IC like the 74LS138 anding the lowest order output with the 4th most significant bit for the final output.

\$\endgroup\$
4
  • \$\begingroup\$ Close, see my edit above with the truth table. I also want to turn on all leds "below" the top most lit up. \$\endgroup\$
    – LarryBud
    Jan 27 at 2:45
  • \$\begingroup\$ And if you have something logarithmic like sound, take the leftmost 1 in your value and set that light and all the others beneath it. \$\endgroup\$ Jan 27 at 2:46
  • 1
    \$\begingroup\$ @LarryBud I see, if someone doesn't write up a more complete answer before me I'll update tomorrow (or sooner) when I get a chance. \$\endgroup\$ Jan 27 at 2:49
  • \$\begingroup\$ Appreciate it! I will continue to look to see if something is premade for this or if I have to get a little more basic with logic gates. \$\endgroup\$
    – LarryBud
    Jan 27 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.