💬 OH MySensors RGBW Controller
-
I got my v1.3 pcbs from Smart Prototyping. Quality is good. The controller works fine BUT the sketch version in your github repo is broken. Seems like the non linear fading part never got finished. I am now using linear fading and the sketch is working.
-
@Jan-Gatzke
Hi can you please post your adjusted sketch for further reference?
-
You have to fix the following part:
for (int i = 0; i < NUM_CHANNELS; i++) { if (isOn) { // normal fading //analogWrite(channels[i], dimming / 100.0 * values[i]); // non linear fading, idea from https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/ analogWrite(channels[i], pow (2, (dimming / R)) - 1); } else { analogWrite(channels[i], 0); } }
Corrected Version
for (int i = 0; i < NUM_CHANNELS; i++) { if (isOn) { // normal fading analogWrite(channels[i], dimming / 100.0 * values[i]); // non linear fading, idea from https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/ //analogWrite(channels[i], pow (2, (dimming / R)) - 1); } else { analogWrite(channels[i], 0); } }
Or else all channels are set to the Value of dimming. The sketch on openhardware.io is broken, too.
-
@Jan-Gatzke
Thank you for your post.
I hope the Mosfet's are comming in today, then i can build it up and play with it.
-
@Jan-Gatzke Thank you for correcting it I never got around to making the fading part work a 100% so I reverted back to my normal linear fading for my controllers. Seems like I forgot to correct that in my git repo Sorry for that, I will fix it after christmas.
Great to hear that others are using the controllers too! Have fun with them and update me if you change something or build some (other) cool thing with them!
-
A little question, the v1.3 is this the one with the corrected mosfet placement ?
I build and programmed one now, but i only get a bright white light, and no response when i switch the node. So now i am in doubt...With regards
Peer
-
The node always starts with white on. This is normal behaviour.
-
@Jan-Gatzke
Thank you, i see it in the code now ...
I tested it with setting the RGB levels one by one to 255, and this works, so the channels are responding to the initialisation code.
And because it is rebuild to version 2.0, i forgot one void to adjust...
void incomingMessage(
should be
void receive(
Problem solved, thank you very much.
With regards
Peer van Hoek
-
Great.Can you post the complete 2.0 sketch, please? I am going to upgrade and this would be a good starting point.
-
@Jan-Gatzke
Sure, no problem.
But it is not 100% clean, i am just a coppier and paste'r....
If you can clean it up that would be nice./** Based on the MySensors Project: http://www.mysensors.org This sketch controls a (analog)RGBW strip by listening to new color values from a (domoticz) controller and then fading to the new color. Version 1.0 - Changed pins and gw definition Version 0.9 - Oliver Hilsky TODO safe/request values after restart/loss of connection */ #define MY_DEBUG #define SN "RGBW 01" #define SV "1.0" #define MY_RADIO_NRF24 // change the pins to free up the pwm pin for led control #define MY_RF24_CE_PIN 4 //<-- NOTE!!! changed, the default is 9 #define MY_RF24_CS_PIN 10 // default is 10 #define MY_RF24_PA_LEVEL RF24_PA_MAX #define MY_REPEATER_FEATURE #define MY_NODE_ID 6 // Load mysensors library #include <MySensors.h> // Load Serial Peripheral Interface library #include <SPI.h> // Arduino pin attached to driver pins #define RED_PIN 3 #define WHITE_PIN 9 #define GREEN_PIN 5 #define BLUE_PIN 6 #define NUM_CHANNELS 4 // how many channels, RGBW=4 RGB=3... #define CHILD_ID 1 // Smooth stepping between the values #define STEP 1 #define INTERVAL 10 const int pwmIntervals = 255; float R; // equation for dimming curve // Stores the current color settings byte channels[4] = {RED_PIN, GREEN_PIN, BLUE_PIN, WHITE_PIN}; byte values[4] = {0, 0, 0, 255}; byte target_values[4] = {0, 0, 0, 255}; // stores dimming level byte dimming = 100; byte target_dimming = 100; // tracks if the strip should be on of off boolean isOn = true; // time tracking for updates unsigned long lastupdate = millis(); void setup() { // Initializes the sensor node (with callback function for incoming messages) //begin(incomingMessage); // 123 = node id for testing // Set all channels to output (pin number, type) for (int i = 0; i < NUM_CHANNELS; i++) { pinMode(channels[i], OUTPUT); } // set up dimming R = (pwmIntervals * log10(2))/(log10(255)); // get old values if this is just a restart request(CHILD_ID, V_RGBW); // init lights updateLights(); // debug if (isOn) { Serial.println("RGBW is running..."); } Serial.println("Waiting for messages..."); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SN, SV); // Register this device as Waterflow sensor present(CHILD_ID, S_RGBW_LIGHT, SN, true); } void loop() { // Process incoming messages (like config and light state from controller) - basically keep the mysensors protocol running // process(); // and set the new light colors if (millis() > lastupdate + INTERVAL) { updateLights(); lastupdate = millis(); } } // callback function for incoming messages void receive(const MyMessage &message) { Serial.print("Got a message - "); Serial.print("Messagetype is: "); Serial.println(message.type); // acknoledgment if (message.isAck()) { Serial.println("Got ack from gateway"); } // new dim level else if (message.type == V_DIMMER) { Serial.println("Dimming to "); Serial.println(message.getString()); target_dimming = message.getByte(); // a new dimmer value also means on, no seperate signal gets send (by domoticz) isOn = true; } // on / off message else if (message.type == V_STATUS) { Serial.print("Turning light "); isOn = message.getInt(); if (isOn) { Serial.println("on"); } else { Serial.println("off"); } } // new color value else if (message.type == V_RGBW) { const char * rgbvalues = message.getString(); inputToRGBW(rgbvalues); // a new color also means on, no seperate signal gets send (by domoticz); needed e.g. for groups isOn = true; } } // this gets called every INTERVAL milliseconds and updates the current pwm levels for all colors void updateLights() { // update pin values -debug //Serial.println(greenval); //Serial.println(redval); //Serial.println(blueval); //Serial.println(whiteval); //Serial.println(target_greenval); //Serial.println(target_redval); //Serial.println(target_blueval); //Serial.println(target_whiteval); //Serial.println("+++++++++++++++"); // for each color for (int v = 0; v < NUM_CHANNELS; v++) { if (values[v] < target_values[v]) { values[v] += STEP; if (values[v] > target_values[v]) { values[v] = target_values[v]; } } if (values[v] > target_values[v]) { values[v] -= STEP; if (values[v] < target_values[v]) { values[v] = target_values[v]; } } } // dimming if (dimming < target_dimming) { dimming += STEP; if (dimming > target_dimming) { dimming = target_dimming; } } if (dimming > target_dimming) { dimming -= STEP; if (dimming < target_dimming) { dimming = target_dimming; } } /* // debug - new values Serial.println(greenval); Serial.println(redval); Serial.println(blueval); Serial.println(whiteval); Serial.println(target_greenval); Serial.println(target_redval); Serial.println(target_blueval); Serial.println(target_whiteval); Serial.println("+++++++++++++++"); */ // set actual pin values for (int i = 0; i < NUM_CHANNELS; i++) { if (isOn) { // normal fading analogWrite(channels[i], dimming / 100.0 * values[i]); // non linear fading, idea from https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/ //analogWrite(channels[i], pow (2, (dimming / R)) - 1); } else { analogWrite(channels[i], 0); } } } // converts incoming color string to actual (int) values // ATTENTION this currently does nearly no checks, so the format needs to be exactly like domoticz sends the strings void inputToRGBW(const char * input) { Serial.print("Got color value of length: "); Serial.println(strlen(input)); if (strlen(input) == 6) { Serial.println("new rgb value"); target_values[0] = fromhex (& input [0]); target_values[1] = fromhex (& input [2]); target_values[2] = fromhex (& input [4]); target_values[3] = 0; } else if (strlen(input) == 9) { Serial.println("new rgbw value"); target_values[0] = fromhex (& input [1]); // ignore # as first sign target_values[1] = fromhex (& input [3]); target_values[2] = fromhex (& input [5]); target_values[3] = fromhex (& input [7]); } else { Serial.println("Wrong length of input"); } Serial.print("New color values: "); Serial.println(input); for (int i = 0; i < NUM_CHANNELS; i++) { Serial.print(target_values[i]); Serial.print(", "); } Serial.println(""); Serial.print("Dimming: "); Serial.println(dimming); } // converts hex char to byte byte fromhex (const char * str) { char c = str [0] - '0'; if (c > 9) c -= 7; int result = c; c = str [1] - '0'; if (c > 9) c -= 7; return (result << 4) | c; }```
-
If I find the time, I will clean it up. I want to have a look at the non linear fading. IMHO the initial settings need to be customized, too. Instead of switching the white LEDs on the node could request the values from the controller (if possible) or from eeprom.
-
As promised I had a look at the sketch. The node can now save and restore values for rgbw, dimming and status to/from the controller. I had a look at the non linear fading, too. I got it partially working and refreshed my math knowledge a lot.
In the end I removed the code for it because it made the sketch much more complicated and I didn't like the results. The formula from the original sketch was ok for fading a single LED from 0% to 100%. It didn't cover other starting values and the combination of the colors. IMHO only the dimming can be done non linear without problems. For this I would use a static table of PWM values and percent values. Doing the log calculations on the pro mini seems to be too slow for a smooth fading. I saw massive flickering.Here is the sketch:
/** Based on the MySensors Project: http://www.mysensors.org This sketch controls a (analog)RGBW strip by listening to new color values from a (domoticz) controller and then fading to the new color. Version 1.1 - Added save/restore of values to/from controller, removed non linear fading code Version 1.0 - Changed pins and gw definition Version 0.9 - Oliver Hilsky **/ #define MY_DEBUG #define SN "RGBW 01" #define SV "1.1" #define MY_RADIO_NRF24 // change the pins to free up the pwm pin for led control #define MY_RF24_CE_PIN 4 //<-- NOTE!!! changed, the default is 9 #define MY_RF24_CS_PIN 10 // default is 10 // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. #define MY_RF24_PA_LEVEL RF24_PA_LOW //Uncomment to enable repeater mode //#define MY_REPEATER_FEATURE //Uncomment to assign static node ID //#define MY_NODE_ID 9 // Load mysensors library #include <MySensors.h> // Load Serial Peripheral Interface library #include <SPI.h> // Arduino pin attached to driver pins #define RED_PIN 3 #define WHITE_PIN 9 #define GREEN_PIN 5 #define BLUE_PIN 6 #define NUM_CHANNELS 4 // how many channels, RGBW=4 RGB=3... #define CHILD_ID 1 // Smooth stepping between the values #define STEP 1 #define INTERVAL 10 MyMessage lastvalueMsg(CHILD_ID, V_VAR1); MyMessage lastisonMsg(CHILD_ID, V_VAR2); MyMessage lastdimmMsg(CHILD_ID, V_VAR3); // Stores the current color settings byte channels[4] = {RED_PIN, GREEN_PIN, BLUE_PIN, WHITE_PIN}; byte values[4] = {0, 0, 0, 0}; byte target_values[4] = {0, 0, 0, 0}; // stores dimming level byte dimming = 100; byte target_dimming = 100; // tracks if the strip should be on of off boolean isOn = false; // tracks if the strip's last status was off. This overrides isOn at startup boolean wasOff = true; //tracks if the old values have bben requested from the controller. This prevents the request from being send multipßle times in the main loop. boolean valuesrequested = false; // time tracking for updates unsigned long lastupdate = millis(); void setup() { // Set all channels to output (pin number, type) for (int i = 0; i < NUM_CHANNELS; i++) { pinMode(channels[i], OUTPUT); } // debug if (isOn) { Serial.println("RGBW is running..."); } } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SN, SV); // Register this device as Waterflow sensor present(CHILD_ID, S_RGBW_LIGHT, SN, true); } void loop() { if (!valuesrequested) { // get old values if this is just a restart Serial.println("Requesting old values..."); //Request RGBW values request( CHILD_ID, V_VAR1 ); wait(200); //Request Status request( CHILD_ID, V_VAR2 ); wait(200); //Request dimm level request( CHILD_ID, V_VAR3 ); valuesrequested = true; } // set the new light colors if (millis() > lastupdate + INTERVAL) { updateLights(); lastupdate = millis(); } } // callback function for incoming messages void receive(const MyMessage &message) { Serial.print("Got a message - "); Serial.print("Messagetype is: "); Serial.println(message.type); // acknoledgment if (message.isAck()) { Serial.println("Got ack from gateway"); } // new dim level else if (message.type == V_DIMMER or message.type == V_VAR3) { Serial.println("Dimming to "); Serial.println(message.getString()); target_dimming = message.getByte(); send(lastdimmMsg.set(target_dimming)); if (!wasOff) { // a new dimmer value also means on, no seperate signal gets send (by domoticz) isOn = true; send(lastisonMsg.set(isOn)); } } // on / off message else if (message.type == V_STATUS or message.type == V_VAR2) { Serial.print("Turning light "); isOn = message.getInt(); if (isOn) { Serial.println("on"); wasOff = false; } else { Serial.println("off"); } send(lastisonMsg.set(isOn)); } // new color value else if (message.type == V_RGBW or message.type == V_VAR1) { const char * rgbvalues = message.getString(); send(lastvalueMsg.set(rgbvalues)); inputToRGBW(rgbvalues); if (!wasOff) { // a new color also means on, no seperate signal gets send (by domoticz); needed e.g. for groups isOn = true; send(lastisonMsg.set(isOn)); } } } // this gets called every INTERVAL milliseconds and updates the current pwm levels for all colors void updateLights() { // update pin values -debug //Serial.println(greenval); //Serial.println(redval); //Serial.println(blueval); //Serial.println(whiteval); //Serial.println(target_greenval); //Serial.println(target_redval); //Serial.println(target_blueval); //Serial.println(target_whiteval); //Serial.println("+++++++++++++++"); // for each color for (int v = 0; v < NUM_CHANNELS; v++) { if (values[v] < target_values[v]) { values[v] += STEP; if (values[v] > target_values[v]) { values[v] = target_values[v]; } } if (values[v] > target_values[v]) { values[v] -= STEP; if (values[v] < target_values[v]) { values[v] = target_values[v]; } } } // dimming if (dimming < target_dimming) { dimming += STEP; if (dimming > target_dimming) { dimming = target_dimming; } } if (dimming > target_dimming) { dimming -= STEP; if (dimming < target_dimming) { dimming = target_dimming; } } /* // debug - new values Serial.println(greenval); Serial.println(redval); Serial.println(blueval); Serial.println(whiteval); Serial.println(target_greenval); Serial.println(target_redval); Serial.println(target_blueval); Serial.println(target_whiteval); Serial.println("+++++++++++++++"); */ // set actual pin values for (int i = 0; i < NUM_CHANNELS; i++) { if (isOn) { // normal fading analogWrite(channels[i], dimming / 100.0 * values[i]); } else { analogWrite(channels[i], 0); } } } // converts incoming color string to actual (int) values // ATTENTION this currently does nearly no checks, so the format needs to be exactly like domoticz sends the strings void inputToRGBW(const char * input) { Serial.print("Got color value of length: "); Serial.println(strlen(input)); if (strlen(input) == 6) { Serial.println("new rgb value"); target_values[0] = fromhex (& input [0]); target_values[1] = fromhex (& input [2]); target_values[2] = fromhex (& input [4]); target_values[3] = 0; } else if (strlen(input) == 9) { Serial.println("new rgbw value"); target_values[0] = fromhex (& input [1]); // ignore # as first sign target_values[1] = fromhex (& input [3]); target_values[2] = fromhex (& input [5]); target_values[3] = fromhex (& input [7]); } else { Serial.println("Wrong length of input"); } Serial.print("New color values: "); Serial.println(input); for (int i = 0; i < NUM_CHANNELS; i++) { Serial.print(target_values[i]); Serial.print(", "); } Serial.println(""); Serial.print("Dimming: "); Serial.println(dimming); } // converts hex char to byte byte fromhex (const char * str) { char c = str [0] - '0'; if (c > 9) c -= 7; int result = c; c = str [1] - '0'; if (c > 9) c -= 7; return (result << 4) | c; }
-
@Jan-Gatzke Good job! I have a working 2.0 Version but it lacks your new features. I will take the time and add yours to the code in my git repo
-
Thx. Those new features, however, are kind of a workaround. It would have been better if the node could request the V_RGBW value directly. MySensors supports this, but domoticz doesn't seem to. I have testet this and domoticz always returned "0" as value. And because you and me are both using domoticz, I decided to implement this feature using V_VAR1-3.
I am still thinking about the fading. I think we could get better colors if we could compensate the non linear dimming of the LEDs. With the actual sketch colors composed of mid range values could be wrong because every PWM value above 150 or so looks like almost full power. So 00AAFF almost looks like 00FFFF. AA has a value of 170 where FF is 255. This should make a big difference.
-
I have tried to get some kind of non linear fading by calculating the values for 256 steps using Excel and putting them in an array. The result is pretty good. Please test and share your opinion.
/** Based on the MySensors Project: http://www.mysensors.org This sketch controls a (analog)RGBW strip by listening to new color values from a (domoticz) controller and then fading to the new color. Version 1.1 - Added save/restore of values to/from controller, removed non linear fading code Version 1.0 - Changed pins and gw definition Version 0.9 - Oliver Hilsky **/ #define MY_DEBUG #define SN "RGBW 01" #define SV "1.1" #define MY_RADIO_NRF24 // change the pins to free up the pwm pin for led control #define MY_RF24_CE_PIN 4 //<-- NOTE!!! changed, the default is 9 #define MY_RF24_CS_PIN 10 // default is 10 // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. #define MY_RF24_PA_LEVEL RF24_PA_LOW //Uncomment to enable repeater mode //#define MY_REPEATER_FEATURE //Uncomment to assign static node ID //#define MY_NODE_ID 9 // Load mysensors library #include <MySensors.h> // Load Serial Peripheral Interface library #include <SPI.h> // Arduino pin attached to driver pins #define RED_PIN 3 #define WHITE_PIN 9 #define GREEN_PIN 5 #define BLUE_PIN 6 #define NUM_CHANNELS 4 // how many channels, RGBW=4 RGB=3... #define CHILD_ID 1 // Smooth stepping between the values #define STEP 1 #define INTERVAL 10 MyMessage lastvalueMsg(CHILD_ID, V_VAR1); MyMessage lastisonMsg(CHILD_ID, V_VAR2); MyMessage lastdimmMsg(CHILD_ID, V_VAR3); // Stores the current color settings byte channels[4] = {RED_PIN, GREEN_PIN, BLUE_PIN, WHITE_PIN}; byte values[4] = {0, 0, 0, 0}; byte target_values[4] = {0, 0, 0, 0}; //Stores corrected values for each step from 0 to 255. See https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/ byte converted_values[256] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8,8,9,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,13,13,13,13,14,14,14,15,15,15,16,16,17,17,17,18,18,19,19,20,20,20,21,21,22,22,23,23,24,24,25,26,26,27,27,28,29,29,30,31,31,32,33,34,34,35,36,37,38,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,54,55,56,57,58,60,61,62,64,65,67,68,70,71,73,75,76,78,80,81,83,85,87,89,91,93,95,97,99,101,104,106,108,111,113,116,118,121,123,126,129,132,135,138,141,144,147,150,154,157,161,164,168,171,175,179,183,187,191,195,200,204,209,213,218,223,228,233,238,243,249,255}; // stores dimming level byte dimming = 100; byte target_dimming = 100; // tracks if the strip should be on of off boolean isOn = false; // tracks if the strip's last status was off. This overrides isOn at startup boolean wasOff = true; //tracks if the old values have bben requested from the controller. This prevents the request from being send multipßle times in the main loop. boolean valuesrequested = false; // time tracking for updates unsigned long lastupdate = millis(); void setup() { // Set all channels to output (pin number, type) for (int i = 0; i < NUM_CHANNELS; i++) { pinMode(channels[i], OUTPUT); } // debug if (isOn) { Serial.println("RGBW is running..."); } } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SN, SV); // Register this device as Waterflow sensor present(CHILD_ID, S_RGBW_LIGHT, SN, true); } void loop() { if (!valuesrequested) { // get old values if this is just a restart Serial.println("Requesting old values..."); //Request RGBW values request( CHILD_ID, V_VAR1 ); wait(200); //Request Status request( CHILD_ID, V_VAR2 ); wait(200); //Request dimm level request( CHILD_ID, V_VAR3 ); valuesrequested = true; } // set the new light colors if (millis() > lastupdate + INTERVAL) { updateLights(); lastupdate = millis(); } } // callback function for incoming messages void receive(const MyMessage &message) { Serial.print("Got a message - "); Serial.print("Messagetype is: "); Serial.println(message.type); // acknoledgment if (message.isAck()) { Serial.println("Got ack from gateway"); } // new dim level else if (message.type == V_DIMMER or message.type == V_VAR3) { Serial.println("Dimming to "); Serial.println(message.getString()); target_dimming = message.getByte(); send(lastdimmMsg.set(target_dimming)); if (!wasOff) { // a new dimmer value also means on, no seperate signal gets send (by domoticz) isOn = true; send(lastisonMsg.set(isOn)); } } // on / off message else if (message.type == V_STATUS or message.type == V_VAR2) { Serial.print("Turning light "); isOn = message.getInt(); if (isOn) { Serial.println("on"); wasOff = false; } else { Serial.println("off"); } send(lastisonMsg.set(isOn)); } // new color value else if (message.type == V_RGBW or message.type == V_VAR1) { const char * rgbvalues = message.getString(); send(lastvalueMsg.set(rgbvalues)); inputToRGBW(rgbvalues); if (!wasOff) { // a new color also means on, no seperate signal gets send (by domoticz); needed e.g. for groups isOn = true; send(lastisonMsg.set(isOn)); } } } // this gets called every INTERVAL milliseconds and updates the current pwm levels for all colors void updateLights() { int convertedvalue=0; // update pin values -debug //Serial.println(greenval); //Serial.println(redval); //Serial.println(blueval); //Serial.println(whiteval); //Serial.println(target_greenval); //Serial.println(target_redval); //Serial.println(target_blueval); //Serial.println(target_whiteval); //Serial.println("+++++++++++++++"); // for each color for (int v = 0; v < NUM_CHANNELS; v++) { if (values[v] < target_values[v]) { values[v] += STEP; if (values[v] > target_values[v]) { values[v] = target_values[v]; } } if (values[v] > target_values[v]) { values[v] -= STEP; if (values[v] < target_values[v]) { values[v] = target_values[v]; } } } // dimming if (dimming < target_dimming) { dimming += STEP; if (dimming > target_dimming) { dimming = target_dimming; } } if (dimming > target_dimming) { dimming -= STEP; if (dimming < target_dimming) { dimming = target_dimming; } } /* // debug - new values Serial.println(greenval); Serial.println(redval); Serial.println(blueval); Serial.println(whiteval); Serial.println(target_greenval); Serial.println(target_redval); Serial.println(target_blueval); Serial.println(target_whiteval); Serial.println("+++++++++++++++"); */ // set actual pin values for (int i = 0; i < NUM_CHANNELS; i++) { if (isOn) { // normal fading //analogWrite(channels[i], dimming / 100.0 * values[i]); //Fading with corrected values see https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/ analogWrite(channels[i], dimming / 100.0 * converted_values[values[i]]); } else { analogWrite(channels[i], 0); } } } // converts incoming color string to actual (int) values // ATTENTION this currently does nearly no checks, so the format needs to be exactly like domoticz sends the strings void inputToRGBW(const char * input) { Serial.print("Got color value of length: "); Serial.println(strlen(input)); if (strlen(input) == 6) { Serial.println("new rgb value"); target_values[0] = fromhex (& input [0]); target_values[1] = fromhex (& input [2]); target_values[2] = fromhex (& input [4]); target_values[3] = 0; } else if (strlen(input) == 9) { Serial.println("new rgbw value"); target_values[0] = fromhex (& input [1]); // ignore # as first sign target_values[1] = fromhex (& input [3]); target_values[2] = fromhex (& input [5]); target_values[3] = fromhex (& input [7]); } else { Serial.println("Wrong length of input"); } Serial.print("New color values: "); Serial.println(input); for (int i = 0; i < NUM_CHANNELS; i++) { Serial.print(target_values[i]); Serial.print(", "); } Serial.println(""); Serial.print("Dimming: "); Serial.println(dimming); } // converts hex char to byte byte fromhex (const char * str) { char c = str [0] - '0'; if (c > 9) c -= 7; int result = c; c = str [1] - '0'; if (c > 9) c -= 7; return (result << 4) | c; }
-
@Jan-Gatzke for Domoticz you can use V_TEXT. You can request a value and manipulate it in Lua. Also Domoticz is terrible with rgb as it only allows saturated colors.
-
@Jan-Gatzke the FastLED library allows for very fast math with color values. Also some very educational stuff for color manipulation in the code and documentation.
-
Thx for the info. This comes 24 hours to late.
-
Is any chance to also project PCB for radio RFM69HW ?
-
@pepson I wont do it because my networks is using NRFs but the kicad files are online, you could just get those and only change the radio part.
-
I dont know software kicad... and can i please you to help me for changing it to radio RFM69HW please ?
-
@pepson, please respect @LastSamurai (who has gracefully shared his hardware design files) when he says he won't change it.
There are resources online on how to learn Kicad,
-
There are also converter boards available, that let you use rfm69hw in a nrf24 socket. That could be an option. Search openhardware.io for it..
-
Ok i find:
https://www.openhardware.io/view/16/NRF2RFM69very thanks
-
What software is for file kicad_pcb ?
I download this but i can not open this file by this soft...
http://kicad-pcb.org/download/windows/Or in which file is write project PCB ?
-
@pepson The *.kicad_pcb file should be the pcb, the *.sch file the schematics.
You could just use the schematics to remake my project by yourself though and learn kicad on the way. Otherwise the suggested adaptor seems to be the easiest solution.
-
But in soft kicad i dont have option to open this file... kicad can only open *.pro
-
This PCB will also available to buy it as i can buy PCB to converter NRF to RFM69 ?
-
@pepson said:
This PCB will also available to buy it as i can buy PCB to converter NRF to RFM69 ?
I am not sure if I understand your question. I am not selling the pcbs but you can buy it from dirtypcbs and support me. I guess you should be able to use it with the converter though I never did. Be sure to check dimensions first!
-
But on dirtypcb what type file i must upload to give cost ?
-
A zip with the gerber files. The version 1.3 that I used is already in their store though: http://dirtypcbs.com/store/designer/details/7078/867/mysensors-rgbw-controller-v1-3
-
Hmm a littlebig cost same PCB. Can you show me it how it looks in Domoticz ?
-
@pepson What do you want to know about domoticz? It looks like every other RGB switch in domotizc depending on your used theme, just google it
-
But is any chance to implement also button as in fibaro rgbw ?
-
@pepson I don't understand?!
-
Buttons to controlling leds red gren blue and white.
-
@pepson Still not sure what you mean. If you want hardware buttons you can add those to the node (I did not). Everything else is part of the controller software which I don't control. You can always use something other than domoticz. But lets not spam this thread with that anymore please
-
Will this board works with an APA102 ledstrip? And, I'm new to custom boards, how can I simply order a couple of this boards?
EDIT: i'm too fast, found this link: http://dirtypcbs.com/store/designer/details/7078/867/mysensors-rgbw-controller-v1-3
so my second question is already be answered!
-
@niek APA102 are adressable leds, right? My led controller only supports "analog" leds controlled by pwm. At least without some modding.
-
@niek an apa102 strip contains internal logic/ driver circuitry so it can be controlled direct from arduino power pins. No mosfet needed. Take a look at the FastLED library to control these strips.
-
I am trying to compile this project with the 2.1.1 library, but I keep getting the errors: the 'MyTransportNRF24' does not name a type.
As far as I can see, it seems that the type is nowhere defined in the libraries.
-
@CoolSaet Yes that is because the sketch you are using is still from MySensors 1.5. I already updated the sketch to Version 2 in November but forgot to push the changes to github.
Here is a newer version that should work with mysensors 2. Only the (non)linear fading is still not working 100%.PS I also updated the text of the openhardware.io project
-
@LastSamurai Thank you very much for the update. That seems to have done the trick.
-
@LastSamurai The gerber files on Dirty PCBs are the mosfet corrected ones or the wrong? I just ordered some and now I've this doubt.
-
@Sergio-Rius
I ordered the pcb a few months back on dirty pcbs. That one had the MOSFET pins connected wrong, but it wasn't that difficult to turn them an discribed in the post. I am not sure if a correct one is available.
-
@CoolSaet Thankiuu! I'll try not to mess anything.
-
@Sergio-Rius I am pretty sure the version 1.3 from the store still has the pins rotated (= wrong but you can fix it as described). There is a fixed version of the gerber files in my github repo that is linked to this project though. I just haven't ordered them from dirtyPCBs yet so they are not in the store (as I am still using the rest of the old ones).
-
Thanks, @LastSamurai, I went and compared the DIrty PCB files with the v1.3 ones on OpenHardware.IO and they are indeed different. It looks like the DIrtyPCB link is out of date and still has the error on them.
@Sergio-Rius would be very grateful if you could update those files
-
@Stuart-Middleton Unfortunately my boards are already made and shipped. They made them in just a day (Sunday) and didn't have me time to rectify my order.
-
@Sergio-Rius Oh well, it doesn't look too hard to adapt for the error.
-
@Stuart-Middleton It really shoudn't be. Just follow the pictures in the project. There are also updated project/gerber files in my github for anyone wanting to order new ones. Once I have used all of the Version 1.3 ones I will order new ones from dirtyPCBs and add the link here.
-
@Jan-Gatzke Did you ever manage to get your non-linear fading to work? I used the predefined values from your sketch and added them to my newer one but whenever I use that the sketch stops working and only rubbish is shown on the serial port.
Here is my new version: github
-
Yes, I did! This sketch is working for me:
/** Based on the MySensors Project: http://www.mysensors.org This sketch controls a (analog)RGBW strip by listening to new color values from a (domoticz) controller and then fading to the new color. Version 1.1 - Added save/restore of values to/from controller, removed non linear fading code Version 1.0 - Changed pins and gw definition Version 0.9 - Oliver Hilsky **/ #define MY_DEBUG #define SN "RGBW 01" #define SV "1.1" #define MY_RADIO_NRF24 #define MY_PARENT_NODE_ID 10 // change the pins to free up the pwm pin for led control #define MY_RF24_CE_PIN 4 //<-- NOTE!!! changed, the default is 9 #define MY_RF24_CS_PIN 10 // default is 10 // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. #define MY_RF24_PA_LEVEL RF24_PA_LOW //Uncomment to enable repeater mode //#define MY_REPEATER_FEATURE //Uncomment to assign static node ID //#define MY_NODE_ID 9 // Load mysensors library #include <MySensors.h> // Load Serial Peripheral Interface library #include <SPI.h> // Arduino pin attached to driver pins #define RED_PIN 3 #define WHITE_PIN 9 #define GREEN_PIN 5 #define BLUE_PIN 6 #define NUM_CHANNELS 4 // how many channels, RGBW=4 RGB=3... #define CHILD_ID 1 // Smooth stepping between the values #define STEP 1 #define INTERVAL 10 MyMessage lastvalueMsg(CHILD_ID, V_VAR1); MyMessage lastisonMsg(CHILD_ID, V_VAR2); MyMessage lastdimmMsg(CHILD_ID, V_VAR3); // Stores the current color settings byte channels[4] = {RED_PIN, GREEN_PIN, BLUE_PIN, WHITE_PIN}; byte values[4] = {0, 0, 0, 0}; byte target_values[4] = {0, 0, 0, 0}; //Stores corrected values for each step from 0 to 255. See https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/ byte converted_values[256] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8,8,9,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,13,13,13,13,14,14,14,15,15,15,16,16,17,17,17,18,18,19,19,20,20,20,21,21,22,22,23,23,24,24,25,26,26,27,27,28,29,29,30,31,31,32,33,34,34,35,36,37,38,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,54,55,56,57,58,60,61,62,64,65,67,68,70,71,73,75,76,78,80,81,83,85,87,89,91,93,95,97,99,101,104,106,108,111,113,116,118,121,123,126,129,132,135,138,141,144,147,150,154,157,161,164,168,171,175,179,183,187,191,195,200,204,209,213,218,223,228,233,238,243,249,255}; // stores dimming level byte dimming = 100; byte target_dimming = 100; // tracks if the strip should be on of off boolean isOn = false; // tracks if the strip's last status was off. This overrides isOn at startup boolean wasOff = true; //tracks if the old values have bben requested from the controller. This prevents the request from being send multipßle times in the main loop. boolean valuesrequested = false; // time tracking for updates unsigned long lastupdate = millis(); void setup() { // Set all channels to output (pin number, type) for (int i = 0; i < NUM_CHANNELS; i++) { pinMode(channels[i], OUTPUT); } // debug if (isOn) { Serial.println("RGBW is running..."); } } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SN, SV); // Register this device as Waterflow sensor present(CHILD_ID, S_RGBW_LIGHT, SN, true); } void loop() { if (!valuesrequested) { // get old values if this is just a restart Serial.println("Requesting old values..."); //Request RGBW values request( CHILD_ID, V_VAR1 ); wait(200); //Request Status request( CHILD_ID, V_VAR2 ); wait(200); //Request dimm level request( CHILD_ID, V_VAR3 ); valuesrequested = true; } // set the new light colors if (millis() > lastupdate + INTERVAL) { updateLights(); lastupdate = millis(); } } // callback function for incoming messages void receive(const MyMessage &message) { Serial.print("Got a message - "); Serial.print("Messagetype is: "); Serial.println(message.type); // acknoledgment if (message.isAck()) { Serial.println("Got ack from gateway"); } // new dim level else if (message.type == V_DIMMER or message.type == V_VAR3) { Serial.println("Dimming to "); Serial.println(message.getString()); target_dimming = message.getByte(); send(lastdimmMsg.set(target_dimming)); if (!wasOff) { // a new dimmer value also means on, no seperate signal gets send (by domoticz) isOn = true; send(lastisonMsg.set(isOn)); } } // on / off message else if (message.type == V_STATUS or message.type == V_VAR2) { Serial.print("Turning light "); isOn = message.getInt(); if (isOn) { Serial.println("on"); wasOff = false; } else { Serial.println("off"); } send(lastisonMsg.set(isOn)); } // new color value else if (message.type == V_RGBW or message.type == V_VAR1) { const char * rgbvalues = message.getString(); send(lastvalueMsg.set(rgbvalues)); inputToRGBW(rgbvalues); if (!wasOff) { // a new color also means on, no seperate signal gets send (by domoticz); needed e.g. for groups isOn = true; send(lastisonMsg.set(isOn)); } } } // this gets called every INTERVAL milliseconds and updates the current pwm levels for all colors void updateLights() { int convertedvalue=0; // update pin values -debug //Serial.println(greenval); //Serial.println(redval); //Serial.println(blueval); //Serial.println(whiteval); //Serial.println(target_greenval); //Serial.println(target_redval); //Serial.println(target_blueval); //Serial.println(target_whiteval); //Serial.println("+++++++++++++++"); // for each color for (int v = 0; v < NUM_CHANNELS; v++) { if (values[v] < target_values[v]) { values[v] += STEP; if (values[v] > target_values[v]) { values[v] = target_values[v]; } } if (values[v] > target_values[v]) { values[v] -= STEP; if (values[v] < target_values[v]) { values[v] = target_values[v]; } } } // dimming if (dimming < target_dimming) { dimming += STEP; if (dimming > target_dimming) { dimming = target_dimming; } } if (dimming > target_dimming) { dimming -= STEP; if (dimming < target_dimming) { dimming = target_dimming; } } /* // debug - new values Serial.println(greenval); Serial.println(redval); Serial.println(blueval); Serial.println(whiteval); Serial.println(target_greenval); Serial.println(target_redval); Serial.println(target_blueval); Serial.println(target_whiteval); Serial.println("+++++++++++++++"); */ // set actual pin values for (int i = 0; i < NUM_CHANNELS; i++) { if (isOn) { // normal fading //analogWrite(channels[i], dimming / 100.0 * values[i]); //Fading with corrected values see https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/ analogWrite(channels[i], dimming / 100.0 * converted_values[values[i]]); } else { analogWrite(channels[i], 0); } } } // converts incoming color string to actual (int) values // ATTENTION this currently does nearly no checks, so the format needs to be exactly like domoticz sends the strings void inputToRGBW(const char * input) { Serial.print("Got color value of length: "); Serial.println(strlen(input)); if (strlen(input) == 6) { Serial.println("new rgb value"); target_values[0] = fromhex (& input [0]); target_values[1] = fromhex (& input [2]); target_values[2] = fromhex (& input [4]); target_values[3] = 0; } else if (strlen(input) == 9) { Serial.println("new rgbw value"); target_values[0] = fromhex (& input [1]); // ignore # as first sign target_values[1] = fromhex (& input [3]); target_values[2] = fromhex (& input [5]); target_values[3] = fromhex (& input [7]); } else { Serial.println("Wrong length of input"); } Serial.print("New color values: "); Serial.println(input); for (int i = 0; i < NUM_CHANNELS; i++) { Serial.print(target_values[i]); Serial.print(", "); } Serial.println(""); Serial.print("Dimming: "); Serial.println(dimming); } // converts hex char to byte byte fromhex (const char * str) { char c = str [0] - '0'; if (c > 9) c -= 7; int result = c; c = str [1] - '0'; if (c > 9) c -= 7; return (result << 4) | c; }
-
@Jan-Gatzke Thanks, I'll try that later although it doesn't look much different from mine. May I ask why you are using V_VAR1/2 types in your sketch? And why you send answer messages? Are you using home assistant (thats the only one where this is need imho)?
-
I am using Domoticz. This was the only way reading initial values from the controller. Directly requesting the value of a child did not work for me. Meanwhile MySensors support in Domoticz seems extremly bugy and uncomplete to me. I am going to give OpenHAB2 a try.
-
@Jan-Gatzke Ah ok nice to know. I am facing the same problem. RGBW is not that well supported in domoticz. I am currently trying to switch to openhab2 but having some problems with my RGBW nodes there too. Development on the plugin seems to be very active though. If you want to follow the discussion have a look at the forum thread here or on github
Once I got everything up and running in openhab I'll post an update here.Meanwhile the newest sketch from my github should work with Home assistant too.
-
I just assembled my first OH! My... board and realized that the V2 sketch doesn't work for me.
Anyways I'm posting a sample sketch for testing the board:#define RED_PIN 3 #define GREEN_PIN 5 #define BLUE_PIN 6 #define WHITE_PIN 9 #define ON 100 // Please, don't burn my eyes #define OFF 0 #define ON_INTERVAL (3*1000ul) void setup() { // Setting pins to output and low is not required for analogWrite. Serial.begin(115200); } void loop() { analogWrite(RED_PIN, ON); Serial.println(F("**RED**")); delay(ON_INTERVAL); analogWrite(RED_PIN, OFF); analogWrite(GREEN_PIN, ON); Serial.println(F("**GREEN**")); delay(ON_INTERVAL); analogWrite(GREEN_PIN, OFF); analogWrite(BLUE_PIN, ON); Serial.println(F("**BLUE**")); delay(ON_INTERVAL); analogWrite(BLUE_PIN, OFF); analogWrite(WHITE_PIN, ON); Serial.println(F("**WHITE**")); delay(ON_INTERVAL); analogWrite(WHITE_PIN, OFF); }
-
@Sergio-Rius Nice to hear! And good idea with the test sketch.
What exactly did not work with my sketch? I would really like to fix it (for others too).
-
@LastSamurai I'm using Domoticz. With your sketch, turning on and off worked.
But whenever it had any rgb value, the white light was always 100% on. The RGB leds where all three lit at a time and never more than 20% but slightly responded to dimming control.The above code from @Jan-Gatzke works flawlessy. Even turns the white leds on when reaching the white band on the gradient.
Only I would like it to not turn off the color leds until the selected color is totally or almost white, so we could white-wash the selection.Oh, men... soldering those mosfets turned around was so difficult. I recommend the next who buys boards to use the new designs.
Give me some time and I'll give a turn to the sketch. But I'm still working on the "water-heating-solar-controller", and still have to assemble the energy monitor board, and do something with the meteo board.
-
@LastSamurai I have some doubts on this code, can I ask you?
The change between color values is done by a fade, and I understand that you don't want a linear change but an exponential one. Right?One doubt i have is that I'm seeing that the fade is accomplished using a conversion array. So you are doing variable steps depending on the difference of value for each channel. Wouldn't be preferable to always take the same amount of time/steps doing the change?
Wouldn't be better to divide the difference for each value on the same steps and then doing the transformation. Then could be fixed without an array.
Sorry if I wrote something wrong. My english it's not so good.
-
The problem with the linear fading was that a value of 100 almost looked the same as 150. So the goal was to make the fading look more linear. The logarythmic calculations needed for this cannot be done on an atmega 328p. (I tried it)
This is why I calculated the values with MS Excel and put them in an array.Making the fading process alway take the same time would be nice. Feel free to post your implementation.
-
@Jan-Gatzke @LastSamurai I've been playing with the formula of the blog post written in comments on the sketch and I see that this isn't something trivial.
I think the code in the post has a misconception, that using 0-255 he missed that the graph data is not related to time, but pwm value.So a fixed table for conversion between pwm value and appreciated light has to be built. And you also arrived to this conclusion seeing the array.
I'm generating the array on the fly using the formula with 256 steps.
(In the blog code there's a bug caused by the mean of zero in intervals and the formula that causes max value to being reached. You have to sum one to interval before using on the formula.)I'm now trying to separate a loop for traveling the array that compensates for in between values so it can handle smaller steps->variable interval.
Sorry. Just thinking out loud.
-
I've been working on an sketch for this board. Somewhere in the path I started adding functionalities and it ended in a library. Perhaps it's way overkill, but I thought that could be easier add it to NodeManager like that.
It's based on the work done here and some more ideas around the network. Thanks to LastSamurai for the board and code and also to Jan.
You can find the sources there: https://github.com/SergioRius/RGBWDimmerThis thing includes a serial manager that I use myself, but you can remove it and delete all the code for debugging, and perhaps add yourselves if necessary.
Just clone the repo or download and install as a zip library on Arduino IDE.
The example works for the OH! MySensors RGBW board as is.It's very self explanatory in the code, but in essence:
- It can be used stand-alone or with mysensors
- You simply send to the commands and the class does all for you.
- Uses a non blocking system for the fading.
- Configurable fading time and resolution
- Several configurable fading curves
- Option for gamma (brightness + hue) calibration.
I'm currently debugging the fading curves equations other than linear, as the arduino mcu capabilities are tight and it's so easy to overflow it. Also I'm doing a program for calibrating the hue (arduino with leds and a rotary encoder for manually adjusting), so for now gamma only compensates brightness. You can change the values if you prefer. I'll be a good idea to lower the white channel.
It still lacks some memory optimization, but for now I'm scared about overflows. I got one of those and it was a two days nightmare and I had to revert to ints to get something running.
I'll soon add a stand alone sample and port to NodeManager.
For the while, for using it alone the minimal it's:#include "RGBWDimmer.h" RGBWDimmer myDimmer(1, 3, 5, 6, 9); ///< id (to remove), Red Pin, Green Pin, Blue Pin, White Pin bool JustDontBlockLoop = true; void loop() { if(JustDontBlockLoop) { myDimmer.setNewValues(255, 0, 150, 0); ///< RGBW decimal values. If you prefer hex, use setNewValuesHex myDimmer.StartFading(); JustDontBlockLoop = false; } myDimmer.loop(); }
I hope you like it. And if you have any idea for adding functionality, please tell me.
-
I updated the repo for being easier to download and install.
-
Wow nice! Might take me some time, but I will take a look at your code (and maybe add some of its features back to my sketches if that fine with you).
-
@LastSamurai Yes, of course.
Just a question. How did you make the "values curve"? You said in excel and perhaps a graph... did you manage to change graph values and update data in any way?I've made the sketch for adjusting the gamma values, something with a Serial monitor menu that allows for increasing and decreasing the channels in real time. And adjusted the greens for a better hue (orange being orange, not a greenish yellow) but now I do't know how to adapt the curve.
I refuse to modify the 255 values by hand.Now I'm making a case for 3d-print. Where do I have to post it, there or in a separate post? I read anything about posts becoming entries at hardware.io and ¿build?
-
Do you really need an external voltage regulator for this module? I mean the Arduino Pro Mini has its linear regulator already built in. You can only draw about 100ma from it, but wouldn't that be sufficient for the micro, radio and the mosfet gates?
-
@ThetaDev Maybe you you could get away with it but especially the radio is very sensitive concerning the power supply. Cheap pro minis often use very cheap regulators too and then this might become a problem.
I also wanted to support the high power version of the NRF and that definitly needs more power than provided by the onboard regulator.
-
Hi
How i can modify sketch files INO to use it with radio RFM69HW with this adaptaer:
https://www.openhardware.io/view/16/NRF2RFM69#tabs-design
-
I never tried that but as far as I know you have to tell Mysensors to use a different kind of radio by adding a define like:
#define MY_RADIO_RFM69
Just do a quick search on this forum though
-
And your project works also with Home Assistant ?
Can you show how it looks in your automation ? Which controller you use ? (Domoticz or other)
And on MySensors 2.2.0 this also works ?
-
I only had Home Assistant installed for some days (did not really like it at the time) so I can't tell you that it works 100% but it did back then. You have to add some strange additional messages but I tried to integrate that into my code.
I am using my RGBW controllers with openhab 2 in one location and with domoticz in another. As it is controlled by MySensors it works (and looks) pretty much like any other mysensors node. Both installations run on 2.2. Hope this helps
-
@lastsamurai
Very thanks for info. I try build and test with Home Assistant.
-
Mmmmm... How much have you pushed this board? I mean, in terms of load.
I just had one fail at me and I'm trying to understand what component may have been the weak link.It was driving a 5m white stripe when it turned himself off and on again, but although the light was still on the node was down. I took it out and almost burned my hand. Not the mosfets, but the arduino and radio. Nothing seems bad (components good looking, arduino seems to start) but as soon as you apply 12v, even without load it starts the barbecue.
It seems that the mosfets are good to 4,2Ah if I understand it. So what would be the boards specs?
-
Have you checked the voltage on the arduino?
-
@gohan As you suspected, it was 12v.
-
No wonder why it got hot, poor little arduino
-
@gohan Yeah, but what is not that intiutive for me is why when load increases in the mosfets side, the ams regulator goes away.
Anyways, no one knows what max led strip length is this board good for?
-
https://www.openhardware.io/view/559/LED-RGBW-Controller
You may also consider this one
-
@sergio-rius A little late, sorry, but that depends on the mosfets you are actually using. I am driving ~5m strips of white leds with most of my controllers and they don't even really get hot.
There is also a big(ish) update from my side concerning this project: I have designed, 3d printed and tested my own case for the controllers and they work great. I have just added the stl files and some images to the project page!!
For now this project is done from my side. The controllers have been working great for the past 2 years but due to the "huge" (~1s) delay with my Mysensors network (with signing and openhab on a raspi) when switching the leds I am currently testing some MQTT and wifi based RGBWW controller boards as an alternative.
-
Hello
How long led strips in meters i can connect to this device ? What max power led strips support it ?
-
Why on 5 picture POWER MOSFET IRLM2502 is other side solder than on picture 9 ?
-
Hi
I build this project but i want use it with radio RFM69HW and controller Home Assistant. But it not working with Home Assistant. Not connect with gateway on my RPI3b+. Other node with this radio connect ok. I dont know why ?Radio works and show this:
| / |_ / | ___ _ __ ___ ___ _ __ ___
| |/| | | | _ \ / _ \_ \/ __|/ _ \|
_/ __|
| | | | || || | / | | _ \ _ | | _
|| ||_, |/ ___|| ||/_/|| |/
|__/ 2.2.016 MCO:BGN:INIT NODE,CP=RPNNA---,VER=2.2.0
26 TSM:INIT
28 TSF:WUR:MS=0
30 TSM:INIT:TSP OK
32 TSM:INIT:STATID=61
34 TSF:SID:OK,ID=61
36 TSM:FPAR
1038 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
3045 !TSM:FPAR:NO REPLY
3047 TSM:FPAR
4050 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
6060 !TSM:FPAR:NO REPLY
6062 TSM:FPAR
7065 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
9072 !TSM:FPAR:NO REPLY
9074 TSM:FPAR
10076 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
12083 !TSM:FPAR:FAIL
12085 TSM:FAIL:CNT=1
12087 TSM:FAIL:DIS
12089 TSF:TDI:TSL
22093 TSM:FAIL:RE-INIT
22095 TSM:INIT
22097 TSM:INIT:TSP OK
22099 TSM:INIT:STATID=61
22104 TSF:SID:OK,ID=61
22106 TSM:FPAR
23109 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
25116 !TSM:FPAR:NO REPLY
25118 TSM:FPAR
26120 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
28127 !TSM:FPAR:NO REPLY
28129 TSM:FPAR
29132 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
31139 !TSM:FPAR:NO REPLY
31141 TSM:FPAR
32143 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
34150 !TSM:FPAR:FAIL
34152 TSM:FAIL:CNT=2
34154 TSM:FAIL:DIS
34156 TSF:TDI:TSL
-
Do you see any error in the gateway log?
-
This from gateway:
pi@hassbian:~/MySensors $ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0
mysgw: MCO:BGN:INIT GW,CP=RPNGL---,VER=2.2.0
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: Listening for connections on 0.0.0.0:5003
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0Other node works ok with this gateway.... Only this RGNW not working.
This is log from gateway with connectionm with other node:
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
mysgw: TSF:MSG:PINGED,ID=30,HP=1
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
mysgw: TSF:MSG:READ,30-30-0,s=255,c=0,t=18,pt=0,l=5,sg=0:2.2.0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=11,pt=0,l=24,sg=0:Cover Roleta Sypialnia__
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=12,pt=0,l=4,sg=0:20.0
mysgw: TSF:MSG:READ,30-30-0,s=1,c=0,t=5,pt=0,l=21,sg=0:Roller Shutter for HA
mysgw: TSF:MSG:READ,30-30-0,s=21,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=41,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=29,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:99
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:98
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:97
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:96
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:95
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:94
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:93
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:92
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:91
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:90
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:89
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:88
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:87
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:86
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=31,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:86
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=31,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:86
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:87
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:88
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:89
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:90
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:91
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:92
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:93
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:94
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:95
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:96
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:97
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:98
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:99
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=29,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=30
mysgw: TSF:PNG:SEND,TO=0
mysgw: TSF:CKU:OK
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,30-30-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=30
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
mysgw: TSF:MSG:PINGED,ID=30,HP=1
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
mysgw: !TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=11,pt=0,l=24,sg=0:Cover Roleta Sypialnia__
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=12,pt=0,l=4,sg=0:20.0
mysgw: TSF:MSG:READ,30-30-0,s=1,c=0,t=5,pt=0,l=21,sg=0:Roller Shutter for HA
mysgw: TSF:MSG:READ,30-30-0,s=21,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=41,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
-
I found one bug in your project PCB. Pin from radio nae IRQ should be connect on PCB to pin 2 ARDUINO. But it is not connect. Also when i use radio RFM69HW i also need connect PIN 2 Arduino to pin DI00 on radio RFM69HW. This should be correct... Now pin 9 from radio is not connect to any pin Arduino.
On RFM69HW all works ok. In previus post my radio is fix.
-
Hi
Is any chance to implement in sketch option to Node after connect power go to state OFF. Now it go to ON. In situation when power lost and come back all leds will be ON.and is any chance to implement in your sketch option to add manual button to enable LEDS color WHITE ?
Any color i want to setup by gateway but on the wall i want mount switch to enable color white and also to disable.
Please add this if you can... In sketch setup pin on which button works and also color which should be turn on....
-
This post is deleted!
-
@aramko at first, he shared a link with the preloaded board on dirtypcbs (http://dirtypcbs.com/store/designer/details/7078/867/mysensors-rgbw-controller-v1-3).
If you want to upload the files by yourself, you have to zip all the files and upload them.. take a look here under "ordering" (https://dirtypcbs.com/store/pcbs/about)
-
Hi
Can you share me file for board for this to print on 3D.
-
@pepson there are a case ready to download and print
go to design files and take the stl files..
rgbwCaseTopV2.stl
rgbwCaseBottomV2.stl
-
@wesley
Ok sorry i see. Sorry
-
With how long max tape you test it ? I have a living room and i need control RGBW with about 16 meters.... I can use your controller ?