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?
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)
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.
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'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!
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.
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.
Always initialise your variables. ALWAYS.
And your interrupt vectors.
High/low byte first.
Left adjust N bits.
Flags left still set when work is done (eg IRQ flags).
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.
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 ...)
Adjustable current limit adjustable voltage power supplies for prototype life maintenance.
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 / ...
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.
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 ??? !!!!
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 ... :-)
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.