Arduino Best expander Input/Output | GPIO Expansion module | MCP23017, MCP23S17

Поделиться
HTML-код
  • Опубликовано: 20 фев 2022
  • You will certainly learn something new from this video!
    Here I go with a new DIY breakout module, and this time I axplained how to design and use a GPIO expansion module that could be used by any microcontroller like #Arduino, Raspberry Pico, STM32, NodeMCU or any other MCU dev board as long as it has a I²C bus
    This MCP23017 Module board has been designed under Altium Designer and you can start a FREE TRIAL of this EDA software through this link :
    www.altium.com/yt/DIYGUYChris
    ★☆★ Trusted sources ★☆★
    PCB designing tool : www.altium.com/yt/DIYGUYChris
    PCB manufacturing : jlcpcb.com/PCH
    Arduino Portenta : store.arduino.cc/products/por...
    ★☆★ DOWNLOAD PCB GERBER FILES ★☆★
    GERBER files : www.mediafire.com/file/kf17oc...
    ★☆★ DOWNLOAD SCHEMATICS ★☆★
    Download PDF : www.mediafire.com/file/8eei5h...
    ★☆★ ARDUINO CODES ★☆★
    ★☆★ My Video filming tools ★☆★
    Main Camera Canon Rebel T7 : www.amazon.com/gp/product/B07...
    Macro Camera lens : www.amazon.com/gp/product/B06...
    Secondary camera Gopro Hero 8 : www.amazon.com/gp/product/B08...
    LED Video lighting : www.amazon.com/gp/product/B08...
    ★☆★ 💻 FOLLOW ME BELOW 💻 ★☆★
    Instructables: www.instructables.com/member/...
    Hackaday : hackaday.io/DIYGUYChris
    Facebook : / diyguychris
    Twitter : / chris_diy
    Hackster : www.hackster.io/diyguyChris
    TikTok : vm.tiktok.com/ZMRAvhK9u/
    Keywords
    #ArduinoProject #MCP23017 #Electronics #Maker #diy #howToDiy #HowToDesignPCB #Altium # #PCBAssembly #SMD #EasyTutorial #STEM #circuitDesign
  • НаукаНаука

Комментарии • 65

  • @safadjobbi7773
    @safadjobbi7773 2 года назад +3

    We need more videos like this 👏 🙏 keep up the good work 👏

  • @yosrahmedi4753
    @yosrahmedi4753 2 года назад

    ohhh ça déchiiiire 😍gooood joob Chris

  • @Electronicshobbyy
    @Electronicshobbyy 2 года назад

    As always in the top 🎩

    • @DIYGUYChris
      @DIYGUYChris  2 года назад

      As always continued support 🙈

  • @tayebaouadi1413
    @tayebaouadi1413 2 года назад

    Great work, good continuation 👏

  • @chaimajabri1710
    @chaimajabri1710 2 года назад +1

    I have followed all stages on your Instagram too it's seems so cool good job👏

  • @giantkherva2141
    @giantkherva2141 Год назад

    In a project, altera max ii fpga ic and mcu atmega328p are installed, altera max ii was used to expand io pins. Only the MCU must be programmed. Or both the Altera Max II and the MCU will be programmed.

  • @temyraverdana6421
    @temyraverdana6421 2 года назад

    Thanks, useful project.

  • @abdallahkhmeri6570
    @abdallahkhmeri6570 2 года назад

    very good M'ester belkhir

  • @amenighraibi5153
    @amenighraibi5153 2 года назад

    Top project

  • @jendoubimarouan3914
    @jendoubimarouan3914 2 года назад

    Good work ✌️🇨🇦

  • @mohamedkamel7897
    @mohamedkamel7897 2 года назад

    Good job 🎖️

  • @eyarihani528
    @eyarihani528 2 года назад

    Good job 😉

  • @brentonrowland8613
    @brentonrowland8613 2 года назад +1

    Excellent project Chris. Any plans for an analogue version of the multiplexer?

    • @DIYGUYChris
      @DIYGUYChris  2 года назад +1

      Do you have any suggestions about some AD devices? I'm doing digital all the time but I have some interest to make some analog modules so any recommendations from you will be very appreciated

  • @inlywang8157
    @inlywang8157 2 года назад

    Nice to see your new video, I wonder how long you spent on hand solder, the board is small, but you did a fantastic job.

    • @DIYGUYChris
      @DIYGUYChris  2 года назад

      Yeah, soldering was challenging because of the tiny components size 🙈

  • @Daniel-odanio
    @Daniel-odanio 3 месяца назад

    how is the pin state at startup of the expander? high or low?

  • @mr.satishfy
    @mr.satishfy Год назад

    Can we use ic 7219 mux
    For conneting more relay in case of attiny mcu

    • @DIYGUYChris
      @DIYGUYChris  Год назад

      Do you mean the TMUX7219? That's a switch not an MCU.

  • @user-ml1jx3oi8r
    @user-ml1jx3oi8r Год назад

    Is it possible to use audio input (e.g. inmp441 i2s) or audio output (e.g. max98357A i2s) via this port expander? If yes how is it done, especially the pin config? Thanks for any advice. I only got buttons, leds, encoders to work.

    • @DIYGUYChris
      @DIYGUYChris  Год назад

      I²S is an audio communication protocal that requires an I²S data line which is not existing in MCP expander not even in other GPIO Expander because these will provide General Purpose IO but I²S is specific IO for sound.
      I hope you can distinguish these two terms (I²S and GPIO) !

  • @br52685
    @br52685 4 месяца назад

    In your example sketches, one demonstrated OUTPUT and the second demonstrated INPUT.
    Can this expander have some
    pins set to OUTPUT and different pins set to INPUT (within the same sketch)?

    • @DIYGUYChris
      @DIYGUYChris  4 месяца назад +1

      Sure thing, it is as same as you set the arduino pin I/O

  • @vijuthomas7880
    @vijuthomas7880 2 года назад

    Hi , like your project, can you pls do Nodmcu with water tank Level indicator IoT.?

    • @angzarr9584
      @angzarr9584 11 месяцев назад

      its exactly the same just use the i2c pins on the nodemcu

  • @abdallahkhmeri6570
    @abdallahkhmeri6570 2 года назад

    top borject

  • @medhasnaoui1533
    @medhasnaoui1533 2 года назад

    👍🎉👏👏👏👏

  • @luizpollo
    @luizpollo 2 года назад +1

    Sooo, could you make a 3d printer with raspberry pi pico now that you can expand its IO pins?

    • @DIYGUYChris
      @DIYGUYChris  2 года назад +1

      You can make 3D printer without any need of expansion : )

    • @luizpollo
      @luizpollo 2 года назад

      @@DIYGUYChris But for a 3d printer usually you have to have at least one stepper per axis and an extra for the extruder, i think the pico doesn't have that much IO pins

    • @DIYGUYChris
      @DIYGUYChris  2 года назад +1

      @@luizpollo you will not get the steppers powered directly from Pico, there you will have stepper motor drivers, A4988 is one of these drivers.
      In this case no need for extra GPIOs

  • @kevinhoublon8630
    @kevinhoublon8630 Год назад

    Hello, great video 😄.
    I'm a beginner and I have a question :
    Can you use the MCP23017 with the TCA9548A multiplexer?
    Thank you in advance for your precious support 😁.
    Cordially.

    • @DIYGUYChris
      @DIYGUYChris  Год назад +1

      Indeed

    • @kevinhoublon8630
      @kevinhoublon8630 Год назад +1

      @@DIYGUYChris Hello, thank you very much for your feedback 😁.
      Have a nice weekend 😄.
      Cordially.

  • @Hangs4Fun
    @Hangs4Fun 5 месяцев назад

    does that adafruit library handle the debouncing of the switch or did you add a 5ms piece of logic in there yourself? I noticed you got precisely only one message per push down and one for release. Normally momentary switches (especially ones that are not top quality) will "bounce" as the mechanical plate causes a bounce (you can see on the o scope) when you get close to closing. debouncing usually removes this or putting in about a 5ms logic to handle it. Very cool video. I have used a dozens of PCA9685 modules and love anything i2c

    • @DIYGUYChris
      @DIYGUYChris  5 месяцев назад +1

      That's a good point to highlight, I got the inputs to interpret the clicks through logic edge because edges appear one time but logic level is continuous so I suggest you add a boolean variable as a flag for each input reading and add it to the input read if() statement so for example instead of writing if(digitalRead(input))
      {
      Serial.println("message");
      }
      You write
      if(digitalRead(input)&&flagInput)
      {
      Serial.println("message");
      flagInput=0;
      }
      if(!digitalRead(input))
      {
      flagInput=1;
      }
      This way the flagInput variable will ensure that we get the message one time only once the input is high.
      This will cost you some of the dynamic memory of your MCU due to variables use.
      Instead you could add a short delay of around 200 ms just inside the "if" statement so it becomes like this
      if(digitalRead(input))
      {
      delay(200);
      Serial.println("message");
      }
      But this will keep you getting the message on the serial as long as the button is clicked.
      I hope this is clear

    • @Hangs4Fun
      @Hangs4Fun 5 месяцев назад

      @@DIYGUYChris that is how I handle "Button Presses" too

    • @Hangs4Fun
      @Hangs4Fun 5 месяцев назад

      @DIYGUYChris well, except the delay, I despise delay in microcontroller code. I either use Millis or interrupts with a simple Finite State Machine logic to give the illusion of "pauses or delays" but still have processor "free" to provide a multi task feel. This becomes VERY important when you want to react quickly to things like button presses, especially of you have a bunch of them

  • @dasaikat
    @dasaikat 6 месяцев назад

    Can you please help me to find an gpio extension upto 2600 output

    • @DIYGUYChris
      @DIYGUYChris  6 месяцев назад

      shift registers is an option

  • @giantkherva2141
    @giantkherva2141 Год назад

    I have used mcp23s17 in a project to extend the io pins.but the speed is getting with 16-bit remote bidirectional 10mhz. What can i use instead of mcp23s17 to increase capacity. Can i connect mcp23s17 in parrallel to solve my problem? The problem in this project is that ic above 128kb is not being read,i want to read 192kb ic.
    Application need more io pin because of laptop keyboard connector is 32 pin connect to my pcb.
    I used mcu atmega88 in my project.
    This my programmer is only able to read io ic 128kb of laptop. Cannot read 192kb ic.
    How to solve this problem. Please help or make video on this topic.
    Thank you

    • @DIYGUYChris
      @DIYGUYChris  Год назад +1

      You are already using the MCP23S17 in parrallel because it uses SPI communication which is already the fastest communication port for MCPs, maybe you need more software solution rather than hardware, try to read/write ports instead of reading or writing one bit at a time, it helped me to speed up the outputs writing for my MCP23017 once.

    • @giantkherva2141
      @giantkherva2141 Год назад

      program SPI_Communication;
      {$APPTYPE CONSOLE}
      uses
      SysUtils, Windows;
      const
      FT232RL_VENDOR_ID = $0403;
      FT232RL_PRODUCT_ID = $6001;
      SPI_MODE_0 = 0;
      SPI_MODE_1 = 1;
      SPI_MODE_2 = 2;
      SPI_MODE_3 = 3;
      type
      TTransferOptions = record
      Pin: byte;
      Mode: byte;
      BitsPerWord: byte;
      Speed: DWORD;
      end;
      var
      hDevice: THandle;
      TransferOptions: TTransferOptions;
      MCP23S17_ADDRESS: byte;
      IODIRA: byte;
      IODIRB: byte;
      GPIOA: byte;
      GPIOB: byte;
      procedure SpiInit;
      begin
      // set SPI mode 0
      TransferOptions.Mode := SPI_MODE_0;
      // set SPI clock speed to 1 MHz
      TransferOptions.Speed := 1000000;
      // set bits per word to 8
      TransferOptions.BitsPerWord := 8;
      end;
      procedure SpiTransfer(address, registerAddress, data: byte);
      var
      Buffer: array[0..2] of byte;
      BytesTransferred: DWORD;
      begin
      Buffer[0] := address or $80; // set MSB to 1 for write operation
      Buffer[1] := registerAddress;
      Buffer[2] := data;
      // perform SPI transfer
      if not DeviceIoControl(hDevice, $22200b, @TransferOptions, SizeOf(TransferOptions), @Buffer, SizeOf(Buffer), BytesTransferred, nil) then
      Writeln('Error: ', SysErrorMessage(GetLastError));
      end;
      procedure MCP23S17Init;
      begin
      // set IO direction of Port B as output
      SpiTransfer(MCP23S17_ADDRESS, IODIRB, 0);
      end;
      procedure MCP23S17Write(data: byte);
      begin
      // write data to Port B
      SpiTransfer(MCP23S17_ADDRESS, GPIOB, data);
      end;
      begin
      // initialize FT232RL USB to serial converter
      hDevice := CreateFile('\\.\FTDIBUS0', GENERIC_READ or GENERIC_WRITE, 0, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL or FILE_FLAG_OVERLAPPED, 0);
      if hDevice = INVALID_HANDLE_VALUE then
      begin
      Writeln('Error: Unable to open device!');
      Exit;
      end;
      // set vendor and product IDs for FT232RL
      if not DeviceIoControl(hDevice, $A2320001, @FT232RL_VENDOR_ID, SizeOf(FT232RL_VENDOR_ID), nil, 0, DWORD(nil^), nil) then
      begin
      Writeln('Error: Unable to set vendor ID!');
      CloseHandle(hDevice);
      Exit;
      end;
      if not DeviceIoControl(hDevice, $A2320002, @FT232RL_PRODUCT_ID, SizeOf(FT232RL_PRODUCT_ID), nil, 0, DWORD(nil^), nil) then
      begin
      Writeln('Error: Unable to set product ID!');
      CloseHandle(hDevice);
      Exit;
      end;
      // set up SPI communication
      SpiInit;
      // set up MCP23S17
      MCP23S17_ADDRESS := $40;
      IODIRA := $00

    • @giantkherva2141
      @giantkherva2141 Год назад

      Please suggest what is the mistak in delphy code.

  • @pierrejeanes
    @pierrejeanes Год назад

    Does it work with esp32 ?

    • @DIYGUYChris
      @DIYGUYChris  Год назад +1

      Indeed, it works with all MCUs

  • @yhyamostafa7247
    @yhyamostafa7247 2 года назад

    You can make robot dog

  • @pierrejeanes
    @pierrejeanes Год назад

    What is that

  • @topreviews7690
    @topreviews7690 2 года назад

    I will need your help

    • @DIYGUYChris
      @DIYGUYChris  2 года назад

      Okay

    • @topreviews7690
      @topreviews7690 2 года назад

      @@DIYGUYChris I would like a hat that can hold up to 96 GPIO pin hat. With its own power supply from a 12v -24V DC BATTERY THAT 🔋 and cand a Automatically be controlled with the raspberry pie depending on load

    • @topreviews7690
      @topreviews7690 2 года назад

      @@DIYGUYChris I want to use R GB W on my 2005 theater Sequoia I'll be able to control it from a raspberry pie app inside the car

    • @topreviews7690
      @topreviews7690 2 года назад

      @@DIYGUYChris I need if I can make another GPL or USB HATt that could control all the 4k cameras on the S UV and store in a external SSD, like tasla camara blind spot camaras. I would like to know if there's a 3-D program that I could use for my vehicle to select toggle switches for my LED light on my car display inside the car

    • @topreviews7690
      @topreviews7690 2 года назад

      @@DIYGUYChris I want the raspberry pie depending on my command to tell if the door is open and if I can turn on the light what color will it be and what color can I change it to or if the Ignition switches on or off when till start loading data into it is hard drive