How to use the MCP23017

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

How to use the MCP23017

#1 Post by asm7100 » 18 Sep 2015, 21:25

Hi
How do i use the MCP23017 to output from Domoticz??

I like the MCP23017 Port B0 to on/off a led, by activate a switch on Domoticz
This is my setup i easyesp
Task Settings Value
Device: MCP23017 input
Name: Power
Port: 9
IDX / Var: 5 <- From the Domoticz.
Formula Switch:


What is Formula Switch: to be used to??????

Please Help me.
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

Martinus

Re: How to use the MCP23017

#2 Post by Martinus » 19 Sep 2015, 16:35

Output hasn't had much focus yet and currently only direct GPIO and PWM is working through the /control=xxx http interface. The MCP23017 Input device in the dropdownlist is only used to read inputs on the MCP device. For direct output using http you do not need a task setting.

Output should be controlled with something like this to toggle output:

Code: Select all

http://<ip>/control?cmd=mcpgpio,9,1
http://<ip>/control?cmd=mcpgpio,9,1
But we need to fix this in the next release.

If you haven't set a password on this ESP, you should be able to use the debug command that still exists in the code:

Code: Select all

http://<ip>/?cmd=extwiredout,9,1
http://<ip>/?cmd=extwiredout,9,0
But beware that this will likely be changed.

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#3 Post by asm7100 » 20 Sep 2015, 12:36

Nice and thanks for the quick answer.
Keep up the good work :-)

By the way if you put one more MCP23017 on it but with another add, will you then get more in/outs??
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

Martinus

Re: How to use the MCP23017

#4 Post by Martinus » 20 Sep 2015, 12:48

asm7100 wrote:By the way if you put one more MCP23017 on it but with another add, will you then get more in/outs??
That's possible. The portnumbers just count up.
The first MCP at address offset 0 uses ports 1-16
The next at addres offset 1 uses ports 17-32
etc

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#5 Post by asm7100 » 20 Sep 2015, 23:10

Nice.
How about updating the wiki with it. :-)
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#6 Post by asm7100 » 23 Sep 2015, 14:12

When you use the MCP23017 as inputs, is the internel pullup enabled?
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: How to use the MCP23017

#7 Post by hamster » 27 Sep 2015, 21:35

First of all.. just like to say this is a fantastic project.. well impressed..!!

Currently using R20..
Following the previous comments, I managed to get the outputs working.. :D

Also wanted to get some inputs working..
I have one input configured but when I tie the contact on the mcp23017 high or low I don't see any immediate change on my domoticz idx. however i do see an update in the history every one minute ??

Any ideas??

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#8 Post by asm7100 » 27 Sep 2015, 22:33

Yes there is some thing rung there, it's the same is you use GPIO :-(

I try to use it to see if a door is open or closed. (Gpio? to gnd) with or without a pull up res.
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: How to use the MCP23017

#9 Post by hamster » 28 Sep 2015, 11:38

Thanks Alan
Standard GPIO's are working ok as inputs..
but not on MCP23017.. :(

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#10 Post by asm7100 » 28 Sep 2015, 12:12

Hamster, do you use pullup res?
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: How to use the MCP23017

#11 Post by hamster » 28 Sep 2015, 16:36

I tried using a 4k resister but didn't make any difference..

Martinus

Re: How to use the MCP23017

#12 Post by Martinus » 28 Sep 2015, 19:09

Sorry to say that the MCP23017 input plugin only works as a periodic input port scan, similar to sensing temperatures.
So it will not act the same as the input switch plugin on local GPIO ports.

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#13 Post by asm7100 » 28 Sep 2015, 20:08

:-( Can that be changes?

Can we use them as Input and Output, 1 as input, 2, 3 and 4 as output and 8 as input ex.
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: How to use the MCP23017

#14 Post by hamster » 30 Sep 2015, 20:32

outputs are working with :-
http://<ip>/?cmd=extwiredout,9,1
http://<ip>/?cmd=extwiredout,9,0
(as posted by martinus)

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#15 Post by asm7100 » 30 Sep 2015, 21:05

Yes i know, but can it bee uses as a mix, input and outputs.
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

Martinus

Re: How to use the MCP23017

#16 Post by Martinus » 02 Oct 2015, 12:49

asm7100 wrote::-( Can that be changed?
It is changed in R27.
asm7100 wrote:Can we use them as Input and Output, 1 as input, 2, 3 and 4 as output and 8 as input ex.
You can mix input and output for each individual port on the MCP23017.

To use a port as input, select the device and configure that port.
To use a port as output, send the http/mqtt command for that port and it will automatically switch to output.

Martinus

Re: How to use the MCP23017

#17 Post by Martinus » 02 Oct 2015, 12:50

asm7100 wrote:When you use the MCP23017 as inputs, is the internel pullup enabled?
Pull-ups on input ports are now enabled by default in R27. So no more floating inputs.

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: How to use the MCP23017

#18 Post by asm7100 » 03 Oct 2015, 01:00

Nice thanks for the good work :-)
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests