I want a simple alarm that HA can trigger when certain conditions happen. I have breadboarded an initial system that works when connected to USB. I am using an ESP32-DEVKITC-V4, a ‘12 v LED’ (an LED with a built-in resistor) and a buzzer. The buzzer is loud enough at 12 VDC to wake me, but not at 5 VDC. So I am using a 12 V power supply. I purchased a 12 V - 3.3 V power converter (Mean Well N7803-1CW datasheet) to power the ESP32 and connected it to the ESP32 3V3 pin and to the breadboard +V and GND rails, which the 12V power supply is connected to. The red power LED on the dev board turns on but the ESP32 doesn’t register with HA, the device switches are not enabled and don’t work. This seems like it should be a simple task but just doesn’t work. If I replace the power converter with a 5 VDC power supply connected to the dev board 5V pin, it works properly. Here is my schematic:
Does it work if you disconnect LED and buzzer?
Your schematic is unreadable. Control your wiring, red led is on 5V rail, it shouldn’t turn on if powered from 3.3V pin except if the current passes backwards through the onboard voltage regulator (not ok).
Yes, all of the GND connections are tied together. The Espressif power schematic also says what you say - the power LED shouldn’t light unless there is 5 V, but, with the regulator, I don’t have 5 V on the board (that I can find). I have broken the GPIO connections to the LED and buzzer but left them connected otherwise and it still does not work.
@Karosm I suspected that the schematic would be a problem. I am using KiCad which only exports PDF or copies to the clipboard. This forum only seems to load JPG. How do I make that work?
Measure all the pin voltages of your setup, 3v, 5v and gpios.
To get image from your pdf, you can use Snipping Tool on windows. Acrobat reader has tool for that as well.
@Karosm I have measured the voltages and they are good, except for the 5V, which doesn’t exist in this setup. However, it works now. A friend suggested holding the ESP32 in reset while the power stabilized. That addressed the problem. Now the ESP32 successfully registers with HA and both the LED and the buzzer work. So, with this setup, I needed to reset the ESP32 after the 3.3 V power stabilized. I will try to load the schematic later. I don’t run Windows, I run Fedora Linux. However, I now have some direction to look to convert my PDF.
Of course it doesn’t, but some voltage you have on that pin if power LED illuminates. I didn’t expect LDO can leak so much current backwards.
I don’t have any board with 1117 regulator and LED on 5V rail to test though.
Try holding shift and hitting the print screen key. I run Debian with a Cinnamon desktop environment and that gives a crosshair cursor that I can use to select a region of the screen for a screenshot. When I release the mouse button after dragging to select the region, the screenshot is taken and saved in my photos. Should be the same in Gnome.
Alternatively, look for the screenshot utility in Fedora. Not sure what it would be - it’s dependent on the desktop environment you are running.
Thank you @rtstarliper. On my Fedora that does a complete screen shot. However, I have GIMP installed and was able to copy from KiCad to the clipboard, then paste into GIMP and save as a JPG.
I am including my updated schematic. Hopefully it can be read. This starts up correctly and works. I am also including the business part of my YAML. It is all pretty simple but was a good learning experience for me and will form a basis for multiple projects that I have in the pipeline. The only possible improvement that I know of would be to use a voltage supervisor or voltage monitor. I don’t know if that would really be an improvement though.
If I am not mistaken, the Dev Kit can be powered via 5v. Instead of the 3.3v I would have used a 5v buck convertor (in fact, I have - but not using the dev kit) and fed power to the 5v pin on the board, and used the 3.3v for where I need 3.3v.
I also agree with the commend Karosm made about the base resistor being too high. You are using the transistor as a switch, and you want to drive it into saturation. That resistor exists mainly to protect the GPIO pin. I also generally add a pull up or pull down resistor on the base when I am using a transistor as a switch - which one depends on the trigger to the base. Active low gets a pull up, active high gets a pull down. The way you have this wired, I am assuming the trigger is active high, so I would add a resistor from base to ground. That would be a nice place to use the 4k7 resistor (I generally go 1k to 5k, depending on the voltages involved - I would likely use a 1k here). It's a bit higher than I would use, but it should still work ok.
While I have not worked specifically with the dev kit, one thing I encountered early when dealing with the ESP is paying close attention to the GPIO pins I am using. Some have multiple purposes, and in some cases can mess with the boot up of the chip. I have also been known to be liberal with filter capacitors on the power supply. Dirty power can cause some really weird things to happen.