Voltage Sensor Fluctuations

Hello!

I am creating an LED circuit that can be brightened/dimmed using a simple DC dimmer module. The LEDs being used have resistors pre-installed to take 12v max, so no risk of thermal runaway when wiring in parallel. In addition, a voltage sensor (R1=30kohm, R2=7.5kohm) is wired into an Arduino Uno and OLED screen, which is meant to be displaying the voltage at any given moment.

Below is the wiring diagram and code for the project:


voltage_sensor_test.ino (815 Bytes)

When the circuit is at zero or full voltage, the sensor reads 0 and 10.1 volts as expected. However, when the circuit is at a voltage in between those two values, the values show extreme fluctuation and bouncing. See video: https://youtu.be/t59dP_0-oA8

Additionally, here are links to some of the hardware used:
Voltage Sensor: HiLetgo 5pcs Voltage Detection Module DC 0~25V Voltage Sensor for Arduino: Amazon.com: Industrial & Scientific
DC Dimmer: Amazon.com: Gebildet 3pcs Mini DC Motor PWM Speed Controller, DC 5V-35V 5A Speed Adjustable Switch Module, 6V 12V 24V Variable Voltage Regulator Dimmer Governor Switching Build with LED Indicator : Industrial & Scientific

Any idea what might be happening here, how I could fix it, or why this setup concept may just not work at all? And, if so, what could be another way to measure the intensity of the LEDs?

Thank y'all for your help!

PWM is not constant DC. :wink:

Refering to sales sites is not accurate enough. Datasheets are.
Else You can sit and hope for helpers using just those devices to respond.

Gotcha! That makes a lot more sense why it was jumping in the middle and constant on the ends.

For my application, I'm not really looking for a exact voltage value, more just a percentage of how bright the LED is at that current moment over how bright it can get at maximum. Measuring voltage seemed like the best way to achieve that, but I can see now why that wouldn't work on a PWM-based dimmer circuit.

Thanks for pointing me in the right direction! Or, for now, pulling me off the wrong one :sweat_smile: