Author Topic: Using comparators to sense voltage?  (Read 3490 times)

0 Members and 1 Guest are viewing this topic.

Offline iampoorTopic starter

  • Frequent Contributor
  • **
  • Posts: 500
  • Country: us
Using comparators to sense voltage?
« on: June 20, 2015, 10:56:59 pm »
Hi

In 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  :-+
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7763
  • Country: de
  • A qualified hobbyist ;)
Re: Using comparators to sense voltage?
« Reply #1 on: June 20, 2015, 11:32:25 pm »
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).
 

Offline iampoorTopic starter

  • Frequent Contributor
  • **
  • Posts: 500
  • Country: us
Re: Using comparators to sense voltage?
« Reply #2 on: June 20, 2015, 11:55:02 pm »
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).

Yes, 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!  :-DD

Ive considered that too, but I dont have much experience with microcontrollers. Maybe this would be a good excuse to gain some?  :-+
 

Offline schwarzrmsu

  • Contributor
  • Posts: 25
Re: Using comparators to sense voltage?
« Reply #3 on: June 21, 2015, 02:06:19 am »
Personally I would vote for the 8-bit micro.  Great first project to get some experience with micro's.
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Re: Using comparators to sense voltage?
« Reply #4 on: June 21, 2015, 02:46:38 am »
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.)
 

Offline iampoorTopic starter

  • Frequent Contributor
  • **
  • Posts: 500
  • Country: us
Re: Using comparators to sense voltage?
« Reply #5 on: June 21, 2015, 05:35:04 am »
Personally I would vote for the 8-bit micro.  Great first project to get some experience with micro's.

Ive been thinking of using the PIC16F677
Im not sure where to start however! Whats a good starting point for pic micro-controllers?

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.)


AH 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!  8)
 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Using comparators to sense voltage?
« Reply #6 on: June 21, 2015, 09:24:27 am »

Quote
Ive been thinking of using the PIC16F677
Im not sure where to start however! Whats a good starting point for pic micro-controllers?

A 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
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Re: Using comparators to sense voltage?
« Reply #7 on: June 21, 2015, 09:59:42 am »
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.
 

Offline schwarzrmsu

  • Contributor
  • Posts: 25
Re: Using comparators to sense voltage?
« Reply #8 on: June 21, 2015, 02:35:59 pm »
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.

Agree 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.
 

Offline denelec

  • Regular Contributor
  • *
  • Posts: 168
  • Country: ca
Re: Using comparators to sense voltage?
« Reply #9 on: June 22, 2015, 12:21:24 am »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf