PhysComp Exam 2
What power supply is used for the Ultrasound HC-SR04 sensor?
+5V DC
What is the SG90 servo motor rated at?
0.009 kg/cm or 9g/cm
What is the resolution of the HC-SR04 sensor?
0.3 cm
What is the pulse width range of the SG90 motor?
0.5 - 2.4 ms
What is the trigger input pulse width of the HC-SR04 sensor?
10 micro-seconds
How long should the TRIG Pin be set to HIGH? What happens after the 10 micro-seconds?
10 micro-seconds Is then set to low. At this point, the sensor will transmit a 8-cycle burst at 40 kHz
What is the working current for the Ultrasound HC-SR04 sensor?
15 mA
How many lines and characters does our LCD have?
16 characters by line with 2 lines. 16x2
What is the ranging distance of the HC-SR04 sensor?
2 - 200 cm
What is audible sound range that humans can hear?
20 Hz to 20 kHz
How long is the period or cycle time for the servo motor?
20 ms = 50 Hz
What should the address of the I2C be? What address is this?
27, Slave
What is the max voltage the Raspberry Pi can receive?
3.3V
What is the measuring angle of the HC-SR04 sensor?
30 degrees
How many Hardware Attached on-Tops (HATs) can be stacked?
32 HATs can be stacked on top of each other 128 DC Motors or 64 Stepper motors can be controlled
What is the sonic burst frequency of the HC-SR04 sensor?
40 kHz
What response signal does the DHT11 send to transmit temperature and humidity information?
40-bit data response
How many objects does a car with 4 motors have?
5 objects 1 being the car plus the 4 motors
What voltage does the servo motor need to operate?
5V
What is the ECHO Pulse output and why is it a problem?
5V It is a problem because the Raspberry Pi can only receive a max of 3.3V
Which decorator is used to convert a class instance method to a Setter method?
@fncname.setter
Which decorator is used to convert a class instance method to a Getter method?
@property
How are static methods defined?
@staticmethod
Calculate Vout of a voltage divider circuit when: Vin = 5V R1 = R2 = 110 Ohms Is this voltage acceptable to be received by the Raspberry Pi?
Answer = 2.5 V Yes, below 3.3 V max
Where can public attributes be accessed?
Anywhere in a program
After importing the sys module, what must be done next to append a path for the LCD1602.py module?
Append a path where the single LCD1602.py module and script is located. then do sys.path.append('/file location')
What frequencies can I2C communicate?
At 100 or 400 kHz
When will the ECHO Pin go HIGH on the HC-SR04 sensor?
At the end of the transmission of the sonic burst
What is the thermistor equation?
B = ( (T1*T2)/T2-T1)*ln(R1/R2)
Do we use board or BCM for DHT11 sensor?
Board code will be import board
How is the resistance to temperature relationship determined?
By a ceramic material constant B determined by the thermistor equation
In a DC motor, how can the rotational direction be changed?
By reversing the polarity
When thread has been started, how is it scheduled for execution?
By the OS scheduler
How is a servo motor controlled?
By use of PWM
How are static methods called?
By using the class name
A method that executes automatically when an object is instantiated is known as a what?
Constructor
After the LCD1602.py sys module is imported and location is appended, what is the last step in importing the module?
Do import LCD1602 as LCD
How often does the servo motor check the pulse?
Every T milliseconds. Where T is the time of the Pulse Width
Methods are free standing functions. T/F?
False. they belong to or are part of the definition of a class
What the low frequency below the acoustic range called?
Infrasound
What are the two types of class attributes?
Instance and static attributes
What does the PWM control on the servo motor?
Its position
What module must be imported to use LCD?
LCD1602.py
What is the name given to a behavior that changes the state of an object?
Method
How many pins does thee DHT11 module expose and how many pins does the sensor actually have?
Module exposes only 3 out of the 4 pins on the DHT11 sensor.
Is a thread object runnable as it is originally created?
No created thread object has to be started
Give an example of Multithreading
One thread controlling the motors, one doing the sensors and so on
What is a decorator?
Piece of code used to mark a callable object such as a function, method, class or object
What scope are attribute names without an underscore before their names?
Public scope
What happens to the DHT11 sensor after response signal is sent?
Returns back to low-power consumption mode and waits for next start signal
What variable represents and instance of an object?
Self
What are the two instance methods?
Setter and Getter methods
What communication process does the DHT11 module use?
Single-Wire Two-Way Communication Process
What happens to the DHT11 sensor when Raspberry Pi sends a Start Signal?
Switches from low-power consumption mode to running mode. Then waits for signal to complete
What module must be imported to use a DC motor?
The adafruit_motorkit module
In a small DC motor, is it the shaft of the magnets that are rotating?
The magnets They rotate as current is applied to the center. This is opposite for larger DC motors.
If a thread function returns a False, what happens?
The thread is terminated, only the first brain will be running now.
What is a quantum?
The time in microseconds that a thread runs in
What is the duration of the Raspberry Pi and 40-bit response?
This is known as a communication process and has a duration of 4 ms
How does a DC Motor use an H-Bridge to rotate in the forward direction?
Top left and bottom right switches are closed
How does a DC Motor use an H-Bridge to rotate in the reverse direction?
Top right and bottom left switches are closed
The number of signal wires used with the I2C protocol is?
Two
What the high frequency above the acoustic range called?
Ultrasound
How long will the ECHO Pin stay HIGH on the HC-SR04 sensor?
Until the sensor receives an ultrasonic burst. Pin will then go to LOW state
How many devices can an I2C support?
Up to 1008 peripheral devices
What circuit is used to wire the HC-SR04 sensor?
Voltage Divider Circuit
What is the output range (Both Voltage and Current) of a Quadruple Half-H-Bridge?
Voltage is -3V to VCC2 +3V Current is +-1 A
What are the 3 pins exposed by the DHT11 module?
Voltage: 3.5 - 5 V (we use 5V) GND S: Data
What is the voltage divider equation?
Vout = ( R2/(R1 + R2) )*Vin
When does a thermistor change its physical resistance?
When exposed to changes in temperature
In Python, the name of the constructor method is always what?
__init__(self,...,...)
How would you instantiate the MotorKit object as as static attribute?
__motorKit = MotorKit(i2c = board.I2C())
What thermistor have we been using?
a DHT11 sensor that measures Temp. and Humidity
Define a Setter method
an instance method which provides the mechanism to set the value of a private attribute
What do objects consists of?
attributes, methods (funcs) and properties
How is the LCD initialized?
by the 'init' func.
Where is the only place that private modifiers can be accessed?
class and methods belonging to the class
How does the sensor calculate distance?
d = v*(T/2) v = speed of sound T = Pulse width of ECHO Pulse
How would you import the motorkit library and adafruit_motorkit module?
from adafruit_motorkit import MotorKit
To create a thread in a Python code, what must be imported? How is this coded?
from threading import Thread
To determine the address of an LCD, what needs to be typed into the bash?
i2cdetect -y 1
When using DC motors, is BCM or Board module used?
import board board module is what is used to access I2C interface
To import the LCD1602 module, what must be done first?
import the system module by doing import sys
What are instance attributes defined in?
inside a method
Are static methods global or local methods of a class?
is a global method called not on an instance or object of the class
Define a Getter method
is an instance method which provides access to the value of a private attribute
How would one clear an LCD?
lcd.clear()
What is the actual code used to initialize the LCD?
lcd.init(0x27,1) where the 0x27 is the slave address
To write something on the LCD, what does the code look like?
lcd.write(0,0,'Text') first input is the starting character ranging from 0-15, and the second is 0-1 which indicates which line is wrote on
To determine if the I2C module is enabled, what needs to be typed in the bash?
lsmod | grep i2c_
What library needs to be imported for the DHT11 sensor?
need to do import adafruit_dht
Is the NTC thermistor a linear or non-linear resistor?
non-linear
Where are Class Attributes, aka Static Variables defined?
outside instance methods but inside the class
What are the three types of modifiers that can be applied to an Attribute?
public, private and protected
What are the 3 components of four pin DHT11 sensor?
resistive type humidity measurement Negative Temp coefficient (NTC) Temp. measurement 8 bit high performance microcontroller
What is the first parameter of an instance method?
self
What are instance attributes specific to in a class?
to an individual object (an instance) of a class
At a -90 degree position, what will the ton and DC be for the servo motor?
ton = 1 ms DC = 5%
At a 0 degree position, what will the ton and DC be for the servo motor?
ton = 1.5 ms DC = ton/T = 1.5/20 = 7.5%
At a 90 degree position, what will the ton and DC be for the servo motor?
ton = 2 ms DC = 10%