Hey there,
i want to controll my LED Strip (I have that simple controller, where you can controll the hole strip, not only parts).
But i don’t want only red, green and blue. To mix colors i have to set the output e.g. on GPIO Pin 11 to only 1,6V (50%).
I only see instructions for on and off. How can i get different voltages ?
Like in pigs “pigs p 11 125” (You can controll the pin from 0-255)
Sorry if my english isn’t the best, i am just a student from Germany.
Hi and welcome to the openHAB community!
There is a binding for the GPIO interface, but AFAIK it will not help you very much.
You can also try the exec binding with some python scripts to do what you require!
Check here, and here!
If you read the documentation, that is pretty much the idea! I have linked the exec1 binding documentation! Please read the documentation on the openHAB documentation’s page according to your setup!
If I recall correctly, at least on a Pi (you didn’t mention but that’s what I assume you’re using), you can only set GPIOs to either 1 or 0 (i.e. 3.3V or 0V). I suggest you get a WiFi or zwave RGB controller instead.
True but there are ways to simulate voltages between 0V and 3.3V using PWM. Of course the LEDs he is using will have to support dimming for it to work.
You don’t want to simulate PWM in software. I doubt a Pi is fast enough. Just for example, a Fibaro RGBW needs to operate at a rate of 244Hz to get it flicker-free.
Dear Markus,
244 Hz for a transistor is like I am walking 1 km/h, slow pace I mean! The transistors generally speaking are not bound to a brand/technology! I have reached with Raspberry Pi far bigger frequencies!
Oh, come on! Of course you can not do PWM control for LED from a rule in openHAB! Let’s set things straight assuming we are reasonable men (people, whatever gender)!
Of course a triac dimmer from the conception is fast, of course we can not emphasize on OH being an all-do machine, because the OS (Java) is not real time!
But, from my above points said to a guidance towards a technology/protocol, I think it’s way too far stretched!
So, instead of saying Fibaro, just say Z-wave!
sitemap home label="Main Menu"
{
Slider item=Dimmer1
Switch item=LED
}
Items:
Switch LED “LED” { gpio=“pin:21” }
Dimmer Dimmer1 “Dimmer [%.1f]”
Rules:
rule “DimmerON”
when
Item LED changed
then
if(LED.state==ON)
executeCommandLine(“screen -dmS dimmer python /home/openhabian/asd.py”)
end
rule "DimmerOFF"
when
Item LED changed
then
if(LED.state==OFF)
executeCommandLine("killall python")
end
rule "Dimmer2"
when
Item Dimmer1 received command
then
if (receivedCommand instanceof PercentType)
executeCommandLine("screen -S dimmer -X stuff " + (receivedCommand as PercentType)+ "\\n")
end
Python Script:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(40,GPIO.OUT)
pwm=GPIO.PWM(40,100)
pwm.start(100)
while True:
asd=input()
pwm.ChangeDutyCycle(asd)
It’s just a thought about using screen, there might be hundreds better solutions. Though its not meant for changing colors on ur LED strip, but u can control voltage by using PWM with the slider going from 0-100% power on openhab.
I don’t know the performance of this, but as I remember, you need a frequency of at least 600 Hz, 1 kHz for best performance.
Maybe @fwolter can provide a better inside view, but as per the example I think it deals with slow processes.