## How to convert resistance to voltage

Converting resistance to voltage in electronics sometimes are so important. This happens because many electronics device such as microcontroller only can read voltage as analog input signal. Analog signal then will be converted to digital using ADC. But before we talk about ADC or microcontoller, how if our sensor has resistance output instead of voltage?

#### Voltage Divider as resistance to voltage converter

The only thing we can do to make our sensor readable by microcontroller is convert resistance to voltage. Converting a resistance to voltage is far more easier than converting to other quantity. So, how we do that?

The answer is very simple. Use voltage divider !

Voltage divider has capability to divide the voltage by comparison of two resistance. You can read more details about voltage divider here.

#### Application Example

I use an LDR for a light sensor. LDR has linear resistance to the light that exposed to it surface. When light getting brighter, the resistance will decreased. Otherwise when light brightness dercreases the resistance will increases. Here’s my schematic example:

The output voltage will be :

In this example, when light density is changed, the LDR resistance will changed too and of course Voltage output will changed accordingly.

Since the voltage will change in every change of light density, then you can connect this voltage output to an microcontroller ADC.

#### Little Tips

Pick the right R2 has a little trick. You have to choose the closest one to LDR reistance range to make the voltage output difference better. For example, if your LDR resistance will vary between 800 ohm to 1k ohm then used 1k ohm resistor as R2 will be ok. But if you has LDR with resistance output vary from 8k-10k don’t use 1k as R2, using 10k as R2 will better.

## How to make Variable Voltage Regulator using LM317

Voltage Regulator is very important thing for power supply. Voltage Regulator maintain the output voltage constant as we want. Many ICs can maintain voltage output. For example LM7805 can maintain voltage at 5V. LM7809 can maintain voltage at 9V. LM7812 mantain voltage at 12V and so on. Now we will give you tutorial how to make variable voltage regulator.

The question is, can we regulate voltage at every volt we want? Yes, the answer is LM317. The datasheet says that :

The LM317 device is an adjustable three-terminal positive-voltage regulator capable of supplying more than 1.5 A over an output-voltage range of 1.25 V to
37 V. It requires only two external resistors to set the output voltage. The device features a typical line regulation of 0.01% and typical load regulation of
0.1%. It includes current limiting, thermal overload protection, and safe operating area protection. Overload protection remains functional even if the

#### How to use LM317 as Variable Voltage Regulator?

Use LM317 as variable voltage regulator is simple, you can use schematic below :

LM317 Vout equation will be : Vout = 1.25V*(1+R2/R1)

So, the key lay on R2. R2 must be variable resistor, so we can change the resistance easily. Changing the resistance will change the output.

If you still thinking that schematic above less simple, you can really make a really simple circuit using only LM317, R1 and R2. But maybe you can get a little noise from this circuit, so you can add capacitor at Vin and Vout.

Happy experimenting!

## Understanding Voltage Divider

Just like the term, voltage divider means dividing the voltage into smaller value. Sometimes this is very useful if we had only measurement instrument with limited maximum value. Such as pocket oscilloscope.

#### Understanding Voltage Divider

Dividing voltage is very simple job but very powerful. We just need two resistor to do it. Here’s the example how we do it.

Consider we have 10V voltage, using two resistor will result 5v at the output. This is how we calculate it :

Vout = Vin * R1/(R1+R2)

So if we want to divide the voltage by 3. You can simply change the R2 to 2k. So the output will be :

Vout = 10 * 1k/(1k+2k) = 3,333 V

#### Voltage Divider Application Example

In some cases, voltage divider is very useful for signal conditioning. For example, you have to sense a voltage from a power supply using an arduino or other microcontroller. The power supply can generate voltage from 0V-50V. Unfortunately, your arduino can sense voltage only from 0V-5V. That’s why voltage divider come in handy. You can just divide voltage from power supply by 10. So the output will only produce voltage between 0V to 5V and you can read using arduino ADC easily.

Beside divide the voltage, you can use voltage divider to convert resistance based sensor to voltage. For example a light dependent resistor (LDR).

Take a look at picture above. We already know that LDR will vary the resistance by how much light that exposed to it. This will make easier to read voltage output from different light brightness.

#### Voltage Divider is not for Power Supply

If you are new to electronics and think to use voltage divider for power supply then you are wrong. Why not for power supply? Voltage divider works with big resistors, so it will produce very small current. Small current cannot used for power supply. You can user linear regulator or switching power supply instead.