I would like to make a device using an esp32c3 and an optocoupler to allow me to actuate a separate device comprised of a motor running from a different power source (4.2V, 6V or 12V).
The esp32c3 runs from 2x AA alkalines and would wake up periodically to run the motor for a minute, then go back to sleep.
What should I change in the attached circuit?
https://tinyurl.com/28jr5j6kThank you.
I re-drew the schematic, hope it's clearer.
the water dispenser is comprised of an 18650 cell, circuit board and motor. The circuit board has a uC that handles USB charging and that enables/disables the motor when its button is pressed.
I want to enable/disable the motor periodically with an ESP32C3 through an optocoupler.
I think you can eliminate one of the FET circuits and just put the switch in parallel with the output transistor of the optoisolator, making a wired-or. You could do this with an N or P fet, whichever is cheaper. The opto-coupler isn't really necessary because the FET can be the "translator" between the independent power sources. Only the ground would be shared. You have choices.
The "fet with switch" I included in the schematic next to the motor represent the microcontroller on the water dispenser, which turns ON/OFF the pump when its button is pressed.
You can just put the manual switch across D and S. That saves you a MOSFET.
Watch out for the opto current. About 8mA from your AAs.
A simple latch circuit may be better. A brief pulse at the opto toggling the load on and off.
Note the emitter follower connection used to change the sense and to speed up the edge seen by the FF.
A CD4013 is about $0.50
The capacitor, resistor and diode connected to the 4013 make sure it powers up in the off state.
Thank you so much for taking the time, going to give it a go
I got it working like in the attached diagram. Do you see any possible point of failure?