[Newbie] Potentiometer's acting strange with under 5v power and 12v power.

Hello all!

First of all, forgive me, I’ve searched loads and haven’t come across anything of a similar topic with a workaround. I’m really not versed well in the world of electronics (got my first Arduino a few days ago). Also, I apologize if this is the wrong subforum, but I think I’ve ruled out other possibilities, and it seems to be an electrical issue (most certainly caused by my lack of knowledge in this area).

I’m working on a project for my computer desk. It’s an RGB controller which controls the output of an RGB LED strip. I’m using 3 potentiometer’s to control the individual R, G, and B values. Nothing too complex. Be prepared to be astounded by my lack of knowledge, I jumped in head first into this world of electronics, but if you can point me in the right direction, I’ll get it done.

I’ve tried 2 methods, both of which are giving me troubles.

Method 1: (see attached RGB-Strip-Method1.png)
As you can see, in Method 1 (which I think is more successful then Method 2), the RGB strip is powered/grounded (I believe those are the correct terms? +/- on the breadboard respectively) by the 12v power supply.
The potentiometer’s are powered/grounded by the Arduino’s 5v power supply, and the GND slot right beneath it.

Now, the first two potentiometers (from the left) work perfectly in controlling Red and Green (mixing the colors too, it’s amazing!). The third, the Blue controlling potentiometer, emits an incredibly dull blue light (as opposed to the perfection of Red and Green) as the pot is increased. Furthermore, as you increase the Blue-controlling pot, it drowns out the red and green lights (literally, as you turn up the blue, red and green essentially turn off by themselves. I tested the RGB strip independently (blue led wire + power into the 12v power supply) and the blue shines like a diamond, so it’s not a whole bunch of dead blue LEDs.

Next step for me was to check the values of all three pots, so I had those outputted via Serial with every iteration of the loop, and all their values work impeccably. They’re not bouncing up and down, even the blue value responds perfectly with increasing/decreasing the pot.

So, ultimately, the problem is - in this configuration, is the blue potentiometer works fine (ie, its values are expected and fine), however the blue light it controls is scandalously dim.

Method 2:
In this method, you can see that I forgo using the Arduino’s 5v PS/GND pins, and connect them to the 12v power supply.
I’m sure you’ve already guessed the issue, all three pot readings are incredibly unstable. Jumping up from 0 to 255, then somewhere in the middle, then back down. I assume this has something to do with the increased current (nobel prize nominee?!).

QUESTIONS
1. Method 1 effectively draws from two different power supplies. Is this… recommended? Is this stupid? Should this NOT be happening?
2. Why is the blue so dim, when the pot readings for the Blue pot are fine (in method 1)
3. Method 2 draws its power from the 12v power supply. Is it not recommended to power pots with this? How would i reduce the load or current that I’m sure is driving the pot insane.
4. Which is a better solution to the approach?
5. How would I fix Method 1?
6. How would I fix Method 2?
Thank you very much if you’ve read this far, and thank you even more if you answer the questions! :slight_smile:
The code is simple (not a problem for me, I’m a CompSci major) and the issue is not with it (but for kicks, i’ll post it anyway):
```
**const int redPotPin = 0;    // select the input pin for the potentiometer
const int greenPotPin = 1;
const int bluePotPin = 2;

const int redPin = 9;   // select the pin for the LED
const int greenPin = 10;
const int bluePin = 11;

boolean aboveZero = true;

void setup() {
 pinMode(redPin, OUTPUT);
 pinMode(greenPin, OUTPUT);
 pinMode(bluePin, OUTPUT);

Serial.begin(9600);
}

void loop() {
  Serial.write("RED VALUE: ");
  Serial.println(analogRead(redPotPin) / 4);
  analogWrite(redPin, analogRead(redPotPin) / 4);
   
 Serial.write("GREEN VALUE: ");
 Serial.println(analogRead(greenPotPin) / 4);
 analogWrite(greenPin, analogRead(greenPotPin) / 4);

Serial.write(“BLUE VALUE: “);
 Serial.println(analogRead(bluePotPin) / 4);
 analogWrite(bluePin, analogRead(bluePotPin) / 4);
 
 Serial.write(”\n”);
    //testing fading - works, but hideous solution!
   /if(aboveZero) {
   val -= 3;
   analogWrite(redPin, val);
   if((val == 0)) {
     aboveZero = false;
   }
 } else {
   val += 3;
   analogWrite(redPin, val);
   if(val == 255) {
     aboveZero = true;
   }
 }
/

}
__
```__
__

__
__
**__

Method two is incorrect because the voltage on the potentiometer output will be varying from 0V to 12V, instead of 0V to 5V as in method 1.

Putting more than 5V into the analog input pins can damage them, so do not use method 2!

Per your diagram on method 1 you do not have a common ground between two ground rails on the breadboard, you need a common ground.

The common ground may in fact be the issue, so make sure to connect negative of power supply and LED strip and GND of Arduino.

What MOSFETs are you using? (part #) Which RGB led strip (link to part or datasheet)

Do you have or do you know someone who has a multimeter you can borrow to debug the circuit itself. If you have one you can check voltage on each input and each output of Arduino. So analog in pins and PWM out pins.

MOFSET part numbers are all 30N06L. As for the RGB strip, I don't know entirely. I bought it from a local electronic components store. It's high quality (I'd like to think) with waterproof coating, and three LED's between each copper perforation. The pots are all 10k(insert Omega symbol here) - B Also, you are a wizard! I connected the two grounds in method 1 (on either side of the breadboard), and it worked like a spell. What was going on there? Why would I have to connect both grounds to one another? Why were the first two pots working perfectly? Why wasn't the last one?

Also, lastly: When I turn up the red or the green knobs while checking the output of all three values (in Serial) - the rest of the colors behave normally and properly, however, if I turn up the blue knob (with red and green at 0) the values of Red and Green jump up by about 3 or 4, leading to a small flicker of the other two colors while raising blue.

What is this cause by, and how can I combat it?

EDIT: I do have access to a multimeter, is there a reference sheet i can look at to compare the values I measure vs. what they're supposed to be?

Hi, check your protoboard, that the gnd row that runs down each side of the board is continuous, some boards have a break in the row. This means that not all your circuit is connected to the same gnd. The reason that the new gnd connection worked is because without it the MOSFET gates had no gnd reference to work with the output from the arduino.

Also try swapping your MOSFETs around to see if you have a faulty one.

Tom...... :)

When designing a circuit ground should be common between all components for a majority of all cases (there are certainly exceptions, but for the vast majority of work ground needs to be connected to all other grounds).

The trick is that without ground a voltage has no baseline, without a reference point a specific wire may be at 5V (but that is 5V referenced to ground) so with no ground, there is no saying what that voltage is.

So the wires coming from pins 9, 10, and 11 may have been at 5V but to the MOSFET it looks like nothing.

As for why red and green were working and blue wasn't I'm not sure, but the bottom line is without a common ground the circuit would always be unpredictable and unstable.

My guess is red and green are slightly increasing because they are picking up noise from the blue wire, or perhaps the noise is on the Arduino board itself.

What I would do is take the multimeter and connect common to Arduino ground and probe the different potentiometer wipers (center pin). You should expect to see somewhere between 0V (min) and 5V (max), these correspond to 0 to 1023 (0 to 255) on Arduino.

So you can probe each pin and when you turn up red see if blue wire is actually rising above 0V slightly. If so then there is noise being picked up. If not then you can probe the output pins and you will similarly see somewhere between 0Vand 5V.

Awesome, thank you!

I will test this out in a few minutes. If I do discover there is noise, what can be done about it? Solvable issue, or will I have to move one of the pots to another breadboard?

EDIT: Solved, switched out the MOFSET dealing with blue, and everything works like magic! Thanks all! :)

Actually, I lied, there is one thing, while at low pot values (usually 1-10) the lights flicker. Is THIS noise? The values drop by about 1 or 2 at the most. Other than that though, it's awesome!

What maximum current do each of red/green/blue strips take at 12V?

What current can the 12V supply deliver? It sounds like not enough for all of the LED channels.

Have you added decoupling to the LED supply at the point of switching (ie between 12V and ground right at the MOSFET? Try at least 100uF,25V to control switching noise.

These LED strips will be high current, don't connect them with a breadboard, breadboards cannot handle high currents. Use terminal connector blocks or solder, then bring the source/gate cinnections for the MOSFETs out the the breadboard

Putting 12V on Vin was causing you grief because of all the massive switching spikes and drop outs caused by not having decoupling and an inadequate 12V supply (or too much resistance in the breadboard contacts).