Upload code on an Arduino

Upload code on an Arduino

We are going to see how to upload code on an Arduino Nano on Windows.

Arduino are microcontrollers, the main difference with a computer, it that it can execute only one software.
This makes it more reliable, more suitable to control electronic and last but not least cheaper.

As long as you are not afraid to solder, I suggest you skip the most well know : Arduino Uno to directly use Arduino Nano, which are similar in functionalities but smaller.

These Arduino boards are connected with USB, so you can easily power them, upload code, and send/receive instructions from an computer, a Raspberry Pi, and even (some) phones !

Where should I buy an Arduino Nano?

These website sells Arduino Nano clone, The main difference with official Arduino is that it uses a different chip for USB, the CH340g instead of the FTDI FT232.

arduino nano

In this tutoriel, we are going to:

  • Download and install Arduino software
  • Copy a code (sketch)
  • Upload a sketch on the Arduino
  • Debug the sketch
  • Copy library if necessary.


Install Arduino

  • Click arduino-1.x.x-windows.exe to install Arduino


  • Open arduinoNano_Drivers.zip, and click on setup.exe

CH340 drivers

  • Then click on INSTALL


We are ready to program our Arduino Nano clone.

Copy a sketch

An Arduino program (Sketch) is a folder wih an .ino file.
Let’s see an example, pigetArduino/helloworld

This sketch will transmit Hello World  every 2 seconds on the USB serial port :

  • Download helloworld here
  • Open the file, inside the folder helloworld-master, we have a folder helloworld, this is where the sketch is.


  • Copy the folder on your skecth folder (Documents/arduino)


  • Click on the sketch helloworld.ino (inside helloworld folder)


A sketch must have the same name as the folder
Where is my sketch folder ?
The sketch folder can be founded inside Documents/arduino on Windows.

You can find where it is on Arduino inside File -> Preferences.

Upload a code on an Arduino

We now have our sketch, we can now copy (upload) it on the Arduino:

We can now copy it (upload it) on an Arduino.

  • In tools, select the board  : Arduino Nano
  • In Port , choose the port of your arduino (if you don’t know which it is, start with the last)


  • Click on Upload (Shortkey : CTRL-U )


  • Arduino red LED will turn on, then the green led will start to blink fast, finally you should see Upload done on your screen


Which port is my arduino on ?
On Windows, Every Arduino are represent by there COM port (Which makes them hard to identify)
The easiest way is to try every ports, Windows create a COM1 port by default so there should be only 2 ports

You can also

  • Go inside the control panel / System / Device manager (Shortkey : WINDOWS + PAUSE)
  • Search at the bottom of the list Ports (COM & LPT)
  • Search USB-SERIAL CH340

Ports série

Debug a sketch

The most effective way to communicate with our arduino with a computer is serial.

This protocol, will allow you to receive and send text (this will allow us to know what’s going on our Arduino and give him orders).

To talk to our Arduino , we can use the serial monitor.

  • Click on Serial Monitor


  • Check the speed is the same as the one on the sketch (here 9600 bauds)


  • You should see “Hello World” , which means we are able to receive messages from our Arduino
TX/RX led will turn on each times a message is sent/received

Copy library

In our example, we didn’t need library, but most sketchs will need them.
Libraries adds functionalities to Arduino software to manages a lot more components.
You can download library directly inside Arduino software, (Sketch, include library,  manages library), but a lot of libraries are unavailable.

Most of the times, libraries are available with sketches.
You just need to copy them inside the sketch folder, inside a libraries folder (It doesn’t exists, you need to create it)
But sometimes you will need to find the libraries by yourself.

Every sketches available on madnerd.org, contains (at least) two folders.

  • Sketch folder
  • Libraries folder

Copy these two folders inside your sketch folder.

Comments are closed.