Hello I would like to know if it's possible to use a "8 Channel AC Light Dimmer Module Arduino"
to control and dimmering led spot.
https://www.youtube.com/watch?v=yeU55jsB7AM
Do you have some ideas about the code I need use to use it?
Thanks a lot
Greg
Use a multiple dimmer? like 8 Channel AC Light Dimmer
-
- Posts: 20
- Joined: 26 Aug 2016 11:43
Re: Use a multiple dimmer? like 8 Channel AC Light Dimmer
Not sure what protocol this board uses.
Seems you need to detect interrupts on each channel and do pin on/off. This is not possible with Z-Uno. In future Z-Uno will be able to track one interrupt.
Seems you need to detect interrupts on each channel and do pin on/off. This is not possible with Z-Uno. In future Z-Uno will be able to track one interrupt.
-
- Posts: 20
- Joined: 26 Aug 2016 11:43
Re: Use a multiple dimmer? like 8 Channel AC Light Dimmer
Hello,
Thanks for your answer. I have found an example of sketch to use this 8 channel AC light Dimmer with arduino. Do you have an idea if the compatibility with your z-uno ?
See you soon
Greg
Thanks for your answer. I have found an example of sketch to use this 8 channel AC light Dimmer with arduino. Do you have an idea if the compatibility with your z-uno ?
See you soon
Greg
Code: Select all
#include <TimerOne.h>
unsigned char channel_1 = 4; // Output to Opto Triac pin, channel 1
unsigned char channel_2 = 5; // Output to Opto Triac pin, channel 2
unsigned char channel_3 = 6; // Output to Opto Triac pin, channel 3
unsigned char channel_4 = 7; // Output to Opto Triac pin, channel 4
unsigned char channel_5 = 8; // Output to Opto Triac pin, channel 5
unsigned char channel_6 = 9; // Output to Opto Triac pin, channel 6
unsigned char channel_7 = 10; // Output to Opto Triac pin, channel 7
unsigned char channel_8 = 11; // Output to Opto Triac pin, channel 8
unsigned char CH1, CH2, CH3, CH4, CH5, CH6, CH7, CH8;
unsigned char CHANNEL_SELECT;
unsigned char i=0;
unsigned char clock_tick; // variable for Timer1
unsigned int delay_time = 150;
unsigned char low = 70;
unsigned char high = 5;
unsigned char CH[]={CH1,CH2,CH3,CH4,CH5,CH6,CH7,CH8};
void setup() {
//CH1=CH2=CH3=CH4=CH5=CH6=CH7=CH8=95;
pinMode(channel_1, OUTPUT);// Set AC Load pin as output
pinMode(channel_2, OUTPUT);// Set AC Load pin as output
pinMode(channel_3, OUTPUT);// Set AC Load pin as output
pinMode(channel_4, OUTPUT);// Set AC Load pin as output
pinMode(channel_5, OUTPUT);// Set AC Load pin as output
pinMode(channel_6, OUTPUT);// Set AC Load pin as output
pinMode(channel_7, OUTPUT);// Set AC Load pin as output
pinMode(channel_8, OUTPUT);// Set AC Load pin as output
attachInterrupt(1, zero_crosss_int, RISING);
Timer1.initialize(100); // set a timer of length 100 microseconds for 50Hz or 83 microseconds for 60Hz;
Timer1.attachInterrupt( timerIsr ); // attach the service routine here
}
void timerIsr()
{
clock_tick++;
if (CH1==clock_tick)
{
digitalWrite(channel_1, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_1, LOW); // triac Off
}
if (CH2==clock_tick)
{
digitalWrite(channel_2, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_2, LOW); // triac Off
}
if (CH3==clock_tick)
{
digitalWrite(channel_3, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_3, LOW); // triac Off
}
if (CH4==clock_tick)
{
digitalWrite(channel_4, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_4, LOW); // triac Off
}
if (CH5==clock_tick)
{
digitalWrite(channel_5, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_5, LOW); // triac Off
}
if (CH6==clock_tick)
{
digitalWrite(channel_6, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_6, LOW); // triac Off
}
if (CH7==clock_tick)
{
digitalWrite(channel_7, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_7, LOW); // triac Off
}
if (CH8==clock_tick)
{
digitalWrite(channel_8, HIGH); // triac firing
delayMicroseconds(5); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_8, LOW); // triac Off
}
}
void zero_crosss_int() // function to be fired at the zero crossing to dim the light
{
// Every zerocrossing interrupt: For 50Hz (1/2 Cycle) => 10ms ; For 60Hz (1/2 Cycle) => 8.33ms
// 10ms=10000us , 8.33ms=8330us
clock_tick=0;
}
void loop() {
CH1=high;CH2=low;CH3=low;CH4=low;CH5=low;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=high;CH3=low;CH4=low;CH5=low;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=high;CH4=low;CH5=low;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=high;CH5=low;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=low;CH5=high;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=low;CH5=low;CH6=high;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=low;CH5=low;CH6=low;CH7=high;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=low;CH5=low;CH6=low;CH7=low;CH8=high;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=low;CH5=low;CH6=low;CH7=high;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=low;CH5=low;CH6=high;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=low;CH5=high;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=low;CH4=high;CH5=low;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=low;CH3=high;CH4=low;CH5=low;CH6=low;CH7=low;CH8=low;
delay(delay_time);
CH1=low;CH2=high;CH3=low;CH4=low;CH5=low;CH6=low;CH7=low;CH8=low;
delay(delay_time);
}
-
- Posts: 20
- Joined: 26 Aug 2016 11:43
Re: Use a multiple dimmer? like 8 Channel AC Light Dimmer
Hello,
I have tried to compile the code into arduino interface.
Only to thinks don't run correctly:
One library: "TimerOne"
One Function: attachInterrupt()
Have you the possibility to add it to the next C++ compiler?
Thanks a lot
Greg
I have tried to compile the code into arduino interface.
Only to thinks don't run correctly:
One library: "TimerOne"
One Function: attachInterrupt()
Have you the possibility to add it to the next C++ compiler?
Thanks a lot
Greg
Re: Use a multiple dimmer? like 8 Channel AC Light Dimmer
attachInterrupt is not yet implemented. Interrupts are very tricki not to kill Z-Wave radio! Timers (also internally use interrupts) are also not easy... This is subject to 2.0.7 (next after next)
-
- Posts: 20
- Joined: 26 Aug 2016 11:43
Re: Use a multiple dimmer? like 8 Channel AC Light Dimmer
Thanks a lot for all your job.
Good luck.
I have just received my z-uno and I will try some test very soon.
See you soon
Greg
Good luck.
I have just received my z-uno and I will try some test very soon.
See you soon
Greg