You are on page 1of 6

Components required:

1. Dual axis Accelerometer

2. 4x 10k potentiometer

3. LM324 OP-AMP IC

4. HT12E+HT12D encoder decoder pair

5. ASK RF Transmitter and Receiver pair

6. L293D Motor Driver IC

7. 2x DC motors

8. 2x wheels

9. Castor wheel

10. Chassis

11. Breadboards

12. Wires

Block Diagram:

Accelerometer

As the name says, accelerometers are sensors used to sense the proper acceleration in a given axis.
The one I am using is a MMA7361L three-axis accelerometer module (i.e. x, y and z) however we will be using
only two axes (x and y).

LM324 Op-Amp

LM324 consists of four operational amplifiers which we would use as comparators. One of the inputs of each op-
amp would be connected to the accelerometer’s output. And other inputs would be connected to their respective
potentiometers which would be tuned later to give the required digital output.

We need four different combinations (For Forward, backward, right and left).

Imagine your hand as the accelerometer. The direction your fingers point to is the positive Y direction and
opposite to it is the negative Y. Perpendicular to your fingers, X axis exists.
Now at normal position (accelerometer parallel to ground), the X and Y outputs of the sensors gives a fixed
analog voltage. Read it using a multi-meter. Below are the values I got from my sensor when in normal position
and then after tilting the sensor as shown in the diagram above.

VOLTAGE
TILT DIRECTION
READING

(in Volts) NO TILT FORWARD BACKWARD RIGHT LEFT

X 1.65 NA NA 2.3 1.1

Y 1.65 2.2 1.1 NA NA

Now depending on these voltage values, we need to tune the potentiometers to get the correct digital output.
Consider the following diagram

Now depending on these voltage values, we need to tune the potentiometers to get the correct digital output.
Consider the following diagram Here Vx is the analog voltage coming from the X output; V1 and V2 are output
voltages of the potentiometers. Remember V2 > V1. The circuit follows the below table:

Conditions Output 1 Output 2

Vx > V2 LOW HIGH


Vx < V1 HIGH LOW

V2>Vx>V1 LOW LOW

So we need to adjust V1, V2 values (using the potentiometer) based on the reading we got and the above table.

You can see a demonstration in the video at the end. I connected LEDs to the output pins to see its state.

Similarly we do this for Y output also.

Then we would get the below 4-bit output from the LM324 IC:

Tilt Direction O1 O2 O3 O4

FORWARD 1 0 0 0

BACKWARD 0 1 0 0

RIGHT 0 0 1 0

LEFT 0 0 0 1

Motor Driver
We will be using L293D motor driver which can control two motors bi-directionally. The reason we use a motor
driver is because circuits (most of them)/ microcontroller work at a different voltage level when compared to the
motor and they cannot provide enough current to the motors. L293D has 4 inputs and 4 output terminals. Here
is a table showing the input combinations and corresponding outputs.
INPUTS MOTOR DIRECTION ROBOT’S MOTION

I2 I3 I4 LEFT MOTOR RIGHT MOTOR


I1

0 0 1 ANTI CLOCKWISE CLOCKWISE FORWARD


1

1 1 0 CLOCKWISE ANTI CLOCKWISE BACKWARD


0

0 1 0 ANTI CLOCKWISE ANTI CLOCKWISE RIGHT


1

1 0 1 CLOCKWISE CLOCKWISE LEFT


0

Why was a microcontroller needed?


Well if you carefully compare the output table of LM324 IC and the Input table for Motor driver, you would notice
a problem.

COMPARATOR OUTPUT MOTOR DRIVER INPUT DIRECTION

O1 O2 O3 O4 I1 I2 I3 I4

1 0 0 0 1 0 0 1 FORWARD

0 1 0 0 0 1 1 0 BACKWARD

0 0 1 0 1 0 1 0 RIGHT

0 0 0 1 0 1 0 1 LEFT

Out of 4bits coming from the comparator, only one is high at a time whereas for motor driver, to drive the
motors correctly requires two bits to be high and that too in a particular order. That’s where the microcontroller
comes into play. We program it in such a way that it takes in the output from the comparator and gives out the
correct sequence to the motor driver. Like this:

If (input==1000) output=1001;
Else if (input==0100) output=0110;
Else if (input==0010) output=1010;
Else if (input==0001) output=0101;

How I eliminated the microcontroller?


For this, we simply used an extra IC in place of the microcontroller i.e. a quad 2-input or gate IC. Look at the
diagram below. Tally the values of above table with the diagram and equations.
Fig. : Circuit Diagram of Digital Gates used in place of Microcontroller to control movement of
Robotic Car
At Gate A, I1 = O1 + O3
Gate B, I2 = O2 + O4
Gate C, I3 = O3 + O2
Gate D, I4 = O4 + O1

Now that we are done with our designing, let’s move on to the next part.

Hardware Setup:
 Gather all the parts shown in the image.
 Attach the motors to the chassis and then the wheels to the axle.
 Arrange the transmitter and receiver circuit as per the circuit diagram.
 Connect the motors to the motor driver output, and power both the transmitter and receiver. That’s it!
You are ready to go!
 Arrange the transmitter and receiver circuit as per the circuit diagram.
 Connect the motors to the motor driver output, and power both the transmitter and receiver. That’s it!
You are ready to go!
Circuit Diagram:

Transmitter:

Receiver:

You might also like