Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Baremetal programming on the tinyAVR 0 micro-controllers (omzlo.com)
106 points by unwind on Oct 1, 2020 | hide | past | favorite | 96 comments


I think it's a really cool tutorial but one thing I don't often see discussed about the 'benefits' of 8bit AVRs (and this tutorial misses that) is that there are still through-hole form factors available for those chips.

I think most everyone has the technical skills to go through this tutorial but a large chunk of the developing world will not be able to afford pcb manufacturing and all the tooling for SMD components.

Having an 8bit AVR with a through hole form factor democratizes access to electronics for a lot of people around the world.

Any maker can take a 1$ veroboard and build a semi-permanent circuit board with a very crude soldering iron. Whereas if you miniaturize further with SMD formats, then the access to materials and tools becomes an economic barrier.


I think the through-hole vs SMD difference is mostly psychological. 'large' SMD devices where you can see the pins (not BGA and such) are often easier to solder (and easier to fabricate PCBs for, because you don't need to drill holes precisely).


You can get pcbs made for peanuts and soldering through hole components requires hardly any coordination at all. People who have been soldering their whole life find it easy to solder SMD because they have the coordination to do it and the temperature controlled station too.

I can solder qfps and tssop no problem but it's still easier to solder a dip package, they can go in breadboards or perf board and you can bang together a circuit without temperature controlled stations or cad software


I think that you are mostly correct for those who has the correct soldering iron and skills.

One thing that I have found is PTH is much more forgiving than SMD. The copper tracks and pads are typically much heavier and can tolerate a lot more abuse from the less skilled.


The issue I am refering to is not the technical barriers with SMD but the cost both for low-volume PCB manufacturing and SMD tooling.

For a lot of economies an SMD design immediately prices out a lot first-time makers. Specially if you compare that with a $1 veroboard and a $10 soldering iron.


You can get simple two layer PCBs made for virtually nothing these days (even at low volumes). There's no cost-related reason to avoid using a PCB. You'll probably save money overall by being able to use cheaper SMD components.

You don't need any special tooling to solder SMD components, either. A temperature controlled soldering iron and a cheap hot air station are perfectly sufficient.

To make this a bit more concrete, consider that you can get 10 custom two-layer PCBs made for $2: https://cart.jlcpcb.com/quote?orderType=1&stencilWidth=100&s...


A chinese 5x run of a two-layer PCB from JLC is $13 incl shipping to Sweden, and takes 3-4 weeks for mfg and delivery.[0]

You can speed it up a bit by going with a local mfg like Svensk Elektronikproduktion, who charges $154 but "only" takes ~2 weeks.[1]

Or you can head down to Kjell&co, pick up a few breadboards for $10[2] or a perfboard for $8[3], and be home again in 20 minutes.

Which do you think is more approachable for hobbyists? Oh, and you'll probably be able to pick up most through-hole components you want during the same trip, while SMD stuff usually needs to be ordered online.

> You don't need any special tooling to solder SMD components, either. A temperature controlled soldering iron and a cheap hot air station are perfectly sufficient.

I'd say a hot air station qualifies as special tooling. But disregarding that, while I can agree for passive components, even tiny SMD MCUs tend to have their legs packed close enough that solder bridges are practically inevitable for beginners.

[0]: https://cart.jlcpcb.com/quote, remember to add shipping and disregard the "special offer" garbage that only applies to your first order

[1]: http://www.svenskelektronikproduktion.se/en/webshop/prototyp..., remember to add shipping cost and add the 25% VAT

[2]: https://www.kjell.com/se/produkter/el-verktyg/elektronik/ele...

[3]: https://www.kjell.com/se/produkter/el-verktyg/elektronik/mon...


Manufacturing with JLC only takes a day or two. Delivery speed depends on which courier you choose. I’m in London and often get boards within a week via DHL, or 2 weeks with the cheaper shipping option.

Breadboards are mostly useless these days because very few components of interest are through-hole and many circuits don’t work at all on breadboards (e.g. switching regulators). I’m a hobbyist and virtually never use breadboards. If you just want to play around with simple circuits then sure, use a breadboard. But you are really missing out if you don't take advantage of cheap PCB manufacturing and the enormous range of amazing SMD components.

There’s nothing “special” about a hot air station. I paid £35 for mine and it works fine.

It's easy to learn how to solder SMD components. Beginners will screw it up, but that's the whole point of being a beginner, right? Solder bridges are very easy to fix with flux.

>and disregard the "special offer" garbage that only applies to your first order

It doesn't only apply to your first order. I've ordered at the $2 price many times. In any case, there are many Chinese PCB fabs of approximately equivalent quality, and you can almost always find one that has a promotional rate of some kind.


We're talking about casual beginners, which is not the same as beginner.

I started my career in Lithuania, where a student will earn no more than a few hundred eur. JLC delivers a custom board for 7Eur within a MONTH! For 7eur I can get a perfboard, ATTiny2313 and a bunch of components and make a thing... in about 4 hours.

I used to make CAN interface boards without SMD and with tools that cost me roughly 20Eur in total. Never needed a hot air station - so your claim that it's nothing special is complete delusion of reality. I couldn't even afford a breadboard... not to mention specialist MCU programmer.


How do you use perfboards? I never managed to get the wires in the same holes as the component's leg, it was such a hassle that it was literally easier to make SMD PCBs with a 3D printer than to solder on a perfboard.


The wires go through the holes next to the pin, not into the same hole. There's a million tutorials and examples online.

And you go the same route - cost and accessibility have nothing to do with "how easy". How would some beginner in a country with $300 average monthly income be able to 3d print stuff?

Advocating for SMD only is exclusionary delusional elitism, until working with SMDs becomes completely financially trivial for the majority of the world's would be electronics engineers.


Wirewrap is underrated. Its definitely tedious, but its solder-free and surprisingly reliable.

Its more expensive than soldering however: wire-wraps are best on header-pin posts, not on the ICs directly. So you should buy sockets-to-wirewrap posts if you plan to wire-wrap. You can wire-wrap on the IC directly, but its definitely not as reliable so I can't recommend the practice.

If we're talking about these small designs with only a dozen or two connections, wire-wrap is more than sufficient. Besides, you can still largely use a soldered Veroboard for most of your design, and just use the occasional wire-wrap for a harder to handle point-to-point connection.

Some beginner tutorials:

* https://hackaday.com/2014/12/18/wire-wrap-101/

* https://learn.sparkfun.com/tutorials/working-with-wire/how-t...

I think having a few wire-wrap tools will help out a low-cost hobbyist. I'd estimate $50 in various parts (wire-wrap wire, a few dedicated wire-wrap sockets), but its largely "compatible" with soldering and DIP components. (Works with perfboard, veroboard, etc. etc. and everything you're soldering with)


Next to the pin? Are these boards were adjacent pins are connected? Mine are singles.

> How would some beginner in a country with $300 average monthly income be able to 3d print stuff?

I am from (and live in) such a country, you just save up a lot. Sure, it's not a disposable device, but it's not unobtainable.


1. You can solder together the copper hole frames or stretch a wire and attach it to the holes. It's less tricky than trying to solder sub millimeter SMD contact with a 3mm point soldering tip

2. "Save up a lot" - that's an obstacle that prevents a lot of people from realising that they can create beautiful things. And that is literally the reason why I am vehemently opposed moving away from through hole logic components. Lower barriers to entry = richer world full of beautiful things.


You’re supposed to insert wires on adjacent holes and bridge together. Harder than glueing an SSOP and running wires to it though.


You're telling the chap who couldn't afford a breadboard to use a 3D printer.


I'm telling the chap who couldn't afford a breadboard that I find soldering perfboard very hard.


>Never needed a hot air station - so your claim that it's nothing special is complete delusion of reality.

I think you're going a bit over the top with the rhetoric there. Hot air stations don't cost more than soldering irons. I bought mine new for £35. I'm not saying that everyone in the world can easily afford a hot air station. But it's wrong to characterize it as some kind of exotic, highly expensive piece of equipment just because you didn't happen to own one.

You can also just use a cheap toaster oven (though that makes rework more difficult).


> Delivery speed depends on which courier you choose. I’m in London and often get boards within a week via DHL, or 2 weeks with the cheaper shipping option.

So, even further from "dirt cheap". And it's still not even in the same ballpark as going down to the store.

> If you just want to play around with simple circuits then sure, use a breadboard.

And what do you think beginners are going to do? Of course there will usually come a time where you need a PCB for something, but the longer that can be delayed, the more likely that they'll actually get past the hurdle.

> There’s nothing “special” about a hot air station.

It's another thing to buy, another thing to need to store somewhere, and another skill to learn.

I'm not saying it isn't valuable, but there is also value in a gradual learning curve.

> It's easy to learn how to solder SMD components. Beginners will screw it up, but that's the whole point of being a beginner, right?

See above.

> It doesn't only apply to your first order. I've ordered at the $2 price many times.

That hasn't been my experience.


The $2 offers are time-limited. They have nothing to do with how many orders you've already made. I've made lots of orders with JLC and I can still sign into my account and get the $2 rate. You've also made orders with them, it seems. Are you saying that you don't get the $2 rate if you sign in?

I think where we disagree is that you think that beginners should delay using PCBs, where as I think that the sooner they move to using PCBs the better. I certainly regret that I delayed doing this myself.


100% agreed. I wasted a lot of time years ago making crappy homebrew perf-circuits, before just getting comfortable with KiCAD.

Regarding the delay.. I find it's not so bad because I'm juggling a few projects, so I always have one on order, and tackle other things while I wait. It's not like your entire hobby career is going to end in a month.

Regarding $2 JLC orders, my experience has been it's always available once per order, for a 2-layer <100mm x 100mm. Definitely have gotten that discount many times.


so 100x100mm pcb, 2 layers, x5, manufacturing costs - £1.56 12-16 business day delivery - £4.18 7-9 days - £9.25 4-6 dhl standard - £15.58

I think 30pcs protoboard for £9.90 with next day delivery from amazon still beats the custom made pcbs. And I don't need to spend time making sure my pcb design is 100% bug free...

Again, speaking from the hobbyist point of view.


I’m also speaking from the hobbyist point of view. There’s obviously nothing wrong with using protoboard if it works for you. Here’s why I don’t.

First, virtually none of the components I want to use are available in DIP packages. E.g., there are many great, very cheap, ARM Cortex microcontrollers that just don’t come in DIP packages.

Second, I have fewer problems with mistakes when I use PCBs. The EDA software checks that my board matches my schematic, so I only have to worry about errors in my schematic. And it’s not that difficult to make small corrections to a PCB with bodge wires if one or two connections are wrong. I’ve certainly made PCBs with errors, but I’ve never made one with so many errors that it was entirely unusable.

Third, the end result is a nice, neat, durable PCB, rather than an ugly tangle of wires. And other people can easily make one using your gerbers.

Fourth, you can use switching regulators and other layout-sensitive components.

For these reasons, I’d encourage any hobbyist to take advantage of the incredible service provided by Chinese PCB fabs. You can do so much more with a custom PCB than you can with protoboard.


To be fair - you're already in advanced stages, when you're looking into ARM MCUs.

PIC10F is $0.55 at Mouser. You can make a programmer for it with an USB-RS232 cable and few other cheap components. That is what I call beginner cheap. Even assembler for it is dead simple.


Even for PIC and Atmel, you have much more choice if you're ok with QFN and TSOP packages.

The ARM microcontrollers aren't actually so much harder to use than the Atmel ones. I remember thinking that it was going to be much harder the first time I tried it, but if you stick with one of the popular ranges (e.g. STM), then the dev tools are good and there's lots of help available online.


Don’t you need 12V VPP/MCLR line for PIC?


I don't remember. Unused them in automotive applications, so they might need them.


>> you'll probably be able to pick up most through-hole components you want during the same trip

Wait, you can buy discrete electronics components in a physical store?


Sure. Here's one in Cheltenham, Gloucestershire, UK:

https://www.google.co.uk/maps/@51.9034553,-2.0801054,3a,41y,...


Yep. I can go to a store and get literally everything to build a smart lights control system for my mother's apartment - in Vilnius, Lithuania.

https://www.lemona.lt/?page=item&i_id=60796

The irony - I cannot do the same in NYC, but the components that I can buy online are cheaper here.


Kjell (my example from earlier) has physical stores throughout Sweden. Their offerings aren't super deep, but they have plenty of kits and common parts to get started with.


I'm able to at Microcenter here in the USA.

Picked me up a cheap oscilloscope too.


I do love Microcenter, but the one in my hometown I've never seen bare components. Actually nothing hobby-centric really at all, not even breakout boards or small modules.


This largely ignores the reality in much of the world outside North America, Europe, and some parts of Asia.

> You can get simple two layer PCBs made for virtually nothing

Sure you can produce them in Shenzhen for virtually nothing but try getting it shipped to Cartagena, Colombia, or Maxixe, Mozambique and then tell me how cheap they get.

> A temperature controlled soldering iron and a cheap hot air station

That is a 'cheap' under $100 setup in a lot of places, but $100 is also the monthly paycheck for a lot of people. Compare that with a $10 soldering iron and honestly consider how are they equivalent outside a developed country.


>try getting it shipped to Cartagena, Colombia, or Maxixe, Mozambique and then tell me how cheap they get.

Sure, but components and all of your other equipment also have to be shipped.

>That is a 'cheap' under $100 setup in a lot of places, but $100 is also the monthly paycheck for a lot of people.

I'm fully aware of that, but you at least need a decent soldering iron whatever kind of components you're using. The hot air station is optional if you avoid QFN. These days you only save a little by getting a non-temperature-controlled iron, and it's a massive reduction in utility.


> Sure, but components and all of your other equipment also have to be shipped.

Those are not custom parts, they are shipped in bulk.

> but you at least need a decent soldering iron

There are people out there who cannot afford to _need_ a $40 temperature controlled soldering iron, and irrespective of the lottery of where they were born in the world, they still have an interest in (and often a need to repair) electronics.

The industry trend of ending dip package options is inevitable but it also makes things harder for many makers across developing countries.


> Those are not custom parts, they are shipped in bulk.

Not if no one else in Mozambique wants those parts.


You don't need to go outside of EU to get lack of availability of fast deliveries.


I'm volunteering in a school in Rural VA, and about half our students couldn't afford a class where we had to pay $0.20 per circuit we make.

Most of them can't afford the $20 class fee, and we waive it and make do somehow anyways.


>I'm volunteering in a school in Rural VA, and about half our students couldn't afford a class where we had to pay $0.20 per circuit we make.

If you're ordering for an entire series of classes, then you could probably get the cost of each individual PCB under $0.20. It would take some forward planning, but it's doable.

In general, it's common for kids to have no money. (I had no money when I was a kid.) If you are doing electronics on an extreme budget then naturally you'll just have to use whatever equipment you can get hold of. But PCBs are really really really cheap. If you cannot afford PCBs you probably can't afford lots of other things that you need.

That's not to say that you should be using PCBs. I have no experience teaching kids electronics.


That reflects my childhood. HN is full of sheltered silver-spoon kids, or to use the current vernacular, unacknowledged class privilege.


Give me a break. I couldn't afford to be an electronics hobbyist when I was a kid either. The only question here is over whether you actually save any money by using through-hole components. Only the madness of the internet could turn this discussion into a debate about "surface mount privilege".

By focusing only on the transition away from through-hole you're missing the fact that everything has got vastly less costly. Temperature controlled irons are much cheaper than they used to be. High quality PCBs are ridiculously cheap. You can buy a microcontroller for $1 that's more powerful than an 80s home computer. If you have a limited budget, you want to be doing electronics now, not in the 1980s.

I have every sympathy for kids around the world who can't afford to pursue their hobbies, but electronics is more affordable and accessible than it's ever been.


I would agree that it's easier than it used to be and easier than it might seem, but for an absolute beginner it requires several more skill sets to be able to get started with.


It's not psychological. You're completely ignoring the cost of equipment.

SMD only is a huge no-go for someone at the lower bracket of income.

The cost of a perfboard, with a cheap soldering iron and components is a fraction of any kind of equipment you need to create a circuit board from scratch.

I built voltage regulators for my electronics projects, because a regulated lab supply was completely out of financial reach. I couldn't have done it with a breadboard - I needed a permanent fixed board. I couldn't have done it with a copper laminate and etcher - because I couldn't afford $10 for the etch or a $40 dremel drill for the holes.

I didn't have a programmer and I had to reuse the RS232 chips to program ATTiny2313.

If people like you had their way, I would have probably been a barista...


Back in college, I etched my own PCBs in tupperware with muratic acid, with Sharpie marker as the mask. Nowadays I buy $2 (for 5) PCBs from china. Equipment-wise, you can reflow SMDs quite well on a frying pan.


Yeah.... I reused most of my $1.50 perfboards 2-10 times. Reusing expensive components, such as $4 MCUs and not frying them in a literal frying pan - is critical. A DIP socket literally made it possible for me to do MCU programming with my $5 soldering iron, that would normally fry an MCU.

Nowadays I buy prefabed modules and uSBCs for $30 each and throw them out - not as my main job as well..

Yet I know really well what access to start in the engineering field means for people whose budgets are $80 per month on food and clothes.


Chinese iPhone repair guys are hand soldering SMDs all the time, you can definitely solder SMDs on THT perfs or get SMD perfs. It's more of the matters of your motor skills and perhaps whether you have a good video microscope if it gets really small.


Sure, but that doesn't make it easy, which was the point.


1. That's racist.

2. They make money off it - thus higher value equipment. Definitely not a $10 soldering iron.

3. Building from scratch is about 100x easier and less error prone with through hole construction, than SMD. Soldering onto an existing PCB is not an issue at all here.

4. When you can't afford to scrap a $4 MCU, because you overheated it with your $5 soldering iron - DIP package can be mounted into a special socket. SMD - cannot.


1) I said Chinese because not many people with other nationalities do PCB repairs on iPhone. People who aren’t trained by Chinese repair ... artists? are exceptionally rare.

2) 3)

https://hackaday.com/2016/10/10/ne555s-smd-prototyping-is-a-...

https://twitter.com/idzuna_tan/status/741895788469485569

https://mitxela.com/projects/soldering_msop

4) https://www.adafruit.com/product/1280

0.65mm is def doable, 0602 caps are hard, below or BGA needs microscope but only from there you need proper equipments


You just linked me to a $49 part...

Are you on a mission to prove that you're completely incapable of understanding that that is an insurmountable amount of money for billions of people?

As for your racism - OH BOY!.. (eyeroll)


Good ZIF sockets for DIP component costs just as much


Yes, that's why people without money DON'T BUY ZIF SOCKETS!


As a DIY'er SMDs are a massive pain as they are hard to impossible to solder and need special PCBs, which I think is what DoingIsLearning is getting at.

Holes are already drilled in your veroboard, that's what they are for, your job is to solder and you want it to be easy and simple.


It's really not difficult to solder SMD components. See e.g. https://www.youtube.com/watch?v=b9FC9fAlfQE&t=1518s for a good introduction to the relevant techniques.


It's not impossible. But it is not as easy as through hole


It really is. That's kind of my point. When I was starting I spent a lot of time and effort to make a design with all through-hole components because I perceived that surface mount was difficult. The design suffered massively from that compromise, it was still a pain to assemble, and when I actually tried surface mount later I felt completely cheated. Soldering a large pitch SMD micro is actually quicker and easier than soldering a DIP, even with crap equipment (though it's always more difficult with crap equipment).


SMDs with leads and 0603 or larger are quite easy to solder in my experience, at least on a factory-made PCB with solder mask. I can hand assemble SMD faster than thorough-hole, using a temp-controlled iron for both. (I have hot air rework station as well, but most of my SMD assembly is with a fairly inexpensive iron.)

SMD is a pain during prototyping and experimenting because they’re harder to use on breadboards (breakout boards are an additional step and possible point of failure). After the breadboarding stage, I think SMD is easier and faster.


> in my experience

In your experience. I solder under a stereo microscope, but I don't go smaller than 1206.


Everyone's different, but my experience tallies with sokoloff's. With the right technique it's no problem to solder 0603 with the naked eye. 0402 is possible but very fiddly. 0201 is really pushing it. A microscope is a useful aid, especially if you're longsighted.


>> access to materials and tools becomes an economic barrier

I'm not sure that's true anymore. PCB fabrication is dirt cheap from the Chinese fabs. In terms of design, KiCAD is free and perfectly usable. Both design and assembly take some practice, sure, but they are valuable skills to learn.

There's value in DIP packages for breadboarding, so you can get going quickly and iterate the design, but for anything permanent or semi-permanent, I don't see a big impact.


If you need a few things in your makeshift lab - perfboard/veroboard is perfect. You can go to your local electronics components store get a few bits and start programming AVR chips within a day.

Using KiCAD, then waiting for the equipment and then soldering - that is already a barrier.

Imagine you need a small voltage regulator on your DC supply line, because your cheap power supply spikes randomly... Are you going to wait for your PCB to be printed and a month for delivery(sometimes 2 months) and pay $6+ for a single board for delivery(components excluded, obv)... or you're getting a 10 pack of perfboards for $5, cut our the right size and have your voltage regulator within 10 minutes at a fraction of the cost...


I think the issue in this whole thread is that a lot of the people commenting on the benefits and merits of SMD development are failing to see the reality that the $6 for a board or $40 for a temperature controlled soldering iron are actually too much money in far too many parts of the world.

Sure as professionals you might work with $20K oscilloscopes and relatively speaking spending less than $100 on a basic SMD soldering station is peanuts, but we need to appreciate this is simply not the reality for a lot of the world out there.

This has nothing to do with the technical merits of SMD or how easy/hard it is to solder versus through-hole. For a lot of kids and makers in developing countries dip packages and veroboard are the only economically feasible gateway to start to make electronics.

I don't understand why everybody is struggling to accept this. Perhaps it is just a failure to appreciate the economic lottery of where in the world we are born.

To me it is sad that there are kids out there who would stop their curiousity just because of economic barriers, I hope AVR's dip packages continue to be produced for a long time to come.


AVR DIP packages will probably be produced for a very long time.

HN comments section contain the cream of elitist delusionals. I bet that only a very small minority have ever experienced crushing poverty and homelessness. Or have experienced how engineering can pull them out of said poverty.

And then you get "I earned my income by studying hard and working hard"... while being oblivious how much pure luck was to do with it.

It infuriates me, when such people then advocate for inaccessible tools for the poorest. Because I was that - 20 years ago(at 16) I was homeless and had about $10 per week in finances.... for me and my mentally distressed mother to survive.


I continue to be dismayed by how Microchip treats developers. Want a toolchain? You have to create an account. Of course, it's freeloading off of the Free software gcc toolchain. Even worse, when it comes to their microcontrollers that use the START or ASF4 system, you get headers that are incompatible with Free software (I haven't checked how they license the headers of the new tinyAVR series MCUs). At least when it was Atmel it was just a few pieces of IP that were guarded with stupidity like this (their touch interface is the only one I recall)


I thought major benefit of AVRs was that you could ignore all that typical vendor bs and just use upstream avr-gcc and be happy. Similarly attiny being so simple mcu, you wouldn't need any libraries as just poking the registers is manageable enough for everything.


Yeah, noticed similar with ActiveState yesterday. Went to download ActiveState TCL just to do a 1-off compile of SQLite on a windows box... and now they require people to create an account to even download TCL.

Instead, I just deleted the SQLite requirement and avoided the whole thing. The only way to win is not play their game. :(


You could just use Cygwin or Msys Tcl. Or just build it yourself. It has always been an embedded language and the build process isn't problematic.


Wasn't worth the effort for this one off case.

It's actually ironic, as I had learning TCL on my todo list due to interest in CNC machining (some older stuff used TCL).

But not any more. Even going to the TCL language home page, they push people towards ActiveState. That's killed my interest in TCL entirely, and likely permanently.


Microchip need to realize that they're selling chips, not software. The barrier to entry should be as low as possible, providing a free, developer-friendly tool chain to attract hobbyists. Instead they treat software as another IP that should be milked. The unbearable developer experience actually drove me away from they PIC microcontrollers towards AVR many years ago. It's pretty obvious to me that the success of the AVR is in large part due to the open tool chain. Microchip makes very nice chips, I'd like to use them but they're handicapped by the obnoxious tools. It's unfortunate that they solved that problem by outright buying Atmel but not changing their own practices.


Just typical hardware manufacture stuff. They all do this sort of thing. I still remember trying to modify and build intel's yocto image a few years ago. It was completely impossible.


That's really annoying. I like to make little build environments with something like Vagrant and some scripts that will set up the toolchain. Having to use a browser and an account to download pieces to make it work makes that really difficult.


I really enjoyed working on microcontrollers and embedded systems back when i was interning at an aerospace company. It was so fun getting into the nitty gritty of these tiny controllers. Spending hours at the lab bench, messing with clock settings and registers. Ended up going towards software after college though, mainly for the money tbh.

I still wonder to myself how i can back into this hobby. These kinds of tutorials are nice but they always kind of leave you wondering what else one can do. IMO it takes so much more than just the mC to make something useful/interesting, as it's just the brains of the operation. One still needs to give their project the arms and legs to really do something.


I recently got back into it. There are tons of youtube videos that provide tutorials.

What helped me most was having concrete and doable projects that you'll want to finish. My first project was a digital dice (attiny85, 7 leds, CR2032, button and a small perfboard). Now it's a led strip for a camper (esp8266 w WLED firmware, potentiometer, 5V stepdown converter). I'm also toying with radio transmission over 433Mhz so I can have battery powered sensors (water-well depth, temperature, etc)


adafruit.com

They have a bunch of tutorials, aimed at absolute beginners, but they also have a lot of great breakout boards for different sensors and their store is well stocked with weird little trinkets that inspire creativity. Blinking stuff, actuators, sensors, all there.

sparkfun.com is a similar shop.

It's a bit like shopping individual lego parts.


adafruit is great. also, they have circuitpython support for most of their stuff. circuitpython is nice for getting LEDs flashing without having to setup a large toolchain.

micropythin deserves a shout-out too for getting something happening with minimal toolchain setup overhead.


I've gone back to embedded development as a hobby recently. A good starting point is a Arduino board. These are mostly AVR or ARM board with a set of input/output components you can easily plug in. There is a sketch coding environment which is basically C++ with some some helper libraries. However you should be able to convert to a fully open source environment. I recently got things compiling using avr-gcc and avrdude to downloads. I'm doing all the editing in vscode. Next step for me will be bringing up FreeRTOS. You can get some dev board and components in bulk through Amazon quickly. Also many manufacturers sell their dev board directly.


Nice article!

A question to the fellow Embedded Developers?

How often do you encounter tutorials and "getting-started-guides" of similar quality than you see here (and in similar blog-posts) FROM THE ACTUAL CHIP VENDOR.

I often feel stuck between a rock and hard place with vendor docs and it feels like there is only the choice between marketing material and transistor-level technical docs (excuse the hyperbole).


Vendors often try to push their fully integrated toolchain that makes everything feel like a black box (and encourages lock in).

Funnily enough some Chinese Semiconductor companies who can't effort to develop such fancy SDK Wizards tend to have the more digestible SDKs (just a bunch of simple periph drivers with a Makefile) Unfortunately they also don't afford good / English documentation :\


This probably already exists, but i really wish there was some kind of Wikipedia or something for all the random microcontrollers out there. Some kind of go-to place to find just enough info on an mC to get going and maybe a link to the actual tech docs if one needs it.



Wow that’s awesome! Thanks so much


Not often. For what it's worth, I am currently working on a project within a semiconductor company to improve this situation.

Semiconductor companies (in my experience) are finally starting to accept the importance of software, so documentation is the next battle. It's coming, but slowly.


Anyone who wants to try this out cheaply - search for "Arduino Nano Clone ATMEGA328p" boards. They use a similar (but more powerful chip) and cost less than cost of shipping: a couple of dollars/euros each.

They come with a USB boot loader (so you don't need a USB to serial cable). Get 2 and you can also use one as a programmer (probably cheaper than a USB to serial cable).

They're also compatible with the Arduino IDE if get fed up with the low level stuff


You can get stm32 boards with more memory for a similar price. I really don't get the appeal of those AVRs.


Arduino support (STM32 has it now but only relatively recently and with substantially less libraries), better availability, less of a confusing hardware landscape with numerous minor chip variants and 'pill' form-factor hardware versions with wacky incompatibilities, more open source PCB designs available, inertia...


Its not about CPU-power, its about electronic flexibility.

AVR has 1.8V to 5V power tolerances. STM32 boards have 1.8 to 3.6V tolerance. (Yes, STM32 boards can have 5V I/O tolerances, but you need the power line to be ~3.3Vs)

This means that you can run an AVR system from 3xAA batteries or Li-Ion without much more thought involved.

STM32 is more complex: 2xAA works, but that's much less energy than 3xAA. Lithium Ion is nominally 3.6Vs, but when charging Li-Ion can be 4.2Vs IIRC, so you're going to need to protect the STM32 from the higher charge voltages, because 4.2Vs is out-of-spec.

This means that STM32 needs an external voltage-regulator module, while the AVR can just happily accept the 4.2V voltage-under-charge under a Li-Ion setup.

-------

The 5V that ATTiny or ATMega supports can also deliver more power from its I/O pins. STM32 is pretty impressive with 15mA source/sink from 3.3Vs, but ATTiny and ATMegas are specified with up to 20mA at 5Vs, both source and sink. That's a lot more potential wattage you can source (and sink) from a raw I/O pin.

----------

So consider what you need to do if you have a 5V line (3x AA batteries): you'll need to create a safe 3.3V line for your STM32, you'll need to have a reference 5V voltage that your ADCs are based off of, and you'll need a voltage-converter to handle all of your 5V electronics.

Or, you can just throw an ATMega or ATTiny at the problem, and just run your entire system off of 5V (ADC, I/O pins, everything).

In my experience, the higher voltage (5V instead of 3V) has a lot better op-amps, and other such devices, that you can work with. Having more voltage is an advantage in electronics design: it really makes things a bit easier to design electrically. (Less noise, less hysteresis issues, etc. etc).

A rail-to-rail OpAmp still only has +/- 2.5Vs at the 5V level, but that's a lot more voltage to work with than +/- 1.65Vs at 3.3Vs, especially if the rail is losing 0.2Vs as is typical. (+/-2.3V once you lose 0.2Vs, but only +/-1.45V on the 3.3V system). Traditionally, OpAmps operated at +/- 12Vs for a reason, the larger voltage just gives you more room to play with. Throw down 100mV to noise

5V also opens up the possibility of running off of a USB line without any voltage-regulation. An important-trick for sure.


I have three projects in progress and chose AVRs.

Part of it is the voltage flexibility that dragontamer mentioned — two run off USB power and include 5V SPI LEDs, and one runs off unregulated 3×AA.

The other part is simplicity and directness — I can just write *PORT=0x42 rather than rely on some vendor BSP that doesn't address my use case and will be deprecated next month.


They have a much shallower learning curve and a large moat of people who have used them for decades, simple as that. These days, AVR chips are a stepping stone to learning embedded development.

They're fine for very cash-strapped beginners, but it would behoove new developers to leave them behind quickly. They are more expensive and less efficient than modern options, and you won't find many well-paying jobs asking for AVR/Arduino experience.

STM32 chips are a much better option, IMO, especially for beginners. They come in sizes ranging from <$1 Cortex-M0 chips up to dual-core Cortex-A/Cortex-M processors, and they use the same sorts of peripherals across all of those product lines. So you can start small, and incrementally learn about more complex parts and topics.

And if you really need a breadboard-friendly chip, an MSP430 is probably a better option. It's a 16-bit MCU focused on power efficiency, and it has GCC/Arduino ('Energia') support. Some of them also have non-volatile FRAM memory.


There is just one - ATmega4809-PF - which is available in a pin-through-hole 40-pin DIP package.

But I don't really see why to use that, there are loads of breakout boards for the others in the similar series, attiny3217 is good.


That's not so tiny... 256 Bytes RAM, 4K Flash, that's quite a bit bigger than the smaller ATtiny25 (128B RAM, 2K Flash, 6 I/O, much less hardware on board)


Attiny4 has 32B RAM, 6 pins and 0.5KB of flash ... see the whole product range here (pdf link) http://ww1.microchip.com/downloads/en/DeviceDoc/30010135E.pd...


Why would you need more?

I prefer with PIC, as they offer real time very predictable execution. All instructions have same execution time.


PSA: tinyAVR Microcontroller Projects for the Evil Genius is a very good book on this family of MCUs.


if I want proper debugging what are my options with these? Embed a gdb-stub? some kind of JTAG?


"Proper" is in the eye of the beholder I guess ... remember that this is an 8-bit part with 4 KB of program space and 256 bytes of RAM.

You are probably not implementing a gdb stub on that while still having meaningful resources (memory, peripherals, execution time) left for your an application complex enough to warrant that level of debugging support. :)

That said, it seems these cores have some on-chip hardware debugging support. See the data sheet [1] section 30 ("Unified Program and Debug Interface (UPDI)"). Features include:

- Memory mapped access to device address space

- Unlimited number of user program breakpoints

- Two hardware breakpoints

- Run-time readout of CPU Program Counter (PC), Stack Pointer (SP), and Status register(SREG) for code profiling

- Program flow control (Go, Stop, Reset, Step Into)

- Non-intrusive run-time chip monitoring without accessing system registers

This interface is the one that is described in the article, and accessed over a single pin on the chip package. I think it sounds pretty neat, makes me want to have a look at AVRs again! :)

[1] http://ww1.microchip.com/downloads/en/DeviceDoc/ATtiny406-Da...




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: