Friday, 28 August 2020

Happy Hour

Objective
To learn how to maintain real date/time information.
Also learn SMD soldering and I2C protocol.

The end-product has following features:
  1. When given 5V, it shows live date, time, day and temperature
  2. When no power, it runs on battery - no display but timekeeping continues
  3. When there is an event, it shows ‘Happy Birthday/Anniversary’ message
  4. It can be programmed with new code e.g. updating events
  5. From an event, you can go back to normal display by pressing a button
  6. You can update date/time/day using buttons

Sample projects
  1. cxem - RTC using ZS-042 module. In Russian but simple with photos and code
  2. video - RTC using Arduino but helpful hints on basics

Paper diagram



New components
  1. ZS-042 module - link to buy
  2. DS3231 (the main timekeeping chip behind ZS-042 module) - datasheet
  3. I2C interface basics video
ATMega328 is used as the microcontroller (same as previous project).

Notes on DS3231
  1. Vcc (2.3-5.5v, typ 3.3v), logic 1 (0.7*Vcc-Vcc+0.3), logic 0 (-0.3-0.3*Vcc)
  2. BCD - Most values are stored in this format
  3. 2's complement - temperature is stored in this format
    • positive number, no change (same as binary), 
    • negative number, invert & add 1
    • if 8 bit can store 0-255, in 2's complement form, it will store -128 to +127
  4. Pull-up resistors 4.7k on each SDA/SDL/32K/INT lines, reset does not need an external pull-up (has an internal 50k ohm pull-up)
  5. ZS-042 module has all these pull-ups (4.7k), no need for external resistors
  6. Same i2c interface pins can be used for both DS3231 and eeprom (the two chips present on ZS-042)

Notes on I2C

  1. SDA/SCL pins in I2C are Open-drain pins. Connect to 5V via pull up resistors
  2. SDA/SCL pins in atmega328 have internal pull-ups also available. Not used but some information
  3. SCL frequency = f_cpu / (16 + (2*TWBR*Prescalar)). Tried speeds 100-400 KHz - all worked. Settled on 200 KHz. Display is refreshing fine every second
  4. AVR cpu speed to be increased from 1MHz (projects so far) to achieve the minimum (100khz SCL frequency). Increased default 1 MHz to 8MHz by removing clock division by 8. For this low fuse byte changed - bit 7 changed from 0 (programmed) to 1 (unprogrammed).
  5. It is necessary to define F_CPU in makefile because clock speed is needed at compile time. Adding F_CPU definition in C file/.H file did not work.

  6. Lcd is very useful in i2c debugging since many intermediate statuses/ACK/register values are to be printed.
  7. Printing register values in 8-bit binary format is very useful on LCD. First line on LCD : name of register and expected value, 2nd line : actual value. Added function printregister() in lcd.h to do this printing.
  8. io.h having I2C registers values etc. Link
  9. I2C status codes - names and hex values. Link
  10. To send data on I2C, setting start bit separately first and then setting TWINT and TWEN does not work - all 3 have to be done together!
  11. Do we need to enable 'twen' every time we set 'twint' to 1? YES! 
    • Why twen bit has to be set everytime
    • when twint is 0, system is doing something (transmission)
    • when twint is 1, system has completed transmission & is waiting for you. 
    • You do something (eg. load data to send) & write twint to 1 (this is weird but it is like this)
  12. TWIE bit is to remain 0 as we are polling (page 225)


Most used registers (useful link)

TWCR    TWINT    | TWEA       | TWSTA | TWSTO | TWWC  | TWEN     |  -  | TWIE

(interrupt flag | enable ack bit | start | stop | write collision flag | twi enable|-| twi interrupt enable)


TWDR to send/receive data or memory location


TWBR to set bit rate;  SCL freq = CPU clock freq / (16 + 2 * prescalar * TWBR) 

// Prescalar = 1, TWBR = 32, CPU clock 8 MHz, SCL freq = 100 KHz


TWSR will have status information after every operation [in bits 3-7, bits 0-1 are for pre-scalar; bit 2 is not used]. Status can be from peripheral (RTC or simply result of an operation eg. START sent successfully)



Transmission statuses in master transmitter (MT) mode
0x08 - Start transmitted - TW_START
0x10 - Repeat start transmitted - TW_REP_START
0x18 - SLA+W transmitted, ACK received - TW_MT_SLA_ACK
0x20 - SLA+W transmitted, NACK received - TW_MT_SLA_NACK
0x28 - Data byte transmitted, ACK received - TW_MT_DATA_ACK
0x30 - Data byte transmitted, NACK received - TW_MT_DATA_NACK
0x38 - Arbitration lost

Statuses in master received (MR) mode
Start/repeat start are same as above
0x40 - SLA+R transmitted, ACK received - TW_MR_SLA_ACK
0x48 - SLA+R transmitted, NACK received - TW_MR_SLA_NACK
0x50 - Data byte transmitted, ACK received - TW_MR_DATA_ACK
0x58 - Data byte transmitted, NACK received - TW_MR_DATA_NACK


I2C (TWI) steps (summary link)

To write to ds3231

  1. send start
  2. send slave device address (for RTC 1101000) + '0' for write
  3. receive ack 0
  4. memory location address (where to write) [00h-12h timekeeping registers of RTC]
  5. receive ack 0
  6. send data byte
  7. receive ack 0
  8. send data byte
  9. receive ack 0
  10. send stop

To read from ds3231

  1. send start
  2. send slave device address
  3. send 0 for write
  4. receive ack 0
  5. memory location address (where to read from) [00h-12h timekeeping registers of RTC]
  6. receive ack 0
  7. send repeat start
  8. receive ack 0
  9. send slave device address + '1' for read
  10. receive ack 0
  11. read data byte
  12. send ack 0
  13. read data byte
  14. send ack 0
  15. read data byte
  16. send nack 1
  17. send stop


Tests

  1. read all RTC values (one by one)
  2. read in quick succession to see seconds/minutes working
  3. read continuous memory locations (auto append of memory location)
  4. BCD to decimal/binary conversion (bit shift)
  5. decimal/binary to hex/ascii char conversion (+48)

Program logic for basic read/write

start

sla+w

first memory location 00h

set all rtc values starting from 00h (auto append of memory location pointer 00h-05h)


//while loop start - for continuous clock

repeat start

sla+w

memory location reset - 00h

repeat start

sla+r

read all rtc values - starting from 00h (auto append happens for memory location pointer 00h-05h)

print rtc buffer

delay 1ms

// while loop end



User interface - buttons

  1. Added 4 buttons to update date/time at microcontroller GPIO pins: setup (normal button - self locking), mode, + and - (3 push buttons)
  2. To add a button in atmega gpio pin - default is high (connected to 5V via a pull-up resistor), pulled low when pressed (push button connects to ground)
  3. GPIO pins pullup resistor value - 20-50k as per datasheet, used 39k on Breadboard and 47k on PCB


Overall program flow (final)

Setup atmega pins data direction for buttons

Initialise LCD

Set I2c speed

Check if RTC is at factory default, if yes, set date/time as per system*

Continuous loop 1 starts

    Read live values (date/time/temperature) from RTC and display on LCD


    If 'setup' button is pressed, continuous loop 2 starts

            >show default mode ie current year on LCD

            >user can press mode button to change to other modes ie current month, 

                date, day, hour, minute

            >+/- buttons are used to change a value

            >press 'setup' button again to save changes and exit

    Continuous loop 2 end


    If current date matches one of the event dates (birthday/anniversary), show             ‘happy <event>’ on LCD

             >to go back to normal display, press 'mode' button

Continuous loop 1 end


Getting date and time from system, __DATE__ & __TIME__ functions in gcc. Conversion of formats



Battery

  1. Tested zs-042 with battery. It works on battery when Vcc is switched off
  2. RTC value does not change on make flash/reset button. 
  3. To revert RTC to factory default, remove battery and switch off power
  4. CS2032 (non rechargeable) 225 mAH - readily available and cheap. Life can be 5-10 years based on RTC requirement of 3.5 uA (max) - not tested
  5. LIR2032 (rechargeable) 50 mAH - not readily available
  6. Useful links:


Breadboard







Kicad Eeschema








Kicad steps

  1. Page properties update
  2. Add key components (symbols)
  3. Add connector wires (most easy first)
  4. Add not connected symbol where needed
  5. Add small components like resistors, capacitors, switches etc
  6. Add power and ground symbols
  7. For neatness:
    1. Update symbols to rearrange pins if needed (right click, properties->edit with lib editor)
    2. Place properly with distance, move around component, label, reference value
  8. Connect components without wires if neat (using net labels) ex. exposing all atmega pins via connector
  9. Check all power input pins are marked so in various components
  10. Make all power output pins as passive if marked as ‘power output’ in component symbols
  11. Add power flags to power sources
    1. One each in all positive terminals
    2. One to ground
  12. Annotate
  13. Run ERC


Settings to update in pcbnew



 Spec name (lion) Specs (lioncircuits) Actual used Kicad setting
 Minimum Board Dimension 3mm * 3mm  
 Copper weight 1 oz (35um),
 2 oz (70um)
 1 oz 
 Board (PCB) thickness 1.6 mm 1.6 mm Layers setup
 Board (PCB) Finish HASL   
 Minimum trace width 6 mil10 mil
30 mil for power
 Design rules
 Annular ring thickness 6 mil manual chk Pad properties
 Minimum trace spacing (clearance) 6 mil 12 mil Design rules
 Trace and Copper pour distance (clearance)  8 mil 12 mil 
 Between vias distance (clearance) 12 mil  12 mil 
 Via and trace distance (clearance) 12 mil  12 mil 
 Circuit to edge 12 mil  manual chk 
 Silkscreen and solder pad distance 6 mil manual chk 
 Solder mask dam width (min solder mask width)  6 mil  6 mil Pads mask clearance
 Solder mask clearance after pad  2 mil Pads mask clearance
 Drill hole diameter  14 - 248 mil  via dia 30 mil
 via drill 15 mil
 Design rules
 Silkscreen minimum text height 23 mil manual chk 
 Silkscreen minimum text width 6 mil manual chk 

Other notes

  1. Grid resolution while creating
    • schematic 10 mil
    • pcb layout 50 mil
    • trace drawing 10 mil
  2. Courtyard layer specifies the minimum distance a component needs before another starts
  3. Settings —> setup; Load netlist after completing settings
  4. Boundary —> edge cuts layer, draw using lines, thickness 0.001, set grid to 10 mil - these are final board dimensions and are related to cost, matching LCD dimensions (80 * 35 mm) to begin with
  5. Layer selection each time: select FCu (Front copper) now
  6. To layer LCD on top of main PCB - position of first pin and mounting hole to be carefully calculated from edge of PCB
  7. While making tracks change the grid to 0.1 mm for better bends
  8. Tried ways to fit 14 tracks between uC and pin socket: track width - tried 6 mil, 8 mil, 9 mil - all 3 can go through uC/pin socket pins, 10 mil cannot - although distance b/w pins is 13 mil ((2.54mm-0.8*2mm)-12*2mil)!
  9. Pin socket footprint to be updated - pins in sequence w.r.t uC, silkscreen etc.
  10. Bottom silkscreen display mirrored, text name of board, width and height 0.1”, thickness 0.02"
  11. For ground pour, place zone on both top & bottom layers, outside boundary
  12. If needed (by some fabrication service), file extensions may be changed:
    • .gm1 —> .gko (no need to do this for LionCircuits)
    • .drl —> .drd (no need to do this for LionCircuits)
  13. Gerbers: 
    • File—>Plot. Lion circuits link on how to generate gerbers
    • Check generated files by opening in Gerbview: load drill first (File->Open Excellon Drill files), then all others by multiple selection (File->Open Gerber Files). Check each by selecting just that one





Printed PCB (from lioncircuits)




SMD soldering experience

Reflow soldering with solder paste

  1. 1st attempt: silicon mat burnt at ~160-180*C, solder was good
  2. 2nd attempt: bigger pan blackened from 2 spots at 160*C, base became uneven, board burnt from 1 corner (small)
  3. 3rd attempt: smaller pan burnt (from almost all over) at 160*C, board burnt further from 2 places (copper visible from one place)
  4. 4th attempt: bigger pan at 180*C, board burnt further from 2-3 places

Learning: Multimeter (a good one) can measure temperature, that too of high range. No need to buy expensive IR thermometer. We have used Meco 108B+TRMS model.

Resources that helped a lot:

Steps for reflow soldering with sand - final process
  1. Apply solder paste on pads and place DS3231 SMD chip using a tweezer. Link for solder paste used.
  2. Sand in pan with temperature probe. Switch on gas on highest setting. Reach 250*C
  3. At 250*C, place pcb (on silver foil) on sand. Cover. Place probe in sand through hole in cover. Gas burner remains on at high.
  4. Start watching carefully. At 300*C, switch off gas
  5. Keep watching carefully. Solder should start melting at anytime between 1 to 5 minutes after placing the PCB
  6. When reflow happens, solder becomes shiny and flows on pads properly
  7. Remove cover, using a spatula and spoon remove PCB (with foil) and place to cool
  8. Use solder wick to clean bridges (if any)









Through hole (THT) soldering experience

  1. Put paper tape on loose components to hold them. Then solder from other side. Tape ensures components stay flush on board
  2. Solder front side components (buttons specially the big one) and berg strip only after LCD to avoid uneven board surface right in the beginning
  3. Solder LCD pins to board first, then pins to LCD!
  4. Soldering order:
    • Bulk (including atmega, resistors, capacitors etc.)
    • Battery holder, barrel jack, lcd pins to board
    • LCD
    • Front buttons and berg strip
    • Big button
  5. Clean with 99.9% Isopropyl alcohol and an old soft bristled toothbrush
  6. In hindsight - Should have put hot glue in between the pub and lcd (when lcd is pressed , it restarts - may be making some unwanted connections)





Software error while pushing code to Happy Hour (due to recent macOS upgrade to Catalina)

  1. Sort out the shell
    • chsh -s /bin/zsh : this changed the shell to zsh (default in catalina)
    • nano .zshrc, update path e.g. export PATH=" "
    • Ctrl+O (to save), Return to confirm file, Ctrl+X to exit
    • . ~/.zshrc to activate
    • echo $PATH to double check
    • This changes the path for all sessions
  2. AVRdude v6.0.3 not working (Bad CPU in executable)
    • Downloaded latest v6.3 from here
    • Installed in /usr/local/avrdude-6.3
    • How to update 
    • Steps to get it working from official pdf

      • $ cd avrdude-6.3 
      • $ ./configure 
      • $ make 
      • $ su root -c ’make install’ 
  3. No USB support error
    • Downloaded latest libusb v1.0.23 from here
    • Copied (libusb-1.0\libusb.h) in AVRdude folder (/usr/local/avrdude-6.3)
    • Compiled AVRdude again (above 4 steps)
  4. Downloaded latest version of AVR tool chain (libc v2.0.0/ gcc v9.3.0/ binutils v2.3.4/ gdb v8.3.1) from here


Program not flashing in one of the happy hour boards

Next steps: to de-solder LCD, ATMega, replace ATMega, re-solder


Link to code

Link to previous project: LCD

Link to previous project: Good Listener


Experience with eeprom memory (AT24C32present in the RTC module (ZS-042). No extra connection was needed on the breadboard.
  1. I2C steps are valid. Difference from DS3231 I2C transmission:
    • Current address read ability
    • Two bytes address (instead of 1) 12 bits needed for 4096 bytes
  2. Writing to be done 'page' by 'page' (32 bytes), explicit rollover required. Not required for 'read'.
  3. Special case may be required for 'last' page
  4. Device address is 1010111 (last 3 digits A0A1A2 are 111 instead of 000)
  5. System hangs if you send i2c read/write without stop. this was not the case with rtc.
eeprom testing

  1. write & read one byte - did not work initially because of no delay between write and read. Datasheet recommends 10 ms delay. Working with 2 ms.
  2. write & read one page (32 bytes)
  3. write & read 2/2+/3 pages (rollover across pages)
  4. write & read last 2-3 pages (rollover across last memory location and first - loop - overwrite first page)
  5. read from file - ability to change start memory location 

Tuesday, 30 June 2020

Book notes - practical electronics for inventors

Capacitors store energy as electric
Inductors as magnetic

1 june 2020
Low pass filters
Input/Output impedance

2 jun
High pass filters - only high frequencies
Band pass filters - only allow a band of frequencies to pass
Notch filters - allow all frequencies except a band in the middle

3 jun
Attenuators
1. using simple resistors based voltage divider to reduce voltage - independent of frequency
2. capacitors added to deal with stray capacitance. r1c1=r2c2 so divider remains frequency independent

4 jun
Transient circuits
1. In DC, the time when switch is opened/closed, voltage/current changes
2. In RC, capacitor starts charging, full (V/R) current initially, decreases to 0 when cap fully charged
3. In RL, inductor initially blocks current, 0 current initially, increases to V/R when inductor turns to wire
4. Time dependent formulae for current, voltages across R/L/C
5. In case resistance is increased by switch (no impact on source voltage), inductor doesn't let current to drop so supplies increased voltage (VL), total current = supplied by inductor (VL decreasing by time)
+ supplied by source

6 jun
Transient circuits contd..
1. There are three ways to calculate inductor's response (induced voltage) to change in current/resistance/voltage
a. using the concept that inductor will increase it's voltage to ensure current remains as before (#5 above)
b. induced voltage will be proportional to change in current
c. using formula, induced voltage = Ae^(-rt/l), total current = forced + induced, calculate A using values at t=0

7 jun
1. Series RLC circuit (another example of transient - damped harmonic oscillator)
2. if linear first/second order homogeneous differential equation, it will reduce to i=i0*e^at
3. Overdamped: R is large (eg. 200 ohm), current reaches higher peak (transfer from capacitor to inductor), reduces to 0 quickly (as a function of time)
4. Critically damped: R is medium (R^2=4L/C, eg. 100 ohm), current reaches lower peak (~half of case 1) and dampens slowly (~2 times case 1)
5. Underdamped: R is small (ex. 10 ohm), current is sinusoidal, reaches even higher peak (~double) than case 1, dampens slowly (~4 times case 1)

9 jun
Nonsinusoidal periodic sources
1. Fourier series, can be expressed as a summation of multiple sinusoidal waves
2. All functions: V(t+/-T) = V(t), V(t+/-T/2) = -V(t)
3. Even function: V(t) = V(-t), only cosines remain
4. Odd function: V(t) = -V(-t), only sines remain, no DC component
5. Square wave is an odd function (if looked from t=0), even function if looked from t=T/4 (for e.g)
6. There are formulae for common waveforms: square, triangle, sawtooth etc.
6. Very good video on fourier transformation - combining/de-combining waves

11 jun
SPICE 
1. https://www.circuitlab.com/
2. Can quickly change component values to see voltage/current/waveform/other behaviours in circuit
3. Internal calculations are based on conductance, using matrix multiplications/inverse etc.
4. Limitations: does not include noise etc. and hence actual breadboarding is unavoidable

12 jun
Wires, cables, connectors
1. Higher gauge, thinner wire, more resistance per foot

13 jun
High frequency effects on wires/cables
1. Skin effect
2. Can be seen as made up of lots of inductors and capacitors
3. Impedance Z = sqrt (L / C), vary with di-electric, area etc.
4. Impedance matching
    a) if unequal, loss of power (wavelength change, amplitude change), reflection
    b) how to match impedance (using R/L/C voltage dividers)

15 jun
Primary and secondary (re-chargeable) batteries
Memory effect
Red/Green led to indicate battery level using resistor voltage divider and transistor as a switch

16 jun
Switches
  • Poles - how many circuits the switch can control
  • Throws - how many outputs each pole can be connected to
17 jun
Relays - mechanical, reed, solid state
AC and DC coils (coils powered by DC/AC source)
Using transistor and relay combination (like we did in raspberry pi dashcam) for low/high current setting

18 jun

Resistors - fixed, var, photo, pots, fusible

power rating, voltage rating; choose whose power rating >=2*expected power

current divider, i1 = [r2/(r1+r2)]*i

voltage divider, v1 = [r2/(r1+r2)]*v


tolerance (+/-5% ok for most), reliability (dR=per 1000 hrs), temperature coefficient (dR=ppm/C/ohm)


power rating v temperature

resistance v temperature (coefficient)

frequency v resistance


Resistor types

Potentiometers - a current divider when 2 pins are used, is a voltage divider in itself when 3 pins are used


The key features of current limiting and voltage setting are implemented in various ways in electronics. Resistors are used to set operating current and signal levels in circuits, provide voltage reduction, set precise gain values in precision circuits, act as shunts in ammeters and voltage meters, behave like damping agents in oscillators and timer circuits, act as bus and line terminators in digital circuits, provide feedback networks for amplifiers, and act as pullup and pulldown elements in digital circuits. They are also used in attenuators and bridge circuits. Special kinds of resistors are even used as fuses.


21 jun

Capacitors

AC coupling, decoupling, passive/active filters

Non-ideal capacitor parameters:

leakage (parallel resistance), equivalent series resistance (ESR), equivalent series inductance (ESL), and dielectric absorption (memory) = (self recharge voltage/voltage before discharge)


DCWV, Dissipation factor (1/Q), Q = XC/Resr, 

Insulation Resistance(?looks similar to RL, resistance to DC)

Temperature coefficient, IR decreases with temperature

Larger capacitance, smaller resonant frequency

Type of capacitors electrolytic, tantalum, ceramic, plastic film, variable


Capacitor functions - pg 325 photo


Capacitor types (pg 337): Trimmer, air core, vacuum, aluminium/tantalum electrolyte, polyester/polypropylene film, silver mica, ceramic - single/multi layer


Capacitor applications

1. AC Coupling and DC blocking

2. Bypassing


Power supply bypassing

1. noise

2. high current draw from attached device


Shorter leads better

Selecting decoupling caps - rules

1. every IC 0.1 uF per VCC-GND

2. power line start and end: 0.001 uF, 0.01 uF, 1uF (tantalum) in parallel at start and end

3. Placement as close as possible - tick tracks, leads < 1.5mm

4. Lower capacitance for higher frequencies blocking


Consider interface frequency, CPU frequency?


Low-Med-High frequency spectrum

AF = 20 Hz - 20 KHz (audio)

LF = 30 KHz - 300 KHz (RF)

MF = 300 KHz - 3 MHz

HF = 3 MHz - 30 MHz

VHF = 30 MHz - 300 MHz

UHF = 300 MHz - 3000 MHz (3 GHz)



Timing capacitor

Relaxation oscillator: square wave generator

1. Inverter IC - what is it's high/low

2. RC (wave low duration = discharge time, high duration = charge time)


Sample and hold


26 jun

Capacitor applications contd...

1. RC ripple filter - full/half wave rectifier, formulae for ripple factor etc.

2. Speaker crossover network - LR for low freq (woofer), RC for high freq (tweeter)

3. Arc suppression: V<300v, dV/dT<1V/uS, I < minimum arcing current for switch

> Snubber R and C calculation to maintain above levels

4. Active filters: low/high pass filters combined with Op-amps


27 jun

Super capacitor applications

1. Solar energy storage without battery

2. Photosensor based

3. Power backup with current limiting circuit (working not clear) pg 353

Not in this section but other not clear item is - thevenin / norton


For many audio applications, polypropylene and polyester film and even an electrolytic capacitor may be good choices, but for a high-frequency, high-stability decoupling application, up into the megahertz range, an NPO multilayer ceramic capacitor may be required.


28 jun

Inductors

1. Band pass (LC series resonant) and notch filters (LC parallel resonant)

> audio carrier signals, tuned circuits for radio reception

2. Boost and buck converters (

3. Solenoid - open/close doors, valves, switch contacts (relays)

4. Transformers


Non ideal real life resistor, capacitor and inductor





RC / RL charging discharging formulae (page 226)



30 jun

Inductor applications

1. Application v key criteria (not clear) page 363, table 3.8

2. Inductor types, labels


2 july

Inductor applications

1. Filters: low/high/band pass. Differential mode high pass filter (not clear) pg 369

2. Switching regulators (buck/boost/buck-boost)

3. Oscillators - Op amp, colpits, hartley (not clear)

4. Radio circuits - short wave receiver, RF oscillator / transmitter (not clear)


3 july

EMI/EMC design tips

- most things in this section are not clear (page 373)

- from engg. note at this link. Better read the whole note instead of subset in book.


6 july

Transformers

  1. Vs/Vp=Ns/Np, Is/Ip=Np/Ns, Zs/Zp=sqr(Ns/Np), Ps/Pp=n (65-99%)
  2. Phase difference
    • Vp v Vs = 0 (winding/current in same direction) / 180 (opposite)
    • Ip v Is = 0 / 180
    • Vp v Ip = 90 (without load) / 0 (resistive load) / X (reactive load)
    • Vs v Is = same as Vp v Ip
    • Phase difference does not matter in many circuits ex. AC step-down
    • Phase difference matters in ex. joule thief (video)
  3. Impedance matching: Creating required primary impedance by selecting Np/Ns to match the load in secondary
7 july

Transformers Contd...

  1. Gear analogy: Voltage = torque, current = speed
  2. Bigger gear (more windings) —> more torque (voltage), less speed (current)
  3. Variac
  4. Single winding transformer: use isolation where needed

10 july

Transformers contd…

1. Boosting and bucking - 3rd alternative using wires in series but autotransformers (single wire) are better

2. Isolation transformer - output from secondary (source and return) are not connected to ground hence no shock if you touch


11 july

Transformers contd…

Types: power, audio, air core rf, ferrite/powdered iron toroidal, pulse/small signal


Transformer application categories

  1. to transform voltages and currents from one level to another
  2. to physically isolate the primary circuit from the secondary
  3. to transform circuit impedances from one level to another.


Transformer Applications:

  1. Current measure
  2. Centre-Tap pole (high power to low for homes)
  3. Landscape lighting (multiple voltages) - overall power drawn < capacity
  4. Step-down DC
  5. Transformers-rectifier combinations
    1. Dual complimentary - not clear
    2. Full/half wave
    3. Full wave center tap
  6. Audio impedance matching: Load input impedance should be >= source output impedance
12 july
Fuses and circuit breakers
  1. fast action and time lag
  2. each device should have it's own individually rated fuse (not rely on main circuit breaker rated at higher current)
  3. fuse current rating should be ~50% larger than expected nominal current rating
13 july
Semiconductors
1. Silicon, doping (phosphorus n-type, boron p-type)
2. water analogy (holes don't travel but it appears so - can be related to positive charge of protons)
3. Applications: Diodes, transistors, LEDs, solar cells etc.

15 july

Diodes

P-N junction, Rectifier are diodes that can handle high current


Used in (applications): voltage-multiplier, voltage-shifting, voltage-limiting and voltage-regulator circuits


Types

  1. Silicon - 0.6V, better heat dissipating, high current (rectifiers)
  2. Germanium - 0.2V, not above 85*C, can detect lowest voltage, high frequency signals, replaceable by schottky
  3. Schottky - 0.4V, very low junction capacitance and faster switching (~10 ns), low heat, metal-semiconductor junction i/f, lower junction threshold voltage (0.15v), detects low voltage high frequency signals


16 july

Characteristics

  1. Peak inverse voltage, PIV; 
  2. forward current-handling capacity, IO(max) ; 
  3. response speed tR  (time for diode to switch on and off); 
  4. reverse-leakage current, IR(max) ; 
  5. maximum forward-voltage drop, VF(max); 
  6. peak surge current (Ifsm)


Types: signal, fast switch, rectifier, schottky


Diode/rectifier applications

  1. Voltage dropper - better than resistor as more stable output voltage even with varying current
  2. Voltage regulator
  3. Reverse polarity protection - series, parallel (better)
Transient suppression with fly-back diodes applications
  1. Transient protection. Inductor's magnetic field collapses  inducing negative voltage & then it gets fed back the same into the other end (via diode) hence the oscillating wave.
  2. Transistor relay driver with protection diodes - 2nd diode across transistor (to protect it) not clear (pg 413).
  3. Motor inductive kickback protection
17 july
Diode clamps applications -  clip signal levels, or they can shift an ac waveform up or down
  1. Adjustable waveform clipper
  2. Adjustable attenuator
  3. Diode voltage clamp (DC resotration) - not clear
  4. Diode switch
  5. Half-wave rectifier
  6. Full-wave center-tap rectifier
  7. Full-wave bridge rectifier
18-19 july
Voltage multiplier circuits (applications)
  1. Half-wave voltage doubler
  2. Full-wave voltage doubler
  3. Voltage tripler - not clear (why polarised capacitor?)
  4. Voltage quadrupler
Low current load & RC >> time-period of input AC.
After capacitor is charged, it retains it even if connected to ground (attraction force between two opposite charged plates)
Read charged capacitor as battery to understand total voltage at a node


21 july

Diode logic gates (applications)

  1. AND, OR gates - pull-down (or pull-up) resistors are needed so inputs (A/B/C that can be microcontroller's pins) do not be dangling / floating at any point
  2. Battery backup - ICs are better since diode, being in series, eats up voltage
  3. AM detector - diode just eats lower half of wave, LC tuning circuit, RC low pass filter
  4. Schottky diode termination - diode with ground at anode makes sure no negative voltage passes through (clamping)
  5. ROM
Zener diodes
  1. Reverse bias is the default mode
  2. Keeps voltage across itself constant - by reducing it's resistance, more current passes; acts like a variable resistor
  3. Voltage regulator
    • variable supply voltage
    • variable load resistance
  4. Temperature dependent so not for critical applications, used to supply reference voltage
22 july

Zener diode applications
  1. Split supply from single transformer winding - 0V in between
  2. Waveform modifier and limiter - clip both ends using 2 opposite zeners
  3. Voltage shifter - will pass (V-Vz) after threshold, graph slightly incorrect
  4. Voltage regulator booster - move ground to Vref, Output = Vout+Vref
  5. Overvoltage protection - zener will be reverse biased when voltage increases (beyond desired level), will conduct till fuse is blown
  6. Increasing wattage rating of zener - can handle higher current/wattage using a transistor. Zener controls base supply and overall voltage across transistor (Vce). Why Vbc=Vce? Why not Vbe+Vcb=Vce? not clear
  7. Simple LED voltmeter - increasing number of LEDs glow as V increases
Varactor Diodes (Variable Capacitance Diodes)
  1. As voltage increases, width of junction increases, capacitance decreases
  2. Used in high frequency RF circuits, change capacitance --> change oscillator frequency
  3. Reverse bias voltage should be noise free - can use filter capacitors
Varactor diode applications
  1. FM modulator - LC tuning circuit that drives oscillator to generate wave of carrier frequency. Varactor changes C based on input signal (amplitude/voltage) and hence frequency of oscillator (superimposing signal on carrier). Colpitts LC oscillator not clear.
  2. Oscillator with Pot-Controlled Varactor Tuning - Pot changes C (via dual varactors) in the LC tuning circuit and hence the frequency of oscillator. N-channel JFET and the circuit not clear.
23 july
PIN diodes (P-Intrinsic-N)
  1. Acts like a variable resistor whose value is controlled by an applied dc forward-bias current
  2. Applications
    • transmit/receive switches in transceivers operating from 100 MHz and up
    • photodetectors in fiber-optic
    • RF switching (spst and spdt)

Microwave Diodes (IMPATT, Gunn, Tunnel, etc.)


Problems

  1. Diode when reverse biased does conduct (leakage current), not 'open circuit', so there will be voltage drop that can be calculated using kirchoff law close loops. R(load) minimum would be V-2*(diode fwd drop). Double it.
  2. Clamping circuit. Wave is pushed by Vpeak  - diode drop (0.6v). With load, voltage reduces, high-pass (RC) filter and it's cut-off frequency comes into picture. Actual voltage/current can be calculated through simulation/actual breadboarding
  3. Varying supply and load current - Rs(max) can be calculated considering min input V, max I drawn by load. In this case, Rs should be low enough to ensure load works in these conditions. In case of max V, min I drawn by load, zener will absorb more current. Power rating for:
    • Rs: sqr(Vinmax-Vz)/Rs
    • Diode: Vz * (Vinmax-Vz)/Rs. Don't consider current eaten by load.

LED and Laser diodes

Zener, photo diode and varicap/varactor work in reverse-bias mode


24 july


Transistors Introduction



25 july

    Transistors contd...
    1. Cut-off, saturation, active regions (Q point - desired V/I within active)
    2. Rule 1 (npn): Vc > Vb + few 10th of volts. Reverse for pnp
    3. Rule 2 (npn): Vb > Ve + 0.6.  Reverse for pnp
    4. There are limits for max V/I across the transistor
    5. Ic=Hfe*Ib given
      • temperature, Vce remains fixed
      • rule 1 & 2 satisfied i.e., in active region
    6. Ie = Ic + Ib (emitter always has max current) for both npn and pnp
    7. Ic = Ie approx if Hfe is large (mostly the case)
    8. Trans-resistance = 0.026/Ie
    9. Applications (Configurations)electrically controlled switching circuits, current-regulator circuits, voltage-regulator circuits, amplifier circuits, oscillator circuits, and memory circuits
    10. Switch NPN

      • Load should not drop Vc so much that rule 1 breaks
      • R1 should be such that Vcc >= 0.6
      • R2 should be large so very less I flows to ground (in OFF situation)
    11. Switch PNP
      • R2 should be high so Ib to ground is low in ON situation
      • R2 & load resistance are related as both are passing current when ON and their currents are related Ic = Hfe * Ib
      • R1 should be (small and) such that Ve-Vb<=0.6 to switch OFF
    12. Current source
      • Ic = Iload = (Vb-0.6) / Re. 
      • Base voltage & emitter resistor are driving current at load (collector)
    26 july Transistor applications (configurations) contd...

    13. Current biasing methods: 
    • same voltage source for C and B
    • split voltage using resistor divider or zener
    14. Emitter follower
    • no voltage gain, high current gain, negative spike is clipped
    • Vout=Vin, Iout=Hfe*Iin, Rout = Rin / Hfe
    • Approximations done ignoring 0.6v, (Re||Rload = Re) etc.
    • Input impedance can be calculated hiding start of circuit - consider everything towards the right including load
    • Output impedance can be calculated hiding load - consider everything towards the left
    15. Emitter follower (common-collector) amplifier
    • Current gain, no voltage gain
    • Capacitors at both ends to pass (and filter) AC, high-pass filters, no clipping
    • Resistor voltage divider adds DC to ensure full signal passes (Vdc-Vpeak>0.6) at all times
    • Choose component values as per desired output
    • Use input/output impedance calculation (from #14) considering DC and AC aspects
    • (Input impedance of load) should be > 10 * (output impedance of source)

    27 july Transistor applications (configurations) contd...

    16. Common-emitter configuration
    • Vout from collector, voltage gain, current gain?
    • Vout = Vc = 1/2 Vcc to allow for max swing without clipping (not clear). This is same as common-collector when Vout was from emitter
    • Gain = -Rc/Re, negative since Vb increase -> Ic increase -> Vc decrease
    • 'deltas' (change) in V/I in formulae due to AC
    • Add Re to stabilise gain, add C to increase gain
    17. Common-emitter amplifier
    • Similar to #15 except Vout from C hence a resistor there
    • Only 1V at Ve (for temperature stability) since you don't take Vout from E
    28 july Transistor applications (configurations) contd...

    18. Voltage regulator
    • with zener - output of zener is input (base) of transistor
    • zener and two transistors - output (emitter) of 1 transistor is input (base) of other
    • Darlington pair: 2 transistors as above. Hfe = Hfe1 * Hfe2. Large current, high input impedance but voltage drop double (0.6*2) and slower response
    Note (for most transistor applications): 
    For voltage amplification, output from Collector only
    For current amplification, output from Emitter (or Collector)

    Transistor types

    Important points: Maximum current (Ic/Ib/Ie) and breakdown voltage ratings (Vbe/Vcb/Vce) must be respected. Diodes to avoid.

    Digitmal multimeter to detect transistor type (npn/pnp), pinout designations (ebc/cbe etc) and hfe

    29 july
    Transistor applications
    1. Relay driver: low->high current, flyback diode
    2. Differential amplifier
    • two inputs, amplifies the difference, common-emitter
    • used to remove noise/EMI that get on both wires
    • gain = Vout / (V1-V2)= Rc/Rtr
    • CMRR (video)
      • Common mode rejection ratio
      • should be infinite (more the better)
      • varies with frequency of input (decreases as noise frequency rises)
      • Low frequency noise can be filtered out using low pass filter
      • When V1=V2, Vout should be 0 but it's not (Vocm)
      • Vocm = Acm * Vicm (common mode)
      • In differential mode, Vout = Ad * Vid + Vocm
      • CMRR = Ad / Acm = 20 log (Ad/Acm)
      • Datasheet has value for open-loop, same is approximately valid for closed loop (i.e., more practical circuits)
      • Op-amp is very similar to differential amplifier
    30 july
    3. Complementary-symmetry amplifier
    • npn and pnp: switch on complimentary at +0.6 and -0.6 respectively
    • crossover distortion near 0v
    • used in dc amplifier - not clear
    4. Current mirror
    • 2 pnp (or npn)
    • control current in one (using resistors + feeding one's collector into base of both), and that will reflect into other (with load)
    5. Multiple current sources
    • extend above with 3 load transistors
    • add 1 extra transistor on 'control' side to avoid a 'saturated' (eg. load removed) transistor 'steal' large I reducing I for others - not clear
    6. Bistable multivibrators (flip flops)

    Transistor states (operation modes)

    Saturation -- The transistor acts like a short circuit. Current freely flows from collector to emitter.
    Cut-off -- The transistor acts like an open circuit. No current flows from collector to emitter.
    Active -- The current from collector to emitter is proportional to the current flowing into the base.
    Reverse-Active -- Like active mode, the current is proportional to the base current, but it flows in reverse. Current flows from emitter to collector (not, exactly, the purpose transistors were designed for).


    Above videos are using transistors. Multivibrators can be made using Op-amp and 555 timer IC too.

    Notes:
    • One transistor starts conducting before the other
    • If a capacitor is charged with +V at plate A and you apply 0V to A then B becomes -V

    7. Transistor logic gates - OR, AND

    31 july
    JFETs (junction field-effect transistors)

    • normally on (when Vbs = 0), apply -ive at base, starts resisting
    • high input impedance ~10^10 ohms!
    • Applications: bi-directional analog switching circuits, input stages for amplifiers, simple two-terminal current sources, amplifiers, oscillators, electronic gain-control logic switches, audio mixing circuits etc.
    JFET states

    1. Cut-off (Vgs-off ~ -0.5 to -10v)
    2. Ohmic region (Vds controlled resistor)
    3. Active (Vgs controlled)
    4. Saturation (Idss constant ~ 1mA to 1A)
    5. Breakdown (Bvds ~ 6-50 v)
    Transconductance, On resistance, Input impedance: relation not clear


    1 Aug
    JFET Basic operations (applications)
    1. Light dimmer: 3 JFETs each with bulb, different voltages at base

    2. Basic current source and amplifier: shorting source and base (self-biasing), Vgs=0, max current (Idds) not stable, add resistor b/w source and ground to improve stability. not as stable as good bi-polar/op-amp current source

    3. Source follower (common drain) - not clear
    • AC applied to JFET
    • Vgs not stable, Vout not stable (because of gm etc.)
    • Add bi-polar transistor to improve - not clear how bi-polar fixes voltage at base
    • Add JFET to improve - not clear
    • dId = dVgs * gm (gm is equivalent to beta from bipolar)
    • rd = dVds/dId @ Vgs (output impedance)
    • Input impedance is considered infinity
    2 Aug
    JFET notes from youtube - all about electronics videos
    1. Vp is pinch-off voltage, consider 'negative' e.g. -4v
    2. Graph is most important to understand regions
    3. Any circuit, understand which region it is operating in (Or assume saturation & then validate it)
    4. Ohmic: fix resistor if Vds vary (<Vgs-Vp), Vgs fix (between 0 and Vp)
    5. Saturation: variable resistor if Vgs vary (b/w 0 and Vp) & Vds fix (>= Vgs-Vp)
      • application: linear amplification of AC signal (not clear)
      • Id = Idss * (1-Vgs/Vp)^2
    6. Cut-off: Vgs <= Vp, Id = 0, application: switch (b/w cut-off and saturation)
    7. Biasing: fixed (using another battery at G), self (shorting S and G/via resistor), voltage divider
    8. Self-bias: If Id increases due to temperature --> drop across Rs increases --> Vgs increases --> Id decreases, stabilises the operating point
    4 Aug
    JFET amplifiers (configurations)
    1. Source follower: current gain, output from S, not clear
    2. Common source: voltage gain, output from D, not clear, gain significantly smaller than bipolar
    3. Voltage controlled resistor: operate in ohmic region, works as variable resistor controlled via input at G. Used in gain-control, attenuators, variable filters and oscillator amplitude-control circuits
    5 Aug
    Practical considerations
    1. JFET application categories
      • Small-signal and switching JFETs are used to couple a high impedance source with amplifier or oscilloscope
      • Voltage controlled switches
      • High frequency JFETs used to amplify high frequency signals (RF) or high frequency switch
      • Dual JFETs used to improve source follower circuit performance
    2. Same JFET type (e.g. 2N5457) can have 2 different Vp (cut-off voltage), different Id at same Vgs/Vds! not clear
    JFET Applications
    1. Relay driver
    2. Audio mixer / amplifier
    3. Electrical field meter
    7 Aug
    MOSFETs
    1. Even greater input impedances (~10^14)
    2. Depletion - similar to JFET
    3. Enhancement - similar to bipolar
    4. Gain = gm * Rd
    5. Fourth lead (body terminal): held at a non-conducting voltage
    6. Damaging is easy, even with static charge
    7. Types: switching, high power, high/low driver ICs
    MOSFET Applications
    1. Light dimmer
    2. Current source - highly reliable (<1% error)
    3. Amplifiers: source-follower, common-source
    4. Audio amplifier
    5. Relay driver (digital to analog conversion)
    6. Direction control of a DC motor
    10 Aug
    Insulated gate bipolar transistors (IGBTs)
    1. Voltage controlled like MOSFET, high current capabilities like bipolar
    2. For very high power applications like electric vehicles
    Unijunction transistors (UJTs)
    1. Only switch (not amplifier)
    2. Voltage applied at emitter (E), large current starts from E to B1
    3. Equivalent to a diode at E and resistor divider b/w B1 and B2
    4. Voltage vs current graph not clear
    5. Types:
      • Basic switching: used in oscillatory, timing and level-detecting circuits
      • Programmable (PUTs): can be programmed using external voltage divider, used in timer, high-gain phase control, oscillator circuits
    UJT applications
    1. Relaxation oscillator (common principle behind most of it's applications)
      • sawtooth wave converted to small pulses
      • OFF while capacitor (C) charges, ON when C charged>Vtrigger, stays on till C discharges below Vtrigger
      • C and resistors control frequency and amplitude of output
    2. Timer / relay driver: switches the relay ON/OFF repeatedly using C
    3. Ramp generator with amplifier: generates sawtooth using C and bipolar
    4. PUT relaxation oscillator: generates sawtooth and spikes, take output from both sides of C
    Thyristors
    1. Only switches (not amplifiers): a switch of accuracy higher than bipolar (which has a middle state b/w ON and OFF)
    2. Applications: speed control, power switching, relay replacement, low cost timer, oscillator, level-detector, phase control, inverter, chopper, logic, light-dimming and motor speed control circuits
    3. Types: 
      • SCR: ON when I enters G, OFF when anode-to-cathode current stopped
      • SCS: extra lead to switch ON/OFF by applying voltage
      • Triac: two way current (AC), ON only when G is receiving current
      • Four-layer diode: 2 leads, ON only when V > breakdown point
      • Diac: similar to 4 layer but conducts in both directions (AC)
    Silicon controlled rectifier (SCR)
    1. 3 leads, normally off, when a small I enters G, it turns on, does not switch OFF even if current is removed from G, anode-to-cathode current flow must be stopped e.g., by reversing voltage polarity
    2. Applications: switching, phase control, inverter, clipped, relay control circuits 
    3. Types: Low/Medium/High voltage/current. Can be several thousands V/A
    4. Equivalent circuit: npn and pnp transistors sandwiched together
    SCR applications
    1. Basic latching switch: remains on after a push button spike at G
    2. Rectifier: Clips AC input controlled by a variable resistor. Does not waste any power in resistive heating
    3. DC motor speed control: by switching it on and off using C and variable R
    Silicon controlled switches (SCS)
    1. Increased control, triggering sensitivity and firing predictability
    2. Turn-off time 1-10 ms (for SCR it is 5 to 30)
    3. Lower power/I/V ratings (than SCR)
    4. Can be ON/OFF by +/- voltages at both gates individually
    5. Equivalent circuit: back-to-back bipolar transistor network
    6. Applications: any circuit that needs ON/OFF using 2 distinct control pulses, power switching, logic, lamp drivers, voltage sensor and pulse generators
    Triacs
    1. If gate voltage is removed, triac switches off when AC voltage crosses 0 V
    2. Applications: ac motor control, light dimming, phase control and ac power switching
    3. Equivalent to two SCRs placed in reverse parallel with each other
    4. Lower current than SCRs
    Triacs applications
    1. Simple switch: using a typical switch and resistor, saves power
    2. Dual rectifier: using capacitor and a variable resistor, outputs energy efficient pulses of current
    3. AC light dimmer: using a C, var R and a diac, bulb ON/OFF with high frequency (same principle as pulses)
    4. AC motor controller: same principle as above but with a transient suppressor
    Four layer diodes: SCR without a gate lead, switch only DC
    Diacs: pnp transistor without a base lead, switch only AC

    Used to help SCRs and Triacs to trigger properly (avoid unreliable triggering due to temperature etc.)

    Applications
    1. Full wave phase control circuit: using C, var R, diac, triac
    2. Circuit used to measure diac characteristics: using C, var R adjusted till diac fires once every half-cycle
    12 aug
    Transient voltage suppressors
    Types: Bypass capacitor, zener diodes, transient suppressor diodes (TVS), metal oxide varistor (MOVs), multilayer varistor (MLTV), surgectors, avalanche diode, gas discharge and spark gap TVSs, polyswitches

    TVSs
    1. Unipolar, bipolar
    2. Invisible unless transient occurs
    3. Vbr >= 1.1 * Vrwm >= normal operating voltage of circuit
    4. Fuse recommended along with
    5. Applications
      • Inductive loads - protecting driving circuitry
      • Supply voltage over-protection
      • Op-amp applications
      • Transmission line
      • RF coupling (not clear)
    MOVs
    1. Voltage sensitive variable resistor
    2. Bipolar only
    3. Series filter inductor and fuse must along with
    4. Can absorb very large power for a brief time or small power for longer time
    5. Smaller leakage, many p-n junctions inside, work like heatsinks too!
    6. TVS have no wearout, better clamp ratio, faster response time
    7. Applications: Power supplies of computers, mains filters and stabilisers, telecommunication and data systems (power supply, switching), industrial equipment (control, proximity switches, transformers, motors, traffic lighting), consumer electronics (television and video sets, washing machines), automotive products (all auto and electronic systems)
    MLTV
    SMD form of MOV. Much quicker response time. Less degradation.
    Applications: transient voltage protection for ICs and transistors, ESD and I/O protection schemes.

    Surgector
    Silicon thyristor technology. Similar functioning. Bi-directional.

    Polyswitch
    Opposite function - lets current flow normally, trips (stops current) after a breakdown voltage. Like fuse but reusable. Applications: low-cost, self-resetting solid-state circuit breaker, used to limit current in speakers, power supplies, battery packs, motors etc.

    Avalanche diodes
    Similar to a zener diode but very high breakdown voltage ~4000 V. Reverse biased.
    Side effect: RF noise generation.

    Integrated circuits
    1. Analog/Digital, Analog+Digital
    2. Package types: # of pins, power dissipation


    13 Aug
    Optoelectronics
    When and electron changes energy levels a photon is emitted

    A photon collides with an electron in the p-semiconductor side, and an electron will be ejected across the p-n junction into the n side. When a number of photos liberate a number of electrons across the junction, a large enough current is generated (e.g. at the base of a transistor to turn it ON)

    LED applications / configurations
    1. Current limiting / brightness control
    2. Driving from AC using rectifier, capacitor and zener diode
    3. LEDs in parallel - require a resistor each
    4. LEDs in series
    5. Voltage level indicator - using zener (when reverse breakdown voltage is reached, zener provides a wire path)
    6. Polarity switching indicator
    7. AC/DC polarity indicator - in AC, a red-green opposite to each other will appear yellow
    8. Tri-color LEDs - green LED requires higher voltage so a diode is placed to bypass a resistor (that plays a part for red LED)
    9. Blinking (flash) LEDs - can ON/OFF normal LED/transistor. Can handle 3-9 V without resistor
    16 Aug
    Laser diodes (LD)

    Applications: CD/DVD/Blu-ray players, laser printers, laser fax, laser pointers, sighting and alignment scopes, measurement equipment, high-speed fiber optic, free-space communication, pump source for other lasers, bar-code and upc scanners and high performance imagers

    Notes
    1. Very delicate in terms of power/temperature/static discharge
    2. Used with stable power source, feedback photo diode and beam focussing mechanism etc.
    3. Photodiode (PD) gets light and generates current. More importantly it limits current by becoming a wire if the laser intensity rises beyond a point. Current (own generated / via an attached power supply) in 'reverse bias' direction.
    4. Common configuration includes a PNP and an NPN transistor and several capacitors 
      • Normal: PD is OFF, both transistors are ON, LD is ON
      • If spike: PD is ON (reduces current into LD by providing alternate path to power supply current and also by switching OFF/reducing current of PNP transistor). Collector of PNP transistor is put into base of NPN so current in latter also reduces. LD is attached with collector of NPN.
    5. Various precautions needed, DIY power supply very difficult, use modules
    17 aug
    Photoresistors
    1. Resistance decreases from megaohms (in dark) to kiloohms with light
    2. Visible light/IR based
    3. Applications: light meter, light-sensitive voltage divider, dark/light activated relay
    Photodiodes
    1. Become 'current source' (battery) hence current flows from Anode to Cathode (as if operating in reverse-bias configuration) - opposite to a normal diode
    2. Mostly operates with additional battery since own current is small
    Solar cells
    1. Photodiodes with very large surface area
    2. 0.5V and upto 0.1A, response time 20 ms
    Phototransistors
    1. photo-bipolar, photo-fet
    2. extra lead to supply additional V/I at base
    3. Applications: light-activated relay, signal receiver, tachometer
    18 aug
    PhotothyristorsBased on SCR / Triac

    Optoisolators / Optocouplers
    1. Closed pair - LED+ photodiode / transistor / thyristor
    2. Slotted coupler - with a blocker in between
    3. Reflective pair: used as object detectors, reflectance monitors, tachometers and movement detectors
    4. Integrated (e.g. LED+phototransistor in an IC)
    5. Applications: Level shifters, with amplifier (adding another power bipolar to increase current), pulse signal passed through with dc level shift, inverted/as-is
    6. Solid-state relay: When control is ON, MOC3041 (IC with triac and zero-crossing detection) switches ON at every 0 crossing of the signal, keeping outside triac ON, passing the AC signal (from HOT to N)
    Optical Fiber - Laser diode at source, photo diode at destination

    19 Aug
    Sensors
    1. Precision, accuracy and resolution
    2. Types: position, proximity, interial, pressure, optical, camera, magnetic, media, I/V, temperature, special (audio etc.)
    3. Observer effect
    4. Used in circuits as variable R/C/I or switch
    5. ADC should be in-built
    6. Calibration: resistor to ground (or base value) or use lookup table (actual behaviour graphs are complex)
    Temperature sensors
    1. Thermistor
      • NTC/PTC - resistance dec/inc (exponentially) with temp
      • Used as voltage divider, read Vout, calculate R and then T
      • R = R0 e^ [beta* (1/t-1/t0)]
    2. Thermocouples
      • Best range
      • Two metal wires joined at both ends
      • Seebeck effect: when temperature difference at 1 junction (hot), voltage difference at other junction (cold)
      • V measured at hot junction along with Tcold gives Thot
    3. Resistive temperature detector
      • Platinum coil on glass/ceramic
      • R varies linearly with T varies
      • upto 100*C
    4. Analog IC (TMP36): Linear relationship, +/-2*C accuracy
    5. Digital IC (DS18320)
      • Accuracy +/-0.5*C
      • 1 wire serial interface
      • multiple sensors on same data line
      • power via data line
    6. Infrared thermometers (MLX90614)
    24 aug
    Proximity and touch sensors
    1. Resistive touch screen
      • voltage divider using resistors (video)
      • sensor at 4 sides, reading voltage, calculating x,y coordinates
    2. Ultrasonic distance
      • ultrasound reflection
      • depends on object, sound speed in medium
    3. IR optical sensor - light reflection
    4. Capacitive sensor - hand becomes 2nd plate of capacitor, is grounded
    5. Inductive sensor video
    25 aug
    Movement, force and pressure sensors
    1. Passive infrared (PIR)
      • Detects change in IR heat, drives base of a transistor / relay
      • Open collector / open drain (used in I2C) video
    2. Accelerometer
      • Microelectromechanical syste (MEMS)
      • Movement measured as change in capacitance
      • Mass is in between capacitor plates
      • F = k * (x-x0) = m*a
      • Video
    3. Rotation
      • Video
      • Two pins, pulses in one direction are different from others hence both direction and number of degrees can be calculated
      • If clockwise, A (after every change) is opposite of B, if anti, A (after every change) = B
    4. Flow
      • Wind rotates cups
      • proximity sensor (magnetic / optical) generates a pulse after each complete rotation
    5. Force
      • Force sensitive resistor
      • Not very accurate, load cell more accurate
    6. Tilt: metal ball on contacts, rolls off when tilted
    7. Vibration and mechanical shock
      • weight at end of flexible piezoelectric material
      • resistor in parallel
    8. Pressure: ICs
    26 aug
    Chemical sensors
    1. Smoke
      • Radisotope sends ions (current) to detector continuously, smoke stops current
      • IR LED emitting light, smoke scatters it to fall on PD
    2. Gas: heating element, catalytic detector (e.g. for methane), resistive divider
    3. Humidity: capacitative, changes in dielectric constant of a polymer separating the plates
    Other sensors
    1. Light: photoresistors, photo diodes etc.
    2. Radiation: Geiger-Muller tube: high voltage across cathode (casing) and anode (wire), current flows when radiation (e.g. for alpha particle)
    3. Magentism
      • Hall effect. V appears  when I passes through a conductor in a magnetic field
      • Magnet present or not, voltage proportional to magnetic field strength
    4. Sound: Mic-->Amplify-->Rectify-->Low pass filter
    5. GPS
      • receives time signals from multiple (as many as possible) satellites
      • use the difference in those times (due to the time for signals to travel) to calculate position
    27 aug

    Hands-on electronics


    Schematic related

    1. Can add waveforms / other such visible indicators of input / output e.g. 0010, 0011 to schematic
    2. Check mention power ratings on schematic (to ensure you check)
    3. Circuit simulator should be used before even schematic
    4. Always mark polarity on silk screen (+/-) for polarised components


    Safety

    1. ESD mat and wrist strap
    2. Neutral/ground has no role unless someone hot wire touches it (video from simply put)

    28 aug

    PCB related
    1. Edge connector and I/O interfacing (gold plated fingers): one way to join multiple boards together
    2. IC/transistor sockets on PCB: so you could replace if needed
    3. Heat sinks
    4. Can add needle nose plier / heatsink clips to save component while soldering
    5. Casing related notes
      • Standoffs to separate PCB from casing
      • Strain relief for cables
      • Grommet around edges of holes
      • Frequently used switches etc. in front
      • Seldom used switches etc. in back
      • If lot of heat is being generated, add blow fan
      • Medium heat: holes in box can help
      • Major heat producing components (e.g. power resistors/transistors) in back. Connect them to heat sink through back panel
      • Heat sinks with fins should be in vertical direction
      • If >1 board, align vertically for better ventilation
    29 aug
    Multimeters
    1. Analog
      • D-arsonval galvanometer
      • Resistors to control current and calibrate
      • Bridge rectifier to measure AC
    2. Digital
      • Signal scaler - attenuator, range selector
      • Signal conditioner - converts to DC
      • ADC converter
      • Logic/decoders/counters
      • More accurate but more prone to noise
      • 20-33% error due to internal resistances
    Oscilloscopes
    1. Only voltage measure
    2. Cathode ray tube with vertical and horizontal deflection plates
    3. Analog applications
      • Check potentiometer for static noise
      • Pulse measurements - rise/fall time, pulse width, delay, tilt, overshoot
      • Measuring impedances - signal reflection due to different impedances
    4. Digital applications
      • I/O relationships
      • Clock timing relationships
      • Frequency division relationships
      • Check propagation time delay
      • Check logic gates
    30-31 Aug
    Oscilloscope, probes, Lab, general purpose function generators, isolation transformers etc.

    12-16 Sep
    Operational amplifiers (Op Amps)
    1. High performance differential amplifiers
    2. Non-inverting input (V+), inverting input (V-), 2 DC supply leads (+Vs, -Vs), 1 output (Vout), few specialised leads for fine tuning
    3. If V+>V-, output saturates towards +Vs, otherwise -Vs
    4. Negative feedback: Vout = -(Rout/Rin) * Vin
    5. Applications of negative feedback: voltage regulator, I to V converter, V to I converter, oscillator, mathematical functions (+/-/*/integrator/differentiator), waveform generator, active filter, active rectifier, peak detector, sample-and-hold circuits
    6. Positive feedback: opposite effect, less used, special comparator circuits
    7. Water analogy: useful, infinite input impedance, 0 output impedance
    8. Op-amp = high input-impedance differential amplifier+high-gain voltage amplifier + low-impedance output amplifier
    9. Vout = A0 * (V+ minus V-); With negative feedback V- becomes f*Vout
    10. Rule 1: A0 = infinite (ideal), 10^4 to 10^6 (real) [JFET is better than bipolar]
    11. Rule 2: Rin = infinite (ideal), 10^6 to 10^12 (real); Rout = 0 (ideal), 10 to 1000 (real)
    12. Rule 3: I = 0 (ideal), 10^-12 to 10^-9 (real)
    13. Rule 4: Negative feedback is such that V+ = V-
    14. Negative feedback applications
      • Buffer (unity gain amplifier): Rout=Rin (Rsource), useful for circuit isolation applications
      • Inverting amplifier: resistor = R1||R2 b/w non-inverting & ground to minimize input bias current offset errors (especially for bipolar )
      • Non-inverting amplifier
      • Summing amplifier: Rout=R1=R2=R3, another inverting unity gain amplifier in front
      • Difference amplifier
      • Integrator: capacitor instead of Rout, sq wave-->saw-tooth, add Rout for stability
      • Differentiator: capacitor instead of Rin, saw-tooth->sq wave, add Rin & another C at Rout for stability, noise & phase shift problems
    15. Positive Feedback
      • Vd (difference b/w V+ and V-) is not 0 in this case
      • Switches state when Vd approaches 0
      • +ive and -ive threshold, hysterisis voltage
      • Quite jazzy signal into square wave
      • Comparator circuit, more immune to noise
    16. Real kind of Op-amps
      • General purpose
      • Precision: high stability, low offset voltages, low bias current; often JFET but introduces phase shift if input too close to negative supply
      • Pros and cons of JFET and Bi-polar
      • Programmable Op amp
        • For low-power (battery) applications
        • characteristics that can be altered via program: quiescent power dissipation, input offset and bias currents, slew rate, gain-bandwidth product and input noise
      • Single supply op amps: output cannot go -ive, not for ac coupled audio signals (output is clipped)
      • Audio amplifiers
        • designed to operate best in audio frequency spectrum 20-20k Hz
        • used in sensitive pre-amplifiers, audio systems, AM-FM radio receivers, servo amplifiers, intercom and automotive circuits
    17. Op amp specifications
      • CMRR (common mode rejection ratio): how well the op amp rejects common mode signal (e.g. noise applied to both inputs)
      • Differential input voltage range
      • Differential input impedance
      • Input offset voltage
      • Input bias current
      • Input offset current
      • Voltage gain: gain drops to 1 at unity-gain frequency (1-10MHz)
      • Output voltage swing
      • Slew rate
      • Supply current
    18. Power op amps
      • Require dual polarity supply (or split a supply by putting GND in middle)
      • Or use single supply op amps but they clip the output when supply is negative (e.g. in ac)
      • Apply dc offset using a voltage divider at input, use capacitors at input and output to filter out dc. Why C2 not clear.
    19. Practical notes
      • Reverse polarity protection - using diode at -Vs
      • Oscillation protection - using capacitors at both Vs and -Vs
      • Destructive latch-up protection
    20. Voltage and current compensation
      • Put POT in the pair of offset null terminals (of the IC e.g. 741C)
      • Short inputs, apply Vin and adjust the POT till Vout is 0
      • For input bias current, put Rcom = R1||R2 at non-inverting terminal
      • Current compensation is more needed in bipolar
    21. Frequency compensation
      • Typical open-loop gain is 10^4-10^6
      • Gain drops to 70% (3dB) at breakover frequency (fb) and to 1 at unity-gain frequency (ft) ~ 1MHz
      • To frequency compensate, add RC network between op-amp's frequency compensation terminals
      • Or buy one that is internally compensated
    22. Comparators
      • Which of the signals is bigger OR when the signal exceeds a reference
      • Simple inverting/non-inverting op amps can be used with V+/V- GND
      • Pot can be added to calibrate Vref (from +Vs for e.g.)
      • Special comparator ICs are different from op-amps
        • uses positive feedback (never use -ive feedback)
        • not frequency compensated
        • much larger slew rates (for high-speed switching)
        • internal transistor whose C is connected to Vout, E is GND; when V+<V-, transistor is ON so Vout = 0; when V+ > V-, transistor is OFF so Vout = +Vs (or a fraction of it)
        • External pullup resistor needed between +Vc and Vout
        • Vc is the output threshold and is different from Vs
        • Used in ADCs
    23. Comparators with hysteresis
      • To add a cushion region that ignores small deviations
      • Adding positive feedback (via R3) leads to two threshold voltages
      • Inverting and non-inverting
      • Rule: Rpull-up < Rload, R3 > Rpull-up
    24. Single supply comparators
      • emitter and negative supply connected and grounded
      • with and without hysteresis
    25. Window comparator
      • Output is high (or low whatever is desired) whenever input voltage is within a pre-determined range of voltages ('window')
      • Using 2 comparators with Vin applied at one's V- & other's V+
    26. Voltage-level indicator
      • Using multiple comparators (V- of each is Vin) and LEDs
      • V+ to each using resistor divider (fraction of Vs)
      • As Vin rises, lower comparator's Vout is grounded first (LED turns on)
    27. Instrumentation amplifiers
      • Able to amplify very small voltages (medical application - heartbeat)
      • very good CMRR
      • Circuit / formula not clear
    28. Comparator applications
      • Op amp output drivers (for loads that are on/off): LED / buzzer / transistor / mosfet / transistor + relay
      • Comparator output drivers: pullup, TTL/CMOS circuits
      • Op amp power booster (AC signals): 2 transistors (npn and pnp)
      • V to I converter: simple load at Vout
      • Precision I source: Mosfet + transistor in front
      • I to V converter using photoresistor/photodiode/phototranssitor+relay
      • Overvoltage protection (crowbar): input at V+, zener at V- (ref), driving SCR
      • Programmable-gain Op amp: R2 is a collection of resistors in parallel ON/OFF using digital switches
      • Sample and hold circuits: switch and capacitor, -ive feedback
      • Peak detectors: capacitor and diode, -ive feedback, smart way to avoid diode 0.6V drop
      • Non-inverting clipper amplifier: pair of zeners in parallel to R2
      • Active rectifiers: using diodes to clip as well as instead of R2, can take output from both sides of diode (to avoid 0.6V drop)
    17-19 sep
    Filters
    1. Low-pass, high-pass, band-pass, notch
    2. Lots of applications e.g. dc power supply, radio send/receive, audio speakers
    3. Passive (100-300 MHz)
      • +can operate on RF
      • -large components
    4. Active (0-100KHz)
      • +easy to make (no inductor)
      • +desired i/o impedance can be provided independent of frequency
    5. Attenuation graphs
    6. Terms
      • -3dB frequency
        • +3dB = double power = 1.4 * V / I
        • -3dB = 1/2 power = 0.7 * V / I
      • Center frequency (f0): for bandpass filters = sqrt (f1*f2) for wide band, (f1+f2)/2 for narrow band
      • Passband: <3dB attenuation (good signal)
      • Quality factor: bandpass f0/(f2-f1), notch (f2-f1)/f0, called null frequency
    7. Basic filters
      • 6dB per octave (i.e., 4 times attenuation by next frequency that is double the current), is not enough
      • Steeper falloffs and flatter bands are needed
      • Combining a number of '6 dB per octave' filters won't work
    8. Filter design techniques
      • Butterworth: flat band, steep fall, easy to make, most popular
      • Chebyshev: steeper fall, ripple in band
      • Bessel: less steep, less flat, No delay distortion (more accurate reproduction of modulated signals)
    9. Practical filter designs
      • Passive low-pass (PL)
        • Normalisation: f3dB = 1 rad
        • Pick response curve: Butterworth
        • Determine # of poles: per requirements, use graph
        • Create a normalised filter (pi / T) - values from table
        • Frequency and impedance scaling
      • Passive high-pass (PH)
        • Flip curve to make PL, design as before and flip (C-->L, L-->C)
        • Choose T (with more inductors) since it will be transformed to pi
      • Passive bandpass (PB)
        • Wide band (f2/f1>1.5): PL+PH
        • Narrowband: treat bandwidth as f, complex procedure
      • Passive notch (PN)
        • similar to PB-narrowband but use PH as base
      • Active low-pass (AL)
        • Different table for values
      • Active high-pass (AH)
        • Create normalised low pass
        • exchange R with C, C with R
      • Active band-pass (AB): use given circuit
      • Active notch (AN): use given circuit
    20-24 Sep
    Oscillators and Timers
    1. Intro: endless applications, different design principles, pros and cons of each
    2. RC relaxation oscillators
      • Square wave
        • using C connected to V-, R1, R2, op amp
        • If op amp's output is +15V, C begins charging upto +15V, when it reaches +Vt (threshold set via R2 into V+), Vout flips tp -15V,  C starts discharging till -Vt and cycle repeats 
        • time constant R1C, period 2.2R1C not clear
      • Sawtooth wave
        • C as feedback to V-, PUT in parallel to it
        • PUT discharges C when it reaches desired level
        • POTs/voltage divider to adjust V-/Vref (impacts frequency)
        • POT at PUT's gate voltage (impacts amplitude)
        • C charges in a linear manner (small portion of an exponential curve)
      • Square + Triangle waves
        • 2 op amps: 1 with C as -ive feedback, 1 with R as +ive feedback
        • Output of op amp2 = input (V-) of op amp 1
      • Using other than op amps
        • UJT based: simple V divider with C, 3 waveforms (one across C, 2 pulses of B1 and B2 of UJT)
        • CMOS schmitt trigger inverter: square wave
        • Digital oscillator using CMOS inverters
    3. 555 Timer: Astable (periodic waveform)
      • C=0V —> comp2 o/p high —> S=1, R=0 —> Qbar low, O/p high (cap charge starts)
      • C>1/3Vcc—>comp2 o/p low—>S=0, R=0—>Qbar/O/p no change
      • C>2/3Vcc—>comp1 o/p high—>S=0, R=1—> Qbar high, O/p low (transistor ON, cap discharge starts)
      • C<2/3Vcc—>comp1 o/p low—>S=0, R=0—>Qbar/O/p no change
      • C<1/3Vcc—>comp2 o/p high—>S=1, R=0—>Qbar low, O/p high (transistor OFF, cap charge starts)
      • Tlow = 0.7R2C1, Thigh=0.7(R1+R2)C1

      • Thigh is always > Low (discharging is faster than charging)

      • To make Thigh<Tlow, add a diode across R2 and make R1<R2 (charging faster than discharging)

      • R/C low - frequency high (small components->faster charge/discharge)

      • R1: 10k - 14M ohm, C1: 100pF - 1000uF (same in monostable)
    4. 555 Timer: Monostable (one shot timer)
      • Cap=0, trigger=Vcc (pullup), comp1 (V+=0, V-=2/3Vcc), comp2 (V+=1/3Vcc, V-=Vcc), R=0, S=0, FF=1*, Out=0, Transistor=ON
      • Cap>0 (started charging), trigger=0 (GND), comp1 (V+>0, V-=2/3Vcc), comp2 (V+=1/3Vcc, V-=0), R=0, S=1, FF=0, Out=1, Transistor=OFF
      • Cap>2/3Vcc, trigger=Vcc (pullup), comp1 (V+>2/3Vcc, V-=2/3Vcc), comp2 (V+=1/3Vcc, V-=Vcc), R=1, S=0, FF=1, Out=0, Transistor=ON
      •  Bold states are momentary
      • *FF=1 initially as it retains previous state (it's only stable state)
    RS flip flop truth table
    RS flip flop truth table
    5. 555 timer types: Bipolar and MOSFET (indicated with 'C'); single/dual/quad
    6. Tip: 0.01uF between pin 5 and GND, 0.1uF between pin 8 and 1
    7. Simple 555 applications
    • Relay driver (delay timer): drive a relay from 555 output
    • LED, lamp flasher and metronome: similar config, driving from Vout via a transistor
    • Voltage controlled oscillators: NE566 - triangle and square wave; special ICs 8038, XR2206 can generate sine, triangle and square wave
    8. Wien-bridge oscillator (helpful link)
    • Using op amp (V+=V- rule 4), RC in series and in parallel
    • Choose R and C values so that only resonant frequency (at which R and C will oscillate) will pass on with a gain of 3
    • Variation has V+>V-, includes pair of zener diodes & POT to adjust V- and prevent saturation
    • Twin-T oscillator
      • T like arrangement of Rs and Cs
      • 2 networks (one low and one high pass) joined together
      • Very precise band (narrower than Wien-bridge) of freq passes through
    • Both wien-bridge and twin-t can generate sine waves
    9. LC oscillators
    • Used for high freq (<=500MHz) sine waves (e.g. in RF applications)
    • Not good at low (e.g. audio) freq
    • Basic circuit
      • Comparator, +ive feedback, LC tank circuit in parallel to feedback
      • Comparator supplies just right energy to ensure oscillations don't die
      • Fourier component at resonant frequency provides energy - not clear
      • Practically, for high frequencies, use transistor amplifier (instead of comparator) but need to add 'phase shifting network' between output and input
    • Harley
      • Using JFET: split L coil in parallel with variable C
      • Using bipolar: base needs voltage, load across secondary coil
    • Colpitts
      • Freq range wider (than Harley), more stable
      • Split capacitors in parallel with variable L
      • Can add another variable C in parallel
    • Clapp
      • Exceptional freq stability
      • Variable Ct (<<C1&C2) in series with L (series resonant with L)
      • Ceffective = Ct (since C1, C2 and Ct are all in parallel)
      • Lt and Ct determine resonant freq
    10. Crystal oscillators
    • Much more stable (0.01-0.001%) than RC (0.1%) and LC (<=0.01%)
    • Equivalent circuit: C0 in prallel with R1, C1, L1 in series
    • Impedance vs freq graphs, series resonant (fs), parallel resonant (fp)
    • Fundamental (f0) and Overtones (odd multiples of f0)
    • Usage instead of LC tank circuit: can use in series or parallel (fs or fp)
    • Applications: basic, pierce, colpitts, CMOS inverter
    11. Microcontroller oscillators
    • Stores waveform in memory and play using DAC
    • 8-pin with built-in clock is better than 555 (fewer external components)
    25-27 Sep
    Voltage regulators and power supplies
    1. 2 types: step-down transformer based & switch-mode power supply
    2. Transformer (inductors)-->Rectifier (diodes)-->Filter (caps)-->Voltage regulator (IC+caps)
    3. Voltage regulator removes spikes/dips & mitigate change in I due to chane in load resistance
    4. Fixed voltage regulator ICs: LM78xx (+), LM79xx (-)
    5. Adjustable: LM317 (+), LM337 (-), TL783 (+) - high range
    6. Flyback diode needed to avoid reverse biad e.g. load/output cap discharges slower than input cap
    7. LDO (low drop out) voltage regulators: LM2940. Can run on low Vin (as compared to Vout) and hence is cooler
    8. Applications
      • Car battery voltage regulation
      • Current regulator
      • 12V battery charger
    9. Dual polarity
      • Transformer with center tap in secondary coil gives both + and -
      • Resistor divider to adjust in LM317/337 (+/-1.2-35V). 24-0-24 config
      • No adjustent in 7815/7915
      • Fixed +/- 12V: 7812/7912
      • Heat sinks necessary
    10. Adapter power engage, battery power disconnect circuit
    11. Ripple rejection in voltage regulators
      • Vripple (rms/pp) should be <+/-0.25% of Vout (less the better!)
      • Ripple rejection factor is measured in dB
      • 7805 has 60dB i.e., ripple reduced by a factor of 1000
      • Add bypass capacitor e.g. in LM317 to achieve 80dB (from 65) i.e., rpple reduced by a factor of 10000
    12. Loose ends
      • Line filter (LC) & transient suppressor (back2back zener diodes)
        • before transformer
        • filter out high freq interference, spikes, RF emission by supply
      • Overvoltage protection
        • after regulator (if it fails)
        • Crowbar: Zener + SCR (needs reset after trigger)
        • Clamp: Zener + transistor
      • Bleeder resistor
        • across output
        • across inout with cap (transient suppressor)
    13. Switching regulator supplies (switchers)
      • Oscillator (steady pulse) & error amplifier feed into PWM
      • Error amp: higher if o/p is lower (than Vref), lower if o/p higher
      • PWM: ON for lower duration if error amp is low, higher if high
      • Inductor to store energy & drive load when PWM is off
      • >85% efficiency (as compared to <50% for liner regulators)
      • 556 dual timer (oscillator + PWM modulator) + UA723 (error amp)
      • Step-dwn/up/inverting (video on how inductor steps up voltage)
      • LM2575: adjustable & fixed versions
    14. Switch mode power supplies (SMPS)
      • 60 Hz transformer out but high freq transformer instead of inductor (smaller and cheaper)
      • another isolation element b/w error amp and pwm
      • switching ripple voltage: external high current low pass filter can be added
    28 Sep
    Digital electronics
    1. Number formats: binary, decimal, hex, octal, BCD, 2's complement
    2. Logic gates applications
      • Enable / disable control
      • Waveform generation
    3. Exclusive gates: De Morgan's theorems
    4. To simplify circuits
      • Boolean algebra
      • Bubble pushing (add->or, or->and, remove bubbles, add where none)
      • NAND / NOR: universal gates
      • SOP / POS: SOP is easier, easy to understand/implement can be different
      • AND-OR-Inverter ICs
      • Karnaugh maps: online calculator
    5. Combinational ICs: 4000, 7400 series
    6. Multiplexers (data selectors)  - using n control lines to select 2^n data (input) lines, 1 output
    7. Bilateral switches: using n lines to select n inputs passed as n outputs
    8. Demultiplexers
      • input routed to one of 2^n outputs using n selection pins
      • 74HC139 (4+4), 75xx154 (16)
      • unselected output = 1
    9. Decoders
      • similar to demux, just makes the output(s) 0 or 1 (741S138)
      • one format to another: BCD2Dec, Dec2Hex
      • BCD27 segment (7447): lamp test, ripple blanking inout/output
    10. Encoders
      • one input to multiple output pins 
      • 74LS147: Dec2BCD, negative true logic
      • Priority: if multiple pressed, only highest is output, extra circuitry for this
      • 74LS147+inverter+7447: Dec>BCD>7segment
      • 74148: Octal to binar priority encoder
      • 74184/5: BCD2Binary encoder, bits arranged/interpreted as per need
    11. Binary adders: half, full; XOR+AND
    12. Subtractor
      • For one number, do 2's complement using XOR with 1 (button=1) & Cin=1, then ad to other number (kept as-is)
      • Same circuit can be used as adder (button = 0)
    13. Comparators & magnitude comparator ICs: A=/>/<B
    14. Use ICs instead of gates: FPGAs are faster (raw hardware + some software flexibility), uC can be cheaper but bit slower (because of software)
    15. Logic families: TTL, CMOS, mostly CMOS is used: less space, simpler construction, higher noise immunity, less power consumption but slower
    16. Logic ICs power management
      • Decoupling caps must: both transistors in totem-pole can be ON for a brief moment during logic low-->high or high-->low drawing larger current from power supply, resulting in spike
      • Don't let unused inputs floating
      • CMOS IC can get damaged if power at input pins but not at Vcc/GND
    17. SR flip flop (set reset)
      • Cross NOR, Cross NAND (more popular in the book)
      • States: Set, Reset, Hold, Not used (because of race condition/unstable/unpredictable results)
    18. SR flip flop applications
      • Switch debouncer
        • when a switch is closed, the metal contacts bounce a number of times before coming to rest due to inherent spring like characteristics of the contacts, resulting in false triggering
        • SR FF avoids that by storing the initial switch contact voltage while ignoring (by going into 'hold' state) the trailing bounces
      • Latched temperature or light alarm
        • Variable resistor divider followed by SR FF
        • Buzzer attached to Q (bar), reset button at Q
      • Level triggered SR FF (beginning of clocked FFs)
        • synchronous or clocked FFs
        • 2 NAND 'enable' gates in front of SR FF - each has 1 input as CLK
        • During the clock ON, inputs (S and R) are passed on to outputs (Q and Q bar)
        • have to keep S and R at desired input state throughout the CLK ON time
      • Edge triggered SR FF
        • Samples the inputs only during the clock edge (+ive or -ive)
        • CLK passes via a 'pulse generator' that splits CLK into 2 inputs one goes via a 'NOT gate with propagation delay' (+ive)
        • For -ive edge trigger, another NOT gate in front of CLK
      • Pulse triggered SR FF
        • Master slave SR FF
        • Two SR FF arrangements: master with CLK then slave with CLK bar
        • During +ive edge, master gets cocked (liek a gun), during -ive edge, slave gets triggered
        • CLR and PREset at slave - exactly how they work not clear
      • SR FF ICs
        • 74LS279A: switch debouncer, quad extra input, using software instead is free!
        • 4043 (NOR), 4044 (NAND): quad
    19. D type flip flops
      • S=D, R = Dbar: simplified truth table, no race condition/hold
      • Clocked level triggered D FF: CLK introduces hold
      • 74HC74: dual d type positive edge triggered FF with preset and clear
      • D input must be fixed high/low at least one setup time (~70 ns) before the positive clock edge
      • Also comes in pulse triggered variety
      • Applications
        • Stop and go: green LED at Q, red at Qbar, one ON at a time
        • Divide by 2 counter: +ive edge triggered, ignores -ive edge
        • Synchronizer: keeps the external control signal in synch with system clock. When it goes through FF, it is effective only during the next clock pulse edge (not as and when it comes)
      • Quad D FF IC

        • 74HC75 (asynchronous without clock)
        • 4042 (synchronous, with clock)
        • application: 4 bit data register
      • Octal D FF IC
        • 74HCT273: 8 bit data register, edge triggered

    20. JK flip flops
      • ‘Toggle’ as 4th state at 11
      • Extra connection (cross coupled feedback) from Q to R (K) & Qbar to S (J)
      • No level triggered version
      • Mostly edge triggered
      • Pulse triggered exists but has problem of ‘one’s catching’ (catches glitches via electrostatic noise & treats it as real data. Not much of a problem if CLK duration is small)
    21. JK FF applications
      • Ripple asynchronous counter (0-15) / frequency divider by 2/4/8/16
        • 4 JK FFs: o/p of one = CLK of next
        • J=K=1 (toggle only) for all
        • Q0=LSB, Q3=MSB
        • 4 clock pulses each with f=1/2 fprevious form a binary number pattern (0000-1111)
        • To reverse count, use Qbar instead of Q
      • Ripple asynchronous counter (0-9) then stops and activates an LED
          • Q0 & Q3 via a NAND gate to sink current of LED
          • CLR to restart
      • Synchronous counter
        • Each FF has propagation delay that adds up in previous asynch config (output of one = clock of next) ~30*4 = 120 ns
        • Same clock for all
        • Output of all previous (ANDed together) is input of next
        • 2 AND gates for 0-15 counter
    22. Practical timing considerations
      • Setup time: time input must be held before the active clock edge ~20 ns
      • Hold time: time input must be held after clock edge ~0 ns
      • Tplh: propagation delay from clock trigger to low-to-high output swing
      • Tphl: propagation delay from clock trigger to high-to-low output swing
      • Fmax: max clock frequency allowed
      • tw(L): minimum clock pulse width (low) allowed ~20 ns
      • tw(H):minimum clock pulse width (high) allowed ~20 ns
      • Preset or clear pulse width: minimum width of the low pulse
    23. Clock generators (astable multivibrators)

      • mostly a capacitor is used with cmos inverters (74HC04)
      • 555 timer needs another JK FF to generate square wave + enable switch (with debouncer)
    24. Monotstables (one shot)

      • 74121, 74123 (retriggerable)
      • applications: timde delay, timing & sequencing
      • 555 can also be used in mono mode (is cheaper)
    25. One shot / continuous clock generator

      • 74121 + 555 with a switch (with debunker) in between
    26. Auto power up clear

      • using RC network
      • After switching power ON, CLR remains low till capacitor charges to desired voltage
      • Schmitt trigger inverter to make a square wave (clean OFF of CLR)
    27. Pullup and pulldown resistors

      • pullup most common because it wastes less power, 10k work for most
      • see data sheet to choose value that is
        • not so large that desired voltage does not reach the IC pin
        • not so less that large current flows through it when grounded (and hence more power wastage)
      • pulldown resistor value is usually much less (still it wastes more power when the switch is closed)
    28. Counter ICs

      • Asynchronous 4-bit ripple 7493, 7490, 7492
    29. Synchronous counter ICs (same CLK, less propagation delay)

      • 74193 (0-15) presettable
        • can be loaded with any value b/w 0-15 to then count up or down
        • TCu, Ted for carry / borrow indication
        • output changes at rising edge of CLK, TC goes low at falling edge (of same cycle)
      • 74192 (0-9) similar
      • 74190 (0-9) / 74191 (0-15)
        • single pin (U/D) instead of 2 clocks: high - count up, low - count down
        • enable pin
        • single TC to indicate max/min count reached
        • ripple-clock (RC) output follows TC: can be used as CLK for next stage (ex. multi stage counter)
        • but that will not be a truly synchronous counter (delay from TC—>RC)
        • 3 configurations (last one best where you ensure H/L via gates)
      • 74160, 74163 (0-15)
        • require no external gates in multistage counter config
        • 2 enable pins CEP and CET instead
      • 74LS90: divide by X counters (configs not clear) page 787
    30. Counter with display

      • microcontroller multiplex: less wires
      • segments of each digit are linked together (same D0-D7 going into each digit)
      • separate enable pins for each digit, whichever is enabled is displaying the number decided by D0-D7
      • flashes LEDs fast, appear continuous multi-digit display
      • ICM7217A: 4 digit up/down counter with LED display
    31. Clock pulse generator (60/10/1 Hz)

      • using AC line (115V, 60Hz) with transformer (12.6V, 60Hz), zener diode (3.9V)
      • Schmitt trigger inverter (0.2-3.4V output, 60Hz) (to make proper square wave)
      • followed by divide-by-6 counter (10 Hz), followed by divide-by-10 counter (1Hz)
    32. Shift registers

      • serial-in:serial-out, serial-in:parallel-out, parallel-in:serial-out, parallel-in:parallel-out
      • parallel needs 1 pulse to go out/in, serial x-bit needs x pulses
      • ring counter (output of last FF = input of first)
      • Johnson shift counter (output of last FF inverted = input of first)
      • 7491A: serial-in:serial-out, 2 inputs (1 data, 1 ctrl), application not clear
      • 74164: serial-in:parallel-out
      • 74165: serial or parallel-in:serial-out
      • 74194: universal shift register (4 bit). any mode in, any mode out
      • 74299: 8 bit universal shift register with storage and 3 state interface
    33. Simple shift register applications

      • 16 bit serial to parallel converter: two 74164 ICs, Q7 of 1st into Q1 of 2nd
      • 8 bit serial to parallel: 74164 (CLK) + 74NCT273 (parallel to parallel, CLK/8)
      • 8 bit parallel to serial: 74165
      • re-circulating memory registers: 74194 (p->s mode)
        • LED flasher (load 0111, 0 moves round and round lighting an LED each time)
        • stepper motor control (load 1000, can move clockwise or counter)
    34. Analog / digital interfacing

      • ON/OFF triggering
        • voltage divider with a resistor and sensor (eg phototransistor) —> FF (latch) —> LED/buzzer
        • Vin into comparator / op amp against Vref --> AND gate/CMOS or TTL inverter, protection diodes

    35. Using logic to drive external loads
      • how much current the load requires
      • how much current the logic gate can source / sink
      • if Iload > Igate, can use a higher power transistor in between
    36. Using logic to drive external loads
    • how much current the load requires
    • how much current the logic gate can source / sink
    • if Iload > Igate, can use a higher power transistor in between
    37. Analog switches
    • 4066B, AH0014D, DG302A
    • functionality: DPDD/DPST/number of in/out
    • supported voltage levels
    • switching speed
    • applications: modulator/demodulator, digital controlled frequency circuits, analog signal gain, ADC, analog device on/off

    38. Analog multiplexer / demultiplexer

    • data selector / data distributor
    • 4051B

    39. ADC and DAC

    • ADC applications: data acquisition, digital sound recording, display
    • DAC commonly used to control the gain of an op amp: digitally controlled amplifiers, filters, wave form generator, modulator, trimmer replacement, process control and auto calibration circuits, mp3/dvd/cd player
    • sampling frequency, resolution (eg. 4 bit)

    40. DAC configurations

    • simple binary weighted
      • 74HC4066+resistors+op amp with -ive feedback
      • not practical if > 4 bits
      • many different resistors needed
    • R/2R ladder network
      • only 2 resistor values needed
    41. Integrated DACs
    • DAC v MDAC (multiplying)
    • MDAC gives current output, Vref is varying, has wider V range, faster switching
    • Digital Vref (fixed) can also generate a waveform by varying digital code
    • ICS: DAC0808 (8 bit): unipolar and bipolar operation. Bipolar uses 2 op amps
    42. ADC: many techniques
    • successive approximation
      • comparator —> SAR —> DAC —> Output register (octal D FF)
      • fast conversion time (10-300 uS), simple circuitry
      • set MSB = 1, if corresponding Voltage (calculated by DAC) > Vin, make MSB=0
      • do same with all remaining bits
      • control signals: start conversion, conversion complete
    • parallel encoded / flash conversion
      • 7 comparators, same Vin to all
      • each denotes a voltage
      • Output into 74F148 (octal to binary priority encoder: takes only highest number)
      • 74F75 (FF) at end
      • If a digit (x) is low & next (y) is high, voltage range is between Vy & Vx
      • Output is only a range (not exact value)
    43. LED displays
    • 7/14/16 segment, 4*7 / 5*7 dot matrix
    • common anode with 74LS47
    • common cathode with 74HC4511
    • MM5450: can drive four ‘7-segments’
    • multiplexed using a microcontroller and 74HC4511: flashing 4 ‘7-segments’ quickly so it appears it is a 4-digit (continuous) display. Enable one at a time & provide digital code to display
    • simple alphanumeric pda54-11
    • smart alphanumeric hpdl-1414
    44. LCD displays
    • lower power consumption, less switching speed (40-100 ms)
    • external lighting used! sunlight / backlight
    • 74HC4511+XOR gates —> 7-segment
    • CLK into XOR gates & 7-segment back electrode / plane (BP)
    • front electrode: individual for each segment
    • If front=0, when CLK=BP=1 (potential diff with BP): we see the char
    • If front=1, when CLK=BP=1 (no potential diff with BP): no char
    • Display remains as-is when clock goes down, just polarity is reversed:
      • when CLK:1->0, BP:1->0, front XOR:0->1, char remains displayed
      • when CLK:1->0, BP:1->0, front XOR:1->0, display remains blank
    • Physics
      • if no potential diff, crystals rotate light by 90* so overall silver against silver
      • if potential diff, crystals don’t rotate, so the 2 polarisers absorb all light, segment appears (dark against silver)
      • nematic crystals 90*, super twist nematic display 270*: better contrast, viewing angle
    • Driving LCDs
      • CD4543B: input->latch->7-segment decoder->display driver. Disable latch to prevent new data
      • MM5453: 40 pin, can drive 4.5 digits
    • Multiplexed LCDs
    • Dot matrix LCD (HD44780)
      • can read from LCD too
      • writing happens when enable goes from high-->low
      • enable needs a switch debouncer if operated with switches (not common)
      • CGROM - to store fixed 192 chars
      • DDRAM - to store current display chars (80)
      • CGRAM - to store custom chars (8)
      • Instruction set, 4-bit transfer etc
    45. Memory devices
    • Basic understanding with diodes matrix addresses (n lines (rows)=2^n addresses/words) and m bits (columns) words
    • Programmable ROM: transistor (bipolar / mosfet) at each cell
      • One time programmable ROM
        • Mask ROM (MROM): manufacturer makes connections (diode/transistor)
        • PROM: you can make connections by blowing fuses once
      • Re-programmable ROM
        • EPROM
          • extra floating gate (below control gate) in MOSFET
          • initially all 1s
          • hot exlectron injection (12v) to give negative charge to floating gate (out of circuit programming)
          • erase using UV light on quartz window (whole memory erase)
        • EEPROM
          • 2 transistors. 1 to store data, other to clear charge from 1st's floating gate
          • in-circuit programming, can erase selective cells
          • applications: TV tuners, uC main program & non volatile data
        • Flash  memory
          • combines EPROM (high storage density) & EEPROM (in-circuit programming)
          • some variants erase full chip only
          • faster read-write and erase times
          • applications: uC main program, digital camera, music players, phones etc.
        • Serial access memory
          • parallel direct connections to address and data bus can lead to big impact if uC makes mistakes
          • eprom / eeprom can be used in serial mode ex. I2C (SDA/SCL)
    • RAM
      • volatile, much faster read-write, not limited r/w endurance cycles (10000 for eeprom)
      • Static RAM (SRAM)
        • Flip flops
        • bits remain stored until overwritten / power off
        • low power consumption
        • higher speed and ease of use
        • used where less memory is needed e.g. uC cache
        • To make SRAM non volatile (add battery / backup eeprom)
        • SRAMs can be combined (expanded) for higher storage
      • Dynamic RAM (DRAM)
        • capacitor
        • bits disappear within milliseconds if not refreshed or supplied with periodic clocking to replenish capacitor charge (lost to leakage)
        • more data storage per unit area
        • used where MBs of memory needed (e.g computer memory modules)
        • # of address lines cut in half by multiplexing
        • refresh every 2ms: by reading/writing/'RAS only' (line by line scan)
        • DRAM controllers handle this (autorefresh)
        • Computer memory in SIMMS and DIMMS packages
        • DDR3: 240 pin DIMMS
        • Extended data out (EDO): 10-20% faster
        • Synchronous DRAM (SDRAM): synch memory with PC clock (25% performance rise)
        • Double data rate SRAM (DDR): able to read data on both rising and falling edges of the system clock
        • Rambus DRAM (RDRAM): uses a high bandwidth channel, ~10 times faster than DRAM
    20 Nov
    Microcontrollers

    1. ATTiny / PIC
    2. Harvard architecture: separate memory for program and data
    3. Bank switching: using same memories for different purposes (defined schemes)
    4. 3 approaches to program
      • Program in C, compile (on PC), send to uC (using hw programmer)
      • Program in C (on PC), send o uC which has an interpreter to compile & run. Takes more resources on uC but faster to test
      • Program in C (on PC), send to uC, bootloader on uC (runs at every reset) detects new program and replaces as uC main program (arduino/esp)
    5. Interfacing with microcontrollers: digital, analog, serial

    6. Digital interfacing
    • manual switches with pullups
    • pullup resistors considerations:
      • choose pull up such that current consumption is minimal while taking care of the signal strength
      • should be strong enough to be interpreted correctly and not confused with noise
      • Depends on noise in environment & lead length
      • Internal pullups are generally high
    • multiple switches using 1 analog input (voltage divider)
    • matrix keypad (parallax link)
    • switch debounce using software (arduino code link)
    7. Analog interfacing (input sensors)
    • if i/p voltage is > uC expected, add resistor V divider, add zener to fix max V
    • handle sensor hysterisis using s/w
    • uC reliably provides ~20mA source/sink current as o/p
    • derate by 25% for production poduct
    • to drive higher load, use transistor (bipolar/mosfet)
    • mosfet has low drain-source R when ON, high R when OFF, high i/p Z so less current needed/drawn from uC
    • Arduino 40 mA per pin, max 200mA per chip
    • if inductive load (e.g. relay), separate supply recommeded
    • Motor control using PWM
      • control motor speed by adjusting duty cycle
      • 74HC07 buffer: stable o/p and high noise immunity
      • motor bi-directional control: H-bridge with 4 mosfets (2 npn, 2 pnp). 2 mosfets ON at a time (fwd/back)
      • IC should have thermal shutdown to prevent overheating
      • servo motor: duty cycle pulse (control signal) determines direction. 1ms pulse: 1 direction, 2 ms other
      • stepper motor: many coils to be energised in correct sequence. uC (step sequence)—>Driver IC (ULN2803)—>Transistor array for high power loads—>Motor
    • Detecting sound
      • mic—>2 comparators (LM324)—>uC—>power transistor (as amplifier) with speaker as load (high current due to 8 ohm speaker)
      • uC ADC is not very fast. Only for primitive loads
      • piezoelectric speaker can be driven directly by uC pin
      • no point amplifying square wave (sounds harsh)
      • generate sine wave: using pwm not good quality, use DAC (R-2R)
    8. Serial interfacing
    • 1 wire
      • send command or set bits in register
      • since no CLK, frequency/pulse width translated into bits
      • different pulse width to send 0 (60uS) & 1 (15uS)
      • each CMD preceded by a reset
      • temperature sensor (DS18B20)
      • parasitic mode - gets power also from uC, 5 or 3.3v, pullup 4.7k
      • when no data transfer, capacitor charged, it drives device when data is transferred
    • 2 wire (I2C)
      • actually need 4 wires: VCC, GND, SDA, SCL
      • 5 or 3.3v, pullups 4.7k
      • >1 master possible, can change roles
      • SDA/SCL are open drain & tri-state : 0, 1, high impedance (tri-state)
    • SPI
      • upto 80Mbps
      • only 1 master
    • UART
      • no CLK
      • agree baud rate & bits (8N1)
      • RS232 (Tx/Rx)
      • TTL logic levels (-ive and +ive)
    • Voltage level conversions
      • easy in SPI and UART: different lines for 2 directions of comms
      • only 5v(uC)->3v (device): Tx->Rx conversion needed
      • I2C & 1 wire: ICs TXS0102, MAX3372, PCA9509, PCA9306
      • Link from NXP on voltage conversion in I2C
    9. LED displays
      • multiplexing, charlieplexing
      • control intensity / color (i.e., current) of RGB LED using PWM instead of analog control
    Programmable logic
    1. PAL - programmable array logic
    2. CPLD - complex programmable logic device
      • configurable logic cells
      • uses sum of products arrangement of gates
    3. FPGA - field programmable gate array
      • uses lookup tables
      • hundreds of thousands of logic cells
    4. HDL - hardware description / definition language
      • Verilog / VHDL
    5. Expensive customizable hardware
    6. used for prototyping for high volume production runs
    7. Xilinx and Altera are major companies making these

    Motors (23-25 nov)

    1. DC motors
      • stall current = max current when the motor is applying max torque (rotational force) & not able to move
      • Link
      • Speed control
        • some oscillator --> power transistor / scr / mosfet
        • bipolar not good
        • UJT relaxation osc + SCR
        • CMOS NAND gate osc + MOSFET
        • 555 timer (astable) + MOSFET
        • uC (PWM) + MOSFET (add buffer to isolate uC from inductive load)
      • Direction control
        • manual DPDT switch
        • transistor driven DPDT relay
        • complementary (npn-pnp) pair of bipolar power transistors
        • H-bridge with bipolar
          • 2 pins: each can enable, control speed and direction
          • at a time give pwm to only 1 pin
        • H-bridge with MOSFETs
          • separate 'run enable' & 'change direction' pins
        • motor driver IC: LMD18200, L293D
    2. RC servo motors
      • Link 1, Link 2
      • AC/DC, Brush/Brushless, Synch/Asynch
      • commutator: mechanism that supplies alternate current
      • AC is brushless (generally)
      • speed ~ frequency & # of poles
      • speed of rotator < speed of change in magnetic field
      • Precise positioning
      • DC Motor + gear assembly + position sensing device (feedback circuit/POT) + control circuit
      • uC / 555 timer give control signal, when it moves POT also moves
      • 3 leads: VCC, GND, control
      • send control signal (PWM), internal POT will tell control circuit the actual position, control circuit will compare actual position with signal & will move motor one way or the other
      • Internal POT can be replaced with fixed resistor voltage divider to achieve 360* turn
      • model airplanes (remote control servo) get control signals via radio waves
    3. Stepper motors
      • Link 1, Link 2 (detailed explanation of bipolar etc.)
      • Lesser max speed & more torque (than dc motor)
      • low speed, high precision applications
      • in dc motor, outer magnetic field is fixed, inner coil current direction varies
      • in stepper, outer is varied by giving 1 or 0, inner is fixed
      • Variable reluctance stepper
        • internal (rotor) is ferromagnetic (~iron) [others have permanent magnets]
        • outer (stator) coil pairs with one end fixed (Vcc), can GND (other end of) each coil pair one by one
      • Unipolar
        • rotor is a permanent magnet
        • stator coil pairs with joint (tap) in between. Can play with both ends.
        • center tap = Vcc, other ends = GND alternatively (direction)
        • full tapping sequence (1 ON at a time)
        • power tapping (2 ON at a time) - 1.4 times torque/power
        • half tapping (1 and then 2 ON alternatively) - more precision
      • Bipolar
        • stator without tapping
        • Each coil given Vcc at one end & GND at other end (alternatively)
        • need H-bridge for every coil pair
        • more difficult to control
        • better size to torque ratio
      • Universal stepper
        • 4 independent windings (8 leads)
        • connect in series = bipolar
        • connect in parallel = unipolar
      • Driving stepper motors
        • Translator --> Driver --> Stator
        • For var reluctance/unipolar (common Vcc, other side GND), driver can be TTL buffer + power transistor + diodes to protect coil & transistor
        • ICs: ULN2003 (Transistor array), 7407 (buffer array), MC1414
        • For bipolar, h-bridge needed for each coil to reverse polarity
        • CMOS 4027 dual JK flip-flop IC with CMOS 4070 XOR logic for direction - working not clear
        • Adding 2 XORs based circuit to prevent h-bridge from getting both inputs high - not clear
        • Complete diagram 555+74194+buffers+transistors+motor +diodes - page 944
        • SAA1027 IC: driver + translator
        • uC acts as a software translator --> driver --> stator
      • Identifying stepper motors: using resistance between leads

    Audio electronics

    1. sound —> electric signal (mike), electric signal to sound (speaker)
    2. frequency, intensity (loudness / energy), timbre (overtones / harmonic spectrum)
    3. human ear can hear
      1. frequency: 20-20,000 Hz, 1-2 KHz most sensitive
      2. intensity: 10^-12-1W/m^2 (0-120 dB). dB = 10*log(I/I0), log is to the base 10, I0=10^-12
    4. harmonic spectrum (spectral plot)
      1. nth harmonic freq = n * 1st harmonic freq (i.e., the fundamental freq)
      2. intensity of each harmonic can vary depending on instrument / it’s construction
      3. complex signal can be expressed in fourier series, each harmonic = a*sinwt + b*coswt (summation of harmonics)
      4. it’s complex to replicate an instrument’s sound: all overtones and decay and rise times, there are special oscillator and modulator circuits
    5. microphones
      1. variation in sound pressure —> variation in electric current
      2. dynamic
        1. plastic diaphragm captures sound waves —> voice coil vibrates on magnet, generates electric current/voltage
        2. rugged, doesn’t need external voltage
        3. many applications
      3. condenser
        1. sound sensitive capcitor: one fixed plate (GND), one flexible (VCC)
        2. crisp low noise sound
      4. electret
        1. charged plastic element placed in parallel with a conductive metal plate
      5. characteristics
        1. sensitivity - ratio of output (electric) & input (sound) intensity (in dB)
        2. frequency response - ability to convert different sound frequencies into ac voltages
        3. directivity - capture sound well from one direction or all
        4. impedance - load Z should be > 10 * source Z. 50 ohm mic, 600 ohm mixer
    6. Audio amplifiers
      1. Op amp based: inverting, non-inverting 
      2. digital: class D. input signal & triangle wave —> comparator (pwm) —> high power switch (mosfet amplifier) —>low pass filter (LC) (amplified signal)
      3. ICs: NCP2704, LX1720
      4. reducing hum
        1. due to power supply: add as much smoothing capacitance as possible
        2. mutual induction in wires or tracks: keep pcb tracks as short as possible
    7. Preamplifiers
      1. circuits to control input (select), level, gain, Z
      2. various circuits using op amp or transistor
    8. Mixer circuits
      1. simple summing of signals
      2. POTs at beginning of each signal to control it’s intensity
      3. circuits using op amp or transistor (why extra cap to ground AC signal - not clear)
    9. Impedance matching
      1. not needed in modern devices (transistor / op amp based)
      2. bridging needed i.e., destination device i/p Z > 10 * source device o/p Z
      3. if transmitted signal is current, source Z should be > load Z
    10. Speakers
      1. dynamic: electric signal —> (moves) coil on magnet —> (moves) paper cone (emits sound waves)
      2. frequency response: woofers <200 Hz, midrange speakers 500-3000 Hz, tweeters > mid range
      3. speakers having all these are better than full range ones (100-15KHz)
      4. crossover networks: 
        1. circuits having filters to divert right frequency to right device
        2. passive: using L/R/C, near speaker, eats power, cheap, easy2make, can be tailored
        3. active: using op amp, before amp so eats less power, controls all frequencies (LF356 along with low/band pass/high filters using passive components)
      5. ICs to drive speakers
        1. LM386: low power apps, to drive 8 ohm speaker, gain 20 (can be raised to 200 using R-C)
        2. LM383: power amp, to drive 4 ohm speaker, thermal shutdown, heat sink required
      6. Audible signal devices
        1. simple warning signal indicators
        2. dc buzzer, compression washer, sonalert audible sound device
      7. Miscellaneous audio circuits
        1. Tone generator using UJT
        2. Metronome

    Modular electronics

    1. Good list of ICs for various purposes
      1. Audio  including audio recording
      2. Power control
      3. LED drivers
      4. Misc
    2. List of useful modules
      1. RF modules
      2. Audio modules
      3. Power control
      4. Display modules
      5. Sensor modules

    Power distribution and home wiring


    Error analysis

    1. if measurements are added/subtracted, add errors
    2. if measurements are multiplied/divided, add errors like errorX/X+errorY/Y
    3. Complex formulae if measurements are independent (uncorrelated), errors follow gaussian (normal) distribution
    4. Full formulae to calculate uncorrelated errors - page 982
    5. avoid designing experiments where 2 large quantities are measured and their difference obtained

    Book review (Dec 2020)

    1. When designing for production all components are to be considered w.r.t environment (temperature, pressure, humidity, noise etc.) e.g. temperature coefficient of resistors

    2. Current - coulombs, charge / s

    3. Voltage - energy / coulomb (force on electrons)

    4. Power - energy / s

    5. Electrons can be moved by forces like
        - chemical (batteries)
        - magnetic
        - light (photons)
        - thermal (mV, mostly noise)
        - piezoelectric (mV)
        - static electric (noise)

    6. Thinner wire has more resistance per unit length than thicker wire
        >> choose thickest track width on PCB as long as board size/layout/cost are not           significantly impacted

    7. In conductors, when temperature increases, resistance increases
        >> In semi-conductors, resistance decreases with temperature increase

    8. In next project, measure and note all V, I, Power (used / lost in heating) in all lines. Update on paper schematic. Expected maximum vs actual
        >> choose components with 2 or 3 times capacity & with lower temperature                  coefficient

    9. Grounding electrostatic wrist strap / mat if using mosfet etc.

    10. Analog (mic/speaker) and digital ground should be separate

    11. If using R <=100 ohm, consider power rating (Since I will be high)
        >> power rating should be 2/3 times max expected power
        >> generally 1/4 W is ok

    12. Resistor voltage divider: the 10% rule
        >> bleeder current is 10% of load current, hence bleeder R is 1/10 load R
        >> if multiple loads, bleeder I is 10% of total (sum of all) loads current

    13. Since voltage (or I) sources are not ideal, check actual voltage across each component (with load connected

    14. Transistor (or a pair of them) can be used as current source

    15. Combining 2 sinusoidal waveforms
        >> when waves of similar magnitude & freq are combined, we get a composite              waveform. Visible in sound beat notes.
        >> when waves of widely different magnitudes & freq (e.g. 1k & 10k Hz) are               combined, it seems one wave (the higher freq one) is riding on another.                  Concept of modulated signals.

    16. If you use capacitors in series to withstand larger voltages, it’s a good idea to also connect an equalizing resistor across each capacitor. Use resistors with about 100 ohm per volt of supply voltage, and be sure they have sufficient power-rating/handling capability

    17. For high frequency circuits, consider the accurate models of R L C. C, L behaviour curves per frequency

    18. Even if a charged capacitor is grounded, charge (Q=CV) remains on it - electric field acts like a glue

    19. using capacitor to control storage and delivery of charge
    >> using difference capacitances, you can hold different amount of charge (hence I) for a given potential difference
    >> also can maintain different potential differences for a given charge (or I)

    20.   R: 2*V —> 2*I; I V in phase

            C: 2*f —> 2*I; I leads V by 90*

            I: 2*f —> I/2; I lags V by 90*

        Phase angle in impedance (Z): -ive means net capacitive, +ive net inductive

        Phase angle in current (I): +ive means net capacitive (I leads), -ive net inductive     (I lags)


    21. LC resonant

    - series (becomes wire at f0), parallel (becomes open at f0)

    - L & C impedance >> R, sharp response (high q, low BW)

    - L & C impedance ~= R, broad response (low q, high BW)

    - At high f, inductor resistance dominates quality

    - line I, circulating I

    - Parallel

        - At f0, like an open switch (I—>0, Z high)

        - move in either direction, closed switch (I high, Z—>0), half power -3dB point

    - Series

        - At f0, like a closed switch (I high, Z—>0),

        - move in either direction, open switch (I—>0, Z high), half power -3dB point

    - In parallel

        - I min does not have to be at Xl=Xc
        - if Q>10, assume above & can use f0 = 1/sqrt(LC)


    A series LC circuit without any resistance would oscillate forever without damping.

    Shock absorbers on an automobile, for example, are part of a mechanical harmonic oscillator designed to be nearly critically damped


    22. Transient circuits - forced + natural response


    23. Batteries: primary (table 278), secondary (table 284), supercap

    selecting the right battery (table 287)

    capacity: mAH, 1C is 1 hour discharge i.e., xmAH/xmA, if you run at 0.5C, battery will run for 2 hrs


    24. switches - page 292

    - sparkfun article

    - mechanical relays: high current (2-15 A), slower switching (10-100 ms)

    - reed relays: moderate current (0.5-1A), moderately fast switching (0.2 to 2ms)

    - solid-state relays: wide range of currents (few mA to 100A), fast switching (1-100ns)


    25. There are many types and characteristics of resistors / capacitors / inductors - read chapter 3 again carefully while choosing for real


    26. semiconductors photo pg 407

    27. diodes table pg 411

    28. battery backup - if main is off, battery can give power via diode (diode conducts only if other side is lower than battery’s)

    29. diode types table - pg 428

    30. transistors types summary - pg 430