Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

converting TTL or CMOS to TTL

Status
Not open for further replies.

danjel

Member
I have a uC project where different digital pulse signals will be patched into specific inputs (it is for a modular synth).

The inputs may be 0-5V but they also could be -12 to 12V. What would I do to make sure no matter what the voltage input is, it appears as a 0 or 5V pulse at the uC inputs?

My first instincts:
1. Use a resistor and 5V zener diode at the input

2. Use a a comparator with diode on the output so that it boosts any signal to 0/12V and then use a voltage divider to bring down to 5V
 
What MCU are you using? Many of them have internal clamp diodes. If you use a resistor to limit the current during the worst possible voltage scenario to within the clamp diode's limits then all you need is the limit resistor. There is an AVR appnote that does just this with a 1meg resistor to directly connect an I/O line to mains power for zero cross detection. Works great. I believe many PICs and other MCU's have these internal clamp diodes on many of the I/O lines. The one's on the AVR are rated at 1ma of current.
 
Last edited:
I am using an Atmega328.

I figured I could use a single supply op amp (lm741) powered at 5V and as a comparator, that way any input results in a 5V output max and no negative voltage.

If this is going to a digital input on the atmega do I need anything else in that path? pull down resistor? current limiting resistor? diode?
 
Verify from your Atmega datasheet the clamping diodes exist on the exact pin that you're using (a couple pins don't have clamping diodes) then all you need is a current limit resistor, no other components passive or active are required. Typically the only pins that don't have clamping diodes on them are VCC/GND and reset. There may be other exceptions on specific AVR models which is why you should simply refer to the datasheet of your model, it's all in black and white.
 
Last edited:
I am using an Atmega328.

I figured I could use a single supply op amp (lm741) powered at 5V and as a comparator, that way any input results in a 5V output max and no negative voltage.

If this is going to a digital input on the atmega do I need anything else in that path? pull down resistor? current limiting resistor? diode?

The 741 should not be operated with input voltages that are higher than the supplied voltage. Most opamps should not be operated in this manner. Use a zener on the output instead, with a resistor to limit the current. Or use your resistor divider idea.
 
I figured I could use a single supply op amp (lm741) powered at 5V and as a comparator
The LM741 is only characterized in the **broken link removed** at 10V or greater between rails (+/-5V), and can only reliably respond to inputs greater than 3V from either rail. There are no valid inputs with a +5V only supply.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top