ECOR 1032
Circuits and
Mechatronics
2025 Fall TERM
What is Mechatronics?
• Multidisciplinary engineering integrating
mechanical systems, electrical engineering,
control systems, and computer systems.
• Mechatronics as a modern solution for
complex problems across industries like
manufacturing, healthcare, and robotics.
[Link]
[Link]
Mechatronics
Mechanical Electronic Control
Computers
System System Systems 2
Model of Mechatronic System • Sensing System
– Sensors
– Analog to Digital and Digital to
Control Analog conversion
• Control
– Open Loop
– Closed loop
Action Sensing • Action
– Motors
– Actuators
3
SENSING
4
Device Types
●We are going to look at two general types of devices in this course:
●Analog Devices:
○ These devices operate using analog signals
○ If we want to interact with them within the Raspberry Pi environment we must
first convert them to a digital signal using an external ADC.
●Digital Devices:
○ These devices operate using digital signals, typically through the use of a built-
in ADC.
■ Typically this makes them easier for us to interact with when using the
Raspberry Pi
■ It can make debugging more difficult as the device is somewhat
abstracted away from the user.
5
Device Types
● Additionally, these devices can be broken into two other groups:
● Input Devices:
○ A hardware or peripheral device used to send data to a computer.
○ These allow users to communicate (directly or indirectly)
○ The communication includes feeding instructions and data to computers for
processing, display, storage and/or transmission.
○ Examples: keyboard, mouse, stylus, touch screen, sensors
● Output Devices:
○ A device used to send data from a computer to another device.
○ Most computer data output that is meant for humans is in the form of audio or
visual.
○ Examples: Screen, displays, printer, speaker etc.
6
Input Device: Push Button
● The button is primarily be used as an input device, which tells the computer when it has been pressed.
● From an electrical stand point their functionality is very straightforward; they act as a switch.
● Once the button is pressed the voltage on one side of the button will match the other side of the button.
7
Input Device: Limit Switch
● Works similar to a regular button, with the specific general application of detecting the presence or absence
of an object.
● Were originally used to define the limits on the range of motion of objects, therefore a ‘limit’ switch
8
Input Device: Light Sensors
● Sensors that are used for detecting the amount of light striking the sensor are called light sensors.
● These light sensors are classified into various types, we will look at the Light Dependent Resistor (LDR).
● An LDR can be used as an analog light sensor, the resistance of the LDR increases with a decrease in
light and decreases with an increase in light.
9
Light Sensors: Example
Use
● The circuit below shows a simple way of constructing a circuit that turns on
when it goes dark.
● The LDR and the other fixed resistor form a simple ‘voltage divider’ where the Fixed resistor
center point of the voltage divider is fed to the Base of the Transistor.
● When the light level decreases, the resistance of the LDR increases.
● As resistance increases it causes the voltage dropped across the LDR to also
increase.
● When this voltage is large enough, it will cause the Transistor to turn on.
● This will make the current flow through the load
LDR
10
Input Device: Temperature Sensors
● Sensors that are used for detecting the temperature of their environment
are called temperature sensors.
● These sensors are classified into various types, we will look at the
thermistor.
● There are two types of thermistors:
○ Negative Temperature Coefficient (NTC)
○ Positive Temperature Coefficient (PTC).
● For an NTC thermistor, when the temperature increases, resistance
decreases and vice versa. Commonly used as temperature sensor or
inrush current limiters.
● For a PTC thermistor, when temperature increases resistance also
increases. Commonly used to protect against overcurrent conditions as
resettable fuses.
11
Input Device: Strain
Gauges
● A strain gauge is a device that measures electrical resistance
changes in response to strain applied to the device.
● A strain gauge takes advantage of the physical property
of electrical conductance and its dependence on the conductor's
geometry.
12
[Link]
Input Device: Strain Gauges
[Link]
13
Input Device: Pressure Sensors
●Sensors used to measure the amount of pressure applied are called
pressure sensors.
●They will produce an output signal that is proportional to the amount of
applied pressure.
●Types:
○ Absolute pressure sensor: Measures the pressure relative to perfect vacuum.
○ Gauge pressure sensor: Measures the pressure relative to atmospheric
pressure.
○ Differential pressure sensor: Measures the difference between two pressures
○ Sealed pressure sensor: Measures pressure relative to a fixed pressure
14
Input Device: Pressure Sensors
●There are several different designs:
○ Piezoresistive strain gauge: Uses the piezoresistive resistance changes as pressure
deforms the material.
○ Capacitive: Uses a variable capacitor to detect strain due to applied pressure,
capacitance decreasing as pressure deforms the diaphragm
○ Electromagnetic: Measures the displacement of a diaphragm by means of changes
in inductance
○ Piezoelectric: Uses the piezoelectric effect in certain materials where the electric
charge accumulates in certain solids in response to applied mechanical stress
15
Input Device: Sound Sensors
●Sensors used to sense sound level are
called sound sensors.
●These sound sensors translate the
amplitude of the acoustic volume of the
sound into an electrical voltage for sensing
sound level.
●They typically use a thin piece of material,
commonly called a diaphragm which
generates an electrical signal when it
vibrates due to the acoustic waves.
16
Input Device: Distance Sensors
●There are several methods to determine the distance between a sensor and an
object, the type of sensor we will look at uses sound.
●Ultrasonic sensors:
○ They work by emitting sound waves at a frequency too high for humans to hear.
○ They then wait for the sound to be reflected and received back at the sensor,
calculating distance based on the time between sending and receiving the signal.
17
Input Device: Accelerometer
●Sensors that detect changes in acceleration are called
accelerometers.
●Accelerometers are available as analog and digital
sensors, based on the output signal.
●The analog accelerometer produces a variable voltage
based on the amount of acceleration applied to the
accelerometer which is then converted to an equivalent
acceleration.
18
Input Device: Rotary Encoder
●Sensors that detect rotational position
(and consequently speed) by converting
rotational mechanical displacement into
an electrical signal.
●Two Subtypes:
○ Incremental Encoders: outputs that a ‘step’
has occurred, an external counter tracks
these
○ Absolute Encoders: output the rotational
angle directly relative to a specific zero
19
Input Device: Pi Camera
●The camera module can be used to
take high-definition video, as well as
still photographs. It supports
1080p30, 720p60 and VGA90 video
modes.
●So far, our devices have interfaced
with the Raspberry Pi through the
GPIO pins, however the camera
attaches via a ribbon cable to the
Camera Serial Interface (CSI) port on
the Raspberry Pi.
20
ACTION
21
Output Device: Light Emitting
Diode
●Light Emitting Diodes (LEDs) are a type of diode that
emit a narrow bandwidth of visible light at different
colored wavelengths when a forward current is passed
through them
●LEDs are two terminal devices; the negative terminal is
called the Cathode and the positive terminal is called
the Anode.
●Almost all modern light emitting diodes have their
cathode identified either by a notch on the side or by
the cathode lead being shorter than the anode
22
Output Device: Buzzer
●A buzzer or beeper is an audio
signaling device, which may be
mechanical, electromechanical, or
piezoelectric
●Typical uses of buzzers and
beepers include alarm devices,
timers, and confirmation of user
input such as a mouse click or
keystroke.
●Piezoelectric (piezo) buzzers
contain a piezo electric vibration
within a molded case. Sound is
emitted when a voltage is applied
and the piezo element inside the
case vibrates.
23
Output Device: Liquid Crystal Display
(LCD)
●
24
Output Device: DC Motor
●DC (Direct Current) Motors are two
wire (power & ground), continuous
rotation motors.
●When you supply power, a DC motor
will start spinning until that power is
removed.
●The speed of DC motors is typically Rotor – the rotating portion
Stator – the static portion
controlled using pulse width
Coils – create a temporary
modulation (PWM). magnet
Commutator – controls current
direction
Brushes – interfaces fixed wires
with the commutator ring
25
Output Device: Actuator
An actuator is a
component of a device or
machine that enables
physical movement by
transforming energy
commonly electrical,
pneumatic, or hydraulic
into mechanical force.
26
CONTROL
27
Control Systems
● A control system is an interconnection of components forming a system
configuration that will provide a desired system response.
● A sensor is a device that provides a measurement of an external signal.
● An actuator is a device employed by the control system to alter or adjust
the environment.
● The extremely important step of the overall design and implementation
process is designing the control systems, such as PID controllers, etc.
28
Lab Focus
29
Laboratory Content
●The labs will use a Raspberry Pi as the basis for the experiments
and will focus on implementation of various components.
●Students will implement a variety of electrical components;
including LEDs, ultra-sonic sensors, motors, etc.
●The labs will build knowledge towards a final project, this will be
discussed in a few weeks.
30
Raspberry Pi Applications – Desktop Computer
The Raspberry Pi can be utilized as a desktop computer – the device itself can
be placed in a case for safety, and a keyboard, mouse, and monitor can be
used through the USB interface.
31
Raspberry Pi Applications – Robotics
● There are a large number of robotics systems that can be implemented using a Raspberry Pi or similar
hardware
32
The Raspberry Pi
● The Raspberry Pi is a ‘microcomputer’, essentially a very small version
of a typical computer
● There have been many versions released over the years (15+)
● They use many common connections:
○ Ethernet
○ USB
○ Micro-HDMI
○ USB-C as a power supply
● Also has Wi-Fi and Bluetooth
33
Aspects of the Raspberry Pi
●While most students likely use either Windows or macOS the
Raspberry Pi uses Linux (typically Raspbian specifically)
●Instead of a typical Solid-State Drive the Raspberry Pi stores files
on a micro-SD card
○ Do NOT remove this micro-SD card from Raspberry Pi while in use
●For the purposes of the labs we will be using Python, applying
your knowledge from previous ECOR classes to build a small
system
34
Raspberry Pi Interfacing
●A major difference compared to a typical computer is the presence
of the General-Purpose Input/Output (GPIO) Pins
●GPIO pins will be one of our main methods of interfacing devices
with the Pi in the labs
●There are two different numbering schemes for Pi Pins:
○ Broadcom SOC Channel (BCM, used in the labs)
○ Physical
●Some of the pins are multi-purpose
35
Raspberry Pi ‘Pin out’
36
Raspberry PI Limitations
• The PI can only output a limited amount of current through the GPIO
pins, if you attempt to overdraw the current it is possible you will break
the Pi.
– Do not connect motors directly to the GPIO pins, instead use an H-
bridge circuit or a motor controller board.
• The PI can only handle a limited number of inputs and outputs at any given
time, there are methods to increase this, however, they typically add
complexity or other limitations.
• The Raspberry PI utilizes digital signals (which we will look at in the
future), not analog signals (sine waves etc.).
• Requires a stable power source.
• The Raspberry PI can overheat with heavy usage; heat sinks or cooling
solutions may be needed.
37
import [Link] as GPIO
import time
Python and the PI
# Pin for the status LED
status_LED = 19
# Setup the GPIO mode
[Link]([Link])
[Link](False)
# Configure the pin as an output
[Link](status_LED, [Link])
# Turn ON the status LED
[Link](status_LED,[Link])
# Keep the LED on for 2 seconds
[Link](2)
# Turn OFF the status LED
[Link](status_LED,[Link])
# Clean up the GPIO settings
[Link]()
38
Python and the PI
39
Python and the PI
40
Python and the PI
41
Python and the PI
42
Python and the PI
43
Python and the PI
44