I'm having trouble trying to drive 12V relays with a ULN2803A Darlington array through a MCP23S17 16 channel port expander.
Both are functioning perfectly independently on either 5V or 3.3V, but when I combine them the ULN2803A will not switch from the MCP23S17 output.
When I directly connect the ULN2803A input to the Arduino 5V power supply it will happily switch. When I test the MC23S17 output I'm connecting to I get 4.93V - some drop, but the ULN2803A works fine also on only 3.3V or with a resister to drop voltage.
The other clue is that if I connect two outputs (getting 4.93V each) from the MCP23S17 to a single input on the ULN2803A it works (and is 5V at the input). This seems like a possible dirty fix but not ideal.
I am a total electronics noob sorry for terrible drawing
I do not know the MCP23S17 well. I used its older brother. The old ones pulls up very poorly. It does pull down well.
The ULN2803 needs 500uA of current into the input. Probably should have 1mA input current.
I think the MCP23S17 has pull down, pull up week and pull up hard. (programmable)
To make the old parts pull up to drive a ULN2803 I added a 10k resistor from +supply to I/O pin. Try that OR see if there is a way to make the MCP23S17 pull up harder.
Interesting
The MCP23S17's outputs are set to input or week pull up on (reset/power up). So before you program the MCP23S17 the ULN2803 will be on with the added resistor. (just like you found)
Next thing; read the data sheet for the MCP23S17. There are words like "open drain", "ODR", "active driver". The newer MCP23S17 acts just like the old part unless it is told to do different. I know the old part only pulls down. The pull up us very very week. Don't use the resistor. See if you can cause the MCP23S17 to "active drive" the output.
If your driving a relay the input of the 2803 should be low and go high to energize the relay. So it’s input should be low. Turn off the weak PU of the 23S17.
On the I/O expander, set the the port direction to output by writing a 0 to bit 0 of the IODIRA register. To turn the relay on, write a 1 to bit 0 of the output latch register (OLATA). To turn the relay off, write a 0 to bit 0 of the output latch register.
Use the document from ronsimpson as a reference. The registers are on page 12.