Internet of Things (IoT)-Sensors & Actuators - IoT.pptxLibin Baby
Sensors & Actuators - IoT
A device used for the conversion of physical events or characteristics into the electrical signals.
A device that converts the electrical signals into the physical events or characteristics.
1. This document provides an overview of the contents to be covered in an Arduino and programming course.
2. The course will cover identifying Arduino board components, basic programming functions, signal types, using various sensors and motors, serial communication, and LCD displays.
3. Additional topics may include PID control and using a seven segment display, depending on available time.
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepalbishal bhattarai
This slides has complete code with respected circuit of projects. It contains Detail information required before starting a arduino project.All the projects are compiled, debugged and simulated on proteus. If you need arduino library for proteus then please visit this link: https://www.facebook.com/cots2013
Arduino is an open-source project that created microcontroller-based kits for building digital devices and interactive objects that can sense and control physical devices.
The Arduino document provides information on learning Arduino through examples, foundations of concepts, hacking guides, and additional links. It includes sections on examples programs, core concepts, extending Arduino hardware and software, and links to other documentation resources. A variety of examples are given to demonstrate uses of Arduino's input/output pins, analog/digital functions, communication, libraries, and interfacing with other hardware.
The document provides an overview of topics related to interfacing sensors and actuators with Arduino microcontrollers. It discusses basic I/O components, sensor interfacing including ultrasonic, IR, temperature and motion sensors. It also covers actuators, motor control, LCD displays and programming concepts for Arduino like digital and analog I/O, PWM and interrupts. References for further reading on Arduino programming are also provided.
This document provides information about the Arduino workshop. It discusses Arduino boards and their components. It describes the Arduino IDE and basic code structure using functions like pinMode(), digitalWrite(), and delay(). It also explains programming concepts like variables, loops, and using sensors and actuators with digital and analog input/output pins.
This is only for educational purposes. I openly declare a common courtesy to the video content owner.
It contains full tutorial as well as a video file inside the ppt file that will help you to build up a complete project.
The document provides an overview of Arduino, including what it is, common Arduino boards, digital and analog input/output, and example projects. Arduino is an open-source electronics prototyping platform that can be used to create interactive objects. It uses a simple hardware and software environment to program and develop prototypes. The Arduino Uno is one of the most commonly used boards, which contains an Atmega328 microcontroller, digital and analog pins, and can be programmed via USB. The document describes how to connect various components like LEDs, buttons, sensors and motors to an Arduino board.
The document provides an overview of Arduino, including what it is, common Arduino boards, digital and analog input/output, and example projects. Arduino is an open-source electronics prototyping platform that allows users to create interactive objects and environments. It uses flexible, easy-to-use hardware and software. Common tasks demonstrated include blinking LEDs, reading buttons, and controlling motors. The document serves as an introduction to getting started with the Arduino platform.
The introduction to Arduino labs at Malmö University. These slides have been handed down since the beginning of Arduino. They have more authors then i can remember and should by no means be considered mine.
The introduction to Arduino labs at Malmö University. These slides have been handed down since the beginning of Arduino. They have more authors then i can remember and should by no means be considered mine.
The document provides an overview of Arduino programming structures and concepts. It discusses the setup and loop functions, variables and data types, arrays, operators, constants, control structures, and input/output functions like pinMode, digitalRead, analogRead, and analogWrite. It also covers other functions for delay, random numbers, serial communication, and working with sensors like a vibration sensor, accelerometer, ultrasonic sensor, and Bluetooth shield. Example code is provided to read and display sensor values and control an LED.
The document describes how to build a spaceship interface circuit using an Arduino. It includes instructions to wire an LED circuit with a switch and write an Arduino program to control the LEDs based on the switch state. When the switch is open a green LED will be on, and when closed the green LED will turn off and two red LEDs will start blinking by changing states with a delay. The program uses variables, if/else statements, and functions like digitalRead(), digitalWrite(), and delay().
The document provides an overview of the Arduino Uno microcontroller board. It describes the main components of the board including 14 digital input/output pins, 6 analog inputs, a 16MHz crystal oscillator, a USB connection, a power jack, and a reset button. It also explains how to power the board using a USB cable connected to a computer or an external power supply. The document then introduces some basic Arduino programming concepts like functions, data types, control structures, and input/output functions.
This laboratory manual introduces students to controlling systems using an Arduino microcontroller. Lab 1 covers basic input and output using LEDs and buttons. Lab 2 adds a photoresistor sensor and implements proportional and proportional-integral control of LED brightness. Lab 3 applies these same control techniques to a motor system using an encoder for position feedback. The labs provide circuit diagrams, code examples, and instructions to help students gather and analyze data on system responses under different control schemes.
This document outlines the syllabus for an Arduino workshop that will cover basic concepts like inputs, outputs, and programming. It includes sections that explain how to use functions like pinMode(), digitalWrite(), analogRead(), and functions for using sensors like ultrasonic distance measurement. The document also covers using the Serial Monitor, LCD displays, and introduces concepts in robotics like sensing, thinking, planning and output. The overall workshop aims to teach participants how to get started with Arduino and touch on the concept of infinity through hands-on projects.
02 General Purpose Input - Output on the ArduinoWingston
Digital signals can represent information and are used to transfer data and control systems. They take on discrete voltage levels representing 1s and 0s. Microcontrollers like the Arduino use ports and pins that can be configured as inputs or outputs to send and receive these digital signals. Inputs like switches can be read to control outputs like LEDs. Interrupts allow the microcontroller to respond to external events without constantly checking. Serial communication allows the Arduino to transfer data to other devices like a computer by encoding data as a stream of 1s and 0s sent through transmit and receive pins.
Gowtham Thamilarasu is a senior embedded design engineer at Sparks Automations. The document discusses Arduino and embedded systems. It includes sections on Arduino hardware, programming, digital and analog input/output, serial communication, and examples of using Arduino to control devices like LCD displays and send messages via GSM. The document provides an overview of key Arduino concepts for engineers and programmers.
The document provides an overview of the Arduino programming language and hardware. It describes the basic structure of an Arduino program with setup() and loop() functions. It lists the main data types and functions for digital and analog input/output, time, math, random numbers, serial communication and more. It also provides information on libraries, the Arduino board pins and components, and compares Arduino to the Processing language.
1. The document outlines the schedule and topics for a two-day workshop on urban sensing and physical computing using Arduino.
2. Day 1 covers getting started with physical computing, an overview of the Arduino board, basic electronics, and an introductory activity.
3. Day 2 focuses on analogue sensors, sharing sensor data, and a project activity where participants work on their own projects and present them.
4. The workshop teaches participants how to connect sensors to Arduino boards and read sensor data to turn the physical world into digital data.
The IoT Academy IoT Training Arduino Part 3 programmingThe IOT Academy
This document provides an overview of basic Arduino code structure and programming concepts. It explains that Arduino programs have two main sections - setup() and loop(). Setup() is used to initialize inputs and outputs, and loop() contains the repeating code. It also covers digital input/output functions, variables, conditional statements, boolean logic, and interrupts. Examples are provided for blinking LEDs, reading sensors, and creating simple programs.
PREDICTION OF ROOM TEMPERATURE SIDEEFFECT DUE TOFAST DEMAND RESPONSEFOR BUILD...ijccmsjournal
In order to evaluate side-effect of power limitation due to the Fast Automated Demand Response
(FastADR) for building air-conditioning facilities, a prediction model on short time change of average
room temperature has been developed. A room temperature indexis defined as a weighted average of the
entire building for room temperature deviations from the setpoints. The index is assumed to be used to
divide total FastADRrequest to distribute power limitation commands to each building.In order to predict
five-minute-change of the index, our combined mathematical model of an auto regression (AR) and a
neural network (NN) is proposed.In the experimental results, the combined model showedthe root mean
square error (RMSE) of 0.23 degrees, in comparison with 0.37 and 0.26 for conventional single NN and AR
models, respectively. This result is satisfactory prediction for required comfort of approximately 1 degree
Celsius allowance.
More Related Content
Similar to Sensors and Actuators in Arduino, Introduction (20)
The document provides an overview of topics related to interfacing sensors and actuators with Arduino microcontrollers. It discusses basic I/O components, sensor interfacing including ultrasonic, IR, temperature and motion sensors. It also covers actuators, motor control, LCD displays and programming concepts for Arduino like digital and analog I/O, PWM and interrupts. References for further reading on Arduino programming are also provided.
This document provides information about the Arduino workshop. It discusses Arduino boards and their components. It describes the Arduino IDE and basic code structure using functions like pinMode(), digitalWrite(), and delay(). It also explains programming concepts like variables, loops, and using sensors and actuators with digital and analog input/output pins.
This is only for educational purposes. I openly declare a common courtesy to the video content owner.
It contains full tutorial as well as a video file inside the ppt file that will help you to build up a complete project.
The document provides an overview of Arduino, including what it is, common Arduino boards, digital and analog input/output, and example projects. Arduino is an open-source electronics prototyping platform that can be used to create interactive objects. It uses a simple hardware and software environment to program and develop prototypes. The Arduino Uno is one of the most commonly used boards, which contains an Atmega328 microcontroller, digital and analog pins, and can be programmed via USB. The document describes how to connect various components like LEDs, buttons, sensors and motors to an Arduino board.
The document provides an overview of Arduino, including what it is, common Arduino boards, digital and analog input/output, and example projects. Arduino is an open-source electronics prototyping platform that allows users to create interactive objects and environments. It uses flexible, easy-to-use hardware and software. Common tasks demonstrated include blinking LEDs, reading buttons, and controlling motors. The document serves as an introduction to getting started with the Arduino platform.
The introduction to Arduino labs at Malmö University. These slides have been handed down since the beginning of Arduino. They have more authors then i can remember and should by no means be considered mine.
The introduction to Arduino labs at Malmö University. These slides have been handed down since the beginning of Arduino. They have more authors then i can remember and should by no means be considered mine.
The document provides an overview of Arduino programming structures and concepts. It discusses the setup and loop functions, variables and data types, arrays, operators, constants, control structures, and input/output functions like pinMode, digitalRead, analogRead, and analogWrite. It also covers other functions for delay, random numbers, serial communication, and working with sensors like a vibration sensor, accelerometer, ultrasonic sensor, and Bluetooth shield. Example code is provided to read and display sensor values and control an LED.
The document describes how to build a spaceship interface circuit using an Arduino. It includes instructions to wire an LED circuit with a switch and write an Arduino program to control the LEDs based on the switch state. When the switch is open a green LED will be on, and when closed the green LED will turn off and two red LEDs will start blinking by changing states with a delay. The program uses variables, if/else statements, and functions like digitalRead(), digitalWrite(), and delay().
The document provides an overview of the Arduino Uno microcontroller board. It describes the main components of the board including 14 digital input/output pins, 6 analog inputs, a 16MHz crystal oscillator, a USB connection, a power jack, and a reset button. It also explains how to power the board using a USB cable connected to a computer or an external power supply. The document then introduces some basic Arduino programming concepts like functions, data types, control structures, and input/output functions.
This laboratory manual introduces students to controlling systems using an Arduino microcontroller. Lab 1 covers basic input and output using LEDs and buttons. Lab 2 adds a photoresistor sensor and implements proportional and proportional-integral control of LED brightness. Lab 3 applies these same control techniques to a motor system using an encoder for position feedback. The labs provide circuit diagrams, code examples, and instructions to help students gather and analyze data on system responses under different control schemes.
This document outlines the syllabus for an Arduino workshop that will cover basic concepts like inputs, outputs, and programming. It includes sections that explain how to use functions like pinMode(), digitalWrite(), analogRead(), and functions for using sensors like ultrasonic distance measurement. The document also covers using the Serial Monitor, LCD displays, and introduces concepts in robotics like sensing, thinking, planning and output. The overall workshop aims to teach participants how to get started with Arduino and touch on the concept of infinity through hands-on projects.
02 General Purpose Input - Output on the ArduinoWingston
Digital signals can represent information and are used to transfer data and control systems. They take on discrete voltage levels representing 1s and 0s. Microcontrollers like the Arduino use ports and pins that can be configured as inputs or outputs to send and receive these digital signals. Inputs like switches can be read to control outputs like LEDs. Interrupts allow the microcontroller to respond to external events without constantly checking. Serial communication allows the Arduino to transfer data to other devices like a computer by encoding data as a stream of 1s and 0s sent through transmit and receive pins.
Gowtham Thamilarasu is a senior embedded design engineer at Sparks Automations. The document discusses Arduino and embedded systems. It includes sections on Arduino hardware, programming, digital and analog input/output, serial communication, and examples of using Arduino to control devices like LCD displays and send messages via GSM. The document provides an overview of key Arduino concepts for engineers and programmers.
The document provides an overview of the Arduino programming language and hardware. It describes the basic structure of an Arduino program with setup() and loop() functions. It lists the main data types and functions for digital and analog input/output, time, math, random numbers, serial communication and more. It also provides information on libraries, the Arduino board pins and components, and compares Arduino to the Processing language.
1. The document outlines the schedule and topics for a two-day workshop on urban sensing and physical computing using Arduino.
2. Day 1 covers getting started with physical computing, an overview of the Arduino board, basic electronics, and an introductory activity.
3. Day 2 focuses on analogue sensors, sharing sensor data, and a project activity where participants work on their own projects and present them.
4. The workshop teaches participants how to connect sensors to Arduino boards and read sensor data to turn the physical world into digital data.
The IoT Academy IoT Training Arduino Part 3 programmingThe IOT Academy
This document provides an overview of basic Arduino code structure and programming concepts. It explains that Arduino programs have two main sections - setup() and loop(). Setup() is used to initialize inputs and outputs, and loop() contains the repeating code. It also covers digital input/output functions, variables, conditional statements, boolean logic, and interrupts. Examples are provided for blinking LEDs, reading sensors, and creating simple programs.
PREDICTION OF ROOM TEMPERATURE SIDEEFFECT DUE TOFAST DEMAND RESPONSEFOR BUILD...ijccmsjournal
In order to evaluate side-effect of power limitation due to the Fast Automated Demand Response
(FastADR) for building air-conditioning facilities, a prediction model on short time change of average
room temperature has been developed. A room temperature indexis defined as a weighted average of the
entire building for room temperature deviations from the setpoints. The index is assumed to be used to
divide total FastADRrequest to distribute power limitation commands to each building.In order to predict
five-minute-change of the index, our combined mathematical model of an auto regression (AR) and a
neural network (NN) is proposed.In the experimental results, the combined model showedthe root mean
square error (RMSE) of 0.23 degrees, in comparison with 0.37 and 0.26 for conventional single NN and AR
models, respectively. This result is satisfactory prediction for required comfort of approximately 1 degree
Celsius allowance.
This research presents a machine learning (ML) based model to estimate the axial strength of corroded RC columns reinforced with fiber-reinforced polymer (FRP) composites. Estimating the axial strength of corroded columns is complex due to the intricate interplay between corrosion and FRP reinforcement. To address this, a dataset of 102 samples from various literature sources was compiled. Subsequently, this dataset was employed to create and train the ML models. The parameters influencing axial strength included the geometry of the column, properties of the FRP material, degree of corrosion, and properties of the concrete. Considering the scarcity of reliable design guidelines for estimating the axial strength of RC columns considering corrosion effects, artificial neural network (ANN), Gaussian process regression (GPR), and support vector machine (SVM) techniques were employed. These techniques were used to predict the axial strength of corroded RC columns reinforced with FRP. When comparing the results of the proposed ML models with existing design guidelines, the ANN model demonstrated higher predictive accuracy. The ANN model achieved an R-value of 98.08% and an RMSE value of 132.69 kN which is the lowest among all other models. This model fills the existing gap in knowledge and provides a precise means of assessment. This model can be used in the scientific community by researchers and practitioners to predict the axial strength of FRP-strengthened corroded columns. In addition, the GPR and SVM models obtained an accuracy of 98.26% and 97.99%, respectively.
Civil engineering faces significant challenges from expansive soils, which can lead to structural damage. This study aims to optimize subtractive clustering and Fuzzy C-Mean Clustering (FCM) models for the most accurate prediction of swelling percentage in expansive soils. Two ANFIS models were developed, namely the FIS1S model using subtractive clustering and the FIS2S model utilizing the FCM algorithm. Due to the MATLAB graphical user interface's limitation on the number of membership functions, the coding approach was employed to develop the ANFIS models for optimal prediction accuracy and problem-solving time. So, two programs were created to determine the optimal influence radius for the FIS1S model and the number of membership functions for the FIS2S model to achieve the highest prediction accuracy. The ANFIS models have demonstrated their highest predictive ability in predicting swelling percentage, thanks to the optimization of membership functions and cluster centers. The developed programs also showed excellent performance and can be potentially applied to optimize subtractive clustering and FCM models in accurately modeling various engineering aspects.
En esta presentación se encuentra la explicación sobre la tomografía Axial Computarizada, se habla sobre su historia, partes, operación general y especifica del equipo, tipos de densidades y sus aplicaciones más comunes y las innovadoras.
May 2025: Top 10 Cited Articles in Software Engineering & Applications Intern...sebastianku31
The International Journal of Software Engineering & Applications (IJSEA) is a bi-monthly open access peer-reviewed journal that publishes articles which contribute new results in all areas of the Software Engineering & Applications. The goal of this journal is to bring together researchers and practitioners from academia and industry to focus on understanding Modern software engineering concepts & establishing new collaborations in these areas.
The development of smart cities holds immense significance in shaping a nation's urban fabric and effectively addressing urban challenges that profoundly impact the economy. Among these challenges, road accidents pose a significant obstacle to urban progress, affecting lives, supply chain efficiency, and socioeconomic well-being. To address this issue effectively, accurate forecasting of road accidents is crucial for policy formulation and enhancing safety measures. Time series forecasting of road accidents provides invaluable insights for devising strategies, enabling swift actions in the short term to reduce accident rates, and informing well-informed road design and safety management policies for the long term, including the implementation of flyovers, and the enhancement of road quality to withstand all weather conditions. Deep Learning's exceptional pattern recognition capabilities have made it a favored approach for accident forecasting. The study comprehensively evaluates deep learning models, such as RNN, LSTM, CNN+LSTM, GRU, Transformer, and MLP, using a ten-year dataset from the esteemed Smart Road Accident Database in Hubballi-Dharwad. The findings unequivocally underscore LSTM's superiority, exhibiting lower errors in both yearly (RMSE: 0.291, MAE: 0.271, MAPE: 6.674%) and monthly (RMSE: 0.186, MAE: 0.176, MAPE: 5.850%) variations. Based on these compelling findings, the study provides strategic recommendations to urban development authorities, emphasizing comprehensive policy frameworks encompassing short-term and long-term measures to reduce accident rates alongside meticulous safety measures and infrastructure planning. By leveraging insights from deep learning models, urban development authorities can adeptly shape the urban landscape, fostering safer environments and contributing to global safety and prosperity.
First Review PPT gfinal gyft ftu liu yrfut goSowndarya6
CyberShieldX provides end-to-end security solutions, including vulnerability assessment, penetration testing, and real-time threat detection for business websites. It ensures that organizations can identify and mitigate security risks before exploitation.
Unlike traditional security tools, CyberShieldX integrates AI models to automate vulnerability detection, minimize false positives, and enhance threat intelligence. This reduces manual effort and improves security accuracy.
Many small and medium businesses lack dedicated cybersecurity teams. CyberShieldX provides an easy-to-use platform with AI-powered insights to assist non-experts in securing their websites.
Traditional enterprise security solutions are often expensive. CyberShieldX, as a SaaS platform, offers cost-effective security solutions with flexible pricing for businesses of all sizes.
Businesses must comply with security regulations, and failure to do so can result in fines or data breaches. CyberShieldX helps organizations meet compliance requirements efficiently.
This presentation highlights project development using software development life cycle (SDLC) with a major focus on incorporating research in the design phase to develop innovative solution. Some case-studies are also highlighted which makes the reader to understand the different phases with practical examples.
6. Input/Output
• Example Code
// Switch test program
int ledPin = 12; // LED is connected to pin 12
int switchPin = 2; // Switch connected to digital pin 2
int val; // variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as output
pinMode(switchPin, INPUT); // Set the switch pin as input
}
void loop(){
val = digitalRead(switchPin); // read input value and store it in val
if (val == HIGH) { // check if the button is pressed
digitalWrite(ledPin, HIGH); // turn LED on
}
if (val == LOW) { // check if the button is not pressed
digitalWrite(ledPin, LOW); // turn LED off
}
}
8. State input
• Example code
/* * Switch and LED test program */
int ledPin = 12; // LED is connected to pin 12
int switchPin = 2; // switch is connected to pin 2
int val; // variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as output
pinMode(switchPin, INPUT); // Set the switch pin as input
}
void loop(){
val = digitalRead(switchPin); // read input value and store it in val
if (val == LOW) { // check if the button is pressed
digitalWrite(ledPin, HIGH); // turn LED on
}
if (val == HIGH) { // check if the button is not pressed
digitalWrite(ledPin, LOW); // turn LED off
}
}
14. Serial Library
/* * Hello World! *
* This is the Hello World! for Arduino.
* It shows how to send data to the computer
*/
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
}
void loop() // run over and over again
{
Serial.println("Hello world!"); // prints hello with ending line break
delay(1000);
}
19. Serial Communication
/* * Hello World! *
* This is the Hello World! for Arduino.
* It shows how to send data to the computer
*/
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
}
void loop() // run over and over again
{
Serial.println("Hello world!"); // prints hello with ending line break
delay(1000);
}
20. Serial Communication
/* * Math is fun! */
int a = 5;
int b = 10;
int c = 20;
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Here is some math: ");
Serial.print("a = ");
Serial.println(a);
Serial.print("b = ");
Serial.println(b);
Serial.print("c = ");
Serial.println(c);
Serial.print("a + b = "); // add
Serial.println(a + b);
Serial.print("a * c = "); // multiply
Serial.println(a * c);
Serial.print("c / b = "); // divide
Serial.println(c / b);
Serial.print("b - c = "); // subtract
Serial.println(b - c);
}
void loop() {
}
21. Serial Communication
/* * Drive size calculator! */
int drive_gb = 5;
int drive_mb;
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.print("Your HD is ");
Serial.print(drive_gb);
Serial.println(" GB large.");
drive_mb = 1024 * drive_gb;
Serial.print("It can store ");
Serial.print(drive_mb);
Serial.println(" Megabytes!");
}
void loop() // we need this to be here even though its empty
{
}
22. Serial Communication
Type Size
(bits)
Size (bytes) Minimum Value Maximum Value
unsigned byte 8 1 0 255
byte 8 1 -128 127
unsigned int 16 2 0 65535
int 16 2 -32768 32767
unsigned long 32 4 0 4294967295
long 32 4 -2147483648 2147483647
23. Serial Communication
/* * Drive size calculator! */
int drive_gb = 100;
long drive_mb;
long drive_kb;
long real_drive_mb;
long real_drive_kb;
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.print("Your HD is ");
Serial.print(drive_gb);
Serial.println(" GB large.");
drive_mb = drive_gb;
drive_mb = drive_mb * 1024;
drive_kb = drive_mb * 1024;
Serial.print("In theory, it can store ");
Serial.print(drive_mb);
Serial.print(" Megabytes, ");
Serial.print(drive_kb);
Serial.println(" Kilobytes.");
real_drive_mb = drive_gb;
real_drive_mb = real_drive_mb * 1000;
real_drive_kb = real_drive_mb * 1000;
Serial.print("But it really only stores ");
Serial.print(real_drive_mb);
Serial.print(" Megabytes, ");
Serial.print(real_drive_kb);
Serial.println(" Kilobytes.");
Serial.print("You are missing ");
Serial.print(drive_kb - real_drive_kb);
Serial.println(" Kilobytes!");
}
void loop() // run over and over again
{
}
25. Serial Communication (UART communication)
//Transmitter and Recevier
int button = 7;
int LED = 8;
char message; // message character
void setup() {
Serial.begin(9600); // start communication
pinMode(button, INPUT); // input button 1
pinMode(LED, OUTPUT); // input button 2
}
void loop() {
digitalWrite(LED,LOW);
if (Serial.available()) // while message received
{
message = Serial.read(); // read message
if (message == '1') // if the message contain character one
{
digitalWrite(LED, HIGH); // switch led one ON
}
}
if (digitalRead(button)==HIGH) // while button is pushed
{
Serial.write('1'); // send this Character
}
delay(20); // delay before sending next message
}
28. I2C Communication
// Master Code
#include <wire.h>
int x = 0;
void setup() { // Start the I2C Bus as Master
Wire.begin();
}
void loop() {
Wire.beginTransmission(9); // transmit to device #9
Wire.write(x); // sends x
Wire.endTransmission(); // stop transmitting
x++; // Increment x
if (x > 5) x = 0; // `reset x once it gets 6
delay(500);
}
29. I2C Communication
// Slave Code
#include <Wire.h>
int LED = 13;
int x = 0;
void setup() {
pinMode (LED, OUTPUT); // Define the LED pin as Output
Wire.begin(9); // Start the I2C Bus as Slave on address 9
// Attach a function to trigger when something is received.
Wire.onReceive(receiveEvent);
}
void receiveEvent(int bytes) {
x = Wire.read(); // read one character from the I2C
}
void loop() {
if (x == '0') { //If value received is 0 blink LED for 200 ms
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(LED, LOW);
delay(200);
}
//If value received is 3 blink LED for 400 ms
if (x == '3') {
digitalWrite(LED, HIGH);
delay(400);
digitalWrite(LED, LOW);
delay(400);
}
}
32. SPI Communication (Serial Peripheral Interface)
// Master Code
#include <SPI.h>
void setup (void) {
Serial.begin(115200); //set baud rate to 115200 for usart
digitalWrite(SS, HIGH); // disable Slave Select
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV8);//divide the clock by 8
}
void loop (void) {
char c;
digitalWrite(SS, LOW); // enable Slave Select // send test string
for (const char * p = "Hello, world!r" ; c = *p; p++) {
SPI.transfer (c);
Serial.print(c);
}
digitalWrite(SS, HIGH); // disable Slave Select
delay(2000);
}
33. SPI Communication (Serial Peripheral Interface)
// Slave Code
#include <SPI.h>
char buff [50];
volatile byte indx;
volatile boolean process;
void setup (void) {
Serial.begin (115200);
pinMode(MISO, OUTPUT); // have to send on master in so it set as output
SPCR |= _BV(SPE); // turn on SPI in slave mode
indx = 0; // buffer empty
process = false;
SPI.attachInterrupt(); // turn on interrupt
}
ISR (SPI_STC_vect) // SPI interrupt routine {
byte c = SPDR; // read byte from SPI Data Register
if (indx < sizeof buff) {
buff [indx++] = c; // save data in the next index in the array buff
if (c == 'r') //check for the end of the word
process = true;
34. SPI Communication (Serial Peripheral Interface)
}
}
void loop (void) {
if (process) {
process = false; //reset the process
Serial.println (buff); //print the array on serial monitor
indx= 0; //reset button to zero
}
}
35. Some Arduino Projects
1) Arduino-based Home Automation System
2) Smart Irrigation Project
3) Human Following Robot
4) Fire Fighter Robot
5) Medicine Reminder using Arduino
6) Arduino-based Weather Station
7) Digital Thermometer using Arduino
8) Arduino-based Security System
9) LED Light Device using Arduino
10) Soil Moisture Monitoring Arduino
1. Automation Systems using Arduino
2. Arduino-based Clock with Alaram
3. Door Lock System with Arduino
4. Arduino Nano BLE 33 Sense Game Controller
5. Color Detection using TCS-3200 and LCD Display
6. Touch Dimmer circuit
7. Precise Motor speed measurement
8. Gas Detector Arduino project
9. Security System using Ultrasonic Sensor
10.Water flow and volume measurement