Skip to content

Toy car that autonomously positions itself into a parking space.

License

Notifications You must be signed in to change notification settings

badea-codrut-cti/proiect-robotica

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self Parking Toy Car

Introduction

The project consists of a toy car that, when placed in the general direction of a a parking space, it will try to steer itself into said parking space. A parking space is determined by three obstacles and an opening, i.e two parked cars and a wall. The car will use two ultrasonic sensors to measure the distance on its front left and front right and determine whether it is approaching an obstacle and in which direction. With that information, it will try to steer itself away from said obstacle. It will consider the parking maneuver finished once it gets close enough to the wall (which is determined by both sensors reporting similar distances).

General Description

general description

Hardware Design

schematic

Element Quantity Source
DC Motor 2 Bought
SR90 Servo 1 Bought
L298N 1 Bought
HC-SR04 2 Faculty
Arduino Uno 1 Faculty
1.5V Battery Driver 1 Faculty
1.5V Battery 4 Bought
9V Battery 1 Bought

Pin Objectives

  • D2: Connected to the start switch.
  • D3: Receives the echo response from the right ultrasonic sensor.
  • D4: Receives the echo response from the left ultrasonic sensor.
  • D8: Connected to the H-bridge, controls the voltage on the positive terminal of the left DC motor.
  • D9: Connected to the H-bridge, controls the voltage on the negative terminal of the left DC motor.
  • D10: Connected to the H-bridge, controls the voltage on the positive terminal of the right DC motor.
  • D11: Connected to the H-bridge, controls the voltage on the negative terminal of the right DC motor.
  • D12: Sends a trigger signal to the right ultrasonic sensor.
  • D13: Sends a trigger signal to the left ultrasonic sensor.

design-front design-back design-top

Software Design

Whether parking should start is dictated by a push button whose pin is configured with an interrupt on the falling edge. Debouncing is handled using a variable that keeps track of the last time the button was pressed as a timestamp in milliseconds since the microcontroller has been powered on. If the difference between the current timestamp and the timestamp stored in the variable is below the pre-defined threshold, the button press would be ignored.

Subsequent button presses would delay when parking initiates, as once the button is pressed, a two second countdown will start before the car begins to park itself.

The source code contains a function for measuring the distance between the frontal sensors and potential obstacles. The function works by sending an input to the HC-SR04 sensors and waiting for an echo using pulseIn.

Those results are stored in two global variables and are later processed in a function that handles steering. The function first checks if it should proceed with parking (if it is in park mode and if the time between being put in park mode and the current timestamp is greater than two seconds), then it checks if either of the sensors is closer to an obstacle than the stopping threshold, in which case it will end the parking maneuver. If that is not the case, it then checks if the deviation between the distances reported by the two frontal sensors are less than a pre-defined percentage, which would make the car go forward. If the distance is skewed to either direction, the car will steer in the opposite direction to avoid the obstacle.

Documented Results

The car is able to steer itself into the parking space, but in a situation where the car is surrounded by three obstacles and an entrance, it might misidentify which one of the three obstacles is the wall and which ones are the adjacent cars if the steering angle is heavily skewed towards one of the parked cars. This can cause a situation where the car is parked sideways on its lot.

WhatsApp.Video.2025-01-08.at.13.19.20.mp4

Conclusion

The project offered me the opportunity to apply my 3D modeling knowledge in order to create the designs for the steering system, chassis and back axle. It also served as an opportunity to use programming as a means to solving a real world issue.

Biography

About

Toy car that autonomously positions itself into a parking space.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages