Tutorial: First time using the Nano Microcontroller

In this tutorial we will be discussing how to initially set up and configure everything required to get started on the Nano Microcontroller. The Nano Microcontroller, simply referred to as “Nano”, is a compact microcontroller that packs a powerful punch. It is a popular among hobbyists and professionals alike, and a great tool to have around the workshop.

When first getting started with the Nano the user may have to configure some things on their computer in order to successfully upload scripts and make circuits. These important steps are discussed in this tutorial. Note that once the user has performed these steps they are likely not going to have to do them again as they are a one-time setup.

Finally, older versions of this Nano required the user to burn the bootloader before being able to even upload any simple script. This required several steps and can be confusion. However, nowadays the Nano comes fully loaded. Meaning the bootloader is already installed. Therefore, these series of steps relating to the bootloader are omitted here. Furthermore, it is common to also find that the Nano has the standard “Blink” script uploaded. This script turns ON and OFF the onboard LED. This is very useful, as the user can easily check upon unboxing their Nano if the Nano is working properly and as expected. This is the next step we will do.

Testing the Nano with preinstalled Blink

You do not need any software or USB driver to check if the Nano is working as it should. All you need to do is power the Nano. The easiest way is to simply plug in a Mini-B USB. But you could also supply 7-12V to the VIN pin if you have a battery in that range or a power supply. For us now we will use the USB option. Plug it in and you should see the little tiny red LED marked with “L” blink with a 1Hz frequency. If this is the case, then the Nano was properly configured with the bootloader and the standard “Blink” script.

Installing the CH340 Driver

Before we can upload a different script to the Nano using the Arduino IDE software, it is likely that you will need to install the CH340 driver.

The CH340 IC is the link between the Mini-B USB port and the serial UART. This chip converts the USB data into a form that the ATmega328P IC found on the Nano can understand. Without this critical IC communication between the Nano and the outside world would be difficult! In fact, the CH340 comes in various versions and is used on many boards, not just the Nano. However, in the spirit of this tutorial, we will only be considering the installation as it relates to the Nano.

The CH340 is made by Nanjing Qinheng Microelectronics Co., Ltd. (known as “WCH”) and has an English website which contains the driver download. Download the software required for your operation system and follow their steps. After a successful installation, you should see the the USB-SERIAL CH340 in the “Ports (COM & LPT)” tree of the “Device Manager” on your machine, similar to the screenshot below.

Don’t worry if the “(COM4)” is not the same on your computer as it depends on which USB port you’ve used. However, we will be coming back to this COM4 later in the tutorial.

Installing and configuring the Arduino IDE Software

The Arduino IDE software is very popular and there are countless tutorials using it, along with custom libraries, examples, and much more. We will get into these sort of details in future tutorials. Here we will simply focus on installing the software and configuring it so to make the Nano work (i.e. upload scripts to the Nano). From the link, follow their steps to install the software.

Once the software is installed, open it up! You should see a menu bar similar to this one:

Fig. 1 – Menu of the Arduino IDE software.

There are four main settings that you must have correct in order to get the Nano working. These are outlined as follows.

1) Set the Port

Recall in the previous section our USB and Nano were plugged into COM4. This is the port we must select in the IDE software. In the menu select “Tools” and navigate to “Ports”. Select your port (COM#), which in our case is COM4. This is shown in Fig. 2 below.

Fig 2 – Tools setting in the Arduino IDE software.

2) Set the Processor

We must select the correct processor. For this Nano microcontroller we need the “Old Bootloader”. This option is visible in the same image above (Fig. 2) from the previous step. Under the “Processor:” tab there might be other options available in your installation, but we only need the “Old Bootloader” one.

3) Set the Board

We must tell the IDE software which board we are using, which of course is the Nano. Again, in the image above in Fig. 2 we can see the “Board:” tab. If you hover your mouse over the tab you will see many options to choose from. We need to select the “Arduino Nano” option, which should be near the top.

4) Set the Programmer

Finally we need to decide which programmer to use that compiles the script onto the Nano. The “Programmer” tab can be seen in the same image above (Fig. 2). We like to use the “AVRISP mkll”. so go ahead and select that one.

Experimenting with Blink as a test

If you have successfully completed the above steps, your Nano should now be ready to be programmed with any script you like. Let’s run a quick test to make sure all is OK. Several examples should have been included upon installing the IDE software. Under File\Examples\01.Basics\Blink you should see the same Blink example that is already preinstalled on your Nano, as we have tested in the steps above. Let’s open this example case and take a look.

Without going into too much detail about the language used, syntax, and the like, we are interested only in checking to make sure our installation and configuration is all correct. In later tutorials we can discuss more details on the scripting aspect itself. Near the bottom of the Blink example script you should see a command called “delay(1000);” as such:

These are the delays between the ON and OFF and back to ON states of the onboard LED. Let us change both delays of 1000 (which is measured in milliseconds, hence 1000ms = 1s) to 500 (i.e. 0.5s). This should make the LED blink twice as fast (i.e. 2Hz). After making this change in the script press the “Upload” button, which looks like a right-pointing arrow as seen in Fig. 1 of the menu bar.

Success! The LED blinks twice as fast. The IDE software is now tested to be configured for your Nano.