LED Madness!!

LED Discussion

LED Madness!!

Postby Nishar on Tue Apr 29, 2008 1:44 pm

I really think i'm LED Crazy....

DSC04014.JPG
DSC04014.JPG (107.4 KiB) Viewed 1234 times


1. 6 X 1W emitters...With 30 degree lenses
2. Mounted on alluminium Strip
3. Buillt in Current limit circuit
4. Switch to avtivate only 3 or all 6
5. Any 12 Vdc source.

DSC04016.JPG
DSC04016.JPG (91.86 KiB) Viewed 1237 times
Image
User avatar
Nishar
Known to all
Known to all
 
Posts: 780
Joined: Wed Apr 09, 2008 1:28 pm

Re: LED Madness!!

Postby Tom on Wed Apr 30, 2008 8:24 am

Looks good, Now make one with 3 rgb leds and control it with a microcontroller ;). Should be great for creating different moods like a mood lamp. And then you can control it from your computer like, lets say you get an email then all the leds show red or have it grab data from the internet such as the weather, if its rainy then it shows green, if it's cold it turns blue, etc. You get the idea.

If this sounds like a good project then let me know, I'll build the controller for it ;)
User avatar
Tom
Part of the Family
Part of the Family
 
Posts: 462
Joined: Tue Apr 29, 2008 10:11 am
Location: Vanderbijlpark

Re: LED Madness!!

Postby Nishar on Wed Apr 30, 2008 8:29 am

As a matter of fact i was thinking of the same thing last night
RGB Led's

Ok but not as deep as you, it was just thinking of having 3 sliders for the different colours

But your idea.... That would be totally cool - a world 1st hey... 8-)

Will you be able to program a pic to communicate with a pc and internet weather?

What about an auto temperature sensor
when its hot >25 deg add more blue (cooler effect)
when it cold <18 deg add more red (warmer feel)
Image
User avatar
Nishar
Known to all
Known to all
 
Posts: 780
Joined: Wed Apr 09, 2008 1:28 pm

Re: LED Madness!!

Postby Tom on Wed Apr 30, 2008 9:48 am

I would exactly call it a worlds first, but its unique alright. This is how I would do it :

rgb led => connected to microcontroller => connected to pc via serial port

The rgb leds would be controlled using pwn so that you can get many different colours. I did something similiar with one of the high power leds that I bought from you guys. The microcontroller receives commands from the computer via serial port. It's easy enough to write a program on the pc to get data from the net or to do whatever. Depending on the data or status you can then easily send a command to micro to change the colours. Using an auto temperature sensor would be cool although I wouldn't limit it to that only. It would work with a pic but unfortunately I don't know it that well, I'd rather use an avr. I've got some lying around, you've got me itching to start on the controller.

Some more ideas on what you can do with this:

- create a plugin for a music player (such as winamp) and have the lights change with the music
- have it show different colours depending on the stage status of eskom ;)

I can do the programming side (pc and microcontroller)
User avatar
Tom
Part of the Family
Part of the Family
 
Posts: 462
Joined: Tue Apr 29, 2008 10:11 am
Location: Vanderbijlpark

Re: LED Madness!!

Postby Nishar on Wed Apr 30, 2008 9:51 am

Awsome man

Ok the next time you come visit us
Lets discuss it... :D
Image
User avatar
Nishar
Known to all
Known to all
 
Posts: 780
Joined: Wed Apr 09, 2008 1:28 pm

Re: LED Madness!!

Postby Tom on Wed Apr 30, 2008 10:26 am

Sounds good, I'm going to start playing around with a prototype now anyways, I've got my stuff with me so I'll have a look at it. I'll keep you updated.
User avatar
Tom
Part of the Family
Part of the Family
 
Posts: 462
Joined: Tue Apr 29, 2008 10:11 am
Location: Vanderbijlpark

Re: LED Madness!!

Postby Tom on Wed Apr 30, 2008 3:13 pm

ok, I have the rgb led working. At the moment all it does is cycle through the colours. I'll work on connecting it to the pc this weekend. I'll come by the shop this afternoon and show you.
User avatar
Tom
Part of the Family
Part of the Family
 
Posts: 462
Joined: Tue Apr 29, 2008 10:11 am
Location: Vanderbijlpark

Re: LED Madness!!

Postby Nishar on Wed Apr 30, 2008 3:16 pm

Ok so i take it you're a genius....

I cant wait to check it out
Image
User avatar
Nishar
Known to all
Known to all
 
Posts: 780
Joined: Wed Apr 09, 2008 1:28 pm

Re: LED Madness!!

Postby Tom on Wed Apr 30, 2008 3:17 pm

btw - if anybody is interested here is the code:

- runs fine on a atmega8 with 16Mhz crystal
- should work on just about any avr
- rgb led connected to portc (0,1,2)

Code: Select all
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/wdt.h>

#define F_CPU  16000000

#include <util/delay.h>

#define bit_get(p,m) ((p) & (m))
#define bit_set(p,m) ((p) |= (m))
#define bit_clear(p,m) ((p) &= ~(m))
#define bit_flip(p,m) ((p) ^= (m))
#define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))
#define BIT(x) (0x01 << (x))
#define LONGBIT(x) ((unsigned long)0x00000001 << (x))

#define DELAY_LOOP     100
#define DELAY_A         50
#define CHANGE_SPEED    5

void set_light(int nr)
{
   // always put them all off first
   PORTC = 0;
   bit_set( PORTC, BIT(nr) );
}

int main(void)
{
   // portc output
   DDRC = 255;
   PORTC = 0;
   
   int c = 0;
   int r = DELAY_LOOP;
   int g = 0;
   int b = 0;
   int cnt = 0;
   
   int mode = 0;
   
   int tr = -1;
   int tg = 1;
   int tb = 0;
   
   int change = 0;
   
   while(1)
   {
   
      if ( mode == 0 )
      {
         tr = -1;
         tg = 1;
         tb = 0;
         
         if (r < 1)
            mode++;
      }
      
      if ( mode == 1 )
      {
         tr = 0;
         tg = -1;
         tb = 1;
         
         if ( g < 1 )
            mode++;
      }
      
      if ( mode == 2 )
      {
         tr = 1;
         tg = 0;
         tb = -1;
         
         if ( b < 1 )
            mode = 0;
      }
      
      set_light(0); //blue
      for( c=0; c<b; c++ )
      {
         _delay_us(DELAY_A);
      }
      PORTC=0;
      for( c=b; c<DELAY_LOOP; c++ )
      {
         _delay_us(DELAY_A);
      }
      
      set_light(2); //red
      for( c=0; c<r; c++ )
      {
         _delay_us(DELAY_A);
      }
      PORTC=0;
      for( c=r; c<DELAY_LOOP; c++ )
      {
         _delay_us(DELAY_A);
      }
      
      set_light(1); //green
      for( c=0; c<g; c++ )
      {
         _delay_us(DELAY_A);
      }
      PORTC=0;
      for( c=g; c<DELAY_LOOP; c++ )
      {
         _delay_us(DELAY_A);
      }
      PORTC=0;      
      
      // do changes
      change++;
      
      if ( change >= CHANGE_SPEED )
      {
         r += tr;
         g += tg;
         b += tb;
         change = 0;
      }
      
   }
   

   return 0;
}

User avatar
Tom
Part of the Family
Part of the Family
 
Posts: 462
Joined: Tue Apr 29, 2008 10:11 am
Location: Vanderbijlpark

Re: LED Madness!!

Postby Tom on Wed Apr 30, 2008 3:18 pm

Nishar wrote:Ok so i take it you're a genius....

I cant wait to check it out


:oops: I wouldn't say that, the concept is actually very simple
User avatar
Tom
Part of the Family
Part of the Family
 
Posts: 462
Joined: Tue Apr 29, 2008 10:11 am
Location: Vanderbijlpark

Next

Return to LED's

Who is online

Users browsing this forum: No registered users and 1 guest

cron