Power net portal is a special schematic object used to define a power or ground net. Power ports allow you to conveniently indicate a power net at any location in the design. Power nets of the same designator automatically connect throughout your design #portal #power
A generic fixed inductor for rapid developing circuit topology. *You can now change the footprint and 3D model at the top level anytime you want. This is the power of #generics
The MCP23017 is a 16-Bit I/O expander, which works off a lower logic level typically ranging between 1.8V and 5.5V, depending on the specific version used. The device will not natively handle signals at +24V. To interface it with a system using +24V signals, you'll need to include some additional components:
Level-Shifting Devices: These components can safely lower the voltage from +24V to a level the MCP23017 can handle without damaging it. There are many ICs available that can accomplish this, but you could also design a simple level-shifter using resistors and MOSFETs.
Overvoltage Protection: Even with level shifters, it's worthwhile to protect your I/O pins from overvoltage conditions. Schottky diodes are often used for this purpose.
Pull-Up Resistors: While not strictly necessary for voltage shifting, most I2C applications (including the MCP23017) benefit from the addition of pull-up resistors on the SDA and SCL lines.
While I can provide general information about how to connect these components, without knowing the specific parts you're using, the exact connections might vary. Feel free to provide any additional parts so I can give a better guidance. I should also note that it's crucial to verify the suitability of any components used with the requirements of your project before implementing them.
Yes, using optoisolators (also known as optocouplers) is a good approach when dealing with signal levels that are higher than those a component can natively handle, like in your case of a 24V signal and the MCP23017 I/O expander. Optoisolators provide effective voltage isolation and level shifting, and also provide the benefit of electrical isolation between your input and output, protecting your components from electrical noise, voltage spikes, and other harmful conditions.
For your use case, you would need an optoisolator that can handle 24V on its input side and 5V or 3.3V (whatever level the MCP23017 operates at in your circuit) on its output side. One such example is the PC817 optoisolator.
However, continue bearing in mind that specific application requirements might call for different components or specific ways to integrate them into your design. Ensuring that you select components that can handle the expected voltage levels, currents, and frequencies of your application is crucial for the stability and reliability of your design.
Note also that every optoisolator has two sides: an input (LED) side and an output (phototransistor) side.
On the input side, you would typically connect:
The terminal from the 24V signal to the anode of the optoisolator's internal LED.
The cathode of the LED to a current limiting resistor, then to the ground (or negative) of the 24V signal.
On the output side, considering that MCP23017 works with active-high signals:
Connect optoisolator's collector terminal to the VDD (typically +3.3V or +5V, depending on the version of MCP23017 you are using).
Connect optoisolator's emitter terminal to the respective I/O pin on MCP23017.
These are general guidelines. The specific connections might vary based on the exact wiring and components used in your project. Make sure to verify the specifications of your optoisolator (forward voltage, current, etc.) and ensure it's compatible with the MCP23017 and your project specification.
The value of the resistor to use with the PC817 optoisolator in your circuit can be calculated using Ohm's Law. You'll need to know the forward current and the forward voltage of the optoisolator's input side (the internal LED). According to the PC817 datasheet, I typically suggest these values:
Forward Current (If) = 20mA (Common operating current for many LEDs)
Forward Voltage (Vf) = 1.2V (Typical forward voltage drop across the PC817's LED at If=20mA)
Next, consider that your input voltage is 24V. Applying Ohm's Law:
Resistor value (R) = (Input voltage - Forward Voltage)/ Forward Current
R=20mA24V−1.2V=1140Ω
So, you would ideally use an 1140 Ohm resistor. However, standard resistor values don't include a resistor of exactly 1140 Ohms. The closest standard value resistor would be 1.2k Ohms, providing a slightly less forward current, increasing your component's lifespan without noticeably affecting its operation.
Here's the connection description with the chosen resistor:
Connect <24V signal> to PC817:anode
Connect PC817:cathode to R1:1
Connect R1:2 to <Ground of 24V signal>
Connect PC817:collector to MCP23017:VDD
Connect PC817:emitter to MCP23017:<specific I/O pin>
Where <24V signal> is your 24V input, <Ground of 24V signal> is its corresponding ground connection, and <specific I/O pin> is the respective I/O pin on MCP23017 you want to interface with the 24V signal.
Please replace <24V signal>, <Ground of 24V signal> and <specific IO pin> per your project's requirements. Remember to replace "R1" with your chosen resistor's designator as it appears in your schematic.
The above connections and resistor's value are recommended based on assumed typical values. Any changes in these suggested values should match the requirements in your specific application.
Using a pull-up or pull-down resistor depends on the specific needs of your circuit and the mode in which your I/O expander - the MCP23017 - is configured.
In most cases, it's recommended to use pull-up resistors on the I2C lines (SDA and SCL), because I2C is an open-drain/ open-collector bus. This means, devices can pull lines low, but must rely on external resistors to pull them back high.
For the rest of the I/O pins on the MCP23017, whether you need resistors on the I/O pins depends on your specific application:
If the I/O pin is configured as an input, it might be necessary to use a pull-up or pull-down resistor, depending on the state you want the input to default to when nothing is connected. Keep in mind that MCP23017 has configurable internal pull-up resistors for its I/O pins, which are disabled by default, but can be enabled via I2C commands.
If the I/O pin is configured as an output, typically, you won't need a pull-up or pull-down resistor. A resistor might be used in series with the output pin as a current-limiting resistor if you're directly driving an LED or a similar device.
Remember to carefully consider your system's needs based on the specific behavior you want to achieve. Refer to the MCP23017 datasheet for detailed guidance on how to interface with and configure this device.
When you're using the I/O pins of the MCP23017 as inputs and you're interfacing with an optoisolator like the PC817, there's typically no need for an additional current-limiting resistor on the MCP23017 I/O pin. This is because the optoisolator itself provides current-limiting on its output (the transistor side).
The phototransistor side of the optoisolator, which connects to the MCP23017's input pin, effectively converts the input current (which is limited by the resistor on the optoisolator LED side) to a voltage signal that's safe for the MCP23017.
However, depending on the state you want the input to default to when the optoisolator is inactive (no light emitted by the LED), you might still want to use a pull-up or pull-down resistor. For example, to default to a logic low when the optoisolator is inactive, you could connect a pull-down resistor between the MCP23017 input pin and ground.
Please note that you can enable the use of the MCP23017's internal pull-up resistors via I2C commands if your application calls for it. Consult the MCP23017 datasheet for specific details on how to accomplish this.
As always, while this general advice should apply to a broad array of typical circuits, the specifics of your project could necessitate a different approach. Consider your circuit's unique requirements carefully when making these design choices.
Apologies for any confusion, but currently, the capability to draw or create visual content directly is not available. However, guidance can be provided on how to create the circuit with the specified components. Consider this a series of individual points to connect.
Connect the +24V signal to one terminal of a current limiting resistor (1.2k Ohms for example). Connect the other terminal of the resistor to the anode of the optoisolator (PC817).
Connect the cathode of the optoisolator to the ground of the +24V signal.
Connect the emitter of the optoisolator to the ground of the MCP23017 and the collector to one of the MCP23017's I/O pin which you will use as an input. Remember, every I/O pin you are going to use should have its own optoisolator.
Connect the VDD pin of the MCP23017 to the +5V power supply and the VSS pin to the ground of the power supply.
Reminder: It is highly recommended to refer to the datasheets of the PC817 and MCP23017 to understand the exact pin configurations and characteristics of these components. Apologies for not being able to draw the circuit. At this stage, direct visual representation is currently not available.
Converting the MCP23017 output up to +24V also requires signal conditioning, similar to handling +24V inputs. Both a level shifter and a power amplifier will be required.
To do this, an optoisolator can still be used, but this time in a different mode: the transistor within the optoisolator will not just be used as a switch, but also as a current amplifier.
Here's how:
Connect a pull-up resistor between the collector of the optoisolator and the +24V line. This pull-up resistor should be chosen based on how much current you expect the output to sink when the optoisolator is turning on. A value like 2.2KΩ might be a good starting point.
Connect the emitter of the optoisolator to ground.
Connect the MCP23017 output to the anode of the optoisolator's LED (input side) through a current-limiting resistor, similarly to how we drove the input side of the optoisolator before.
Connect the cathode of the optoisolator's LED to the ground of the MCU.
When MCP23017 provides a signal, the optoisolator takes that signal and pulls up the connected line (through the pull-up resistor) to +24V. The output signal will be inverted because of this setup (a LOW from MCP23017 will result in +24V output, and HIGH will result in 0V), so you'll need to account for this inversion in your software or change the pull-up to a pull-down if the inversion is a problem.
Remember to supply the correct VDD to the MCP23017 (either +3.3V or +5V depending on your chosen version), and also couple the grounds of your different voltage supplies to tie the voltage references together. Always consult the datasheet of your components to check for electrical rating compatibility and please test this setup carefully, ensuring that your components are not subjected to voltages exceeding their absolute maximum ratings.
11mo
what elements i need to use mcp23017 with +24V signals
Hey, I'm copilot! I can help you with all kinds of stuff in your project. Reach me at any time by tagging me on comments or in the chat with my handle, @copilot.
Let's start by adding four MCP23017 I/O expanders to your project. The MCP23017 is a 16-bit I/O expander with an I²C interface. Each expander can be configured with different I²C addresses, allowing multiple devices on the same bus.
Here’s how we can proceed:
Assign I²C Addresses:
The MCP23017 has 3 address pins (A0, A1, A2), allowing for 8 different addresses.
For four MCP23017 devices, we can use different combinations of A0, A1, and A2.
Electrical Connections:
Connect each MCP23017's SDA and SCL pins to the I²C bus.
Connect the VDD pins to your power supply voltage (typically 3.3V or 5V).
Connect the VSS pins to your ground.
Use pull-up resistors on the SDA and SCL lines if necessary.
Pin Configuration:
Decide the purpose of each pin on the MCP23017 (input/output).
PCB Layout Considerations:
Minimize trace lengths for I²C signals.
Ensure proper decoupling capacitors are placed near the VDD pins.
Consider the physical size and placement of components to ensure clean routing.
Let's connect the first MCP23017, and then you can replicate these connections for the other three. Here's a suggestion on the connections for the first MCP23017: