goat-hill / bitclock

An e-ink desk companion
https://bitclock.io
MIT License
41 stars 4 forks source link

ESP32-C3 version with 18650 battery + charger #7

Open handmade0octopus opened 3 weeks ago

handmade0octopus commented 3 weeks ago

Hello! I must say you inspired me a little. Was thinking of making project like this for very long time but never had time to figure which eInk screens would work best and get drivers working.

I spent the night and big part of today to get basic schematic in.

Ideas that I incorporated:

  1. Biggest change is swap MCU to one that is less power hungry - namely ESP32-C3 which also has smaller footprint. We utilize 100% of the pins currently.

  2. Use single 4.2v cell that will be power source with boost converter + timer controller that is selectable with dip switches to allow for configuration to wakeup at different intervals (from every ~45s up to 30 min - but it can be easily extended from 1s to 2h) or disable sleep completely if needed. Question there is if sensors need some time after powerup to get accurate readings, but because they will be disabled board will have neutral temperature. In general this should allow for super low power draw.

  3. USB-C allows for safe charging of the battery. I based design of TP4056 module with overvoltage + undervoltage protection of battery, we can use analog input to measure battery voltage - there is also an option to put input for solar panel as charger will allow for that. Typical 6V solar panel should be enough although I never played with them so any tips are appreciated. Charging current is limited to around 250 mA. While USB-C is connected device will be always powered. LEDs will indicate status of charging and battery.

  4. I recreated design in EasyEDA pro and will be happy to share it. I can't stand KiCad I am sorry :( 95% of resistors, capacitors, mosfets etc. are basic parts so should be fairly cheap to purchase and assemble from JLCPCB.

  5. I changed temperature and humidity module to TI HDC1080 as it seems to be more accurate. Although this is just preference as they seem to be more accessible.

PCB is not done yet but I had few ideas on making footprint much smaller, but before proceeding I wanted to clarify few things about design and agree on some basics stuff. I know that battery support was requested by many people. Hence I would advise to create Discord server for discussion/ideas and quick development (I can help you set it up etc.)

Currently biggest problem is supply of screens, but if we are serious about I can get some higher quantities ordered if I ask my Chinese suppliers nicely ( ͡º ͜ʖ͡º)

Here is screenshot of early schematic/idea draft: image

babldev commented 3 weeks ago

Thanks for sharing your project!

I actually used the ESP32-C3 initially. Specifically the ESP32-C3-MINI-1 with 4 MB Flash Memory and 400kB SRAM. I was hitting the limits of both sooner than I liked. It was barely enough memory for Bluetooth and Wi-Fi, then you add in 2D graphics + LVGL and two partitions for OTA it was becoming an annoyance.

Because the current iteration was USB powered I decided to switch to the beefier ESP32-S3-WROOM-N8 with 8 MB Flash and 512 kB SRAM.

Long story short, you may need to turn features off or simplify them, especially RAM usage, if you switch to the ESP32-C3.

It'd be pretty time-intensive to review the entire schematic but keep me updated on the project! It'd be cool to see a mobile version of Bitclock. I'll consider a Discord in the future but I have bad experiences from too much noise from past Discord servers so I would probably not be active in it for now. Feel free to set up your own -- if it gets traction I can link to it in the README.

handmade0octopus commented 3 weeks ago

Ok lets do it.

I created server, join and PM me Ill give you admin rights: https://discord.gg/VAyvuMmuTU

As for the rest: ESP32-S3 has 400kb SRAM and tbh I written big projects on smaller older ESP32 with colourful LVGL so it shouldn't be bottleneck. But I will look at codebase a bit later on and figure where it needs trimming.

Not sure if LVGL is right in case we don't use any button inputs - I think it could be simplified and boot button could be used to let users to change screens or configure changing of screens over WiFi (or controlled by HomeAssistant in similar way as ULANZI does).

We can try other bits or leave it as ESP32-S3 but in any case moving to platform.io would give us ability to have different builds for different versions/variants of the boards and people could submit them.

Lets try and see if there is interest on developing that.

handmade0octopus commented 1 hour ago

@babldev Though I will give you update: So far so good, made small mistake with one route but I managed to get most stuff working. 2024-09-11 18 35 25 I only implemented screen, wifi, HDC1080 and SDC40.

Screen is fine, maximum 1.91 fps and I wrote driver for adafruid library so its much smaller and easier to use - can be easily adapted for LVGL.

Of course it uses C++ zero cost abstractions and still have most of RAM and flash available (with OTA updates).

Now writing MQTT broker to put data to home assistant, once that is ready I will think what to do next.

I have 2 problems that you may have encountered:

  1. SDC40 drifts a LOT, temperature starts high and if I query in 30s mode it drops slowly to normal levels. Humidity though goes up and up all the time, also you can see it being hotter than the rest of the board (on thermal camera).

  2. HDC1080 temperature seems to work well although it has offset like 2 degrees (with or without heater set). Humidity though keeps at 99.9% so not sure what to do there..

Not tested charging/battery yet as I am waiting for connectors but so far I am quite happy with this.