0% found this document useful (0 votes)
79 views9 pages

Iot Auto LabTask 3

This document summarizes a lab task to design an intelligent smart parking system with dynamic cost allocation using an Arduino Uno, WiFi module, ultrasonic sensor, PIR sensor, servos, LCD display, and ThingSpeak platform. The system opens entry and exit gates based on sensor readings, displays the parking cost on an LCD, and sends real-time data to ThingSpeak. The cost increases as parking occupancy rises. The design was tested and able to dynamically allocate cost and send data to the cloud platform.

Uploaded by

Chaithanya Reddy
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)
79 views9 pages

Iot Auto LabTask 3

This document summarizes a lab task to design an intelligent smart parking system with dynamic cost allocation using an Arduino Uno, WiFi module, ultrasonic sensor, PIR sensor, servos, LCD display, and ThingSpeak platform. The system opens entry and exit gates based on sensor readings, displays the parking cost on an LCD, and sends real-time data to ThingSpeak. The cost increases as parking occupancy rises. The design was tested and able to dynamically allocate cost and send data to the cloud platform.

Uploaded by

Chaithanya Reddy
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

Lab Task-3

Name: Nithish kumar Ravella.


Reg No: 18BIS0033.
Course: IoT in Automotive Systems.
Course Code: ECE3033.
Faculty: Dr. Suresh Chavhan.

Page 1 of 9

Aim:
To design Intelligent Smart Parking System(Dynamic cost allocated) with WiFi module and feed
the data to the ThingSpeak

Components Required:
1. Arduino Uno-1
2. Relay SPDT-1
3. Resisters(different resistances)
4. RGB Led-1
5. Jumping wire
6. ESP8266 Module
7. LCD 16x2- 1
8. Micro Servo- 2
9. Ultrasonic Distance Sensor- 1
10. PIR Sensor- 1
11. NeoPixel Ring- 1
12. Tinkercad, ThingSpeak Platform

Procedure:
1. Design the circuit as shown below with above listed components

2. Now, we need to write the logic in the code section and have to execute. Here the cost of
parking is allocated dynamically and every time the LCD shows the parking cost/hour.
3. Next we need to test the design by entering the vehicles from Entry Gate and leaving the
vehicle from Exit Gate. The results are shown below at different scenario.
Page 2 of 9

Results:

Fig.1 Developed design after simulation

Fig.2 When the vehicle enters the entry gate(dis.<50cm) then Entry Gate opens, free slots and charge is displayed

Page 3 of 9

• The cost is directly proportional to No. Of Vehicles parked. If the free slots are less then charge
would be high accordingly.
• We can also observe the free slots and parked slots over NeoPixel Ring. Each and every time
when ever a vehicle enters the data is saved in ThingSpeak in graph formate with costs.

Fig.3 When the vehicle leaves then Exit Gate opens and charge is displayed on LCD

Working:
• When the Ultra-Sonic sensor detects a vehicle, the entry gate opens, and after a certain amount
of time, the gate closes automatically. Similarly, at exit, the PIR Sensor detects movement and
opens the Exit Gate to allow vehicle movement.
• The cost is proportionate to the number of parked vehicles. If there are fewer free spots, the cost
will be higher.
• The data feed for the system is shown in the ThingSpeak as shown below figure.

Page 4 of 9

Fig.4 Data feed for the system is shown in the ThingSpeak

• Vehicles and Charges/Hour is shown, the as the no. of vehicles increases the charge
increases(since free slots becomes less, so will cost increases)

Conclusion:
We have successfully designed the Intelligent Smart Parking System(Dynamic cost allocated) with
WiFi module and feed the data to the ThingSpeak. This can be applied in real world scenario for
real time analytics of parking systems.

Page 5 of 9

Appendix:
Code for designed logic:
#include <LiquidCrystal.h>
#include <Adafruit_NeoPixel.h>
#include <Servo.h>

String ssid = "Simulator Wifi"; // SSID to connect to


String password = ""; //virtual wifi has no password
String host = "api.thingspeak.com"; // Open Weather Map API
const int httpPort = 80;
String url = "/update?api_key=0N7RMXEC0AXG9I4T";

void setupESP8266(void) {

// Start our ESP8266 Serial Communication


Serial.begin(115200); // Serial connection over USB to computer
Serial.println("AT"); // Serial connection on Tx / Rx port to ESP8266
delay(10); // Wait a little for the ESP to respond
if (Serial.find("OK"))
Serial.println("ESP8266 OK!!!");

// Connect to Simulator Wifi


Serial.println("AT+CWJAP=\"" + ssid + "\",\"" + password + "\"");
delay(10); // Wait a little for the ESP to respond
if (Serial.find("OK"))
Serial.println("Connected to WiFi!!!");

// Open TCP connection to the host:


//ESP8266 connects to the server as a TCP client.

Serial.println("AT+CIPSTART=\"TCP\",\"" + host + "\"," + httpPort);


delay(50); // Wait a little for the ESP to respond
if (Serial.find("OK"))
Serial.println("ESP8266 Connected to server!!!") ;

void thingspeakWrite(int a0, int a1) {

// Construct our HTTP call


String httpPacket = "GET " + url + "&field1=" +String(a0) + "&field2=" +
String(a1) + " HTTP/1.1\r\nHost: " + host + "\r\n\r\n";
int length = httpPacket.length();

// Send our message length


Serial.print("AT+CIPSEND=");
Serial.println(length);
delay(10); // Wait a little for the ESP to respond if (!Serial.find(">"))
return -1;

// Send our http request


Serial.print(httpPacket);
delay(10); // Wait a little for the ESP to respond
if (Serial.find("SEND OK\r\n"))
Serial.println("ESP8266 sends data to the server");

#define servopin 7
#define selectpin 8
#define pir 13
Servo myservo;
Page 6 of 9

int ledPin= 9;
int ledNo= 12;

Adafruit_NeoPixel strip= Adafruit_NeoPixel(ledNo,ledPin,NEO_RGB+NEO_KHZ800);

// initialize the library with the numbers of the interface pins


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

char red=A0;
char green=A1;
int cars=0;
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT); // Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
// Sets the trigger pin to HIGH state for 10 microseconds
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return 2*pulseIn(echoPin, HIGH);
}

void ringled(int c){

for(int i = 0; i < c; i++)


strip.setPixelColor(i,strip.Color(0,50,0));//g,r,b

for(int i=c;i < ledNo;i++)


strip.setPixelColor(i,strip.Color(50,0,0));

strip.show();

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
Serial.begin(9600);
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(selectpin, OUTPUT);
ringled(0);
myservo.attach(servopin);
myservo.write(0);

pinMode(pir,INPUT);
setupESP8266();
}

int price()
{
int free_slots = 12 - cars;
return 18 - free_slots;
}

void checkpwd()
{
delay(1000);
cars+=1;
Page 7 of 9

ringled(cars);

lcd.setCursor(0, 0);
lcd.print("Free Slots - "+String(12-cars));

delay(1000);

lcd.setCursor(0, 1);
lcd.print(String(price())+"$ /hour");

digitalWrite(selectpin, LOW);

for(int i=0;i<=90;i+=1)
{
myservo.write(i);
delay(50);

for(int i=90;i>=0;i-=1)
{
myservo.write(i);
delay(50);

int flag = 0;

void loop() {
lcd.setCursor(0, 0);
int cm = 0.01723 * readUltrasonicDistance(6,6);
Serial.println(cm);

if (cm > 100)


{
flag = 0;
lcd.clear();
lcd.print("Waiting");

if(cm <= 100 && flag==0){


flag = 1;
lcd.clear();
lcd.print("Welcome ");
checkpwd();
}
else if(digitalRead(pir)==HIGH)
{
lcd.clear();
lcd.print("Exiting.... ");
delay(50);
lcd.clear();
lcd.print(String(price())+"$ /hour");
cars-=1;
ringled(cars);

digitalWrite(selectpin, HIGH);

for(int i=0;i<=90;i+=1)
{
myservo.write(i);
Page 8 of 9

delay(10);
}

for(int i=90;i>=0;i-=1)
{
myservo.write(i);
delay(10);
}
}

thingspeakWrite(cars, price());
}

Page 9 of 9

You might also like