2021-11-15
-
Project 4 is active ece322-proj4 — https://agnd.net/valpo/322/proj4.html
Hardware you should have by now:
-
SG90 servo (handed out on day19)
-
EN12-HS22AF20 rotary encoder + switch
-
HC-SR04 ultrasonic range finder module
-
5.5x2.1mm barrel connector pigtail for AD2 aux power input
-
Infrared remote
-
IR receiver
-
AAA batteries for IR receiver
-
extra thingies for your project 4?
-
ATtiny85 MCU (so cute)
1. ATtiny85
-
8-bit architecture MCU
-
32 registers
-
64 peripheral registers
-
-
8 KiB program memory flash
-
10k write cycles
-
-
512 B data SRAM ("variables")
-
same block as registers, no CPU difference in hardware (!)
-
disappears when power goes away
-
-
512 B of EEPROM
-
100k write cycles
-
non-volatile storage (keeps value with power off)
-
You can program this MCU using … another MCU! See section §20 Memory Programming, page 147, and see that there are two related programming modes. The Serial Downloading mode makes the chip appear as an SPI slave that accepts a small set of commands to erase the memory, read the contents, or write new values to Flash / EEPROM.
2. ADC — Analog to digital conversion
From the land of real to the discreteness of integers.
Fundamental idea:
-
2N values (usually 0 … 2N-1, but other codes are possible)
-
between vREF- up to vREF+
-
-> Which value is closest to vin?
Terminology:
-
Full scale range: vREF+ - vREF- (V)
-
Resolution: Q = vFSR / 2N (V)
-
Sample rate: fs
-
Quantization error: difference between code value and input voltage.
-
A perfect ADC has quantization errors ± ½ LSb (least-significant bit)
-
Δerr
≤ Q / 2
-
2.1. Types of ADCs
-
Flash or direct-conversion
-
fast: 1 clock
-
requires 2N analog comparators
-
-
Successive-approximation
-
common, tsamp = N × Tsamp
-
One comparator + a digital-to-analog converter
-
-
Ramp-compare
-
ramp voltage and a comparator
-
time-to-compare
-
-
Wilkinson
-
Discharge capacitor by constant current
-
time-to-discharge
-
-
Integrating / dual-slope / multi-slope
-
Slow but can be very high resolution (small Q)
-
Popular in multimeters
-
-
Sigma-delta
-
common for audio-frequency sample rates
-
signal processing tricks!
-