Strange Behaviour

I purchased an Arduino Uno. On my breadboard I added one 10KOhm POT. The middle wire is connected to A0, one side of the POT to the Ground rail and the other to the Power rail on the breadboard.

I've connected the breadboard Power rail to the 5V PIN on the Uno and the Ground rail to GND on the Uno.

My code reads the POT value and writes it to Serial. But I get strange numbers that are changing even without turning the dial.

How can I test this and know what is the problem? Is there a way to test the UNO board itself?

I went to 123D site and built the exact same circuit and code, and the simulator runs fine, with values 0 to 1023.

Thanks to anyone who can help me.

Quoted from another thread on similar subject.

By Wawa

Re: Potentiometer to scroll through values.
#5
Today at 11:06 am Last Edit: Today at 11:55 am by Wawa
A pot is basically a nude resistor with a metal wiper sliding over the body.
Over time, the wiper will oxidise and the track will get dirty.
When you turn the knob, the dirty contact bounces over the dirty track, and can temporarilly loose contact.
You might have heard that when you turn the volume knob of an amplifier (crackle).
Basically a floating analogue pin during contact bounce.
A cap could fix that by holding the voltage steady while the pot looses contact.
100n is a standard value. Bigger delays things, smaller won't work.
Leo.

Weedpharma

Thanks Weedpharma for your info.

However, it doesn't seem to be the POT. If I plug the POT directly into the UNO (A0, GND and 5V) then it works fine and I can see 0-1023 in the Serial Monitor.

But when I go through the breadboard I get the strange behaviour. I peeled off the breadboard backing but I can't see anything wrong with it.

Please send a picture of your wiring.

Weedpharma

I tried 2 other breadboards but got the same strange results, so I can 100% rule that out.

I've attached a PNG of the wiring.

When I wire the POT direct to the UNO it works fine.

Please send a picture of your actual wiring, IE a photograph. Preferably one wired direct and another in the breadboard.

Make sure your pictures are clear and reduced to around 100kb.

Weedpharma

ok I will upload a picture of the actual wiring, but it is exactly as shown in the Fritzing image I included in my last post. In fact, the wiring is straight out of an Arduino projects book.

This is so frustrating. 3 days and I still can't get even a basic POT reading :frowning:

here is actual pic of project

To localise the fault, move one wire at a time from the board to the UNO board and test. This will help workout where the fault is occurring.

Weedpharm

Now things seem to be even more bizzare. I followed your troubleshooting suggestion and it worked after the first wire change: I directly connected the A0 input wire to the UNO, with the GND and 5V wires still connected to the breadboard rails.

Then I changed back to the original wiring and it was now working!

I then tried connecting two POTS and the second one shows "0" in the Output Monitor with the first one still working. I then swapped the POTS around and the same issue, with the second POT not working - so there is no problem with the POTS.

I am at a total loss at this stage. It seems as though the UNO doesn't like anything more than one POT connected at a time :frowning: lol

I went back to one POT and tested that with all the analog inputs, using GND direct to the UNO, and they all worked fine. So nothing wrong with the A0-A5.

It seems that as soon as I have more than 1 POT connected, ie. using more than 1 input it fails.

Ok I have more empirical evidence. Using 2 POTS, as soon as I wire the second POT's GND directly to the UNO, instead of the shared GND on the breadboard, they both work fine. When I move the GND back to the breadboard, the second POT is not working.

I have no idea why this behaviour. Without using the breadboard I can't add several components.

Looks like you found a bad breadboard. Try using parts of the breadboard other than the rails. And order a different brand breadboard.

Oh, wait a minute. Do you see how the blue and red lines on the rails are not continuous in the middle of the board? They are probably not continuous in the rails either.

dmjlambert you nailed it!

As soon as I wired all 3 POTS to one side of the breadboard they all worked. I had read in a book that the power and GND rails ran all the way across. This may be true for some boards but certainly not the one I am using.

Thank you so much for your acute observation. You have given me the info that solved my problem.

I can now move forward in my learning and practice :slight_smile:

Thanks also weedpharma for your advice - it helped me to rule out one thing at a time.