# Voltage divider

**URL:** <https://forum.core-electronics.com.au/t/voltage-divider/3511>\
**Category:** Uncategorized\
**Created:** [20 September 2018 00:50 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511 "2018-09-20T00:50:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chehadie58152](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@chehadie58152](https://forum.core-electronics.com.au/u/chehadie58152)\
**Post date:** [20 September 2018 00:50 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/1 "2018-09-20T00:50:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Clinton](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/clinton/32/1515_2.png) [@Clinton](https://forum.core-electronics.com.au/u/Clinton)\
**Post date:** [20 September 2018 01:02 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/2 "2018-09-20T01:02:45Z")

</div>

Hey Chehadie

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.](https://core-electronics.com.au/tutorials/how-to-choose-the-right-resistor.html)

---

<div class="post-metadata">

**Author:** ![chehadie58152](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@chehadie58152](https://forum.core-electronics.com.au/u/chehadie58152)\
**Post date:** [2 October 2018 22:18 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/3 "2018-10-02T22:18:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chehadie58152](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@chehadie58152](https://forum.core-electronics.com.au/u/chehadie58152)\
**Post date:** [2 October 2018 22:25 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/4 "2018-10-02T22:25:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chehadie58152](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@chehadie58152](https://forum.core-electronics.com.au/u/chehadie58152)\
**Post date:** [3 October 2018 04:46 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/5 "2018-10-03T04:46:10Z")

</div>

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

int sensorvalueval = analogRead (A1)  
voltageval = sensorValueVal \*(25/1023.0);

this work well on arduino .  
but with the logic leveler on electron its not accurate?  
thank you for your time.

---

<div class="post-metadata">

**Author:** ![Clinton](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/clinton/32/1515_2.png) [@Clinton](https://forum.core-electronics.com.au/u/Clinton)\
**Post date:** [4 October 2018 23:31 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/6 "2018-10-04T23:31:06Z")

</div>

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);`

---

<div class="post-metadata">

**Author:** ![chehadie58152](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@chehadie58152](https://forum.core-electronics.com.au/u/chehadie58152)\
**Post date:** [5 October 2018 01:15 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/7 "2018-10-05T01:15:40Z")

</div>

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,

Chehadie

 ![](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/5/5385d2d6dab5f15e7648ca5cc8c9c10fd2a754a9.jpeg)

---

<div class="post-metadata">

**Author:** ![Clinton](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/clinton/32/1515_2.png) [@Clinton](https://forum.core-electronics.com.au/u/Clinton)\
**Post date:** [5 October 2018 01:28 UTC](https://forum.core-electronics.com.au/t/voltage-divider/3511/8 "2018-10-05T01:28:28Z")

</div>

Hi Chehadie,

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.
