I'm working on a little project made of several parts :
- a webserver
- a ESP32 connected to WIFI
- some ESP32 controlled hardware : sensors, LED and servo motors
All the software parts are working.
I'm made some tests to experiment the hardware parts one by one (tested a step motor, then tested to control I2C input/outputs...)
Now I'm trying to finish the whole project by connecting all together, and here the problems begins.
Here is a schematics of the whole circuit, which should be controlled by the ESP 32 :
This is made of several parts :
- 1 MCP23017 : I2C 16 I/O expander
- 8 photointerrupters, powered thru a resistor and connected to the MCP23017 inputs using a pull-down resistor
- 8 LED, powered thru the MCP23017 outputs using a resistor (about 10 mA current per LED)
- 5 servo motors, powered by 5V
There is 3 connectors :
- 1 power connector (GND/5V)
- 1 I2C connector
- 1 servo control connector (5 channels)
Basically, I would like :
- connect the I2C connector to the I2C output of the ESP32
- connect each servo control channel to one of the ESP32 output
- control the power (on/off) of all devices on the schematics above from an ESP32 output
To power the whole thing, I plan to use a 5V/2A power supply :
- connected to the ESP32 USB input : ESP32 always powered
- connected to the above circuit power input thru a ESP32-controlled switch : the above circuit is powered only when needed
Finally, my ESP32 software works as this :
- if there is something to do, do it
- if nothing happen during 1 minute, the ESP32 set the devices power to "OFF" and go to deep sleep mode
- when the ESP32 is waken up, the ESP32 set the devices power to "ON"
Now, I have several questions :
1/ Is the whole circuit above valid ? Is there any errors in it ? (I've tested it part by part, but not all together)
2/ Can I connect the ESP32 I2C output (which is 3.3V) to the MCP23017 I2C input (the MCP23017 is powered by 5V) or should I use a level shifter ?
3/ Can I connect the ESP32 outputs (3.3V) directly to the servo control inputs ?
4/ What is the best way to design the ESP32 controlled power switch ?
Parts used references :
- I2C IO expander : "MCP23017"
- photo-interrupters : "ITR9608"
- servo motors : "SG90" 9G mini servo