OH MySensors RGBW Controller

RGBW Lighting

I love the new possibilities that modern leds provide (cheap, efficient, small, ...) and I wanted a nice project to play with for my home automation. As I could only find a dimmer for one-color-leds and domoticz and mysensors recently added support for rgb(w) lighting I started to build a control pcb for just that.

I got some help here.

Hardware

The board

The board should be relativly easy to build and use and shouldn't be too big. The maximum size was 5x5cm as thats what cheap pcb manufactures mostly support. In the end I used a 30 by 50mm board with rounded edges and 2 mounting holes. enter image description here

The components

I tried to use small but easy to solder components. IRML2502 mosfets in a smd formfactor are used to control the channels of the leds. They are pretty small but one can still solder them by hand without too many problems. I had an earlier version where I used through hole mosfets but these take up a lot of space. An AMS1117 is used to generated the 3.3V from the 12V (led power) input. I tried a buckconverter for more efficiency but these need a lot of filters otherwise the radio doesn't work anymore. As the whole thing doesn't draw too much power a linear regulator should be sufficient. The core is an arduino pro mini. That one is cheap and already has all components it needs to run. Perhaps I will create another version with just the atmega 328P but at the moment this is the easiest solution. Beside the NRF24L01+ radio I and some passive components I also added an ISP programmer 6-pin port to be able to change the program without using the serial connection if need be.

The enclosure - Added 08.2018

I recently got a 3d printern and so I started to design and print a custom enclosure for my RGBW controller(s). It features labels on the front, a mounting point for cable management on the side and standoffs with screw holes for the pcb on the inside. The front has a matching cutout to connect all cables otherwise its closed. The lid just clips in and can be (re)opened at any time.

The cases work great for me you only need to trim the headers on the pro mini (if they are soldered at all). The stl files can be found here and on my github repo if you want to print some enclosures too.

Software

At the moment the software relies on domoticz as a controller or some software that sends the same kind of information. The program stores the current target level for the leds which it gets from domoticz and then fades from its current values to the target ones. As the human eye doesn't see changes in brightness linearly I tried to use non linear scaling for but that doesn't seem to work yet.

Update: I just added a newer version of my sketch that is based on MySensors 2. The most update-to-date version can always be found in my github repo.

Mounting

I build a custom lighting system for my living room which uses this controller. It's still work in progress but I will try to upload some pictures soon.

TODOS

  • Make non linear fading work

Errors

The old version (that I have tested and where these pictures are from) had an error where I switched outputs for the mosfets! They have to be rotated to work! In the newest (gerber) files in the linked github repo I fixed these mistakes. Although I haven't tested these new boards (yet) they should work without this fix now. Wrong: Wrong pins for the mosfets Right: Right pins for the mosfets

Update: 5 RGBW controllers using the first generation (with the switched mosfets) have been running here for months now without error.

Update2: They have been running for about 2 years now mostly without problems. The only disadvantage is that my Mysensors network overall is quite "slow" (~1s reaction time). I am currently experimenting with Wifi RGBWW controllers (H801) so there wont be to many more updates to this project

PCB

The pcb can be bought here. Read the error part above!

Images

Design Files

Source Code

NameSize# Downloads
RGBWDimmer.ino6.73 kB3584
RGBWDimmerV2.ino6.97 kB3565

Bill of Material

QtyValueDevicePackagePartsDescriptionMFMPNAliexpress or Ebay link
1Arduino Pro Mini
1NRF24L01+
16 Pin Connector
4IRLML2502MosfetSOT-23
1AMS1117
122uF tantal capacitor
147uF capacitorRadial
410k resistorSMD 1206
15 pin screw terminal
12 pin screw terminal

Comments

  • pepson commented 6 years ago

    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 ?

  • pepson commented 6 years ago

    @wesley
    Ok sorry i see. Sorry 🙂

  • Wesley commented 6 years ago

    @pepson there are a case ready to download and print
    go to design files and take the stl files..
    rgbwCaseTopV2.stl
    rgbwCaseBottomV2.stl

  • pepson commented 6 years ago

    Hi
    Can you share me file for board for this to print on 3D.

  • Wesley commented 6 years ago

    @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)

  • pepson commented 6 years ago

    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....

  • pepson commented 6 years ago

    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.

  • pepson commented 6 years ago

    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:0

    Other 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

  • gohan commented 6 years ago

    Do you see any error in the gateway log?

A forum thread is automatically created for each project and article in the OpenHardware/MySensors forum. To make comments here, you must have a separate forum user account. Comment