Suggestion for a device between LED DRIVER output for input on MCP23017

(Lorenzo S.) #1

I have a led driver dimmerable and his output is constant 24 volt dimmered with pwm.
I would know his output state, possible solutions:

  1. 24v to 5v converter - for a simple on - off state

  2. A power meter ( like this but i’m not sure if is compatible with pwm modulation )

Suggestions?
Regards

Lorenzo.

schemas

0 Likes

(Rich Koshak) #2

I can’t help but I’ve moved this to a more appropriate category.

0 Likes

(Nils) #3

a 24v to 5v converter in the simplest way ist just 2 resistors in series…
Resistor Values have to be calcualted accordingly tho :slight_smile:
(i would choose a 47k and a 10k resistor which would bring the voltage form 24 V to 4.2 V i think)


you could add a large capacitor and measure with an ADC but its probably simpler to have it just look at the timings of the PWM.

0 Likes

(Allen) #4

Hi Yes take A look at the calculations bellow.

R1 = 47k and the R2 = 10k

Vout = Vin * R2/R1+R2
Vout = 24 * 10/47+10
Vout = 4.2105 V

Our You Can just save this site . it helps a lot.

0 Likes

(Lorenzo S.) #5

Nice… Now i remeber that MCP23017 chip has only pull_up internal resistor…
Don’t have pull_down res.
I tried without pull_up resistor but input blink.

Hi
Lorenzo.

0 Likes

(Rossko57) #6

This is what PWM does … to make the lights dim, it turns the power on and off very quickly.
If you read that at a digital input, you’ll randomly get on or off.

0 Likes

(Ron) #7

If you want to ‘read’ the PWM signal, you need something to measure the duty cycle.

But how do you control the dimmer? It has a DALI input that you could pick up as well (it sends "Manchester code’), or are you using a push button?
I can try to come up whith some potentially working solution, but that will take some thought (=time).

0 Likes

(Lorenzo S.) #8

@rossko57
blink on other configuration (post) your resp after my post.

@noppes123
i would control the dimmer with a time based rule. i have put a relay, that give 230v on circuit to dali contacts.
that relay is controlled from a mcp23017’s output pin.
Do you know a device that read duty cycle and return as output 5v max?

Many thanks
Lorenzo S.

0 Likes

(Rossko57) #9

Two resistors and a capacitor

0 Likes

(Ron) #10

According to the datasheet it has a PWN frequency of about 1kHz (= 1000 cycles per second). So it would be simple to measure its duty cycle with any MCU.
For example you could use a separate Arduino device and create a simple sketch that measures the ‘ON’ time in microseconds. Since the minimal dim level is 1% and maximum is 100%, you will measure an ON time between ~0.01 ms = dimmed and ~1 ms = full brightness.
The datasheet does not specify if the PWM signal briefly goes low between cycles. If not, you would need a timer to stop measuring. Or you could program the device to set a maximum dim level of 99%.

BTW, The Pi is also capable of reading the PWM signal (but not at 24V). Since this device is handling multiple things, an interrupt and timer driven approach would be needed. And whether that can be accomplished in a simple language like Python, without missing cycles, is uncertain. Programming in for instance C/C++ would also be an option, but that is more complex (e.g. no cross compiler for Windows).

However, I wonder what exactly you want to accomplish. Your initial request was about reading the dim level, but now

you mention that you want to set the dim level from OH. That’s more or less the oposite of measuring it…:grinning:

On a side note: I’m wondering why you want to use these expensive devices for something as simple as control a few LEDs from OH?

0 Likes

(Lorenzo S.) #11

@noppes123
input pin from MCP23017 need only to know led driver’s state.
output pin from mcp23017 for (with time based rule) command the led driver. (in this moment just work simple on or off )
eletric plant was made for wife’s reach , the openhab integrations i wish they were with minimal component replace.

Regards
Lorenzo

0 Likes

(Ron) #12

What do you mean by state? On/Off or dim level?

0 Likes

(Lorenzo S.) #13

i would minim simple on / off , dim level as best wish

Regards
Lorenzo

0 Likes

(Rossko57) #14

If I understand this right … when the dimmer is working, you get on, off, off, on etc. signals from your MCP pin?
If you only get off when the dimmer is off … you already have an on-off indicator.

You just need to use your Item going on to turn another Item on. Do not turn it off. Use a timer or expire binding to turn it off after a few seconds, or however long it is between your “blinking” signals.

0 Likes

(Ron) #15

In that case I would suggest a simple active low pass filter to convert the PWM signal to a DC level. I’ll create a schematic for that. Be aware that safety should always be a concern and any schematic design needs proper testing.

Will do some calculations tonight…

1 Like

(Ron) #16

Somthing like this should work and give a voltage relative to the duty cycle. Be aware that there will be some ripple and also a delay of serveral duty cycles before the capacitor is charged and the output voltage matches the pulse width.


Remember, this is not tested…

0 Likes