0% found this document useful (0 votes)
34 views38 pages

DOC-20240504-WA0001.

Uploaded by

Aswin E
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views38 pages

DOC-20240504-WA0001.

Uploaded by

Aswin E
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

EXP NO:1

INTRODUCTION TO THE ARDUINO PLATFORM


DATE

AIM:
To study the basics of Arduino Uno board and Arduino IDE 2.0 software.

Hardware & SOFTWARE TOOLS REQUIRED:

S.No. Hardware & Software Requirements Quantity


1 Arduino IDE 2.0 1
2 Arduino Uno Board 1

INTRODUCTION TO ARDUINO:

Arduino is a project, open-source hardware, and software platform used to design and build
electronicdevices. It designs and manufactures microcontroller kits and single-board interfaces for
building electronics projects. The Arduino boards were initially created to help students with the non-
technical background. The designs of Arduino boards use a variety of controllers and
microprocessors. Arduino is an easy-to-use open platform for creating electronic projects. Arduino
boards play a vitalrole in creating different projects. It makes electronics accessible to non-engineers,
hobbyists, etc.

INTRODUCTION TO ARDUINO UNO:


The Arduino UNO is a standard board of Arduino. Here UNO means 'one' in Italian. It was
named UNO to label the first release of Arduino Software. It was also the first USB board released
by Arduino. It is considered a powerful board used in various projects. Arduino. cc developed the
Arduino UNO board. Arduino UNO is based on an ATmega328P microcontroller. It is easy to use
compared to other boards, such as the Arduino Mega board, etc. The board consists of digital and
analog Input/Output pins (I/O), shields, and other circuits. The Arduino UNO includes 6 analog pin
inputs, 14 digital pins, a USB connector, a power jack, and an ICSP (In-Circuit Serial Programming)
header. It is programmed based on IDE, which stands for Integrated Development Environment. It
can run on both online and offline platforms. The IDE is common to all available boards of Arduino.
The components of Arduino UNO board are shown below:
o ATmega328 Microcontroller- It is a single-chip Microcontroller of the ATmel family. The processor
code inside it is of 8-bit. It combines Memory (SRAM, EEPROM, and Flash), Analog to Digital
Converter, SPI serial ports, I/O lines, registers, timers, external and internal interrupts, and
oscillator.
o ICSP pin - The In-Circuit Serial Programming pin allows the user to program using the firmware of
the Arduino board.
o Power LED Indicator- The ON status of the LED shows the power is activated. When the power is
OFF, the LED will not light up.
o Digital I/O pins- The digital pins have the value HIGH or LOW. The pins numbered from D0 to D13
are digital pins.
o TX and RX LED's- The successful flow of data is represented by the lighting of these LED's.
o AREF- The Analog Reference (AREF) pin is used to feed a reference voltage to the Arduino UNO
board from the external power supply.
o Reset button- It is used to add a Reset button to the connection.
o USB- It allows the board to connect to the computer. It is essential for the programming of the Arduino
UNO board.
o Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes the Arduino UNO
a powerful board.
o Voltage Regulator- The voltage regulator converts the input voltage to 5V.
o GND- Ground pins. The ground pin acts as a pin with zero voltage.
o Vin- It is the input voltage.
o Analog Pins- The pins numbered from A0 to A5 are analog pins. The function of Analog pins is to
read the analog sensor used in the connection. It can also act as GPIO (General Purpose Input Output)
pin.
TECHNICAL SPECIFICATIONS OF ARDUINO UNO
The technical specifications of the Arduino UNO are listed below:
o There are 20 Input/Output pins present on the Arduino UNO board. These 20 pins include 6 PWM
pins, 6 analog pins, and 8 digital I/O pins.
o The PWM pins are Pulse Width Modulation capable.
o The crystal oscillator present in Arduino UNO comes with a frequency of 16MHz.
o It also has an Arduino-integrated WIFI module. Such Arduino UNO board is based on the Integrated
WIFI ESP8266 Module and ATmega328P microcontroller.
o The input voltage of the UNO board varies from 7V to 20V.
o Arduino UNO automatically draws power from the external power supply. It can also draw power
from the USB.

INTRODUCTION TO ARDUINO IDE 2.0:

The Arduino IDE 2.0 is an open-source project, currently in its beta-phase. It is a big step from it's
sturdy predecessor, Arduino IDE 2.0, and comes with revamped UI, improved board & library
manger, autocomplete feature and much more.
In this tutorial, we will go through step by step, how to download and install the software.
Download the editor
Downloading the Arduino IDE 2.0 is done through the Arduino Software page. Here you will
also find information on the other editors available to use.

Requirements
 Windows - Win 10 and newer, 64 bits
 Linux - 64 bits
 Mac OS X - Version 10.14: "Mojave" or newer, 64 bits

Installation
Windows
Download URL: https://www.arduino.cc/en/software
To install the Arduino IDE 2.0 on a Windows computer, simply run the file downloaded from the
software page.

Follow the instructions in the installation guide. The installation may take several minutes.
RESULT:
EXP NO:2
INTERFACING ARDUINO TO ZIGBEE MODULE
DATE

AIM:
To write a program to control an LED using a Zigbee module.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity


1 Arduino IDE 2.0 1
2 Arduino UNO Development Board 2
3 Jumper Wires few

4 Arduino USB Cable 2

5 Zigbee Module 2

THEORY:
IoT devices require reliable and efficient communication methods to transmit data and interact
withother devices or systems.
Zigbee is a low-power wireless communication protocol designed for short-rangecommunication
between devices. It operates on the 2.4 GHz frequency band and supports mesh networking, allowing
devices to communicate with each other through intermediate nodes. Zigbee iscommonly used in home
automation, industrial control, and smart energy applications.

CONNECTIONS:
TRANSMITTER:

Arduino UNO Pin Zigbee Module


VCC 5V
GND G
2 Tx
3 Rx

RECEIVER:

Arduino UNO Pin Zigbee Module Arduino Development Board


- 5V 5V
- G GND
2 Tx -
3 Rx -
4 - LED1
PROGRAM:
TRANSMITTER SIDE:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
mySerial.write('A');
Serial.println('A');
delay(100);
mySerial.write('B');
Serial.println('B');
delay(100);
}

RECEIVER SIDE:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
pinMode(4, OUTPUT);
}
void loop()
{
if(mySerial.available()>0)
{
char data=mySerial.read();
Serial.println(data);
if(data=='A')
digitalWrite(4,HIGH);
else if(data=='B')
digitalWrite(4,LOW);
}
}
RESULT:
EXP NO:3
INTERFACING ARDUINO TO GSM
DATE MODULE

AIM:
To write a program to control an LED using a GSM module.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity


1 Arduino IDE 2.0 1
2 Arduino UNO Development Board 2
3 Jumper Wires few

4 Arduino USB Cable 2

5 GSM Module 2

PROGRAM:

int LED = D1;void


setup() {
pinMode(LED, OUTPUT);
Serial.begin(9600); /* Define baud rate for serial communication */
}

void loop() {

if (Serial.available()) /* If data is available on serial port */


{
char data_received;
data_received = Serial.read(); /* Data received from bluetooth */if
(data_received == '1')
{
digitalWrite(LED, HIGH);
Serial.write("LED turned ON\n");
}
else if (data_received == '2')

{
digitalWrite(LED, LOW);
Serial.write("LED turned OFF\n");
}
else
{
Serial.write("Select either 1 or 2");
}
}

}
import gsm def
main():
print("GSM communication")
gsm_device = gsm.GSMDevice()
gsm_device.connect()
data = gsm_device.read()
print(data)

RESULT:
EXP NO:4
INTERFACING ARDUINO TO
DATE BLUETOOTH MODULE

AIM:
To write a program to control an LED using a Bluetooth module.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity


1 Arduino IDE 2.0 1
2 Arduino UNO Development Board 1
3 Jumper Wires few

4 Arduino USB Cable 1

5 HC-05 Bluetooth Module 1

THEORY:
IoT devices require reliable and efficient communication methods to transmit data and interact with
other devices or systems.
Bluetooth is a short-range wireless communication technology that operates on the 2.4 GHz frequency
band. It is commonly used for connecting IoT devices to smartphones, tablets, and other nearby devices.
Bluetooth Low Energy (BLE) is a power-efficient version of Bluetooth that is ideal for battery-powered
IoT devices. Bluetooth is widely used in applications such as wearable devices, healthcare monitoring,
and home automation

CONNECTIONS:

Arduino UNO Pin Bluetooth Module Arduino Development Board


VCC 5V -
GND GND -
2 Tx -
3 Rx -
4 - LED
PROGRAM:

#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
pinMode(4, OUTPUT);
}

void loop() {
if(mySerial.available()>0)
{
char data=mySerial.read();
Serial.println(data);
if(data=='1'){
digitalWrite(4,HIGH);
Serial.println("LED ON");
}
else if(data=='2'){
digitalWrite(4,LOW);
Serial.println("LED OFF");
}
}
}
RESULT:
EXP NO: 5 INTRODUCTION TO THE RASPBERRY PI
DATE PLATFORM AND PYTHON PROGRAMMING

AIM:
To study the basics of Arduino Uno board and Arduino IDE 2.0 software.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity

1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Jumper Wires few

4 Micro USB Cable 1

5 IR Sensor 1

6 Ultrasonic sensor 1

Introduction to Raspberry Pi Pico W:

The Raspberry Pi Pico W is a compact and affordable microcontroller board developed by the
Raspberry Pi Foundation. Building upon the success of the Raspberry Pi Pico, the Pico W variant
brings wireless connectivity to the table, making it an even more versatile platform for embedded
projects. In this article, we will provide a comprehensive overview of the Raspberry Pi Pico W,
highlighting its key features and capabilities.
Features:
 RP2040 microcontroller with 2MB of flash memory
 On-board single-band 2.4GHz wireless interfaces (802.11n)
 Micro USB B port for power and data (and for reprogramming the flash)
 40 pins 21mmx51mm ‘DIP’ style 1mm thick PCB with 0.1″ through-hole pins also with edge
castellations
 Exposes 26 multi-function 3.3V general purpose I/O (GPIO)
 23 GPIO are digital-only, with three also being ADC-capable
 Can be surface mounted as a module
 3-pin ARM serial wire debug (SWD) port
 Simple yet highly flexible power supply architecture
 Various options for easily powering the unit from micro-USB, external supplies, or batteries
 High quality, low cost, high availability
 Comprehensive SDK, software examples, and documentation
 Dual-core Cortex M0+ at up to 133MHz
 On-chip PLL allows variable core frequency
 264kByte multi-bank high-performance SRAM

Getting Started with Thonny MicroPython (Python) IDE:


If you want to program your ESP32 and ESP8266 with MicroPython firmware, it’s very handy to
use an IDE. you’ll have your first LED blinking using MicroPython and Thonny IDE.

What is MicroPython?
MicroPython is a Python 3 programming language re-implementation targeted for microcontrollers
and embedded systems. MicroPython is very similar to regular Python. Apart from a few exceptions,
the language features of Python are also available in MicroPython. The most significant difference
between Python and MicroPython is that MicroPython was designed to work under constrained
conditions.
Because of that, MicroPython does not come with the entire pack of standard libraries. It only
includes a small subset of the Python standard libraries, but it includes modules to easily control and
interact with the GPIOs, use Wi-Fi, and other communication protocols.
Thonny IDE:
Thonny is an open-source IDE which is used to write and upload MicroPython programs to different
development boards such as Raspberry Pi Pico, ESP32, and ESP8266. It is extremely interactive and
easy to learn IDE as much as it is known as the beginner-friendly IDE for new programmers. With
the help of Thonny, it becomes very easy to code in Micropython as it has a built-in debugger that
helps to find any error in the program by debugging the script line by line.

You can realize the popularity of Thonny IDE from this that it comes pre-installed in Raspian OS
which is an operating system for a Raspberry Pi. It is available to install on r Windows, Linux, and
Mac OS.

RESULT:
EXP NO:6
INTRODUCTION TO PYTHON PROGRAMMING
DATE

A) Installing Thonny IDE – Windows PC


Thonny IDE comes installed by default on Raspbian OS that is used with the Raspberry Pi board.
To install Thonny on your Windows PC, follow the next instructions:
1. Go to https://thonny.org
2. Download the version for Windows and wait a few seconds while it downloads.
3. Run the .exe file.

4. Follow the installation wizard to complete the installation process. You just need to click “Next”.

5. After completing the installation, open Thonny IDE. A window as shown in the following figure
should open.
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


Pin Development Board
GP16 LED
PROGRAM

LED:
from machine import Pin
import time
LED = Pin(16, Pin.OUT)
while True:
LED.value(1)
time.sleep(1)
LED.value(0)
time.sleep(1)
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


Pin Development Board
(RGB)
GP16 R
GP17 G
GP18 B
GND COM

RGB:
from machine import Pin
from time import sleep_ms,sleep
r=Pin(16,Pin.OUT)
y=Pin(17,Pin.OUT)
g=Pin(18,Pin.OUT)

while True:
r.value(1)
sleep_ms(1000)
r.value(0)
sleep_ms(1000)
y.value(1)
sleep(1)
y.value(0)
sleep(1)
g.value(1)
sleep(1)
g.value(0)
sleep(1)
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


Pin Development Board
GP16 LED
GP15 SW1

SWITCH CONTROLLED LED:


from machine import Pin
from time import sleep
led=Pin(16,Pin.OUT)
sw=Pin(15,Pin.IN)
while True:
bt=sw.value()
if bt== True:
print("LED ON")
led.value(1)
sleep(2)
led.value (0)
sleep(2)
led.value (1)
sleep(2)
led.value(0)
sleep(2)
else:
print("LED OFF")
sleep(0.5)

RESULT:
EXP NO:7
INTERFACING SENSORS WITH RASPBERRY PI
DATE

AIM:
To interface the IR sensor and Ultrasonic sensor with Raspberry Pico.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity

1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Jumper Wires few

4 Micro USB Cable 1

5 IR Sensor 1

6 Ultrasonic sensor 1

PROCEDURE
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


IR Sensor Module
Pin Development Board
GP16 BUZZER -
GP15 - OUT
- 5V VCC
- GND GND
PROGRAM:

IR Sensor:
from machine import Pin
from time import sleep
buzzer=Pin(16,Pin.OUT)
ir=Pin(15,Pin.IN)
while True:
ir_value=ir.value()
if ir_value== True:
print("Buzzer OFF")
buzzer.value(0)
else:
print("Buzzer ON")
buzzer.value (1)
sleep(0.5)
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


Ultrasonic Sensor Module
Pin Development Board
GP16 BUZZER -
GP15 - ECHO
GP14 - TRIG
- 5V VCC
- GND GND
ULTRASONIC SENSOR:
from machine import Pin, PWM
import utime
trigger = Pin(14, Pin.OUT)
echo = Pin(15, Pin.IN)
buzzer = Pin(16, Pin.OUT)

def measure_distance():
trigger.low()
utime.sleep_us(2)
trigger.high()
utime.sleep_us(5)
trigger.low()
while echo.value() == 0:
signaloff = utime.ticks_us()
while echo.value() == 1:
signalon = utime.ticks_us()

timepassed = signalon - signaloff


distance = (timepassed * 0.0343) / 2
return distance

while True:
dist = measure_distance()
print(f"Distance : {dist} cm")
if dist <= 10:
buzzer.value(1)
utime.sleep(0.01)
else:
buzzer.value(0)
utime.sleep(0.01)
utime.sleep(0.5)
RESULT:
EXP NO:8 COMMUNICATE BETWEEN ARDUINO AND
DATE RASPBERRY PI

AIM:
To write and execute the program to Communicate between Arduino and Raspberry PI
using any wireless medium (Bluetooth)

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity

1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Arduino Uno Development Board 1
4 Jumper Wires few
5 Micro USB Cable 1
6 Bluetooth Module 2

PROCEDURE
CONNECTIONS:

Arduino UNO Pin Arduino Development Board Bluetooth Module


2 - Tx
3 - Rx
- GND GND
- 5V 5V
PROGRAM:

MASTER
ARDUINO:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
}

void loop() {
mySerial.write('A');
delay(1000);
mySerial.write('B');
delay(1000);
}
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


Bluetooth Module
Pin Development Board
GP16 LED -
VCC - +5V
GND - GND
GP1 - Tx
GP0 - Rx
SLAVE
RASPBERRY PI PICO
from machine import Pin, UART
uart = UART(0, 9600)
led = Pin(16, Pin.OUT)

while True:
if uart.any() > 0:
data = uart.read()
print(data)
if "A" in data:
led.value(1)
print('LED on \n')
uart.write('LED on \n')
elif "B" in data:
led.value(0)
print('LED off \n')
uart.write('LED off \n')
RESULT:

You might also like