Java Python MTRX1701 Introduction to Mechatronic Engineering
Assignment 2: Sensors, Actuators and Control 2024
Notes on the Assignment
1. This assignment is worth 10% of your final mark in MTRX1701.
2. You will have the opportunity to ask the tutors for assistance during the
tutorial sessions in weeks 4-6. You should spend approximately one hour preparing for each of these tutorials so that you can benefit fully from them.
3. The tutors will not assist you further unless you can provide real evidence
you have attempted the questions prior to the tutorials. Beyond the tutorial sessions, it is estimated that you will need two to three hours to complete the assignment (7-8 hours total).
4. You may discuss the assignment with your peers, however all written work submitted for assessment must be strictly your own.
5. All work must be completed electronically (typed) including all diagrams.
6. There will be 100 marks assigned for the assignment.
Assignment Submission
1. Submit your assignment electronically as a PDF file via the “Assignments” page on the MTRX1701 Canvas site.
2. The assignment is due at 11:59 pm, Monday 25 March (end of week 6).
3. Late submission will be penalised by deducting 5% of the maximum mark for each calendar day after the due date. Zero will be awarded after ten calendar days late.
4. Submit early enough to ensure that your submission is processed by 11:59 pm.
5. Keep the email that will be generated automatically by the system as proof of your submission.
Context of the Assignment
As we have seen in lectures, many mechatronic systems comprise multiple sub-systems which interact to achieve some goal. These systems often include sensors, actuators and control elements that are designed to work together. Feedback from the sensors is used by the control system to determine appropriate actions for the actuators. In this assignment, we will be working on understanding the basic mechatronic elements that comprise a simple line-following robot, shown in Figure 1. Your tutors should have the line following robot kits available for you to collect during your tutorial session. You may keep this kits and will need ALL of the components in the kits later in the semester for your soldering exercise as part of Manufacturing Technologies. We will also have some breadboards and multimeters you can borrow to help complete the following exercises.
Figure 1 - Line following robot kit. The kit comprises the electronic components required to build a line-following robot, including electronic components, motors and a PCB.
The ‘brains’ behind this robot are a relatively simple circuit, shown in Figure 2. In this assignment, we will spend some time understanding what this circuit does and preparing our own custom Printed Circuit Board (PCB) which we will populate later in the semester during your soldering session of Advanced Manufacturing, which is part of this unit of study.
Figure 2 - Schematic of the line-following robot. This schematic is the electronic 'brains' of the robot. We'll use this as a pretext for exploring the sensing, actuation and control schemes employed to get this robot to follow a line. We have put a red box around the sensing part, a green box around the actuator circuitry and a blue box around the control logic.
Question 1 – Sensors (25 marks)
The sensor used in this robot is designed to detect the line that the robot is following. It is comprised of a pair Light Emitting Diodes (LED1 and LED2) and a pair of photoresistors (R13 and R14). The amount of light reflected from a white surface will be significantly more than the light reflected by a black line. The ‘sensor’ subsystem in this case will provide information about which of the photoresistor pairs is over the line and the control system will drive the vehicle such that it will turn to keep itself on the line.
a. Our first task will be to characterise the sensors. The sensors in this case are two
photoresistors. These are devices that change their resistance based on the amount of light impinging on their surface. Most photoresistors exhibit a reduction in resistance as photons promote their electrons into a higher energy state, making them more mobile and therefore making the device more conductive (i.e. reducing resistance). Take one of the photoresistors from your robot kit. You will also be provided with a multimeter (although you may want to seriously consider purchasing your own as this will be an important tool throughout your degree). Measure the resistance between the legs of the photoresister. Briefly describe what happens to the resistance between the legs as you increase and decrease the light on the surface (you can use the torch on your phone or a lamp to change the illumination).
b. Now we would like to be a bit more systematic about how we characterise the
response of the sensor. Place the photoresistor into the breadboard you have been supplied with. Add some wires to allow you to measure the resistance between the legs using the multimeter, making sure that the multimeter is in resistance mode.
Download an app on your phone that allows you to measure the ambient light using the ambient light sensor. On iPhone you can use Lux Light Meter or the Sensors
Multitool on Android. Take measurements of the resistance across the photoresistor for a least 5 different light levels. Record the measured lux and resistance. Plot this and fit a curve describing the relationship between light level (lux) and resistance
(Ω). Briefly describe the characteristics of this curve.
c. Now we would like to build the circuit that can be used to turn the light level into an electrical signal on the robot board. To do this, we will make use of what is known as a voltage divider. This will exploit one of the fundamental relationships in electricity known as Ohm’s Law. This asserts that the voltage drop in a circuit is equivalent to the current times the resistance through which it flows.
V = iR
Looking at Figure 2, we can see a part of the circuit in the section labelled ‘Sensing’ that connects the positive terminal of the battery (the top horizontal black wire) to the ground of the battery (bottom horizontal black wire) through the variable resistor R1, fixed resistor R7 and photo-resistor R13 (there is an equivalent circuit through R2, R6 and R14 for the second photoresistor). You can see where the voltage just below R1 is connected to pin 3 of the LM393 comparator. This is compared against the voltage picked up below R2 to allow the robot to determine which way it should turn.
As the resistance of R13 changes in response to changes in the light level (as we saw in b)), the measured voltage will change as well. If we set the variable resistor (R1) to the middle of its range, then the resistance from the central ‘wiper’ to the lower leg will be 5k Ω . Resistors in series add up so the total resistance between VCC and ground will then be:
R = R1 + R7 + R13
= 5000Ω + 1000Ω + R13
= (6000 + R13)Ω
The voltage of the battery Vcc is 3V so the current, i, that flows around this circuit will be:
Notice that this is a function of the resistance across our photoresistor, and hence is related to the ambient light. Kirchoff’s Law states that the sum of the voltages around a circuit must add up to zero. If we can determine the current flowing through each resistor, we can then work out the voltage drop across them. We are particularly interested in the voltage across the two resistors R7 and R13 as this is the voltage that will be seen by our comparator device, Va. We can again use Ohm’s law to determine the voltage, Va, which we should see as:
Plot a graph showing the Voltage Va for a range of resistances that our photoresistor might exhibit from 0 (bright) to 1k Ω (dark).
d. Set up a circuit to measure the voltage and repeat the characterisation exercise to
build a model between the light levels (lux) and the voltage that will be seen at Pin 3 of the LM393 Chip.
Does the shape of this curve resemble what you would expect given your model determined in part c.? Describe any differences and briefly explain how they might originate.
Question 2 – Actuators (25 marks)
The actuators for our robot consist of two permanent magnet DC motors. These motors are connected to a 1:38 gearbox (the yellow plastic part attached to the motor). One consideration as Engineers when we are designing system is how efficient our system will be at converting store potential energy (batteries in this case) into kinetic energy (movement of our robot). We’d like to start by estimating the efficiency of various components of our system.
a. Let’s start by considering the gearbox. A gearbox is used to increase the torque
available to do work. This also results in a decrease in speed from the shaft of the motor to the drive shaft. The ratio between the number of teeth in each gear element determines the change in speed and torque.
A gear such as the one shown above would see the motor shaft connected to the blue gear which would then drive the drive shaft through the green gear. The number of teeth in each gear determines the gear ratio, GR. The following relationships hold for a gear:
where n is the number of teeth, w is the angular speed, d is the diameter and T is the torque for the respective gear. Note th MTRX1701 Introduction to Mechatronic Engineering Assignment 2 2024Matlab at many gearboxes consist of a chain of gears to get a particular gear ratio. For our motor, the gear ratio is 1:38, meaning that we will have a decrease in angular speed by a factor of 38 and an increase in torque from the motor to the drive shaft of 38 times. In principle, a gear box should transmit power efficiently through the gears but in practice there are losses due to misalignment of the gears, friction and the like.
Usually, we would be concerned with how much power is efficiently transferred from the battery to the actual task we are using the motor for. Start by (carefully) removing the retainer on the back of the motor and removing the gearbox. Apply 5V to the motor and measure the current. Power in an electrical circuit is defined as:
P = iv
Where P is the power, i is the current and V is the voltage. Set up a circuit and estimate the no load power of your motor when 5V is applied.
b. Now reattach the gearbox. Repeat the measurement above. What do you notice about the speed of the output shaft of the gearbox relative to the speed of the motor without the gearbox? What is the electrical power required to drive the gearbox without any external load? Estimate the loss in power of the gearbox by relating the power required with and without the gearbox.
c. We are also interested in characterising the overall efficiency of the motor and
gearbox (the exercise above didn’t tell us anything about the actual mechanical work done as we weren’t explicitly measuring torques). Now let’s use the motor to do some ‘useful’ work. Attach one of the wheels from the robot to the output shaft using the small screw included in your kit. Design an experiment to estimate the work done by the motor and gearbox. This might involve measuring the time
required to lift a known mass using a string connected to the motor. We can calculate the work done in lifting a mass as:
W = Fd
= mgd
where W is the work done, F is the force applied (in this case the mass m times the gravitational constant g=9.81m/s2 ) and d is the distance (in this case the height we lifted the weight). Now the power required to complete this work is related to the work by the time required to lift the mass.
Pout = t/W
So, if we measure the time taken to lift the weight a certain height, we can calculate the power required for this lift. We can also estimate the electrical power at the
input by measuring the voltage and current.
Pin = iv
If we know the applied voltage and we measure the current, we can estimate how
much power we are putting into the motor. The efficiency of the motor in converting electrical energy into work is therefore:
Estimate the efficiency of your motor and gearbox combination. Do this with several
weights and voltages to the motor (you can generate 5V and 3.3V on your
breadboard by moving the small jumper). Does the efficiency remain constant? Explain any change in efficiency that you see.
Question 3 – Control (25 marks)
Our next task is to understand the control system for our robot. This comprises a simple
LM393 comparator Integrate Circuit (IC). The LM393 consists of two comparator circuits
which compare the two inputs. The output of the circuit is switched ‘on’ if the positive
terminal is higher than the negative and ‘off’ otherwise. We have provided you with a copy of the datasheet for this chip. Section 8 (pages 19 and 20) contains the application note
which gives details of how the chip operates.
a. Let’s start by understanding how the LM393 chip works. The circuit below emulates one half of control system for our robot. Instead of using the photoresistor, we’ll
use the potentiometer labelled as R3 below. This is set up as a voltage divider. Pin 5 on the LM393 will see half of the VCC voltage while the voltage at pin 6 will depend on the setting of the potentiometer. As per the datasheet, when the voltage at pin 5 (+) is higher than the voltage at pin 6 (-), the output at pin 7 is high impedance. This means that current won’t flow through the driver and the middle leg on the Q2 8550 transistor will be pulled high by the pull up resistor R4. You can simply think of Q2 as a switch that will allow current to flow through the motor when it is ‘on’ . When the voltage at pin 5 (+) is lower than the voltage at pin 6 (-) then the output at pin 7 will be pulled low, meaning that the transistor will be turned off, otherwise it will be on. Generate a table and measure the voltage at pin 5 as you vary the potentiometer
through its full range. Note when the motor turns on and off in your table.
b. Consider again the full circuit and briefly describe how the arrangement of the two photo-resistors will be used to drive the wheels of the robot. You can experiment
with this on your breadboard or use the insights gained above to determine how the robot works. You may want to consider the arrangement of the clear LED and photoresistor and how these will behave when reflecting of a while sheet or the black line.
Question 4 – Designing a PCB for our Line Following Robot (25 marks)
Our final task will be to layout an alternative version of the Printed Circuit Board (PCB) on
which the components are to be mounted and have this manufactured so you can solder
this up as part of your Introduction to Manufacturing Technologies soldering session. We have provided you with a copy of the schematic for this circuit, shown below. The code for this schematic can be downloaded from Canvas. We will be using an online tool called
EasyEDA to convert this schematic into a PCB that we can have manufactured. In addition to being the electronic circuit, this also happens to provide the mechanical structure of our robot (this won’t usually be the case for most ‘real’ robots). Consider whether you’d like to make any changes to the layout of the components of the robot. Have some fun with the design (without losing sight of the objective of making a robot that can follow a line).
• Design Objectives: layout a PCB for a line following robot with a view to having this manufactured and ready to be assembled in the soldering lab associated with
Introduction to Manufacturing
• Design Requirements:
o Design must be a maximum of two layer (i.e. you can use both the top and
bottom of the board but do not include additional layers – PCBs can be up to
16 layers for very complex designs).
o Design must accommodate all components and connections as per the provided schematic.
o Design must not be larger than 110mm x 75mm.
o Design must include name and SID of student on top silk screen layer.
o Design must be verified using the ‘Check DRC’ menu item under the ‘ Design’ menu. This will check that all connections are complete and that there are no short circuits in the design. A verification report must be included with your submission.
a. Go tohttps://easyeda.com/and sign up for an account. We will be using the online
editor to work on laying out our PCB. You can also download a version of the
EasyEDA app for Windows, Linux or Mac and install this on your own device if you’d prefer to work on your own machine.
b. Load the schematic that we’ve provided along with this assignment into the
schematic editor. Have a look and make sure that the component layout
corresponds to the figure above and to the one at the start of the assignment.
c. Go to the Design menu and select ‘Convert Schematic to PCB’ . You should see a new layout screen that includes all of the components required to run the robot. The
pins on each device should be connected as per the schematic above. Your task is to lay out the components and to add the electrical traces that connect the
components. You can use the board in your kit as inspiration for your layout or get creative about how you layout your own board and the shape of your robot. In
addition to the individual electronic components (resistors, LEDs, batteries, motor, etc.), make sure that you add in a large through hole for the front post. You should also add markings for the motor layout and (most importantly) add your name and SID on the solder mask layer on your board so we can identify your final board. You may wish to consult some online PCB layout guidelines, such as
https://resources.altium.com/p/pcb-layout-guidelines, to help you understand some of the common best practice in laying out PCBs. This is a relatively simple design so we don’t necessarily need to be too concerned about power and ground planes
(although a ground plane is generally a good idea) or high speed signal lines but it is
good to observe some common conventions around component placement,
clearances, trace widths and the like. Do a bit of a research to familiarise yourself with common practice.
d. Once you have finished the layout, check this with your tutor. We will be collecting your designs in your submission and will arrange to order these to be printed and
delivered in time for your soldering lab towards the end of the semester. Make sure that you include some evidence that your board has been checked for manufacture in an appendix with your submission.
e. Provide a brief description of the rationale for your design, including reference to the design requirements, principles that guided the placement of components, images of the top and bottom of the board including labelling of key components including
your name and SID on the top silkscreen and evidence of having verified the circuit layout.
f. Submit your PCB layout design in addition to your report using the following naming convention according to the date of your scheduled soldering session for
Introduction to Manufacturing along with your SID:
YYYYMMDD_HHMM_SID_LineFollowingRobotPCBDesign.json
Before submitting your PCB design file, verify that it can be loaded into EasyEDA and that the DRC check completes successfully