First, please forgive me if this post is in the wrong place. I really wasn't sure where to put it.
So anyway, hello.
I'm (obviously) new here and also brand new to diy micro controllers. A friendly guy on another forum suggested Arduino as a possible solution for my problem. There are actually a number of things I need to accomplish, but the first and foremost is this:
I have 3 leads. I need to increase voltage on #1 until it reaches its threshold. Then I need to increase voltage on #2 until it reaches its threshold as well. At that point, I need to ramp the voltage on #1 down at the same rate it was increased on #2 until #1 is off. Then I need to repeat the process with #2 & #3 and #3 & #1 until I'm back where I started.
I think a lot of you have probably already figured out what I'm trying to do even though my explanation lacks technical clarity and eloquence.
Is Arduino a good way to accomplish this and how difficult would it be? I have a few years' programming experience but little to no hands-on experience with hardware of any kind. I rewired the amplifier for my 1979 Rhodes electric piano (because I needed it for a gig) and I've opened up a couple random electronic devices over the years to make simple repairs, but nothing along the lines of designing circuitry, etching my own board, and soldering caps and such into place. So, yeah. I'm inexperienced, but I'm no dummy. I just want to be fair to myself and explore my options before I hire someone to do this for me and waste both money and a learning experience.
Ok what is the voltage you need to change ? ( 5V ? ) then its a bit easy just you need use the pwm pins on the arduino
Something else ?
then look at the digital potentiometer you can control those things with arduino
Ok Understood i didnt want to change Aetherys post just wanted to try it on a topic which i made previously and got it ( i never noticed that we could type in the subject line )
-Thanks
My bad. Didn't mean to go AWOL, just had some things I needed to get done around the house and then dragged my sorry carcass to bed at an unusually early hour.
So I changed the title. That's what I'm trying to do. I have a whole bunch of these 4 pin RGB LEDs that should be put to use. I was looking at the color-picker in Photoshop with the red, green, and blue sliders when I noticed what a simple sequence of increasing and decreasing values it was which resulted in a smooth trip around the color wheel, so to speak, and I decided to do just that. Adjusting three controls is tedious, though, and I wanted it done with one. One continuous rheostat that cycled through the pattern/spectrum over and over, turn after turn, would be the most convenient as far as controlling a lamp or mood lighting in a room.
Anyway, I don't see how this is any clearer than my original question and I still don't know if Arduino is a good way to accomplish it.
Thanks to everyone who has taken the time to reply so far, though. I'm still listening. I just go to bed early sometimes.
The actual coding will need some thought but shouldn't be too hard.
One of the main questions is, how fast does this ramping need to be?
Hey, Graynomad. Looks like you're the person to talk to. I'm not too worried about the code. I have a fair amount of experience writing software for various projects but I'm str8 n00b as far as hardware goes when it comes to doing anything more than a little soldering.
The ramping changes need to happen as fast or as slow as dictated by the controls. For instance, if it was 3 sliders for 3 colors, a chimp could probably put it together but I want one control for all 3 leads. There is a strict (and relatively simple) formula to follow, though, which is comforting.
Anyway, I don't see how this is any clearer than my original question
Well it is.
Now we know you are trying to change the brightens of LEDs we can advise it can be done in two ways. One is by feeding them with a varying DC voltage like you asked about but the other much simpler way is by using PWM.
Or complicate it a bit (ok, maybe a lot ) and add an external D/A converter lke AD5308/AD5310/AD5312 (8, 10, 12 bit resolutions) with a transistor drive stage to sink or source the current each lead can support.
I know, I know, you can tell the hardware engineer with too much time in his hands ...
mmmm, if you want to do it in software you could use the knob to spin an optical sensor that eather increments or decrements a counter for the current color's counter. You use counter to set the size of the pulse for that color's pwm pulse width.
I'm afraid that I still don't get how you select r/g/b colors though, are you just cycling through the entire color table quickly and then slowly fine tuning it? If so then may I suggest making the step size of the color jump proportional to how fast one spins the selector dial.
I think I lost part of my labeling, but you're talking something like this, yes? Maybe more sinusoidal looking?
Kind of like Project 8 in the earthshine ASKManual:
(let me see if I can find a link for that)
Oh, it was already posted - see reply #16.
I'm afraid that I still don't get how you select r/g/b colors
Check it out, bro. Let me splain it good as I can.
Here is my craptastic visual aid.
The LED has 4 pins. Red, green, blue, and ground. If you give the red pin 100% power, the little lamp/diffuser/plastic housing/whatever lights up totally red (12:00). If you gradually increase the power on the green pin, the diodes in the lamp/diffuser are so small and so close together that the red and green diodes blend together and you see many colors of the visible spectrum between red and yellow, i.e. shades of orange (12:01 - 1:59). When both pins have 100% power (2:00), it appears as yellow as it can get and when you gradually decrease the power to the red pin (2:01 - 3:59), you create the colors between yellow and green until only the 2nd pin is powered and the green diode is the only one lit (4:00).
Just keep in mind that off to 50% power to full power and back down again should be a smooth transition so we get the most shades of colors between red, green, and blue. And the boost/cut on each lead follows a static pattern.
I'm no good at writing code myself, but I can copy/paste some stuff together to make it work.
You would probably want a FOR statement to make it work, here's the LED dimming tutorial off the Arduino Learning page:
// Dim an LED using a PWM pin
int REDpin = 11; // LED in series with 470 ohm resistor on pin 10
int BLUEpin = 10; //Blue LED + resistor
int GREENpin = 6; //Green LED + resistor
void setup()
{
// no setup needed
}
void loop()
{
for (int R=0; R <= 255; R++){
analogWrite(REDpin, R);
delay(d); //This delay will be controlled by an external potentiometer which will control how fast the wheel circulates
}
}
That code will bring the R (red) led up, by chaining together a series of these statements in the loop() function, we can create the colour wheel you're looking for:
void loop()
{
for (int R=0; R <= 255; R++){
analogWrite(REDpin, R);
delay(d); }
for (int B=0; B <= 255; B++){ //Add blue to the mix
analogWrite(BLUEpin, B);
delay(d); }
for (R >= 255; R--){
analogWrite(REDpin, R); //Remove the red leaving just the blue
delay(d); }
for (int G=0; G <= 255; G++){ //Add green
analogWrite(GREENpin, G);
delay(d); }
}
Going on like this, you would continue through all the combinations, then add some code to read a Potentiometer (or whatever method you plan on using to set the speed.
Someone with actual coding experience/knowledge should probably read over this, I haven't run it through the Arduino IDE so I'm not sure if it will compile or run as intended.
You left out reading the value of the pot to get value d and mapping the resulting 0-1023 into the 0-255 range for the PWMs. (divide by 4, or shift the result 2 bits right).