Author Topic: Decision to Choose Comparator vs MCU for a Simple Thing.  (Read 4926 times)

0 Members and 1 Guest are viewing this topic.

Offline MechatrommerTopic starter

  • Super Contributor
  • ***
  • Posts: 11631
  • Country: my
  • reassessing directives...
Decision to Choose Comparator vs MCU for a Simple Thing.
« on: August 18, 2011, 11:05:36 pm »
I'm getting back to my long overdue project. Having just played with a comparator trying to get some simple straightforward signal filtering, still not satisfied with it. So make me thinking of replacing it with simple mcu like pic10f200. I heard discussion that using mcu for this very simple thing is overkill, but i made a quick research on this anyway. this is what i found from datasheet and digikey:

spec                                       LM139 comparator                          pic10f200
current comsumption                  400uA                                          <175uA
price per unit USD                         3.47                                             0.70

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=497-6992-1-ND
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=PIC10F206T-I/OTCT-ND

with comparator, i'm gonna need extra components to help with filtering, pullup, dc bias etc and i still cannot guarantee it can do what i want. but with uC no need extra component and i can do whatever i want in the software. so tell me why should i still give a consideration to a component thats 5X more expensive and 2X++ more power usage?
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: us
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #1 on: August 18, 2011, 11:26:17 pm »
First of all, look at an LM339.  Down around 25 cents.  139 is the mil temp spec'd device.  As for comparing, the A/.D in the pic is 8 or 10 bit (I didn't look it up).  The 339 will have much greater accuracy with regard to analog "comparing, while the PIC is limited by the A/D resolution.  In either case you need some sort of voltage reference to do the comparison.

If the app is not high accuracy, then the PIC should work fine.  For higher accuracy and also speed, the 339 will likely win, and it doesn't need a program.

paul
 

Offline vk6zgo

  • Super Contributor
  • ***
  • Posts: 7586
  • Country: au
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #2 on: August 19, 2011, 01:31:17 am »
Looking back at your original project,have you tried listening to the RF pulse from your flash unit,using a ordinary AM transistor radio.
If you can hear it,you will have a nice audio noise burst available at the earpiece outlet.
Take that,rectify it and feed the result to your comparator or MCU.

VK6ZGO
 

Offline MechatrommerTopic starter

  • Super Contributor
  • ***
  • Posts: 11631
  • Country: my
  • reassessing directives...
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #3 on: August 19, 2011, 05:05:13 am »
Looking back at your original project,have you tried listening to the RF pulse from your flash unit,using a ordinary AM transistor radio.
If you can hear it,you will have a nice audio noise burst available at the earpiece outlet.
Take that,rectify it and feed the result to your comparator or MCU.
VK6ZGO
the original emf signal will minimally rectified with a diode and cap and later to "supposedly" lm393 (only in stock) for further filtering (hysterisis) because i dont want all the signal, some are true emf signal, some just the back emf like result when some switch turning off inside the flash unit, i've made something like hysterisis switch (nice up down signal), but if the original signal is changed, then the output signal will be changed too. i need it to be stable no matter what, like a stable 10Kbps signal. so maybe my signal filtering is not this straight forward. i can program pic to OUT HI for some duration when it detects a signal on another input pin, just that straight forward conversion, except i can tune how much duration it is and how much time to ignore the emf that i suspect false emf. i can see the only advantage using comparator is higher input/supply volt capability and no need programming time during mass production. but for my case, i think the emf is low energy low volt i can adjust and pic can take, my circuit pcb should be smallest and lowest power usage. and not really mass production, i can stand production like 100 pcb only in a day, certainly not thousands. have the pic in stock for testing already, not like lm339. but when i check the comparator price... I :o 5X?! not even close!

just checking lm339, ok it almost the same price (10 cent cheaper), but it only quad package, i only need one comparator, + i still need extra components and will increase cost and pcb size. 0.8mA current? my point in post #1, still valid i think. maybe it can beat the mcu if the comparator only cost at most 10-20cents at small order like 10-100 unit.. ignoring the power hog spec for the comparator.
« Last Edit: August 19, 2011, 05:08:18 am by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline DaveW

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: gb
    • WattCircuit
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #4 on: August 21, 2011, 10:30:35 am »
Well if current consumption is important, why not use a comparator with low current consumption. I'm using this one on a project that runs for years without a battery change,

http://datasheet.octopart.com/LTC1440IS8%23PBF-Linear-Technology-datasheet-516017.pdf

2uA current, and that's with a high temperature range and built in voltage reference, I'm sure that if you don't need those you could find something with a lower consumption, or probably more important, cheaper.

With a (very) quick search,

http://uk.farnell.com/microchip/mcp6546-e-p/comparator-single-open-drain-dip8/dp/1332141

32 cents and 0.6uA supply current. For a one off project the cost of an MCU is irrelevant if it's easier/quicker, but if you ever go into higher volume production you can do the tuning in analog on a one off development board (RC Filter, or something more sophisticated for the timing/pulse lengthening), and then replace with cheap fixed passives for higher quantities
« Last Edit: August 21, 2011, 08:15:46 pm by DaveW »
 

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: us
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #5 on: August 21, 2011, 12:59:26 pm »
The LM339 is a quad.  You can get a dual in an 8 pin, LM393.  Digikey has them for 10 cents in thruhole 8 pin dips.

paul
 

Offline MechatrommerTopic starter

  • Super Contributor
  • ***
  • Posts: 11631
  • Country: my
  • reassessing directives...
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #6 on: August 21, 2011, 08:43:05 pm »
the link i gave is dual opamp lm139. since size is critical, thruhole is not preferable. the ltc1440 dave gave is alot better though. but thinking of it, if i want to reduce even more power, i can put pic10 in sleep mode which only use 0.1uA, and only wake up when there's signal. if i use pic, i may settle the problem right now, but with comparator, i need a good hat in analog design to get it to work. but since this is the next stage in the development, i will put this aside for a while, until when i need to translate every bit of the emf burst, for now i only need to detect the first burst, which i think comparator or pic is not necessary, i'll just use the main mcu for the purpose, or somekind of input protection, to avoid excessive voltage, although the signal will not be so high (around 5-20V max) and only for very short duration (low energy?). thanx for input guys, but a pic still in mind, maybe only for this particular project, other type of project may prefer a comparator.

the only drawback with pic i can see right now is extra programming effort, could be a problem for mass production at magnitude greater than few hundred. but i dont think a big mass production is the mission here. even if it is, i'm sure we can always resort back to comparator for the solution.
« Last Edit: August 21, 2011, 08:56:29 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19518
  • Country: gb
  • 0999
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #7 on: August 21, 2011, 09:31:34 pm »
All right, going from the thread you want to output a single pulse when the EMP from the camera flash is detected.

Did you try any of the designs posted in the other thread?

The ones I posted will use a fair amount of power because the one of the gates is biased as a linear amplifier.

Here's another idea which uses less power. It uses a Schmitt trigger to fire a monostable. You can use the lower power HC series if you wish.
 

Offline MechatrommerTopic starter

  • Super Contributor
  • ***
  • Posts: 11631
  • Country: my
  • reassessing directives...
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #8 on: August 22, 2011, 11:31:09 am »
Did you try any of the designs posted in the other thread?
Here's another idea which uses less power. It uses a Schmitt trigger to fire a monostable. You can use the lower power HC series if you wish.
no it didnt work, i used 74HC02N quad nor gates (in my stock). i got nothing on the output. btw, i think your circuit is too complicated for me :P i dont have the same expertise as yours. i havent fine tune it though, thanx for the suggestion.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19518
  • Country: gb
  • 0999
Re: Decision to Choose Comparator vs MCU for a Simple Thing.
« Reply #9 on: August 22, 2011, 03:51:54 pm »
The HC series isn't suitable for the circuit I posted in the other thread because it'll draw too much current. Did it get hot?

It's not complicated at all. It's two very simple and common circuits connected together: a Schmitt trigger and monostable.

I've Googled for some monostable tutorials and they all use a slightly different circuit to the one I used so I modified my circuit and added some component numbers.

Tutorials on monostables:
http://www.bancrofts.essex.sch.uk/pdfs/electronics_monostable.pdf
http://www.electronics-tutorials.ws/waveforms/monostable.html

For the Shcmitt trigger, see firgure 18 on page 8 of the datasheet linked below. If you want a more detailed explanation ask but I'm sure you can figure it out.
http://www.intersil.com/data/fn/fn3321.pdf

There shouldn't be any need for any tweaking. If you know the amplitude of the input pulses and the desired length of the output pulse, all you need to do is plug the numbers in to the formula.

You don't have to use CMOS gates for this. It's possible to make all the building blocks to build this circuit with BJTs, op-amps or comparators but I'd recommend CMOS because it uses less power.
« Last Edit: August 22, 2011, 03:54:34 pm by Hero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf