MCP23017 question

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

MCP23017 question

#1 Post by Sasch600xt » 02 Mar 2019, 19:50

Hello all :)

may i have a probably dumb question but i cant find the answere.

i need to send out 4 analog values from ESP (0-3.3V / 0-255)

I have a MCP23017 connected to ESP.
Can i do it with a MCP ?
And if yes, how would the syntax look like ?
If NO, is there a way to get 4 analog output pins working with ESP (like a "analog output port expander") ?

See ? Dumb question :)

Thanks for help :)
Sascha
"the flat earth society has members all around the globe"

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: MCP23017 question

#2 Post by budman1758 » 02 Mar 2019, 19:59

Methinks the best way is to use an ADS1115 A-D Converter chip. MCP23017 is only for on,off or pulse stuff.

No such thing as a dumb question. Nobody falls out of their mama knowing everything. :mrgreen:
"The glass is twice as big as it needs to be".

HomeJCL
Normal user
Posts: 89
Joined: 03 Feb 2018, 10:42

Re: MCP23017 question

#3 Post by HomeJCL » 02 Mar 2019, 20:30

ADS is an AD.

In this case the question is for an DA output stage.

I am also interested if anybody has the answer.
Belgium and land of ESP ... counting :D

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: MCP23017 question

#4 Post by budman1758 » 02 Mar 2019, 20:58

What is the source of these values? How does the ESP get the values in the first place?
"The glass is twice as big as it needs to be".

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: MCP23017 question

#5 Post by Sasch600xt » 02 Mar 2019, 21:37

i want to send MQTT Messages to the ESP.

like:

http://192.168.123.45/control?cmd=ANALOG_OUT,1,255
http://192.168.123.45/control?cmd=ANALOG_OUT,2,127
http://192.168.123.45/control?cmd=ANALOG_OUT,3,0
http://192.168.123.45/control?cmd=ANALOG_OUT,4,200

this sends the value to a 4ch dimmer (0-3.3volt expected)

So lets google for a ADS1115 A-D Converter chip :)
Is there a plugin already for ESP Easy ?

Thank you all for your Help :)
Sascha
"the flat earth society has members all around the globe"

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: MCP23017 question

#6 Post by budman1758 » 02 Mar 2019, 21:51

Not sure you need the ADS1115 here as I am still a bit confused as to what the ESP is actually doing here. You say you want to send these analog values TO the ESP. I assume they then go out to a dimmer of some sort?

Maybe a picture or a diagram or schematic would be helpful.
Last edited by budman1758 on 02 Mar 2019, 22:18, edited 1 time in total.
"The glass is twice as big as it needs to be".

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: MCP23017 question

#7 Post by Sasch600xt » 02 Mar 2019, 22:06

http command ---> ESP Easy -----> 4 times analog 0-3.3Volt out ------> 4 CH Dimmer

I see the ADS1115 is for analog INPUT, but i need to have analog OUTPUT.
"the flat earth society has members all around the globe"

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: MCP23017 question

#8 Post by budman1758 » 02 Mar 2019, 22:28

I think what you need to do is convert PWM output to a voltage.
See this for inspiration.
https://www.instructables.com/id/Analog ... o-Voltage/
"The glass is twice as big as it needs to be".

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: MCP23017 question

#9 Post by Sasch600xt » 02 Mar 2019, 22:50

Perfect !!!
"the flat earth society has members all around the globe"

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: MCP23017 question

#10 Post by Sasch600xt » 02 Mar 2019, 23:05

Now another question :)

i dont understand in doku:
MCPPulse,<pin>,<value>,<duration> 1,0 Pulse control on MCP23017 output pins (duration in mS, MILLIseconds)

so how would a http command look like for MCP port 1 with a pwm of 127 ( i assume value can be from 0-255) ?

Thank you so much
Sascha
"the flat earth society has members all around the globe"

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: MCP23017 question

#11 Post by budman1758 » 03 Mar 2019, 00:57

I'm not sure the MCP23017 supports PWM. That's a question for the devs. Some of the native ESP GPIO support PWM. Might be easier to use those.

Or a dedicated PWM output chip module.
"The glass is twice as big as it needs to be".

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: MCP23017 question

#12 Post by Sasch600xt » 03 Mar 2019, 09:12

i have a PCA9685 here and i will try one of those :)
"the flat earth society has members all around the globe"

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: MCP23017 question

#13 Post by Sasch600xt » 03 Mar 2019, 10:47

i do not get a signal out of the PCA9685 ?

It shows up after "scan for i2C device".

So i try:
http://192.168.123.45/control?cmd=PCAPWM,1,4095

and get:
{
"log": ": PWM 1",
"plugin": 22,
"pin": 1,
"mode": "PWM",
"state": -1
}

any ideas ?
Thank you for your help
"the flat earth society has members all around the globe"

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: MCP23017 question

#14 Post by kimot » 03 Mar 2019, 22:00

You can use this motor PWM like DA converter for convert digi to analog via i2c:
https://www.letscontrolit.com/wiki/inde ... 2#Hardware

So by TB 6612

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: MCP23017 question

#15 Post by Sasch600xt » 04 Mar 2019, 19:50

yes, but i have already a PCA9685 and there is a plugin for in ESP Easy.
plus budman showed a very good and very small solution to get a analog signal out of a pwm signal.

the only question right now is why does the PCA9685 not work ?
i must do something wrong here.

Thanks for help
Sascha
"the flat earth society has members all around the globe"

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests