In this article, I'll be explaining the basics of how microcontrollers work, physically and virtually. First off, microcontrollers are no simple thing, so don't be discouraged if you find it mind-boggling! The world of microcontrollers is fascinating, engaging, and an awesome hobby; it never gets boring. I'll be focusing more on I/O and analog based microcontrollers, such as those running Arduino, and using Atmel chips as examples (these are most commonly available, and easy to program).
A microcontroller is a silicone-based computer chip (or integrated circuit), that is programmed with a set of instructions. These instructions can range from as simple as blinking an LED, to dealing with mass amounts of data from a serial connection. The size of the microcontroller generally depends on the amount of pins and flash memory. For beginners, I'd recommend purchasing the Arduino Duemilanove, as it is inexpensive ($30) and very easy to use.
Advanced microcontroller users typically write their programs in C, then compile the finished script to a hex (hexadecimal) format. Finally, using a serial cable and AVR (or similar) programming software, users write or flash the data onto the chip itself through the SCK, MOSI, MISO, and RESET pins of the microcontroller (referred to as the SPI, or Serial Peripheral Interface Bus).
In the case of Arduino, the ATmega chip on the board itself contains a "bootloader", which understands and programs data through the UART, which is basically a telephone line between the computer and the board, the bootloader being the interpreter and recorder. The little silver rectangle (rounded edges) is a quartz crystal oscillator, which generates a frequency (in this case, 16 MHz). For accurate and precise serial communication, an external oscillator is practical.
AVR microcontrollers without a bootloader must be programmed through the SPI, as described above. All microcontrollers (at least, those with datasheets) have a pinout schematic and pin description. For example, below is the pinout and description for the ATmega328 described above.
The VCC is the positive power input (5V) and GND is the negative (or ground). Pins 17, 18, and 19 are used by the SPI to program the chip, if it does not have a bootloader. Digital pins are capable of both I and O interfaces, in other words, they can either output power (ex. light an LED), or receive power (ex. identify if a switch is at a high or low state/on or off).
Analog pins are more complicated, as they collect multiple forms of data over a large span of voltage readings. For example, analog pins can determine "digital" specific voltage being inputted.
The AREF pin (21, analog reference) is used as the max value, or highest value measured, represented by the digital value 1023. Any values in between 0 and the reference voltage are represented with values between 0 and 1023.
- Microcontrollers can fry very easily! Ensure that you NEVER insert/attach with incorrect polarity, or to incorrect pins.
- Microcontrollers are sensitive to static electricity, always employ static-protection (grounded wristband).
- Microcontrollers are FRAGILE! Treat them with care.
Now,head on over to part two, which digs deeper into the mysteries of microcontroller programming!
Want to master Microsoft Excel and take your work-from-home job prospects to the next level? Jump-start your career with our Premium A-to-Z Microsoft Excel Training Bundle from the new Gadget Hacks Shop and get lifetime access to more than 40 hours of Basic to Advanced instruction on functions, formula, tools, and more.
Other worthwhile deals to check out:
- 97% off The Ultimate 2021 White Hat Hacker Certification Bundle
- 98% off The 2021 Accounting Mastery Bootcamp Bundle
- 99% off The 2021 All-in-One Data Scientist Mega Bundle
- 59% off XSplit VCam: Lifetime Subscription (Windows)
- 98% off The 2021 Premium Learn To Code Certification Bundle
- 62% off MindMaster Mind Mapping Software: Perpetual License
- 41% off NetSpot Home Wi-Fi Analyzer: Lifetime Upgrades