Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


Alternative Simulation Exercises – Lab 3

Introduction

This document outlines simulation exercise alternatives to the lab tasks shown in Lab 3 – Interface Electronics” of the Project (EENG18020) Lab Notes (2021/2022). These tasks should only be done if you do not have a Home Lab Kit. This document is to be used in parallel with the Lab notes for this unit. These tasks will require you to use two software programs that you have already been using in your other units:

•   TinkerCAD For creating circuit layouts on the breadboard

•    Wokwi For creating circuits and running and testing your microcontroller program.

•    AWR Design Environment (DE) – For simulating and measuring your circuits.

Regarding your lab report assessment, any measurements that you take in the simulation should be included in the Experimental Procedure and Results” section of your lab report NOT the Design Procedure” section.

Lab 3 alternative task list

This section covers what tasks are being changed in order to complete the lab. It also gives instructions on how to perform the task if it has been changed.

Task 3.1

•    Select appropriate resistor values that ensure that the output of a voltage divider is between +2.4 V and +3.3 V for an input of +9 V. You must choose resistor values that are available in the home lab kit (check the Home Lab Kit part list” for details on what is in the kit).

•    Use TinkerCAD to add a breadboard layout for the input signal buffer circuit shown in Figure 3.2 of the lab notes, to the existing breadboard layout that was created in Lab 1 – Analogue Electronics” .  Use the unused comparator in the LM393 dual comparator” for the LM358 operational amplifier.

•    Use AWR to add a simulation model of the input signal buffer circuit shown in Figure 3.2 in the  lab  notes, to your  pre-existing simulation created  in  Lab  1 – Analogue  Electronics” . Confirm that the output of the input signal buffer is less than 3.3 V for both when there is no object in the range of the proximity sensor (d = 0.01) and when there is (d = 0.09). Here are some hints on how to do this:

o Unfortunately, there is no model in AWR for the LM358 operational amplifier, so instead we will the model of a similar op-amp, the AD8614, whose model file can be downloaded for the Blackboard page in the “Key Documents” section.

o Place a 10 kΩ resistor on the output of the op-amp to ensure correct operation.

Task 3.2

Make a copy of the Wokwi circuit and program that was created in Lab 2 – Microcontroller and Output Display” and rename it for use in this lab. Remove the code for the simple running timer from the main program but keep everything else the same.

Task 3.3

Using Wokwi create an interrupt that triggers whenever a rising edge occurs on the GPIO pin attached to the output of the signal buffer. Upon triggering, the interrupt is to call an ISR that increments a


counter and displays the result on the dual-digit, 7-segment display. Run the Wokwi simulation and record the performance including any errors that you observe. Here are some hints on how to do that:

•    We will imitate the output of the signal buffer by adding a push-button circuit to the circuit that was created in Lab 2 – Microcontroller and Output Display” . Connect one terminal of the push-button to the +3.3 V pin on the Raspberry Pi Pico, and connect the other to a digital I/O pin that will be used to trigger the interrupt.

•   To test that your program is working correctly, we will need to disable the switch bounce effect that Wokwi uses with its pushbutton’ model. To disable this go into the diagram.json’ file and set the attributes line to the following:

o “attrs”: { “bounce”: “0” }

•    Once you  have confirmed that your  program  is working as desired,  re-enable the switch bounce effect by changing the attributes line to the following:

o “attrs”: { “bounce”: “1” }

Run the Wokwi simulation with this setting and record the performance including any errors that you observe.

Task 3.4

Design the non-inverting Schmitt trigger circuit shown in Figure 3.6 in the lab notes. To do this you will need to perform the following tasks:

•    In your pre-existing AWR simulation, replace the threshold comparator circuit with the non- inverting Schmitt trigger shown in Figure 3.6 in the lab notes.

•    As shown by equations 3.4.1 and 3.4.2 in the lab notes, the ratio  determines how the non- inverting Schmitt trigger will operate. In your AWR simulation give one of these resistors a fixed value and make the other a tuned variable so that a range of  values can be tested. Both the fixed and tuned resistors are to be limited to resistor values that are available in the home lab kit (check the Home Lab Kit part list” for details on what is in the kit).

•    Run the simulation and use AWR’s tune feature to tune the value of d” that was created in “Lab 1 – Analogue Electronics” . To determine the circuit’s Vth+ value, use the Tuner” to move the slider for “d” from 0.01 to 0.09 and record the value of the output voltage of the proximity sensor  when  the  output  of  the  Schmitt  trigger  changes  from  low  to  high.  Similarly,  to determine the circuit’s Vth value, use the “Tuner” to move the slider for “d” from 0.09 to 0.01 and record the output voltage of the proximity sensor when the output of the Schmitt trigger changes from high to low.

•    Repeat the previous step for several different values of  and plot Vth+  and Vth  as a function of  . Calculate the theoretical values of Vth+  and Vth  for each value of  and compare with your simulation results. Choose fixed resistor values for RA  and RB that will produce values for Vth+  and Vth  that are +5% and −5% the value of Vth   in your circuit, respectively. You must choose resistor values that are available in the home lab kit (check the “Home Lab Kit part list” for details on what is in the kit).

•    Alter the TinkerCAD circuit you created in task 3.1 by replacing the threshold comparator with the non-inverting Schmitt trigger that you have just designed. Take a screenshot of this layout for your lab report.