Mcp23017 odd årpblem

Hi all

I use a mcp23017 with a esp8266 for my relays, but pin 1 one dont wanna work,
pin 2 to 8 Works fine, but pin 1 is Always on, and i Cant control
it in any Way from ha
But if i use the command in the webgui it Works fine
Any ideaS?

What lib do you use?
How do command your Esp? Do you use mqtt?
Is your gpio extender i2c or spi?

I use the has and mqtt

I2c Its connected directly to the esp8266
and the odd Thing is that the 7 other pin Works fine

Haven’t you missed with connection?
AGPIO0 is near INT pins which are always high.

Em ??? AGPIO0 ??? Got a link to the diagram u referst to

Do u mean GPA0

But i can control it with

http:///control?cmd=mcpgpio,1,1
And
http:///control?cmd=mcpgpio,1,0

So there is something wrong in your mqtt processing function.

I’m very interested in using MCP23017 with esp8266.
Can you please post the sketch an the wiring?

Pm sent so check your inbox :wink:

Thanks for your answer and sorry for the late reply.
I never received a PM, checked also spam.
No problem, i decided to use MCP’s with a RPi, because i want to use a wired connection to HA.

im drawing it now, bb in about 10min :slight_smile:

Or in text
SDA(pin13) on MCP to SDA on RPI pin 3
SDC (pin 12) on MCP to SDC on RPI pin 5

Vss(pin 10) on MCP to +3v3 on pi
Vdd(pin 9) on MCO to - on pi
Reset(pin 18) on mcp to +3v3

Unknown

To address the mcp
MCP23017-addresspins1-1

So if u want address 0x20 then set it like this, where A0 = pin 15 A1= Pin 16 A2= pin 17
A0 = - (-3v3)
A1 = - (-3v3)
A2 = - (-3v3)

Or if u want Address 0x27
A0 = - (3v3)
A1 = - (-3v3)
A2 = - (-3v3)

if confused just write me :wink:

1 Like

Thank you very much for your effort.

Glad to help :wink: and if any problems just write :smiley:

And Update on my mcp,problem is

When i use the VIN port to supply the ardunio it makes this
error, but if i use the usb port for supply it Works fine,
and on RPI it Works nomater what :smiley:

Hey Demonchok,

Do you use esp8266 with Easyesp firmware? If yes, can you show what command_topic you use for change any pin on MCP to high state. I can control it with commands:
http:///control?cmd=mcpgpio,1,1 and http:///control?cmd=mcpgpio,1,0

IN ha ?

like this :

  • platform: mqtt
    name: “esp04_relay2”
    state_topic: “esp04/2/Switch”
    command_topic: “esp04/mcpgpio/2”
    payload_on: “1”
    payload_off: “0”
    optimistic: false
    qos: 0

Hmm,

I tried yesterday this code:

  • platform: mqtt
    name: “MCP”
    state_topic: “Node1/Mcp/Switch45”
    command_topic: “Node1/mcpgpio/2”
    payload_on: “1”
    payload_off: “0”
    optimistic: false
    qos: 0

And it don’t work.
My settings in EasyESP Devices page:

Device: MCP23017 Input
Name: Mcp
Port: 1
Idx/var: 343
Send Data: yes
Value Name 1: Switch45

Ok, I probably found the source of the problem. I did not connect MCP RESET pin to +V. I’ll check it out as I come back to home.

Ok, problem solved! Thanks Demonchok.

seitaro no problem :smiley: just ask if anything els :slight_smile:

Ive solved my own mcp23017 problem, it was noise from the psu
so I’ve placed a 470uf capacitor at the input, no more jumping around :wink: