AC diming
-
@rvendrame said:
@thomasdc , as simple as
// Channel Number int i = message.sensor;Thank you very much for the reply!
can you expain it a litle more?so i have 4 dimmers:
MyMessage dimmer1Msg(AC_pin1, V_DIMMER); MyMessage light1Msg(AC_pin1, V_LIGHT); MyMessage dimmer2Msg(AC_pin2, V_DIMMER); MyMessage light2Msg(AC_pin2, V_LIGHT); MyMessage dimmer3Msg(AC_pin2, V_DIMMER); MyMessage light3Msg(AC_pin3, V_LIGHT); MyMessage dimmer4Msg(AC_pin4, V_DIMMER); MyMessage light4Msg(AC_pin4, V_LIGHT);how do i get the vallue for each dimmer?
so how do i get an 'int i' for channel one, an 'int j' for channel two, and so on ?
where do i put the code? is it just behind the:void incomingMessage(const MyMessage &message) { if (message.type == V_LIGHT || message.type == V_DIMMER) {? do i have to change something in the 'void incomming message' (see above)
big thanks!
-
My RGBW sketch is basically 4 dimmers also, take a look in this thread:
-
My RGBW sketch is basically 4 dimmers also, take a look in this thread:
@korttoma said:
My RGBW sketch is basically 4 dimmers also, take a look in this thread:
thanks for the reply!
I dont really get your code... you receive a byte from the controller? / you use a 'mode' to set your dimmers? my dimmers are 4 induvidual dimmers and dont have to work together ..
-
Another way to go is to use something like this and just convert everything to 12/24v dc. You can upgrade your lighting as you go and much easier and safer than AC dimming. If coarse there is still the ceiling fan to deal with. I will probably do that with an IR blaster.
-
-
Just ignor the mode related code, you probably dont need that. I allso have 4 individual dimmers they just happen to be connected to a RGBW Led strip. Same same but different.
-
Simplified the sketch code a bit. Here is an example how you can control 4 individual dimmers:
// Example sketch showing how to control RGBW LED Strip. //IMPORTANTE NOTE!!! one of the "radio" pins has been moved from pin 9 to pin 4 because the White is connected to pin 9 because only 3,5,6 and 9 are PWM outputs!!!! // This code should generate 4 Dimmer devices in Vera so you can control the RED, GREEN, BLUE and WHITE individualy #define SN "RGBW" #define SV "1.2" #include <MySensor.h> #include <SPI.h> #define NODE_ID AUTO #define RED 3 // pin for red LED #define GREEN 5 // pin for green #define BLUE 6 // pin for blue #define WHITE 9 // pin for white #define RF24_CE_PIN 4 //<-- NOTE!!! (4,10) and NOT (9,10) #define RF24_CS_PIN 10 #define RF24_PA_LEVEL RF24_PA_MAX MyTransportNRF24 transport(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL); MySensor gw(transport); void setup() { gw.begin(setDimmerStatus, NODE_ID); // Send the Sketch Version Information to the Gateway gw.sendSketchInfo(SN, SV); // Register all sensors to gw (they will be created as child devices) gw.present(RED, S_DIMMER); gw.present(GREEN, S_DIMMER); gw.present(BLUE, S_DIMMER); gw.present(WHITE, S_DIMMER); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(WHITE, OUTPUT); //Get values from RAM and write to outputs analogWrite(RED, 255 * gw.loadState(RED) / 100); analogWrite(GREEN, 255 * gw.loadState(GREEN) / 100); analogWrite(BLUE, 255 * gw.loadState(BLUE) / 100); analogWrite(WHITE, 255 * gw.loadState(WHITE) / 100); } void loop() { gw.process(); } void setDimmerStatus(const MyMessage &message) { if (message.type == V_DIMMER) { uint8_t incomingDimmerStatus = message.getByte(); analogWrite(message.sensor, 255 * incomingDimmerStatus / 100); gw.saveState(message.sensor, message.getByte()); //Save value to RAM } }``` -
Today I played with my AC dimmer
http://forum.mysensors.org/topic/1316/ac-dimmer-with-openhab/3It is very similar to the one reference above (but maybe a little bit cheaper :) ).
Good news: it is working fine with normal light bulbs and halogen tubes.
Bad news: it doesn't work with the high voltage LED tubes I testetd.
Has anybody a recommendation for a dimmable LED tube (E27/E17 230 V) working with the setup from this thread?
-
@FotoFieber , I use some 230V dimmable leds that I bought from IKEA in Germany about 1 year ago and and they work good. Some are Philips and some are IKEA-branded.
Most important is the 'dimmable' word on them. Most of current led drivers are not designed for AC dimming, as this increase the unit costs (usually the driver is more expensive than the leds itself)...