Setting up Development Environment for Arduino Nano 33 Iot

Arduino Nano 33 IoT is an internet of things (IoT) solution to perform sensing and actuating on physical environment. The Arduino Nano 33 IoT board comes with WiFi and BLE modules that enable communication with other entities for exchanging data. Here will explore how to set up the Arduino Nano 33 IoT board for development.

  • Reviewing Arduino Nano 33 IoT board
  • Setting up development environment
  • Building LED blinking program
  • Applying Arduino web editor

Introduction

Arduino Nano 33 IoT is one of IoT platforms from Arduino. This board uses WiFi and Bluetooth modules to connect to a network. WiFi is a common network that people use to access Internet. Bluetooth is a part of wireless personal network (WPAN) that enables communication with other devices within a short distance. Arduino Nano 33 IoT board is designed for low-cost IoT devices to address your IoT problems. Arduino Nano 33 IoT has a small-size factor, 45 x 18 mm (length x width). You can see my Arduino Nano 33 IoT board in Figure

Arduino Nano 33 Iot
Arduino Nano 33 IoT board

Review Arduino Nano 33 IoT Board

Arduino Nano 33 IoT is built from ARM Cortex M0 32-bit SAMD21. The board also has a radio module, NINA-W102, from u-blox. This module is designed for data communication over WiFi and Bluetooth. You can read a detailed specification of Arduino Nano 33 IoT on Table 1-1.
Since Arduino Nano 33 IoT has some digital and analog I/O, we extend the board capabilities by wiring with other sensors or actuators. We also use universal asynchronous receiver/transmitter (UART), serial peripheral interfact (SPI), and interintergrated circuit (I2C) protocols to communicate with other devices.

Table 1-1. A Specification of Arduino Nano 33 IoT

Features Notes
Microcontroller SAMD21 Cortex-M0+ 32-bit
Radio module u-blox NINA-W102
Secure module ATE CC608A
Operating voltage 3.3V
Input voltage 21V
DC current per I/O pin (limit) 7 mA
Clock speed 48 Mhz
CPU flash memory 256 KB
SRAM 32 KB
EEPROM None
Digital I/O 14
PWM pins 11 (2, 3, 5, 6, 9, 10, 11, 12, 16 / A2,
17 / A3, 19 / A5)
UART 1
SPI 1
I2C 1
Analog Input 8 (ADC 8/10/12 bit)
Analog Output 1 (DAC 10 bit)
LED_BUILTIN 13
USB Native in the SAMD21 processor
IMU LSM6DS3
Size (Length x Width) 45 mm x 18 mm

Key: CPU, central processing unit; SRAM, static random-access memory; EEPROM, electrically erasable programmable read-only memory; PWM, pulse width modulation; UART, universal asynchronous receiver/transmitter; SPI, serial peripheral interfact; I2C, interintergrated circuit; USB, universal serial bus; IMU, inertial measurement unit.

Set Up Development Environment

Arduino provides software to build programs for all Arduino board models.
We can use Arduino software. You can download Arduino software on the following link: https://www.arduino.cc/en/Main/Software. This software is available for Windows, Linux, and macOS.

The installation process steps are easy. Just follow the installation guideline from Arduino setup. After finished installation, you will see the Arduino application menu on main menu from your OS platform.
Open the Arduino application. Then, we will obtain the Arduino application as shown in Figure

Arduino software for Windows
Arduino software for Windows

You will see skeleton codes on the application dialog. The following is a code template.
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
We can see that the Arduino program adopts C/C++ program language dialects. We can put all data initialization on the setup() function. The program will execute codes inside the loop() function continuously.

To work with the Arduino Nano 33 IoT board, we need to configure Arduino software. First, we add Arduino SAMD Boards so the Arduino software will recognize our Arduino Nano 33 IoT board. You can open a menu on Arduino software by clicking the menu Tools ➤ Board ... ➤
Boards Manager…
After clicking the Board Manager menu, we will obtain the Boards
Manager dialog, as shown in Figure

Adding supported boards for Arduino Nano 33 IoT
Adding supported boards for Arduino Nano 33 IoT

Select All on the Type menu from
Boards Manager. Then, type arduino&NANO&33&IoT in the textbox. You will see Arduino SAMD Boards. Click and install this package. Make sure your computer is connected to an Internet network.

This installation takes several minutes to complete. After completed installation, you can see the Arduino Nano 33 IoT board on the targeted board. You can verify it by clicking the menu Tools ➤ Board ... ➤ Boards Manager… on Arduino software. You will see your board list.

A list of targeted boards for Arduino
A list of targeted boards for Arduino

Figure shows Arduino Nano 33 IoT on Arduino software

Now you attach Arduino Nano 33 IoT to a computer via micro USB cable. After attached, you can verify your board using Device Manager for Windows. Figure shows my Arduino Nano 33 IoT on Windows

Detected Arduino Nano 33 IoT on Device Manager
Detected Arduino Nano 33 IoT on Device Manager

If you are working on Linux, you can verify the Arduino Nano 33 IoT using this command on the terminal.

$ ls /dev/ttyUSB*

You will see a list of attached devices over USB. Arduino Nano 33 IoT usually is detected as /dev/ttyUSB0 or /dev/ttyUSB1. For macOS, you can type this command to check Arduino Nano 33 IoT.

$ ls /dev/cu*
You should see the USB device on your terminal

Hello Arduino Nao 33 IoT: Blinking LED

We first build a Arduino program. The Arduino Nano 33 IoT board has a built-in LED that is attached on digital pin 13. In this section, we build a simple blinking LED. Now you can connect Arduino Nano 33 IoT into a computer. Then, we can start to write the Arduino program. You can open Arduino software. We create a program from the project template. You can click menu and then File ➤ Examples ➤ 01.Basics ➤ Blink. After clicked, you will obtain program codes as shown in Figure.

Blink application on Arduino software

This is a program sample from Arduino. You can see the program codes are written as follows.
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second
}
Save this program. Now we can compile and upload the Arduino program into Arduino Nano 33 IoT. You can click the Verify icon to compile the Arduino program. To upload the Arduino program into the board, click the Upload icon on Arduino software. You can see these icons in Figure

Compiling and flashing a program
Compiling and flashing a program

After uploading the Arduino program into Arduino Nano 33 IoT, we will see blinking LED on the Arduino Nano 33 IoT board. You can see blinking LED in Figure

Blinking LED on Arduino Nano 33 IoT
Blinking LED on Arduino Nano 33 IoT

Arduino Nano 33 IoT board has one built-in LED on digital pin 13. In our program, we set digital pin 13 as digital output using pinMode(). We initialize this data on the setup() function.

void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

The Arduino program defines LED_BUILTIN for a general of built-in LED pin. We can set the pin as output mode by giving a value, OUTPUT.

Now our program will run continuously on the loop() function. We turn on LED and then turn off the LED. We can use digitalWrite() to perform on/off on the LED. Set the value to HIGH to turn on the LED. Otherwise, we can turn off the LED by sending a value of LOW on the digitalWrite() function. We also set a delay for turning the LED on/off. We set 1000 ms on the delay() function.

void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second
}

You can practice the blinking LED program. Next, we can use the Arduino web editor for alternative tools for Arduino development. We just need a browser and Internet access.

Arduino Web Editor

Arduino provides an online editor to build Arduino programs. The advantage of online editor is that we don’t prepare too many runtimes and tools. We only need a browser and Internet connection.

We can access the Arduino web editor using any browser. You can navigate to the link https://create.arduino.cc/editor.

Arduino web editor
Arduino web editor

Figure  shows the Arduino web editor model. To use Arduino web editor, we must register in the Arduino portal to build the Arduino program.

In this section, we will focus on getting started with Arduino web editor. We will perform these tasks to complete our Arduino development with online web editor:

  • Register your Arduino portal account
  • Install Arduino plug-in
  • Build blink application for Arduino Nano 33 IoT

Registering an Arduino Account

To use and build the Arduino program with Arduino web editor, we must register an Arduino account. This account is a similar account to that used to buy the Arduino board in the Arduino store. You can register a new Arduino account on the right-top menu icon. You can fill personal information through this portal. After completed account registration, we can build the Arduino program with Arduino web editor.

Installing Arduino Plug-in

To enable our Arduino Nano 33 IoT to connect to Arduino web editor, we need to install the Arduino plug-in. This is a required task for Windows. The Arduino plug-in will act as a bridge between local Arduino Nano 33 IoT and the Arduino web editor.

First, we open a browser and navigate to the link https://create.arduino.cc/getting-started/plugin/welcome. Then, we have a form, as shown in Figure

Arduino plug-in installation
Arduino plug-in installation

Click the START button. After that, you will see a form, as shown in Figure. Click the DOWNLOAD button to download the Arduino plug-in application.

Download the Arduino plug-in for Windows
Download the Arduino plug-in for Windows

After downloading the Arduino plug-in, we can install this application.Follow the installation steps from the setup file. If we finished the Arduino plug-in installation, the browser will detect our Arduino plug-in. Figure shows the browser detecting the Arduino plug-in. Click the NEXT button to continue.

Detecting the Arduino plug-in
Detecting the Arduino plug-in

After we click the NEXT button, we receive confirmation of the completed installation, as shown in Figure

Completed Arduino plug-in installation
Completed Arduino plug-in installation

You can click the GO TO WEB EDITORS button to continue. You will be directed to the Arduino web editor.
Now we are ready for Arduino development using the Arduino web editor. Next, we will build a blink Arduino application.

Building an Arduino Program

The Arduino web editor has the same functionalities as the desktop version ofArduino software. The Arduino web editor has project samples. We also can add Arduino libraries into the project.
In this section, we build a blink Arduino application like in the previous project. We start by opening a browser and navigating to https://create.arduino.cc/editor. Click the Examples menu on the left menus. Then, click the BUILTIN tab and select 01.BASICS(6) -> Blink. You can see Figure

Create a new project
Create a new project

for our Arduino project.
After we select the Blink project sample, we have a blink program. Youcan see this program in Figure

Uploading a program into Arduino Nano 33 IoT
Uploading a program into Arduino Nano 33 IoT

Now we can compile and upload the program into Arduino Nano 33 IoT. Select your Arduino Nano 33 IoT board from the dropdown of the device list. Click the Verify and Upload icon on the left of dropdown. This tool will compile and upload the Arduino program into the targeted board.

We can try to build another Arduino project using the Arduino web editor. We can use project samples from this tool.

Summary

We have learned to set up an Arduino development environment. We also installed Arduino software on a desktop environment. We built a simple Arduino program, blink. In addition, we tried to use the Arduino web editor to build Arduino programs. Next, we will learn how to access Arduino Nano 33 IoT input/output. We use other communication protocols too.