# What do you wish you had known before you started with Microcontrollers?

When working with AVR microcontrollers or Arduinos, what is something that if you had known sooner would have saved you a lot of time or frustration?

• Why is this here now I asked. looks. Ah, Kortuk has been playing with its tags. Many thanks :-). Jan 19 '12 at 7:14
• @RussellMcMahon, I bump random messages to keep people on their toes. I was posting a comment on stack overflow and this was the top rated arduino question. I wanted to change it from a CW discussion question from long ago. Jan 19 '12 at 12:44
• @Kortuk - (1) I hope you like my answer :-). (2) I think it funny that it was placed in this area effectively by conscious action and then promptly closed - with the promoter being one of the closers :-). (3) The fact that it was the top rated Arduino question says something about what people want to hear. and, perhaps, suggests we are not addressing this well enough. (4) FWIW a beginner working through and making sense of the many snippets that I have raised would vastly improve their knowledge base and undersanding of the real world. Dangerous stuff!. Jan 19 '12 at 22:58
• My answer was almost 100% "specific expertise" albeit in summarised form. Expand it all and you'd have a book. Jan 19 '12 at 22:59
• @RussellMcMahon, It was not a top arduino question, it was just a very old question that had an arduino tag. I bumped it with an edit, following my standard method of avoiding action without community flags and then because it was bumped received flags. We have often not taken action on many of the old questions until someone flags then or brings them forward as evidence of why another bad question should stay. I can lock it instead, which might be a better choice. Jan 20 '12 at 5:07

For me it's the other way around: I wish I knew about Arduino's and AVR's before they tried to teach me electronics in secondary school. Learning Ohms law without ever having seen or used an actual resistor was not a pretty exercise. Back then it would be ideal to have an Arduino around to play around with.

Because of this, I would have like to have known more about basic electronics. Simple questions as: why should I care about current? (because things blow up if you don't) Why should I care about resistors? (same here and other stuff) Why should I care about caps? (all kinds of reasons)

Having the ability to play with micros (and frying them in the process) has tought me most of these things but I wish I had learned them sooner. (Classic chicken and egg problem I guess)

• Very well put, I have seen many many students who are fluent with there theory of how a diode works but cannot identify one from a bunch of components Jun 26 '10 at 4:57
• Wow... they try to teach you basic electronics without letting you play with resistors and capacitors? Did they at least use the water analogy? Aug 4 '10 at 6:30
• They probably did let us play with electronic parts but not with the ones you buy but with the special "educational" versions. I remember working with an educational "binary logic" board. All the components were visible only as symbols with connectors for patch cables. The educational value of that was no more than a computer simulation. It would have been fun to have been able to play with real components and at least get the idea that all the stuff you learned had some real application somewhere. And that components are quite cheap and readily available instead of "special and expensive". Aug 16 '10 at 17:35

I wish I had known that every math class I would ever take I would use again, and more than once, and I sure as hell wish I had paid a bit more attention.

I wish I had a lot of hands on experience programming and using FPGAs. They are the new wave of embedded system development and I have only basic class experience with them.

I wish I had been taught how to use all of the modules of Microcontrollers in classes before my boss expected me to use them all.

I sure as hell wish that my university's electrical engineering department started design classes before senior year.

• +1 for the "design classes before senior year" - in retrospect, a project each year wouldn't have been a bad thing. Aug 5 '10 at 2:09
• yeah, it would have done me wonders. I learned more in one project then I did with any other class. Aug 8 '10 at 3:21
• I find that maths and other 'problems' that were beyond me are now understandable or doable or even easy. This is encouraging when so much else in the mechanism seems to be degrading :-). Jan 19 '12 at 7:08

I wish I'd known how much FUN it was :) If I had I would have started playing with this stuff much sooner!

I wished I'd had a clearer understanding of Fuse bits. I spent half my time early on terrified that I'd brick my mega32. Oh and ditto with regards to serial IO.

• As someone who currently spends half their time terrified about bricking his mega32, I'd appreciate it if you could elaborate on this. :P
– Grey
Jun 28 '10 at 19:44

I wish I'd known how useful a board vise and a really good soldering iron would be. My Panavise Jr and Aoyue soldering station cost < $100 together, but they've paid that back many times over by making it a lot more pleasant to build things. You don't absolutely need them, but they're much much better than helping hands and$15 cheapo soldering irons.

I think of loop as being the arduino's substutitue for main in C. So I declared some variables at the top of loop. Bad idea, they get re-initialized each time around the loop. Instead declare as globals before any subroutine. Not a big deal, but it took a few minutes to figure out what was happening.

I wish i had arduinos and "make things talk" when i was a kid. I would have automated everything!

I'm with Kortuk. I wish we'd started simple design classes before final year of university, but specifically I wish we'd gotten to use an Arduino board in my classes!

We used a specially configured board designed at University of Wollongong based on an old Motorola chip, all programmed in assembler via a monitoring application. Pain in the arse!

Of course, I look up the course content for digital design now and they're all using Atmel AVR chips. sigh

I also wish I had more time to tinker with 'em, 'cause that's the best way to learn!

• Yeah, We did the same Motorola work. There is a big shift towards ACVR inside the tinker/educational community at many schools, but I think the PICs from Microchip are a better starting product personally. I think they have a broader range of applications, but I will admit in Low power apps I use MSP430s created by TI. Nov 17 '09 at 9:18
• For our third year group project, we built a wireless electrocardiogram rig based on a PIC chip for the data collection and RS-232 reporting to a computer running the host application. The one we used was a great little unit (can't remember spec now, it's been a while) and really gave me a proper appreciation for Micro's in small, complex logic devices. :D Nov 19 '09 at 21:18
• Sounds like a great project for senior design. I am getting ready to change up how my school teaches PIC. I got some professional development boards and will be teaching students how to handle multiple interfaces. Nov 24 '09 at 7:58

The CAN bus communication scheme and CANOpen.

• Do you have any good links? Apr 28 '10 at 13:52
• @Johan - From my answer, you can tell I don't know a whole lot about it. At work we have a book on CANOpen that we use from canopenbook.com. The wikipedia pages don't look too bad. If your'e primarily writing higher-level software, the important thing is to realize a message has an 11-bit ID, and a 8-byte data segment. I'll be working on a CANOpen project in the upcoming days/months, perhaps I can give more links later. Apr 28 '10 at 15:28
• I'm actually slowly working on a project with the means of learning this....this would be very helpful (especially car projects) Aug 3 '10 at 18:56

I wish I would have known that I could get free samples from a lot of online stores. Then I wouldn't have been forced to choose which project to get started on based on cost. And I wouldn't have been afraid to buy components that I wasn't 100% sure I could get working.

• What kind of things can you get free samples of? Any examples of parts you got from particular stores?
– Grey
Jun 28 '10 at 19:51
• @Grey: Well I just got a free 2X40 character LCD from Purdy Electronics. I only recently discovered this whole sample thing. Here's a place that lists quite a few suppliers that have sample programs: instructables.com/id/Free_Electronic_Samples Jun 29 '10 at 0:41

I have used the Arduino a fair bit and I wish I had known how difficult serial IO was on arbitrary pins. I eventually settled on a 3rd party library but it took weeks to get to that point and even then it was not rock-solid reliable.

One thing I wish I knew better is analog circuit theory. 1s and 0s are easy...hook pin 1 of device A to pin 2 of device B.

A second-order band-pass Butterworth multiple-feedback filter...not so much. And then you have to worry about the characteristics of the op-amp, like whether the capacitive load on the output combined with the output impedance of the op-amp creates a pole which makes the output oscillate.

Or let's say you want to send an audio signal to headphones. You must carefully choose a DC-blocking cap, because it will combine with the impedance of the headphones to form a single-pole low-pass filter. Pick the wrong cap and you will neuter the bass frequencies.

Similar to the accepted answer, I wish I had known about Arduino's sooner. There were some designs I was looking at doing around the house. I have no problem designing my own boards with uC's, but I just didn't want to pay for the PCB costs at the time and then mounting SMT chips. So, those projects fell by the way side. However, now that I know about Arduino and all the shields for it, I'm considering them once again.

This answer strays far from the strict question but is in line with most other answers - and should be fun and useful:

RS232 is upside down

Most of everything you will have problems with will be caused by "boundary conditions" - stuff that happens as things get going or start stopping.

Little endian.
Big endian.
High/low byte first.

Flags left still set when work is done (eg IRQ flags).

Stack overf
ck underflow.

RTS versus RTI

Watchdog what ?

Simple interrupt driven timer real time round robin scheduler that looks like a full RTOS but can be understood and written as you go. Trivial and amazing.

Microcontroller pin specs - Vout / Iout relationships. Vin limits. Holding pins near mid rail.

Always define all pin states under all conditions.

Thermal resistance.

NEVER let a body diode conduct (or mayhap a few uA if you really really must) that your life shall be long on the face of the land - even when the great satans come and tell you it will be alright and that you CAN safely use them for input clamping.

Absolute parameters and operating parameters in data sheets mean totally different things an must NEVER be used interchangeably (or at least not the former for the latter) that your days may be long ... etc.

V = I x R. The V doesn't happen if the I isn't happening so drawing conclusions re V without I is pointless, or worse.

Hex Schmitt inverters !!!! God's gift to DIY digital AND analog electronics. (74xx14, CD40106, ...).

CMOS logic !!!

Opamp common mode range.

Opamp output headroom - high and low.

Voltage regulator dropout - ON TOP OF Vout min.

Voltage regulator Iput min when relevant.

Lead acid battery sulfation. Don't let it !!!

The utter magic of LiIon batteries, despite their drawbacks.

The utter nasty chicaneries of NimH batteries, despite their nicenesses.

LSD NimH (no, not lysergic ...)

MOSFETS !!!!!!!!!!!!!!!!!!! Yee ha

Low Vgsth MOFETS and digital electronics and large loads. Yee Ha.

MOSFET, 2-jellybean-transistor gate drivers.
Why you NEED a gate driver.

Tantalum capacitors die die die !!! (and they do)

Input leakage current. What's that?
Input off what ?

Accuracy / resolution / linearity / monotonicity / ...

Isochronous.
Asynchronous?
No, Isochronous.

Asynchronous. 1 bit 2 bit 1.5 bit more.
LSB first!. First? YES! Start bit, stop bit, parity bit, forced parity, no parity, do you know if parity is on?
Bit sampling - middle of bit, samples per bit.
Accuracy with RC - absolute error per end, shared drift (temperature), resonator, crystal internal clock - old one and new.
Always more !!!

Crystals shatter on high g./ Or just drift and jump.
Or shatter.

Hot melt glue fails. Always. Always ? Always ! Weeks to months to just maybe years.
Acid cure silicone rubber is a no no no no.
Thermally or electrically conductive epoxy is filled with X - you can fill it too.

Silicone rubber and cornflower say 50-50 to start. Try it, you'll like it.

Heating a large pottle of fibreglass resin on a cold morning may make it go off faster but THAT fast ??? !!!!

Tin whiskers.

If they say ROHS their magic machine will spot your non compliance instantly.

Larn to solder. Well.
Note that solderability can vary very very greatly.
Bad solder is a waste of calories and not worth sharing your life with.
ALWAYS clean / abrade a bare board that has sat around a while before soldering - time and stress saved can be monumental.
Learn to NOT catch falling soldering irons.
Learn to kick falling soldering irons while grabbing their cords, if they have one.
Learn not to drop soldering irons.

Nd2Fe14B magnets are great fun BUT -
They can do you a very serious injury.
A good one can take out a wallet of magnetic cards at a single bound. They shatter chip and break with ease.
The US process ones are significantly inferior in field strength to the Japanese process ones.
Provide up to about 0.5 Tesla across an airgap of about half material thickness.
Magnetic field drops as inverse SQUARE of distance from one pole but two poles are always involved so it looks like 1/d^3 at a distance.

Much more ... :-)

Everything.

(Yeah, it's unrealistic)

(Also, better).

I wish I'd known just how easy it is to make a BSD programmer and get started. That would have saved a lot of time tool hunting. Of course I also wish I would have had the Bus Pirate sooner :)

And I still wish I knew where to get more chips cheaply (including delivery).

What I wish many of my interns knew is how difficult and demoralising electronics can be. I see many non-engineer types try to add some flashing lights and sensors to a fashion project or something, not realising that they're heading for a debugging nightmare.

If I was to write a book on electronics, I'd do my best to scare people away in chapter 1. Anyone who was left would probably be able to put up with debugging.

• I disagree with this quite strongly. Electronics is no more demoralizing than learning to knit or how to play a musical instrument. If you want something custom and haven't got the patience and frame of mind to LEARN instead of applying a cookie-cutter solution then yes, you're in for a bit of a rude awakening. Head over to SparkFun and grab some flasher modules if that's all you need, but be prepared to stay within the limits of what they provide. You can't have both. :-) It's like I tell my kids... most things that are worth learning are going to take practice and patience to master. Aug 4 '10 at 6:37
• No, electronics is quite different to knitting. Both of these subjects are hard because they require practice to get good at, but a wooly jumper never mysteriously stops working when you wave your hand near it. Electronics has a whole 'nother arena of 'fun' waiting for you, even if you're very experienced. I've been in the business for 17 years, and things still bite me. Aug 4 '10 at 19:27
• I have some sympathy with the first paragraph, as a hobbyist I can't afford the quality components and test equipment that would make some of my many headaches disappear. But the second paragraph is just plain wrong Feb 25 '11 at 7:14
• Try helping a bunch of fashion students with an electronics project some day. Then you'll see. Apr 21 '11 at 8:56
• Electronics is easy if you are prepared to work at it step by step. Easy if you are prepared to apply logic to find how things are and not try instead to wish them into being as you want. Debugging is easy. Really. You just pull off all the iwngs legs, body parts etc then rebuild the beasty bit by bit and see what happens. Hard only happens when it is an indivisable whole - eg a high voltage smps with feedback where all must fly at once for any to fly at all. Making a jersey flash or beep does not usually require such closed loopery. Break it down step by step and all is well. Jan 19 '12 at 7:12