HackSpace_-_April_2020

(Frankie) #1

TUTORIAL


Level shifting


e often talk about digital
signals being either 'on' or
'off', '1' or '0', but it’s not quite
as clear-cut as this. Because
different components work
at different signals, what one
module considers 'on', another might consider 'off'.
This mostly comes down to the voltage that a device
works at. Most hobbyist components work at either
3.3 V or 5 V, though you might come across some
other voltage levels.
There can be a little leeway for working with these
different voltage levels, for example, a 5 V system
may be able to take input from a 3.3 V module
(though it’s quite rare for a 3.3 V device to be able to
take 5 V input).
Often, however, we need a way of adjusting the
voltages of signals too, and for this, we need a level
shifter. These come in various forms. The biggest
difference between the types is whether they’re
one-way or bidirectional.

Above
A simple MOSFET-
based level shifter
board with four
channels will typically
only cost a couple
of pounds

Helping digital devices talk to each other


Level shifting


W


Ben Everard


@ben_everard

Ben loves cutting stuff,
any stuff. There’s no
longer a shelf to store
these tools on (it’s now
two shelves), and the
door’s in danger.


AC/DC


Perhaps the most electrically complicated form of
switching is controlling alternating current (AC) from
a direct current (DC) microcontroller. Fortunately,
there’s a very easy way of sidestepping all the
electrical complexity: relays. These are magnetically
controlled switches where a DC signal turns a
magnet on and off. This magnet flicks a switch and
can control a wide variety of electrical connections.
Since the input and switched circuit are entirely
separate, a DC signal can switch an AC signal
without problems. There are still electrical limits on
relays, so you do have to make sure that your relay
is up to the job in hand, but it’s easy to get ones
capable of switching mains-level current. However,
if you’re going to use it for high-voltage applications,
you need to make sure that you understand the
safety implications of this, particularly around making
sure the entire circuit is properly insulated (and will
remain so under the rough and tumble of daily use) so
no stray fingers come into contact with high voltages.
Free download pdf