Using comparators to sense voltage? - Page 1
Forum section: electronics / beginners

author: iampoor
author_rank: Frequent Contributor
timestamp: June 20, 2015, 10:56:59 pm
content: HiIn a project Im working on, I would like to use a potentiometer to select between 8 different digital positions.I will be selecting pins on a 4017 binary counter. I am trying to keep the cost as low as possible, and do not have space for a rotary switch.I am thinking of using the potentiometer as a voltage divider, and then having a string of circuits to sense and switch on at different voltage thresholds (Ie 0 to .5v would be one selection .5 to 1v another selection). I am assuming that using 2 quad comparators would be the best option? I feel like some old school LED vu meters were build upon this principle.Really, Im just looking for what the technical term for what I am trying to do is. I have looked through the books I own, and have not found a similar circuit, but I know it must be pretty common!Thanks

author: madires
author_rank: Super Contributor
timestamp: June 20, 2015, 11:32:25 pm
content: IIRC, the LM3916 is the classic driver for LED VU meters. But in your case I'd go for a small 8 bit MCU (connect pot to analog input, run ADC and set output pin).

author: iampoor
author_rank: Frequent Contributor
timestamp: June 20, 2015, 11:55:02 pm
content: Quote from: madires on June 20, 2015, 11:32:25 pmYes, the LM3914/5/6 are all used for meter drivers. But I know I have seen some very primitive LM339 variants...now if only I could remember where!Ive considered that too, but I dont have much experience with microcontrollers. Maybe this would be a good excuse to gain some?

author: schwarzrmsu
author_rank: Contributor
timestamp: June 21, 2015, 02:06:19 am
content: Personally I would vote for the 8-bit micro. Great first project to get some experience with micro's.

author: matseng
author_rank: Frequent Contributor
timestamp: June 21, 2015, 02:46:38 am
content: The technical term is "window comparator" or maybe "window discriminator".But still a solution with LM3915 would only require 1 chip and a resistor or two. If you would do it with LM339's you would require six of them and 3-4 dozens of precision resistors. (That is if you want 10 levels to match your 4017.)

author: iampoor
author_rank: Frequent Contributor
timestamp: June 21, 2015, 05:35:04 am
content: Quote from: schwarzrmsu on June 21, 2015, 02:06:19 amIve been thinking of using the PIC16F677Im not sure where to start however! Whats a good starting point for pic micro-controllers?Quote from: matseng on June 21, 2015, 02:46:38 amAH yes, that rings a bell! Thank you! I just spent some time reading a few datasheets. Looks like the LM3914 is good for linear scales. I totally forget they had a chip designed for linear scale display. The only issue is that in the future, I might need to convert those 8 individual outputs into a 3 bit BCD address. The 74LS148 seems ideal, but this solution may actually be more expensive than just using a small Pic! EIther way I will probably try both....good learning experience!

author: picandmix
author_rank: Frequent Contributor
timestamp: June 21, 2015, 09:24:27 am
content: QuoteA Pic will do what you want, but you first need to say what you want to program in Assembly,Basic, C ?For any stand alone micro chip you will need a programmer, diy or ready made . (unless you opt for one of the ready made small arduino boards)While the 16F677 does look ok with its ADC and intenal oscillator, it does need an adapter if you want to do in circuit debugging so looking at other chips that have debugging built in might be a better long term option eg pic16F88 , 16F883/6 to name a few of the cheap, popular chips where you will also find plenty of web code examples

author: matseng
author_rank: Frequent Contributor
timestamp: June 21, 2015, 09:59:42 am
content: Why make the selection of microcontroller any harder than necessary? In this case there's no special requirements at all. Just grab a $2.50 Chinese Arduino Nano clone and be done with it. You need like 15 simple lines of code and there more than plenty of people out there that can help you.Choosing a particular PIC out of their lineup of approximately 1000 different models, setting up all peripheral registers correctly, purchasing the programming unit and all the other stuff you need to take care of will be a big timewaster.And no. I'm not a Aretino fanboy, I done designs with everything from pic10f200 to pic32 series. And also Attiny11 up to xmega and ARM. I just tend to use the most convenient processor unless size and/or chip costs are a major factor.

author: schwarzrmsu
author_rank: Contributor
timestamp: June 21, 2015, 02:35:59 pm
content: Quote from: matseng on June 21, 2015, 09:59:42 amAgree and disagree with matseng. It really depends how much time/effort you want to put into this project. If you have little to no experience with programming micro's, then I would suggest using a platform such as Arduino to get your self moving in the right direction.BUT, I would also try and emulate the same software in the future using some sort of PIC/Atmel part in order to teach you the hard knocks of programming a micro controller.I would relate this to learning how to ride a bike. You don't show up at a bike store and buy a fancy, tough to ride bike right off the bat. You buy the cheapy with training wheels (Arduino) and learn all the simple lessons. Then when you feel comfortable or get bored and require a challenge, l would look for the bike with no training wheels and maybe has a few bells and whistles (traditional PIC's/Atmels). Just beware these will be harder to ride right off the bat.

author: denelec
author_rank: Regular Contributor
timestamp: June 22, 2015, 12:21:24 am
content: The easiest microcontroller to program is probably the "Picaxe".Basically, it's a PIC with a BASIC interpreter built in. Slow but very easy to learn.All you need to program it is the free editor and the special USB cable.If you don't need speed, it could do.