This shows you the differences between two versions of the page.
pm:prj2022:apredescu:automatedparking [2022/05/26 11:04] mathis.vaugeois [Results Obtained] |
pm:prj2022:apredescu:automatedparking [2022/05/27 10:06] (current) mathis.vaugeois [Hardware Design] |
||
---|---|---|---|
Line 10: | Line 10: | ||
Block Diagram of the project : | Block Diagram of the project : | ||
- | {{ :pm:prj2022:apredescu:block_diagram_automated_parking_v2.png |}} | + | {{ :pm:prj2022:apredescu:block_diagram_automated_parking.jpg?500 |}} |
===== Hardware Design ===== | ===== Hardware Design ===== | ||
<note tip>To create this project, i used an Arduino Uno R3, 5 HC-SR04 Ultrasonic Sensors, 2 SG90 Micro Servo Motors, a 1602 LCD with I2C Interface, 4 Infrared Obstacle Sensors and wires </note> | <note tip>To create this project, i used an Arduino Uno R3, 5 HC-SR04 Ultrasonic Sensors, 2 SG90 Micro Servo Motors, a 1602 LCD with I2C Interface, 4 Infrared Obstacle Sensors and wires </note> | ||
- | {{ :pm:prj2022:apredescu:scheme_electric_parking.png?600 |}} | + | {{ :pm:prj2022:apredescu:scheme_electric_parking.jpg?600 |}} |
- | {{ :pm:prj2022:apredescu:diagram_eletric_parking.png?600 |}} | + | {{ :pm:prj2022:apredescu:diagram_eletric_parking.jpg?600 |}} |
===== Software Design ===== | ===== Software Design ===== | ||
- | The project is suppose to detect a car at the entrance or exit and open the coresponding gate and verify the number of parking place availible for printing the result into the LCD screen. The detection for the gate are made with the infrared obstacle sensor who send back an high level when an obstacle is detected. If there is a car detected, we open the gate and keep it open until the two sensor stop sending high level. For the parking place, those check the distance of object in front of it so if a value is small enough then the parking place is taken. The LCD screen print the result with some text. I'm using "library" to help me with my code in the arduino program. | + | The project is suppose to detect a car at the entrance or exit and open the coresponding gate and verify the number of parking place availible for printing the result into the LCD screen. The detection for the gate are made with the infrared obstacle sensor who send back an high level when an obstacle is detected. If there is a car detected, we open the gate and keep it open until the two sensor stop sending high level. For the parking place, those check the distance of object in front of it so if a value is small enough then the parking place is taken. The LCD screen print the result with some text. I'm using libraries to help me with my code in the arduino program. |
+ | |||
+ | <note tip>This libraries are Ultrasonic.h, Wire.h, LiquidCrystal_I2C.h and Servo.h.</note> | ||
+ | //Ultrasonic// is used to define verible for the ultrasonic sensor and ease to recuperate the data form them. //LiquidCrystal_I2C// help to configurate the LCD screen by I2C and add method to clear and print string on it. Meanwhile, //Servo// does the same than Ultrasonic but for servomotors. | ||
+ | |||
+ | To ease the connection of the arduino, i'm defining each pin for their use : all the pin between 2 and 9 are use by the Ultrasonic sensor and those between 11 and 14 are for IR sensor. For the LCD screen, it need to be connected on SDA and SCL on the pin A4 and A5 while i define A2 and A3 for the entry and exit servo. | ||
+ | |||
+ | Then comes the setup where i define the data rate. | ||
+ | <note>Serial.begin(9600);</note> | ||
+ | I initialise the LCD screen, i add a backlight to it to ease the reading on it. For the IR sensor, i place the pin in Input mode to recieve the data. And for the servo, i use the .attach() methods to create the variable Entrance_servo and Exit_servo with the pin, the minimum and maximum as parameters. | ||
+ | |||
+ | <note>Entrance_servo.attach(EntryServo, 1000, 2000);</note> | ||
+ | |||
+ | For the loop, i just called function i created to split the diffrent part of the project. | ||
+ | We can find UltrasonicDistance that recuperate the distance for the sensors. | ||
+ | <note>void UltrasonicDistance()</note> | ||
+ | PlaceUpdate that compare the distance with the integer cm to see if a place is taken. | ||
+ | <note>void PlaceUpdate()</note> | ||
+ | LCDUpdate that do as it said (it update the screen). | ||
+ | <note>void LCDUpdate()</note> | ||
+ | IRUpdate that check the Ir sensor and store their state. | ||
+ | <note>void IRUpdate()</note> | ||
+ | DoorEntryCheck and DoorExitCheck that move the servo based on the state of infrared sensor. | ||
+ | <note> | ||
+ | void DoorEntryCheck() | ||
+ | void DoorExitCheck() | ||
+ | </note> | ||