Is my Arduino duffed or me?
Started a new project today, hooked up a 16x2 LCD, and a potentiometer. To start with the screen is simply displaying the reading from the pot with analogRead("PotPinNumber") but its fluctuating like mad:
Here is a video on YouTube (http://www.youtube.com/watch?v=fgEm7czlUVg YT has cut eh quality so it isn't very clear!), to start with I have turned the pot to max and you can see the fluctuation in the reading, then I unplug the pot from the analog input so it should be reading nothing but it drops to about 450 and fluctuates around there when surely it should drop to 0 (mystery voltage from somewhere perhaps?), then I plug the pot back in the analog input and you can see it go back up and fluctuate. This is the case irrelevant of which port the pot is plugged into and weather it is plugged in or not it still reads something?
Is the Arduino dead or am I dead?
On 30/05/10 22:12, James Bensley wrote:
I unplug the pot from the analog input so it should be reading nothing but it drops to about 450 and fluctuates around there when surely it should drop to 0 (mystery voltage from somewhere perhaps?), then I plug the pot back in the analog input and you can see it go back up and fluctuate. This is the case irrelevant of which port the pot is plugged into and weather it is plugged in or not it still reads something?
It's normal for an open input to fluctuate somewhat, which is why it is common practice to tie ports high or low with a highish value resistor. The input itself represents an almost zero load so EMI etc can cause the pin to "float"
If you were just using a potentiometer then you don't need to tie the ports as it should be relatively stable if you wire up the pot as a voltage divider and not as a series resistor. How did you have it wired when you performed this experiment ?
Also be aware that it will only be as stable as your circuit supply..are you running from battery here or something else ?
As another test I used some digital inputs, when I press the left button "A IS ON" is displayed on the LCD, when I press the right button "B IS ON" is display, even though you can't make out the text, you can see in this video that just being near the button makes the Arduino sense enough voltage to indicate the button is pressed and display some text...
http://www.youtube.com/watch?v=jKuIDsq0WIQ
OMGWTFBBQ?
I have forgotten how I wired that pot but I ripped it all apart and started over with this small test but the problem still persists?
Is interference really that big a deal on these small circuits? To answer your question, it is powered off of a front USB socket on my PC, but I plugged it in the back and got the same result. I also tried unplugging all other USB devices, turning off my monitors and speakers to that just the computer was on giving the Arduino power but it is still going mad for EMI.
I turned my PC off and the main power socket so everything in the room went off, and ran the Arduino off of my laptop so it was using the laptop battery, same result. I used a 9v batter, same result!
If my Arduino is this susceptible to EMI its pretty much useless.
On 2 Jun 2010, at 21:38, James Bensley wrote:
As another test I used some digital inputs, when I press the left button "A IS ON" is displayed on the LCD, when I press the right button "B IS ON" is display, even though you can't make out the text, you can see in this video that just being near the button makes the Arduino sense enough voltage to indicate the button is pressed and display some text...
http://www.youtube.com/watch?v=jKuIDsq0WIQ
OMGWTFBBQ?
I have forgotten how I wired that pot but I ripped it all apart and started over with this small test but the problem still persists?
Is interference really that big a deal on these small circuits? To answer your question, it is powered off of a front USB socket on my PC, but I plugged it in the back and got the same result. I also tried unplugging all other USB devices, turning off my monitors and speakers to that just the computer was on giving the Arduino power but it is still going mad for EMI.
I turned my PC off and the main power socket so everything in the room went off, and ran the Arduino off of my laptop so it was using the laptop battery, same result. I used a 9v batter, same result!
If my Arduino is this susceptible to EMI its pretty much useless.
I dont think thats EMI.
Arduinos, like all machines, are susceptible to EMI, however in my experience, the only thing Ive manage to make it 'go wrong' on an arduino due to EMI is when I had it sitting on *top* of my Yeasu FT897 which was transmitting. I think the results of EMI upon an arduino would begin with the USB/Serial communication dropping out, so if you print lots (like an * every loop) and play and if you find it drops out continually (for several seconds as the chip fecks up) thats a good sign of EMI.
Having done a fair bit of LCD work (a few years back) I think what you have there is some other circuit or software issue - either you have a circuit issue (bad connection) or you are not sending exactly the right commands to the system.
The other thing to consider is whether the LCD is drawing too much power from the Arduino - You may want to consider powering the board's backlight etc seperatly instead of through the arduino, and seeing if that affects it. The other possibility is that the LCD display is having a dodgy effect on the ground supply.
Also, powering your Arduino from a power source instead of via USB is a possibility because again, your computer might be giving dodgy ground (althought that is very unlikley)
JT
Sorry if this gets posted twice, I hate emails / email clients / mailboxes / whatever.
On Wed, Jun 2, 2010 at 9:38 PM, James Bensley jwbensley@gmail.com wrote:
As another test I used some digital inputs, when I press the left button "A IS ON" is displayed on the LCD, when I press the right button "B IS ON" is display, even though you can't make out the text, you can see in this video that just being near the button makes the Arduino sense enough voltage to indicate the button is pressed and display some text...
http://www.youtube.com/watch?v=jKuIDsq0WIQ
OMGWTFBBQ?
I have forgotten how I wired that pot but I ripped it all apart and started over with this small test but the problem still persists?
Is interference really that big a deal on these small circuits? To answer your question, it is powered off of a front USB socket on my PC, but I plugged it in the back and got the same result. I also tried unplugging all other USB devices, turning off my monitors and speakers to that just the computer was on giving the Arduino power but it is still going mad for EMI.
I turned my PC off and the main power socket so everything in the room went off, and ran the Arduino off of my laptop so it was using the laptop battery, same result. I used a 9v batter, same result!
If my Arduino is this susceptible to EMI its pretty much useless.
I dont think thats EMI.
Arduinos, like all machines, are susceptible to EMI, however in my experience, the only thing Ive manage to make it 'go wrong' on an arduino due to EMI is when I had it sitting on *top* of my Yeasu FT897 which was transmitting. I think the results of EMI upon an arduino would begin with the USB/Serial communication dropping out, so if you print lots (like an * every loop) and play and if you find it drops out continually (for several seconds as the chip fecks up) thats a good sign of EMI.
Having done a fair bit of LCD work (a few years back) I think what you have there is some other circuit or software issue - either you have a circuit issue (bad connection) or you are not sending exactly the right commands to the system.
The other thing to consider is whether the LCD is drawing too much power from the Arduino - You may want to consider powering the board's backlight etc seperatly instead of through the arduino, and seeing if that affects it. The other possibility is that the LCD display is having a dodgy effect on the ground supply.
I would have suggested powering your arduino from a different source, but I just spotted you did that already.
JT
On 02/06/10 21:38, James Bensley wrote:
As another test I used some digital inputs, when I press the left button "A IS ON" is displayed on the LCD, when I press the right button "B IS ON" is display, even though you can't make out the text, you can see in this video that just being near the button makes the Arduino sense enough voltage to indicate the button is pressed and display some text...
It's not 100% clear from the video but it looks like you haven't done what I said with the inputs and used a pull up or pull down resistor.
http://www.arduino.cc/en/Tutorial/Button
It's not that your Arduino is faulty, this is common to pretty much everything. If you just have a switch between supply and an input then when the switch is open the input is floating. Then EMI, crosstalk, leakage, RF, damp, solar flares or just a bloody great walking antenna putting their hands near it....pretty much anything can make it float just enough to go high.
http://www.youtube.com/watch?v=jKuIDsq0WIQ
OMGWTFBBQ?
I have forgotten how I wired that pot but I ripped it all apart and started over with this small test but the problem still persists?
and How did you wire it this time ? as a voltage divider ? I probably need to see a drawing of what you have done.
Is it wired like this http://arduino.cc/en/Tutorial/AnalogInput
Also a general question, I am unfamiliar with Arduino's but is it just common that switch inputs are debounced in the code rather than in hardware ? I'm used to PIC's were we don't always have enough resources to waste on debounce code so it is frequently done in hardware and in this case we wouldn't use that top example from the arduino site. You'd do something more like the example in fig 2A here.
Hi Wayne,
Yeah with the digital input fluctuating, it was because I hadn't set the pull up resistors, was having a bit of a mental lapse when I was doing this I think (that's what I'll say anyway). And yes, I am doing the de-bouncing in the code. That is all dandy now, still not sure how I missed this in the first place to be honest :s
However, I still have massively fluctuating analog inputs. You referenced the article, http://arduino.cc/en/Tutorial/AnalogInput
In my first post with that cruddy quality video where I detach the potentiometer and the numbers are still fluctuating (just at a lower voltage), it had been wired the same as the first (the colour) diagram in the above article. Obviously the screen was added in so I can actually see what's happening.
I have wired the screen in three different ways (2 of them are technically I guess wrong, but the screen still worked and I thought it may have an effect of the craziness of the analog reading of the pot but it did't!).
I'm at a dead end here...
Sorry for the delay, been away doing complicated things like getting married
On 08/06/10 23:30, James Bensley wrote:
I have wired the screen in three different ways (2 of them are technically I guess wrong, but the screen still worked and I thought it may have an effect of the craziness of the analog reading of the pot but it did't!).
I'm at a dead end here...
Is your pot a new one or a reclaimed one you salvaged from somewhere ?
Old dusty or worn pots will have a noisy behavior that could cause this. Also you could try building a voltage divider from two resistors across supply in series and then feed the point between them into the analogue input and see how stable that is.
Also remember that you are feeding a voltage into a presumably fairly low end A-D converter so some sampling errors should be expected in the same way that a digital volt meter will fluctuate between readings. If I am reading the right spec sheet then you have 5mV resolution so it wouldn't take much for the value you are reading to jump about a bit. How often does your code take a sample from the analogue input and what sort of variation are you seeing when the pot is set to max, I can't quite make it out on the youtube video ?
On 20/06/10 00:21, Wayne Stallwood wrote:
Sorry for the delay, been away doing complicated things like getting married
Congratulations!
I have until October to get out of mine :-)