Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ETO's 2nd Annual Holiday Lighting Contest

Vote for the best Display

  • DirtyLude Posts #3, 11, etc

    Votes: 0 0.0%
  • delphijustin Post #9

    Votes: 0 0.0%

  • Total voters
    0
  • Poll closed .
Status
Not open for further replies.

3v0

Coop Build Coordinator
Forum Supporter
No prizes from ETO just a chance to strut you stuff. Bragging rights.
ETO will not provide prizes or oversee the award of prizes.

Others
my opt to provide prizes. If so they have sole responsibility for announcing the prizes in this thread and providing the prizes to the winners.
Rules

  • Any form of holiday illumination is acceptable.
  • You can not have entered it in last years lighting contest.
  • Anything you post to this thread will be considered for judging including progress reports. You can be a communicative or as secret as you like.
  • Winners/ranking will be determined by a member poll which will be attached to this thread on Jan 15 2011 and voting will continue for approximately two weeks.
  • Do not ask about the rules, there are none other then what is in this post.
 
I started this up a while ago, but I got distracted. I used to have red lights with blinking white around my garage, but with LED bulbs now I can't get that. I just made a 4 channel controller to control 4 strings of lights. The controller is complete and controls the four strings of lights, 2 white, and 2 red. I'm going to remake the control board part, since it's too complex now. I originally designed it with SD card control, but I found I can put in very complex and long patterns with very little memory and my idea of being able to change the patterns by just writing a new file to the SD card and plugging it in, seems nice, but based on the amount of times I'll change patterns it's a waste of time. It also turns everything on at dusk with a light sensor.

It's no crazy light show, but it's a start and my first try at doing mains control and dimming.

Only two of the plugs are connected in the picture, which was taken during original testing a few months ago.

I may do more before Christmas rolls around.
 

Attachments

  • 20100419-dimmer-001.jpg
    20100419-dimmer-001.jpg
    195.3 KB · Views: 444
Well hopefully folks here will be honest and enter their own work..... and not some cut n' paste photo of something off the web and claim it as theirs!!
 
Holiday lighting contest

I plan on entering the contest.....waiting for some parts to come in right now.
 
Bah humbug, now you kids get the hell off my lawn or I will get the hose out! :D

Still the contest sounds like fun though. :)
 
Only two of the plugs are connected in the picture, which was taken during original testing a few months ago.

Very neat and professional looking work DirtyLude, nice work!
 
USB LED Christmas lights

Here's my christmas lights powered by a USB port containing 35 LEDs and Resistors. All wired on a Speaker wire and usb cord. The red ones needed more resistance than the green ones so electricity would flow threw all LEDs. so theres 10 270 ohm resistors and 25 of 180 ohm resistors. In this video its running off of 5vdc 1a. I made the video with a webcam and thats why it is not the best. Next year i'm planning on making a thing that changes which set of LEDs are on and off every some milliseconds. So vote for me!
 
Last edited by a moderator:
My Vote and Opion

Here's my christmas lights powered by a USB port containing 35 LEDs and Resistors. All wired on a Speaker wire and usb cord. The red ones needed more resistance than the green ones so electricity would flow threw all LEDs. so theres 10 270 ohm resistors and 25 of 180 ohm resistors. In this video its running off of 5vdc 1a. I made the video with a webcam and thats why it is not the best. Next year i'm planning on making a thing that changes which set of LEDs are on and off every some milliseconds. So vote for me!

hey babe love the chritmas lights they are so cool u did a great job and keep it up y dont we go and yell at them for kick me out how rude love u and have a merry chritmas love u
 
Last edited by a moderator:
Okay, I finally finished off one of these things and need to assemble the other. I took a video of it doing a test pattern on my garage lights. Dims and flashes and patterns.


Here's the Eagle files for the controller and the power board that has the TRIACs and other high voltage stuff on it. The power board has 4 plugs on it, but you can stack 2 power boards together with one control board to control 8 lights in total.

https://www.higginstribe.com/uc/lpc1xxx/xmas-dimmer/light-control-lpc1313.zip

Here's the code: It's mostly just setup and switches to step through all the lights processing. It's all interrupt driven. The uC is an LPC1313 (it says LPC1114 on the schematics, but I used a 1313).
Code:
//Mark Higgins 2010
#include "LPC13xx.h"			/* LPC13xx Peripheral Registers */

#define ZERO_CROSS  ( 1 << 6)

#define LIGHT0      ( 1 << 0)
#define LIGHT1      ( 1 << 1)
#define LIGHT2      ( 1 << 2)
#define LIGHT3      ( 1 << 4)
#define LIGHT4      ( 1 << 11)
#define LIGHT5      ( 1 << 5)
#define LIGHT6      ( 1 << 6)
#define LIGHT7      ( 1 << 7)

typedef struct
{
uint16_t on_point;
uint16_t current_dim_value;
uint16_t irq_int_counter;
uint16_t *script;
} lights;

//COMMANDS
#define CMD_RETURN_TO_START     0 // no parameters
#define CMD_DELAY               1 //, delay
#define CMD_ON                  2 //, delay
#define CMD_OFF                 3 //, delay
#define CMD_MOVE_TO             4 //, target, steps
#define CMD_SYNC                5 // no parameters

const uint16_t script_light0[] = { CMD_ON ,      60,        CMD_OFF,         60,       CMD_OFF,        60,        CMD_OFF,      60,
                                   CMD_OFF,     200,        CMD_MOVE_TO,      1,    1, CMD_MOVE_TO,   450,    1,  CMD_ON,      400, 
                                   CMD_OFF,      60,        CMD_ON,          60,       CMD_OFF,        60,        CMD_ON,       60,
                                   CMD_MOVE_TO, 450,   4,   CMD_SYNC,                  CMD_RETURN_TO_START};
const uint16_t script_light1[] = { CMD_OFF,      60,        CMD_ON,          60,       CMD_OFF,        60,        CMD_OFF,      60,
                                   CMD_ON,      200,        CMD_MOVE_TO,    450,    1, CMD_MOVE_TO,     1,    1,  CMD_ON,      400,
                                   CMD_ON,       60,        CMD_OFF,         60,       CMD_ON,         60,        CMD_OFF,      60,
                                   CMD_MOVE_TO,   1,   4,   CMD_SYNC,                  CMD_RETURN_TO_START};
const uint16_t script_light2[] = { CMD_OFF,      60,        CMD_OFF,         60,       CMD_ON,         60,        CMD_OFF,      60,
                                   CMD_OFF,     200,        CMD_MOVE_TO,      1,    1, CMD_MOVE_TO,   450,    1,  CMD_ON,      400, 
                                   CMD_OFF,      60,        CMD_ON,          60,       CMD_OFF,        60,        CMD_ON,       60,
                                   CMD_MOVE_TO, 450,   4,   CMD_SYNC,                  CMD_RETURN_TO_START};
const uint16_t script_light3[] = { CMD_ON,       60,        CMD_ON,          60,       CMD_OFF,        60,        CMD_ON,       60,
                                   CMD_ON,      200,        CMD_MOVE_TO,    450,    1, CMD_MOVE_TO,     1,    1,  CMD_ON,      400,
                                   CMD_ON,       60,        CMD_OFF,         60,       CMD_ON,         60,        CMD_OFF,      60,
                                   CMD_MOVE_TO,   1,   4,   CMD_SYNC,                  CMD_RETURN_TO_START};
const uint16_t script_light4[] = { CMD_OFF, 60, CMD_SYNC, CMD_RETURN_TO_START};
const uint16_t script_light5[] = { CMD_OFF, 60, CMD_SYNC, CMD_RETURN_TO_START};
const uint16_t script_light6[] = { CMD_OFF, 60, CMD_SYNC, CMD_RETURN_TO_START};
const uint16_t script_light7[] = { CMD_OFF, 60, CMD_SYNC, CMD_RETURN_TO_START};

uint8_t current_light;
uint16_t timer_int_counter;

lights light[8];

int main( void)
{
  SystemInit();

  current_light = 0;

  light[0].current_dim_value = 1;
  light[0].irq_int_counter = 0;
  light[0].script = (uint16_t *)script_light0;

  light[1].current_dim_value = 1;
  light[1].irq_int_counter = 0;
  light[1].script = (uint16_t *)script_light1;

  light[2].current_dim_value = 1;
  light[2].irq_int_counter = 0;
  light[2].script = (uint16_t *)script_light2;

  light[3].current_dim_value = 1;
  light[3].irq_int_counter = 0;
  light[3].script = (uint16_t *)script_light3;

  light[4].current_dim_value = 1;
  light[4].irq_int_counter = 0;
  light[4].script = (uint16_t *)script_light4;

  light[5].current_dim_value = 1;
  light[5].irq_int_counter = 0;
  light[5].script = (uint16_t *)script_light5;

  light[6].current_dim_value = 1;
  light[6].irq_int_counter = 0;
  light[6].script = (uint16_t *)script_light6;

  light[7].current_dim_value = 1;
  light[7].irq_int_counter = 0;
  light[7].script = (uint16_t *)script_light7;

//GPIO setup
  //assign input for zero crossing
  LPC_GPIO0->DIR &= ~(ZERO_CROSS);
  LPC_IOCON->PIO0_6 |= (1<<5);          //turn on hysteresis
  //assign outputs
  LPC_IOCON->JTAG_TMS_PIO1_0 &= ~0x07;
  LPC_IOCON->JTAG_TMS_PIO1_0 |= 0x01;		//change P1_0 to GPIO
  LPC_IOCON->JTAG_TDO_PIO1_1 &= ~0x07;
  LPC_IOCON->JTAG_TDO_PIO1_1 |= 0x01;		//change P1_1 to GPIO
  LPC_IOCON->JTAG_nTRST_PIO1_2 &= ~0x07;
  LPC_IOCON->JTAG_nTRST_PIO1_2 |= 0x01;		//change P1_2 to GPIO
  LPC_GPIO1->DIR |= LIGHT0 | LIGHT1 | LIGHT2 | LIGHT3 | LIGHT4 | LIGHT5 | LIGHT6 | LIGHT7;
  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);  //enable GPIO clock
  NVIC_EnableIRQ(EINT0_IRQn);

//timer16 0 setup
  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7);
  LPC_TMR16B0->PR  = 0x08;         // set prescaler
  LPC_TMR16B0->MR0 = 30;         //load match register 0
  LPC_TMR16B0->MCR = 3;		  // Interrupt and Reset on MR0
  NVIC_EnableIRQ(TIMER_16_0_IRQn);

//timer16 1 setup
  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<8);
  LPC_TMR16B1->PR  = 0x01;         // set prescaler
  LPC_TMR16B1->MR0 = 2000;         //load match register 0
  LPC_TMR16B1->MCR = 3;		  // Interrupt and Reset on MR0
  NVIC_EnableIRQ(TIMER_16_1_IRQn);

  LPC_GPIO0->IS  &= ~(ZERO_CROSS);  //interrupt sense - 0 = edge sensitive
  LPC_GPIO0->IBE &= ~(ZERO_CROSS); //interrupt both edges - 0 = edge controlled by IEV
  LPC_GPIO0->IEV &= ~(ZERO_CROSS); //interrupt event reg - 0 = rising edge interrupt
  LPC_GPIO0->IE  |= (ZERO_CROSS);    //interrupt enable

  while( 1 );
}

void PIOINT0_IRQHandler(void)
{
  uint32_t regVal;

  timer_int_counter = 0;

  regVal =  LPC_GPIO0->MIS & (ZERO_CROSS);  //get interrupt status
  if ( regVal )
  {
    current_light = 0;
    while( current_light < 8)
    {
      light[current_light].irq_int_counter++;
      switch( *(light[current_light].script))
      {
      case CMD_DELAY:
        if( light[current_light].irq_int_counter > *(light[current_light].script + 1))
        {
            light[current_light].script += 2;
            light[current_light].irq_int_counter = 0;
        }
        break;
      case CMD_ON:
        light[current_light].current_dim_value = 1;
        if( light[current_light].irq_int_counter > *(light[current_light].script + 1))
        {
            light[current_light].script += 2;
            light[current_light].irq_int_counter = 0;
        }
        break;
      case CMD_OFF:
        light[current_light].current_dim_value = 450;
        if( light[current_light].irq_int_counter > *(light[current_light].script + 1))
        {
            light[current_light].script += 2;
            light[current_light].irq_int_counter = 0;
        }
        break;
      case CMD_MOVE_TO:
        if( light[current_light].current_dim_value < (*(light[current_light].script + 1) - (*(light[current_light].script + 2) + 1)))
        {
          light[current_light].current_dim_value +=  *(light[current_light].script + 2);
        }
        else
        {
          if( light[current_light].current_dim_value > (*(light[current_light].script + 1) + (*(light[current_light].script + 2) - 1)))
          {
            light[current_light].current_dim_value -= *(light[current_light].script + 2);
          }
          else
          {
            light[current_light].current_dim_value = *(light[current_light].script + 1);
            light[current_light].script += 3;
            light[current_light].irq_int_counter = 0;
          }
        }
        break;
      case CMD_SYNC:
        if ( *light[0].script == CMD_SYNC &&
             *light[1].script == CMD_SYNC &&
             *light[2].script == CMD_SYNC &&
             *light[3].script == CMD_SYNC &&
             *light[4].script == CMD_SYNC &&
             *light[5].script == CMD_SYNC &&
             *light[6].script == CMD_SYNC &&
             *light[7].script == CMD_SYNC)    //If every light has hit a SYNC event
        {
          light[0].script++;                  //let all lights continue processing
          light[1].script++;
          light[2].script++;
          light[3].script++;
          light[4].script++;
          light[5].script++;
          light[6].script++;
          light[7].script++;
        }
        break;
       case CMD_RETURN_TO_START:
        switch( current_light)
        {
           case 0:
             light[0].script = (uint16_t *)script_light0;
             break;
           case 1:
             light[1].script = (uint16_t *)script_light1;
             break;
           case 2:
             light[2].script = (uint16_t *)script_light2;
             break;
           case 3:
             light[3].script = (uint16_t *)script_light3;
             break;
           case 4:
             light[4].script = (uint16_t *)script_light4;
             break;
           case 5:
             light[5].script = (uint16_t *)script_light5;
             break;
           case 6:
             light[6].script = (uint16_t *)script_light6;
             break;
           case 7:
             light[7].script = (uint16_t *)script_light7;
             break;
        }
        break;
     }
      light[current_light].on_point = 160 + light[current_light].current_dim_value;
      current_light++;
    }
    LPC_TMR16B0->TCR = 1;
    LPC_GPIO0->IC |= (ZERO_CROSS);  //clear interrupt
  }		
  return;
}


void TIMER16_0_IRQHandler(void)
{  
  if ( LPC_TMR16B0->IR & 0x1 )
  {
    timer_int_counter++;
    if( timer_int_counter > 700)
      LPC_TMR16B0->TCR = 0;                     //disable timer

    current_light = 0;
    while( current_light < 8)
    {
      if( light[current_light].on_point == timer_int_counter) //turn on signal
      {
        switch( current_light)
        {
           case 0:
             LPC_GPIO1->DATA |= LIGHT0;
             break;
           case 1:
             LPC_GPIO1->DATA |= LIGHT1;
             break;
           case 2:
             LPC_GPIO1->DATA |= LIGHT2;
             break;
           case 3:
             LPC_GPIO1->DATA |= LIGHT3;
             break;
           case 4:
             LPC_GPIO1->DATA |= LIGHT4;
             break;
           case 5:
             LPC_GPIO1->DATA |= LIGHT5;
             break;
           case 6:
             LPC_GPIO1->DATA |= LIGHT6;
             break;
           case 7:
             LPC_GPIO1->DATA |= LIGHT7;
             break;
        }
      }

      if( light[current_light].on_point + 3 == timer_int_counter) //turn off signal
      {
        switch( current_light)
        {
           case 0:
             LPC_GPIO1->DATA &= ~(LIGHT0);
             break;
           case 1:
             LPC_GPIO1->DATA &= ~(LIGHT1);
             break;
           case 2:
             LPC_GPIO1->DATA &= ~(LIGHT2);
             break;
           case 3:
             LPC_GPIO1->DATA &= ~(LIGHT3);
             break;
           case 4:
             LPC_GPIO1->DATA &= ~(LIGHT4);
             break;
           case 5:
             LPC_GPIO1->DATA &= ~(LIGHT5);
             break;
           case 6:
             LPC_GPIO1->DATA &= ~(LIGHT6);
             break;
           case 7:
             LPC_GPIO1->DATA &= ~(LIGHT7);
             break;
        }
      }
      current_light++;
    }

    LPC_TMR16B0->IR = 1;			// clear interrupt flag
  }
  return;
}
 
Last edited by a moderator:
Okay, I finally finished off one of these things and need to assemble the other. I took a video of it doing a test pattern on my garage lights. Dims and flashes and patterns.

Kudos! As usual, that is really neat work and looks great.
 
Thanks Edeca. It's nice to have completed something that actually does something noticeable as my Wife thinks I pretty much fiddle with stuff just to make toys.
 
I make a few piccies tonight of my X-mas lights
The binary star is default on my YouTube channel
The 4017 star hasn't been published yet
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top