Maker Pro
Maker Pro

Attiny85 and unrecognized HIGH levels

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I will of course add a series resistor to teh zener. :) Thank you...

Here is the circuit I recommend:

upload_2017-5-30_16-53-24.png

R1 limits the current through the diodes

R2 limits the current through the microcontroller's input protection (which is often similar to the two diodes shown here)

If you use Schottky diodes for D1 and D2, R2 may not be required.

Be careful that the maximum current through R1 (and all the input protection circuits) does not exceed the current drawn from the 3.3V rail. Excess current may cause the power rail to rise in voltage -- which is a bad thing.

The safe zener option is to replace D2 with a low value zener and remove D1. Be careful of soft knees of low voltage zeners. Their soft knee may result in the input voltage not being able to reach the nominal zener voltage without significant current flowing.
 

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
What are your comments about this solution?

(I am looking for the most minimalist way) :)

6.jpg

Input LOW: Worst case scenario with 20k internal pullup resistor: Current flow less than 0.2 mA. Voltage at the input of Attiny85 less than 0.2V.

Input HIGH: Current flow less than 0.08 mA and voltage at the input of the Attiny85 almost 5 V.

Am I missing something?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Input HIGH: Current flow less than 0.08 mA and voltage at the input of the Attiny85 almost 5 V.
It is not.
Assuming the internal Pull-up is 20 kΩ, the voltage at the attiny's input for a 3.3 V high level at the input of the circuit will be 3,38 V (the pull-up and the series resistor form a resistive divider between 5 V and 3.3 V).
This is good enough to be detected as high by the attiny.

But: Why would you try to give a 5 V input toe the attiny which is presumably powered by 3.3 V from your linear regulator? This is way too high an input voltage under that condition.
My impression was, and I do thik Steve's too, that your input signal is higher than the 3.3 V allowed to the attiny's input. Both Steve's and my circuit would work to limit an input voltage higher than 3.3 V to a safe level.
 

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
You know... There is a disease called "get thereitis" in aviation. You are fixed to something and after a while you forget why you are doing this! :)
You are right. Why am I trying to limit the input signal when the signal level is already 3.3V... :)
I will simply replace the LM2950 with LP2950 which has an output of 3.3V. Thank you.
 

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
The most interesting question was: "why are there no problems with other projects". In search of an answer to this question, I have replaced the Attiny85 with another one. I uploaded the code and put the IC into the socket. Yes it works!!!
I have done many tests and there was no problem.
I am really sorry for taking your time.
It was a chip issue. I have thrown away the faulty ICs and replaced them with new ones. Now everything works fine.
But...
During the research for this problem I found out that one RC manufacturer (Futaba) uses 2.7V output signal. This will definitely not work and will need the signal amplifier. This inspired a new idea. I have modified the code to check the signal polarity at boot-up. Now I can feed the controller modules with either positive or negative pulses. :)
Thank you all so much...
 

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
Why not? An Attiny operated from 3.3 V has a logic threshold of ~1.65 V (1/2*Vcc). 2.7V can easily be recognized as logic high.

Yes... Really, why not?! I think this is called "fixation" in behavioural sciences. :)

It seems that it is time for me to change over to 3.3V logic. :) Thank you...
 

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
In the meantime I could fix some issues and now I have a working circuit. The Attiny85 is being supplied with 3.3V and the signal level of the receiver output can be recognized as HIGH without any problems.
But I want the circuit be compatible with higher signal levels (like the 4.5V signal output of a servo tester).
Simplicity of the design is very important in such amateur projects.
What about this circuit to protect the input from overvoltage and work with signal levels between 2 - 5 V.

6.jpg

Is there a possibility of not recognizing LOW state?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
This should work.The drawback is that the low level is raised by the voltage drop across the diode to at least 0.6 V (ideal 0 V at the input) or higher. This makes detection of a low levelstill possible but lowers the noise margin.
The circuit in my post #17 has a voltage drop of Vcesat which can be as low as 0.1 V only.
Or simply use a resistive divider to scale down the input voltage range from 5 V to 3.3 V.
 

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
A resistive divider would prevent the recognition of 2.7V HIGH signal. My aim is to build a circuit which can accept inputs between 2.7 - 5 V.
Your circuit suggestion is the most elegant way but uses 4 components. I want to simplify things.
The electrical characteristics sheet of Attiny85 states that LOW is between -0.5V to 0.3Vcc. I will try it...
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Use a schottky diode then instead of teh 4149. A schottky diode has only ~0.3 V voltage drop.
 
Top