Home assistant alarm clock - begin - Page 1
Forum section: electronics / projects

author: harrydg
author_rank: Newbie
timestamp: November 01, 2024, 04:25:01 pm
content: Hey all,This is my first ever post here. Also my first steps into Kicad and PCB design. I’m not a “good electronics engineer”, but i know how stuff works.I had an idea of making an alarm clock that integrates neatly with Home Assistant. The idea is the following:everything runs on an ESP322 4 digit LCD displays (based on TM1637https://www.aliexpress.com/item/32866425287.html). 1 for showing temperature, 1 for the time)BME280 for temperature (and humidity… but not needed actively, as i want to display tempetature only. Humidity/pressure are for HA only)LDR to limit the brightness of the LCD when it gets dark, bright during the dayBuzzer for those who don’t want the next part, but are happy with simple wakeup tunes based on rtttlmax98357 I2S DAC + amp which can drive a small speaker. Currently in my breadboard setup i use the PCM5102 and a PAM86032 buttons, fully configurable in home assistant to snooze, open/close curtains, control lights… whatever you want, configurable in home assistant. Uses the internal pull-up resistor of the esp32, so not on the schematicUSBC powered (with ESD module for safety as well as a ams1117-3.3V linear regulator)a 1W (max) LED, driven by a mosfet, dimmable throuwh PWM by the ESP32wireless charging pad on the top, so i can (very slowly, 5W max) charge my phone over night. This is ordered, not in the schematic as it just requires 5V from the USB-C portother features are welcome… maybe a 3rd button? other things/ideas? We have IO pins!Advantages: never set the time of your alarm clock as it uses NTP/home assistant as time server. Control your wakeup time from your calendar/other setup in HA, use the buttons on the alarm clock to control whatever you like!So the plan:- I put it all on a breadboard and it all works (noise issue on the PCM5102, but working on that)- I have the code working on esphome for everything above, but not with the “right” mosfets/… most are just on their own pcb's from an arduino starter setNext steps, this is where i need help:- getting the circuit built in kicad see attached schema. I think i have everything. Did i forget stuff? I tried getting the requirements as close as possible to the datasheets- create a PCB from it:but this is where it gets horribly difficult. I have no idea where to best put the LED, as it has to be on the side of the clock, the BME280 has to stay “outside”, the LDR needs to extend through the enclosure, where do the buttons come out, …- once i have the PCB design, i’ll hop into fusion 360 to design an enclosure where it all fits. I would expect 1 PCB to host most of it. Some "longer leads" for stuff. I am very flexible here.- Done.Now… i don’t have ANY SMD soldering material, no idea which components/footprints to use/are best. Example: which MOSFET, which ESD, which type/size/… resistors/capacitors? the LED will use max 300-350mA when it drops 3V. Did i make the correct electronic connections/protections/decoupling/…?So, how do I go about this? The schematic is attached and i hope someone will/can help me make this a success and i can just make the whole project, incl gerber files, … freely available, including the 3d print designs, to all interested people.Or am I doing it wrong here and should i just build the things from existing pre-built buttons/sensors, wire it up with cables and forget the PCB idea?But then again... how cool would it be if this design could be used by anyone interested home assistant in the bedroom!

author: PGPG
author_rank: Frequent Contributor
timestamp: November 01, 2024, 09:36:00 pm
content: Wires routed through component symbols are rarely found in schematics.Quote from: harrydg on November 01, 2024, 04:25:01 pmI understand that it is not indicator but the dimmable light.With 220R it will be dimmable from 0W to 0.03W so 30 times less than you assume.Quote from: harrydg on November 01, 2024, 04:25:01 pmI solder SMD only occasionally (when I have to test something). I use soldering iron with a sharp tip and tin (classic, with Pb) in the form of 0.5mm wire with rosin inside, and nothing else.In 90s we moved from THT to SMD. At first 1206, then shortly 0805. Now, since 20+ years I use 0603 resistors and capacitors as a standard.You can solder 0603 manually. I do not recommend hand soldering 0402.

author: harrydg
author_rank: Newbie
timestamp: November 01, 2024, 09:51:42 pm
content: you're obviously right, i put 220 as default value to drive a status LED, not a power led. I changed it to around 10 Ohms.The main question I have is.... who can do a sanity check before i continue thinking about converting it to a PCB? I've never done that part before.... I've started, but there are so many "free" variables in the design. GPIO pins are quite "free", component placement is free, connectors are free... as i still have to design an enclosure, i can adapt to everything. TOo much freedom makes me block mentally

author: xvr
author_rank: Frequent Contributor
timestamp: November 02, 2024, 03:15:35 pm
content: ESP32 used UART, not USB to connect to outer world. Connecting them to D+/D- of USB C socket is not enough to convert UART to USB.

author: ebastler
author_rank: Super Contributor
timestamp: November 03, 2024, 08:49:53 am
content: Quote from: harrydg on November 01, 2024, 04:25:01 pmI would suggest a hybrid approach to get this off the ground:Use a pre-built ESP32 module -- one of those little things in a dual inline footprint. That will also take care of the quartz and the USB port.Build everything else from discrete components -- not further off-the-shelf sensor or switch modules.Use perfboard and soldered point-to-point wires to mount evertyhing, including the ESP32 module -- not the pluggable breadboards.That will give you a build that's stable enough to actually work, but flexible enough to let you experiment with your circuit. You can also aim to get close to the intended component arrangement and form factor.Once you get everything to work, you can either put that prototype in an enclosure and declare the project complete. I have various one-offs built in that way which have been in service for many years. Or you can proceed with a PCB layout and will have a solid schematic for that.Even a custom PCB layout can continue to use the pre-made ESP32 module if you prefer. That will save you and other builders from SMD-soldering the microcontroller (manageable) and the USB jack (really finicky!).Perfboard, with holes in the standard 0.1" spacing, comes with various copper patterns. My personal preference has rectangular copper pads which connect groups of three holes: This lets you use standard DIL packages including the microcontroller etc. piggyback boards, and often allows you to connect a couple of passives (SMD or through-hole) directly via the pads without needing a wire. Use AWG28 or AWG30 single-stranded wire for on-board connections.