You are on page 1of 6

Computational Robotics

Engineering

Microcontrollers
Programming U2

Product 2
Voltage divider

Student
Esquivar Genesta Efrain Enrique
Balam Poot Carlos José

January 29th - 2021


Index
Introduction ........................................................................................................ 1
List of materials .................................................................................................. 2
Development ...................................................................................................... 2
Results ................................................................................................................ 3
Conclusion .......................................................................................................... 4
References .......................................................................................................... 4

Table of images

Fig. 1 Voltage divider example .......................................................................... 1


Fig. 2 Arduino IDE interface ............................................................................. 1
Fig. 3 Posed Problem for the circuit................................................................... 2
Fig. 4 Built circuit .............................................................................................. 3
Fig. 5 Monitor Serial Results ............................................................................. 3
Introduction
In this report we will explain what was done in practice 2 of the subject of microcontrollers
programming, which consisted of making a voltage divider between 2 resistors, which we
will obtain its output signal, which will be displayed through the serial monitor of the
Arduino IDE. We will briefly explain what the voltage divider is, and the arduino IDE.

A voltage divider is a simple circuit which turns a large voltage into


a smaller one. Using just two series resistors and an input voltage,
we can create an output voltage that is a fraction of the input. Voltage
dividers are one of the most fundamental circuits in electronics. If
learning Ohm's law was like being introduced to the ABC's, learning
about voltage dividers would be like learning how to spell cat . [1]

Fig. 1 Voltage divider The Arduino Integrated


example
Development
Environment (IDE) is
a cross-platform application
(for Windows, macOS, Linux) that is written in
functions from C and C++. It i used to write and
upload programs to Arduino compatible boards,
but also, with the help of third-party cores, other
vendor development boards. [2]

Fig. 2 Arduino IDE interface

1
List of materials
• Protoboard of 6,4 x 17,2 cm with 830 perforations.
• 1 1k ohms resistor.
• 1 330 ohms resistor.
• Computer.
• ESP32.
• 1 1k Ohms Resistance
• 1 330 Ohms Resistance.
• Du-pont wire .

Development

The objective of the practice is to make the outline proposed by the teacher:

Fig. 3 Posed Problem for the


circuit

Since this, we can understand that we are supposed to obtain the voltage output of the circuit
in such a way that we have to measure it from the 330 ohms resistor. We expect this result
on the serial monitor of the arduino IDE. Let's move on to the explanation of the
programming code.

First of all, it was necessary to develop the code, that practically is considering the reading
of the ADC and applying a formula:
As a first point, the Analog pin has to be declared.

In the void setup, the bauds for the Serial to print the results has to be defined; on the other
hand, in the void loop, a variable for the ADC reading was declared just to memorize the
value. A float variable corresponding to the volts read was necessary, in such a way that the
formula was stablished.

Finally, the function for the volts to be printed was written and then the delay.

2
Code
#define Analog 36
void setup() {
Serial.begin(115200);
}
void loop() {
int ADC=analogRead(Analog);
float volts=(3.3*ADC)/4095;
Serial.print("Value: ");
Serial.println(volts);
delay(1000);
}

The connection on the board was


as following: a 1k ohms resistor
was connected to the 3.3v pin, a
330 ohms resistor was connected
in series; then the circuit was
closed connecting the last pin of
the 330 ohms resistor to the ground
pin. The pin corresponding to ADC
was connected in the union of the
resistors, as it is shown.
Fig. 4 Built circuit

Results

The printed result of the volts according to the formula was shown on the Serial monitor.

Fig. 5 Monitor Serial Results

3
Conclusion
In this practice we basically made a voltage divider, which consists of obtaining the output
voltage result of a pair of variable ohm resistors, in this case resistance 1 was 1k and
resistance 2 was 300. We apply the formula which gave us 0.818. but beware that here we
have not applied the resolution for the ADC output.

The ADC range is the maximum and minimum ADC input (e.g., 0 to + 3.3V). The ADC
resolution is the smallest distinguishable change in input (e.g., 3.3V / 4095, which is about
0.81 mV). The resolution is the change in input that causes the digital output to change by 1.
Once the obtained is multiplied by this quotient, we obtain the 0.69mV

References
[1] Sparkfun, (2018). “Voltage Dividers”. Taken from
https://learn.sparkfun.com/tutorials/voltage-dividers/all
Recovered on January 28, 2021.

[2] Wikipedia, (2018). “Arduino IDE”. Taken from


https://en.wikipedia.org/wiki/Arduino_IDE
Recovered on January 28, 2021.

You might also like