IoT & Robotics projects with Codes + Circuit Digram
Popular Types of Microcontroller Series and examples
Name | Example |
---|---|
AVRSeries | Atmega328p, Atmega2560 |
RENESAS Microcontroller | RA4M1 |
Espressif Chips | ESP8266, ESP32, ESP32S3, ESP32C6 |
RP2040 | RPi Pico |
STM Microcontroller | STM32F4011CCU, STM8S103F3 |
INTEL Microcontroller | Intel 8051 |
NXP | NXP iMXRT1062 |
NRf | nRF52832 |
PIC Family | PIC16F877A |
Popular Development Boards and SBC
Name | Processor name | Tested |
---|---|---|
Arduino UNO R2 Wifi | ATmega4809 + NINA-W102 | No |
Arduino UNO R3 | Atmega328p | Yes |
Arduino UNO R4 Minima | RA4M1 | No |
Arduino UNO R4 Wifi | RA4M1 + ESP32S3(WiFi) | No |
Arduino Nano Every | Atmega328p(SMD version) | Yes |
Arduino Nano ESP32 | NORA-W106 (ESP32-S3) | No |
Arduino Mega 2650 | Atmega2560 | No |
Arduino Giga R1 Wifi | STM32H747XI | No |
Nodemcu ESP8266 Devkit | ESP8266EX | Yes |
DoIt esp32 devkit-V1 | ESP-Wroom-32 | Yes |
ESP32-CAM | ESP-Wroom-32 | Yes |
ESP32 C3 DevkitC-1 | ESP32-C3-N4R2 | No |
ESP32 S2 DevkitC-1 | ESP32-S2-Solo-N4 | Yes |
ESP32 S3 DevkitC-1 | ESP32-S3-N8R8 | Yes |
ESP32-S3-Pico | ESP32-S3-R2 | Yes |
ESP32 C6 DevkitC-1 | ESP32-S6-N8R8 | No |
Raspberry Pi Pico | RP2040 | Yes |
Raspberry Pi Pico W | RP2040 + CYW43439(wifi) | No |
Raspberry Pi 4B | Broadcom BCM2711 | Yes |
Raspberry Pi 5 | Broadcom BCM2712 | No |
Blackpil STM32 | STM32F401CCU6 | No |
Minimal Component Requirements
- One of the above board(Atleast : Arduino UNO R3)
- USB type A to USB type B Connector Vable
- USB type A to Micro USB Connector Cable
- led(Red,green,blue,RGB)
- jumpers(MtoM and MtoF)
- breadboard
- Register(220ohm,1Kohm,10Kohm)
- capacitor(220 microfarad,47 microfarad)
- Some sensors(DHT11, HC-SR04)
Components (Required : based on project)
Sensors and Modules
- HC-SR04 Ultrasonic distance sensor*
- DHT11 temparature and humidity sensor*
- BISS0001 PIR Motion sensor
- MPU-6050 3-Axis Accelerometer and Gyro Sensor
- TTP223B Capacitive Touch Sensor Module
- LM393 Sound Detection Module
- IR receiver + Remote
- DS3231 RTC Module
- MS5611 Barometer, Temperature & Altimeter Sensor
- BME280-3.3V(I2C & SPI) Barometer, Temperature, Humidity & Altimeter Sensor
- BME280-5V(I2C) Barometer, Temperature, Humidity & Altimeter Sensor (Recommended)
- BME680 Barometer, Temperature, Humidity, Altimeter & Gas Sensor
Camara Module
- ov2640 camera module.
- ov7670 camera module.
- Arducam ov7670 SPI camara module.
Wireless/Communication Modules
- ESP-01 ESP8266 Serial WIFI Module
- HC-05 Bluetooth Module
- Ublox Neo-6M GPS Receiver Module
Displays and LED MOdule
- 16x2 LCD Display
- Single digit 7 segment display
- 0.96inch OLED I2C display
- Color LCD SPI Display
- WS2812 RGB LED MATRIX/RING
- MAX7219 LED Dot Matrix Display
- I2C 8x16 RGB LED Matrix Panel
Motors
- 12V 200 RPM DC Motor
- 28BYJ-48 Unipolar Stepper Motor
- SG90 Servo Motor (180° Rotation)
Motor Drivers and Shields
- L293D IC
- L293D Motor Driver Shield(Arduino UNO/Mega)
- L293D Motor Driver Board for ESP8266 NodeMcu 12E
- L298N motor driver module
- ULN2003 Stepper Motor Driver
- A4988 driver Stepper Motor Driver
Others
- 2N2222 transistor
- 2/4 - channel 5V relay module
Softwere requirements
- Arduino IDE(Latest version)
- Arduino IDE(v1.8.3 if you have arduino nano)
- Thonny(If micropython/circuitpython is used)
- Platform IO
- ESP-IDF
How to get started
Installation of IDEs and Clone repo.
Install the Arduino IDE & Clone this repository
git clone https://github.com/tirtharajsinha/IOT-and-Robotics.git
- Connect the arduino board via USB.
- Open the arduino IDE
- select the board and port number(something like
COM5
) - Now open
LED_BLINK/LED_BLINK.ino
in arduino ide. - Connect the circuit diagram available the .ino code location.
- Open the arduino ide and validate and upload the script.
- If you see led lights up and down periodically then you are good to go. othewise contact a experienced friend. if you friend refuses then your are fucked up, go search on youtube.
Upstream the repository
git reset --hard origin/main
git remote add upstream https://github.com/tirtharajsinha/IOT-and-Robotics.git
git fetch upstream
git checkout main
git merge upstream/main
If anytime you think you messed up with the original repo code then you can consider reset the rerository.
Reset repository
git reset --hard origin/main
Arduino libraries you need to get started
- Adafruit Circuit Playground by Adafruit*
- Servo by Michael Margolis, Arduino
- DHT sersor library by Adafruit*
- Adafruit Unified sensor by Adafruit*
- Firmata by firmata developers
- WiFi by Arduino
- LiquidCrystal by Arduino, Adafruit
- Arduino_JSON by Arduino
Diffrent type arduino boards
Classic family
- Arduino UNO R3
- Arduino Mega 2560 Rev3
- Arduino Leonardo
- Arduino UNO Mini Limited Edition
- Arduino Due
- Arduino Micro
- Arduino Zero
- Arduino UNO WiFi Rev2
Nano family
- Arduino Nano 33 IoT
- Arduino Nano RP2040 Connect
- Arduino Nano 33 BLE Sense
- Arduino Nano 33 BLE
- Arduino Nano Every
- Arduino Nano
MKR family
- Arduino MKR 1000 WiFi
- Arduino MKR WiFi 1010
- Arduino MKR FOX 1200
- Arduino MKR WAN 1300
- Arduino MKR WAN 1310
- Arduino MKR GSM 1400
- Arduino MKR NB 1500
- Arduino MKR Vidor 4000
- Arduino MKR Zero
Portena family(Arduino Pro)
- Portena H7
- Portena X8
- Portena Max Carrier(Carrier for portena)
ESP based boards
As ESP based borads are also available from third-party manufactures like adafruit,unexpectedmaker,wemos,waveshare etc. so listing all boards is almost impossible. This Page lists all esp official espressif products.
Here we are only listing the popular ESP32 SOC series.
- ESP8266
- ESP32
- ESP32 H2
- ESP32 C3
- ESP32 C6
- ESP32 S2
- ESP32 S3
Development Environment and Languages for ESP boards
ESP32 supports multiple development Environment and Languages
- Arduino IDE (C++)
- ESP-IDF (C and C++)
- PlatformIO (C)
- Thonny (MicroPython,CircuitPython)
- nanoFramework(C#)
Raspberry Pi 2040 Based Boards
- Raspberry Pi Pico /W.
- Adafruit Feather RP2040.
- Arduino Nano 2040 Connect.
- Cytron Maker Pi Pico.
- Adafruit QT Py RP2040.
- Seeed XIAO RP2040.
- Pimoroni Tufty 2040.
- Pimoroni Keybow 2040.
- Sparkfun Pro Micro.
- … etc.
Development Environment and Languages for RP2040 based bords
RP2040 based board supports multiple development Environment and Languages
- Arduino IDE (C++)
- PlatformIO (C)
- MicroPython,CircuitPython
- RPi C/C++ SDK
Setup of Development Environmnts
Arduino IDE Setup for Boards
Arduino boards
These board has arduino IDE Support by default.
- Start Arduino IDE
- Plug your board
- Select your board(like: Arduino Uno R3, Arduino Mega, Arduino Nano etc.)
- Select Port (like COM3[for windows], dev/tty0[for linux/OS X] etc.)
- Write Code > Compile code (Tick icon) > Upload Code to board (Upper arrow icon)
ESP Boards
-
Start Arduino and open Preferences window.
-
for your specific boards use below url to install boards manager
ESP8266
https://arduino.esp8266.com/stable/package_esp8266com_index.json
ESP32/ESP32 H/S/C
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Put these url into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
-
Open Boards Manager from Tools > Board menu and find esp8266/esp32 platform.
-
Select the version you need from a drop-down box.
-
Click install button.
-
Don’t forget to select your esp board from Tools > Board menu after installation.
Upload program to esp boards
-
for Esp32/esp8266/C3
- after initiate upload press and hold the
BOOT
button after upload done unpress boot button
- after initiate upload press and hold the
-
For Esp32 S2/S3/C6 [ Boards with 1 usb port on board ]
- after initiate upload press and hold the
BOOT
button after upload done unpress boot button
- after initiate upload press and hold the
-
For Esp32 S2/S3/C6 [ Boards with 2 usb port on board ]
-
First Way - Connect board to USB to UART bridge (usb port with UART label) [Recommended WAY]
Before upload Go to
TOOLS
thenUSB CDC on BOOT > Disable
,update the UPLOAD MODE > UART
. Now hit Upload. -
Second Way - Connect board to USB (usb port with USB label)
Before upload Go to
TOOLS
thenUSB CDC on BOOT > Enable
,update the UPLOAD MODE > Intarnal USB
. Now hit Upload.For First time if it does not get recognised by windows(Which you can check by device manager) press and hold BOOT button and click RESET button now unpress the BOOT button. Now follow the above steps.
-
Additional/Importent Arduino Libraries for esp8266/esp32
- esp8266 by ESP8266 Community
- ESP32 by Espressif Systems
- ESPAsyncWebServer
- ESPAsyncTCP for esp8266
- AsyncTCP for esp32
Raspberry Pi Pico /W
Follow this tutorial to set up arduino ide with RPi Pico boards.
Arduino Core for RP2040 based boards.
Micropython(Some selected boards are supported) setup
Common boards that supported by micropython
- all esp based boards.
- Arduino nano RP2040 connect and Arduino Nano 33 BLE Sense
- Arduino pro portena H7
- all pyboards
- Raspberry Pi pico & Pico W
- BBC micro:bit v1
- Adafruit Feather series
Micropython libraries:
Find needed packages from awesome-micropython.com
Follow This Guide to install a micropython package.
IDE Installation
- Now you need a IDE. I prefer thonny for this as it has REPL terminal For Installation guide follow this blog form Adafruit.
Firmware Installation to target board
First read micropython docs to check if your micropython support your board. If your board is supported you can go ahead.
-
[Easy method] Connect board to computer via USB > Open thonny > tools > options > interpreter > select Micropython > install or update Micropython.
-
[Other Method] Download the micropython firmware file :
-
Install the flash tool for esp boards :
pip install esptool
or
pip3 install esptool
verify installation with
esptool --help
command. -
Connect the esp board wit your computer and get the port number. It should be like
COM5 or /dev/ttyUSB0
- Now open cmd where you downloaded the firmware/bin file.
- Run the following commands :
Notice : After entering the command before pressingEnter
press the boot button in your esp board and press enter in your keyboard don’t unpress until command executes.
Erase previous firmwareesptool --port <PORT_NO> erase_flash
Install micropython firmware
esptool --port <PORT_NO> --baud 460800 write_flash --flash_size=detect 0 <FIRMWARE.bin>
Clear Flash
To remove and get back to Arduino IDE, Run the following command :
esptool.py --port <PORT_NO> erase_flash
-
Use circuitpython libraries through micropython
First find your device is supported or not here
Read installation docs Docs from adafruit
CircuitPython(Some selected boards are supported)
-
Find the CircuitPython Docs
-
First search you board here to check if your board is supported by CircuitPython.
-
[Note] : if your board not supported you can build your board by yourself. Find docs here.
Firmware Installation
In this case every board have diffrent method to install circuitpython. follow boards specific method in adafruit site.
-
Download the circuitpython BOOTLOADER ZIP and .uf2 file here.
-
[Recommended Method]
follow the Install, Repair, or Update UF2 Bootloader instruction in Adafruit site. -
[Other Method/esp boards]
Download the firmware(.zip) file > unzip it > flashcombine.zip
with the help of esptool. -
ESP32 S/C/H : For reference Follow this Youtube Video.
-
Raspberry Pi Pico with CircuitPython
Flash Resetting UF2
If your Pico ever gets into a really weird state and doesn’t even show up as a disk drive when installing CircuitPython, try installing this flash_nuke.uf2 which will do a ‘deep clean’ on your Flash Memory. You will lose all the files on the board, but at least you’ll be able to revive it! After nuking, re-install CircuitPython.
Circuitpython libraries and frameworks
CircuitPython libraries are written in Python. They provide additional functionality and support external devices, beyond what is in CircuitPython itself.After connect your board to your computers usb you should see a drive named CIRCUITPY. Libraries are stored on your CIRCUITPY drive in a folder called lib.
Automatic Installation using CircUp
- Install python 3.5 or later in your laptop or desktop.
- Open Terminal and create a virtiual environment with
pip install virtualenv
virtualenv venv
./venv/Scripts/activate
- Open Terminal and run
pip install circup
- Connect your board.
- run
circup --help
to know all the command. -
To know more visit Official Docs.
- Save installed package in
requirements.txt
circup freeze -r
Manual Installation
- You can get the circuitpython essential bundle and The Community Bundle from here.
- Extract the bundle.
- Go to
/lib
and copy the required packages(ie. neopixel.mpy) - Connect the circuitpython device with your computer. You should see a new drive named
CIRCUITPY
. - Paste the copied packages inside
/lib
directory ofCIRCUITPY
drive. - You can also get Indevidual packages from here
IDE/Text Editor Installation
- Now you need a IDE. I prefer thonny for this as it has REPL terminal For Installation guide follow this blog form Adafruit.
- For just minor editing you can use VS Code.
ESP-IDF
Follow this official instruction for installing ESP-IDF in VS Code.
Follow this Youtube tutorial for more precise instruction.
PlatformIO
Get started with PlatformIO.
Follow This Youtube Video to learn about installation and Usage.
Specific Drivers
CH340 Driver
These are installation guide, there you can find the driver downloader link.
CH343 Driver
FTDI VCP Drivers
- Windows/Linux/Mac Drivers
Misc. Docs
Topic | Description |
---|---|
I2C Device address list | https://i2cdevices.org/addresses |
Linux Hardware Driver Finder | https://linux-hardware.org/index.php?view=search |
-- By Tirtharaj Sinha