Getting started with arduino
"Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects."
What can I do with an arduino?
The main website of arduino has a lot of resources you can learn from goto the search page and search for anything you would like to know more about. For example you could search for "led" or "sound".
The makers of the arduino platform also created a great starter kit with some example projects to get started. There is no need to purchase this yourself as we have two of these in the MDD librarary you could just grab and use, as well as (most of) the "things" you need to do these projects. However, if you would like to spend a bit more time into developing this skill it is highly recoomended to purchase this starter kit.
Once you know the basics you can have a look at some of our prepared Arduino examples
Working with a simulated arduino
In order to experiment without the need of the electrical parts being wired already you can use https://wokwi.com/.
If you are not sure how to wire something https://www.circuito.io/ is a great resource which shows you how to wire various parts. It also provides you with generated code based on your components.
⚠️ Be aware that the generated code does not always work perfectly, some coding/debugging skills still come in handy over here
The MDD preferred arduino board
At the MDD we prefer using the Adafruit HUZZAH32 micocontroller. There are other boards out there which you can use but we do not support them and you are on your own (as we also probably need to google for stuff).
Setting up the ESP32 Featherboard
In order to use this device you need to perform these steps or follow the TLDR below
- On your arduino IDE goto
Arduino
>preferences
>Additional Boards Manager URLs
and add the following URL- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- On your arduino IDE goto
Tools
>Boad
>Boardsmanager
and install- esp32 by espressiff
- Select the correct board via
Tool
>Board
>ESP32 Arduino
>Adafruit ESP32 Feather
Verifying you can upload code to the arduino
To check if we can upload any code to the arduino we can use a simple example sketch provided by the Arduino IDE
- After you have downloaded the Arduino IDE you can open an example code via
File
>Examples
>01. Basics
>Blink
- After you have connected your arduino to your machine select the correct port via
Tools
>Port
> ARDUINO PORT. An easy trick to know the port is to unplug your arduino, look which port is missing, plug it back in and select the added port.- For MacOs users the ARDUINO PORT looks something like
/dev/cu.usbserial-{gibberish}
- For Windows users the ARDUINO PORT looks something like
COM{number}
- For MacOs users the ARDUINO PORT looks something like
- When you have selected the arduino at the correct port you can press the upload button (➡️).
After your Arduino IDE has the text "Done uploading" at the bottom of your screen you should see a red LED light blink on and off every second.
Now try and change the delay(1000);
to delay(500);
, upload again and see what happens
⚠️ If your machine does not show any arduino on a port, you are unable to select a port or the uploading to the arduino fails have a look over here. If this does not solve your issue, you probably need to download and install this driver
Communication over the internet
An arduino can be a great tool to create interactive things or things that need to communicate over longer distances.
Have a look at IoT boilerplate to see how you could make arduinos communicate over the internet.
Have a look at Iot network to see how you could connect your device to our IoT network.
ℹ️ If you use a connected device which uses the esp8266 wifi-chip (another device than the preferred MDD adruino) you also need to:
- On your arduino IDE goto
Arduino
>preferences
>Additional Boards Manager URLs
and add the following URL- https://arduino.esp8266.com/stable/package_esp8266com_index.json
- On your arduino IDE goto
Tools
>Boad
>Boardsmanager
and install- esp8266 by ESP8266 community
Adding the package to communicate over MQTT
Follow the instruction on https://pubsubclient.knolleary.net/ to download the client