1. Introduction

Robotics is a fun way to delve into DC circuitry and digital logic. For this project, you will use the information learned in previous weeks to assemble a car that follows a line.
The car can follow the line by using infrared (IR) sensors to move with the absence or presence of infrared light. The sensors used in this tutorial have been modularized for you.
These modules consist of an IR transmitting light emitting diode (LED) that emits only infrared light, an IR phototransistor, a potentiometer, a dual differential comparator chip,
and two regular LEDs; one to indicate power, and another to indicate a change is detected.

The IR phototransistor is a diode with a special coating that only lets infrared light pass through. It acts as a resistor that is affected by the amount of light that contacts it's surface;
with a resistance of around 1k ohms when light is detected, and around 1 million ohms when no light is detected.

A potentiometer is a type of resistor that has a resistance value that can dimmed or enhanced by turning a knob. It's being used in this circuit as an open amplifier, or "op-amp," for an open loop gain.
The open loop gain being so high is what keeps the output voltage of the comparator at an extreme; converting the output to discrete, digital outcomes of low, 0V, and high, maximum voltage.

The dual differential comparator chip is being used to convert the signal of the IR phototransistor from an analog signal to a digital signal by comparing the reference voltage, from the voltage dividing op-amp,
to the voltage being sent from the phototransistor, and amplifying the difference to the closest extreme value.

Digital signals have discrete potential values that are used to represent Boolean bits. When the potential is low, at 0 volts, it sends a 0, and when the potential is high, at the maximum available voltage,
it sends a 1. Because of this, the signal comes out as a square wave on a timing chart. The diagram could look like this:

Analog signals are not discrete in potential, and can look like triangle waves when plotted over time; which could look like this:

The signal from the module is sent to a driver. The driver uses digital logic to control the motors. The driver then executes the logic through the motors.
The logic the driver uses for the different steering movements are shown in the figure below:

American Journal of Physics85, 333 (2017); doi: 10.1119/1.4979648

This figure is a snippet from a PDF that can be found here. It has more details about this project.

2. Materials

Various Fastening Pieces
 Bolts/Stand-offs Quantity M3*30 4 M3*10 2 M3*6 8 M3*5 2 M3 nut pieces 8 M3 washer pieces 4 M3*6+6 Standoff 4 L12 Standoff 4

Car Components
 Component Quantity Baseboard 1 Hammer Caster Wheel 1 Motor Fasteners 4 Encoder Discs 2 Wheels 2 Deceleration DC Motors 2 3.7V Batteries 2 Battery Pack 1

Tools/Wires
 Screwdriver Small/Needle-nose Pliers Wire Cutters/Strippers Wire for Connections Breadboard Soldering Iron Solder(60/40)

Modules
 Type Quantity IR Sensor Modules 2 DC-DC Converter 1 I2C L293D Driver 1 MC14049U Inverter 1

3. Instructions

Part I - Assembling the Car

If there is an instruction sheet in your kit, please disregard it. You will be using a different battery pack that already has a switch, so the layout will be different for us.
You also may need to peel a protective coating off of the baseboard, encoder wheels, and the fasteners before you begin.

Here is the map of the car's component layout:

Attach an encoder disc to a protruding arm of each deceleration DC motor. The motors look like they have a button on a side. These are not buttons, but you can use them to orient your motors on the baseboard.
Have them facing away from each other and put the encoder discs on the arms that will be facing each other as shown in the figure below.

You may need to solder the wires to the motors. If this is the case, you can find some tips on how to do that here.

Attach the motors to the frame by taking two of the T-shaped fasteners and inserting one on each side of the chassis as shown in the figure below.
I find it easier to attach one motor at a time.  Flip the chassis over while holding the T-shaped fasteners in place. Position the motors with the discs towards the front of the car,
and sandwich the motors with the other two fasteners by fitting them in the grooves on the outer edge of the frame, and secure them with two M3*30 bolts with nuts per motor.

Once the motors are on the frame, the wheels can be attached. Push the two large wheels onto the outer arms of the motors. Attach the smaller caster wheel to the underside of the frame.
Do this by using all of the L12 standoffs, and all of the M3*6 bolts. The standoffs will keep the car level.  The figure below shows the bottom of the car after the wheels are attached.

The battery pack will be attached next. You may need to solder the wires of the battery pack to a DC power cable with a male end.
Attach the battery pack to the topside of the car by using the two M3*10 bolts with the flat heads, and two nuts.
Line the two bottom holes of the battery pack up to the holes in the car that are shown in the figure below, and secure it to the board.

After the battery pack is secured, attach the IR sensor modules to the front of the car. To do this, we need to use the four M3*6+6 standoffs, four M3 washers, two M3 nuts, and two M3*5 bolts.
Connect two standoffs to each other. This offsets the sensors closer to the ground while leaving room to access the potentiometer. This will help when troubleshooting and calibrating the sensors.
Install the standoff to the chassis by inserting the skinny end into the long hole that is outlined with purple, as shown, from underneath the frame. Add another washer to the topside, and secure it with a nut.
Once the standoffs are secure, the sensor modules can be mounted. With the IR LED and photoreceptor facing downwards, align the hole with the standoff from underneath the car,
and secure it to the standoff with the M3*5 bolt. Use a screwdriver to secure the bolt. Small pliers may be used to secure the nuts on the topside of the car.

A demonstration of this can be found in the video below:

The car should now look similar to this:
Top view:

Bottom view:

Now the circuit can be built.

Part 2 - Creating the Circuit

The circuit of the car will be as shown in the figure below. The details of the IR sensor modules and power supply are not shown here,
as they are being treated as black boxes in this schematic.

The rectangle labeled "5V" represents the power supply; The power supply is composed of the battery pack that holds two 3.7V batteries,
and a DC-DC converter. This converts a power supply of up to 12V down to either 5V or 3.3V. We will be using the 5V option in this circuit.
We will be converting the 7.4V supply down to 5V to control the speed of the motors.

The square boxes represent the sensor modules, and the circuit schematic of the module can be found here.
The circles labeled "M" represent the DC motors. The colored dots represent connections.
The chip on the left represents the inverter. The data sheet for the one used can be found here.
The chip on the right represents the driver. The data sheet for this driver can be found here.

The modules should have the pins labeled for you. The pin labeled "VCC" will power the module's circuit, and the pin labeled "GND" will ground the sensor's circuit.
The pin labeled "DO" will send the output as a digital signal. The pin labeled "AO" will output the signal as an analogue signal; we will not be using this pin.

The pin-out maps of the inverter and driver are as shown in the figures below.

For the driver:

For the inverter:

The circuit schematic for the DC-DC converter is as shown in this figure; the 5V supply output is the circuit of focus:

Once the circuit has been built on the small breadboard, the sensors can be aligned and calibrated.
Remember to always be careful when adjusting your sensors with the power on.
You may slip and create a short with your screwdriver!
It may be a good idea to turn the power off when doing this to prevent this from happening!
The final result should look similar to this:

"Not-grimace" is not included with your kits; he's just the passenger.

Here is a demonstration of the car following the black lined track both clockwise and counter-clockwise: