Go Down

Topic: I'm lost and desperate. Need help with RGB's, 595 shifters, (Read 1 time) previous topic - next topic

Clay

I was wondering (hoping) that someone might help me with using RGB's in a lighting sequence.  Because right now I have nothing to go,  I have been searching the internet for the last 18 hrs straight, and I can-not find anything to benefit me.  I've finished 3 books and the 4th is coming so please don't think I'm lazy.  And there are sketches that I see will work, but the sketches are long and in all honesty above my head right now.  So if anybody can give me a head start that would be great.  My goal was to make a 8*8 matrix (witch I'll put off for later). I have a Arduino R3 and 5 HC74595 on breakouts from SparkFun, and the RGB's are common cathode.  I don't care what the sketch does, just as long as I understand it, and you use more than 1 shifter.



Thank ya'll very much and if you have time I would appreciate anything you had to offer.
claymccarson@gmail.com

 
























marco_c

On my site (link below in my signature) I have some sketches that drive seven segment displays using the 595 shifter.
Arduino libraries http://arduinocode.codeplex.com
Parola for Arduino http://parola.codeplex.com

Msquare

I do not think you can "search the net for 18 hours and find nothing". Oh, maybe, if you looked for a program that does excatly what you want to do, or a large complex program written with so many comments as if it is a tutorial/selflearning book.

Anyhow, when a problem is "too large" to find a solution, you must reduce it to smaller probelm, solve that, and then use that as a building block for the more complicated one. Here is a suggested progression list

ANY breadboard / Arduino code combination that controls one RGB  (On/Off on the 7 possible colours)?

Does it need to have contous colour spectrum, ie you need to "PWM" it. Again - do that with one RGB.

Control one RGB (or two) through one shift register, but only with 7 full On/Off colors. Extend this to two shift registers, controlling one (or two) RGB LED on each.

Note that if you need "PWM" this gets tricky to pass through the shift register, like - not possible. (You can use the OE line to blink all in unison, ie all LEDS have the same brightness) I think you need to manually toggle the LEDs On Off. So the challenge here is to change the LED pattern very quickly so it seems that a LED is half-on (or 10% or whatever)

And ... when you've done all above then you're an expert RGB/595 programmer ! :)

Clay

Yes I understand about starting off from scratch, and for 99.99 percent of people that would work, but i'm not grasping it.  I could wire the space shuttle but when it comes to the c language this is foreign  to me.   Sorry for being complicated and i'll leave this up 3 more days and if no activity all I will close out.  But once again if anybody else haves any sketches for multiple RGB with the bear necessities i would be grateful.

Books so for are, SIK (came in project kit)
Programming Arduino "getting started with sketches.
Electronic Sensor Circuits & Projects.
will also have one coming through UPS monday.
P

fungus


I could wire the space shuttle but when it comes to the c language this is foreign  to me.


Maybe your first task should be to forget the LED matrix and learn a bit of C.

Arduinos (and all other microcontrollers) are useless without programming. Programming takes study, there's no way around that.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dannable

I would suggest that to start with you try getting the shift registers to work with some ordinary leds before tackling the RGB problem.

To help with this you might want to consult Nick Gammon's excellent write up http://www.gammon.com.au/forum/?id=11518. Wire it up, play around with the values you shift out and see what happens. And try to think in binary!
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Msquare

i'll leave this up 3 more days and if no activity all I will close out
I could read this as meaning : "If I do no get my solution now, ready to run then I'll start doing <other hobby that requires - surprise - time and effort to understand and enjoy>". That would be sad. Not your leaving, but expecting this to be a mere matter of finding the right sketch to download.

Still, lets look positive on this, and see what we could help with.

Quote

the c language this is foreign  to me.
:
haves any sketches for multiple RGB
Well, if you do not understand C then you can not "read" the sketches offered to make the minor adjustements to fit your setup. (Which explains why you didn't find "anything" after 18 hours) There ARE skteches out there - plenty to inspire and cut-n-paste sections from, to make your own variation.

It is much easier to "read" a sketch and tweak it than to write one from scratch. So you do not need that much skill in "C" to do that, but you do need some.

Quote
Books so for are <booklist>
IfIRecallCorrectly .. there are some nice simple "Hello World" examples in there. Have you succeeded in getting one of them to run? Have you suceeded - for example - to modify the Blink sketch so the LED blinks - as an example - "SOS" in Morse?


whiskey

#7
May 14, 2013, 03:49 pm Last Edit: May 16, 2013, 06:00 pm by whiskey Reason: 1
this is a pretty good book/lesson with 595 chips, start on page 80/project 14, it starts you off with 8 LED's and one chip, then 16 LED's and two chips and ends with a whole matrix.
https://docs.google.com/file/d/0Bw_ruMOtRDDgNXI3OTFGZXhIZ2c/edit?pli=1

edit: when you get to the matrix demo (chapter 19 of above book) you should refer to this link to get it working properly:
http://mindovermaterial.wordpress.com/2012/07/17/beginning-arduino-project-19-led-dot-matrix-basic-animation/



arduino's shitOut tutorial:
http://www.arduino.cc/en/Tutorial/ShiftOut

this guy has some other good lessons that are worth checking out
http://www.youtube.com/watch?v=6fVbJbNPrEU

fungus


arduino's shitOut tutorial:
http://www.arduino.cc/en/Tutorial/ShiftOut


The shiftout typo rears its ugly head again... :)
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

whiskey



arduino's shitOut tutorial:
http://www.arduino.cc/en/Tutorial/ShiftOut


The shiftout typo rears its ugly head again... :)



I'm sorry, it's been awhile since I've been here, but was it always ugly and I just never noticed because of the beer goggles or did it just grow ugly as it got older?  :P


Simpson_Jr

Your choice isn't really a beginners project. I would probably start with a single colour matrix, it's a lot easier to understand and finding examples will be easier as well. You could... adapt such examples for your rgb-matrix since it uses 3 matrices of 8x8 leds.

Although it's not impossible, using shiftregisters it will be quite hard to find/create a sketch that displays each dot in more as 8 colours. That may be enough if you just want 8 colours, but if you want to use the rgb matrix to its mesmerising potential, I'd start searching different rgb-matrix projects and check what hard/software was used.

Docedison

#11
May 15, 2013, 12:17 am Last Edit: May 15, 2013, 12:23 am by Docedison Reason: 1
Here's a simple sketch and easily adapted to the Arduino... I put it in a tiny 85...
No Shifters... just 3 resistors a 5 mm RGB CC LED and a Tiny 85.. Real simple
Code: [Select]

//ATtiny85 RGB color fading Mood Light NOW WITH LIGHT SENSING CAPABILITIES!!!

const int redPin = 0; // Arduino 9
const int grnPin = 1; // Arduino 10
const int bluPin = 2; // Arduino 11
//const int sensor = 3; // I don't use an LDR so keep it in the dark


void setup()
{
 pinMode(redPin, OUTPUT);    
 pinMode(grnPin, OUTPUT);    
 pinMode(bluPin, OUTPUT);
 pinMode(sensor, INPUT);
}

void loop() {
 if (analogRead(sensor) <= 200)
 {
   redtoyellow();
   yellowtogreen();
   greentocyan();
   cyantoblue();
   bluetomagenta();
   magentatored();
   bluetomagenta(); // I wanted to see the colors cycle continuously
   cyantoblue();       // so I repeated the colors back to red
   greentocyan();
   yellowtogreen();
   
 }
 else if (analogRead(sensor) >= 201) // Short the sensor input to ground...
 {
   digitalWrite(redPin, LOW);
   digitalWrite(grnPin, LOW);
   digitalWrite(bluPin, LOW);
 }
}

void redtoyellow()
{
 digitalWrite(redPin, HIGH);
 digitalWrite(bluPin, LOW);

 // fade up green
 for(byte i=1; i<100; i++) {
   byte on  = i;
   byte off = 100-on;
   for( byte a=0; a<100; a++ ) {
     digitalWrite(grnPin, HIGH);
     delayMicroseconds(on);
     digitalWrite(grnPin, LOW);
     delayMicroseconds(off);
   }
 }
}



void yellowtogreen()
{
 digitalWrite(grnPin, HIGH);
 digitalWrite(bluPin, LOW);

 // fade down red
 for(byte i=1; i<100; i++) {
   byte on  = 100-i;
   byte off = i;
   for( byte a=0; a<100; a++ ) {
     digitalWrite(redPin, HIGH);
     delayMicroseconds(on);
     digitalWrite(redPin, LOW);
     delayMicroseconds(off);
   }
 }
}


void greentocyan()
{
 digitalWrite(grnPin, HIGH);
 digitalWrite(redPin, LOW);

 // fade up blue
 for(byte i=1; i<100; i++) {
   byte on  = i;
   byte off = 100-on;
   for( byte a=0; a<100; a++ ) {
     digitalWrite(bluPin, HIGH);
     delayMicroseconds(on);
     digitalWrite(bluPin, LOW);
     delayMicroseconds(off);
   }
 }
}



void cyantoblue()
{
 digitalWrite(bluPin, HIGH);
 digitalWrite(redPin, LOW);

 // fade down green
 for(byte i=1; i<100; i++) {
   byte on  = 100-i;
   byte off = i;
   for( byte a=0; a<100; a++ ) {
     digitalWrite(grnPin, HIGH);
     delayMicroseconds(on);
     digitalWrite(grnPin, LOW);
     delayMicroseconds(off);
   }
 }
}


void bluetomagenta()
{
 digitalWrite(bluPin, HIGH);
 digitalWrite(grnPin, LOW);

 // fade up red
 for(byte i=1; i<100; i++) {
   byte on  = i;
   byte off = 100-on;
   for( byte a=0; a<100; a++ ) {
     digitalWrite(redPin, HIGH);
     delayMicroseconds(on);
     digitalWrite(redPin, LOW);
     delayMicroseconds(off);
   }
 }
}



void magentatored()
{
 digitalWrite(redPin, HIGH);
 digitalWrite(grnPin, LOW);

 // fade down blue
 for(byte i=1; i<100; i++) {
   byte on  = 100-i;
   byte off = i;
   for( byte a=0; a<100; a++ ) {
     digitalWrite(bluPin, HIGH);
     delayMicroseconds(on);
     digitalWrite(bluPin, LOW);
     delayMicroseconds(off);
   }
 }
}

It works for me on an ATtiny 85 with the fuses set for 1MHz RC oscillator
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Clay

Thanks  for the example code Docedison, and Whiskey & Dannable for the sites.  I was going at it the wrong way,  I was trying to write sketches from scratch, (with the help of books of course) but I was not truly understanding what I was typing.  Sounds stupid I know.  So, like suggested I will go with the led and 1 shift register and so until I feel good and confident,  then a matrix?

thanks again for the help cause i'm dead set on figuring this out.  my wife keeps telling me cowboys and tech. don't mix   


Clay

Go Up