AVR Programming: Learning to Write Software for Hardware (Make: Technology on Your Time)

Atmel’s AVR microcontrollers are the chips that power Arduino, and are the go-to chip for many hobbyist and hardware hacking projects. In this book you’ll set aside the layers of abstraction provided by the Arduino environment and learn how to program AVR microcontrollers directly. In doing so, you’ll get closer to the chip and you’ll be able to squeeze more power and features out of it.
Each chapter of this book is centered around projects that incorporate that particular microcontroller topic. Each project includes schematics, code, and illustrations of a working project.

  • Program a range of AVR chips
  • Extend and re-use other people’s code and circuits
  • Interface with USB, I2C, and SPI peripheral devices
  • Learn to access the full range of power and speed of the microcontroller
  • Build projects including Cylon Eyes, a Square-Wave Organ, an AM Radio, a Passive Light-Sensor Alarm, Temperature Logger, and more
  • Understand what’s happening behind the scenes even when using the Arduino IDE

Users Comments:

  • I like this book but for different reasons then “omg it’s so great”…
    I like it because it provides a positive primer while not going to such detail that some theoretical person can read it nodding their head all the time.
    As a Primer, I would award this 5 stars but as a shelf resource I would give this 3.5 (hence the 4 start rating. I have noticed that the wording is not well edited and thus you have to re-read and fact check certain paragraphs. The code relies on you knowing and understanding libraries well. If you do not, get ready for some homework (which lets face it, you are programming an AVR, you HAVE TO KNOW libraries. You will also be required to understand AVR register programming such as the book does not teach well. Reference datasheets for the chip you are using. Ex: [search for the Atmel 328P COMPLETE datasheet (not the summary) on google] Also,…The book is consistently inconsistent. The author even notes in a few places that this is done on purpose to force a reader into studying outside material. Google comes in handy here and it is not a deal breaker. Again, Elliot is pushing you to use the internet instead of spoon feeding you literally everything. If you have determination and staying power and know how to work through these types of books and speedbumps found there-in, then go get it. If you are looking for a primer that will introduce you to the lingo and various use subjects, go get it. If you expect this to be a single source reference, think again!
  • If you are past the beginner stages with Arduino and want to play closer to the hardware, or work with Atmel’s AVR family chips stand-alone on a breadboard rather than in an Arduino, this is the book for you! Unlike another book I got for that purpose, this one is well written, easy to follow, and appears to have actually been written and edited by competent folks. I’ve found very few typos, and none that interfered with understanding. The concepts are well explained and presented in a rational order. This may be heavy going if you’ve never programmed a microcontroller, don’t know what a register is, or aren’t familiar with binary math or Boolean logic, but the book does explain these to an extent if you haven’t run into them before. You’ll want the AVR data sheet for reference too (free download, link in the book)…the book has the info required for the projects described, but being able to put that in context with the rest of the processor description is useful…especially if you want to try things not explicitly covered in the book.
  • Excellent for getting started programming AVR MCU’s.
    For someone like myself with no microcontroller experience, some general electronics knowledge and lots of programming experience, this book hit the spot. A couple of pointers:
    – I got the USBTiny programmer from Sparkfun, which works fine with ATmega168’s. Just jumper the corresponding pins.
    – I started with the Arduino IDE, which works as mentioned in the book, but requires some fiddling with boards.txt to get USBTiny to work with atmega’s. In the end it all turned out to be more trouble than it’s worth. How it builds and flashes is pretty involved and far from transparent. Better to go with WinAVR as mentioned in the book, and just edit your code with good old Emacs. The Arduino IDE gets all wrapped around the axle if you’re messing with different processor speeds and baud rates. I never got the USART working right at anything but 9600 baud at 1MHz using the Arduino IDE. It’s much easier to just edit the Makefiles, which are very well documented. Also, if you’re messing with different AVR chips, you’ll want to go this route: the ATTiny chips don’t have a USART and the USART.c program doesn’t compile for them. You just remove that from the Makefile for ATTiny projects and you’re good-to-go. I have no idea what the other reviewer was talking about with WinAVR not working when the Arduino IDE was previously installed on a Windows PC – that was exactly my setup and it worked right away, subject to the following nit:
    – the avrdude argument -p should be “m168” not “m168p” as stated.
    – I ran through most of the examples to get going – they pretty much worked as expected.
    – When I started messing with the ADC, I realized how slow the internal one was and went for a separate chip. The MCP3004 works a lot faster and is fairly easy (and instructive) to interface via SPI. Again, the book does a great job at explaining SPI, and that knowledge translated well.
    – Another point to note is that some of the projects don’t work right if you’re connected to the programmer. Rather than plugging and unplugging all the jumpers each time, I attached the programmer to a breadboard with a ZIF socket, and had a separate breadboard and ZIF socket for running, and just shuttled the chip between the two.
    – Sometimes the book only shows a photo of the breadboard and not the actual wiring diagram. If you have to pick one, the wiring diagram is more clear IMO.
    I started this about 3-4 weeks ago from ground zero and have gotten through almost the entire book. At this point I feel very confident about working with AVR MCU’s going forward.

Be the first to comment on "AVR Programming: Learning to Write Software for Hardware (Make: Technology on Your Time)"

Leave a comment

Your email address will not be published.