Logic Report 23100874
Logic Report 23100874
Navigation
ID: 23100874
Major: Mechatronics Engineering
1
Introduction:
Mechatronic systems tightly integrate mechanical parts, electronics,
sensors, actuators, and digital controllers. In mobile robots, digital logic
forms the “brain” that processes sensor inputs and drives actuators.
Digital logic gates (AND, OR, NOT, etc.) make binary decisions on sensor
signals electronics, enabling robots to respond quickly to their
environment. Field-Programmable Gate Arrays (FPGAs) and dedicated
logic chips can run many operations in parallel, allowing a single FPGA to
handle multiple sensors and motors simultaneously For example, FPGAs
are popular in obstacle-avoidance robots because they exploit
concurrency: one chip can read several range sensors and issue motor
commands in real time, something a single microprocessor might struggle
with under tight timing. Overall, digital logic (whether in discrete gates or as
embedded firmware) provides reliable, deterministic control in mobile
robots, complementing analog circuits (for sensors) and mechanical
actuators.
3
Once digitized, sensor signals can be combined or encoded. Multiple IR
sensors can be wired to logic gates directly. For instance, in a line-follower
robot one might OR or AND sensor outputs to detect if any sensor sees the
line. Care must be taken to avoid floating inputs (unused sensor outputs
can be tied low or handled as “don’t care” conditions). Digital filtering (e.g.
simple debouncing or majority voting) can also be done with logic gates if
needed. In summary, sensors form a “front end” of analog thresholds and
comparators, producing digital signals that feed the robot’s navigation
logic.
4
1
1
1 (line) 1 (line) (forward On track – go forward
(forward)
)
1 (line) 0 (no line) 0 1 Line is on left – turn left
0 (no Line is on right – turn
1 (line) 1 0
line) right
In this table, each “1” input means the IR sensor detects the line; 0 means
it sees no line. The outputs are binary signals to the motors (1 = spin
forward, 0 = stop or reverse). The robot’s logic gates implement these
rules: for instance, an AND gate (LeftMotor = L_sensor AND
R_sensor) drives both motors when both sensors see the line; and an
OR/NOT combination can stop both when neither sensor sees it.
More complex combinational logic may be needed for finer control. If three
sensors are used (left, center, right), Karnaugh-map simplification can
yield minimal gate equations for the left and right motor signals. For
instance, one design yielded left-motor = IN1 and right-motor = IN1' +
IN2'·IN3, where IN1–IN3 are the three IR sensor bits In practice, these
Boolean expressions are implemented with standard ICs (74HC series
gates) or programmable lookup-tables.
Obstacle avoidance can also be done with combinational logic. A simple
scheme: if a front-facing obstacle sensor outputs 1 (obstacle detected),
then the controller sets both motors to 0 (stop or reverse); otherwise, both
motors go forward. The truth table for a single-front-sensor obstacle guard
might be:
Obstacle
Left Motor Right Motor Behavior
Sensor
0 (no obstacle) 1 1 Move forward
Stop or
1 (obstacle) 0 0
reverse
More sophisticated avoidance uses multiple sensors (e.g., left/right
bumpers or sonar pairs) and gates to decide turns. For instance, if a left
obstacle sensor is triggered (1) but right is not (0), logic can steer the robot
right (left motor = 0, right motor = 1). These rules can all be encoded as
Boolean logic. As noted in an FPGA-based design, “the robot avoids
5
obstacles by using the three range sensors. Combinational logic is used to
create the algorithm”.
6
arranged in an “H” so that activating different pairs drives the motor
forward or backward. Digital outputs from the logic circuit feed the H-
bridge input pins: for example, setting one input HIGH and its complement
LOW causes current in one direction, while the opposite inputs swap
causes current to reverse. As a guide, an educational note explains: “The
H-bridge uses digital signals (high/low) to control the ON/OFF state of the
motor and the FORWARD/BACKWARD state”. Similarly, an L293D has logic
inputs (pins 2A, 1A, etc.) where a HIGH/LOW combination on each motor’s
pair of inputs sets the rotation direction (See Figure 1 for the L293D pinout
as an example of a dual H-bridge device.)
Figure 1: Pin diagram of the L293D H-bridge motor driver (PDIP-16). Logic
inputs (1A, 2A, 3A, 4A) on the left control two motors; outputs (1Y, 2Y, 3Y,
4Y) on the right go to the motor terminals.
7
motor lines receive PWM at 33%, 66%, or 100% duty depending on the
sensor logic, steering the robot smoothly along the line. The 555 outputs
drive the enable pins of the L293D, modulating speed while the logic inputs
set direction.
The digital controller thus produces the final binary signals that activate
the motors. The H-bridge requires just a 5V logic supply and a higher motor
supply (e.g., 12V). As one tutorial notes: “We can’t just connect motors to
sensors… motors require large current. Therefore we need a motor driver…
(L293D)”. The L293D lets two logic-level inputs control each motor: e.g.,
(1,0) spins it clockwise, (0,1) anticlockwise, and (0,0) or (1,1) stops it. In
practice, this interface is straightforward – the control logic outputs (or
PWM signals) tie directly to the H-bridge inputs.
M_L = S_R OR S_L (move if either sensor sees line on right side)
M_R = S_L OR S_R (move if either sensor sees line on left side)
8
Figure 2: Sample line-follower circuit. Each IR sensor (right side) uses an
LM358 comparator to output a digital signal (LOW on black line). These
signals feed an L293D H-bridge (left) which drives two DC motors (M1+,
M1– and M2+, M2–). In this design, each sensor output goes to one motor
input through driver pins
The truth table for the example circuit could be simplified to:
9
Both off
0 (black) 0 (black) 0 0
(search)
Both on
1 (white) 1 (white) 1 1
(forward)
1 (white) 0 (black) 1 0 Turn left
0 (black) 1 (white) 0 1 Turn right
Here “1” means the sensor sees white (no line) and “0” means it sees the
black line. Thus, when both sensors see white, the robot is centered and
both motors run. When only one sensor is on the line, the robot steers
toward that side to re-center. All these rules are implemented by the logic
gates and fed into the motor driver.
Subsystem Integration:
10
A basic navigation subsystem includes: sensors → digital logic → motor
drivers (with power). These blocks can be implemented on a breadboard
or PCB. For example, a typical design flow is:
Practical Considerations:
11
In practical implementation, timing and signal integrity matter. Sensor
readings should be debounced or averaged if noisy. Logic ICs have
propagation delays, but at typical robot speeds these are negligible.
Ensure all chips share a common reference (ground). Use proper power
decoupling on ICs. When using PWM, a low-pass filter (or motor
inductance) smooths the drive.
Physical layout: keep sensor wiring away from motor cables to avoid
interference. Use pull-down resistors if any logic inputs might float. If using
analog sensors, shield and calibrate them. For breadboard builds,
integrate trim potentiometers to adjust comparator thresholds on the fly.
References:
1. Mano, M. M., & Ciletti, M. D. (2017). Digital Design with an
Introduction to the Verilog HDL, VHDL, and SystemVerilog (6th ed.).
Pearson Education.
➤ A foundational textbook on digital logic design used in most
engineering courses.
2. Floyd, T. L. (2019). Digital Fundamentals (11th ed.). Pearson
Education.
➤ Covers key digital components and logic systems used in
embedded applications.
3. Parallax Inc. (2020). BoE-Bot Robot Kit Documentation. Retrieved
from https://www.parallax.com
➤ Provides practical examples of sensor integration and basic robot
movement.
12
4. MIT OpenCourseWare. (2005). Introduction to Robotics. Retrieved
from https://ocw.mit.edu
➤ An excellent free resource covering robot navigation and logic
design.
5. Alciatore, D. G., & Histand, M. B. (2011). Introduction to
Mechatronics and Measurement Systems (4th ed.). McGraw-Hill
Education.
➤ Discusses mechatronics systems including sensors and logic
controllers.
6. Arduino Official Documentation. Retrieved from
https://docs.arduino.cc
➤ Useful for understanding the hardware-software interface of
sensors and actuators.
7. Khan Academy. (n.d.). Digital Logic. Retrieved from
https://www.khanacademy.org
➤ A beginner-friendly reference for logic gates and their behavior.
13