Bizarre problem with analog inputs and Wiznet

Alright, I have an incredibly frustrating problem that has me stumped. I’ve been using Uno R3 boards and Wiznet WS5100 shields for communications on my flight simulator instruments, and they have worked great (goodbye USB!!!). My usual method is to work out how to drive the instrument straight from just the Uno board and virtual serial (USB) for communications/debugging at first.

I got a gauge working PERFECTLY tonight with the debug/development arrangement.This particular instrument relies on one analog input for a potentiometer. I was using A0. This input is pulled down by a 22k resistor to ground. After thoroughly testing the gauge itself, I then stuck a Wiznet on top of the Uno. However, before touching my code, I went ahead and fired up the gauge again just to make sure all was well. Well, all was not well. My analog input is now reading too high… It’s functioning like something is biasing the pot. I tried switching to A1 just to see if this Wiznet was mysteriously using A0 for something, but results were exactly the same. I also tried adding in the ethernet code to initialize the Wiznet and get it running, thinking perhaps having it in a “zombie” state did something odd. No change. I also tried another Wiznet to make sure I didn’t have a dud.

To clarify, zero on the analog input is still in the same position on the potentiometer, but 1023 comes up sooner. The offset doesn’t seem to be linear throughout pot travel, otherwise I could put in an arbitrary offset or scaling factor to my analog reading just to “make it work”.


OK, solved my problem (for now).

Out of sheer desperation and a tired post-midnight mind, I tried A2, and voila, instrument is working now. Evidently A0 and A1 are both being used for something by the Wiznet, but what? Since I was on to the A0/A1 specific stuff, I did some more searching and found this topic:

One of the replies there says that the official shield list claims A0 and A1 used for some shield detection stuff. Would be nice if this were in the ethernet tutorial (for that matter, a list up front at the beginning of the tut or official page of all the pins this shield needs would be adding A0/A1 to my list of "do not use" pins).

The ethernet shield is salvation from the grief of dealing with USB on a complex network of embedded devices that simply must work all the time, but I sure wish it wasn't so pin-hungry. Two of the unusable pins are PWM outputs, seems rather wasteful.


I think the A0 and A1 pins were used by the SD card slot on some models of the ethernet shield. One was the SD detect and the other was the SD write protect.

That does not apply to the new R3 model ethernet shield according to the schematic.

Which model are you using?

This is an ebay cheapo with no name on does have the SD slot (which I find very strange, and TOTALLY do not need).

I suppose I should only buy "genuine", but with the amount of projects I'm working on, the cost adds up really fast.

I have a new problem now.....making a new post for that.