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 28v signal to logic levels for MCU.

Status
Not open for further replies.
I used an astable 555 in place of the PIC because that circuit sim doesn't have a PIC.

His bridge and divider will work with a pic I don't no about the 555 but the Op said as quoted he couldn't sim a pic micro.
 
I have to go with Nigel on this one.

But a simple 47K resistor (as an example value), direct to the PIC pin from the 28V is all that's required.

Using this method there is still 28V on the pin but there is only a very small amount of current and the PIC will clamp it to 5V. By ohms law the very small current results is almost no voltage drop across the resistor. The resistor is there to protect the PIC should the pin be set as an output. it limits current.

A voltage divider is more useful when we need to scale a voltage prior to reading it with a ADC.
 
I have to go with Nigel on this one.



Using this method there is still 28V on the pin but there is only a very small amount of current and the PIC will clamp it to 5V. By ohms law the very small current results is almost no voltage drop across the resistor. The resistor is there to protect the PIC should the pin be set as an output. it limits current.

This gets more and more confusing :D

There won't be 28V on the pin, there will only be just over 5V, as the protection diodes clamp it.

By definition, the voltage drop across the resistor will be 23V (28-5), that's the reason for it been there.

Depending on the value of the resistor, the current through it will be low, and dissipation low.
 
Nigel Goodwin I'm with you I would use what works best but in light of what has been posted at microchips forum and what i have read
I 'm going to be a little more careful about telling some one to poke 28 volts on a input pin. There a lot of room for mistake's.

With a voltage divider they can't go wrong telling them to use a current limiting resistor they could pick the wrong pin

This one I/O pin has protection diode to VSS only.
 

Attachments

  • like this one.jpg
    like this one.jpg
    23.8 KB · Views: 170
Last edited:
Nigel Goodwin I'm with you I would use what works best but in light of what has been posted at microchips forum and what i have read
I 'm going to be a little more careful about telling some one to poke 28 volts on a input pin. There a lot of room for mistake's.

If someone is going to make mistakes as idiotic as that, then a potential divider isn't going to help :D

To place 28V directly on the pin you would need to not use a resistor at all (just a piece of wire), using the same 'piece of wire' as the top resistor in a potential divider would have EXACTLY the same effect.

With a voltage divider they can't go wrong telling them to use a current limiting resistor they could pick the wrong pin

This one I/O pin has protection diode to VSS only.

RA4 would be a stupid pin to choose, as it's the only open-collector pin there is, and can be used to switch higher voltages than Vdd (hence you can't have a protection diode).

I've also repeatedly mentioned the alternative of using a potential divider in this thread, but the fact remains, it's NOT actually required.
 
Yeah the 3AM text does not look so good in the morning so here I am.

Using this method there is still 28V on the pin but there is only a very small amount of current and the PIC will clamp it to 5V.
Ok just past the green part saying the pin was at 28V I said it was clamped to 5V. I was trying to say that the resistor is not responsible for the voltage drop. It is due to the diode clamp. Did a insert explicative poor job.

By ohms law the very small current results is almost no voltage drop across the resistor.
I will flat out give you this one. I was only thinking of the resistor as a current limiting. I can see that the voltage drop, forced by the Zener, is important to the survival of the Zener.

The voltage divider is looking better to me, just one more resistor and we do not have to rely on the Zener clamp.
 
I like the voltage divider for the preferred suggestion to beginners.

It has safety benefits and an added benefit that it can be built and tested with 2 resistors (to test output voltage levels) WITHOUT needing the PIC connected. So the "scary testing" bit can be done with no risk to the PIC.

And I also like putting caps on input pins, but maybe that's a more commercial approach than a hobby approach?
 
I have posted more the a handful of examples doing zero crossing with just a resistor but after arguing this with a bunch of people.

There just too many thing that can go wrong

I like this thanks MrRB
It has safety benefits and an added benefit that it can be built and tested with 2 resistors (to test output voltage levels) WITHOUT needing the PIC connected. So the "scary testing" bit can be done with no risk to the PIC.
 
I will flat out give you this one. I was only thinking of the resistor as a current limiting. I can see that the voltage drop, forced by the Zener, is important to the survival of the Zener.

The voltage divider is looking better to me, just one more resistor and we do not have to rely on the Zener clamp.

There's still no zener diode anywhere :D
 
hi,
I know this is a well trodden path but this is the way I do it!.:)

The plots show the basic divider, for 28Vdc, 100Vdv and 100Vac.

With higher voltages, accidentally applied, the PIC's internal clamp diodes easily cope with the current.

I would not add a capacitor across the 2k2 unless the Vext source was 'noisy'.

IMO a zener diode is not required across the 2k2.
 

Attachments

  • AAesp06.gif
    AAesp06.gif
    22.7 KB · Views: 181
  • AAesp07.gif
    AAesp07.gif
    23.5 KB · Views: 184
  • AAesp08.gif
    AAesp08.gif
    29.6 KB · Views: 158
Last edited:
Only of use of course if you're feeding it a very slow changing signal, to help debounce.

Not necessarily. In many (most?) applications you know what the minimum period of the input will be, so I add a cap of a value that allows that pulse voltage to just reach from rail to rail. Usually I am testing on the scope so I just hold a few assorted caps from the input pin to ground and look at the waveform.

Then once the cap is installed it has a very high rejection of noise spikes etc, things like digital edge switching spikes etc in the nS to uS range that might cause false triggering. There is no need to have the ability to respond to signals faster than the fastest "real" signal.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top