Tag Archives | nano

Arduino Clone Bootloader Setup & Programming

Arduino modules (in this case an Arduino Nano 3.0) may come from China without the hardware initialized with a suitable bootloader. Necessary for project work and programming, a bootloader configuration is necessary for an Arduino to connect to a local host computer and its Arduino Sketch IDE. To install a bootloader into the clone Arduino, it is necessary to connect it to a known functional Arduino unit (in this example another Nano) and configure the functional Arduino to set up and configure the bootloader code for the target Arduino clone.

Side by side are the source and target Arduino units to set up and configure the bootloader at the target device (the black Arduino Nano).

Once the bootloader set up and programming is successful, the clone Arduino is prepared for standard project work and programming as desired.

A host computer connects to the source Arduino Nano via USB-Mini male to USB-A male. From there, the source Arduino Nano serves as a host for the target Arduino clone. Bootloader code that resides in the source is transferred to the clone with the connections made and the burn utility within the Arduino IDE.

Programming Method

Step 1 | Configure IDE and Load Arduino ISP

  1. Connect functional Arduino to the USB port on your computer. A USB-Mini male to USB-A male cable is necessary to make this connection. No USB connection is made to the clone Arduino.
  2. Open the Arduino IDE software.
  3. Select the correct COM port available from the Arduino menu (Tools > Port > Serial ports). Choose one COM port such as COM1, COM3, COM5, etc.
  4. Select the correct Arduino board from the Boards Manager menu option (Tools > Board: Arduino Nano (in this example).
  5. Open Arduino ISP to functional Arduino connected to the host computer via USB mini (Nano) to USB-A (computer). To open the Arduino ISP file select the correct example file (File > Examples > Arduino ISP). Once selected, the Arduino ISP code should open within the Arduino IDE as a Sketch.
  6. Upload the Arduino ISP code to the functional Arduino (Nano in this case).
  7. Unplug the functional Arduino USB cable and complete the six connections to the clone Arduino as described in step 2 below.

If the Arduino ISP code is needed separately (step 5 above), see the download button/link below.

Step 2 | Connect Arduinos

  1. Connect pin 1 on Arduino clone to D12 of functional Arduino.
  2. Connect pin 2 on Arduino clone to 5V of functional Arduino.
  3. Connect pin 3 on Arduino clone to D13 of functional Arduino.
  4. Connect pin 4 on Arduino clone to D11 of functional Arduino.
  5. Connect pin 5 on Arduino clone to D10 of functional Arduino.
  6. Connect pin 6 on Arduino clone to GND of functional Arduino.

Wiring Schematic

This diagram illustrates how to connect both a functional and clone Arduino together for bootloader programming to the clone. Important: connections D10 – D13 (digital pins 10-13 of the functional Arduino) are the connections to the clone Arduino. For example, do not connect reset or RST of the functional Arduino to the RST of the clone Arduino. Instead, connect D10 of the functional Arduino to pin 5 of the clone Arduino.

Schematic diagram of source and target Arduino units for bootloader upload to a clone Arduino.

Proceed to step 3 below once all connections are made as described in step 2 above, or as illustrated in the wiring schematic above.

Step 3 | Code Load Bootloader

  1. Connect the USB cable to the functional Arduino again for power and programming. This is the same connection made earlier when the Arduino ISP was uploaded to the Arduino unit.
  2. Confirm the correct COM port is selected (Tools > Port > Serial ports). Choose one COM port such as COM1, COM3, COM5, etc.
  3. Select the correct Arduino board from the Boards Manager menu option (Tools > Board: “Arduino Nano” (in this example)).
  4. Select the correct processor from the menu (Tools > Processor > ATmega328P).
  5. Select the correct Arduino programmer from the menu (Tools > Programmer: “Arduino as ISP”)
  6. Select from the Arduino menu the bootloader utility (Tools > Burn Bootloader) to program the target clone Arduino with the bootloader file. Confirm from the Arduino IDE that the upload is completed (observe the “Done” message at the lower IDE window pane). The LEDs on both Arduino units flash during the bootloader programming and stop once the process is done.
Arduino Sketch IDE menu tools for bootloader setup and transfer.

Hardware Demonstration of Bootloader Transfer

This brief video demonstrates the LED activity before, during, and after the bootloader programming. The Arduino Nano on the left is the source and the Arduino Nano clone on the right is the target.


Portable Temperature & Humidity Monitor System

The purpose of this build is to become more familiar with how to develop a free-standing Arduino system using the Arduino Nano. The Nano is a smaller equivalent to the Arduino Uno, but with fewer interface options. It obviously occupies less space since it is a smaller footprint while having reduced overall dimensions. The project makes use of a DHT temperature and humidity sensor that interfaces with the Nano and it includes a 16×2 LCD display to indicate measurement results.

As temperature and humidity variations appear within the immediate environment, there are readings at the sensor read into the Arduino Nano. The system is configured and programmed to accept those readings and report them to the liquid crystal display. The ambient conditions surrounding the sensor are processed within the Nano to translate sensor data into usable information at the display.
The system is powered by a 9V battery stepped down to a regulated 5VDC supply. The power module supports the Nano, DHT sensor, and LCD display. The power supply module’s detachability renders the Nano accessible for ease programming and alternative power through the Nano’s USB receptacle. This setup removes any permanent tethering with extended life through a power supply module’s USB-A receptacle if a power bank is used instead. The 10K-ohm potentiometer is a brightness control for the LCD display.

The system schematic makes no use of passive components except for the single variable resistor (10K-ohm potentiometer). The direct connections between the Nano and display provide for desired simplicity during build and diagnostics. The DHT11 sensor pin-out provides for clarity about necessary connections at the Nano.

1602A LCD Display Pinout

PinSymbolFunction
1VSSGround
2VDD+5VDC
3V0Contrast
4RSRegister
5R/WRead/Write
6EEnable
7D0Data
8D1Data
9D2Data
10D3Data
11D4Data
12D5Data
13D6Data
14D7Data
15AAnode (+5VDC)
16KCathode (Ground)

Arduino Setup:

To program, edit, or update the firmware within the Arduino Nano, it is necessary to attach a USB connection from computer. The serial connection is made to update settings, configure the Arduino IDE (Sketch)
The conventional structured programming setup applies to this project as with any other. The top of the program specifies libraries to support physical objects or devices in the project such as the DHT sensor and the LCD display in this case. Above the void set up procedure block, relevant variables are declared by data type (integer, float, etc). The void setup initiates devices, Arduino functions, or GPIO pins. The loop functions are the procedure itself that iterates to execute the main process by which the program operates.
To set up and program the Nano, it is necessary to select it under the Board option from the Tool menu. The Port option within the Tools menu may require selection or setup as COM1 – COM5 (or some COM#) to establish a connection to a computer for programming and to run the Serial Monitor under this same Tools menu selection.
To install relevant external device libraries (such as a temperature sensor, or display), it might be necessary to add the device to the Arduino Sketch folder on its host computer (usually C:\Users\[name]\Documents\Arduino\libraries).
An example to install or update a device library from the Manage Libraries selection of the Tools Menu option, provides a dialog box to search by library name or description. In this example, “DHT” is keyed in to find the temp & humidity sensor for installation.
Once the Arduino Sketch IDE is set up and configured with the correct board, serial COM connection, and relevant libraries, the code becomes operable and the serial monitor confirms proper use and setup (if/as applicable).

Code Setup:

#include <DHT.h>
#include <LiquidCrystal.h>
int rs=7;
int en=8;
int d4=9;
int d5=10;
int d6=11;
int d7=12;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);

int sensePin=2;
DHT HT(sensePin,Type);
float humidity;
float tempC;
float tempF;
int setTime=500;
int dt=1000;

void setup() {
Serial.begin(9600);
HT.begin();
delay(setTime);
lcd.begin(16,2);
}

void loop() {
humidity=HT.readHumidity();
tempC=HT.readTemperature();
tempF=HT.readTemperature(true);

lcd.setCursor(0,0);
lcd.print(“Temp F= “);
lcd.print(tempF);
lcd.setCursor(0,1);
lcd.print(“Humidity= “);
lcd.print(humidity);
lcd.print(“%”);
delay(500);
lcd.clear();

Serial.print(“Humidity: “);
Serial.print(humidity);
Serial.print(” Temperature: “);
Serial.print(tempC);
Serial.print(“C “);
Serial.print(tempF);
Serial.println(“F “);
}