Difficulty driving ULN2803A Darlington with MCP23S17 I/O port expander

Status
Not open for further replies.

jawshuwah

New Member
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

edit: added a slightly better schematic
 

Attachments

  • MCP2317 and ULN2803.png
    730.8 KB · Views: 210
  • ULN2803.png
    545.4 KB · Views: 202
  • IMG_0007.JPG
    461.6 KB · Views: 192
Last edited:
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.
 
Thanks for the reply! So just to be clear, you're saying put a 10k resistor between the 5V supply and pin 21 on the MCP23S17? (/pin 1 on the ULN2803)
 
Yes.
If you don't have a 10k, use something. I think we need to pull up harder.
 
Maybe I'm missing something... when I do that, the ULN2803 switches regardless of whether there's power coming from the MCP23S17 output

I have a variety of resistors... is it that a 10k is not quite right or perhaps I am connecting it incorrectly?

Sorry if this is a super beginner question!
 
the ULN2803 switches regardless of whether there's power coming from the MCP23S17 output
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.
 
I think you were onto it here, it looks like it's a software problem. I'll get to the bottom of it and reply with the solution!
 
Thanks for the reply! So just to be clear, you're saying put a 10k resistor between the 5V supply and pin 21 on the MCP23S17? (/pin 1 on the ULN2803)

Hi

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.

eT
 
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.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…