Pages: [1] 2   Go Down
Author Topic: 8 x RGB LED Array  (Read 2383 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello All, i am looking at using 8 off RGB LED's as a shift light module in motorsport,

I am able to Recieve a CAN based message 5 Bits Long, i.e,   ( 00, 00, 00, 00, 00, 00 )

The first  bit, will controll the arrangement of the LEDS to illuminate, starting with the LSB being LED 1 and a binary addition to add further LED's in sequence,

Can anyone suggest a simple method of arraying 8 RGB led's and mapping an active sequence from 00 ( all off ) to 128 ( all on )

The brigtness of each colour will be controlled from the next 3 bits,

many thanks, and i will post results in the future,

Rich
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Use Common Anode RGB LEDs.
Connect the anodes to +5
Connect the 24 cathodes to 2 TLC5490 drivers.
Under software control you can then control brightness of each R, G, B,  and fade up/down as needed.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Alternately, use 8 WS2801, one per LED.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2471
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you really need RGB LED's I would think a mixture of single colour Green, Yellow & Red would do.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

8 LEDs takes up less space than 24 individual LEDs.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The array needs to be multifunctional, for multicolour warnings, oil pressure, fuel pressure etc,

I had a thought of using common cathode led,s, connecting all reds to a own output for brightness, same for green and blue,

Then connecting each cathode to a digital output to pull low to activate each led as required,

Only a single colour or mix of colours in each led is required at a time,

From there, I need to find a way of turning a 0-255 value received over CAN  into the various combinations of led pattern?

Sound sensible?

Comments please guys,
Appreciate all help
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Gonna need anodes in there somewhere:

Quote
I had a thought of using common cathode led,s, connecting all reds to a own output for brightness, same for green and blue,

Then connecting each cathode to a digital output to pull low to activate each led as required,

Draw up a schematic & post it here.
Can't help on the CAN to display until you post what the CAN codes are and what you want them to do re: red/yellow/green for each status light.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a quick schematic of what i am proposing, the high and low side drive will need to be through power transistors,
attached.

As for the CAN code,

On Bit 1 of the CAN message i will recieve a value of between 00 and FF in HEX, being 0 to 255 in decimal as the Arduino recieves it from the CAN controller, or in binary   1111  1111

Each 1 represents an LED,
The binary addition of light values will reslt in one of the 255 possible LED patterns available with 8 LED,s
 
The LED's will be arranged in a straight line, and i am hoping that the LSB will correspond to the LED on the right hand end of the chain,

The main reason for this, is so that it will be a direct replacement for another existing product.


The can message will be as follows,

     Base ID, 023,     Data Length ,5,                                      (00,                     00,                      00,                          00,                          00,)

                                                                                     Pattern Bit       RED Brightness      Green Brightness         Blue Brightness            Enable, (always FF)

The RED, GREEN and BLUE, brightness channel will be simply read from the CAN message, and written to the Arduino PWM channels appropriately for different colours.

Hope this helps,

What do you think?

* Visio-RGB Led Schematic.pdf (21.6 KB - downloaded 34 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Add a current limit resistor on each PWM output. No need for PNP transistor.
If you needed 3 greens on at one time as an example, you'd have to multiplex the cathodes so that only 1 PWM output & 1 cathode is selected at a time. Not hard to do.

Your "pattern bit" will be one of B00000001,  B00000010, B00000100, B00001000, B00010000, B00100000,  B0100000, or B1000000?
Or more than 1 LED will be sent at a time?
Seems pretty workable either way.
How fast do messages come in?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why would I to need to multiplex the cathodes? As if I wanted 3 greens on for example, I could simply activate the corresponding pins,

Yes that is exactly how the "pattern bit" should work,
So I have to find a way of relieving the pattern bit and turning that into the corresponding output.

Thanks so far
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So i have the hardware built,

I have the code written to take the CAN id and write it out to the PWM pins for Red, Green and Blue Brightness,

Now i need to figure how to get the 0-255 value i get on the first bit of the can message, to control the 8 LED pins in binary order, a bit like a counter,

I had been using byte
  • as the command for the PWM pins, i,e, analogWrite(3byte[3]0;

So it would be byte[1] for the pattern,

How do i do a simple binary output to the 8 led pins corresponding to the value in the CAN message?

Hope you can help guys
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Write a little loop that masks off each bit one by one and writes the value to the pin driving the correspoding LED.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thats fine, but all of the pattern data is on Byte 1 only,

What i am struggling with, is the the command to pass the 0 to 255 value from the CAN message to the 8 digital outputs to turn the corresponding LED's on

I was assuming there is some clever command that passes an 8 bit integer to 8 defined output pins,

I am probably hoping a bit too much there i guess?

RIch
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"I was assuming there is some clever command that passes an 8 bit integer to 8 defined output pins, "

If you had all 8 output on the same Port, you could use
PORTD = newCanByte;
for example using PORTD pins.
With an Uno, only PortD has 8 pins and if you are using Serial than 0,1 are committed.

So put your pins in an array
Code:
pinsArray[] = {2,3,4,5,6,7,8,9;}  // could be whatever group you select

and loop thru them to write each one
Code:
maskBit = 1; // start with B00000001
for (x=0; x<8; x=x+1){
if ((CANbyte & maskBit) >0){           // makes all bits but 1 low: 0000000C, next pass 000000C0, etc
digitalWrite (pinsArray[x],  HIGH);
}
else {
digitalWrite (pinsArray[x], LOW);
}
maskBit = maskBit<1;  // next bit - B00000010, B00000100, B00001000, etc up to B10000000
} // next x
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, thanks crossroads for all the help, when i am at work tomorrow, i will try setting that code up, i am fairly new to programming, and i have seen a few examples of sending a binary number to 8 led's, but they all seem to step through a sequence as a counter rather than pulling the value required from a data stream,

I really appreciate all of your help and will give it a go tomorrow and let you all know the results,

I plan on developing this into a product, as the hardware side of things is simple for me,

I will post all my results , schematics, and CAn templates here once i have something better to report than simple questions,

Thanks again

Rich
Logged

Pages: [1] 2   Go Up
Jump to: