Skip to content

Commit 922d29f

Browse files
committed
Merge branch 'master' of github.com:ShrimpingIt/micropython-mcp230xx
2 parents f32a68c + a18d5dc commit 922d29f

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Micropython I2C-based manipulation of the MCP series GPIO expanders MCP23017 and MCP23008, derived from the Adafruit_MCP230xx.py module of https://github.com/adafruit/Adafruit_Python_GPIO
44

5-
This has been tested with ESP8266 running Micropython 1.8.7 on MCP23017 only, but hopefully works also for MCP23008 if you have one.
5+
This has been tested with ESP8266 running Micropython 1.8.7 on MCP23017 only, but hopefully works also for MCP23008 if you have one. Please post an issue if you have success.
66

77
To use, wire up the GPIO expander chip following this loom...
88

@@ -13,6 +13,26 @@ To use, wire up the GPIO expander chip following this loom...
1313
* 13 => ESP8266 GPIO3 (NodeMCU D2) [I2C SDA Signal]
1414
* 12 => 10kOhm resistor => 3.3V Supply [I2C SCL Pull-up]
1515
* 13 => 10kOhm resistor => 3.3V Supply [I2C SDA Pull-up]
16+
* 18 => 10kOhm resistor => 3.3V Supply [Reset pin in 'run' configuration]
17+
18+
Also choose the address of each MCP23017, e.g.
19+
20+
* Addressing pins for address 0x20
21+
* 15 => 10kOhm resistor => GND
22+
* 16 => 10kOhm resistor => GND
23+
* 17 => 10kOhm resistor => GND
24+
25+
The mappings between pins and I2C addresses are...
26+
27+
![Pin pull table](http://raspi.tv/wp-content/uploads/2013/07/MCP23017-addresspins1.jpg)
28+
29+
If you wish to use a different I2C address, or a different GPIO-numbered SDA or SCL pin than the default then pass that in to the constructor.
30+
31+
The default constructor arguments mean that MCP23017() is equivalent to MPC23017(address=0x20, gpioScl=5, gpioSda=4).
32+
33+
A handy visual reference is this from mathworks, although I recommend that for ESP8266 the chip power should be provided by 3.3V not 5V, to make sure logic levels are correct and that the serial data line doesn't overload SDA.
34+
35+
![MCP Pinout](https://www.mathworks.com/help/examples/raspberrypiio_product/win64/mcp23017_circuit.png)
1636

1737
For example, the following will set the output values of pins 10-15 and read the logic value (True or False) of pins 0-9
1838

@@ -35,4 +55,4 @@ for pinNum in inPins:
3555
io.setup(pinNum, mcp.IN)
3656
while True:
3757
print(io.input_pins(inPins))
38-
```
58+
```

0 commit comments

Comments
 (0)