Electronics notes/Knobs and dials

From Helpful
Jump to: navigation, search
This is for beginners and very much by a beginner. It's meant to try to cover hobbyist needs, and as a starting point to find out which may be the relevant details for you, not for definitive information.

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: IO and wired communication · localish communication · wireless (ISM RF, GSM, RFID, more) · 802.11 (WiFi) · 802.15 (including zigbee)

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 · Bluetooth serial · JY-MCU · DMX · ESC/POS notes

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

Less sorted: Common terms, useful basics, soldering · Microcontroller and computer platforms · Arduino and AVR notes · ESP series notes · Electronics notes/Phase Locked Loop notes · mounts, chip carriers, packages, connectors · signal reflection · pulse modulation · electricity and humans · Unsorted stuff

See also Category:Electronics.


Variable resistors (see potmeters), many of the ones with a knob are single-turn, meaning they go though their resistance range in ≤ 360 degrees.

Hacking servos

Servos use a potmeter as a sensor, so you could solder wires to that potmeter.

Mostly makes sense to do to continuous-rotation servos, and/or when you also want to move the servo (because otherwise it's just a pricier pot)

Also, the higher the torque, the more that manually turning the servo is likely to damage said gears, so in general this is not very useful.

Rotary/linear encoders

Incremental encoders, a.k.a. Relative encoders (only) report/detect change in position.

Also often report which of the two ways they are turning, via quadrature coding (see below, but basically a second output 90 degrees out of phase, so you can tell by which leads the other).

This video is a decent indication of what happens on these two outputs.

Speed is the speed at which the changes happen, so needs a CPU to pay attention.


Absolute encoders also report their actual position. These are harder to find than incremental encodes, because it's more complex and pricier to do, and often you could use a potmeter instead (...though it's not as easy to find continuous-rotation potmeters, and they take a little extra care).

Both relative and absolute can be intuitively understood as pulses/states coming from (different) encoder discs (optical, magnetic, capacitive, or even conductive) - see

relative is the variant with just the slits, often with two channels out of phase (see quadrature encoder disk), so that one signal is ahead of the other, and you can additionally detect direction
absolute encoder disk are the variant which looks like it may have its position as a binary number -- but is actually a the slightly more useful Gray code

As-is, relative encoders are useful for things like menu navigation, where only movement mattersmatter in the first place, and when sensing speeds.

There are a few applications where you can use a relative and add absolute position, by calibrating, e.g. by starting by moving to an end switch (or some other calibration point), and then never missing any movement.


  • three-phase motors can, with a bit of sensing on top, be used as relative linear encoders.
There's an interesting DIY project in taking a broken hard drive and using it like this

See also:




When using switches as input

Avoid floating

With most switches, one of the switch states will mean a broken circuit. When this is sensed by ICs or amplifiers this means a floating input and implies unpredictable behaviour.

You'll need a pullup/pulldown resistor.

In some PICs (such as AVRs in Arduinos) you can enable internal pullups via code, which means you don't need to add a resistor to such a circuit.

Avoid reacting to bounce

The mechanics of contacts in switches means they show contact bounce will be mirrored in electrical contact: a very quick flip-flop between contact and no contact. In buttons that you have to hold down, this may also happen on movement.

Instant senses (such as those from PIC) may accidentally sense a moment of disconnection, where you basically want the state it is mostly in in a short term (or perhaps you want to know whether it has switched recently).

Also, there are some electrical components that don't like switching that fast.

Both tend to mean you want to filter input from switches somehow.

In analog circuits, one way to debounce is a simple RC circuit - the capacitor will charge slow enough to mean that only consistent contact will get the voltage to a fairly high level (and in a relatively monotonous way, but that's not really the point, nor something you can count on).

When sensing digitally you can debounce in software. With PICs, one simple solution is to take a bunch of samples over the time it takes the switch to bounce (often a millisecond at most) and check how consistent they are.

You can bias this to the safer state (e.g. consider a pushbutton off until it's fairly consistently on), but beware of variants of that code that will effectively debounce in one direction but not in the other.

Switches, buttons, toggles, and such

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)

Encompasses combinations of:

  • Multiple positions,
  • a mechanical tendency to go to one position
toggle/flip, or momentary
  • multiple electronic states,
  • and other electronic properties

Bistability refers to switches that will rest in both states.

It could be both a mechanical and electronic descriptor, though on the mechanical side it's often called latching, or some such term, whereas a monostable would refer to what most relays do (the term "monostable switch" would be rare because we have words like "momentary" and "pushbutton").

...so the terms monostable and bistability are usually about electronic switching, e.g. to pointing out e.g. that

digital circuits can be made to sustain their current state.
thyristors will stay in their current state, while transistors are not
...often then mentioning a simple bistable multivibrator circuit, a.k.a. flipflop), or contrasted with a monostable multivibrator

See also


The distinction between buttons and switches is not more pragmatic than it is hard/strict. Can be a pain in webshopping :)

A few more specific buttons/switches:

  • rocker switch
    • states: often two or three. Usually toggled, sometimes momentary
    • rocker switch
  • push-button
    • states: two. often momentary, sometimes toggled
    • push-button
  • microswitch
    • mainly a small momentary push-button
    • states: Two. Momentary.
    • microswitch
  • Mercury switch
    • states: Two. Depends on orientation (because gravity).
    • no contact bounce
    • mercury switch
  • Reed switch
    • states: Two.
    • Mechanical, closed by nearby magnet
    • reed switch
  • knife switch
    • The circuit breaker of old
    • states: Two. toggled
    • knife+switch


  • end switch
    • a switch positioned at the end of a mechanical range, often to detect when actuation should go no further
    • often a microswitch with some sort of lever, wheel, etc. for durability.\
    • end+switch

Contact bounce (behaviour)

Contact bounce indicates the time in which an arriving contact mechanically settles and in which the connection is not yet stable. See some images. This bounce is often tiny, both in movement and time.

This bounce is rarely important when driving resistive loads, but in anything more complex there the reaction to the bounce itself can matter.

For example, a digital system observing/sampling it may see very fast switching back and forth.

Some components, such as ICs, also don't deal too well with bounce on their Vcc. A bypass capacitor helps here, and is nice for its power stability anyway.

Arcs (behaviour)

Default switch state (design)

Switches that are typically in one state (in the case of buttons will probably return there, rather than be toggled) can be referred to as Normally Open (NO) and Normally Closed (NC)

If it has contacts for more than one state (which, when one state is most natural, can be termed NO and NC contacts), the switch is termed Changeover (CO) (also Double-Throw, implying a typical two-state switch, Triple-Throw, etc.).

Changeover switches can be:

  • break before make, meaning there is some time in which neither side makes contact. This may cause temporary high impedance long enough to cause some unpredictable behaviour
  • make before break, meaning there is some time in which both sides make contact. This may easily cause temporary shorts.

Poles and throwing (design)

Depending on what exactly you want to do, poles and throws can matter when buying a switch.

Amount of poles matters to whether you want to do something with one state (e.g. powered or not) or with both.

Amount of throws matters when you want to control things independently from the same mechanical switch (without digital logic doing it for you). Consider that a car's emergency light switch turns on both turn signals without tying them together electrically.

In some constructions, both matter. Consider multiway switching.

SPST (symbolic)
  • SPST (Single Pole, Double Throw)
    • open or closed

DPST (symbolic)
  • DPST (Double Pole, Single Throw)
    • two separate SPST-style switches controlled by the same mechanics

SPDT (symbolic)
  • SPDT (Single Pole, Double Throw)

DPDT (symbolic)
  • DPDT (Double Pole, Double Throw)
    • two separate SPDT-style switches controlled by the same mechanics

There are further variants of design.

Triple pole and similar also exist, for example triple pole single throw mechanical knife switch circuit breakers.


A relay is an electronically controlled switch.

Often electromechanical, though solid state relays are becoming more common.

Relays mean a circuit can switch a electronically separated circuit, which can be particularly handy when they deal with different voltages and currents. This can be useful when switching a completely distinct device, as part of process control, or as part of safety design.

Electromechanical relays are solenoids (electromagnets). As inductive elements they have flyback, so you'll often want a protection diode (flyback diode).

With the electromagnetism involved, thy are not completely isolated. With large voltage differences, you have a potential source of arcing (although this is more of a problem at kilovolts than at regular mains voltages).

Relays may need need on the order of at least 20mA-50mA to be held, so ICs driving them regularly use a transistor - and not unusually something for flyback protection.

Solid state relays are a relatively new development, and have no moving parts


  • Relays can generally deal with more voltage (e.g. 40V, 400V) than transistors/optocouples, and with more load (regularly a few amps or more).
  • Relays don't care what's on them (AC or DC) while in-circuit transistors are only really DC
  • Relays can often switch more than one thing at the same time
  • Transistors use less power than relays
  • Transistors react faster
  • Transistors use less power than relays (most relays cannot be driven directly by most ICs and need a transistor)

Reed relays can switch faster than regular coil relays, but have a current limit that is often on the order of half an amp.