0
\$\begingroup\$

Before starting i'm a novice :) I'm tring to count each time a 5v pump is powered on. I build my sketch with a PC817. The reading works but each time i put the ESP32 in deep sleep mode it triggered as false positive pump power on and it cycle. I use the esp_sleep_enable_ext0_wakeup(GPIO_NUM_33,1); command to read the pump powered on.

Is anybody able to help me solving this issue ?

Thanks for your help !

enter image description here

\$\endgroup\$
0
\$\begingroup\$

Don't use 5 V on the ESP32 GPIO pins. The way you have drawn your schematic, you are actually putting > 6 V on the GPIO when the opto fires. You may want to use the opto as an active low device instead of active high.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for your comment. The thing I forgot to mention is that I have only one psu these 4 1.5v batteries. You mean I must use the 3.3v pin instead? \$\endgroup\$ – bNj Mar 13 at 17:52
  • \$\begingroup\$ You should use the 3.3V for any logic levels on the ESP32 GPIO pins. If you are powering the board with batteries through the 5V pin, then the onboard regulator will be supplying the 3.3V to the ESP32. You can use the 3.3V connection as a source of 3.3V for external circuits but you have to be careful not to pull too much current. Using ~5K pull-downs should not be problematic. \$\endgroup\$ – ScienceGeyser Mar 13 at 17:58
  • \$\begingroup\$ Ok thanks for your advice on that! \$\endgroup\$ – bNj Mar 13 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.