Hello, I have completed my "smart" thermostat project and i am facing some weird issue with the MCU i am using.
Issue : Since the on board MCU cannot supply all the components on its own, the board is always powered using mains (see schematics below). When i have the board connected to my PC via USB everything works fine.
The moment i unplug the USB cable and i reset the MCU things get wild.
The MCP23017 used to control the state of two relays and read button inputs, reads random inputs and turns on and off the relays. I have no control over the buttons once the USB cable is unplugged.
Troubleshooting steps i followed :
1) I tried disabling Serial communication and every serial.print/println statement, to make sure the problem was not caused by the MCU trying to relay messages to the Serial Console.
2) I tried removing the SCL and SDA pull-up resistors.
3) I tried enabling and disabling the internal pull-ups of the MCP23017.
I am kinda lost on what to do or what to measure. Since the MCU does not communicate via USB and the MCP works fine when connected via USB i think this might be a supply issue.
The power supply on my board utilizes a 220VAC to 5VDC module , more specifically the HI-LINK HLK-20M05 which is more than capable of powering everything on the board ( the ESP8266, 20X4 LCD Display and 2 Relays are the most power hungry components on there).
Since i have no idea on how to proceed i posted the schematics for the board below. I am so sorry if i missed something and i thank you in advance.
If there is anything i could clarify please inform me.