Page 1 of 1

How to use the MCP23017

Posted: 18 Sep 2015, 21:25
by asm7100
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.

Re: How to use the MCP23017

Posted: 19 Sep 2015, 16:35
by Martinus
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.

Re: How to use the MCP23017

Posted: 20 Sep 2015, 12:36
by asm7100
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??

Re: How to use the MCP23017

Posted: 20 Sep 2015, 12:48
by Martinus
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

Re: How to use the MCP23017

Posted: 20 Sep 2015, 23:10
by asm7100
Nice.
How about updating the wiki with it. :-)

Re: How to use the MCP23017

Posted: 23 Sep 2015, 14:12
by asm7100
When you use the MCP23017 as inputs, is the internel pullup enabled?

Re: How to use the MCP23017

Posted: 27 Sep 2015, 21:35
by hamster
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??

Re: How to use the MCP23017

Posted: 27 Sep 2015, 22:33
by asm7100
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.

Re: How to use the MCP23017

Posted: 28 Sep 2015, 11:38
by hamster
Thanks Alan
Standard GPIO's are working ok as inputs..
but not on MCP23017.. :(

Re: How to use the MCP23017

Posted: 28 Sep 2015, 12:12
by asm7100
Hamster, do you use pullup res?

Re: How to use the MCP23017

Posted: 28 Sep 2015, 16:36
by hamster
I tried using a 4k resister but didn't make any difference..

Re: How to use the MCP23017

Posted: 28 Sep 2015, 19:09
by Martinus
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.

Re: How to use the MCP23017

Posted: 28 Sep 2015, 20:08
by asm7100
:-( 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.

Re: How to use the MCP23017

Posted: 30 Sep 2015, 20:32
by hamster
outputs are working with :-
http://<ip>/?cmd=extwiredout,9,1
http://<ip>/?cmd=extwiredout,9,0
(as posted by martinus)

Re: How to use the MCP23017

Posted: 30 Sep 2015, 21:05
by asm7100
Yes i know, but can it bee uses as a mix, input and outputs.

Re: How to use the MCP23017

Posted: 02 Oct 2015, 12:49
by Martinus
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.

Re: How to use the MCP23017

Posted: 02 Oct 2015, 12:50
by Martinus
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.

Re: How to use the MCP23017

Posted: 03 Oct 2015, 01:00
by asm7100
Nice thanks for the good work :-)