Decision to Choose Comparator vs MCU for a Simple Thing. - Page 1
Forum section: electronics / projects

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 18, 2011, 11:05:36 pm
content: I'm getting back to mylong 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 pic10f200current comsumption 400uA <175uAprice per unit USD 3.47 0.70http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=497-6992-1-NDhttp://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=PIC10F206T-I/OTCT-NDwith 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?

author: tecman
author_rank: Frequent Contributor
timestamp: August 18, 2011, 11:26:17 pm
content: 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

author: vk6zgo
author_rank: Super Contributor
timestamp: August 19, 2011, 01:31:17 am
content: 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

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 19, 2011, 05:05:13 am
content: Quote from: vk6zgo on August 19, 2011, 01:31:17 amthe 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... I5X?! 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.

author: DaveW
author_rank: Frequent Contributor
timestamp: August 21, 2011, 10:30:35 am
content: 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.pdf2uA 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/133214132 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

author: tecman
author_rank: Frequent Contributor
timestamp: August 21, 2011, 12:59:26 pm
content: 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

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 21, 2011, 08:43:05 pm
content: 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.

author: Zero999
author_rank: Super Contributor
timestamp: August 21, 2011, 09:31:34 pm
content: 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.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 22, 2011, 11:31:09 am
content: Quote from: Hero999 on August 21, 2011, 09:31:34 pmno 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 mei dont have the same expertise as yours. i havent fine tune it though, thanx for the suggestion.

author: Zero999
author_rank: Super Contributor
timestamp: August 22, 2011, 03:51:54 pm
content: 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.pdfhttp://www.electronics-tutorials.ws/waveforms/monostable.htmlFor 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.pdfThere 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.