A few months ago, I wrote some posts about PCA9634 LED driver. Today, we are to going to do a practical application of published module. We are going to make RGB LED strip wireless controller. More inside…
Picture below describes interconnection between PCA9634 module ULN2803 and LED strip. I used 3 pins of ULN for each color because of current limit of ULN. You can use another transistor of course.
Software
I used software for PCA9634 EVM described in this post: Wireless LED driver with PCA9634 II – PC application and added new command ‘C’ for Remote controller. This command handles 6 buttons of Remote controller.
if (bufferRF[2] == 'C') // Set register { // Write register R if (bufferRF[4] & 0x20) { if (RGB_R < 250) RGB_R+=5; PCA9634_WriteReg(PCA9634_REG_PWM0,RGB_R); } // Write register R if (bufferRF[3] & 0x02) { if (RGB_R > 4) RGB_R-=5; PCA9634_WriteReg(PCA9634_REG_PWM0,RGB_R); } ... |
Remote controller source code had to be changed too. I had to add ‘C’ command indicator, remove battery measurement and add address of target device…
read_IO(); // read buttons bufferRF[0] = 0x12; bufferRF[1] = 0x34; bufferRF[2] = 'C'; bufferRF[3] = btns_L; bufferRF[4] = btns_H; if ((btns_L) || (btns_H)) timeout = 10; pulseLEDR(); // Pulse LED R PIN = 0; // P2P packet DLEN = 5; // data len = 5 RFTXpacket(); // Send it... waitDelay(5); // wait 50ms timeout -= 1; // decrease timeout |
And this is all. It is very simple, isn’t it? 🙂
Full source code for both, EVM and RC are attached.
Enjoy.