Skip to main content
Arduino

Return to Answer

replaced http://electronics.stackexchange.com/ with https://electronics.stackexchange.com/
Source Link

As @Gerben says, voltage dividers are a good place to start. To elaborate on the topic, you can use a combination of voltage dividers, zener diodes and clamping diodes.

This EE.SE post EE.SE post has some good info about this, related to ADC, but still the same.

First off, a voltage divider circuit is easily found on the internet,

  1. Google
  2. Wikipedia

This circuit from Hyperphysics shows the basics: Hyperphysics


To add more protection to this so as not to go over the max I/O voltage of the MCU, you can add a zener diode on the Vout. That would give you something like this(Olins Olins):

credit to Olin

This will give you the desired range to give legitimate High and Low on an I/O.


If you wanted to forgo the voltage divider and zener you can use clamping diodes to the microcontroller supply voltage Vcc. This will give a range that will not damage the I/O.

schematic

simulate this circuit – Schematic created using CircuitLab

The 10k resistor is there to limit the current through the diodes, which are Schottky diodes.


Another method, which I have used before and is reliable, is to use a diode and two resistors like below:

enter image description here

The logic is that, when the input IN is > Vcc(5V) the signal on the I/O _IN will be the voltage of the pull_up resistor R2, if it is low or floating the signal will be low. R1 also gives a known logic state if the input floats.

Edit: Changed the image to proper logic flow.

As @Gerben says, voltage dividers are a good place to start. To elaborate on the topic, you can use a combination of voltage dividers, zener diodes and clamping diodes.

This EE.SE post has some good info about this, related to ADC, but still the same.

First off, a voltage divider circuit is easily found on the internet,

  1. Google
  2. Wikipedia

This circuit from Hyperphysics shows the basics: Hyperphysics


To add more protection to this so as not to go over the max I/O voltage of the MCU, you can add a zener diode on the Vout. That would give you something like this(Olins):

credit to Olin

This will give you the desired range to give legitimate High and Low on an I/O.


If you wanted to forgo the voltage divider and zener you can use clamping diodes to the microcontroller supply voltage Vcc. This will give a range that will not damage the I/O.

schematic

simulate this circuit – Schematic created using CircuitLab

The 10k resistor is there to limit the current through the diodes, which are Schottky diodes.


Another method, which I have used before and is reliable, is to use a diode and two resistors like below:

enter image description here

The logic is that, when the input IN is > Vcc(5V) the signal on the I/O _IN will be the voltage of the pull_up resistor R2, if it is low or floating the signal will be low. R1 also gives a known logic state if the input floats.

Edit: Changed the image to proper logic flow.

As @Gerben says, voltage dividers are a good place to start. To elaborate on the topic, you can use a combination of voltage dividers, zener diodes and clamping diodes.

This EE.SE post has some good info about this, related to ADC, but still the same.

First off, a voltage divider circuit is easily found on the internet,

  1. Google
  2. Wikipedia

This circuit from Hyperphysics shows the basics: Hyperphysics


To add more protection to this so as not to go over the max I/O voltage of the MCU, you can add a zener diode on the Vout. That would give you something like this(Olins):

credit to Olin

This will give you the desired range to give legitimate High and Low on an I/O.


If you wanted to forgo the voltage divider and zener you can use clamping diodes to the microcontroller supply voltage Vcc. This will give a range that will not damage the I/O.

schematic

simulate this circuit – Schematic created using CircuitLab

The 10k resistor is there to limit the current through the diodes, which are Schottky diodes.


Another method, which I have used before and is reliable, is to use a diode and two resistors like below:

enter image description here

The logic is that, when the input IN is > Vcc(5V) the signal on the I/O _IN will be the voltage of the pull_up resistor R2, if it is low or floating the signal will be low. R1 also gives a known logic state if the input floats.

Edit: Changed the image to proper logic flow.

Edited my image to prevent confusion
Source Link
RSM
  • 1.5k
  • 1
  • 11
  • 26

As @Gerben says, voltage dividers are a good place to start. To elaborate on the topic, you can use a combination of voltage dividers, zener diodes and clamping diodes.

This EE.SE post has some good info about this, related to ADC, but still the same.

First off, a voltage divider circuit is easily found on the internet,

  1. Google
  2. Wikipedia

This circuit from Hyperphysics shows the basics: Hyperphysics


To add more protection to this so as not to go over the max I/O voltage of the MCU, you can add a zener diode on the Vout. That would give you something like this(Olins):

credit to Olin

This will give you the desired range to give legitimate High and Low on an I/O.


If you wanted to forgo the voltage divider and zener you can use clamping diodes to the microcontroller supply voltage Vcc. This will give a range that will not damage the I/O.

schematic

simulate this circuit – Schematic created using CircuitLab

The 10k resistor is there to limit the current through the diodes, which are Schottky diodes.


Another method, which I have used before and is reliable, is to use a diode and two resistors like below:

enter image description hereenter image description here

The logic is that, when the input IN is > Vcc(5V) the signal on the I/O _IN will be the voltage of the pull_up resistor R9R2, if it is low or floating the signal will be low. R1 also gives a known logic state if the input floats.

Edit: Changed the image to proper logic flow.

As @Gerben says, voltage dividers are a good place to start. To elaborate on the topic, you can use a combination of voltage dividers, zener diodes and clamping diodes.

This EE.SE post has some good info about this, related to ADC, but still the same.

First off, a voltage divider circuit is easily found on the internet,

  1. Google
  2. Wikipedia

This circuit from Hyperphysics shows the basics: Hyperphysics


To add more protection to this so as not to go over the max I/O voltage of the MCU, you can add a zener diode on the Vout. That would give you something like this(Olins):

credit to Olin

This will give you the desired range to give legitimate High and Low on an I/O.


If you wanted to forgo the voltage divider and zener you can use clamping diodes to the microcontroller supply voltage Vcc. This will give a range that will not damage the I/O.

schematic

simulate this circuit – Schematic created using CircuitLab

The 10k resistor is there to limit the current through the diodes, which are Schottky diodes.


Another method, which I have used before and is reliable, is to use a diode and two resistors like below:

enter image description here

The logic is that, when the input IN is > Vcc(5V) the signal on the I/O _IN will be the voltage of the pull_up resistor R9, if it is low or floating the signal will be low.

As @Gerben says, voltage dividers are a good place to start. To elaborate on the topic, you can use a combination of voltage dividers, zener diodes and clamping diodes.

This EE.SE post has some good info about this, related to ADC, but still the same.

First off, a voltage divider circuit is easily found on the internet,

  1. Google
  2. Wikipedia

This circuit from Hyperphysics shows the basics: Hyperphysics


To add more protection to this so as not to go over the max I/O voltage of the MCU, you can add a zener diode on the Vout. That would give you something like this(Olins):

credit to Olin

This will give you the desired range to give legitimate High and Low on an I/O.


If you wanted to forgo the voltage divider and zener you can use clamping diodes to the microcontroller supply voltage Vcc. This will give a range that will not damage the I/O.

schematic

simulate this circuit – Schematic created using CircuitLab

The 10k resistor is there to limit the current through the diodes, which are Schottky diodes.


Another method, which I have used before and is reliable, is to use a diode and two resistors like below:

enter image description here

The logic is that, when the input IN is > Vcc(5V) the signal on the I/O _IN will be the voltage of the pull_up resistor R2, if it is low or floating the signal will be low. R1 also gives a known logic state if the input floats.

Edit: Changed the image to proper logic flow.

Source Link
RSM
  • 1.5k
  • 1
  • 11
  • 26

As @Gerben says, voltage dividers are a good place to start. To elaborate on the topic, you can use a combination of voltage dividers, zener diodes and clamping diodes.

This EE.SE post has some good info about this, related to ADC, but still the same.

First off, a voltage divider circuit is easily found on the internet,

  1. Google
  2. Wikipedia

This circuit from Hyperphysics shows the basics: Hyperphysics


To add more protection to this so as not to go over the max I/O voltage of the MCU, you can add a zener diode on the Vout. That would give you something like this(Olins):

credit to Olin

This will give you the desired range to give legitimate High and Low on an I/O.


If you wanted to forgo the voltage divider and zener you can use clamping diodes to the microcontroller supply voltage Vcc. This will give a range that will not damage the I/O.

schematic

simulate this circuit – Schematic created using CircuitLab

The 10k resistor is there to limit the current through the diodes, which are Schottky diodes.


Another method, which I have used before and is reliable, is to use a diode and two resistors like below:

enter image description here

The logic is that, when the input IN is > Vcc(5V) the signal on the I/O _IN will be the voltage of the pull_up resistor R9, if it is low or floating the signal will be low.

AltStyle によって変換されたページ (->オリジナル) /