PC/CP320 Physical Computing: Digital Interaction with the Analog World

This page is being updated
Winter term course



This is the Physics/Computing 320 Lab page, prepared by Terry Sturtevant .
Page last updated Monday January 9, 2023
**Items marked this way are not final.**


Week 1, Week 2, Week 3, Week 4, Week 5, Week 6, Week 7, Week 8, Week 9, Week 10, Week 11, Week 12

Introduction

Useful links

Evaluation Methods

Course Material

Week of ... Lab / Lecture Reference Material
[white background indicates required reading;
gray background indicates optional reading]
 

Sept. 8
Lecture: Introduction, resistors and resistance
  1. Course Introduction: What's the purpose of PC/CP320? [PDF]   [ September 5, 2018 ]
    Course syllabus Fall 2022

    About the course     [ September 8, 2022 ]

  2. Active Learning Introduction
    Proven teaching strategies

  3. Overview of Physical Computing   [ September 8, 2017 ]

  4. Learning on your own using Google and YouTube, etc.

  5. Block Diagrams   [ February 13, 2019 ]
    Block Diagram Elements [HTML]   [ November 9, 2017 ]
    Block Template
    Signals for block diagrams library for Dia
    Use this if you are installing Dia on your own computer.

    draw.io online drawing app
    Sample signals

  6. Electrical terminology   [ September 8, 2016 ]
  7. Resistors and resistance   [ September 7, 2017 ]

    colour code humour

    colour code snake humour
  8. Variable Resistors (Trimmers)   [ January 4, 2018 ]

  9. Identifying resistor nominal values (AL exercise)
    doc version
    png version
    Timer (6 minutes)

  10. Digital multimeters   [ November 7, 2018 ]

  11. Using lab notebooks
    New Information: Lab Notebook summaries   [ May 12, 2017 ]
    Summary checklist   [ January 18, 2017 ]
    "summarization is among the top nine most effective teaching strategies in the history of education"

  12. Online Quiz: Read over the learning objectives for this course.
    Do quiz on MyLearningSpace between 7 a.m. Friday and 11:30 p.m. Sunday evening.
    "Our central result is that higher exposure to the online instrument robustly leads to higher student learning, all else being equal."


 

Resistance
[© 1995-2003 M. W. Davidson, Florida State University]

Fixed Resistors   [ January 8, 2018 ]
Measuring Resistance   [ May 12, 2017 ]
Measuring Continuity   [ May 12, 2017 ]


Resistor colour coding chart
[PDF; NIC Components, May 2004]

Which Way Does Current Really Flow?

Resistor colour codes: 4- band, 5- band
[GIF; © 1996-2003 Electronix Express]
Resistor colour code: 4, 5, 6 band
[JPG; T. May, University of Colorado]
[PDF 50pp, © Wavetek Meterman, 2000]
Wavetek Meterman 33XR Operator's Manual
[PDF 17pp, © Amprobe,]

MAKE presents: The Resistor
the resistor

Resistors [from PC200]
Resistor colour code: 4, 5, 6 band
[JPG; T. May, University of Colorado]
 

Sept. 12
Lecture: Electrical circuits and single board computers including the Raspberry Pi

xkcd comic

  1. AL wrap-up from last week- last value
  2. Kirchhoff's laws   [ May 16, 2011 ]
  3. Kirchhoff's laws example   [ May 31, 2017 ]
  4. Voltage dividers   [ May 31, 2017 ]
    voltage divider symbol
  5. Resistive sensors   [ May 31, 2017 ]
    force-dependent resistor
    photoresistor
    thermistor
    strain gauge

  6. Application of voltage dividers - internal resistance   [ June 13, 2014 ]
  7. Determining battery internal resistance (AL exercise)
    Timer (6 minutes)

  8. Single board computer platforms   [ November 23, 2016 ]

    Arduino, Pi model B+
    Pi model A, B, B+
    Pi 2, model B+
    Pi 3, Pi 2, model B+
    Arduino, Pi model B, BeagleBone
    Raspberry Pi models comparison
    arduino symbol

    raspberry pi symbol

  9. Linux shell command summary
    Note: Linux is case-sensitive, and commands should be in lower case.
  10. Raspberry Pi GPIO pins
    Board and Broadcom numbering schemes
    WEMOS GPIO pin guide
    Note that numbering uses the Broadcom system. How can you tell?

    Orientation of GPIO pins
    Correct cobbler orientation
    GPIO orientation
  11. Access GPIO from Linux user space

    Tip: To see the Pi internal temperature, type:
    cat /sys/class/thermal/thermal_zone0/temp
    Divide the result by 1000; e.g. 44250 corresponds to 44.25 Celsius.

  12. Review: Breadboards [PDF]   [ May 1, 2012 ]

  13. Quiz during next lecture!
Lecture: Static sensitive devices and exploration project introduction
  1. good lab summary
    Clear, useful, and just 1 page

  2. Launchpad Science Maker Lab Introduction

  3. Voltage, current and Ohm's law quiz
    Applying some basic concepts of voltage, current, and power
    Rationale for collaborative quizzes
    "The students first completed a quiz individually. Once the quiz was completed individually, the students completed the same quiz in groups. Eighty percent of the score on the quiz was based on the individual results, and 20% of the score on the quiz was based on the group results. The performance on the quizzes was significantly higher when students completed the quizzes in groups than when they completed the quizzes individually. Results document that completing the quizzes in groups enhances the understanding of the material."

  4. Exploration Project Overview   [ May 24, 2018 ]
    Exploration project introduction
    Remember Google, YouTube, etc.
    Example of wrong/misleading "data"
    Exploration Project checklist
    Example of exploration project (8x8 Matrix LED)

  5. Online Quiz: Review proper electrical terminology.
    Do quiz on MyLearningSpace between 7 a.m. Friday and 11:30 p.m. Sunday evening.



Electrical Circuits Review [pdf 18pp; B. M. Fleischer] - sections B.1 and B.2.1 

Operating point analysis in CircuitLab [video]
operating point analysis in CircuitLab


Internal resistance of a voltage source [screencast of PDF]
internal resistance of a voltage source

Voltage Divider [© 2000, C.R. Nave, Georgia State University]

Potentiometers [video]
potentiometers

Voltage dividers [video]
voltage dividers


 

Measuring DC Voltage   [ May 12, 2017 ]
Measuring DC Current   [ May 12, 2017 ]

Lab bench setup in N2082 [video]
lab bench setup in N2082


Dual DC supplies [video]
dual DC supplies




Voltage Circuit Simulator   [java applet; G. Bothune, UOregon]



MAKE presents: Ohm's Law
Ohm's law
 

Sept. 19
Lecture: Producing and measuring analog signals
  1. Oscilloscopes   [ August 23, 2018 ]
    oscilloscope symbol

    Triggering on an oscilloscope
    oscilloscope triggering
  2. Function generators   [ January 20, 2020 ]

    function generator symbol
  3. Sketching AC signals   [ April 19, 2011 ]

  4. Logic family characteristics - voltage   [ May 23, 2018 ]
    Logic gate characteristics - measuring voltage limits   [ November 20, 2014 ]
  5. GPIO Electrical specifications
  6. Determining GPIO voltage limits (AL exercise)
    Timer (6 minutes)

  7. Logic gate characteristics - current   [ September 4, 2013 ]
    Logic gate characteristics - measuring current limits   [ September 4, 2013 ]
    datasheets for SN7400, CD4011UB, 74HC00A

  8. Logic gate characteristics - propagation delay   [ November 16, 2016 ]

  9. GPIO Electrical specifications
    Note diode section

  10. Quiz during next lecture!
Lecture: Voltage considerations for Raspberry Pi GPIO pins and Python programming on the Raspberry Pi
  1. quiz 1 group summary
    6 people got a lower group mark than individual.

  2. Static discharge   [ February 18, 2010 ]

    ESD video (2/4)
    ESD video (2/4)
    ESD video (3/4)
    ESD video (4/4)
    ESD prevention measures
  3. GPIO access in Python
    Official RPi.GPIO Wiki examples
  4. GPIO access in Python
    Raspberry Pi GPIO pins
    Basic python example
    Modified python example
    Broadcom numbering example
    Another Broadcom numbering example
    Another board numbering example
  5. Good Coding Style   [ August 23, 2018 ]
    Why magic numbers are evil
    Unnamed numerical constants

    code 
quality

    code 
quality 3

    Coding without comments
    Code Style Checklist [PDF]   [ January 18, 2017 ]

  6. Simple DC circuits quiz
    Simple application of Kirchhoff's laws
    Timer (6 minutes)

  7. Online Quiz: Review Kirchhoff's laws and their application.
    Do quiz on MyLearningSpace between 7 a.m. Friday and 11:30 p.m. Sunday evening.




Logic Gates
logic gates created from discrete components
Measuring Strain with Strain Gages  [© 2016 National Instruments Corporation]
Logic Family Selection Guide


 
Overtones, harmonics, and additive synthesis [video]
overtones, harmonics, and additive synthesis

DC and AC voltage measurements with an oscilloscope
DC and AC voltage measurements with an oscilloscope

Finding the origin on an oscilloscope in XY mode
finding the origin on an oscilloscope in XY mode

Use of a function generator - Part I
use of a function generator (1/2)

Use of a function generator - Part II
use of a function generator (2/2)


MAKE presents: The Oscilloscope
oscilloscopes



Close-up pictures of signal generators we have in the lab:
White case model (Instek GFG-8217A)
Black case model (Wavetek FG3C)
Grey case model (Wavetek FG3B)
Old model (Wavetek 182A)

XYZ's of Signal Sources [pdf 52pp; © 2005, Tektronix, Inc.]

Philips oscilloscope (PM3207)

XYZ's of Oscilloscopes [pdf 64pp; © 2001, Tektronix, Inc.] The Cathode Ray Oscilloscope [pdf 6pp, T. Sturtevant]
TDS1000 and TDS2000 Series Digital Storage Oscilloscopes [© Copyright Tektronix, Inc.]
TDS210 Series Digital Storage Oscilloscopes [© Copyright Tektronix, Inc.]

ABCs of Probes [pdf 48pp; © 2005, Tektronix, Inc.]
Oscilloscope animation (Flash)
 

Sept. 26
Lecture: Diodes and capacitors
  1. quiz 2 group summary
    1 person got a lower group mark than individual.

  2. Reading data sheets   [ May 12, 2017 ]
  3. Reading data sheets   [ October 7, 2013 ]
    sample datasheet (Fairchild)
    sample datasheet (National Semiconductor)
    sample datasheet (International Rectifier)
    sample datasheet (Photonic Detectors)


  4. Diodes [PDF]   [ September 9, 2015 ]
    Diode Measurement  [ May 1, 2014 ]

    diode operation humour

  5. Zener Diodes and Photodiodes [PDF]   [ September 26, 2017 ]
  6. Selecting Zener/photodiode resistors (AL exercise)
    1N5913B Zener diode, ON Semiconductor; determine resistor for 12V supply
    Note recommended vs. maximum current.

    SFH 229 Photodiode, Osram Semiconductors; determine resistor for 9V supply and 3.3V swing with light
    Save these results and you'll save time in the lab!

    Timer (6 minutes)
  7. Optical Isolation [PDF]   [ November 10, 2016 ]
    optoisolator symbol
  8. Optoisolator Calculations [PDF]   [ October 1, 2018 ]

  9. Selecting LED/photodiode resistors for optoisolator(AL exercise)
    PS2501 datasheet
    determine resistors for 5v on input and output at least 2.5V with a 3.3V supply
    determine resistors for 3.3v on input and output at least 4V with a 5V supply
    Save these results and you'll save time in the lab!

    Timer (6 minutes)
  10. Quiz during next lecture!
Lecture: More electrical considerations for GPIO pins and output transducers (actuators)
  1. Optoisolator breadboard layout [PDF]   [ November 16, 2017 ]

  2. Lab notes (optoisolator)
    scope output
    circuit
    triangle wave output
    increased output resistor value

  3. The Embroidered Computer

  4. Capacitors   [ October 9, 2015 ]
  5. Identifying Capacitor Polarity  [ August 22, 2019 ]

  6. Inductive Output Transducers [PDF]   [ October 18, 2016 ]
    pmdc motor symbol
    brushless motor symbol
    servo motor symbol
    stepper motor symbol

  7. DC motor with shaft encoder [PDF]   [ November 1, 2018 ]

    pmdc motor with shaft encoder symbol

  8. Controlling Output Transducers [PDF]   [ November 10, 2016 ]

  9. Oscilloscope quiz
    Basic functionality of the oscilloscope
    Timer (6 minutes)


  10. H-Bridges and DC Motors [PDF]   [ April 22, 2019 ]
    Question: What should a block diagram symbol for an H-Bridge look like?

  11. Online Quiz: Review oscilloscope operation.
    Do quiz on MyLearningSpace between 7 a.m. Friday and 11:30 p.m. Sunday evening.



Diode Measurement [screencast of PDF]
diode measurement


MAKE presents: The Diode
the diode



Checking Diodes   [ May 12, 2017 ]
Physics of a Diode [©2003 Marvin Casanova ]

Measuring Capacitance   [ May 12, 2017 ]
How Capacitors Work [© 1998 - 2003 HowStuffWorks, Inc.]
Charging and Discharging A Capacitor [© 1995-2003 M. W. Davidson and The Florida State University]

Identifying Capacitor Polarity [screencast of PDF]
capacitor polarity


MAKE presents: The Capacitor
the capacitor


Tristate Buffers
tri-state buffers



Introduction to Wired-OR Outputs and Open-Collector Circuits   [© 2003 National Instruments Corporation]
7401 datasheet   [© 1995 National Semiconductor]

Design Fundamentals for Phototransistor Circuits   [ April 30, 2015 ] [© 2002 Fairchild Semiconductor]


Stepper, servo, DC motor control [video]
stepper, servo, DC motor control


How does a Stepper Motor work ? [video]
stepper motor construction

Induced EMF demo from MIT [video]
induced EMF demo from MIT

Induced EMF in a motor [video]
induced EMF in a motor

Relays and Optocouplers [video]
relays and optocouplers

Small solenoid operation [video]
small solenoid operation

What is a solenoid valve? [video]
solenoid valve


How do servos work? [video]
how servos work


MOSFET tutorial [video]
MOSFET tutorial


MOSFETs and How to Use Them [video]
Another MOSFET tutorial

Transistor as a switch [video]
transistor as a switch

SSRs Technical Information [PDF 8pp; © Copyright Matsushita Electric Works, Ltd.]
Solid State Relays [PDF 5pp; Vishay, 2001]
 
  • Lab A: Zener Diodes and Photodiodes  [ November 15, 2017 ]

    Note: If you finish early, start on Lab B.

  • Lab B: Optical Isolators  [ January 30, 2020 ]
    PS2501 datasheet
    Note: Don't take this circuit apart after the lab; you'll be using it later.
  • Postlab Requirements: Show your calculations for the required resistors for the Zener diode and for each optoisolator.
    Diode calculation checklist   [ May 16, 2019 ]


  • After this week's labs, you know how to get inputs from the outside world at any specified voltage into the Raspberry Pi and you know how to provide outputs to the outside world at any specified voltage from the Raspberry Pi .
HC-SR04
HC-SR04 datasheet
Optoisolator simulation [video]
optoisolator simulation


Analog Optical Isolators VACTROLS® [©1998-2004. PerkinElmer, Inc.]
 

Oct. 2
Lecture: Conversions between analog and digital signals and the I22 interface on the Raspberry Pi
  1. Analog and Digital Quantities [PDF]   [ May 25, 2017 ]
    ADC symbol
    DAC symbol
  2. Analog to Digital and Digital to Analog Conversion [PDF]   [ October 3, 2018 ]

    A/D converter demonstration [video]
    A/D converter demonstration


  3. Analog and Digital Grounds and Decoupling Capacitors [PDF]   [ May 31, 2017 ]

  4. Identify decoupling capacitors in circuits
    circuit1
    circuit2
    circuit3

  5. Serial communication (UART)
    Serial Communication-UART [PDF]   [ November 7, 2018 ]

    UART symbol
    If using serial (i.e. UART) sensors, you need to turn off the serial console and feed both signals through the appropriate optoisolators (to and from the Pi).
    Here's the rpi-serial-console script.
    To turn off the serial console:
    sudo rpi-serial-console disable
    To turn on the serial console:
    sudo rpi-serial-console enable


  6. UART devices
    GPS module, RFID reader, Bluetooth module

  7. Serial Communication-SPI [PDF]   [ October 3, 2018 ]

    SPI symbol
  8. I2C interface
    Serial Communication-I2C [PDF]   [ February 13, 2019 ]
    Devices come with a default address programmed in, but it can usually be changed.

    I2C symbol
  9. I2C devices
    digital compass (HMC6352), colour sensor (ADJD-S371), light intensity sensor (GY-30), 3-axis magnetometer (HMC5883L), gyro (ITG-3200), 128x32 OLED display

  10. Identifying interfaces (AL exercise)
    Sample interfaces
    Timer (6 minutes)

  11. Single Wire Communication
    Single Wire Interfaces [PDF]   [ October 23, 2017 ]

    1 wire symbol
    single wire interface symbol

  12. Quiz during next lecture!
Lecture: Using operational amplifiers to modify analog signals
  1. Review of previous quiz
  2. quiz 3 group summary
    6 people got a lower group mark than individual, but all were over 8, and most were because the group did worse on question 4.

  3. GP2Y0A21YK infrared distance sensor

    Can the distance sensor feed directly into the ADC? (See Fig. 5 in datasheet.)

  4. Operational Amplifier Basics [PDF]   [ October 4, 2016 ]

    Rails of an operational amplifier [video]
    op amp rails

    op amp symbol
    Optoisolators allow changes in voltage for digital signals; op amps allow changes in voltage for analog signals
  5. Noting variation in naming conventions (AL exercise)
    sample 1
    sample 2
    sample 3
    Timer (4 minutes)
  6. Operational Amplifier Circuits [PDF]   [ September 4, 2014 ]

  7. Analog computers [video]
    analog computers


  8. Sketching amplifier output [PDF]   [ September 7, 2013 ]
  9. Sketching op amp circuit output (AL exercise)
    circuit 1
    This is what you'll do in a future quiz!

    Timer (4 minutes)

  10. Negative Feedback in Operational Amplifiers [PDF]   [ July 29, 2013 ]

  11. Logic gate characteristics: Open collector and open drain outputs   [ October 3, 2018 ]
    datasheet for SN7401
  12. Logic gate characteristics: - Tri-state outputs   [ June 1, 2017 ]
    Processor internal architecture
    "Standard" Processor internal architecture
    Z80 system architecture (outside mpu)
    Hyperphysics microprocessor page

    GPIO Electrical Specifications
    Determining GPIO current limits (exercise)
    Find all of the rules governing current limits.
    Look at GPIO pin equivalent circuit.

  13. Zener diode quiz
    Choosing correct resistors
    Timer (6 minutes)

  14. Exploration Project Overview   [ May 24, 2018 ]
    Exploration project introduction
    Remember Google, YouTube, etc.
    Example of wrong/misleading "data"
    Exploration Project checklist
    Example of exploration project (8x8 Matrix LED)

  15. Online Quiz: Review optoisolator operation.
    Do quiz on MyLearningSpace between 7 a.m. Friday and 11:30 p.m. Sunday evening.


ADC and DAC Glossary [HTML; PDF] [Dallas Semiconductor, 2000]

A/D converter simulation [video]
A/D converter simulation




 

Sensors and Signal Conditioning Overview  [ May 12, 2017 ]
Solenoid Catalog [ © 1999, 2000 Magnetic Sensor Systems ]


Animations:

READING WEEK

Oct. 10 READING WEEK - No lecture or labs
 

Oct. 17
Lecture: More about interfacing devices to the Raspberry Pi
  1. Review of previous quiz
  2. quiz 4 group summary
    No-one got a lower group mark than individual. The lowest group mark was 8/10.

  3. Lab summary comments
    Want to say what you learned, not that you learned something.
    No magic numbers

  4. Project overview
    Outline of all 3 projects [PDF]   [ October 17, 2022 ]
    Note: DC motor needs 1 channel of shaft encoder connected to indicate position.
    DC motor being able to run in both directions and monitor both channels for speed and direction can be a substitution project and the second channel can replace the other input.
    If a single device contains both inputs and outputs, it can fulfil both requirements for the second input and output of the integration project.

  5. Reviewing learning objectives (AL exercise)
    Timer (4 minutes)

  6. Three options for connecting to devices:
    • Use existing Python libraries
    • Use system commands from within Python (if there aren't Python libraries)
    • Bit-bang your own interface in Python

    Bit banging [PDF]   [ February 13, 2019 ]
    Bit banging on Wikipedia
    Raspberry Pi Interface with Parallax Serial RFID Reader
    Bit-banged serial interface [to RFID reader]
    bit-banging in action


    Bit-banged SPI Interface to MCP3008

  7. Row-Column Devices [PDF]   [ February 13, 2019 ]
    Wiki sections on "more than one channel" and "several channels"
    Also note options for enabling pull-up or pull-down resistors.
    row-column display symbol

  8. Matrix LCD Driver (MAX7219) [PDF]   [ February 13, 2019 ]
    MAX7219 datasheet

  9. MAX7219 8x8 LED matrix
    MAX7219 8 digit 7 segment display

  10. Various displays
    LTP-1415AG Single colour 8x5 display
    LTP-2558A Tri-colour 8x5 display
    Alphanumeric 16 segment LED display

  11. MAX7219 Fritzing Board
    fritzing board

  12. Row-Column with Both Outputs and Inputs
    row-column keypad symbol

  13. TM1638 datasheet (LED/Keypad controller)
    TM1638 key/display board

    TM1637 datasheet (LED/Keypad controller)
    TM1637 display board (front)
    TM1637 display board (back)

  14. Some input options
    capacitive hex keypad
    TM1638 key/display board
    Telephone keypad

  15. Response-time sensors; shaft encoders and ultrasonic sensors
    Pulse Width Modulation Communication [PDF]   [ August 14, 2020 ]

    Note: On the Raspberry Pi 2, there are 4 possible hardware PWM pins:
    • BCM GPIO 18 (using PWM0, so same as GPIO 12)
    • BCM GPIO 12 (using PWM0, so same as GPIO 32)

    • BCM GPIO 13 (using PWM1, so same as GPIO 33)
    • BCM GPIO 19 (using PWM1, so same as GPIO 35, and also is SPI1_MISO, so won't be available if SPI1 in use)

    SR04 Ultrasonic range finders

    SR04 ultrasonic distance sensor signals


    ultrasonic sensor symbol

  16. Interrupts and threading [PDF]   [ October 30, 2017 ]
    Interrupts on Wikipedia
    Threading on Wikipedia
    Interrupts on the Raspberry Pi with Python

  17. Real Time Programming   [ November 29, 2017 ]

  18. Block Diagrams   [ February 13, 2019 ]
    Block Diagram Elements [HTML]   [ November 9, 2017 ]
    Block Template
    Create one of these for each device you use.

    Signals for block diagrams library for Dia
    Use this if you are installing Dia on your own computer.

    draw.io online drawing app
    Block_test.drawio Sample signals

  19. Quiz during next lecture!
Lecture: More about operational amplifiers and other devices to alter signals
  1. Results of AL exercise

  2. Success versus completion
    This ignores 45% of the grade (projects and online).
    It ignores performance.

  3. Wheatstone bridge circuits   [ October 18, 2016 ]

  4. Wheatstone bridge animation

    electricity humour

  5. Operational Amplifier Dynamic Response [PDF]   [ October 9, 2015 ]
  6. Neat animations of op amp circuits

  7. Analog Sensors [PDF]   [ October 19, 2018 ]
    analog sensor symbol
    Infrared distance sensor - GP2Y0A21YK
    Can the distance sensor feed directly into the ADC? (See Fig. 5 in datasheet.)

    Photodiode - sfh229
    Hall sensor - 3503
    Capacitive soil moisture sensor
    Resistive soil moisture sensor
    Pulse rate sensor
    Pulse rate sensor (back)
    sensor interfacing

  8. Use of Differential Amplifier Circuits [PDF]   [ February 8, 2019 ]

  9. Operational Amplifier Circuit quiz
    Functionality of common op amp circuits
    Timer (6 minutes)

  10. Signal Conditioning [PDF]   [ May 30, 2017 ]
    comparator symbol
    analog multiplexer symbol
    one shot multiplexer symbol
    switch symbol

  11. draw.io online drawing app
    Sample signals

  12. LED Strings [PDF]   [ January 3, 2019 ]
    WS2812B datasheet
    Ring LED (front view)
    Ring LED (back view)
    Line LED (front view)
    Line LED (back view)
    Matrix LED (front view)
    Matrix LED (back view)
    APA102 datasheet
    SK9822 datasheet

  13. Second SPI channel (SPI1)
    Enabling SPI1 on the Raspberry Pi B+/Zero/2/3

  14. Prototyping options for the Raspberry Pi
    Prototyping options [PDF]   [ October 19, 2018 ]


  15. AB Electronics expansion hats

  16. Extending ports with 74HC595 and 74HC589A shift registers
    74HC595 using SPI
    74HC595 with bit-banging
    74HC589A using SPI

  17. Fritzing design software
    Fritzing Example [PDF]   [ October 24, 2018 ]


  18. Where to get Pi stuff:
    Canada
    USA
    Ebay.ca
    • makervault, universal-solder, and more


  19. Sensors
    Seeed studio
    Grove sensors
    DF Robot sensors

  20. Sensor and actuator inventory   [ November 30, 2017 ]

  21. Online Quiz: Review op amp introduction
    Do quiz on MyLearningSpace between 7 a.m. this Friday and 11:30 p.m. Sunday evening at the end of Reading Week.






Analog computers [video]
analog computers


Op amp tutorial [video]
op amp tutorial

Low pass filter operation [video]
low pass filter operation


Wheatstone Bridges: Introduction [©2003 eFunda; Engineering Fundamentals]
Wheatstone Bridge Animation [screencast of animation]
Wheatstone bridge

Measuring Strain with Strain Gauges [©2005 National Instruments Corporation]

 
 

Four bus breadboards [video]
four bus breadboards




Op amps compared (including open collector) [video]
op amps compared (including open collector)
 

Oct. 24
Lecture: Serial interfaces which various devices use to communicate with the Raspberry Pi
  1. Review of previous quiz Motor
    One group of 5 got 3/5 while every individual got 4/5!

  2. Serial communication (UART)
    Serial Communication-UART [PDF]   [ November 7, 2018 ]

    UART symbol
    If using serial (i.e. UART) sensors, you need to turn off the serial console and feed both signals through the appropriate optoisolators (to and from the Pi).
    Here's the rpi-serial-console script.
    To turn off the serial console:
    sudo rpi-serial-console disable
    To turn on the serial console:
    sudo rpi-serial-console enable


  3. UART devices
    GPS module, RFID reader, Bluetooth module

  4. I2C interface
    Serial Communication-I2C [PDF]   [ February 13, 2019 ]
    Devices come with a default address programmed in, but it can usually be changed.

    I2C symbol
  5. I2C devices
    digital compass (HMC6352), colour sensor (ADJD-S371), light intensity sensor (GY-30), 3-axis magnetometer (HMC5883L), gyro (ITG-3200), 128x32 OLED display

  6. Identifying interfaces (AL exercise)
    Sample interfaces
    Timer (6 minutes)

  7. Single Wire Communication
    Single Wire Interfaces [PDF]   [ October 23, 2017 ]

    1 wire symbol
    single wire interface symbol

  8. CP316 Intro

  9. Need 30 minutes more!

  10. Quiz during next lecture!
Lecture: More different devices and how they interface with the Raspberry Pi and project introduction
  1. Row-Column Devices [PDF]   [ February 13, 2019 ]
    Wiki sections on "more than one channel" and "several channels"
    Also note options for enabling pull-up or pull-down resistors.
    row-column display symbol

  2. Matrix LCD Driver (MAX7219) [PDF]   [ February 13, 2019 ]
    MAX7219 datasheet

  3. MAX7219 8x8 LED matrix
    MAX7219 8 digit 7 segment display

  4. Various displays
    LTP-1415AG Single colour 8x5 display
    LTP-2558A Tri-colour 8x5 display
    Alphanumeric 16 segment LED display

  5. MAX7219 Fritzing Board
    fritzing board

  6. Row-Column with Both Outputs and Inputs
    row-column keypad symbol

  7. TM1638 datasheet (LED/Keypad controller)
    TM1638 key/display board

    TM1637 datasheet (LED/Keypad controller)
    TM1637 display board (front)
    TM1637 display board (back)

  8. Some input options
    capacitive hex keypad
    TM1638 key/display board
    Telephone keypad

  9. Response-time sensors; shaft encoders and ultrasonic sensors
    Pulse Width Modulation Communication [PDF]   [ August 14, 2020 ]

    Note: On the Raspberry Pi 2, there are 4 possible hardware PWM pins:
    • BCM GPIO 18 (using PWM0, so same as GPIO 12)
    • BCM GPIO 12 (using PWM0, so same as GPIO 32)

    • BCM GPIO 13 (using PWM1, so same as GPIO 33)
    • BCM GPIO 19 (using PWM1, so same as GPIO 35, and also is SPI1_MISO, so won't be available if SPI1 in use)

    SR04 Ultrasonic range finders

    SR04 ultrasonic distance sensor signals


    ultrasonic sensor symbol

  10. Diode and capacitor quiz
    Behaviour of diodes and capacitors in circuits
    Timer (6 minutes)

  11. Project overview
    Outline of all 3 projects [PDF]   [ October 17, 2022 ]
    Note: DC motor needs 1 channel of shaft encoder connected to indicate position.
    DC motor being able to run in both directions and monitor both channels for speed and direction can be a substitution project and the second channel can replace the other input.
    If the TM1638 board is used for input and output, it can replace the second input for the integration project.

    Outline of integration project [PDF]   [ February 22, 2019 ]

    Outline of exploration project [PDF]   [ October 24, 2019 ]

    Option: test (and document) my Fritzing board
    my 
fritzing 
board (front)
    Back of populated board
    Board overview

    Outline of enclosure project [PDF]   [ October 24, 2019 ]

    Integration Project checklist One output can be a "monitoring voltage" or an LED of varying brightness.

    Exploration Project checklist [PDF]   [ October 23, 2019 ]


    Enclosure Project checklist [PDF]   [ October 23, 2019 ]
    If you're going to do the enclosure project, you have to start ASAP.

  12. Raspberry Pi Interface to 28BYJ-48 Stepper Motor

  13. Online Quiz: Review op amp circuits.
    Do quiz on MyLearningSpace between 7 a.m. Friday and 11:30 p.m. Sunday evening.



Permanent magnet DC motor with shaft encoder [video]
DC motor with shaft encoder illustration




Normal servo operation - effect of pulse width [video]
servo motor control


Continuous rotation servo - effect of pulse width [video]
servo motor control (continuous rotation)

Servo Operation and Calibration LM7805 Voltage regulator
LM7805 Voltage regulator datasheet (includes TAB package)
Circuit Integrity - Bypassing [© 2002 Williamson Labs]
Circuit Integrity - Decoupling [© 2001 Williamson Labs]

How a smartphone knows up from down
How a smartphone knows up from down


 

 

Oct. 31
Lecture:
Software and hardware issues with physical computing
  1. Review of previous quiz Diode-capacitor
    7/10 group, individual got 10/10

  2. No post-lab requirements this week! (But if you hand one in it can make up for a missed one.)

  3. Interrupts and threading [PDF]   [ October 30, 2017 ]
    Interrupts on Wikipedia
    Threading on Wikipedia
    Interrupts on the Raspberry Pi with Python

  4. Real Time Programming   [ November 29, 2017 ]

  5. Three options for connecting to devices:
    • Use existing Python libraries
    • Use system commands from within Python (if there aren't Python libraries)
    • Bit-bang your own interface in Python

    Bit banging [PDF]   [ February 13, 2019 ]
    Bit banging on Wikipedia
    Raspberry Pi Interface with Parallax Serial RFID Reader
    Bit-banged serial interface [to RFID reader]
    bit-banging in action


    Bit-banged SPI Interface to MCP3008

  6. Block Diagrams   [ February 13, 2019 ]
    Block Diagram Elements [HTML]   [ November 9, 2017 ]
    Block Template
    Create one of these for each device you use.

    Signals for block diagrams library for Dia
    Use this if you are installing Dia on your own computer.

    draw.io online drawing app
    Block_test.drawio Sample signals

  7. Course review
    Has it all been covered?

  8. Internet of Things [PDF]   [ March 6, 2019 ]
    "Hackers used 'internet of things' devices to cause Friday's massive DDoS cyberattack" - AP, Oct 22, 2016

    "'A window into your life': Why smart home devices might be putting your privacy at risk" - CBC Sept. 28, 2018


    "Google says it forgot to mention there's a mic in its home alarm system Nest" - CBC Feb. 20, 2019

  9. Need 15 minutes more!

  10. Quiz during next lecture!
Lecture: Doing your own physical computing with the Raspberry Pi
  1. Results of AL exercise

  2. Operational Amplifier Circuit quiz
    Functionality of common op amp circuits
    Timer (6 minutes)

  3. Lab schedule

  4. Analog input devices
    hall sensor, photoresistor, photodiode

  5. Design as a process
    Practical design example [PDF]   [ June 23, 2016 ]


  6. Sensor and actuator inventory   [ November 30, 2017 ]
    If using serial (i.e. UART) sensors, you need to turn off the serial console and feed both signals through the appropriate optoisolators (to and from the Pi).
    Here's the rpi-serial-console script.
    To turn off the serial console:
    sudo rpi-serial-console disable
    To turn on the serial console:
    sudo rpi-serial-console enable
  7. Project components - voltage regulators

    voltage regulators

    We have 5V and 3.3V regulators in the lab.

  8. Pigpio libraries
    These use a daemon process running in a separate thread to bit-bang more ports.

  9. Java on Raspberry Pi
    Pi4J Project GPIO access in Java for the Raspberry Pi

  10. Bluetooth
  11. Near Field Communication (NFC) and RFID
    PN532 module

  12. Arduino and the Wiring language
    Arduberry Arduino-compatible Raspberry Pi interface board
  13. Firmata protocol
    Firmata on Raspberry Pi

  14. Reading analog resistance values without an ADC
    Using Resistive Sensors

    (While this example talks about a potentiometer, the process works for any resistive sensor.)

  15. Results of this quiz q7

  16. Online Quiz: Review analog output transducers and controlling power.
    Do quiz on MyLearningSpace between 7 a.m. Friday and 11:30 p.m. Sunday evening.




 
  • Lab A: Raspberry Pi Stepper Motors  [ October 30, 2018 ]

    Note: If you finish early, start on Lab B.

  • Lab B: Controlling Power to a DC Motor   [ October 28, 2019 ]
  • No postlab requirements; you can start on the project.

  • After this week's labs, you know how to control DC motors, stepper motors, and servo motors with the Raspberry Pi.



TM1638 sample board [video]
tm1638 board
 

Nov. 4
No lectures; project schedule
Deliverable (Lab A): One of four devices
Deliverable (Lab B): Two of four devices


 
  • Lab A: Demonstrate 1 input or output device
    Suggestion: Pick a motor, since you should have working code from recently. Then you can choose a distance sensor to start working on for Lab B.
    Echo signal from ultrasonic distance sensor must go through optoisolator!

  • Lab B: Demonstrate previous device and 1 other.
    Note: You can have different test programs for each device, but they must both be physically connected at the same time.
    Decide on 3rd device to use.

Component Inventory

Project components - SR04 Ultrasonic range finders

SR04 ultrasonic distance sensor signals

GP2Y0A21YK
 

Nov. 11
No lectures; project schedule
Deliverable (Lab A): Three of four devices
Deliverable (Lab B): All four devices

 
  • Lab A: Demonstrate previous devices and 1 other.
    Note: You can have different test programs for each device, but they must all be physically connected at the same time.
    Decide on 4th device to use.

    Remember one output can be a "monitoring voltage" or an LED of varying brightness.

  • Lab B: Demonstrate all input and output devices
    Note: You can have different test programs for each device, but they must all be physically connected at the same time.
 

Nov. 18
No lectures; project schedule
Deliverable (Lab B): Integration Project demonstration
Integration Project checklist [PDF]   [ January 3, 2019 ]
Block Diagrams   [ February 13, 2019 ]
Block Diagram Elements [HTML]   [ November 9, 2017 ]
Block Template
Signals for block diagrams library for Dia
(Use this if you are installing Dia on your own computer.)



 
  • Lab A: project work (Remember to include some form of operator interaction.)
  • Lab B: Demonstrate Integration project
 

Nov. 25
No lectures; work on project
On-line Course Evaluation November 27 until Dec. 4
Deliverable (Lab A): Integration project report
Some functionality of exploration device
Deliverable (Lab B): Advanced functionality of exploration device (i.e. something of your own)



 
On-line Course Evaluation November 27 until Dec. 4
  • Lab A: demonstrate basic functionality (i.e. doing something)
  • Lab B: demonstrate advanced functionality (i.e. doing something useful or interesting)
    The goal is to do something that wasn't in an existing example, so that your report adds to the knowledge base for people after you.
 



Dec. 2
 
  Preliminary Exploration project video or screencast
Exploration project demonstration in lab
Deliverable: Demonstrate Exploration project prototype

Documentation and final video due Dec. 5
Exploration Project checklist [PDF]   [ October 23, 2019 ]
 
 
  • Lab A: Demonstrate Exploration project

Resources

To view pdf documents, you can download Adobe Acrobat Reader .
get Acrobat Reader
If you need to update a browser, you might try Firefox which is Get Firefox!
Since this page uses cascading style sheets for its layout, it will look best with a browser which supports the specifications as fully as possible.

If you are looking for an office package, with a word processor, spreadsheet, etc., you might try LibreOffice which is Get LibreOffice!

Go to the main page for the Department of Physics and Computer Science.

Valid XHTML 1.1

Valid CSS!

WCAG
2.0
(Level AA)

Wilfrid Laurier University