OK, so the next module I am working on creating is an I2C relay module to integrate with a Nano 33 IOT on separate DIN mounted modules.
This module will have:
Inline Fuses (automotive type)
A common 12 V connection to the relays
and I2C connection probably through an MCP23017 chip
My questions:
Do I need opto-isolation for the MCP23017?
If so would the following chip work and also provide the darlington required to drive the coils? 2047059.pdf (farnell.com)
Would I need excessive trace size to make the 12v common to the relays?
Do I need a diode for the relays to protect the darlington? I was going to use a ULN 2803 if the above chip is not ok. ULN2803A Darlington Transistor Arrays datasheet (Rev. H) (ti.com)
Relays are going to be relatively standard 10A 12V things
The I2C bus is not that kind of bus. The I2C bus is not supposed to go somewhere else. The I2C bus is also a bus with weak signals (the high level is created with pullup resistors) and if you have motors or relays then the I2C bus might cause your project to fail.
Think of the I2C signals as signals that are at least 100 times weaker than normal digital signals.
Some optocouplers should be driven with 10 or 20 mA. Your Arduino board can only give 7mA.
A darlington output is not often used anymore.
A inductive load always needs a flyback diode, maybe more components are needed for more dampening.
The ULN2803A is a chip from decades ago. But it has a internal flyback diode.
There are many opto-mosfet, photo-mosfet and other opto-switch-driver-chips-things.
There are no standard relays. Can you give a link to a relay that you have in mind ?
What will they switch ?
Why do you want to use relays ? Melting contact pins, deforming plastic and sparks flying around is not a pretty sight. A mosfet can be more reliable.
Can you make a drawing ? You can draw something on a piece of paper and make a photo of it. Please draw all the wires, and show how the power wires go, especially the ground wire.
Are all your questions of the last week about the same project ? Maybe a moderator should put them together.
The nano will only be connected to the mcp20317 via I2c. I was wondering if the MCP needed an optoisolator between it and the Darlington array. If it doesn’t I will use the uln2038 to do the job as I have it in other modules and so it keeps price down. If it has the diode then even better.
Loads on the relays will mostly be 12v leds and occ pumps. I will fly back the pumps.
I am doing separate individual stand-alone modules so I thought each one should have its own topic. Otherwise it would be hard for anyone to search and see an individual module without being bogged down with a massive confusing mixture. If the mods think they are better combined then fine.
Hi,
If you are going to control relays, you don't need to opto-isolate them.
Just make sure your wiring layout keeps the relay switched output AWAY from the rest of the control circuitry.
Also use branded relays for reliability, OMRON, PANASONIC, Schrack.
In other words don't buy them from AiExpress or Bang.
Note the voltages your board will need to drive these different components.
So: Middle top is the MCP 23017 which is connected to the arduino nano iot module through a wago connector (shematic bottom right). We have 2 ULN 2803a providing the drain for the relay activation. Power to the chips is the 3.3v from the nano. Power to the relays is 12V from large lead/acid battery bank (~200Ah deep cycle). Beneath the MCP is the wago terminals for attaching loads to the relays and beneath them is the automotive fuses for the loads. I2C addressing is through a dip switch bottom left
Keep in mind, the SCL and SDA lines need 1 pullup each, somewhere in your system. My experience is, you can put two or three MCP23017 in a string without using any pullup, but at some point things get flaky, and adding the pullup solves that - when I finally remember to install them! Sigh.
C
Hi,
Thanks for the schematic.
Is there a reason for 12V coils, rather than making the whole PCB 5V or 5V and 3v3?
Is there a reason for 12V on the outputs of the relays, wouldn't it be more versatile to just have three output terminals for each relay so the application can choose what it switches, ie 3V3, 5V, 12V or some sensor signal.
That is have NO, NC and COM terminals with no 12V from the PCB connected to them, voltage free.
The project is for a boat and is to replace a main wiring system. The boat is powered by 12V batteries hence the 12V. The main junction box in the boat would require every relay COM to be powered with 12v from the battery and then have the NO to any equipment. Having a common 12V to all the COMs on the relays reduces wiring considerably and makes the junction box more tidy. Essentially I can have a reasonably heavy wire from the battery to the module and then just one wire from any load with the negative going to a common buzz bar.
I would need to generate a separate 5V supply but your idea would make the boards more similar to the off the shelf types that are generic and flexible to other uses. My needs are specific but I am tweaking all the time to subject to change.
If there is an equivalent of the MCP23017 that only does 8 GPIO that might be better and I could split the modules. I am planning all 16 mostly just to use all the available gpio but that is probably silly
To be honest, if I was confident I could work out the NMEA communication properly I might change the whole thing and make each module with a teensy and plugged into the NMEA canbus. That is a project for once I understand Timo's nmea library and work.