Goodbye Arduino, Hello AVR

Go Beyond the Arduino

Arduino Uno
The Arduino is a great prototyping platform, and can get you building projects probably faster than any other platform out there. I cut my teeth on an Arduino UNO, and was like a kid on a sugar-rush when I got my first robot buzzing around my workshop. I built and built, and learned, and read, and experimented, and played. Then came the day that I wanted to build project that needed to be a little more permanent and with less jumper wires that could work themselves loose. I gritted my teeth, held my breath, and plunged into working with the microcontroller in its raw state. No more Arduino UNO to hold my hand, just a bare-metal ATmega328P sitting on a breadboard staring back at me.

The journey away from the safety of the Arduino UNO was a tough one. There was an almost endless supply of information I found on the internet, but the it was fragmented and didn’t form a cohesive guide to take me from the Arduino ecosystem to a standalone project. After months of research and learning (and a fair bit of head-banging) I started getting comfortable with the AVR microcontroller by itself.

I started coming across people who felt very similarly to me, and had faced similar challenges. So I sat down at my PC, and together with the team at Nuts and Volts, I put together a series of articles (still work in progress) to help guide people wanting to move beyond the Arduino. Here’s summary of the topics that this series covers.

Build Your Own Arduino

Nuts and Volts - March 2015

Nuts and Volts – March 2015


So you’ve got an ATmega328 microcontroller, and you’re ready to take on the challenge of working with it “raw”. Now what? This article takes you through the steps needed to build a simplified breadboard-based Arduino, and forms the foundation for the rest of the series. We take things step-by-step, so still work in the Arduino IDE.

Connect Chip

Beyond the Arduino IDE

Nuts and Volts - April 2015

Nuts and Volts – April 2015


The next step we take is to leave the Arduino IDE behind, and start working with more fully-featured development environment – one that is geared up specifically for working with standalone microcontroller projects. Bring your breadboard Arduino along with you as we learn how to blink an LED without using the built-in functions from the Arduino IDE.

 

AtmelStudio - New Project

Handling Inputs on an AVR

Nuts and Volts - May 2015

Nuts and Volts – May 2015


We’ve made an LED blink – now we start working with inputs. As we move further from the Arduino IDE, we learn about some of benefits of working directly with the microcontroller. This month we work with digital and analog inputs: we dig into using registers in more detail, and get to know the Analog-Digital Converter a little better. To wrap up, we create a simple game on our breadboard Arduino.

 

Guessing Game

Let your Microcontroller do the Talking: The UART

Nuts and Volts - June 2015

Nuts and Volts – June 2015


In June we discover how to communicate with our PC. Serial communication is a simple and reliable way to communicate with peripherals, and is achieved using the microcontroller’s USART. We look at exactly what a UART is, and then how to use it to communicate externally. This month, we bring the last 4 months together with a project that the readers design themselves – a serial-controlled thermostat.

 

Serial Thermostat

 

Interrupts on your AVR

Nuts and Volts - Jul 2015

Nuts and Volts – Jul 2015


Sometimes interruptions can be a good thing. This month we look at how to handle interrupts in your Atmel AVR embedded projects, and how they can make your projects more efficient and easier to develop. Our project for the month tests your reaction time – fingers on the buzzers please!

 

Finger on Buzzer

 

Learn to speak I2C

Nuts and Volts - Sept 2015

Nuts and Volts – Sept 2015


The components we’ve included in our projects so far have been relatively simple. This month we raise the bar and connect our AVR microcontroller to modules with a little more intelligence, using the I2C protocol. Our project is the most complex of the series so far, integrating an EEPROM module and a Real Time Clock to build a temperature logger

 

Temperature Logger
Go Beyond the Arduino
ebook - Arduino to AVR

I’ve just completed my brand new guide Arduino to AVR: Get Started in 3 Steps.
Get it now on Payhip for only $1.65.

Challenge yourself and learn how to gain the flexibility and additional control that the AVR microcontroller offers.

As a free bonus, get an ATmega328P pinout cheatsheet.

15 thoughts on “Goodbye Arduino, Hello AVR

  1. Mr. Retallack,

    I’ve enjoyed your series “Beyond the Arduino”. Currently I am reading your article on interrupts. While trying to download solution “finger on buzzer”, I am getting an error message from Atmel Studio that states, ” One or more projects in the solution were not loaded correctly”. This is the first project that I have not been able to open. Any suggestions?

    Thanks,
    Chad

    • Hi Chad
      Thanks for the comment – so pleased that you’re enjoying the series. That’s an odd error – it sounds like the other sample projects download and run OK. I did a quick search online and couldn’t find anything helpful – the error seems to be linked to Visual Studio (which Atmel Studio sits on top of). My first thoughts are:

      • Making sure that you’re extracting the files from the ZIP, not opening them from the ZIP file
      • Checking that your path isn’t too long – perhaps copy the project to another folder and see if it works there?

      If you still aren’t winning, try:

      1. Creating a new project
      2. Opening the Beyond Arduino 5 - 1 Finger on Buzzer.c file in a text editor (Notepad should work)
      3. Copy the code from the text editor and and paste it into the new project, replacing the existing code template there
      4. Give it a go and try compiling

      Hope you come right – please let me know either way.

      Cheers
      Andrew

      P.S. Why not sign up for my newsletter – I’ll be touching on topics that fit in well with the articles!

  2. Hello Mr. Retallack,

    I also enjoy very much going through your articles and learning the embedded programming.
    However, in Part 4, “Talking to Your AVR Microcontroller” I ran into trouble.

    First, the delays were 16 times longer than they should be, but I think I solved it by playing with Fuses.
    Second, attempting to run “Interactive Alphabet” I am getting some proper alphabet characters but not all and interspersed other characters out of expected range. So there would be characters S through Z and then [ ^ _ (in Decimal: 83 thorough 95) with Null, New Line, VerticalTab, etc.
    If you would be willing to look at it I can send you a log of these characters.

    I looked at your program and couldn’t find anything wrong (not that I know what I am doing). It seems to me that it can not be problem with the communication through serial port, if that so, than program would be at fault.

    I ran out of ideas so I am hoping that perhaps you will be able to point me into right direction.
    Thank you very much.

    Regards,
    Kris

    • Hi Kris

      Thanks for taking the time to drop in and post a comment. I’ll send you a mail in the next day as I find it easier to troubleshoot over email. Hopefully we can resolve the issue and then post back here so others can benefit.

      Thanks
      Andrew

  3. Andrew,
    Question on the “EEPROM_write()” function in the September issue of “Nuts and Volts”. Still learning this stuff so forgive if the answer is obvious. You call the “IC2_sendStart()” and “IC2_send()” functions several times and assign the return value to the variable “result” but you do nothing with the value, not even any error checking. I assuming you use “result” simply because you have to do something with the returned value (correct?) but why not check to see if the the operation was successful?
    Thanx for the articles, learning a lot.
    John

    • Hi John

      You’re 100% correct, the result variable returns the status of the operation and therefore we should do something with it – I’m pleased that you’re digging into the code in detail! Throughout the series I’ve tried to make the projects illustrative and focused on the specific topic that we’re covering – and this has been at the cost of writing the code in a way that makes the project more robust, efficient, effective, etc.

      In this example, I probably should have done something with the result – depending on whereabouts the failure occurred I could have exited the routine, retried, or terminated the communication session altogether.

      What I am trying to avoid in my sample projects is the complication in the logic that would arise in the routine that calls EEPROM_write() – do we retry, how many times, how do we let the user know that the call failed, etc. I’m concerned that this would detract from the topic at hand – how to talk I2C.

      I’d love to know whether you agree with my approach – ultimately these projects need to work for you and other readers, so happy to look at alternative approaches.

      Thanks for taking time to leave a comment, and for your encouragement – I’m pleased you’re enjoying the articles!

      Cheers
      Andrew

      • Andrew,

        Thanx for the reply. I do agree with the “KISS” principle, especially when teaching to ground level folks like me. However, if you do something out of the norm, it helps to have a brief explanation as to why you’ve done it. In this case, a comment when “result” was declared that the “EEPROM_write()” function returns a value and you’re only using “result” as a temporary place to put it, nothing will be done with it and that it would be normally used to check the success of the function. I spent quite awhile trying to figure out why the variable “result” was there in the first place. It finally occurred to me that when a function returns a value and something does need to be done with it. Just calling the function with no assignment would cause an error. Of course, this did accomplish the result of my having to dig through the function file and figuring out what it was doing and why.

        I look forward to your articles. Thanx again for taking the time to write them.

        John

  4. Hi Andrew,
    Thanks for the Beyond series. I’ve been studying these for some time now. The recent power management article indicates that you have been getting input/feed back. I see some here, but I can’t find any in the NV site. I’m especially interested in what people are finding in the sequence of graduated power options from the last article. I’m playing with sleep modes at the moment and am interested in the mA, or uA savings that others are finding.

    Thanks again for the series

    • Hi Craig

      Thanks so much for leaving a comment – it’s really fulfilling to hear from readers who benefit from the time I put into the articles! I’m going to send you an email with the results of some experiments that I did – I haven’t yet had any detailed feedback from readers on this sort of savings that they were realising.

      Thanks
      Andrew

  5. Hello,
    will be there another installmens of the series Beyond the Arduino in Nut and Volts? Thank you for the reply.
    Jan

    • Hi Jan
      Unfortunately due to work and personal demands on my time I haven’t been able to continue the series. I had hoped to wrap it up with a final one on SPI – perhaps I will have a chance to write that final one in the coming months. I hope you enjoyed the series – if you have any questions please feel free to drop me a line.
      Cheers
      Andrew

      • Andrew,
        Count me in – I look forward to the SPI article. I am still playing with your series – especially the temperature logger and the power management pieces. I have purchased the XplainedMini board ($8.88) for access to the debug functionality of the Studio 7 IDE. This has allowed me to closely follow code execution and learn the subroutine branching. Learned much about indirect addressing (*,&) features as well and then branched out into a variety of customization. Thanks again for the series – great stuff.

        If you ever decide to continue the series, it appears that you have a following, perhaps even subscribers to crash-bang!

        Thanks again,
        Craig

        • Thanks for the vote, Craig! Pleased you’re digging into debugging – it’s saved me from my own lack of attention to detail a few times!

          Good to hear that you’re still benefitting from the series – thanks for letting me know, it makes it rewarding.

          Cheers
          Andrew

  6. Common Andrew, come back with your articles. It was great journey while it lasted, but we need more! 🙂

    I hope everything is OK with you. Please, give us some update on what is your creative brain working on.
    Kris

    • Hey Kris – it’s really good to hear from you again! Hope that you’re doing well.
      Thanks for the kind words and encouragement. Unfortunately these articles were always pursued as a hobby, and “real-life” demands just don’t allow me the time to carry on working on them. To be very open, I do miss writing the articles as I found it very rewarding – but I can’t see the work pressures easing up in the near future.

      Would love you to post details of something that you’re working on!

      Cheers
      Andrew

Leave a comment

Your email address will not be published. Required fields are marked *