Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
LinkBack Thread Tools Display Modes
Old 5th September 2006, 10:19 PM   (permalink)
Default Schmitt Trigger for 'counting' the time

Hi there,

I want to count the time with a µController (counting the 50 Hz power line freq). For this, I need to turn the sine-wave into a square signal with a schmitt trigger.

Now I have no idea what values to use for the hysteresis resistors. I'd have guessed the pre-resistor to be, say 1k, and the feedback-loop resistor 10 Ohms??? Would that work? And btw, can I use the LM 358 (using only one channel), it's the cheapest Op-Amp I've found. I want to use the 6 Volt out from a simple transformer. Will I need a galvanic isolation between the input signal for the Op-Amp and it's power supply??

Sorry for being so unexperienced with Schmitt Triggers...

Many thanx
Odysseas is offline  
Old 5th September 2006, 10:57 PM   (permalink)
Default

why complicate things, use an npn transistor and a couple of resistors before the capacitive filter in your power supply, and a pull up resistor to your uC supply rail.
tunedwolf is offline  
Old 6th September 2006, 02:24 AM   (permalink)
Default

Why complicate things with transistors, caps and some resistors? here is a microchip app note that uses just a 5M resistor directly into a PIC pin. http://ww1.microchip.com/downloads/e...tes/00521c.pdf
it relies on the internal clamping diodes and low current. If you are using a uC without internal clamping diodes, you can add them externally.

Note, none of the above solutions provide isolation. I'd use an AC opto isolator (+ 2 resistors) if that's important to you (and it should be).
philba is offline  
Old 6th September 2006, 01:52 PM   (permalink)
Default

If you are using a PIC microcontroller, usually at least one port incorporates a schmitt trigger. (eg. RA,4 on a 16f84). (Check the data sheet for ports marked ST)
You need to connect via about 22-33K series resistor to the output of your low voltage (eg. 9v ac supply (before the bridge rectifier) and use a 5v zener and 0.1uf capacitor across the port pin to protect the controller from any voltage above +5v and suppress supply noise.
picasm is offline  
Old 6th September 2006, 05:49 PM   (permalink)
Default

Quote:
Originally Posted by philba
Note, none of the above solutions provide isolation. I'd use an AC opto isolator (+ 2 resistors) if that's important to you (and it should be).
I wouldn't worry, 32uA is too low to shock you, even if you're running it from a transformer I bet the coupling capacitance will allow this small current to flow.
__________________
I also post at the following sites:
http://www.stop-microsoft.org http://www.heated-debates.com
Screen name: Aloone_Jonez
And http://www.silicontronics.com, same screen name as here.
Hero999 is offline  
Old 6th September 2006, 06:01 PM   (permalink)
Default

Quote:
Originally Posted by Hero999
I wouldn't worry, 32uA is too low to shock you, even if you're running it from a transformer I bet the coupling capacitance will allow this small current to flow.
yes but you still are bringing 120/240 VAC onto a circuit board. I'm not at all worried about the circuit when it works properly. A surge can do a number on a cap/resistor. At least with an opto, you've got several KV of isolation at a minimum. a transformer provides better isolation. probabilities of failure of an opto or transformer are pretty low. UL seems to agree...
philba is offline  
Old 6th September 2006, 06:19 PM   (permalink)
Default

I'll be using an Atmega16 - there is some mention of a Schmitt Trigger in the datasheet, but it doesn't say which pin to use. Can anyone help me with this??
Odysseas is offline  
Old 6th September 2006, 07:48 PM   (permalink)
Default

look at pg 50 and 51 of the atmega16(L) datasheet (doc2466). you will see 2 schematic diagrams that answer your questions.
philba is offline  
Old 6th September 2006, 07:48 PM   (permalink)
Default

Quote:
Originally Posted by tunedwolf
why complicate things, use an npn transistor and a couple of resistors before the capacitive filter in your power supply, and a pull up resistor to your uC supply rail.
How does this work? Please explain.
Odysseas is offline  
Old 6th September 2006, 08:47 PM   (permalink)
Default

Now here's another idea, but I'm not sure if that would work. I think this could probably create a short circuit along Ground, frying the bridge rectifier, but I'm not sure of that. Please verify this schematic or declare it as rubbish
Attached Images
File Type: gif schem.gif (31.3 KB, 12 views)
Odysseas is offline  
Old 6th September 2006, 09:20 PM   (permalink)
Default

Here's what you are proposing. see anything odd about it?
Attached Images
File Type: gif bridgeshort.gif (2.6 KB, 6 views)
philba is offline  
Old 6th September 2006, 09:49 PM   (permalink)
Default

Would placing a galvanic isolation (1:1 transformer) before the resistor and the zener-diode help? It should work then, shouldn't it?
Odysseas is offline  
Old 6th September 2006, 09:55 PM   (permalink)
Default

The grounds at either side of the rectifier shouldn't be connected, it will short circuit two of the rectifiers!
__________________
I also post at the following sites:
http://www.stop-microsoft.org http://www.heated-debates.com
Screen name: Aloone_Jonez
And http://www.silicontronics.com, same screen name as here.
Hero999 is offline  
Old 6th September 2006, 10:09 PM   (permalink)
Default

Yes, I know (at least, I do now). But that's what I mean: If I put a galvanic isolation between those two - the problem should be solved, rite?
Odysseas is offline  
Old 6th September 2006, 11:39 PM   (permalink)
Default

since you want to use a bridge (and thus no common ground), use an opto isolator and drive the led from the AC side. The H11AA814 http://www.fairchildsemi.com/ds/H1/H11AA814A.pdf is exactly what you would need - $.49 from mouser. Use a dropping resistor to limit the current to the dual LEDs. the photo transistor collector should be pulled to +V via a 10K resistor and the emitter connected to ground. Take the output from the collector as input to the ATMega. You will see pulses at 120 hz.

the top test circuit on page 6 of the datasheet shows the basic hookup. edit: to be clear, connect the LEDs leads to the 2 legs of the transformer output, though the dropping resistor. resistor value is calculated just like you would for a regular LED

Last edited by philba; 7th September 2006 at 12:33 AM.
philba is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 11:08 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

eXTReMe Tracker