Go Down

Topic: Reading three inverted 12v PWM values (Read 861 times) previous topic - next topic

Hilleskog

Hello friends!
So I recently bought a new PC and the case (Phanteks Eclipse P300) comes preinstalled with RGB LED's and a cable to connect additional LED's or LED strips. On the cable it strictly says to only connect Phantek branded strips, but yeah...

My friends had a leftover piece of a NeoPixel LED strip (NeoPixel) which they kindly gave to me for this purpose. The strip contains individually addressable LED's and has three pins (+5V, DATA, GND) and is supposed to be controlled with an Arduino. However the cable in the case has four pins (+12,R,G,B). The RGB pins are used with inverted PWM to control the LED color. Because of this I cannot plug my strip directly in to the case to sync it with the other LED's and the button cycling between modes/colors. In conclusion, I wish to sync and use the built in 12V four pin RGB LED's and a button together with a 5V three pin LED strip which is then controlled by an Arduino.

I have tried experimenting with my problem and so far I have realized that I cannot hijack the built in LED's and button to control everything using an Arduino. Not being able to do this I decided to try reading the PWM signal using pulseIn() on my Arduino and then forward the color value to the LED strip. The problem here is reading reading 12V PWM signal with the Arduino. I have looked around but I have not found any answers and the closest I could come was this.

According to that post a simple voltage divider should do the work, but I have my doubts since when the PWM pin is +12V the potential at my desired reading point would as well be +12V and that is what I am trying to avoid. If you have any ideas or solutions feel free to share!

Thank you!

DVDdoug

#1
May 03, 2018, 06:45 pm Last Edit: May 03, 2018, 06:47 pm by DVDdoug
A (correct) voltage divider will give you 5V PWM.  If the 12V is not regulated it would be a good idea to add an over-voltage protection diode

If it was me, I'd add a capacitor to the voltage divider output to convert the PWM to filtered-variable DC, then read it with an analog input.  I'd start with a time constant around 1/10th of a second.

...Actually if it was me I'd get the "correct" LED strip so I could skip all of this extra hardware & software.  ;)   

Hilleskog

Haha, I know I am making this unnecessarily hard but that is how I like to learn :P

What do you mean with a "correct" voltage divider? I still wonder how a voltage divider can give me 5V if the 12V PWM is high and there is no current?

Grumpy_Mike

Quote
What do you mean with a "correct" voltage divider?
One with the correct ratio and the correct absolute values.

Quote
I still wonder how a voltage divider can give me 5V if the 12V PWM is high and there is no current?
If you have a voltage and load it with a resistor, you have current. That is ohms law.

A voltage divider is one of the most widely used configuration of resistors.

https://en.wikipedia.org/wiki/Voltage_divider

Or less formally
https://learn.sparkfun.com/tutorials/voltage-dividers

Hilleskog

#4
May 04, 2018, 02:14 pm Last Edit: May 04, 2018, 02:25 pm by Hilleskog
One with the correct ratio and the correct absolute values.
If you have a voltage and load it with a resistor, you have current. That is ohms law.

A voltage divider is one of the most widely used configuration of resistors.

https://en.wikipedia.org/wiki/Voltage_divider

Or less formally
https://learn.sparkfun.com/tutorials/voltage-dividers
But since I have three PWM pins and one +12V where should I connect the other side of the voltage divider? To a common GND shared with the Arduino and the built in controller board (Which I would guess is using my PSU GND?)? I completely understand how a voltage divider works and functions so I do not need an explanation of that! I just wonder how I should wire it, maybe you could provide a drawing? If I understand somewhat correctly I should connect a voltage divider in between each PWM pin and a common GND and not wire anything to the +12V pin? If so I need to find the GND of the controller board, correct?

EDIT: Something lik this x3?

Grumpy_Mike

Quote
Something lik this x3
Exactly like that.

Hilleskog

Exactly like that.
So I should try to find the common GND of the built in RGB controller and share it with the Arduino and use it as GND for the voltage divider as well?

Grumpy_Mike

So I should try to find the common GND of the built in RGB controller and share it with the Arduino and use it as GND for the voltage divider as well?
Yes that is how it must be done.

Hilleskog

#8
May 07, 2018, 12:13 pm Last Edit: May 07, 2018, 02:35 pm by Hilleskog
Ok, so I have now managed to read the values I want and successfully been able to use them but I have now encountered another problem.

I have 2 built in LED's (technically 3) in the pc chassi wich are controlled by a PCB and a button. I then try to read the signal from an extra cable (R,G,B,12V) for additional RGB LED's or strips using a voltage divider connected to the PSU GND and the Arduino GND. But when I connect my Arduino to read the values, one of the case LED's light becomes more and more "distorted".

To make it more clear, the case LED's glows magenta, and I have nothing connected to the cable. I then connect one Arduino pin to the cable and ONE of the case LED's becomes slightly less magenta. I connect the second Arduino pin and the LED becomes even less magenta. Connecting the third pin makes the LED go more or less white.

Note that this only happens for one of the built in LED's, the other keeps its colour and is not affected at all. But if I disconnect the affected LED the other previously unaffected LED gets the same distorted color, and returns to normal when the other LED is connected again which gets distorted.

The things I have tried to resolve my issue:
  • Increasing and reducing the resistor values of my voltage divider - no effect
  • Checked the current in the GND wire - didn't notice anything weird, no high currents

Grumpy_Mike

Quote
decreasinf
Reducing

Is this troublesome LED different from the others? That is could it be that it is a common anode rather than a common cathode.

Otherwise you need to look at the signal on the LED with an oscilloscope to see what is happening to it when you connect the Arduino.

Hilleskog

Reducing

Is this troublesome LED different from the others? That is could it be that it is a common anode rather than a common cathode.

Otherwise you need to look at the signal on the LED with an oscilloscope to see what is happening to it when you connect the Arduino.
Which LED do you refer to? The ones in the case are common anode 12V RGB, and the strip I am trying to install is 5V 3-pin RGB.

I will try to check with my DSO-138 oscilloscope but I am still learning how to use it :P

Grumpy_Mike

Quote
Which LED do you refer to
The one that gives the odd behaviour.

Hilleskog

The one that gives the odd behaviour.
Those LED's are 12V common anode!

Grumpy_Mike

#13
May 08, 2018, 05:50 am Last Edit: May 08, 2018, 05:51 am by Grumpy_Mike
Quote
Those LED's are 12V common anode!
So can you post a schematic of how you have wired everything including the LEDs.
It looks like the pull down resistor in the voltage divider is causing an issue with holding the LED on slightly.
You could always up the resistor values by times ten so the ratio remains the same.

This is how we post images here
image guide

Hilleskog

#14
May 08, 2018, 04:14 pm Last Edit: May 08, 2018, 04:15 pm by Hilleskog
So here is the schematic, assume R1-R6 are the correct values to divide 12V to 5V! There are also 2 more LED's built into the chassi but they are SMD and I guess they work the same way as the one in the picture!


Go Up