RGB(W) arduino device

Hek,

What is the status of this project? I was thinking of using one of the arduinos to control some rgb led strips for lighting. Was not sure if the Arduino plugin would be of good use since most of the building blocks are there. Some of the things I would like to have the arduino do for controlling the led strip would be the following:

  1. Control the hue, saturation, and brightness of the led strip
  2. Provide the status of the led strip, hue, saturation, on / off, etc

Would this be possible with the current plugin state?

  • Garrett

You could easily create 3 vera dimmer-device (like fibaro RGBW controller does) to control the arduino from vera.
Bu have you figured out a way to control the RGB led strip? How will you power it? Which model are you planning to use?

Would this work?

[quote=“hek, post:359, topic:176573”]Yes, this would work fine! Thanks for the link korttoma!
You could even create your own device type with 3 slides if you want a nicer vera gui. I’ll add it to the repo when or if you choose this solution.[/quote]

@hek
If you invest some time and do some implementation regarding this please keep in mind that some people would probably like to use RGBW LED strips. Red, Green, Blue AND WHITE. Basicaly 4 channels instead of 3.

@RTS
There are different NRF24L01 boards available. Search for NRF24L01+PA+LNA you should find one that promis a range of a 1000m.

[quote=“korttoma, post:4, topic:178207”][quote=“hek, post:359, topic:176573”]Yes, this would work fine! Thanks for the link korttoma!
You could even create your own device type with 3 slides if you want a nicer vera gui. I’ll add it to the repo when or if you choose this solution.[/quote]

@hek
If you invest some time and do some implementation regarding this please keep in mind that some people would probably like to use RGBW LED strips. Red, Green, Blue AND WHITE. Basicaly 4 channels instead of 3.

@RTS
There are different NRF24L01 boards available. Search for NRF24L01+PA+LNA you should find one that promis a range of a 1000m.[/quote]

Hek will incorporate the changes. He will not be doing any of the dirty work (unless he wants to :slight_smile: ). I am going to try and tackle this. I need to brush myself up with the latest code as a lot has changed when it first started. Right now I am going to focus on RGB as they are cheaper and this will be for accent lighting.

  • Garrett

[quote=“hek, post:359, topic:176573”]Yes, this would work fine! Thanks for the link korttoma!
You could even create your own device type with 3 slides if you want a nicer vera gui. I’ll add it to the repo when or if you choose this solution.[/quote]

This may be overkill, but 4 devices will be used, 3 sliders to control the red, green blue and another device that will handle the ability to set hue, saturation, brightness, etc. Two downsides to this, one is that there will be many devices for control, two is that Vera only allows 10% increments for the sliders. This should not be affected by 3rd party apps.

What code base should I be working from 1.3beta1? I am going to need to spend some time looking over the code to understand it all. A lot has changed since this project first started. Is there anything I need to know?

  • Garrett

@garrettwp
Are you thinking of the limitations of a Vera Dashboard ?
I think that it’s time to introduce and standardize on a 4 Channel Light that can degrade to:
4-Channel Lightness Slider for White + 3 Channel.
3-Channel RGB or CMY, or Hue, Saturation, Lightness models .
1-Channel - Lightness
It would be terrible for your nice mobile app to have 4 sliders with Vera’s Increment Limitations.
A nice light Color selector of appropriate light model would be much nicer.

These lights are not going away and are only going to become more common.

[quote=“RichardTSchaefer, post:7, topic:178207”]@garrettwp
Are you thinking of the limitations of a Vera Dashboard ?
I think that it’s time to introduce and standardize on a 4 Channel Light that can degrade to:
4-Channel Lightness Slider for White + 3 Channel.
3-Channel RGB or CMY, or Hue, Saturation, Lightness models .
1-Channel - Lightness
It would be terrible for your nice mobile app to have 4 sliders with Vera’s Increment Limitations.
A nice light Color selector of appropriate light model would be much nicer.

These lights are not going away and are only going to become more common.[/quote]

Richard,

My app already uses the color wheel for Philips Hue and MiLight/LimitlessLED plugins. So this should not be an issue when developing the device. I would also hate the additional sliders, but I am looking at it from a Vera user stand point. Not all Vera users use my app or other 3rd party apps that may implement the color wheel. I believe HomeWave does something similar for the Hue and MiLights. So I need to take that into consideration.

I am putting a parts list together on ebay. Found a seller a state away that sells the rgb led strips and power supply for cheap. I only need less than 5 meters for now. RGB+W are more expensive, but hopefully should not be hard to add the code to support them. The hardest part is brushing myself up with the Arduino plugin and how it works.

So for the 4 channel white and the 1 channel, it should use the brightness code?

  • Garrett

Hek,

I am starting to work on the LED control code and wanted to make sure it was ok to create additional variable types? For example, I wanted to create V_HUE, V_SAT, V_RGB, etc. I also noticed that certain device types are not populated in the L_Arduino.lua file (Lock and IR). I am going to go ahead and add that to the current code so I can add the additional device types. Is there anything I should not do to mess up your code?

Also we should probably come to an agreement with the standardization of sensors found here:

http://forum.micasaverde.com/index.php/topic,11815.0.html

  • Garrett

I have not checked in my local L_Arduino.lua (which contains Lock, and Ir device) yet because it’s not quite finished :slight_smile:

	LOCK = 		  {19, "urn:micasaverde-com:serviceId:DoorLock1", "D_DoorLock1.xml", "Lock "},
	IR = 		  {20, "urn:schemas-arduino-cc:device:ArduinoIr:1", "D_ArduinoIr1.xml", "IR "}

Guess you want to add a new RGBW device type as well. I will make sure the order/ids will be correct later when merging your code.

Yes… the standardization… don’t really know how to proceed on that…

Hek,

Thanks for splitting up the topic. I’ll add those values to the existing one so I can add my additional ones.

  • Garrett

I’we been looking in to this RGB(W) a bit today and it seems there are not enought PWM outputs on the Pro mini for all four channels.

PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.

Only 3,5 and 6 are free since the radio is using 9,10 and 11.

I guess the easiest solution would be to have a separate arduino for white using a normal dimmer sketch and separate arduino for RGB sketch.
Unless there is a easy way to free one more PWM from the radio side.

Any thoughts on this?

The PWM outputs are on pins:

3, 5, 6, 9, 10, and 11

To use SPI we have to make use of pins:

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK)

Leaving PWM pins:

3, 5, 6 and 9

Pin 9 is used by the radio as the Radio Chip Enable. It just needs to be reassigned to another pin. These pins are left over:

0 - used as RX in by the FTDI
1 - used as TX out by the FTDI
2 - Radio IRQ pin
4 - used by the SD card reader on some gateway style larger PCBs with Ethernet
7 - RX error LED on gateway only
8 - RX LED on gateway only

I would suggest pin 4 be used for the Radio Chip Select; leaving pins 3, 5, 6 and 9 for PWM.

This would disallow the use of I?C (I-squared-C) - not too bigger a loss - I?C uses these pins:

4 (SDA) and 5 (SCL)

@garrettwp - you may want to try some of these LEDs using the Teensy:

http://www.pjrc.com/teensy/td_libs_OctoWS2811.html

The Teensy board uses DMA to run the LEDs making “light work” of the job - could have it ready for next Xmas.

It’s now integrated into the Arduino environment and it uses a very powerful processor:

http://www.pjrc.com/teensy/teensyduino.html

Thanks for the tip. I already have a Teensy that I bought about a year or so ago and not using. The LED strips I would be powering are not individual addressable but a single pwm type strip.

  • Garrett

Is it teensy 3.0 or 3.1 cause I think the memory is 16k vs 64k.

Has anyone else made any progress on this?

I have just finished the hardware part and are using a simple sketch to test the hardware.

Now since I chose to make a 4 channel RGBW type I would need to free up the pin 9 to be used for one of them. (pin 9 is currently used for radio as the Radio Chip Enable)
So how do I change the Radio Chip Enable to use pin 4???
Any help would be appreciated.

[quote=“korttoma, post:17, topic:178207”]So how do I change the Radio Chip Enable to use pin 4???
Any help would be appreciated.[/quote]

Just change the first argument to the constructor if the MySensor library.

Instead of:

Sensor gw(9, 10);
do

Sensor gw(4, 10);

Bah, thanks hek. I newer would have thought it was that easy…

Now if anyone has an example sketch of a dimmer device it would save me a ton of time to finish the rest of the code.

// Present the dimmer device (one for each channel) gw.sendSensorPresentation(<childId>, S_DIMMER);

Look at the Relay-example sketch on how to listen to values coming from Vera-side. For dimmer level check the V_DIMMER-variable of the child-device you created above.