# Voltage divider

hi clinton ,
as per our conversation, does the dfr0051 voltage divider capable of working at 3.3v ? if not do u have a 3.3v divider or do i have to use the logic level?

The answer is it will work, but only to a maximum input voltage of 16.5V. The DFR0051 takes and input voltage and scales if by 0.2 with a voltage divider we have a tutorial on how to use resistors for this.

1 Like

goodmorning clinton , thank you for the last reponse.
i decided to use the core electronics logic leveler.
ive connected it all up , would you have a sample code ?
ive use my arduino code but its not actuate.
thank you kindly

sorry clinton forgot to mention , iam moving from arduino uno which is 5v to particle electron with is 3v.
thank you

1 Like

hey stephen , how are you? as per our conversation my code is

voltageval = sensorValueVal *(25/1023.0);

this work well on arduino .
but with the logic leveler on electron its not accurate?

When you are reading a voltage with the Electron is the voltage wrong by a set amount or does the error change a lot. There is a possibility that the electron needs a different set of parameters in this line `voltageval = sensorValueVal *(25/1023.0);`

Hi Clinton,

I hope you are well. I have drawn a diagram (please find attached). I just need a code example of how to get the voltage on the electron.

I hope to hear from you soon.

Many thanks,

If you are going to be measuring the voltage on a 12V battery, I would suggest removing the Logic level shifter and connecting it in the same way you did to the arduino just change the code to be `voltageval = sensorValueVal *(16.5/1023.0);` Just be careful that the measured voltage does not go above 16.5 Volts.