Pages: [1]   Go Down
Author Topic: I'm lost and desperate. Need help with RGB's, 595 shifters,  (Read 1392 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

 























 
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1285
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

On my site (link below in my signature) I have some sketches that drive seven segment displays using the 595 shifter.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 33
Posts: 1225
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ! smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5656
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

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

Leeds, England, (dis)UK
Offline Offline
God Member
*****
Karma: 16
Posts: 708
Quick, chuck it in the bin before the boss finds out...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 33
Posts: 1225
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 81
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

« Last Edit: May 16, 2013, 11:00:32 am by whiskey » Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5656
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


The shiftout typo rears its ugly head again... smiley
Logged

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

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 81
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


The shiftout typo rears its ugly head again... smiley


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?  smiley-razz

Logged

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 658
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2925
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//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
« Last Edit: May 14, 2013, 05:23:38 pm by Docedison » Logged

--> 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

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: