Hello!
I'm attempting to build a small capacitive-type analog moisture sensor with an ESP8266-01. I assume I connect the RX and TX of the ESP to the TX and RX (ie. reversed) of the MCP2221. I also presume I attach the 3.3v and gnd to the same on the other.
I guess I can power the whole thing thru the USB C connector on the MCP2221 and also use it to program the ESP? I also have a USB UART adapter that I normally use to program the ESP8266-01.
How would I connect either the RST/EN or IO0/IO2 pair on the ESP to the pins on the MCP? Maybe the "R" on the MCP would connect to the RST so the Arduino IDE can flash and reset the ESP? Where does the analog signal sensor wire get connected- to one of the G# pins on the MCP? And the SCL/SCA connected to the IO0/IO2?
I'm hoping someone can point me in the right direction. Thanks!
Using MCP2221 with analog sensor and ESP8266-01
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- johnzbesko
- Posts: 15
- Joined: Wed Jan 09, 2013 12:34 pm
- johnzbesko
- Posts: 15
- Joined: Wed Jan 09, 2013 12:34 pm
Re: Using MCP2221 with analog sensor and ESP8266-01
OK, so I was able to determine how to use the mcp2221 to function as a UART to USB bridge for the ESP8266-01. Yes, the RX/TX are connected to the TX/RX. I ground the IO0 with a button switch when I upload a new program. I also connect the SCL pin of the mcp to the IO2 and the SDA to IO0 of the esp.
I presume I use the wire.h library to somehow convert the analog signal I'm imputing on the G1 pin of the mcp to an I2C signal to use on the esp. However, don't I still need some library for the MCP2221? Searching online, it seems all the libraries are written to connect the mcp to a Win, OS2, or Linux device, not a microcontroller like arduino or esp.
Not a newbie, but also not an EE major. Hoping someone can point me in the right direction.
I presume I use the wire.h library to somehow convert the analog signal I'm imputing on the G1 pin of the mcp to an I2C signal to use on the esp. However, don't I still need some library for the MCP2221? Searching online, it seems all the libraries are written to connect the mcp to a Win, OS2, or Linux device, not a microcontroller like arduino or esp.
Not a newbie, but also not an EE major. Hoping someone can point me in the right direction.
- neradoc
- Posts: 542
- Joined: Wed Apr 27, 2016 2:38 pm
Re: Using MCP2221 with analog sensor and ESP8266-01
Hi, you want to read analog data on the MCP2221 and transmit that to the ESP board ?
I believe the only solution for that would be to run some code on the host computer that reads the analog input and sends it to the ESP, via UART RX/TX for example, which are available on the host PC as a serial (USB CDC) port. You could also run some I2C peripheral code on the ESP and send the data via I2C from the host, but you need a host.
Or do you want it to be independent of a host ? As far as I know the ESP can not read the pins of the MPC2221, you would need an ADC breakout. The MCP2221 is a USB-to-things converter and transmits between USB on one side (HID plus CDC for serial) and the pins on the other side.
I believe the only solution for that would be to run some code on the host computer that reads the analog input and sends it to the ESP, via UART RX/TX for example, which are available on the host PC as a serial (USB CDC) port. You could also run some I2C peripheral code on the ESP and send the data via I2C from the host, but you need a host.
Or do you want it to be independent of a host ? As far as I know the ESP can not read the pins of the MPC2221, you would need an ADC breakout. The MCP2221 is a USB-to-things converter and transmits between USB on one side (HID plus CDC for serial) and the pins on the other side.
- johnzbesko
- Posts: 15
- Joined: Wed Jan 09, 2013 12:34 pm
Re: Using MCP2221 with analog sensor and ESP8266-01
Thank you for your reply. Guess I got the wrong part for what I wanted to accomplish. I guess I could use the mcp2221 with a raspberry pi zero or pico.
A couple of years ago, I purchased a half dozen ESP8266-01 and I've been always on the lookout for applications. I guess I should get some ADS1115 or ADS1015 analog converters.
A couple of years ago, I purchased a half dozen ESP8266-01 and I've been always on the lookout for applications. I guess I should get some ADS1115 or ADS1015 analog converters.
Please be positive and constructive with your questions and comments.