Author Topic: How to detect -5 volts?  (Read 1114 times)

0 Members and 1 Guest are viewing this topic.

Offline rea5245Topic starter

  • Frequent Contributor
  • **
  • Posts: 581
  • Country: us
How to detect -5 volts?
« on: January 18, 2019, 03:52:37 pm »
Hi,

I have a connector that can plug into two slightly different devices. I want to automatically detect which device it's plugged into. With one of the devices, there is -5V (yes, that's minus 5 volts) coming in on a pin. With the other device, that pin is not connected to anything. I can't connect the pin directly to a microcontroller, because -5V would damage it. What can I do to get a 0 or 1 signal to the MCU based on whether the -5V is there or not?

Thank you,
   Bob
 

Offline PartialDischarge

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: 00
Re: How to detect -5 volts?
« Reply #1 on: January 18, 2019, 03:57:14 pm »
4.7V zener to the pin, then a pull up 100k resistor to the mcu. If not connected to anything the mcu will see 5V, if -5V is present at the pin, the mcu will see 0
 

Offline rea5245Topic starter

  • Frequent Contributor
  • **
  • Posts: 581
  • Country: us
Re: How to detect -5 volts?
« Reply #2 on: January 18, 2019, 04:00:08 pm »
Will the MCU's built-in weak pull-up suffice, or do I need the 100K resistor?
 

Online schmitt trigger

  • Super Contributor
  • ***
  • Posts: 2222
  • Country: mx
Re: How to detect -5 volts?
« Reply #3 on: January 18, 2019, 04:08:53 pm »
The weak internal pullup may work. Having said this, common resistors are ultra-cheap. And if you are using SMT devices, ultra-small too.

My personal opinion is that for this instance I would use an external pullup. But other posters may think otherwise.
 

Offline PartialDischarge

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: 00
Re: How to detect -5 volts?
« Reply #4 on: January 18, 2019, 04:14:04 pm »
The internal may be enough, but anyway I would also add a series resistor with the zener to limit the current in the mcu, just in case your -5V turn out to be -7 or -10V someday
« Last Edit: January 18, 2019, 04:17:29 pm by MasterTech »
 

Online coppercone2

  • Super Contributor
  • ***
  • Posts: 9444
  • Country: us
  • $
Re: How to detect -5 volts?
« Reply #5 on: January 18, 2019, 04:23:46 pm »
its good form anyway because its a external device and all external IO should be protected if possible by design, it will reduce the ESD some what.
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2254
  • Country: ca
Re: How to detect -5 volts?
« Reply #6 on: January 18, 2019, 05:14:46 pm »
Connect 10k to micro's +5V rail, other end to a microcontroller input pin AND to the device pin via another 10k resistor. When device drives that to -5 V, then the voltage divider makes ~0 V, or logic low to the local micro. Otherwise it floats to +5 V, logic high. A zener (or better, a TVS) to protect the micro's input would be prudent, but its own input protection diodes plus the 10k resistor may be enough.
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: How to detect -5 volts?
« Reply #7 on: January 19, 2019, 05:47:41 am »
Hi rea5245

Another approach:
« Last Edit: January 19, 2019, 05:52:30 am by spec »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf