## Requirements To implement this project, 1 RS-550 12-24V 22000rpm DC Motor, 1 BTS7960 43A Dual H-Bridge Motor Driver Circuit, 1 Buzzer and 24V 1.5A Adapter were used to control the speed of this motor. In addition that in order to show the distance, In addition that an internal 7-Segment Display was used on the FPGA. ### Ultrasonic Distance Sensor - MaxSonar MB7360 The HRXL-MaxSonar-WR sensor line provides high accuracy and high resolution ultrasonic proximity detection and ranging in air. This sensor line features 1-mm resolution, target-size and operating-voltage compensation for improved accuracy, superior rejection of outside noise sources, internal speed-of-sound temperature compensation and optional external speed-of-sound temperature compensation. The sensor can give us 3 types of output. These are 1-Analog Output, 2- RS232 Serial Output, 3- PW Output. In this project, PW Output was used to measure the distance. To explain this output method simply, the Sensor starts emitting the ultrasonic wave continuously. When it hits an obstacle and comes back, it gives the distance to the user through its own circuit. - Range Information is output with a high pulse width between 300uS(for 30cm distance) and 5000uS(for 5m distance) - The measured distance (in mm) will be shown on the seven-segment display in decimal form. ![Sensor Schematic](images/sensorpicture.png) ### DC Motor Driver - BTS7960 43A Dual H-Bridge The BTS7960 is a fully integrated high current H bridge module for motor drive applications. ![BTS7960 Pins](images/driverpic.png) Changing the polarity of the power supply to DC motor is used to change the direction of rotation. Apart from changing the rotation direction, the H-bridge can provide additional operation mode, "brake" and "free run until frictional stop". The H-bridge arrangement is generally used to reverse the polarity/direction of the motor, but can also be used to 'brake' the motor, where the motor comes to a sudden stop, as the motor's terminals are shorted. In shorted case, the kinetic energy of a rotating motor consumed rapidly in form of electrical current in the shorted circuit. The other case, to let the motor 'free run' to a stop, as the motor is effectively disconnected from the circuit. The following table summarizes operation, with S1-S4 corresponding to the diagram above. In the table below, "1" is used to represent "on" state of the switch, "0" to represent the "off" state. The general schematic and truth table of the motor driver circuit are shown below. This is exactly the logic of the motor driver used in the project. ![H-Bridge Schematic](images/hbridge.png) | S1 | S2 | S3 | S4 | Result | | :---: | :-: | :-: | :-: | :---: | | 1 | 0 | 0 | 1 | Motor moves right | | 0 | 1 | 1 | 0 | Motor moves left | | 0 | 0 | 0 | 0 | Motor Coasts | | 0 | 0 | 0 | 0 | Motor Coasts | | 1 | 1 | 0 | 0 | Motor Coasts | | 0 | 0 | 1 | 0 | Motor Coasts | | 0 | 0 | 0 | 1 | Motor Coasts | | 0 | 1 | 0 | 1 | Motor Brakes | | 0 | 0 | 1 | 0 | Motor Brakes | | X | X | 1 | 1 | Short Circuit | | 1 | 1 | X | X | Short Circuit | ### Buzzer After measuring the distance from the ultrasonic distance sensor, it is aimed to make a sound from the buzzer to warn the user when the distance drops below 50cm. A police siren sound will be produced by using various frequency ranges in a flat sound place. I will talk about the details in the implementatiton section.