Getting Started With Arduino IoT Cloud for Arduino Nano 33 IoT

by shreyas.sj in Circuits > Arduino

3419 Views, 8 Favorites, 0 Comments

Getting Started With Arduino IoT Cloud for Arduino Nano 33 IoT

project2.jpg

Want to get into IoT and prefer Arduino for it? We learn how to that here. We will understand how to integrate Arduino IoT Cloud with Arduino Nano IoT 33 board now.

Let's make a simple project of LED Dimmer or LED Brightness control.

Supplies

  1. Arduino Nano 33 IoT development board
  2. Micro USB cable
  3. LED (Any colour of your choice)
  4. Resistor (220 ohms or a small value resistor)

Starting With Arduino IoT Cloud

Screenshot_20210525-201945_Drive.jpg

Start Arduino IoT Cloud on a web browser and login to Arduino using a mail id and password. We can login using our google id as well. The Arduino IoT Cloud platform provides a set of basic IoT tools at no cost. So an IoT enthusiast can develop projects using this platform!!

The platform supports the Arduino WiFi based development boards for its basic free pack. All of the MKR family boards, Nano 33 IoT and Portenta H7 boards can be connected to the cloud. We use the Arduino Nano 33 IoT in this project.

Configuring IoT Board

Screenshot_20210525-205010_Drive.jpg
Screenshot_20210525-205025_Drive.jpg
Screenshot_20210525-210001_Drive.jpg

Once we login into the platform we see four sections at the top. First we will get into the Device section.

Clicking on the Add device button a pop-up appears. We select 'Set an Arduino device' option as our device is an Arduino board. The platform starts to detect the board. The board is not detected if Arduino Create Agent is not installed in the computer.

Hence we need to download and install the Arduino Create Agent firstly. Then once again the we repeat the process with Arduino Create Agent installed in the computer. This time with the help of Arduino Create Agent the board is detected successfully!!

We can give our device any desired name and add the device to the cloud platform. Thus, we now have configured our device with Arduino IoT Cloud!!

Creating a Thing

Screenshot_20210525-202004_Drive.jpg
Screenshot_20210525-202113_Drive.jpg
Screenshot_20210525-202447_Drive.jpg
Screenshot_20210525-202511_Drive.jpg

A 'Thing' is an important part of the cloud which deals with variables, code sketches and serial monitor.

After configuring the device we create a new thing for our LED Dimmer project. We name the thing as 'LED Dimmer' and then click on 'add variable'. We give the variable a name. Define its data type from the available data types, choose permission as read-write or read-only, update method and Threshold value of that variable if required. And then save the variable.

Associating IoT Device and Adding Network Credentials

Screenshot_20210525-210248_Drive.jpg
Screenshot_20210525-210819_Drive.jpg
Network2.jpg
Network.jpg

To attach the device with the thing we just created, we click on 'Device' button on the right of the variable. Then we see our configured device in a pop up window with an 'Associate' button. Clicking on 'Associate' we will now be able to use the variable 'dimmer' in our Arduino code.

Then we put our network credentials in the below section which are used by our device to connect to the cloud/internet.

Editing the Arduino Sketch With Arduino Web Editor

Screenshot_20210525-203536_Drive.jpg
INT12.jpg
Screenshot_20210525-202750_Drive.jpg

As we set up the variable of specific type, device and network credentials an Arduino sketch with all required libraries for our device, our variable 'dimmer' and the network credentials in the 'secret.h' file is generated in the background.

For every updating value of the variable some action has to be performed for which a function is automatically generated. We can edit this function and the rest of the sketch using the Arduino Web Editor. We make necessary changes in the sketch like defining GPIO (PWM) pin number 12 and putting the 'analogWrite' function for led brightness control with respect to variable 'dimmer'.

A .zip file of the code can be downloaded from the Web Editor now. We can also upload the code directly to the Arduino Nano 33 IoT board by updating the Nina firmware of the board.

Once the code is uploaded to the Nano 33 IoT, the board will be connected to the internet but brightness control cannot happen. For that we need to setup our Arduino IoT Cloud dashboard and make the circuit connections ahead.

Dashboard for the Project

Screenshot_20210525-203813_Drive.jpg
Screenshot_20210525-204055_Drive.jpg
Screenshot_20210525-204106_Drive.jpg

Now we are ready to make our dashboard. For this purpose we first go into the 'Dashboard' section and then click onto 'Add dashboard'. An untitled dashboard is created now. We then give the dashboard a suitable name as 'LED Dimmer'.

After that we need a widget for control purpose. For that we enter the edit mode and then click on 'Add'. From the list of the widgets we choose the 'Slider' widget for this project so that we can vary the value from one to another.

Setting Up the Dashboard Widget

Screenshot_20210525-204137_Drive.jpg
Screenshot_20210525-204357_Drive.jpg
Screenshot_20210525-204439_Drive.jpg
Screenshot_20210525-204928_Drive.jpg

We need to setup the selected Slider widget now. We enter a title for the widget as 'Brightness'.

Then we link this slider to LED Dimmer(Thing) and 'dimmer'(variable) by clicking on 'Link variable' button and selecting our thing and variable. Once we check if the correct variable is linked we can click on 'Link variable' and the variable is now linked to our slider widget.

Afterwards we decide the orientation of the slider as 'Horizontal'. Then we set the minimum and maximum values as 0 and 255 respectively. The values are so taken as we can use the PWM facility of Arduino Nano 33 IoT for LED brightness control.

Making the Connections

pinout.jpg
Circuit.jpg

Now it's time to make the hardware connections. It is a basic connection of resistor, LED with the Arduino Nano 33 IoT. The pin used for this project is the PWM pin D12. So we connect LED anode to this pin through a resistor and connect the LED cathode to the ground.

Testing Our First IoT Project

20210526_153842.jpg
20210526_154406.jpg
20210526_154158.jpg

Once complete Arduino IoT Cloud setup and circuit connections are done we can boot the Arduino Nano 33 IoT through the computer USB port or a 5V Micro USB charger.

Then we can check the fine working by moving the Slider on our Arduino IoT Cloud dashboard or the Arduino IoT Cloud mobile application.

As we move the slider towards higher values the LED becomes brighter. While as we move the slider towards 0 it becomes dimmer.

Thus we have successfully developed our first Arduino IoT Cloud based project using the Arduino Nano 33 IoT!!

Hope you made it till here and find this tutorial useful. If not then you watch the video in the next step. Thank you and happy learning!!

Watch the Video

Getting started with Arduino IoT Cloud using Arduino Nano 33 IoT