Documentation

The area of the WSB Academy in particular reserved for pedestrians is relatively safe, but the shortcomings of certain solutions make it impossible to walk on the roadway in complete safety as a pedestrian or as a driver in a vehicle. The lack of a two-way roadway near the student parking lot, the lack of lights at the pedestrian crossing for the youngest by the elementary school creates a partial danger especially for children, but also for students crossing the roadway, which is not lit. The parking lot, as experience shows, is dangerous and makes it difficult to identify the cause of a hypothetical accident. The lack of cameras in the parking lot makes it difficult to verify testimony and identify the perpetrator, the second currently one-way in part reserved for cyclists makes it extremely difficult to move a car. The main goals of the "Safe pedestrian crossing" project are to create a simpler and automatic alternative to pedestrian crossing lights based on distance sensors operating on an Arduino system, to eliminate the road for cyclists and swap the free space to expand the roadway as a two-way road, and to control monitoring by IP cameras based on three strategic points (parking lot, elementary school, academy), which would automatically provide additional WiFi. Ensuring the safety of the youngest is a priority as much as balancing needs against means, hence the design of alternative less costly and more efficient pedestrian safety lights guided by newly adopted legal amendments putting pedestrians first. The modifications implemented in the area near WSB Academy are divided into the following segments:


The solution is cheaper than a standard light system and works automatically with the sole purpose of warning both sides (pedestrians, drivers). It is in addition to a standard pedestrian crossing, and 360 cameras along with standard complementary ones secure hypothetical evidence.


Scanners with showed area




Scanners without showed area




Network

network


Map

Example image


Arduino


IOT Distance Sensors based on 4 Ultrasonic Distance Sensors




int cm_1_internal_ped = 0;
int cm_2_internal_car = 0;
int cm_1_external_ped = 0;
int cm_2_external_car = 0;
//Read from sensor on DIGITAL INPUT
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
return pulseIn(echoPin, HIGH);
}
void setup()
{
Serial.begin(9600);
//Internal Cars
//Red light
pinMode(12, OUTPUT);
//Green light
pinMode(13, OUTPUT);
//Internal Pedestrians
//Red light
pinMode(2, OUTPUT);
//Green light
pinMode(4, OUTPUT);
//External Cars
//Red light
pinMode(9, OUTPUT);
//Green light
pinMode(6, OUTPUT);
//External Pedestrians
//Red light
pinMode(3, OUTPUT);
//Green light
pinMode(5, OUTPUT);
}
void loop()
{
//Measure the ping time in cm
cm_1_internal_ped = 0.01723 * readUltrasonicDistance(7, 7);//Internal pedestrians
cm_2_internal_car = 0.01723 * readUltrasonicDistance(8, 8);//Internal cars
cm_1_external_ped = 0.01723 * readUltrasonicDistance(11, 11);//External pedestrians
cm_2_external_car = 0.01723 * readUltrasonicDistance(10, 10);//External car
//Switch on LED lights - pedastrians logic
if (cm_1_internal_ped <= 75 || cm_1_external_ped <= 75)//750
{
digitalWrite(2, LOW);
digitalWrite(4, HIGH);
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
digitalWrite(9, LOW);
digitalWrite(6, LOW);
digitalWrite(3, LOW);
digitalWrite(5, HIGH);
}
else if (cm_1_internal_ped > 75 || cm_1_external_ped > 75)//750
{
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, HIGH);
digitalWrite(3, LOW);
digitalWrite(5, LOW);
}
else if (cm_1_internal_ped > 75 || cm_1_external_ped > 75 && cm_2_internal_car > 11 || cm_2_external_car > 11)//1100
{
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
digitalWrite(9, LOW);
digitalWrite(6, HIGH);
digitalWrite(3, LOW);
digitalWrite(5, LOW);
}
//Print values
Serial.print("INT PEDEST:");
Serial.print(cm_1_internal_ped);
Serial.print("cm | INT CAR:");
Serial.print(cm_2_internal_car);
Serial.print("cm || ");
Serial.print("EXT PEDEST:");
Serial.print(cm_1_external_ped);
Serial.print("cm | EXT CAR:");
Serial.print(cm_2_external_car);
Serial.println("cm");
//Wait for 100 millisecond(s)
delay(1000);
}



IOT Distance Sensors based on 1 HC-SR04 Distance Sensor




#include <LiquidCrystal.h>
int inches = 0;
int cm = 0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
pinMode(8, OUTPUT);
pinMode(7, INPUT);
}
void loop()
{
lcd.clear();
cm = readUltrasonicDistance(8, 7)*0.034/2;
inches = readUltrasonicDistance(8, 7)*0.0133/2;
lcd.setCursor(0, 0);
lcd.print("cm: ");
lcd.setCursor(4,0);
lcd.print(cm);
lcd.setCursor(0,1);
lcd.print("inch: ");
lcd.setCursor(6,1);
lcd.print(inches);
delay(100);
}
long readUltrasonicDistance(int trigPin, int echoPin)
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
return pulseIn(echoPin, HIGH);
}



IOT Distance Sensors based on 1 Ultrasonic Distance Sensor




#include <LiquidCrystal.h>
int inches = 0;
int cm = 0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
pinMode(8, OUTPUT);
pinMode(7, INPUT);
}
void loop()
{
lcd.clear();
cm = readUltrasonicDistance(8, 7)*0.034/2;
inches = readUltrasonicDistance(8, 7)*0.0133/2;
lcd.setCursor(0, 0);
lcd.print("cm: ");
lcd.setCursor(4,0);
lcd.print(cm);
lcd.setCursor(0,1);
lcd.print("inch: ");
lcd.setCursor(6,1);
lcd.print(inches);
delay(100);
}
long readUltrasonicDistance(int trigPin, int echoPin)
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
return pulseIn(echoPin, HIGH);
}