User Tools

Site Tools


rt_mcp23017

RT MCP23017

General Description

This is a MCP23017 board designed to be simple to connect sensors to.

P1 is the power supply connection for the sensors.

The three rows of 16 pins labelled 0 - 15 are 2.54mm(0.1inch) pitch and are set up as follows:

S = sensor input to RT_MCP23017 or output to led/relay etc

+ = +V voltage for the sensor etc this is supplied by the +V connection on the screw terminal P1

G = ground for the sensor etc this is connected to the GND connection on the screw terminal P1

I2C connection is via the Qwiic/Stemma Qt/Picodev connectors C1/C2 at either end of the board or the headers H1 and H2.

The int beside the H1 and H2 headers can be used for interrupt connection to the micro-controller.

I2C address can be set using A0,A1 and A2. Base I2C address is 0x20.

The inputs and outputs are as normal for a MCP23017. All can be used as outputs however, only 0-6 and 8-14 can be used as inputs. This is a design limitation of the MCP23017.

In Use

If you've purchased this without the headers and P1 terminal soldered then the first thing to do is solder them into place. If not then continue from Powering Up.

We suggest soldering them in this order.

The supplied white, red and black 8 pin headers are soldered in the S, + and G positions respectively.

The 2×3 header is soldered at the A0, A1, A2 I2C address selection position.

If you want the H1 and H2 I2C headers and the int (not supplied) then solder them next. These can be 5 pin headers to include the int connectin on the header.

Solder the P1 power screw terminal in position.

Check that you have made all solder connections.

Powering Up

At this point connect the power supply to P1. This is the power supply for the sensors only not the MCP23017. The power supply is not reverse polarity protected so ensure that it's +V is connected to +V and Gnd is connected to Gnd.

Once connected and powered on check that you have the correct voltage a the + (Red) and G (Black) pins of the sensor connections. Use a voltmeter (multimeter set to read DC volts).

When you have confirmed that this is correct turn off the power supply.

Now connect the RT_MCP23017 to your micro-controller via either the Qwiic connections (CN1/CN2) or the pin headers (H1/H2).

It's now time to power up the micro-controller and test the connection to the MCP23017. The easiest way to do this is to use something like the i2cscanner sketch in Arduino IDE or similar if your using some other programming environment.

Assuming everything is correct you should see a device at I2C address 0x20, this is the default address.

You can now connect sensors or leds etc to the input/output pins and use this with the program you intend.

Connecting Sensors (Input)

The sensors need to be a digital output sensor.

Such as a “KY-032 Obstacle Avoidance Sensor Module” or “KY-003 Hall Magnetic Sensor Module”

They also need to operate at the voltage of your power supply connected to P1.

The RT_MCP23017 is designed to work from 3.3V or 5V micro-controllers and can acccept 5V input.

The connection is simply S to the sensor output, + to the sensor +V supply and G to the sensor ground. As can be seen on the above image the connections on the module are in a different order to the RT_MCP23017 so you need to ensure that your connections are correct.

Our recommended method is to use three way cable with colour coding the same as the pins and ensure that the cable plugs has good connection to the RT_MCP23017 and the sensor.

Due to a design limitation in the MCP23017 ic connection 7 and 15 can not be used for sensor input.

Connecting Leds or Relays (Output)

Relay modules like this:

can be connected as an output from the RT_MCP23017.

Note that the input pinout on this board is different to the output pinout from the RT_MCP23017. This is a good example of having to really check how your board is connected.

In this case it's a matter of connecting the S to the In, the + to VCC and G to GND. You will also need to be aware if the board requires high or low activation on the In pin.

To connect a led it depends on how you wish to turn the led on. Either with a high output (not recommended) or low output (recommended) from the RT_MCP23017. The diagram below shows how to connect either method.

NOTE the MCP23017 is limited to 25mA sink or source on an output. So be carefully with your led current limits. With the above circuits and a 5V supply voltage the current is 15mA.

NOTE if you use a high output you are also using the power supply from the I2C buss not the P1 connector. This is not recommended as it will affect your micro-controller operation if you exceed the limits of it's power supply.

Wiring

There's numerous options to wire devices to the RT_MCP23017.

The original design discussion was that it would be good to have it use servo extension cables like these:

servo extension male male

servo extension male female

These are available in various lengths with either male or female ends.

They have cables coloured yellow, red and brown. So for use with the RT_MCP23017 yellow goes to white, red to red and brown to black. They are also available with white, red and black cables.

The male end of these is what I would consider to be a female dupont connector. So these will connect directly to the male pin headers on the RT_MCP23017 board.

Depending on your sensor modules you may need to change the cable positions in the connector. This is easily done with a small screwdriver or o-ring pic. There's a youtube video here:

Dupont pin removal insertion

It's recommended to make any changes at the sensor or relay module end.

Purchasing

If you are on the DCC-EX channel on discord DM me user Rosscoe. If you buy it via discord payment will be by PayPal.

Price does vary depending on your location but as at 15 January 2024 they are:

$AUD15.00 each posted within Australia.

$AUD18.60 each posted outside Australia.

This is non tracked postage.

If you need tracked postage it can be arranged at cost.

Bulk discounts also apply.

What you will receive:

  • 1 x RT_MCP23017 board
  • 2 x 8pin white male headers (will be sent as 16 pin need to cut)
  • 2 x 8pin red male headers (will be sent as 16 pin need to cut)
  • 2 x 8pin black male headers (will be sent as 16 pin need to cut)
  • 1 x 2×3 male header

If you need the power connector then please specify screw termainal or pluggable header. These are available at extra cost.

rt_mcp23017.txt · Last modified: 2024/03/21 12:07 by rosscoetrain