0

Okay so I just accidentally bought a MCP23017 instead of MCP23018(this one is 5V tolerant) I don't have time to buy this one, because shipping to my country is painfully slow. Will be simple voltage divider sufficient? Im planning to use SainSmart 16-channel 12V relay module and some users report relay output 5V to gpio pin when it's off..

  • Do you plan to drive the SainSmart relay module from the MCP23017 and to drive the MCP23017 from the Raspberry Pi? – joan Aug 7 '15 at 8:50
  • @joan yeah, that's it! And on the relay is LM2376 12v to 5V conventer and 5V out pin, so I'm also thinking about powering my raspberry pi from 5V pin – Quest Aug 7 '15 at 9:00
0

I am NOT an electronics type of person so treat what I say with caution.

I don't see that using the MCP23017 or the MCP23018 will make any difference.

You can power the MCP23017 from 5V (or slightly over) so it will feed 5V into the relay.

The problem will be that you might not be able to control the MCP23017/18 from the Pi if you power them from 5V.

The datasheet says the minimum voltage needed on the SCL/SDA lines to be seen as a logic 1 is 0.8 VCC, or 0.8 of the power supply voltage. If you power from 5V that means you will need SCL/SDA to be 4V. The Pi's I2C pull-ups are to 3V3, which is less than 4V. You should not use pull-ups higher than 3V3 on the Pi's I2C bus. You will damage the Pi.

To my mind a far simpler solution will be to use a couple of chips such as the ULN2003A or similar (they drive 7 or 8 outputs each, so you will need at least two for a 16-channel relay). They can be driven from the Pi and will safely switch the voltages you need.

  • MCP23018 will use 3V3 on I2C bus even if the input is higher (up to 5.5V) that's what differs. – Quest Aug 7 '15 at 9:44
  • I'll try to visit local store for ULN2003A – Quest Aug 7 '15 at 9:46
  • I think that using optoresistor would be easier (it is like a transistor, or current controled switch, but it does not directly connect the lines it controls) so having 5V power supply on your GPIO (there is at least one) you cuold connect it to optoresitor's one end, the chip to the other and connect any GPIO pin to optoresistor control pin. – Piotr Kamoda Aug 7 '15 at 10:06
  • I just found out that array is way much cheaper :P link for optoresistor – Piotr Kamoda Aug 7 '15 at 10:13
  • @Quest I've quicklty re-read the datasheet. I don't see where the MCP23018 behaves differently to the MCP23017 regarding the I2C bus and the supply voltage. – joan Aug 7 '15 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.