0% found this document useful (0 votes)
0 views13 pages

Logic Report 23100874

The document discusses the integration of digital logic in mobile robot navigation, emphasizing the role of digital logic gates and FPGAs in processing sensor inputs and controlling actuators. It details the use of various sensors, decision-making logic (both combinational and sequential), and the generation of control signals for motors using H-bridge drivers. Additionally, it outlines the subsystem integration for building a navigation system, including sensor boards, logic boards, and actuator boards, along with the importance of prototyping and simulation tools in the design process.

Uploaded by

Make Up Make
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views13 pages

Logic Report 23100874

The document discusses the integration of digital logic in mobile robot navigation, emphasizing the role of digital logic gates and FPGAs in processing sensor inputs and controlling actuators. It details the use of various sensors, decision-making logic (both combinational and sequential), and the generation of control signals for motors using H-bridge drivers. Additionally, it outlines the subsystem integration for building a navigation system, including sensor boards, logic boards, and actuator boards, along with the importance of prototyping and simulation tools in the design process.

Uploaded by

Make Up Make
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Digital Logic in Mobile Robot

Navigation

Made by: Yassin Mostafa Saeed Mostafa Ghobara

ID: 23100874
Major: Mechatronics Engineering

Supervised by: DR/Mahmoud Sleem

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.

Sensor Input Circuits:


2
Mobile robots use various sensors whose outputs are interfaced to digital
circuits.

Line-follower sensors typically use infrared (IR) reflectance modules (e.g.


TCRT5000). Each module includes an IR LED and photodetector: the
photodetector output goes HIGH (logic “1”) when it sees a white surface,
and LOW (“0”) when it sees a black line. The raw output is often analog, so
it is fed into a comparator (e.g. an LM358 op-amp) to produce a clean
digital signal. For instance, an LM358 in a comparator configuration can
drive its output HIGH or LOW depending on whether the IR voltage exceeds
a threshold. In practice, each IR sensor plus comparator yields a binary
input (line vs. no line) that feeds the logic circuit.

Obstacle sensors may use ultrasonic rangefinders or IR proximity


sensors. An ultrasonic module (e.g. HC-SR04) is triggered with a digital
pulse and returns a HIGH pulse whose width corresponds to distance. That
pulse can be digitized (e.g. measured by a timer or fed into a monostable
circuit) to detect when an obstacle is within a certain range. Simple IR
obstacle detectors output a digital HIGH when an obstacle is detected at
close range. In all cases, the key is to convert sensor signals to digital logic
levels (0 or 1). For example, a comparator or Schmitt trigger often
thresholds an analog sensor voltage to produce a TTL/CMOS-compatible
output.

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.

Decision Logic: Combinational and Sequential


Circuits:
Combinational Logic

The robot’s decision-making is often first implemented as a combinational


logic circuit: outputs depend only on the current sensor inputs, not on
history. For example, a simple two-sensor line follower might use this truth
table:

Left Right Left Right


Behavior
Sensor Sensor Motor Motor
0 (no No line – stop or
0 (no line) 0 0
line) search

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”.

Sequential Logic (State Machines)

Some navigation behaviors depend on past actions or states. These require


sequential logic with memory (flip-flops, registers). For example, a robot
that alternates turning direction after each obstacle might use a T flip-flop
to toggle left/right bias. More formally, one can design a finite state
machine (FSM) where states encode history. Consider an obstacle-
avoidance FSM with states “no obstacle, last turn was left” and “no
obstacle, last turn was right” plus “turning left” and “turning right” states.
An input from a front sensor (X) triggers transitions: in state A (“no
obstacle, last turn left”), if X=1 (obstacle) it goes to state B (“turn right”),
outputting a right turn. Once past the obstacle (X=0), it transitions to state
C (“no obstacle, last turn right”), etc. This type of control ensures the robot
doesn’t always turn in the same direction when an obstacle appears. The
states are implemented with flip-flops, and next-state logic (AND/OR
gates) computes the next state and outputs from the current state and
input.

In summary, sequential circuits allow memory of events. In practice, one


writes a state table or diagram, minimizes the logic, and implements it with
D or JK flip-flops. For basic navigation, however, many robots use mainly
combinational logic (or microcontrollers) and keep memory simple (e.g. a
single flip-flop to toggle a turn direction).

Generating Control Signals for Motors:


Once the decision logic has determined what the motors should do (stop,
forward, reverse), it must generate the actual drive signals. DC motors
typically require more current than logic ICs can provide, and also need
bidirectional control. This is handled by an H-bridge motor driver (such as
the L293D or L298N). An H-bridge consists of four switches (transistors)

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.

In addition to direction, speed control is often needed. A common


technique is to use pulse-width modulation (PWM): a logic circuit (or timer
IC) outputs a square wave whose duty cycle (proportion of ON time)
controls the average voltage to the motor. For example, one design uses
two 555 timer ICs configured as variable pulse generators: the left and right

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.

Example: Line-Following Logic Circuit:


A canonical example is a two-wheeled robot that follows a black line. It
might have two IR sensors (left and right) mounted at the front, each driving
a comparator. The outputs (S_L, S_R) go to combinational logic that sets
the left motor (M_L) and right motor (M_R). One possible implementation
is:

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)

with some conditions inverted to turn appropriately. A simpler logic is given


by the truth table above: for instance, if only the left sensor sees the line
(S_L=1,S_R=0), one may drive only the left wheel (M_L=0,M_R=1) to correct
course, or vice versa for (S_L=0,S_R=1). The exact logic equations depend
on the desired steering strategy and can be minimized via Karnaugh maps
as in Renesas’s design

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

In Figure 2, each IR sensor (bottom right) consists of an IR LED (IR523B)


shining on the ground and a phototransistor (IRF520) receiving reflections.
The LM358 amplifiers compare the reflected signal against a threshold;
their outputs go HIGH when the sensor sees white and LOW on black.
These two digital signals then connect to the L293D inputs: for example,
the left sensor output might enable the left motor, the right sensor the right
motor. The exact wiring depends on whether you want the robot to turn
toward or away from the detected line.

The truth table for the example circuit could be simplified to:

S_L (Left S_R (Right M_L (Left M_R (Right


Action
sensor) sensor) motor) motor)

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.

Example: Basic Obstacle-Avoidance Logic:


Consider a simple obstacle-avoidance scheme using one front-facing
range sensor. The sensor’s output (OBS) is 1 when an obstacle is detected
within a threshold, 0 otherwise. A simple logic rule is: if OBS=0 (no
obstacle), set both motors on; if OBS=1, set both off (or reverse). The truth
table:
OBS M_L M_R Behavior
0 1 1 Move forward
1 0 0 Stop/back up
This can be implemented with one NOT gate and two AND gates, or directly
by tying OBS to the enable pins of both motors through an inverter. In more
advanced robots, multiple sensors allow more nuanced reactions. For
example, if a left-side sonar (L) detects an obstacle (L=1) but the right side
(R) does not, logic can steer the robot right (M_L=1, M_R=0). These steering
decisions are encoded in the logic network similarly to the line-follower
example. If memory is needed (e.g. alternating turns), a flip-flop-based
FSM as in the Auburn example can be used.

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:

• Sensor board: IR or ultrasonic sensors produce digital signals.


These may be on a small preboard with comparators.
• Logic board: Standard ICs (74HC04 NOT, 74HC08 AND, 74HC32 OR,
etc.) or a PLA handle the combinational logic. Multiplexers (e.g.,
74HC157) can be used to route between behaviors or signals. Flip-
flops (74HC74) hold state if needed.
• Actuator board: A dual H-bridge (L293D or L298) with its own power
supply takes the logic outputs.
• PWM or control: Optionally, 555 timer chips or a microcontroller
generate PWM signals based on the logic outputs for speed control.

For instance, one walk-through builds a 4-sensor line follower by first


wiring the sensors to breadboard pins, then hooking up 74HC04/11/32
gates per the truth table, then adding 555 timers for PWM, and finally an
L293D for motor drive. In practice these stages are glued together: the
sensor outputs and V_CC/GND form a common bus; logic IC inputs are on
the breadboard rails; the L293D on a separate sub-board receives the logic
and battery supply. Breadboards make this easy: as one guide notes,
“Using a breadboard like this makes it easy to experiment with robotic
circuits. Since no soldering is required, it’s very easy to make changes”.

Besides prototyping hardware, students often use digital design tools


before building. Software like Logisim, Multisim, or Proteus can simulate
the logic and allow interactive testing of the circuit. Even hardware
description languages (VHDL/Verilog) on FPGA boards are used in
advanced courses to implement navigation logic. These tools help verify
truth tables and timing before the real robot is wired.

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.

Finally, always test each sub-module: verify sensor outputs on LED


indicators, check truth tables with LEDs, and bench-test the motor driver
with logic-level inputs. With thorough testing and modular design, a robot’s
navigation logic can be built reliably using simple digital electronics.

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

You might also like