The objective of this project was to create and program a miniature obstacle-avoiding car. The car's electronic components are shown below. A L293D Motor Driver Shield was interfaced on top of an Ardunio UNO. The motor driver shield is powered by a 6 V battery pack. The Motor Driver Shield powers two DC motors for the car wheels and an HC-SR04 Ultrasonic Sensor. When the sensor detects an obstacle within 15 cm in front of it, the car turns until it doesn't detect an obstacle anymore.
Below are schematics of the connections between the Arduino UNO, 74HC595 Shift Register, and L293D Motor Driver Chip (used to power the two motors). The shift register and motor driver chip are components of the L293D Motor Driver Shield.
The Arduino UNO outputs SER, LATCH, CLK, and EN to the 74HC595 Shift Register. The Aruino UNO also outputs PWM1 and PWM2 to the L293D Motor Driver. SER, LATCH, CLK, PWM1 and PWM2 outputs are driven by programming code.
For the 74HC595 Shift Register, when the input LATCH is driven high, the contents of the shift register are copied into the storage register, which is outputted at the QA-QH output pins to the Motor Driver Chip. SER inputs data into the shift register one bit at a time. EN enables the shift register when it is low. CLK is the clock for the shift register. A bit is transferred into the shift register every time the clock signal goes high. PWM1 and PWM2 enables their respective side of the L293D Motor Driver Chip and controls the speed of the connected motor using pulse width modulation. The M1A, M1B, M2A, and M2B outputs from the shift register control the direction of rotation of the two motors. The SCL pin resets all of the shift register's bits to 0 when it is set to low. By default, it is high by being connected to the supply voltage.
For the L293D Motor Driver, pin 1 and 9 enable the integrated circuit and control the speed of the connected motors. Pins 3 and 6 are connected to the terminals of one motor while pins 11 and 14 are connected to the terminals of the other motor. Pins 2, 7, 10, and 15 control the directions of rotation of the motors. Pins 4, 5 and 12, 13 are ground pins. Pins 8 and 16 are the supply voltage.