0
\$\begingroup\$

I am designing a circuit which will drive 4 relays & 2 LEDs from 4 push buttons(for each relay) with ESP-12E via (I2C) IO expander PCF8574 as I need more IO's than what are usable(stable) on ESP-12E. I'm using ULN2803A as a relay driver circuit. Circuit schematic is as shown in image below.

I made the circuit and was testing it out. I've made all input pin's initial state to be 'LOW'. But all of the output pins(Relays) are staying high when ESP-12E is connected (and also even when it is not connected!). And also I'm using INT(interrupts) for detecting inputs, the interrupts are being generated on push button(software debounced) input and MCU sometimes scans/detect inputs from multiple ports even when only one switch is pressed.

Question is :

Is the circuit schematic and components used are correct for ESP-12E and given appliacation?

Why multiple inputs are scanned even when action is done at single switch input?

Why are all output pins are staying 'High' when they are set at initial 'LOW' state?

Suggest if any components or methods needs to be changed for better and stable operation.

P.S. : In image only one relay is shown, there are 3 more relays with same configuration and are driven from ULN2803 remaining designated outputs.

enter image description here

\$\endgroup\$
13
  • \$\begingroup\$ You need to post your code, as it's the code that's responsible for controlling that chip. That's the only way you can get sensible answers to your problems. Schematic-wise, that looks OK. \$\endgroup\$
    – Justme
    Jul 12, 2021 at 19:52
  • \$\begingroup\$ On second thought, it does not look quite OK. I got confused by the button resistors going up but there is ground. Usually, you would have pull-up resistors, and have the buttons to ground. This may or may not matter in the end, but you better not program the button inputs as low outputs. And when the pins are programmed as inputs, they have weak internal pull-ups, so having external pull-downs can mean the pins are floating in the state that is between a definite logic high or definite logic low voltage. \$\endgroup\$
    – Justme
    Jul 12, 2021 at 20:12
  • \$\begingroup\$ @Justme I am using this input configuration, because if I have to drive input from any other high(+3.3v) signal then I can with this confg and resistor for pulling pin to active-low. Do you think I should use internal pull-up and drive input switch to low? will it make operation better? \$\endgroup\$ Jul 12, 2021 at 21:00
  • \$\begingroup\$ Well, have you actually measured the voltage at IO pin of a button when it is not pushed? The IO expander is quite quirky with the "quasi-bidirectional" IO pins and high current rise time accelerator being enabled during a write to logic 1. \$\endgroup\$
    – Justme
    Jul 12, 2021 at 21:08
  • \$\begingroup\$ @Justme When the button is not pushed the voltage between button is 2V and when pressed it goes to 0V. \$\endgroup\$ Jul 12, 2021 at 21:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.