Suggest a microcontroller for a DIY PCB watch - Page 1
Forum section: electronics / general

author: tellurium
author_rank: Frequent Contributor
timestamp: March 12, 2025, 01:07:51 pm
content: I want to design and build a very simple DIY binary watch , similar tohttps://www.tindie.com/products/subsystems/simple-rechargeable-binary-watch/Requirements:- run on a battery for a long time- functionality is minimal: light LEDs on button press, otherwise sleep. show battery % on double click- USB for reprogramming- minimum components count- no components on the bottom side- preferably SMT components, 0603 for easy assemblyWhat MCU and components would you recommend (e.g. which LEDs) ?Is there an easy way to protect the top part from the moisture and accidental damage? I worry mainly about the battery. Should I worry about something else?

author: jpanhalt
author_rank: Super Contributor
timestamp: March 12, 2025, 01:16:03 pm
content: Any microcontroller with a crystal oscillator one that allows a 65536 Hz (2^16) tuning fork second oscillator. In fact, there is nothing wrong with using a "clock" oscillator for the main oscillator for something that simple.

author: stretchyman
author_rank: Regular Contributor
timestamp: March 12, 2025, 01:23:29 pm
content: Attliny

author: tellurium
author_rank: Frequent Contributor
timestamp: March 12, 2025, 01:35:19 pm
content: Quote from: stretchyman on March 12, 2025, 01:23:29 pmIf I go with attiny, should I implement USB in software?Would a 32-bit ARM with USB be a better choice, from the point of power consumtion / price / simplicity ?

author: DashApple
author_rank: Contributor
timestamp: March 12, 2025, 02:05:01 pm
content: I did something similar as a prototype a while back, Though I understand its not remotely as small and i lacked buttons at the time and I opted for IC's I had an idea of.Mine was based on the Atmega328P with an DS3231 RTC and 16 channel constant current LED driver along with a battery fuel gauge IC ( USB B was just a test, Tad big )Doing it again i would go with a smaller RTC since Id go with the 328P again but Id remove the USB bridge and just use UART since time would be set by buttons on the watch, It sleeps and wakes up to update the LEDs,The new Attiny's look like a good option too.just my 2 cents

author: squadchannel
author_rank: Frequent Contributor
timestamp: March 12, 2025, 02:05:55 pm
content: What do you want to do with USB? If it is just to set the time, it should be possible via USART.Recent AVR varieties use UPDI. one wire reprogramming and debugging is possible.implement DFU updates, will need to build a bootloader that can self-program while sending checksums via USART."REAL" USB, it would be easier to use an STM32 or similar with USB support.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 12, 2025, 02:14:30 pm
content: Quote from: squadchannel on March 12, 2025, 02:05:55 pmI think USB would serve as a handy connector for reprogramming.If I use UART, then what connectors should I use? Like have pads and use pogo pins ? Any pointers?

author: squadchannel
author_rank: Frequent Contributor
timestamp: March 12, 2025, 02:15:12 pm
content: Batteries can be coin cell or coin cell like Li-ion. In that case, a charging circuit would be needed. Magnetic charging cables are also a good idea.To protect it from external factors, it is better to put it in a case.Cases are available from enclosure manufacturers in the form of wristwatch enclosures. 3D printing is also a good option.https://www.serpac.com/product-by-series/bw-series.htmlhttps://www.okwenclosures.com/en/Plastic-enclosures/Body-Case.htm?ref=53d163b0-c3d5-11e5-bef8-bc764e20b40e

author: tellurium
author_rank: Frequent Contributor
timestamp: March 12, 2025, 02:17:43 pm
content: Quote from: DashApple on March 12, 2025, 02:05:01 pmThat watch looks sick! Well done!Even and Ethernet ? What did it do?Are there micros with a built-in RTC, to save on component count / PCB space / complexity?I think there are, like ESP32 IIRC

author: SiliconWizard
author_rank: Super Contributor
timestamp: March 12, 2025, 02:18:57 pm
content: For low power and all features and memory they have, I would personally recommend the STM32L4 series. Ultra-low power, has USB, has anything you'd need for this, and has no limitations like you'd get with an ultra-small 8-bitter. It has a RTC, only requires a small 32768 Hz crystal (which can be used to drastically improve the accuracy of the internal RC clock too, so you don't need any other crystal).You can go for the lower end of this series for this project, I think that would be the STM32L431? It's pretty cheap too, considering what it brings. Available from JLCPCB directly too.Just my pick, of course.

author: squadchannel
author_rank: Frequent Contributor
timestamp: March 12, 2025, 02:20:53 pm
content: Quote from: tellurium on March 12, 2025, 02:17:43 pmI don't think there is a modern micro that does not have an RTC. It is a basic peripheral function.

author: DashApple
author_rank: Contributor
timestamp: March 12, 2025, 02:25:18 pm
content: Quote from: tellurium on March 12, 2025, 02:17:43 pmThankyou, It does looks like that but its just a well over sized USB B socket hereI switched over to USB Micro B for the final design.Most of the ICs I had used are old so not the best for PCB space saving, Going with other's suggestions would be a good idea with more modern MCU's with built in RTCs, If you went down the lithium battery route then a simple linear charger and maybe a fuel gauge depending on how far you'd want to go.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 12, 2025, 02:42:55 pm
content: Quote from: SiliconWizard on March 12, 2025, 02:18:57 pmThank you!So say if I go with STM32L431, I'd need a battery, a oscillator, LEDs, and a bunch of decoupling capacitors, apparently.Any suggestion w.r.t. battery? Can I power the STM32 directly, or need a converter?

author: SiliconWizard
author_rank: Super Contributor
timestamp: March 12, 2025, 02:56:20 pm
content: Quote from: tellurium on March 12, 2025, 02:42:55 pmNo problem powering it directly from a 3V lithium coin cell. It works down to 1.7V, and the accuracy of VDD won't matter if you don't use ADCs/don't need a stable reference (which you won't, given your requirements).It should draw less than 1 µA with the proper low-power mode. Say that the LEDs would draw 5 mA (all combined) on average when lit up, which is probably overkill (small SMD LEDs are pretty efficient), and that they are lit up a total of 1 minute per day (which is probably also overkill for normal daily use), you should get something like 4 µA consumption on average. Say 5 µA to be conservative (I'm sure that would be less than half that in practice). On a CR2032 (about 200 mAh), that would be 4.5 years (again, you can probably count on twice that in practice).

author: woofy
author_rank: Frequent Contributor
timestamp: March 12, 2025, 03:05:25 pm
content: Quote from: tellurium on March 12, 2025, 02:42:55 pmGiven your familiarity with STM32, that's what I would suggest. For the battery I have used the LIR rechargable button cells very successfully with an ESP32 project, using a small solar panel to recharge it. They go up to 4.2v on re-charge, so you will need an LDO to 3.3v. The advantage is the USB port can also re-charge the battery when needed.Sorry about the massive amazon links, search LIR2032 or LIR1220 if you don't want to click them.LIR2032https://www.amazon.co.uk/EEMB-LIR2032H-Rechargeable-Lithium-ion-Batteries/dp/B096LQN4GJ/ref=sr_1_7_sspa?crid=2JC77GBW6OZ47&dib=eyJ2IjoiMSJ9.piXozJrAJNtEuj7i7IAH2KaR6jFEqwBH6jpdmqnh5Q5UmZVm-AMqKzCqcUm8XTp0RJJtFv35RuJz59uON2mpI47DSA9scd9zarXimg8QbAWpfb2uVAjaBSrN4lcxPnq_7IgJGtabWqc767JRV0DRyMMIzk_eQ2D-7Be4gLWcvHmaYk6C_AUuo6nMW-6kZsm_jONWlhDBKLB67tzmAlfJYT3Wf__IlGuKsUWyYlEcy2s.aagw8lDvw_OJwbK79TqH_welg1Z54k9lwys2GveT6cU&dib_tag=se&keywords=rechargeable+lithium+button+solder&qid=1741790698&sprefix=rechargeable+lithium+button+solder%2Caps%2C81&sr=8-7-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9tdGY&psc=1If those are too big the a LIR1220:https://www.amazon.co.uk/SIMPLETEK-Rechargeable-Battery-LIR1220-connectors-Silver/dp/B0DZXNM5KK/ref=sr_1_6?crid=2JC77GBW6OZ47&dib=eyJ2IjoiMSJ9.piXozJrAJNtEuj7i7IAH2KaR6jFEqwBH6jpdmqnh5Q5UmZVm-AMqKzCqcUm8XTp0RJJtFv35RuJz59uON2mpI47DSA9scd9zarXimg8QbAWpfb2uVAjaBSrN4lcxPnq_7IgJGtabWqc767JRV0DRyGW5vp7lQbMluWRP9R0-BO0w347QhPNhQ8momO77LrR_jONWlhDBKLB67tzmAlfJYT3Wf__IlGuKsUWyYlEcy2s.ictdDkMEVx5egu5vxMvT7IxkrhC9JKvV678_agZ8JLM&dib_tag=se&keywords=rechargeable+lithium+button+solder&qid=1741791108&sprefix=rechargeable+lithium+button+solder%2Caps%2C81&sr=8-6

author: Kasper
author_rank: Frequent Contributor
timestamp: March 12, 2025, 04:08:07 pm
content: For shorter links, I often delete the '?' and everything after it.https://www.amazon.co.uk/EEMB-LIR2032H-Rechargeable-Lithium-ion-Batteries/dp/B096LQN4GJ/ref=sr_1_7_sspaCould even go a step further:https://www.amazon.co.uk/EEMB-LIR2032H-Rechargeable-Lithium-ion-Batteries/dp/B096LQN4GJ

author: woofy
author_rank: Frequent Contributor
timestamp: March 12, 2025, 05:08:38 pm
content: Thanks Kasper,I'll try to remember that next time.

author: Picuino
author_rank: Super Contributor
timestamp: March 12, 2025, 05:41:02 pm
content: Microchip PIC with XLP (eXtreme Low Power)https://ww1.microchip.com/downloads/en/DeviceDoc/30009941J.pdfhttps://ww1.microchip.com/downloads/en/Appnotes/00606B.PDFExample: PIC16F15323https://ww1.microchip.com/downloads/en/DeviceDoc/PIC16_L_F15313_23_Data_Sheet_40001897C.pdfeXtreme Low-Power (XLP) Features:Sleep mode: 50 nA @ 1.8V, typicalWatchdog Timer: 500 nA @ 1.8V, typicalOperating Current: 8 uA @ 32 kHz, 1.8V, typical

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: March 13, 2025, 10:37:17 am
content: CH32V203

author: Picuino
author_rank: Super Contributor
timestamp: March 13, 2025, 11:25:47 am
content: One LIR2032 lithium battery has approximately 70mAh capacity.If you leave half of the capacity to keep the clock running for a MONTH, you have to have a consumption of:35mAh / (30 * 24h) = 48uA of max continuous consumption in RTC mode.If you leave half of the capacity to keep the clock running for a YEAR:4uA of max continuous consumption in RTC mode.

author: bobxyz
author_rank: Contributor
timestamp: March 13, 2025, 06:01:06 pm
content: You could look at the low-end TI MSP430 chips toohttps://www.ti.com/microcontrollers-mcus-processors/msp430-microcontrollers/overview.htmlYou probably need to go to a bigger than needed pin count (e.g. LQFP-48) to find one with USB support. Capacitive touch sensing would be nice instead of a button.For protecting the board, a 3D-printed enclosure would be best. Spray-on clear "conformal coating" would provide some protection. I don't know if there's a cheap hardware store alternative that won't react with the PCB.https://www.digikey.com/en/products/detail/acl-staticide-inc/8695/10270026On a tangent to the original request, there are starting to be some "LCD watch development board"s showing up on ebay. So far, they're rather big and ugly.

author: peter-h
author_rank: Super Contributor
timestamp: March 13, 2025, 07:03:57 pm
content: I must be missing something huge here, but surely a watch- needs to run for a fair time on the battery (it is debatable whether the almost daily removing it from the wrist to charge it, is a hugely cynical play on fashionable smart watches)- needs to be accurateWhat CPU do Garmin use in their £800 top end watch? They claim ~50 day battery life but that is only if you basically don't do anything with itIt is really fat, to accommodate the battery.Re accuracy, you can have a periodic GPS sync. But all smartwatches do very little without a bluetooth connection to a smartphone.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 14, 2025, 04:15:11 pm
content: I've created a schematic. It is simple - but since I am not a HW person, I'd appreciate comments / feedback on it.- Pin VDDA / VREF+ left unconnected - is that OK?- only 1 uF decoupling cap per VDD pin, is that OK?- Those current limiting resistors per LED, do I really need them if I plan to lit LEDs for like 3 seconds only, a couple of times a day?- Thought a lot about USB connector, and since I plan to program baremetal, I have little idea about how it will work out. Ideally I could program the thing from using the USB connector, but I guess that needs a bootloader installed, so how then to bootstrap the chip? So for now I broke out UART and SWD as 2.54 inch spaced pin holes, to make sure I have options w.r.t. programming. I plan to stick a short female header for those, no idea about better connector options.

author: woofy
author_rank: Frequent Contributor
timestamp: March 14, 2025, 04:23:20 pm
content: I would put a 10k pullup on the reset line, and also pull Boot0 to ground via a resistor.The 1uF are ok if they are multilayer ceramic surface mount caps, otherwise a 0.1uF in parallel.Yes, you need the current limiting resistors.

author: woofy
author_rank: Frequent Contributor
timestamp: March 14, 2025, 04:26:36 pm
content: The processor has a built in boot-loader. Set boot0 high during reset to use it. That's why I suggested the pull down resistor. I normally connect boot0 directly to ground as I only use st-link.

author: woofy
author_rank: Frequent Contributor
timestamp: March 14, 2025, 04:36:13 pm
content: You should also allow for some load capacitors on the 32.768KHz crystal. Something like 12-18pF each side to ground should be ok.

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 14, 2025, 04:55:13 pm
content: Without the VDDA connected to the supply voltage the internal oscillator and LSE might not run. I know from experience that a STM32F103 does not start when VDDA is not connected.As you are running from a battery and the caps on the supply pins of the MCU are only for decoupling I would reduce them to 100nF.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 14, 2025, 05:46:24 pm
content: Thank you pcprogrammer & woofy!woofy, could you elaborate on a reason a ceramic cap makes a difference, what's special about it?

author: woofy
author_rank: Frequent Contributor
timestamp: March 14, 2025, 05:54:41 pm
content: Multi-layer ceramic caps have a low inductance. If you use an aluminium electrolytic they have a small inductance because they are wound internally. That inductance can cause a voltage drop on fast internal switching inside the processor. I would change them to 100nF caps as pcprogrammer suggested.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 14, 2025, 05:59:24 pm
content: Done, thank you!

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 14, 2025, 07:30:23 pm
content: It is probably best to also add a decoupling cap on VDDA. Depends a bit on how you can place the cap on pin 1 and route the VDD to pin 5. The decoupling caps should be as close as possible to the pins, with not to thin power traces.Another thing is that you did not value your series resistors on the LED's. They depend on the LED forward voltage and the supply voltage and the amount of current you want running through them. Depends also on if you are going to use PWM to control the brightness. Modern SMD LED's don't need a lot of current to be bright, so you might want to experiment with it for the different colors you are going to use.It might also be a good idea to add a 1uF cap from reset to ground, to delay the startup on battery insertion. May not be needed here, but good practice in other MCU designs with for instance power supply via USB.As a side note, you started of with a bad habit of schematic drawing. I do this too when in a hurry or can't be bothered to much, but it is better to use wires instead of those net labels to make the connections. With a simple design like this it makes not that much difference, but it improves on readability.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 15, 2025, 05:46:00 pm
content: pcprogrammer, thank you for those tips, appreciated!LED resistors are all 1k Ohm.W.r.t. wires vs net labels - I did not know that. Could you give an example of a good schematic to illustrate the point, please?

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 15, 2025, 06:34:09 pm
content: Quote from: tellurium on March 15, 2025, 05:46:00 pmYou are using EasyEDA by the looks of it. With this you can export your schematic. Menu option File->Export->EasyEDA. Upload the export here and I will redraw your schematic to show you what I mean with the wires versus the net labels.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 15, 2025, 10:33:20 pm
content: Here it is. Zipped cause eevblog does not like attaching .json.Thank you.

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 16, 2025, 08:42:49 am
content: Here you go, your schematic redrawn with wires.I modified the reset part to correct it to how it should be. Also removed the VDD from the connectors for programming. Why, because it is a battery driven system, and when the battery is placed it is not a good idea to supply a voltage to it without any protection.An option can be to add a separate connector for supplying power, but this still can hurt the battery. This is something to think about.For the LED resistors, your choice to use 1K ohm for them all can bite you in the behind, brightness wise. Best to test this before making a final design.

author: tellurium
author_rank: Frequent Contributor
timestamp: March 16, 2025, 05:20:54 pm
content: pcprogrammer,that is way more than I expected, thank you so much.

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 16, 2025, 07:07:42 pm
content: Quote from: tellurium on March 16, 2025, 05:20:54 pmNo biggie, and you are welcome.

author: ColinB
author_rank: Contributor
timestamp: March 24, 2025, 04:46:51 pm
content: Quote from: peter-h on March 13, 2025, 07:03:57 pmThere are a wide array of what people consider a "watch". As opposed to a wrist-worn personal computer.You have to really want the smart watch experience to have a device that needs to be charged every day. But if OP wants to make a watch that uses LEDs as the display, then the LEDs are going to use significant energy and unless they are somehow turned off for the vast majority of the time, it will have to be charged frequently, it seems.As for accuracy, average 32.768 kHz crystal is good enough for normal watches. Just needs manually synchronized to the second every couple of weeks. You could do temperature compensation in firmware to increase accuracy also.You could use Bluetooth to synchronize time automatically (e.g. Device Time Profilehttps://www.bluetooth.com/specifications/specs/dtp-1-0/)Now Garmin is an interesting example since it has good battery life but also a lot of features including GPS. They obviously are using a CPU/microcontroller that allows good low-power operation, but also they must have made some good design decisions and quality implementation of firmware and hardware, so they get my respect for that.

author: SiliconWizard
author_rank: Super Contributor
timestamp: March 24, 2025, 06:52:04 pm
content: Well, +/- 1 s per 2-week period is about 0.8 ppm. Not something you're very likely to get with an "average" 32768 Hz crystal (which will be more like +/- 30 ppm) and no special additional measure IMO, but YMMV.(30 ppm over 2 weeks is about 36 s, just to get some perspective.)

author: Picuino
author_rank: Super Contributor
timestamp: March 24, 2025, 07:00:19 pm
content: You can reach better accuracy with tuning (adding or substracting x pulses every 1000000 pulses) and with temperature compensation.https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ApplicationNotes/ApplicationNotes/00001413B.pdfhttp://ww1.microchip.com/downloads/en/AppNotes/Atmel-42251-RTC-Calibration-and-Compensation_AP-Note_AT03155.pdf

author: peter-h
author_rank: Super Contributor
timestamp: March 26, 2025, 10:23:01 pm
content: Watch mfgs do proper calibration in production, probably 2-point i.e. at 2 temps. You have to do that if using a cheap 32768Hz xtal.Swiss "chrono" watches need to achieve < 7 secs per day, which is what you get on a 10,000 quid IWC etc - well from one 600 quid service to the next a year laterOr you could assume it will be worn, so +35C or soand then cal it at just that one point. But if it draws as much power as this one will, it likely won't be worn during the night (that's the case for most smartwatches) and then you have a problem...There are drift offsetting methods used in the precision analog chip business, which let the device warm up and drift due to that and you measure the drift and extrapolate the curve from that. I was doing this in the 1970s on precision HV power supply feedback resistors. It is much quicker than heating up the product during production to get the 2nd cal point.If there is not enough self-heating then you can incorporate a resistor next to the xtal which is connected to test probes for the heating.However in this case I suspect the purpose of this exercise is to develop an application note for some software libraries, so it doesn't need to be super polished. One would be hard pushed to compete with the 800 quid Garmin product, which probably runs for a week or so between charges. And which doesn't do a whole lot anyway unless there is a BT-connected smartphone.

author: tellurium
author_rank: Frequent Contributor
timestamp: April 07, 2025, 07:50:52 am
content: Got 5 PCBs from JLCPCB, with 2 of them assembled. Battery they did not assemble, and also did not ship either - so need to deal with it later.I've created a repo where I posted both hardware and firmware sources,https://github.com/cpq/watch. Firmware code with time display and time setup logic is implemented and tested.Left to do:- (hardware) battery- (software) proper clock setup, currently a default is used, which is an internal oscillator IMO- (software) proper low power sleep / wakeup on button pressQuick question. Any tips can I measure power consumption for the assembled board? The relevant equipment I own is this:- Tenma 72-7745 multimeter- Miniware DS213 mini oscilloscopeThank you all, your help so far was invaluable.

author: woofy
author_rank: Frequent Contributor
timestamp: April 07, 2025, 08:12:29 am
content: Dave used to sell the ideal device for this, but its not been available for a while:https://eevblog.store/products/ucurrent-gold-multimeter-adapter?_pos=1&_sid=bdaecbd89&_ss=rAnother forum member has just found two of them that have been lost for 12 years.https://www.eevblog.com/forum/chat/2-ucurrents-found-after-moving-my-lab-halfway-across-the-world/Maybe you could come to some arrangement together.

author: voltsandjolts
author_rank: Unknown
timestamp: April 07, 2025, 10:36:30 am
content: Quote from: peter-h on March 26, 2025, 10:23:01 pmThe turnover temperature of watch crystals is typically 25C as the watch temperature is lower than wrist surface temperature.Firmware applied rtc temperature compensation may or may not be useful here (e.g. watch spends nights off-wrist, or many days at cooler temperature, if you care). For academic interest, there is a fun technique of temp comp using two crystals.https://bhi.co.uk/wp-content/uploads/2023/12/12-HJDecember23-AOTM.pdf

author: Tation
author_rank: Regular Contributor
timestamp: April 07, 2025, 02:58:35 pm
content: Quote from: tellurium on April 07, 2025, 07:50:52 amthis Nordictool is aimed at measuring consumption of devices that show current peaks (as sleep - awake - sleep). Not much expensive, IMHO.Note that I have not used it.

author: voltsandjolts
author_rank: Unknown
timestamp: April 07, 2025, 03:34:51 pm
content: Quote from: tellurium on April 07, 2025, 07:50:52 amYes indeed, theNordic PPK2is well worth themodestprice.