Go Down

Topic: ANALOG control of RGB LED ~WITH~ LCD/keypad shield (Read 3520 times) previous topic - next topic

prosper50

Hi Everyone! I'm a newb, so please excuse this question if it is very basic.

I would LIKE to use a keypad shield on my Arduino Duemilanove in order to control a Radio Shack RGB LED (actually, two RGB LEDs) - #276-0028 (I believe they are common-anode). For example, I would like to assign one color to the "up" button on the shield, another color for the "down", etc. I would also like to assign a fading function to the "selection" button which would slowly wipe through all possible colors. I would like BOTH LEDs to respond identically, at the same time.

I have been through several tutorials, and I see that most people use PWM to work with RGB LEDs. However, since the keypad shield uses several of the pins that other individuals have assigned to the LED, I am at a bit of a loss. I have read one or two examples of analog control of an RGB LED, but again, I am new so I really don't know how to proceed. In reading through some of the analog control examples, I'm sure the solution will involve the usual transistors, resistors, etc.

If anyone has ANY suggestions, it would be appreciated. In particular, I would greatly appreciate any circuit diagrams for the potential LED pinout (in consideration of the LCD shield). Also, any sample analog RGB LED code would also be appreciated!!! I have already configured the LCD shield software with the button-driven menus and displays that I need. At this point, I just need to plug in the appropriate code for the LED portion (as well as how to wire it in).

Again, ANY contributions would be appreciated!! Thank you so much!!

-Dave

PaulS

Now that you've made you first post, you can post links. This would be a good time to take advantage of that new capability. Which keypad shield are you talking about? Keypads don't generally come in shield format.
The art of getting good answers lies in asking good questions.

prosper50

Hi.... sorry for the lack of clarity. There are several different manufacturers of the LCD/Keypad shield. I purchased the DFRobot model:

http://www.robotshop.com/dfrobot-lcd-keypad-shield-arduino.html?utm_source=google&utm_medium=base&utm_campaign=jos

PaulS

#3
Dec 05, 2010, 02:46 am Last Edit: Dec 05, 2010, 02:49 am by PaulS Reason: 1
Quote
However, since the keypad shield uses several of the pins that other individuals have assigned to the LED, I am at a bit of a loss.


Quote
? Use digital pins 4, 5, 6, 7, 8, 9, 10, and analog pin 0 to interface with the LCD


The Arduino also does PWM on pins 3 and 11. Why that shield chose to use a bunch pf PWM pins for non-PWM purposes escapes me.

If you are going to use that shield, and 3 or 6 PWM pins, you'll need to mount it onto a Mega that has more PWM pins.
The art of getting good answers lies in asking good questions.

prosper50

Paul, thank you for the response. Yes, that is the shield that I currently have hooked up, and everything that I have read indicates that it makes inefficient use of the pins. However, I have it, it's here, and I'd like to make the most of it.

Again, excuse my ignorance, but if I use analog control of the RGB LED(s), does that relieve me of the need to use PWM? Is it one or the other (either analog control OR digital control)?? That was my understanding from reading the numerous digital-vs.-analog discussions. From reading the pinout of the LCD shield, it doesn't utilize any of the analog pins. Is there a way to accomplish the RGB control using exclusively analog control WHILE still using the keypad shield???

That is my ultimate goal!

prosper50

...I also have a Sensor Shield, and a Prototype Shield.... just in case either of those would provide added benefits to this process.

I purchased all of this about a year ago, had good intentions of diving into it, and I am just getting around to it. Suddenly I have a pressing need to get this first task done!!

Thank you again, everyone!

-Dave

PaulS

Quote
but if I use analog control of the RGB LED(s), does that relieve me of the need to use PWM?

It would, IF you could use the analog pins as output pins. You can not. They are input only pins.
The art of getting good answers lies in asking good questions.

prosper50

OH, I see, Paul. I was not aware that analog was input only!!!  So, as it turns out, the only way to accomplish the RGB control is to exclusively use PWM?

Further, since the LCD shield only leaves two free PWM pins, is it safe to say that this can not be accomplished as I had hoped? Is there no other way of accomplishing this using the shield and the RGB?

I understand the need for the Mega with more pins, and that may be something to explore down the road. I'm just trying to get a handle on all of this. It is a fun process, but the trial-and-error is killer.

Again, thanks for your help!!

-Dave

Go Up