←back to thread

It's hard to build an oscillator

(lcamtuf.substack.com)
219 points chmaynard | 3 comments | | HN request time: 0s | source
Show context
ZyanWu ◴[] No.46003220[source]
What intrigued me was the "just use a microcontroller" comment at the bottom of the page - I genuinely don't know if it was pinned because it's a joke, a genius idea or just top 10 dumbest comments of 2025
replies(2): >>46003994 #>>46005440 #
1. dgacmu ◴[] No.46003994[source]
The comment is by the author. And it's not wrong! You can get super cheap microcontrollers for pennies that will act as an easy to use programmable oscillator, if that's what you want. And more to the point, you usually want an oscillator to _do something_, not just to wiggle in isolation, and the cheap microcontroller lets you skip the middleman in many cases.

Yes, you're using a million transistors to do something you could have done with a couple of discrete passives, but it will often result in a lower total BoM and development time. Not always.

replies(1): >>46010060 #
2. ZyanWu ◴[] No.46010060[source]
Well, it's a bit of a chicken and the egg, no? Microcontroller won't work without a (most likely) crystal oscillator or something to act as a clock signal.

Now that I think about it, no, it's not even cheaper as XTALs are quite pricy compared to other discrete components.

I didn't mean to be rude - I interpreted the comment as "Would you like to build an (insert random object here)? Well, you can just BUY it and be done with it" - may not be as I put it (dumb) but certainly... simplistic and purpose-defeating

replies(1): >>46010558 #
3. dgacmu ◴[] No.46010558[source]
I mean, yes, if you're designing a microcontroller you need a clock source, but from the perspective of implementing a circuit as a more normal designer, the UC has it already. And lots of small UCs have an internal clock source so you can omit the external xo unless you need a particular frequency, accuracy, or in some cases a precisely timed micropower sleep. For example, the sub-$0.10 32 bit PY32F002A can do 24MHz internally -- but I would bet it doesn't have great temperature compensation or other things you'd want for timekeeping or being a good frequency ref. (But you're not going to get that out of $0.20 of components anyway.)