Experiment: Using a Voltage Divider to Interface High Voltage with Microcontrollers

This experiment demonstrates how a voltage divider can safely reduce a higher input voltage to a level that a microcontroller can handle.

Objective

To understand how a voltage divider can be used to scale down a high voltage signal, making it safe to interface with the input pins of a microcontroller.

Materials

Circuit Diagram

Connect the circuit as shown below, with a voltage divider reducing the high voltage to a level suitable for the microcontroller input.

Voltage divider circuit for interfacing high voltage with microcontroller

Theory

A microcontroller typically operates at 3.3V or 5V logic levels, while some sensors or power supplies operate at higher voltages. To measure or interface with these higher voltages, a voltage divider can be used to scale down the voltage to a safe level. The output voltage V_out can be calculated as:

V_out = V_in * (R2 / (R1 + R2))

where V_in is the high input voltage, and R1 and R2 are the resistors in the divider.

Procedure

  1. Select values for R1 and R2 to achieve the desired output voltage V_out. For example, with V_in = 12V and V_out = 5V, use 10kΩ for R1 and 4.7kΩ for R2.
  2. Connect R1 between the high voltage source V_in and the junction point (to be read by the microcontroller).
  3. Connect R2 between the junction point and ground.
  4. Connect the junction point (output of the divider) to an analog input pin on the microcontroller.
  5. Power on the circuit and measure the voltage at the junction point to ensure it matches the calculated V_out.
  6. In the microcontroller’s software, read the analog input pin to confirm it correctly reads the scaled-down voltage.

Observations

Measure and record V_out and verify that it matches the expected value from the voltage divider formula. Confirm that the microcontroller’s analog input pin reads the voltage within safe limits.

Conclusion

This experiment demonstrates how a voltage divider can be used to scale down a high voltage signal to a microcontroller-compatible level. This technique is essential for interfacing with sensors or systems that operate at voltages higher than the microcontroller’s input tolerance.