Arduino digital pins 10, 11, 12 and 13 and analog not working with relays

Having resolved the issue of multiple temperature sensors I then also wired multiple (4) relays. I connected the 4 relay shield to digital pins 7, 8, 9 and 10.
Surprise, they all work fine, with the exception of the one connected to pin 10. This flickered together with the Ethernet shield W5100 built-in LED.
So I have moved the pin connection to the next free pin, N. 11, but same issue. The same problem appeared also on next digital pins 12 and 13.
I have then tried to connect the relay to an analog pin, but also this did not work. It turned the relay on, but then it remains on and it is not possible to go to the off state. Same connection, to analog pin, worked fine in local (no Cayenne), so I assume it cannot be a wiring or sketch issue.

Regards, Giorgio

Hello,
From arduino http://arduino.cc/en/Main/ArduinoEthernetShield

“Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). This is on digital pins 11, 12, and 13 on the Duemilanove and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. These pins cannot be used for general i/o. On the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won’t work.”

The pin usage on the Arduino UNO would be the same as the Duemilanove. If your Arduino does not have an ATmega168 or ATmega328P processor (Leonardo, etc) you will have to look up which pins are used for SPI.

1 Like

Hi, thank you. I now have been able to find some literature on the
network shield.

I still do not understand the reason why the analogue pins have a
problem. They seem to come on, the first time you click on, and then
they stay on forever; until the board is reset.

Can you test them not with the relay, but with other hardware?
Keep in mind that analog pins are returning integers from 0 to 1023.