Author Topic: Home assistant alarm clock - begin  (Read 506 times)

0 Members and 3 Guests are viewing this topic.

Offline harrydgTopic starter

  • Newbie
  • Posts: 2
  • Country: be
Home assistant alarm clock - begin
« on: November 01, 2024, 04:25:01 pm »
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 ESP32
  • 2 4 digit LCD displays (based on TM1637 https://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 day
  • Buzzer for those who don’t want the next part, but are happy with simple wakeup tunes based on rtttl
  • max98357 I2S DAC + amp which can drive a small speaker. Currently in my breadboard setup i use the PCM5102 and a PAM8603
  • 2 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 schematic
  • USBC 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 ESP32
  • wireless 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 port
 
other 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 set

Next 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!
« Last Edit: November 01, 2024, 04:28:00 pm by harrydg »
 

Offline PGPG

  • Frequent Contributor
  • **
  • Posts: 384
  • Country: pl
Re: Home assistant alarm clock - begin
« Reply #1 on: November 01, 2024, 09:36:00 pm »
Wires routed through component symbols are rarely found in schematics.

  • a 1W (max) LED, driven by a mosfet, dimmable throuwh PWM by the ESP32

I 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.

Now… i don’t have ANY SMD soldering material,

I 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.
 
The following users thanked this post: harrydg

Offline harrydgTopic starter

  • Newbie
  • Posts: 2
  • Country: be
Re: Home assistant alarm clock - begin
« Reply #2 on: November 01, 2024, 09:51:42 pm »
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
 
The following users thanked this post: jh15

Offline xvr

  • Frequent Contributor
  • **
  • Posts: 539
  • Country: ie
    • LinkedIn
Re: Home assistant alarm clock - begin
« Reply #3 on: November 02, 2024, 03:15:35 pm »
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.
 

Offline ebastler

  • Super Contributor
  • ***
  • Posts: 7347
  • Country: de
Re: Home assistant alarm clock - begin
« Reply #4 on: November 03, 2024, 08:49:53 am »
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!

I 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.
 
The following users thanked this post: harrydg


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf