Warnings
Regarding the safety aspects, since the projects are based on a very low voltage power supply supplied by the USB port of the PC or by backup batteries or power supplies with a maximum of 9V output, there are no particular risks of an electrical nature. It is however necessary to specify that any short circuits caused during the exercise could cause damage to the PC, to the furnishings and in extreme cases even to burns, for this reason every time a circuit is assembled, or modifications are made on it, it will be necessary to do it in power failure and at the end of the exercise it will be necessary to disconnect the circuit by removing both the USB cable for connection to the PC and any batteries from the appropriate compartments or external power connectors. Furthermore, again for safety reasons, it is strongly recommended to carry out the projects on insulating and heat resistant mats that can be purchased in any electronics store or even on specialized websites.
At the end of the exercises it is advisable to wash your hands, as the electronic components could have processing residues that could cause damage if swallowed or if in contact with eyes, mouth, skin, etc. Although the individual projects have been tested and safe, those who decide to follow what is reported in this document assume full responsibility for what could happen in the execution of the exercises provided for in it. For younger children and / or for their first experiences in the field of electronics, it is advisable to perform the exercises with the help and in the presence of an adult.
Copyright Notice
All trademarks shown belong to their legitimate owners; third party trademarks, product names, trade names, corporate names and companies mentioned may be trademarks of their respective owners or registered trademarks of other companies and have been used for explanatory purposes only and for the benefit of the owner, without any purpose of infringement. of the Copyright rights in force. What is reported in this document is the property of Roberto Francavilla, Italian and European copyright laws are applicable to it – any texts taken from other sources are also protected by copyright and property of their respective owners . All information and contents (texts, graphics and images, etc.) shown are, to the best of my knowledge, in the public domain. If, unintentionally, material subject to copyright or in violation of the law has been published, please notify us by email to info@bemaker.org and I will promptly remove it.
Roberto Francavilla
Introduction
With this new course we are addressing one of the most debated topics among scientists and philosophers of recent decades: Artificial Intelligence.
Obviously, for us who do robotics, this discipline must be, together with many others, the basis of our studies.
First of all, let’s try to understand in a simple way what Artificial Intelligence is and to do this, let’s first refer to what is written on Wikipedia:

«Artificial intelligence (or AI, from the initials of the two words, in Italian or in English AI) is a discipline belonging to computer science that studies the theoretical foundations, methodologies and techniques that allow the design of hardware systems and systems of software programs capable of providing the computer with performances that, to a common observer, would seem to be exclusively pertinent to human intelligence.»
On this definition I would like to dwell on two concepts that I consider important that you understand well:
- Artificial Intelligence is a computer science discipline (that is, what we call CODING)
- “provide the computer with performances that, to a common observer, would seem to be exclusively pertinent to human intelligence“ …. [Editor’s note: This part of the definition is complex to explain, especially to you young people who are practically already immersed in AI unconsciously. I’ll try the same…]
To better explain the concept expressed in the second point, I give you an example: online translations.
A few decades ago, when I started my computer science studies, translations consisted of memorizing the vocabulary of the language concerned and then thanks to the cycles of “if” and “else” the text that was inserted in the module to be translated was translated, word for word. Obviously this way of translating you know very well that it was not very correct, indeed it was more the times that he was wrong than those that the right answer was right. Today, any machine translator , like Google’s, uses AI. In fact, processing is not only a search for the word of the vocabulary, but it is also a search for the concept that you want to express and you know well, especially for you who speak well, for example English, that there are many “idioms” that differ from simple word-by-word translation. New translation processes and algorithms are increasingly able to “guess” in translation the concept you want to translate. [Editor’s note: I use the term “guessing”, because in AI there is also Machine Learning, but we will talk more about this later]. So, returning to the definition, if I were the “common observer”, the translation of a text carried out, without my knowledge, by a computer, is so similar to what a person would do that I, if it were subjected to judgment, I would confuse him … that is, for me the translation would have been carried out by a person … when this condition is created then the action carried out is of an Artificial Intelligence.
I hope I was clear in the explanation, in case I did not succeed, do not worry, as I always say in these cases … go ahead that you will surely understand better later, with other examples and other explanations …
We prepare our AI Laboratory
For the discovery together of this new fantastic world of Artificial Intelligence, we will refer to the Arduino open source platform and in particular we will use the development board called Arduino Nano 33 BLE Sense

This development board is sold individually, but also as a kit, the kit is called “Arduino Tiny Machine Learning KIT” of which I suggest the purchase.
I reviewed both the kit and the single board and the review you can find it by clicking on this link: review Arduino Nano 33 BLE Sense & Tiny ML KIT

The kit, shown in the image above, consists of:
- Arduino nano 33 BLE Sense board with soldered PINs
- Modulo Camera (OV7675)
- Expansion Arduino shield
- 1 m USB – Micro USB connection cable (I purchased, separately, a 3 m… more convenient to be able to make the movements that interest us in the various projects)
- Plastic container box
This new development board that we will use is a little gem of technology that the fantastic guys of the Arduino Team have developed for us, humble mortals, to allow us to study Artificial Intelligence.
In fact, in addition to being fully compatible with the Arduino IDE development environment, which we now know well, it has many important features … let’s see what are its main features that we will obviously try in the various projects we will realize:
- The size of the board is really small, so much so that it is classified as a “wearable” card, already the adjective clearly qualifies the possibility of using this development board.
- It has a 9-axis inertial sensor, that is, it is capable of recording any movement of the object on which the board is placed.
- It has a humidity and temperature sensor to be able to accurately measure the environmental conditions in which it is located
- It has a barometric sensor that indicates the ambient pressure to which it is subjected
- It has a microphone to capture and analyze sound even in real time
- It has a gesture-sensitive and proximity sensor, as well as detects light color and light intensity. This sensor is capable of “feeling” if someone is approaching!
That is, in essence, already alone the development board is an assembly of ready-to-use sensors for all those projects that will make us discover the world of Artificial Intelligence and it will not be necessary to buy others except for specific projects.

Other equally important features:
- The Nano 33 BLE Sense is powered via 5V micro USB, but the voltage at its PINs is 3.3V. Which means you should never apply more than 3.3 V to its digital and analog pins, otherwise you risk damaging the board.
- It has Bluetooth connectivity in the BLE version, that is, low power consumption
- The maximum current at THE PINs is 10 mA
- Number of digital PINs: 14 of which PWM 5 and Analog PIN No.: 8

The diagram above is what is called PIN-out of the development board and describes the architecture of our board.
Installation and Configuration of the Arduino Nano 33 BLE Sense

Let’s start with the installation of the board drivers in the IDE so that the Arduino development environment recognizes the new connected board, to do this click twice on the Arduino application icon on the Desktop:

opens the IDE window. At this point, if an empty sketch does not appear, go and click on “New” and you will see an empty IDE window and close the previous one.

At this point go to Tools -> Board “Arduino Uno” -> Board Manager …

A new window opens, Tab Manager

In the research bar write Nano 33 BLE

Installed: Arduino Mbed OS Nano Boards…

It will ask you to install the driver and then the device (twice):

Always click on “Install”.
At the end of the procedure, the window with the library of new tabs installed will appear.

Now we have to install the sensor libraries on the board.
First we install the library: APDS9960 – of the Colore Sensor
Always go to the IDE and then click on Tools -> Library Manager

The window will appear:

At this point in the search bar type APDS9960

Click on install on the Arduino_ library APDS9960

And the library will be installed

We repeat the same procedure for the HTS221 Library – of the Temperatura and Umidity Sensor:

The same thing for the LPS22HB Library – Barometer Sensor

Again, we continue and install the LSM9DS1 Library – of the IMU Sensor (accelerometer, gyroscope, magnetometer):

Finally the Library: Adafruit PDM – Microphone, by clicking on

After the installation phase of the card driver and the libraries of the various sensors, the first thing to do is the configuration of the IDE to allow the recognition of the new board and then, after connecting the Nano BLE Sense to the PC through the appropriate USB cable, you must select the correct board in the Arduino IDE:
Go to Tools -> Boards -> Arduino Mbed Nano Board -> Arduino Nano BLE

How to upload the sketch and how to run it on the Nano BLE Sense
To load the sketch, after connecting the Nano BLE Sense to the PC and checking that the correct card is set on the IDE, click twice quickly on the white button, so it turns on in addition to the green LED indicating the power supply, also a Flashing orange LED indicating that the board is ready for the upload process:

At this point it is necessary to check that the board is connected to the correct COM port:

Go to Tools -> Port:… -> COM… Arduino Nano 33 BLE
Selected the port to which the board is connected, to load the sketch click on the classic arrow ” -> “.
Wait a few minutes for the sketch to be compiled and uploaded and once finished, the card will automatically disconnect from the “upload” mode. In this phase, the IDE changes the COM port of the board which is connected to a COM port other than the upload one, therefore, for the execution of the sketch, it is necessary to check again that the board is connected to the correct COM port .
Always remember that the COM port for uploading the board is different from the COM port for executing the loaded program, especially when it is necessary to keep the board connected to the PC, for example to read data from the serial monitor.
Once the correct COM port has been selected, our Nano BLE Sense is already running the sketch loaded previously.
If you found the lesson interesting, make a donation you will help me realize many others.
