Difference between revisions of "Electronics notes / Inputs and outputs"

From Helpful
Jump to: navigation, search
m (Transistor output stages)
m (Crowbars)
Line 500: Line 500:
A crowbar refers to presenting a short or near-short when there's overvoltage.
A crowbar refers to presenting a short or near-short when there's overvoltage.
You often want this combined with current limiting, or a fuse or breaker.
This is only half a solution - you'll want this combined with current limiting, or a fuse or breaker.
Often used protectively, acting faster and/or more decisively than some alternatives.
The common construction is a with a [[thyristor]]
The common construction is a with a [[thyristor]]

Revision as of 17:51, 21 February 2020

This is for beginners and very much by a beginner.

It's intended to get an intuitive overview for hobbyist needs. It may get you started, but to be able to do anything remotely clever, follow a proper course or read a good book.

Some basics and reference: Volts, amps, energy, power · Ground · batteries · resistors · changing voltage · transistors · fuses · diodes · varistors · capacitors · inductors · transformers · baluns · amplifier notes · frequency generation · skin effect

And some more applied stuff:

IO: Input and output pins · wired local IO wired local-ish IO · · · · Shorter-range wireless (IR, ISM RF, RFID) · bluetooth · 802.15 (including zigbee) · 802.11 (WiFi) · cell phone

Sensors: General sensor notes, voltage and current sensing · Knobs and dials · Pressure sensing · Temperature sensing · humidity sensing · Light sensing · Movement sensing · Capacitive sensing · Touch screen notes

Actuators: General actuator notes, circuit protection · Motors and servos · Solenoids

Some stuff I've messed with: Avrusb500v2 · GPS · Hilo GPRS · JY-MCU · DMX · Thermal printer ·

Audio notes: microphones · device voltage and impedance, audio and otherwise · amps and speakers · basic audio hacks · digital audio ·

Less sorted: Common terms, useful basics, soldering · Arduino and AVR notes · ESP series notes · PLL · signal reflection · pulse modulation · electricity and humans · resource metering · Microcontroller and computer platforms · SDR · Unsorted stuff

See also Category:Electronics.

High side versus low side switching/driving

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Some limits and choices

Transistor output stages

Open-drain / open-collector

Common collector / Common drain

Totem-pole, push-pull

Other details

Transient voltage and ESD protection, snubbers

Protection diodes (inputs and output pins)

TVS diodes


RC and RCD snubbers


Gas Discharge Tubes




See also

On ADCs and DACs


An Analog-Digital Converter (ADC) takes a (voltage) signal and turns it into numbers to be digitally consumed.

Well, most ADCs do voltage sensing. A few have extra circuitry to be current-input ADCs (which mostly just means a resistor setup, but probably better specced than you can easily make), many of them for specific applications.

On quantization


Multiplying DAC (type)

Upsampling DACs

On the cheap: Resistor ladder

Basic idea: If you can change many (e.g. often 8 on microcontrollers) digital pins at the same time, then putting a resistor ladder on them means each contributes a different voltage level, and you can make 2amt voltage levels (256 for 8 pins).

E.g. the Covox Speech Thing was basically just a bunch of resistors on a parallel port. adopted by some games and music trackers.


  • you still need to write out new data with strict regularity
which is what interrupts are good at, but it will occupy a bunch of CPU power
The Disney Sound Source solved this by being buffered (but fixed the output rate to a relatively poor 7kHz)
  • the resistors' voltage contribution won't be perfect to contribute exactly what they should.
making equal steps (to produce undistorted signals) takes either precision resistors or a bunch of measuring and matching beforehand.
the more bits you have, the harder it gets - 8 is quite doable, but it starts getting impractical around 12 bits
  • more than 8 bit is rare
it's often the max you can change at the same time (single uC port)
using multiple ports is hard to get quite right, though may be acceptable at lower frequencies


On the cheap: Fast PWM

Basic idea: If we can PWM much faster than audible (by preferably two orders of magnitude - which basically asks "if we have dedicated PWM circuit in the IC"), then the duty cycle is controlled precisely enough that putting it through a lowpass means the result is stable enough (being an average of that duty cycle).

These work fine, though are limited frequency-wise. They're can work pretty decently in audible frequencies.


  • the lowpass is fixed
so it has a range where it works best, which is part of your design
which is why this can't be a more general-purpose DDS
  • without dedicated PWM circuitry the timing issues would make this a horribly task, particularly if you also want to do other things in the microcontroller
  • even then we need to update the PWM with strict regularity
this is what interrupts are good at. It just occupies the CPU.
  • i.e. even when it's not CPU-intensive it's still timing-critical
Expect everything else to be secondary to this.
  • multiple channels may be possible (varies with IC) but may have to be related
which is perfectly fine if you e.g. wanted different types of wave at the same rate


  • Raspberry Pi's onboard sound is actually PWM pins, plus a filter and buffer (exact details vary)

Oversampling PWM

DAC practicalities

DAC chip notes


See also

Digital sample capture, storage, reproduction