The shipping fee depends on your address
Standard: 9-15 business days,fee is down to $3.99
Express: 4-7 business days,fee is down to $5.99
WE'RE READY TO BUILD A CUSTOM PRODUCT FOR YOU.
If you're looking for a custom product, we can help. Kindly contact us via email support@keszoox.com and send us the details for your need, then we'll let you know how we can deliver the right solution.We make into production usually Within 1 - 3 Bussiness Days.
Expect customization orders.Provides a 16 GPIO using I2C bus at up to 1.7MHz.
The MCP23017 provides a 16-bit general purpose bidirectional I/O port using the I2C bus.
It’s not unusual to run out of I/O pins on a microcontroller and the MCP23017 is a popular way to increase the number of GPIO available and has good library support.
Since it interfaces using the I2C bus, the MCP23017 uses only 2 pins on the MCU and up to 8 chips can be operated off the same I2C bus for a total of up to 128 I/O lines.
Three address pins (A0-A2) are used for setting the I2C address of the chip. These pins must be tied high or low to set the address and not left floating. If all three pins are tied to ground, the base address is 0x20 and can go up to 0x27 if they are all tied to Vcc. If more than 1 chip is used on an I2C bus, each must be set to a unique address.
The I2C bus can operate at up to 1.7MHz for fast manipulation of the I/O lines for higher speed applications. Note that to achieve 1.7MHz operation, Vcc needs to be 5V. When operating at 3.3V the maximum speed is limited to 400kHz which can still handle most I/O requirements.
If faster operation is required, the MCP23S17 which is the same chip, but uses the SPI bus, can operate at up to 10MHz bus speed even at 3.3V operation.
The 16 GPIO lines are configured as two 8-bit ports (PORTA and PORTB). Each pin can also be individually defined as an input or output for complete flexibility.
When pins are configured as inputs, an internal 100K pullup resistor can be enabled which is handy for inputs such as switches that require a pullup to Vcc when the switch is open and pull to ground when pressed. This removes the need to add external pullup resistors in some applications.
Another nice feature is that the input pins can be selectively inverted. For instance, a button press that would normally return a logic LOW can be inverted so it returns a HIGH.
Each GPIO pin can handle up to 25mA, but the total current for all pins must be kept under 150mA. If driving something like 16 LEDs, each LED current needs to be kept down around 9mA if they may all be on at the same time to avoid overheating the chip.
Interrupt capability is a nice feature since the MCU does not have to continuously poll the device looking for any change on the inputs.
Each of the two ports has a configurable interrupt output that can be used independently or the two interrupts can work together. Input pins can be set to interrupt the MCU upon a state change.
Another nice feature is that the interrupt outputs can be configurated as active LOW, active HIGH or OPEN-DRAIN.
The reset pin is active LOW and must be externally biased. If not using the reset pin, it can be tied to Vcc. It can also be be put under MCU control by connecting it to a digital output pin on the MCU. The pin is normally HIGH and momentarily driven LOW to reset the MCP23017.
These parts are very easy to use and have good library support on most MCU platforms.
The simple example shown here sets up one pin (GPA0) as an input to detect a button press. A second pin (GPA1) is setup as an output to light an LED while the button is being pressed.
Hookup of the chip is straight forward.
To use the program you will need to download the Adafruit MCP23017.h library using the Arduino IDE Library Manager. There are several other libraries also available.
Once the program is downloaded and running, pressing the pushbutton should cause the LED to light as long as the button is depressed.
An interesting exercise left up to the user is to modify this setup to use interrupts to notify the MCU that the button state has changed rather than constantly polling the MCP23017 to see what the current state is.
/* * MCP23017 Test Program * * Set one pin as input and detect a button push * Set one pin as output and turn on LED when button is pushed * * Vdd = 3.3V or 5V to match your microcontroller (Vcc) * * Connect pin #9 (Vdd) of the expander to Vcc (IC power) * Connect pin #10 (Vss) of the expander to ground (IC ground) * Connect pin #12 (SCK) of the expander to I2C Clock * Connect pin #13 (SDA) of the expander to I2C Data * Connect pins #15, 16, 17 (A0-2) of the expander to ground * Connect pin #18 (RESET) through a ~10kohm resistor to Vcc * Connect pin #21 (GPA0) to pushbutton, other side to ground * Connect pin #22 (GPA1) to LED cathode, other side to Vcc through 470ohm resistor */ #include <Wire.h> #include "Adafruit_MCP23017.h" Adafruit_MCP23017 mcp; // Uses default I2C address of 0x20 //=============================================================================== // Initialization //=============================================================================== void setup() { mcp.begin(); // use default address 0 mcp.pinMode(0, INPUT); // Switch input mcp.pullUp(0, HIGH); // turn on internal 100K pullup for switch mcp.pinMode(1, OUTPUT); // LED output } //=============================================================================== // Main //=============================================================================== void loop() { int buttonState = 0; buttonState = mcp.digitalRead(0); if (buttonState == 0) // Button is pressed mcp.digitalWrite(1, LOW); // Turn on LED else mcp.digitalWrite(1,HIGH); // Turn off LED delay(100); }
Notes:
Operational Ratings | ||
Vdd | 1.8- 5.5V | |
Max I2C Clock Speed | Vdd = 3.3V | 400kHz |
Vdd = 5V | 1.7MHz | |
Output Current | Per I/O Pin | 25mA |
Total package output current | 150mA | |
Package | Footprint | 0.3″ DIP-28 |
Type | Plastic, thru-hole | |
Mfr | Microchip | |
Datasheet | Microchip | MCP23017/MCP23S17 |
WE'RE READY TO BUILD A CUSTOM PRODUCT FOR YOU.
All orders are dispatched from our warehouse. The shipments are fully tracked—from our door to yours. Please allow 3-5 business days for your order to be processed in addition to the shipping times below.
Standard: 9-15 business days. Express: 4-7 business days.
Please note that shipping providers are extremely busy during this time, and some orders might experience a delay on top of usual delivery times. If your order is late, please allow 5-10 days more than indicated in standard shipping times before contacting our customer service. Thank you for your understanding.
All orders are 100% tracked. You’ll receive an email with a tracking number and a link to track your parcel once your order leaves our warehouse. Please allow 24-48 hours for the tracking link to start showing shipping information.
Receive our latest updates about our products & promotions.
Thanks for subscribing!
This email has been registered!