We have moved at community.getvera.com

Author Topic: RGB(W) arduino device  (Read 25046 times)

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
RGB(W) arduino device
« on: December 09, 2013, 04:47:58 am »
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

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: RGB(W) arduino device
« Reply #1 on: December 09, 2013, 06:51:45 am »
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?

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
- Tomas

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: RGB(W) arduino device
« Reply #3 on: December 09, 2013, 10:53:19 am »
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.

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

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: RGB(W) arduino device
« Reply #4 on: December 09, 2013, 12:44:03 pm »
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.

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

Hek will incorporate the changes. He will not be doing any of the dirty work (unless he wants to :) ). 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

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: RGB(W) arduino device
« Reply #5 on: December 09, 2013, 12:54:38 pm »
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.

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

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: RGB(W) arduino device
« Reply #6 on: December 09, 2013, 01:05:39 pm »
@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.



Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: RGB(W) arduino device
« Reply #7 on: December 09, 2013, 01:18:55 pm »
@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.

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

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: RGB(W) arduino device
« Reply #8 on: December 11, 2013, 03:14:22 am »
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
« Last Edit: December 11, 2013, 03:18:15 am by garrettwp »

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: RGB(W) arduino device
« Reply #9 on: December 11, 2013, 03:40:38 am »
I have not checked in my local L_Arduino.lua (which contains Lock, and Ir device) yet because it's not quite finished :)
Code: [Select]
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...
« Last Edit: December 11, 2013, 03:42:57 am by hek »

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: RGB(W) arduino device
« Reply #10 on: December 11, 2013, 03:54:03 am »
Hek,

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

- Garrett

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: RGB(W) arduino device
« Reply #11 on: January 08, 2014, 04:19:13 am »
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?
- Tomas

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 872
  • Karma: +66/-8
Re: RGB(W) arduino device
« Reply #12 on: January 13, 2014, 12:06:49 am »
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)

« Last Edit: January 16, 2014, 02:38:17 am by a-lurker »

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 872
  • Karma: +66/-8
Re: RGB(W) arduino device
« Reply #13 on: January 13, 2014, 12:15:29 am »
@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


Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: RGB(W) arduino device
« Reply #14 on: January 13, 2014, 01:04:06 am »
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