Documentos de Académico
Documentos de Profesional
Documentos de Cultura
www.elektormagazine.com
www.elektor.com
www.elektormagazine.com
Memberships: designation as I am challenged to associate any dog let alone its bone with a cape, be it
Please use London address referring to a sleeveless cloak or a promontory. And neither is that friendly looking doggie
E-mail: service@elektor.com in beaglebone.org’s logo ever seen wearing the garment, or high on a windswept rock
www.elektor.com/memberships
peering over the ‘vast waters — of the petrel and the porpoise’. Puzzling.
Shields, capes or hats come in a bewildering variety covering just about anything you’d
Advertising & Sponsoring:
want to do learn from, or inflict on, the real world (your I and O respectively). Check out
Johan Dijk
Phone: +31 6 15894245 the .org websites associated with each of The Three Platforms, and the .com sites of a
E-mail: johan.dijk@eimworld.com flood of board retailers and you’ll find that most, if not all, plug-on boards cost more than
www.elektor.com/advertising the computerette they sit on. Users seem to be happy with that simply because the hat/
Advertising rates and terms available on cape/shield is a fit-and-forget device that allows people to concentrate on what the sys-
request.
tem, rather than the MCU alone, is actually doing. Hats off to the meticulously designed
RPi Audio DAC on page 22.
Regulars
13 Elektor Connexions
59 Homelab Helicopter
22
68 Err-lectronics
Corrections, Updates and Feedback to
published articles
70
Components in Space
Features
6 PCB Design is Not Easy
The art of laying traces
44
94 Electronics in Orbit 18 RF Step Attenuator
Space science for all of us Adjustable attenuation gives precise signal
levels
99 “May I have the menu, please?”
22 Audio DAC for Raspberry Pi
A network audio player with Volumio
Projects
Data acquisition and oscilloscope functions
for Raspberry Pi
Getting started with ESP32 and the Arduino
IDE
118 Ukele-LED
Serially addressable LEDs as ukulele
88
learning tool
Next Editions
the maker community with its low price: you can
get one from AliExpress for just two or three
euros/dollars/pounds. Its big brother, the
ESP32, is the result of Espressif’s efforts to
make their WLAN SoCs fit for the future. Elektor Magazine 5 / 2017
Along with a dual-core processor, it Tangible Prototypes for Tabula • LoRa with ST Boards •
has onboard Bluetooth, more RAM, CPLD Board as DIL Component • FFT Scopes in Practice
and IO extensions. In this article
• ESP32 with IDF • Datalogger for Heating Systems •RPi
we talk about programming the
Zero W Review • Function Generators • Flexible IoT sen-
ESP32 with the Arduino IDE. In
sor interface with GoNotify • Scoreboard with 7-segment
the next issue of Elektor we will
turn our attention to the native Displays • 12-V LED Driver • Ultrasonic Sound Generator
development tool IDF. • Universal I2C Bus Isolator and Level Adapter • Temi
Temperature & Humidity Sensor • Spy Camera Detector
• and much more.
Elektor Magazine edition 5 / 2017 covering September & October is
published on 15 August 2017. Delivery of printed copies to Elektor
Gold Members is subject to transport.
Contents and article titles subject to change.
Presenting the
Voltera V-One 48 nWatch, a Wearable Development
System Elektor Business Magazine 4 / 2017
PCB printer
or how to build your own smart watch Focus on: LEDs, Displays & Drivers
and reflow
soldering station AS7221 Spectral Tuning IoT Smart Lighting Manager
62 Get 5 V from One Exhausted Alkaline Cell (ams) • Smart City Transformation (Schréder) • GP-
Juice it to the Max! LV-32D Driver Series (GlacialPower) • Lighting Audit,
70 FPGA-DSP Board for Narrowband SDR Spectrum Mixer (GL Spectrosoft) •MiP-Displays in Me-
A fully programmable receiver/transmitter dical Applications (Sharp Devices Europe) • High-power
baseboard Colour and White LED Emitters (LED Engin) •Lights for
the ‘Oasis’ Rinspeed concept car (OSRAM) • and more.
80 MicroPython and the pyboard
From blinking LED to … webserver blinking Elektor Business Magazine edition 4/2017 is published on 15 July
an LED 2017. Contents and article titles subject to change.
Auto-router: Holy Grail of PCB design software Millimeter: one thousandth of a meter solder migrating away from the pad which
developers Net: a desired connection between two or more may result in bad solder joints or pulling an
Bottom: the lowest layer of the board stack, pins SMD device out of alignment.
also still commonly known as solder side OAR: outer annular ring SMD: surface-mount device, a device using SMT
Class: resolution or density of a PCB; the higher Pad: PCB element for connecting a pin SMT: surface-mount technology, for parts with
the class, the smaller PCB elements and PCB: printed circuit board terminals that are not to be inserted in holes
clearances are allowed to be PCB element: object printed on a layer, includes Stack: neat pile of layers
Clearance: distance between two or more PCB the board outline Stencil: mask to apply solder paste on a PCB
elements Pin: connection point of a component like a Terminal: see Pin
DRC: design rule check, to verify that PCB pad, pin, lead, etc. THT: through-hole technology, for parts with
elements respect a set of required design Plane: large copper area; called power plane terminals that are to be inserted in holes
parameters like minimal trace width, when connected to ground or a supply Tombstoning: the partial or complete lifting of
minimal drill size, minimum clearance voltage two-terminal SMT components during reflow
between pads, etc. Plated: covered with a conducting material Top: the highest layer of the board stack, also
ERC: electrical rule check, to verify that nets are Pour (copper): see Plane known as component side
connected, not overlapping, no shorts exist Push and shove: routing a trace by pushing Trace: a connection between two or more pins
due to copper pours, etc. and shoving PCB elements surrounding the on a PCB
Excellon: data format for CNC drill and route trace to create enough clearance for the Track: see Trace
machines new trace Via: metalized hole connecting traces on two or
Fiducial: special mark on a film, mask, board, Ratsnest, rat’s nest: a visual representation of more different layers
panel, etc., to help aligning them with all unconnected nets Via stitching: the use of many vias to connect
cameras, stencils, machines, each other, etc. Resist: protected against solder(ing), see Solder a copper element on one layer to another
Gerber: ASCII vector data format for two- mask element on another layer; often used for
dimensional, two-color images Routing: transforming nets into traces. conducting heat or on high-frequency
Heat relief: pad-copper (plane or trace) Silk screen: a non-conducting layer of graphic boards
connection preventing solder heat from symbols and text, usually white, also known
being absorbed by the copper as component print
IAR: inner annular ring Short: an undesired connection between two or
Layer: surface carrying PCB elements like more pins
traces, pours and components Solder mask: mask with openings where
Metalized: see Plated solder(ing) is allowed. A solder mask not
Mil: one thousandth of an inch only prevents short circuits, it also avoids
for this. Especially high or heavy parts with few terminals (e.g. space required to meet clearance rules.
large capacitors) need big pads to prevent them from acciden- Teardrop-shaped and tapered pads — where the pad gradu-
tally being ripped off . The copper is glued to the board, and, ally merges into the connecting trace — exist too (Figure 5).
especially when heated up (by soldering or current) delami- Besides giving a slight retro touch to the board, they do provide
nation is a possible risk. stronger pad-trace connections. This is important for boards
SMD parts usually have oblong shaped pads. Lead-free sol- that have to be able to bend, like flexible PCBs. Not all PCB
der doesn’t flow as well as traditional 60/40 solder, especially design tools can do this.
in the corners, which is why people have started to use pads Then there is heat relief (Figure 6). When a component lead
with rounded corners. SMD pads must be large enough to hold must be soldered to a very thick trace or a copper pour, the
enough solder paste to correctly solder a terminal. Refer to copper surrounding the pad may absorb the heat, making sol-
the component’s datasheet for the footprint or landing pat- dering difficult. To avoid the heat flowing away, pads can be
tern to use. connected with thin traces — so-called spokes or thermals,
THT pads can have all sorts of shapes (Figure 4). Square pads usually four — to the surrounding copper (this is where the
are often used to indicate pin 1 of a part, say, a connector. inner annular ring makes its appearance). When doing reflow
Octagonal pads are popular, but round is the best shape as it soldering (i.e. in an oven) this is less of a problem because the
maximizes the copper area (good for mechanical strength as whole board is heated up to the same temperature. Therefore,
well as heat dissipation) while simultaneously minimizing the there is usually no real reason to use heat-relief techniques
Holes
Pads often have holes in them — vias have holes too. Mount-
ing holes can be non-plated; holes in pads and vias are plated.
You specify the plated-hole diameter for your vias and pads; it
is the job of the PCB manufacturer to ensure that the finished
hole matches this diameter. For a plated hole the actual drill
size must be larger than specified because the plating material
needs space. Drilling has limited accuracy and a hole may be
drilled off-center (Figure 7). Therefore, to ensure that enough
copper remains around a plated hole after drilling and etch-
ing the board, the ‘outer annular ring’ (OAR) should be wide
enough. Inner annular rings (IAR) exist too. According to my
Figure 6. Heat relief prevents too much heat flowing away into the large
dictionary, ‘annular’ means ‘shaped like a ring’, so, technically
copper pour during soldering. Here the minimum inner annular ring (IAR)
speaking, annular rings are “ring rings” (which reminds me may be specified even though it is much the same as the OAR. The red
of this great Abba song from 1973 of which I highly recom- ring represents the plating of the hole.
mend the video on YouTube. They don’t make music like that
anymore…, nor apparel, Swenglish, guitars, hairdos, etc., but
I digress.) parallel” are often used to improve current conduction, while
A common mistake is to specify the wrong drill size for a com- limiting the risk of open circuits due to a broken via. However,
ponent lead — either too large or too small. one large via can be used too.
There is an issue related to vias and wave soldering: if a via is Naming nets is helpful during routing as they remind you of
unmasked, solder may flow up through it and potentially dam- the signal you are working with.
age a component mounted over it. Closing the solder mask for Then, corners! Rounded traces are best because, contrary to
vias will usually prevent this. angled traces, they have constant width. Changes in trace
width cause impedance mismatches and reflections, but only
Traces and planes at very high frequencies so most circuits are not affected by
Keep traces as short as possible; you knew that, of course. This
is especially true for high-frequency signals, but low-frequency
and even DC signals benefit from short traces too. Not only
are short traces good for signals, they also save board space.
Some fast signals may require traces (or a pair of traces) of an
exact length (and impedance) which is not always the shortest
connection possible.
Do not use the thinnest pen from your PCB design tools. Thin
traces may cost more and are fragile. The finest detail on the
board determines the board’s manufacturing class; the higher
the class, the more expensive the board. Vibrations can cause
micro cracks in thin traces resulting in bad or even broken con-
nections. If the board has to be soldered by hand, or if rework
is to be expected, thin traces may easily delaminate when too
much heat is applied for too long. Home etching usually is not
well-controlled and thin traces may get eaten away. Further-
more, a thin trace may not be capable of carrying the current
that you had in mind for it. Adapt the trace width to the current
that has to flow through the trace, the extra width is needed
to keep the trace cool. Many online calculators are available to
help you determine the best width for your trace. A thin trace
carrying too much current will heat up and may eventually
Figure 7. Due to manufacturing tolerances a hole may be drilled off-
melt or crack; it is the heat that limits the current. Vias also center. To allow for plating (the red ring) the hole must be drilled larger
must support the current. Covering traces with a thick layer than specified. The finished hole (with plating) will have the diameter you
of solder will increase the maximum current a trace can carry. specified. The ring that remains after drilling is the annular ring (AR). The
Similarly, filling a via with solder or copper helps too. Providing minimum acceptable outer annular ring (OAR) shown here is specified by
openings in the solder mask will be useful here. Multiple vias “in the design rules (DR).
2-Terminal Dimmer
controls LEDs, lamps and heaters
Features
• Two flavors: AC or DC
By Michael A. Shustov (Russia) • Does not require extra wire
and Andrey M. Shustov (Germany) • Does not require Arduino
In the past, rheostats (today also called potentiometers) were connected in series with a load to control the
current flowing through the load. Although simple, this technique has some disadvantages.
First of all, the current can only be con- lamps and LEDs), or to control the speed
R
trolled when the load is active. Secondly, of a motor.
the heating of the rheostat results in sig- Dimmers controlling the intensity of LED LED
K2
Æ intermediate level
1N4148 1N4148
2
expert level
L–
4 8
RES VCC 1
6 T1 L+
THR
7
IC1
3
R3
LED
2 hours approx.
DIS OUT 2k2
2 LMC555
TRIG RFP12N10L K3
CV GND 2 V+
C1
5
C3
1 Soldering iron,
1
V– common sense
2n2 1n
VDC
160380 - 11
copyright
£12 / €15 / $17 approx.
cannot be used in place of conventional imately 6 kHz, i.e. way too fast for the AC Line-powered dimmer
double-pole switches, since they require human eye to notice. The pulse/pause It is, of course, possible to adapt the
an additional third power wire for proper ratio or duty cycle is adjusted with poten- dimmer for use with an AC power supply
connection. To overcome this problem tiometer P1; the minimum and maximum like the 230 VAC line voltage available in
we propose a two-terminal dimmer con- values for the pulse width are determined households in many countries all over the
nected in series with the load (LED, lamp by resistors R1 and R2. world (115 VAC will work too.) To achieve
or a heating element) instead of a switch, this feat two hurdles have to be taken:
see Figure 1. Contrary to a switch, the Up to here the dimmer is a standard
dimmer allows adjusting the load cur- three-terminal shunt regulator. The trick • Finding a suitable power transis-
rent from almost 0 to about 97% of its to get rid of one terminal is to use the tor capable of handling such high
maximum value. The dimmer is powered load’s supply to power the circuit. This is voltages;
through the load when its switching ele- achieved by charging C2 through R4 and • converting the AC voltage to a DC
ment is disconnected and the current LED1 when T1 is not conducting. Zener voltage.
through the load is minimal. diode D3 limits the voltage to 3.6 volts.
An inconvenience of both two-termi- LED1 serves as a power-on indicator and The second point requires some atten-
nal and three-terminal dimmers is their also makes it easier to find the dimmer tion. Simply rectifying the AC line volt-
residual current consumption, but it is in the dark. age is not good enough, as heavy loads
insignificant compared to the current Transistor T1 can withstand up to 100 V like incandescent light bulbs will flicker,
when the load is powered. and conduct 12 A, but not at the same making filtering mandatory. Furthermore,
The dimmers described below can be time (the PCB only handles up to about the rectified line voltage is about 325 V
used with household lighting devices, 2.5 A anyway). According to its data- (163 V for 115 VAC line voltage), which
thermostats, and for instance back-up sheet it can dissipate up to 60 watts, is too high for standard household light
or secondary lighting. and it should be mounted on a suitable bulbs (several identical lower-voltage
heatsink when it has to handle more than light bulbs connected in series can be
Two-terminal DC-powered 1 watt. R4 determines the maximum sup- used, however). Because of these prac-
dimmer ply voltage, 20 V here. tical limitations, what follows is mainly
At the heart of the dimmer (see Fig- With the values given in the schematic to illustrate our point and is not recom-
ure 2) is the good old 555 timer IC in its we measured a quiescent current of mended for use in real life.
low-power CMOS guise called LMC555CN. 3.5 mA (i.e. when the duty cycle is 0%). Figure 3 shows the 230-VAC version of
It is wired as a pulse generator with vari- That’s enough current to make certain the dimmer. The most noticeable change
able duty cycle, a well-known circuit, LEDs light up noticeably. Reducing the is the addition of the rectifier (D4-D7)
nothing new under the sun. The output value of R2 to 75-100 ohms may improve and the supply filter made up with C4, C5
of IC1 drives power MOSFET T1 which the situation. In addition, increasing the and C6. We also added a skull & bones
in turn switches on and off the load (the value of R5 will reduce the minimal cur- symbol to make clear that potentially
LED) as dictated by the PWM signal. The rent too. A switch can be connected to lethal things are going on here.
PWM signal has a frequency of approx- K1 to completely turn off the dimmer. The filter capacitor is made with three
1N4148 1N4148 D4 D5
230VAC
4 8
VCC
1N4007 1N4007
RES
6 K2
THR T1
IC1 R3 1
7 3 C4 C5 C6 V
DIS OUT 100R
2 LMC555 2
TRIG 100u 100u 100u V
BU323Z 350V 350V 350V
CV GND
D6 D7
LINE
5 1
C1 C3
160380 - 12
copyright
Figure 3. This dimmer circuit is dangerous and may kill you. Do not look at it too long.
separate devices because one big one capacitors is not critical when a heating up to 150 W (with a suitable heatsink!).
is difficult to find and rather expensive. element is used as a load. If you are tempted to replace this tran-
With three times 100 µF (350-V types Besides the clearly visible schematic sistor by something “sturdier”, keep in
minimum) and a 100-W light bulb the changes there are also a few more sub- mind that the rectifier diodes D4-D7 are
voltage ripple at the output will not tle changes. Transistor T1 for once is specified up to 1 A and 3 W.
exceed 3% (approx.). This is invisible now a BU323Z Darlington power tran-
to the human eye. For heavier loads sistor instead of a MOSFET. This tran- Let’s do some math
the values of C4-C6 must be increased; sistor is designed for 230-VAC inductive When using LEDs (just one or
for light loads they can be decreased. switching applications and has built-in a few in series) for
The capacity of these over-voltage protection. It can handle illumination
component list
RF Step Attenuator
Adjustable attenuation
gives precise signal levels
By Alfred Rosenkränzer (Germany)
When dealing with radio-frequency signals it often comes in handy to have an easy way to attenuate a signal
level in discrete steps. For example, you might want to reduce the output of an RF generator to a lower level
than the output control on the generator allows, and there are many other applications of attenuators in
the adjustment and repair of receivers and other radio equipment. Unfortunately professional attenuators
are rather pricey, but they do not contain any expensive electronics and so a DIY approach is an eminently
practical alternative.
Sometimes it is necessary to attenuate there is no real alternative to an exter- example, when testing the sensitivity or
an RF signal by a known amount. If the nal attenuator, which is normally sim- small-signal behavior of a receiver: just
signal comes from an RF source whose ply inserted into the RF output connec- insert the attenuator in the antenna lead
level cannot easily be adjusted, then tion. Such an arrangement is useful, for and increase the degree of attenuation
Attenuator circuit
There are two different but equivalent cir-
cuit configurations used to attenuate sig-
nals while maintaining impedance match-
ing (in other words, the input and output Figure 1. Example of a VHF attenuator by HP, long since out of production.
1000R
1000R
6810R
8250R
8250R
1470R
1470R
464R
464R
261R
261R
I built attenuators of 1 dB, 2 dB, 4 dB,
1 dB copyright 2 dB 4 dB 8 dB, 8 dB and 8 dB. Together these allow
RF attenuation in steps of 1 dB (about a
10 % reduction in amplitude) from 0 dB
S4.A S4.B S5.A S5.B S6.A S6.B
to 31 dB, which makes sense for the
R19 R25 R31 TP3
typical uses to which I put the device.
825R 825R 825R TP4 Other combinations are of course possi-
R20 R26 R32
56R2 56R2 56R2 ble: for example six 10 dB stages would
R21 R22 R23 R24 R27 R28 R29 R30 R33 R34 R35 R36 allow attenuation from 0 dB to 60 dB
3160R
3160R
3160R
3160R
3160R
3160R
121R
121R
121R
121R
121R
R2 R8 R14 R20 R26 R32 Programs to help with this design can be
found on the Internet: if you are thinking
R10
R12
R15
R16
R17
R18
R21
R22
R23
R24
R27
R28
R29
R30
R33
R34
R35
R36
R11
R3
R4
R5
R6
R9
If you are looking for a small stand-alone project for this, we might as well design package, and it has outstanding specs in
network audio player, preferably with a a good high-end DAC for the RPi using all respects, including a dynamic range
touchscreen user interface, you don’t components with top-notch specs. of 127 dB (2 V RMS, stereo) to 132 dB
have a lot of options. Usually you end up (9 VRMS, mono), a THD of 0.0004%, and
with a largish amplifier from one of the The project at a glance differential current outputs (7.8 mApp).
big brand names, with a corresponding Digital to analog converter (DAC) ICs The PCM1794A accepts all known data
price tag. And most of them do not from Burr Brown (now part of Texas formats: standard, left justified, and I2S
have a touchscreen. If what you want is Instruments) have always been (and (which is important for our project). The
something compact and portable, these still are) about the best you can buy, digital portion of the IC operates at 3.3 V,
devices do not fit the profile. and we have used them previously in but the digital inputs are also compatible
That means your only real option is various high-end DAC projects. For this with 5 V signals. For a complete overview
to make your own. Apps based on the project we opted for one of the top of of the specifications, see the device data
Raspberry Pi are a good starting point, the line devices from Burr Brown: the sheet [1].
and DACs with fairly good specs are now PCM1794A. This is a 24-bit DAC which In order to convert the differential current
available for the RPi platform. However, can handle sampling rates up to 200 kHz outputs into single-ended voltages, we
at Elektor we are not satisfied with “fairly and has an integrated 8× oversampling need a current to voltage converter for
good” – if we are going to develop a filter. This IC comes in a 28-pin SSOP each channel, followed by a combined
VCC2L
VCC2R
S0 CLK/2
7 5 SCK R22 7 26 7.8mA p-p C1 C9 2n2
CLK FBIN 22R SCK IOUTL-
1 4 BCK R23 6 6n8
S1 ICLK 22R BCK 2
DATA R24 5 25 7.8mA p-p C2 6n8 R17
ICS570BILF 22R DATA IOUTL+
6n8 IC4 6
LRCK R25 4 R8 R10 47R K3
GND 22R LRCK 3
3
360R 1k 360R K1 L
+3V3 1 VCOML
22
6 R2 R9 1
C11
IC1 C21 7
560R
R21 IC2.B 2
5 IC2B 2n2
7x 47k
10uF +5V2
23
1 VCC1
2
3
4
5
6
7
8
MONO
+3V3_RPi +5V_RPi 2 C20 C19 3
CHSL PCM1794A IC3A
3 1 R12
DEM
10u 10u IC3.A 560R
10 2
K5 MUTE 21
1 2 11 VCOMR R3 R11 R13 C15
FMT0
3 4 12 360R 1k 360R
FMT1
5 6 14 18 7.8mA p-p C5 C14 2n2
*RST IOUTR-
7 8 13 6n8
AGND3R
AGND3L
ZERO 2
AGND2
AGND1
9 10 17 7.8mA p-p C6 6n8 R18
1
2
3
4
5
6
7
S1 R19 IOUTR+ 6
11 12 BCK DGND IREF 6n8 R14 R16 IC5 47R K4
BCK H 3
K2 R
270R
13 14 8 20 24 27 19 16 360R 1k 360R
L R20
15 16 6 R4 R15 1
LED1 C16
10k
17 18 7
14
13
12
11
10
9
8
560R
IC3.B 2
19 20 no data 5 IC3B 2n2
21 22
23 24
+5V2 +3V3 +3V3
25 26
27 28 8 1
IN OUT
29 30 C53 C52 5 IC9 R32
31 32
EN C50 copyright
180k
33 34 4u7 4u7 7
TPS7A4901
DNC 10n C49 C48
LRCK 35 36 TEST POINT 2
LRCK FB
37 38 6
NR/SS 1.185V R33
4u7 4u7 +4V74L
39 40 DATA C51 L1
100k
DATA NC GND EPAD +4V74L +4V74L
3 4 9 C30
10n
4u7 C3 C12
K7 >5V7 +5V2 +4V74
8 7
3 PMEG6030EP 100n 100n
R26
1 15 1 8 1 IC2 IC4
IN OUT IN OUT 0R +4V74R C4 C13
2 C58 C57 C56 16 20 C54 C41 C40 5 IC7 R28
L2 4 4
D1 IN OUT EN C38
300k
NC NC GND EPAD
R34 18 100n 100n
1u NC
10n
3 4 9 -4V81L
19 L7 L3
NC
1k
+4V74R +4V74R
TPS7A4700
12 4 -4V81 ACM4520-231-2P-T C32
LED2 0P1V 6P4V2
11 5 R27
0P2V 6P4V1 1 4 C7 C17
10 6 VIN VOUT 0R 4u7
Power 0P4V 3P2V C47 C46 R30
9 8 8 7
0P8V 1P6V 6 IC8 100n 100n
-4V81R IC3 IC5
150k
GND PAD EN
4u7 4u7 7 C8 C18
7 21 C1- C42 L4 4 4
C45 5 –1.22V
VFB
C33 100n 100n
1u 8 LM27761 R31 2u2
3
C1+ CPOUT
4u7
51k
C44 C43
PAD GND -4V81R -4V81R
9 2
4u7 4u7
160198 - 11
Figure 2. Detailed schematic diagram of the high-end DAC for the Raspberry Pi.
consumption of the audio DAC is listed we added a frequency multiplier with A problem
in Table 2. an integrated PLL in the form of an We ran into a different problem when
ICS570BILF (IC6). This IC has a zero testing our prototype DAC. First we tried
Master clock delay buffer to ensure that the rising all sorts of 32-bit and 24-bit audio data
In order to utilize the audio DAC, the edges of the input and output signals with sampling frequencies from 32 to
operating system of the Raspberry Pi are perfectly aligned. 192 kHz, all without any difficulties.
(Raspbian) has to be configured for a The multiplication factor can be set However, when we tested the circuit with
HiFiBerry DAC. Once that is done, the between 0.5 and 32 by two tri-state 16-bit audio data we did not see any
Inter-IC Sound (I2S) signals are available inputs (S0/S1). According to the date output signal. To make a long story short,
on the GPIO expansion connector. The sheet, the output frequency range is 10 after a lot of sleuthing we discovered that
official names of these signals are to 170 MHz. We chose a multiplication although the PCM1794A supports 16-bit
Continuous Serial Clock (SCK) or Bit factor of 6 by leaving both S0 and S1 and 24-bit audio, that is not entirely
Clock (BCLK/BCK), Word Select (WS) open, and we use the CLK/2 output, true in I2S mode. The data sheet is not
or Left/Right Clock (LRCLK/LRCK), and which is also connected to the feedback especially clear about this.
Serial Data (SD/SDATA). input. This configuration provides the Does this mean that our player does not
For proper synchronization we also need best input range (2.5 to 12.5 MHz) with support 16-bit audio? That depends.
a master clock, but that is not included an output range of 15 to 75 MHz. You Direct playback is not possible, but the
in the original I 2S specification. This might think that with this arrangement Volumio version we use here (version
signal is therefore not available on the it is not possible to handle signals with a 1.55) includes sampling frequency
expansion connector, so the DAC circuit sampling frequency of 32 kHz, but that conversion capability with three different
has to generate it on its own. For this is not true; it works perfectly. quality levels. With a bit of luck, this
component list
Figure 3. The component side of the PCB. Figure 4. The bottom side of the PCB.
Jumpers JP1 and JP2 can normally be
omitted.
Output filter
Although the sampling artifacts are
largely suppressed by the 8x digital
oversampling filter, there are still
undesirable high frequency components
present in the output signal of the DAC.
We use a reconstruction filter to suppress
these components. The filter in question
is a third-order Butterworth filter, and
the current to voltage converters (IC2/
IC3) are part of this filter. The corner
frequency is 64.5 kHz. With a sampling
frequency of 44.1 kHz, the 8x frequency
component at 352.8 kHz is attenuated by
more than 40 dB, and with a sampling
frequency of 192 kHz the attenuation
Figure 5. The GPIO connector is mounted on the bottom side.
is more than 80 dB. The chosen corner
frequency is a compromise between
adequate attenuation at low sampling
frequencies and the audio bandwidth
of the output signal at higher sampling
Table 1: S1 settings
frequencies. Here the filter bandwidth is
S1-1 L De-emphasis disabled for 44.1 kHz
more than three times the normal audible
S1-2 L Digital filter with steep falling edge range.
S1-3 L Mono off The DAC IC has differential current
S1-4 L Mono off outputs, which allows an external filter
S1-5, S1-6 L I2S mode to be used. To convert the output current
into a single-ended voltage, we need a
S1-7 H Reset off
current to voltage converter, which in
this case is built around the dual opamps
of IC2 and IC3. The differential output
voltages of IC2A/IC2B or IC3A/IC3B are
Table 2: Current consumption at different sampling frequencies fed to IC4 or IC5, respectively, which
Sampling frequency Current consumption (K7) convert them into single-ended voltages.
No data 120 mA They are also configured as second-
32 kHz 127.5 mA order filter stages. In combination with
the current to voltage converters, the
44.1 kHz 131.7 mA
overall filter characteristic is equivalent
48 kHz 133 mA
to a third-order Butterworth filter.
96 kHz 149.5 mA On the PCB the single-ended output
192 kHz 182.1 mA signals are available on connectors
(Measured with 8 V lab power supply; both outputs terminated with 10 kΩ) K1 and K2 via headers K3 and K4.
Jumpers allow the signals from K3 and
K4 to be fed directly to K1 and K2. It
is also possible to connect a stereo
potentiometer to the headers to provide
Table 3: Distortion
a simple volume control.
THD+N
The DAC IC does not have integrated
Sampling frequency 48 kHz 96 kHz 192 kHz volume control capability. Although it
1 kHz BW = 22 kHz 0.0008% 0.0009% 0.0013% is possible to use Volumio for software
BW = 80 kHz 0.0028% 0.0012% 0.0014% volume control, that comes at the
7 kHz BW = 22 kHz 0.00095% 0.0011% 0.0013% expense of the resolution and therefore
affects the sound quality. For us that is
BW = 80 kHz 0.003% 0.0014% 0.0016%
out of the question. We therefore decided
IMD
to add hardware volume control in the
50 Hz:7 kHz = 4:1 0.0014% 0.002% 0.0036%
form of a separate board, which also
The board
For the DAC board we only need a single
external supply voltage in the range of 7
to 8 V, since the Raspberry Pi board has
its own 5 V supply. An external supply
voltage of 9 to 12 V is possible, but not
recommended due to the higher power
dissipation in IC10.
The top and bottom PCB layouts for
the DAC board are shown in Figure 3
and Figure 4. The board has the same
dimensions as the Raspberry Pi. The
power connector and the two signal
outputs are on the same end of the
board, with the seven-pole DIP switch S1
on the opposite end (adjacent to the WiFi
antenna on the RPi 3 board). The 40-pin
GPIO stacking header K5 is mounted on
the bottom of the board, as can be seen
from the photos of the assembled board.
The pins of connectors K1–K4, K6 and K7
protruding on the bottom of the board
must be trimmed as short as possible
to avoid shorting on the metal shells of
the Ethernet and USB connectors on the
Raspberry Pi board. It is probably a good
idea to place a bit of insulation between
the two boards. In our prototype we
used M2.5 metal male/female threaded
standoffs with a length of 17 mm
(0.675”) to attach the DAC board to
the Raspberry Pi. The solder pads for
the capacitors in the filter stages are
laid out to allow three different types of
capacitor to be mounted for C1, C2, C5,
C6, C9–C11, and C14–C16. SMD 0805
components can be used here, but it
is also possible to mount conventional
through-hole capacitors with a lead pitch
of 5 mm. For best results, we recommend
using 1% polystyrene capacitors.
Pin 1 of each IC is marked with a small
white dot, but with IC7 this is difficult
to see due to capacitor C38. There was
not enough room to put the numbers
of the 0805 resistors and the 0805 and
1206 capacitors next to the components
concerned, so we put them inside the
component outlines. That means they Figure 6: The complete network audio player.
Measurements
It goes without saying that we subjected
our audio DAC to extensive testing. The
key results are summarized in Tables 2
and 3. All measurements were made
with the S1 settings listed in Table 1.
The current consumption increases at
higher sampling frequencies, as can be
seen from Table 2.
The measured figures for total harmonic
distortion plus noise (THD+N) and inter-
modulation distortion (IMD) are listed
in Table 3.
Several plots made with our Audio
Precision analyzer are also available
on the Elektor Labs page for this
project [2].
(160198-I)
Web links
[1] PCM1794A data sheet:
www.ti.com/general/docs/lit/getliterature.
tsp?genericPartNumber=pcm1794a&fileType=pdf
[2] Elektor Labs project page: www.elektormagazine.com/labs/
audio-dac-for-rpi-networked-audio-player-using-volumio
W E R S U P P LY
INDEP I N G ENDENT PO
R T R AV E L L
IDEAL F O
Intenso slim 10,000 mAh power bank
Our price tip – ideal for
smartphones & tablets!
Cell capacity: 10,000 mAh, lithium-ion
Output connection: USB A and integrated
micro USB cable
Output: 5 V DC, max. 2.1 A
Protective features: surge voltage protection,
discharge protection, overcharge protection,
short-circuit protection
Dimensions: 130 x 70 x 16 mm
Order no.:
9.68
instead of 16.40 INTENSO 7332530
SAVE
41%
TO HELP YOU CHOOSE
Smartphone Tablet PCs
suitable for power banks suitable for power banks
with 1 – 1.5 A and with more than 1.5 A and
2,200 – 6,000 mAh 6,000 – 20,000 mAh Logilink slim 20,000 mAh power bank
The power bank with
huge power reserves
Stabilised universal adapter, 12 – 24 V DC Output: 5 V DC, max. 2.1 A
Supplies netbooks and notebooks with LED charge state display (4 segments)
reliable power while travelling by car! Protective functions: overcharge protection,
deep discharge protection, short-circuit protection
Input voltage: 12 – 24 V DC
2 USB ports
Output: 15 – 20 V DC / max. 4,730 mA
Dimensions (L x W x H): 160 x 82 x 23 mm
10 DC connector plugs included for different devices
Short-circuit, overload, surge current and overheating protection
T
Integrated USB charging port, 5 V DC HOW ABOU
G EXTRA?!
SOMETHIN
Order no.:
22.38
LOGILINK PA0086B
E NOW
Order no.: OUR HOTLIN
E
UR LANGUAG
25.86
NTS 90 USB
ALSO IN YO
We look forward to your call:
+44 203 808 95 25
Daily prices! Price as of: 29. 5. 2017 Prices in £ plus statutory VAT, plus shipping costs · reichelt elektronik, Elektronikring 1, 26452 Sande (Germany) Onlineshop languages:
www.reichelt.co.uk
PAYMENT METHODS:
BBC micro:bit for
Electronicists (2)
Data acquisition and oscilloscope functions
A USB oscilloscope
For programming the BBC micro:bit the
mbed platform has proven its worth. The
GND
3V
Input
micro:bit P2
P1 10k
P0
Figure 1. Measurement input and signal output. Figure 2. A squarewave signal with 10 Hz Figure 3. The filtered signal.
repetition rate.
Wireless transfer
of captured data
Figure 4. Measuring with a higher sampling Figure 5. A 500-Hz sawtooth signal The BBC micro:bit is equipped with
rate. Bluetooth Low Energy (BLE). You will look
in vain on the board for a dedicated chip
for this, as the RF circuitry is already built
sition time of the A-to-D converter that use a Byte Array with 400 bytes using into the microcontroller. The nRF51822
limits the achievable sampling rate. So char d[400]. By dividing by 4, the 10-bit from Nordic Semiconductor was originally
you create a Data Array, fill it with data data of the A-to-D converter becomes an developed for applications such as
measurements and send these off to the economical 8 bits. wireless keyboards and mice, which did
PC. But it’s exactly here that problems We now store and transfer 400 bytes not call for extensive range but did have
arise that you had not reckoned with. (Listing 2). We are still 100 bytes short to use battery power economically. The
Although the controller is well endowed for filling the plotter. But we can make a BBC micro:bit takes advantage of these
with RAM, an Array of the type int virtue out of necessity and prefix a zero- capabilities. You can power the board
d[100] is pushing the limits, because bytes header and suffix a trailer having using a 3-V battery and then dispense
the Microbit Runtime does not have much 255-bytes. This causes the serial plotter with even the USB cable. This makes
spare capacity. But if you want to use to always display the full measurement the system viable even for long-term
the serial plotter, there should already range and provides the viewer with clear applications powered by batteries. The
be 500 measured values. visibility of the range limits. The reading shortform lineup of its main features
You definitely need to be aware that the in Figure 4 depicts a 50-Hz signal with speaks for itself:
type of int in a 32-bit system has a typical interference pulses, which you
size of four bytes. Accordingly we have pick up with an exposed measurement • 2.4-GHz transceiver
400 bytes at our disposal. Therefore we lead. Because around 1.5 oscillations are • –93 dBm sensitivity in Bluetooth®
low energy mode
• 250 kbps, 1 Mbps, 2 Mbps supported
data rates
• Tx Power –20 to +4 dBm in 4-dB
steps
• Tx Power –30 dBm whisper mode
• 13 mA peak Rx, 10.5 mA peak Tx
(0 dBm)
• 9.7 mA peak Rx, 8 mA peak Tx
(0 dBm) with DC/DC
• RSSI (1-dB resolution)
• ARM® Cortex™-M0 32-bit processor
• 275 μA/MHz running from flash
memory
• 150 μA/MHz running from RAM
• Serial Wire Debug (SWD)
Advertisement
GREEN
MEMBERSHIP
✔ 6x Elektor M
agazine (PDF)
✔ Access to Ele
ktor Archive
(Thousands of
Articles)
www.elektor.com/member
ers
project information
Noise
Simulator
Relaxation
Æ entry level
intermediate level
expert level
1 hour approx.
You may think that for producing a mag- weeks is because of our Multifunctional Soldering iron,
azine like Elektor all that is required Power Planner and unsung hero Hedwig. small screwdriver,
are some editors to write articles and Although electronics is not her specialty bed
one or two graphics designers to cre- (“is this capacitor thing or whatever it
ate nice illustrations. That is only partly is supposed to be this kind of blue?”),
true. One of the main reasons — possi- Hedwig does have a pet circuit: the sea £12 / €15 / $17 approx.
bly the only one — for you to be able to sound generator. So Hedwig, this one
read your favorite magazine every eight is for you.
R3 P1
50V
100k C4 R8 R13
R5 P4
D1 D2 500k 2M2
1k2
47u
10k
10 50V
8 6 1M C10 1 IC3
IC2.C R11 2 3 6
9 R6 7 C8 R12 C11
D3 IC2.B 8
1 5
3x 5 R9 1u IC2.A 100k LM386
1M
1N4148 50V
10k
3 10u 2 C13 K2
220u
50V
100k
P2 4 50V
T3 7 47n
R10
R7 R14
500k 100k IC2 = LM324 C12
Speaker
10R
Volume
2k2
P3 P5
OUT
500k BC547C 10k 10u
50V
+5V +5V
+5V
copyright R2 +5V
10k
8
K1
R1 C2 2 +V 7
1 C+ OSC
+5V 68k 4 C5
2 C7 C3 1 IC1 5
D– T1 * T2 10n IC2 FC OUT –5V
3 C1
D+ 11 100u
4 MAX660 6 C6
220u 100n 50V C– LV
4 50V
GND GND
1u
50V 100u
2N3904 3
50V
USB
–5V
140097 - 11
–5V
component list
SDA
SCL
S B1 B2 BN P
Raspberry Pi, BeagleBone, Arduino, Genuino, ATmega, PIC, The Raspberry Pi provides a convenient environment for learn-
practically any PC: pretty much anything you can find sitting ing how to use new and unfamiliar I2C slave devices. Figure 1
on a maker’s work bench that can compute will have one or shows how a breadboard can be used to connect an LM75 to
more I2C interfaces. Using the example of the LM75 tempera- a Raspberry Pi.
ture sensor we will look in this article at how the I2C interfaces
of the Raspberry Pi, ATmega and Arduino can be used as bus Operation as bus master
masters, and, where possible, as bus slaves. Before the I2C bus on the Raspberry Pi can be used under
Raspbian, it is necessary to install two extra drivers. To do
Raspberry Pi this, launch raspi-config and select the I2C option under the
The Raspberry Pi has two physical I2C buses, of which only Advanced Options menu item. This will enable the interface
one can normally be used directly. The Raspberry Pi board and load the necessary kernel module. Alternatively add the
comes with pull-up resistors to the 3.3 V supply already fit- following lines to the file /etc/modules using a text editor:
ted and permanently enabled. SDA and SCL are available on
pin 3 (SDA) and pin 5 (SCL) of the expansion header, conve- i2c-dev
niently right next to the 3.3 V supply on pin 1, the 5 V supply i2c-bcm2708
on pins 2 and 4, and ground on pin 6. These pins belong to I2C
bus number 1. It is therefore possible to make a very compact After restarting the system the two drivers (as well as any other
plug-in expansion board offering temperature sensing, real- extra drivers that are required) will be loaded and the device
time clock or position sensing functions. nodes /dev/i2c-<n> will be created. This can be confirmed
Caution: the ports of the Raspberry Pi must only be oper- using the following commands at the ‘$ ...’ prompt.
ated at 3.3 V and connection to 5 V signals can damage the
device. It is important, therefore, to check your circuit carefully $ lsmod | i2c_
before connecting it to the ports on the Raspberry Pi. In par- i2c_dev XXXX 0
ticular take care that no I2C slave contains pull-up resistors to i2c_bcm2708 YYYY 0
the 5 V rail. If present, any such resistors should be removed: $ ls /dev/i2c-*
the slave will still work without them. dev/i2c-1
For a first test you can use the i2cdetect tool from a terminal
window to obtain an overview of the slave devices that the
system recognizes on I2C bus number 1. The results might
appear as shown in Figure 2, where the LM75 is responding
to address 0x48.
The commands i2cget, i2cset, and i2cdump can be used to Figure 1. Connecting an LM75 to a Raspberry Pi using a breadboard.
communicate with the LM75 without having to get involved
in programming. In the example below 0x00 is the register
number, which must always be specified.
ioctl(fd, I2C_SLAVE, 0x48);
Next we set the slave address with an ioctl() call. Figure 2. The i2cdetect tool has found an LM75 at address 0x48.
address = 0x48
w = bus.read_word_data(address, 0)
The Wire library can be found directly within the Arduino IDE.
As in the case of Peter Fleury’s i2cmaster library the library
and I2C interface must be initialized at the start of your code.
#include <Wire.h>
void setup() {
Wire.begin();
}
You can then look at what device nodes are root@bounty:~# i2cdump -y 5 0x50
present in /dev. No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
$ ls /dev/i2c* 00: 00 ff ff ff ff ff ff 00 1a b3 d4 07 ec 22 02 00 ........?????"?.
/dev/i2c-0 /dev/i2c-1 /dev/i2c-2 /
10: 0a 16 01 03 80 34 20 78 2a ef 95 a3 54 4c 9b 26 ?????4 x*???TL?&
dev/i2c-3 /dev/i2c-4 /dev/i2c-5
20: 0f 50 54 a5 4b 00 81 80 81 00 81 0f 95 00 95 0f ?PT?K.???.???.??
30: a9 40 b3 00 01 01 28 3c 80 a0 70 b0 23 40 30 20 ?@?.??(<??p?#@0
40: 36 00 06 44 21 00 00 1a 00 00 00 fd 00 38 4c 1e 6.?D!..?...?.8L?
Up to this point you do not need root privi- 50: 52 10 00 0a 20 20 20 20 20 20 00 00 00 fc 00 42 R?.? ...?.B
leges. Under Debian and its derivatives (which 60: 32 34 57 2d 35 20 45 43 4f 0a 20 20 00 00 00 ff 24W-5 ECO? ....
includes Raspbian and Ubuntu) you can install 70: 00 59 56 32 45 31 34 30 30 31 32 0a 20 20 00 8e .YV2E140012? .?
i2c-tools.
apt-get install i2c-tools If your PC has a VGA connector, you can try connecting an
I2C slave to pin 12 (SDA) and pin 15 (SCL). Pins 6 (SCL)
Sometimes there are slaves on only one of the buses, as in the and 7 (SDA) of a DVI connector and pins 15 (SCL) and 16
following example. (SDA) of an HDMI connector are also good candidates for
experimentation. Unfortunately in some cases these buses
root@bounty:~# i2cdetect -y 5 are under the sole control of the graphics card and its
0 1 2 3 4 5 6 7 8 9 a b c d e f firmware.
00: -- -- -- -- -- -- -- -- -- -- -- -- --
Etching your own PCBs used to be a real chem lab exercise. First you had to copy the PCB layout from film
to the PCB material by exposing, developing and fixing the photoresist. That involved a lot of chemicals, with
unpleasant odors and a good chance of splashes or spills. Now there’s an entirely new option: the Voltera
V-One can print circuit tracks, apply solder paste, and even solder the components in a reflow process.
The hassle of working with chemicals convinced many develop- PCB production with their V-One PCB printer, which could inspire
ers to stop making their own prototype PCBs. The trouble starts many electronics enthusiasts to start making their own PCBs.
already with the layout film, where you have to determine the That’s true twenty-first century technology — with the V-One
exposure and development times by trial and error. The goal is you print PCBs, apply solder paste to the board, and even
to find the best compromise between the darkness of the black solder manually placed components using a reflow process.
tracks and the lightness of the surrounding areas. Making the
tracks darker causes the surrounding areas to become gray, Hardware
with the result that the copper will not be fully etched away The V-One is a flatbed printer with three-axis control, and it
where it shouldn’t be left. If instead the surrounding areas fits easily on a benchtop (Figure 1). The mechanical structure
are nicely clear, the track density is not high enough and thin is illustrated in Figure 2. There is a base on which a movable
tracks in particular are sometimes etched away. bridge is mounted for the Y axis. A carriage with a tool holder for
Once you get the film prepared reasonably well, it is time for three different tool modules and a drive gear (carriage gear) is
the real work: exposing, developing and etching the PCB. If mounted on this bridge. This carriage travels along the X axis.
everything goes well, after removing the photoresist layer you The tool modules can also be moved vertically along the Z axis.
are rewarded with shiny copper tracks. We call this a printed The three tool modules shown in Figure 3 are a probe head, a
circuit board (PCB), but actually it should be called an etched print head for electrically conductive ink, and a print head for
circuit board (ECB). solder paste. The tool modules are simply attached to the tool
Now the Canadian start-up Voltera is poised to revolutionize holder by four strong magnets, making them easy to exchange.
Software
The associated software is a package comprising calibration, Figure 4. Operating mode indication: when the LEDs in the Y axis slots
control and printing software and a video user guide. The video are red, the work surface is very hot.
user guide in particular deserve praise: each step of the pro-
cedure is illustrated by one or more short videos on the right
side of the screen, and each action is shown in practice (Fig-
ure 5). The videos run continuously and help you understand
the illustrated actions on your own machine. It could hardly
be simpler or clearer.
Software is available for Microsoft Windows 7 (64-bit) or later
and for OS X version 10.11 or later. Unfortunately, a Linux ver-
sion is not yet available. The software can be updated at any
time, with no need for antiquated optical storage media. In
addition, the software checks for updates each time the pro-
gram is launched. If an update is available for the software or
the printer firmware, it is installed automatically.
era has tested the Gerber dialects of Eagle, Altium, Upverter the previous one). According to the manufacturer, the con-
and KiCad. Gerber files are also available as downloads for ductive ink and the solder past should normally be kept in the
many Elektor projects. To make it easy to try out the printer refrigerator, and they should be taken out 30 minutes before
right away, Voltera kindly includes all necessary components the start of printing to allow them to adjust to room tempera-
for a small “Hello World” project. That consists of a simple ture. However, in my experience a considerably longer time
blinking light board with the well-known NE555 timer IC in of about two hours is advisable, because then the printing is
an SMD package. The PCB layout is already incorporated in much more uniform and above all free from gaps. If the test
the software and can be accessed by a special link in the pattern is okay, you can wipe it away with a paper towel and
Open File dialog. clean the board again with alcohol.
It is always fascinating to watch the printer at work (Fig-
Printing ure 6). Unlike ink jet printers, the print head does not scan
Standard FR4 glass fiber reinforced epoxy circuit board material back and forth over the surface of the board. Instead, it prints
is a suitable choice for the substrate. Along with a ten-pack of the tracks one after the other, just like a plotter, and finishes
blank circuit boards with dimensions of 2 × 3 inches and 3 × 4 them with solder pads.
inches, my V-One came with a shield for the Arduino Uno and
Mega. The maximum printing area is 138 × 102 mm (5.5 × 4
inch). In my experience it is a good idea to clean the board
with alcohol before printing, since traces of skin oil can lead Automatic PCB printing and
to broken PCB tracks. reflow soldering
The first step is to secure the blank circuit board in the middle
of the working area with the two metal clamp strips. In the
next step, the probe head outlines a rectangle on the board If the printing is not satisfactory in some places, which can hap-
within which the circuit will be printed. If the rectangle is not pen for a wide variety of reasons, you can select the affected
in the middle of the board or extends beyond the edge of the area on the screen and repeat the printing in that areas. For
board, you can adjust the position on the screen until every- this you can also adjust the ink supply if necessary.
thing is okay. You can also use this approach to print several
small layouts on the same board, for later separation into Baking
individual boards. Once the printing is completed, you can start the baking pro-
Once the position on the board is correct, the probe head scans cess in order to cure (harden) the freshly applied ink tracks.
the board to generate a height profile. The print nozzles for Until they are cured, you must be careful to avoid accidentally
the electrically conductive ink and the solder paste are very smearing the ink. For baking, the clamp strips are exchanged
thin and fragile. They must never be allowed to collide with the and the board is placed in the recesses of the clamp strips with
board surface, but they also should not float too high above the printed side facing down, so that the surface of the board
the surface, as otherwise the print quality will suffer. is held slightly above the working surface.
After the height profile has been generated, the probe head The baking process is initiated by the software and takes about
is replaced by the print head with the electrically conductive 40 to 50 minutes. During this time the target and actual tem-
ink. First a test pattern is printed with this head. It consists of peratures of the heating system are continuously plotted on
two serpentine lines and several parallel horizontal lines with the screen (Figure 7). The bridge guide slots also light up
a minimum separation of 0.8 mm. The minimum track width is bright red as a warning signal. Touching the printer during the
8 mil (about 0.2 mm). If the test pattern is not printed prop- baking process is not a good idea, because a temperature of
erly, you can adjust the ink flow in the software and then check 250°C can cause painful burns. To on the safe side, I placed
the new setting by printing the pattern again (after wiping off my V-One on top of a double layer of ceramic tiles.
When the LEDs change back to blue, the heating system has temperatures in the range of 190 to 210 °C. The solder rec-
cooled down and the baking process is finished. Now you can ommended by Voltera (Sn62, or even better SnBiAg1) is well
safely remove the board. suited to this temperature range. The solder wire is so thin
A special plastic sponge is include with the V-One, and it must that there is no room for a flux core. The flux (for example,
be used now to polish the PCB in order to ensure reliable sol- ChipQuick SMD 291) must be applied separately before solder-
der joints later on. Figure 8 shows the fully printed and pol- ing. As I found out the hard way, that takes a bit of practice.
ished PCB.
nWatch,
a Wearable Development System
or how to build your own smart watch
The nWatch presented in this article is finally realized what I was doing wrong: is a member of the high-performance
a smart watch that doubles as a micro- I wanted to make a quite complex device foundation line from STMicroelectron-
controller development board. At the in a very short time. This really was a ics. It has an ARM Cortex-M4 core run-
start this project wasn’t really about a bad idea and so I decided to spend some ning at 168 MHz with a DSP and an FPU,
development board, but more for a sim- time to rethink the schematic, and redo there is 1 MB of flash memory, and a
ple watch to cheat at my school quizzes the PCB while aiming for as few bugs as galaxy of peripherals. The reasons for
about subjects that were — in my humble possible. After about two weeks of fixing selecting this device are several. First, it
opinion — not relevant. The first proto- issues, I came up with the final version. I has enough general purpose I/O (GPIO)
type was not very advanced, but it did had learned to think about a project first ports and buses to connect all the other
what it was designed for. Then I started before trying to draw the schematic or ICs to it. A special hardware memory
thinking about the possibilities of devel- design a PCB. This project also taught management unit (MMU) is present,
oping a device that would be useful and me to be patient. which is used to control the LCD and
allow me to learn something in the pro-
cess, and so I came up with the idea to
build a smart watch that doubles as a
microcontroller development board. This
turned out to be not so easy though. wake up Accellerometer
button RTC clock Gyroscope Bluetooth
When I started out I had limited knowl-
edge of electronics and only some basic
programming skills, the idea being that SRAM memory
1k
1k
D0 6 D0 6
VAUX
VAUX
VIO
VIO
100n 100n 100n 100n100n 100n 100n 100n 10uH 10uH D0 D0
A0 1A0 1 7 D0
7 D0
C21 C21 A0 A0 IO0 IO0 D1 18 D1 18
A1 2A1 2 8 D1
8 D1 D1 D1
SWDIO SWDIO A1 A1 IO1 IO1 D2 8 D2 8 12 RST 12 RST
TP7 TP7 A2 3A2 3 9 D2
9 D2 D2 D2 !RESB !RESB
143
143
108
121
131
144
108
121
131
144
100n 100n A2 A2 IO2 IO2
32
30
39
52
62
72
84
95
25
33
32
30
39
52
62
72
84
95
25
33
SDWCLK SDWCLK D3 17 D3 17
17
17
TP6 TP6 A3 4A3 4 10 D3
10 D3 D3 D3
A3 A3 IO3 IO3
PDRON
VDDA
PDRON
VDDA
D4 9 D4
VDD
VDD
VDD
VDD
VDD
NRST
9
VDD
VDD
VDD
VDD
VDD
VDD
VDD
VDD
VDD
VDD
NRST
VREF+
VREF+
GND_UNK0
GND_UNK1
GND_UNK0
GND_UNK1
45
TOUCH_INT TOUCH_INT 45 48 48 WRB 5 WRB 5
PC5 PC5 PB2 PB2 A12 25A12 25 35 D12
35 D12 WRB WRB
44 44 50 50A6 A6 A12 A12 IO12 IO12 RDB 20 RDB 20
R17 PC4
R17 PC4 PF12 PF12 A13 26A13 26 36 D13
36 D13 RDB RDB
GND
GND
GND
GND
MP3-MOSI 43
MP3-MOSI 43 53 53A7 A7 A13 A13 IO13 IO13
0R PA7
0R PA7 PF13 PF13 A14 27A14 27 37 D14
37 D14
SDIO_D0 SDIO_D098 98 54 54A8 A8 A14 A14 IO14 IO14 4 21 7 16 4 21 7 16
PC8 PC8 PF14 PF14 A15 42A15 42 38 D15
38 D15
SDIO_D1 SDIO_D199
PC9
99
PC9
IC1 IC1 PF15
55
PF15
55A9 A9 A15 A15 IO15 IO15
A16 43A16 43
SDIO_D2 111
SDIO_D2 111 56 56A10 A10 A16 A16
PC10 PC10 PG0 PG0 A17 44A17 CY7C1041DV33
44 CY7C1041DV33 17 WRB17 WRB +3V3 +3V3
SDIO_D3 112
SDIO_D3 112 57 57A11 A11 A17 -10ZSXI
A17 -10ZSXI
WE WE
PC11 PC11 PG1 PG1 A18 28A18 28 41 RDB
41 RDB
SDIO_CMD SDIO_CMD116 116 58 58D4 D4 A18 A18 OE OE
PD2 PD2 PE7 PE7 40 UB
40 UB
SDIO_CLK SDIO_CLK113 113 59 59D5 D5 UB UB 6 8 14 6 8 14
PC12 PC12 PE8 PE8 NE3 6NE3 6 39 LB
39 LB
DRDY- DRDY- 76 60 60D6 CE CE LB LB
VCC
76 D6
VCC
VIO
VIO
IN0
IN0
PB15 PB15 PE9 PE9
MP3_ON MP3_ON75 75 70 SDA
70 SDA GND GND GND GND TOUCH_INT 2TOUCH_INT 2 13 13
PB14 PB14 PB11 PB11 INT INT X+ X+ TP8 TP8
IR_LED IR_LED 74 74 79 79D15 D15 12 34 12 34 SCL 4 SCL
IC11
4
IC11 15 15
PB13 PB13 PD10 PD10 SCLK SCLK Y+ Y+ TP9 TP9
MP3-DREQ MP3-DREQ100 100 80 80A16 A16 SDA 5 SDA STMPE811
5 STMPE81116 16
PA8 PA8 PD11 PD11 SDAT SDAT X– X– TP10 TP10
49
DIVIDE_ON DIVIDE_ON 49 81 81A17 A17 3 3QTR QTR 1 1
PF11 PF11 PD12 PD12
LCD +4V1
LCD +4V1 A0/D0 A0/D0 Y– Y– TP11 TP11
SW2 SW2 73 73 82 82A18 A18
DATAIN
DATAIN
D1 D1
PB12 PB12 PD13 PD13 BACKLIGHT BACKLIGHT
STM32f407
STM32f407 SBR1A40S1 SBR1A40S1
GND
GND
SCL2 SCL2 136 136 87 87A12 A12
CONVERTER CONVERTER L2 L2
IN1
IN2
IN3
IN1
IN2
IN3
PB6 PB6 PG2 PG2
137 137 88 88A13 A13 9 11 10 12 9 711 10 12 7
PB7 PB7 PG3 PG3 C17 C1722uH 22uH
LCD_ON LCD_ON34 34 89 89A14 A14 R4 R14
R4 R14 R16 R16
PA0 PA0 PG4 PG4 2 12 1
D7 D7 63 63 90 90A15 A15
PE10 PE10 PG5 PG5 1u VIN1u SW
VIN SW
TOUCH TOUCH
1k
1k
1k
1k
1k
1k
D8 D8 64 64 91 BRTS
91 BRTS 3 3 LED+ LED+
PE11 PE11 PG6 PG6 OVP OVP CONTROLLER CONTROLLER
D9 D9 65 65 93 BLE_EN
93 BLE_EN 4 IC12
4 IC12
PE12 PE12 PG8 PG8 EN EN
D10 D10 66 66 96 BLE_TX
96 BLE_TX AP5724 AP5724 5 5 LED– LED–
PE13 PE13 PC6 PC6 R2 R2 FB FB
D11 D11 67 67 97 BLE_RX
97 BLE_RX R5 R5 +3V3 +3V3
PE14 PE14 PC7 PC7 GND GND C18 C18
10R
10R
10R
10R
PE15 PE15 PA9 PA9 6 6
R27
R28
R29
R30
R35
R36
R27
R28
R29
R30
R35
R36
D0 D0 85 85 102 SD_ON
102 SD_ON 100n
PD14 PD14 PA10 PA10 100n
D1 D1 86 86 103 DM
103 DM
PD15 PD15 PA11 PA11
1k
1k
1k
1k
1k
1k
1k
1k
1k
D14 D14 78 78 104 104DP BACKLIGHT
DP BACKLIGHT
PD9 PD9 PA12 PA12
D13 D13 77 77 105 SWDIO
105 SWDIO
PD8 PD8 PA13 PA13
R9
R9
SDA2 SDA2 140 140 109 SWCLK
109 SWCLK SD CARD SD CARD
PB9 PB9 PA14 PA14 BATT_BLE BATT_BLE
SCL SCL 69 69 110 MP3-DCS
110 MP3-DCS
0R
0R
PB10 PB10 PA15 PA15 Card SocketCard 4 K1Socket 4 K1
FPC2 FPC2 29 29 114 114D2 D2 2 2
PC3 PC3 PD0 PD0 VDD VDD
MP3-SCK MP3-SCK41 41 115 115D3 D3 VCC VCC SDIO_DO SDIO_DO 7 7
PA5 PA5 PD1 PD1 3 3 18 18 DATA_OUT DATA_OUT
1 1 117 CPU_ON
117 CPU_ON P2.2 IC2P2.2 P0.1IC2 P0.1 SDIO_CMD SDIO_CMD 3 3
PE2 PE2 PD3 PD3 4 4 17 BLE_TX17 BLE_TX DATA_IN DATA_IN
2 2 118 RDB
118 RDB P2.1 P0.2(RX)
P2.1 P0.2(RX) SDIO_CLK SDIO_CLK 5 5
PE3 PE3 PD4 PD4 BLE_RST 5
BLE_RST 5 16 BLE_RX 16 BLE_RX SCLK SCLK
3 3 119 WRB
119 WRB RST RSTP0.3(TX) P0.3(TX) SDIO_D3 SDIO_D3 2 2
PE4 PE4 PD5 PD5 6 6 15 BLE_INT15 BLE_INT CS CS
4 4 123 123 P2.0(EN) P0.4(BCTS)
P2.0(EN) P0.4(BCTS) SDIO_D1 SDIO_D1 8 8
PE5 PE5 PD7 PD7 DAT1 DAT1
SW3 SW3 5 5 124 CSB
124 CSB CC2540-BLE CC2540-BLE SDIO_D2 SDIO_D2 1 1
PE6 PE6 PG9 PG9 7 7 14 BRTS14 BRTS DAT2 DAT2
7 7 125 NE3
125 NE3 P1.7 P0.5(BRTS)
P1.7 P0.5(BRTS)
PC13 PC13 PG10 PG10 8 8 13 13 SD & MMC SD & MMC
8 8 127 127 USB+ USB+ P0.6 P0.6 CARD_DETECT CARD_DETECT CD1 CD1
TP14 TP14 PC14 PC14 PG12 PG12 9 9 12 12 CARD_DETECT CARD_DETECT
9 9 132 132 USB– USB– P0.7 P0.7 CD2 CD2
TP15 TP15 PC15 PC15 PG15 PG15 R18 10 R18 10 11 11 CARD_DETECT CARD_DETECT
A0 A0 10 10 133 133 P1.2 P1.2 P1.1 P1.1
PF0 PF0 PB3 PB3 GND VSS GND GND VSS GND
A1 A1 11 11 134 134 GND GND +3V3 +3V3
1k
1k
VCAP2
VCAP1
VCAP2
10 10 8 8
VSSA
VSSA
C1 C1 SETP SETP
1k
1k
VSS
VSS
VSS
VSS
VSS
VSS
VSS
VSS
VSS
VSS
VSS
VSS
PH0
PH1
PH0
PH1
23
24
71
31
38
51
61
83
94
23
24
71
31
107
120
130
106
107
120
130
106
16
16
C6 C1 C6 C1 C22 9
C22 11 9 11
TP4 TP4
1k
1k
OSC1
OSC2
OSC1
GND
1k
1k
Figure 2. Besides some resistors and capacitors, the schematic does not add much to the block diagram.
5 7 24 31
5 7 24 31
The SRAM IC10 was not originally
1 1
CRYSTAL, CRYSTAL, planned, but it eventually proved nec-
CVCCO
CVCCO
CVCCO
CVCCO
CVCCO
CVCCO
CVCCO
32 32 15 15 TURN ON TRANSISTOR
TURN ON TRANSISTOR
TEST TEST VCO VCO
AND VOLTAGE
ANDREGULATOR
VOLTAGE REGULATOR essary to handle the display in a com-
FOR MP3 DECODER
FOR MP3 DECODER
6 6 33 33
14
IOVCC0
14
IOVCC0 GPIO0
34
GPIO0
34
fortable way because the CPU’s internal
IOVCC1 IOVCC1 GPIO1 GPIO1
SUPPLY SUPPLY
19
IOVCC2
19
IOVCC2 GPIO2
9
GPIO2
9 RAM is not large enough to handle the
38 38 10 10
43
AVCC0
43
AVCC0 GPIO3
36
GPIO3
36 memory requirements of the STemWin
AVCC1 AVCC1 GPIO4 GPIO4
45
AVCC2
45
AVCC2 GPIO5
25
GPIO5
25
graphics library (see below). IC10 is used
11 11
GPIO6 GPIO6
MP3-RST MP3-RST 3
RESET
3
RESET GPIO7
12
GPIO7
12 as a screen buffer for the LCD. All screen
MP3-CS MP3-CS 23
CS
23 IC14
CS IC14 4 modifications are applied to the buffer
4
MP3-DCS MP3-DCS 13 13 GND0 GND0
DCS DCS 16 16
MP3-SCK MP3-SCK 28
SCLK
28
SCLK
GND1
20
GND1
20
held in this memory before it is trans-
MP3-MOSI MP3-MOSI 29 29 GND2 GND2
MP3-MISO MP3-MISO 30
SI
30
SI
GND3
21
GND3
21 ferred to the display’s buffer. Notice that
SO SO 22 22
MP3-DREQ MP3-DREQ 8
DREQ
8
DREQ
GND4
35
GND4
35
this memory is not as fast as the micro’s
GND5 GND5
K3 K3
46 46 37 37 built-in RAM, and it is good practice to
LEFT LEFT AGND0 AGND0
39
RIGHT
39
RIGHT AGND1
40
AGND1
40
keep all the allocated stacks (FreeRTOS
41 41
VS1053 VS1053
AGND2 AGND2
42
GBUF
42
GBUF AGND3
47
AGND3
47 memory, etc.) in internal memory to
R33 R41 R33 R42 R41
1 1
R42 26
RX
26
RX
make the CPU work as fast as possible.
MIC+/LINE1 MIC+/LINE1 27 27
TX TX The external SRAM is connected to the
1M
1M
1M
1M
1M
1M
2 2
MIC– MIC– C12 C12
48 48 44 44
C15 C13 C15 C14 C13 LINE2
C14 LINE2 RCAP RCAP
same bus as the LCD and is controlled
XTALO XTALI
XTALO XTALI 100n 100n
47n 10n 47n 10n 10n 10n 17 18
17 18 by the CPU’s flexible static memory con-
R15 R15
SUPPLY SUPPLY
1M 1M troller (FSMC).
T1 T1 +4V1 +4V1 +4V1 +4V1
C5 X1 C5 3 X1 3 C4 C4
R6
0R
R6
0R
The second external memory is the
OUT OUT
22p 22p TRI 1 TRI 22p
1 22p
non-volatile SD card (K1). I opted for
R26 R26 +3V3 +3V3
R3 +3V3
R3 +3V3
BSS84 BSS84
0R 0R
an SD card because you can remove it
4k7
4k7
+3V3 +3V3 R1 R1
easily and connect it to a computer or
16.288 MHz 16.288 MHz
MP3_ON MP3_ON VDD GND VDD GND 0R 0R
smartphone to upload a new image or
4 2 4 2
text file. This part is a leftover from the
+3V3 +3V3
first versions of the cheat watches. At the
BATT BATT time I didn’t know how to upload cheat
VCC VCC
BATT_BLE BATT_BLE
VBAT VBAT XI XI
R31 R32 R31 R32 sheets to my watch other than by using
R12 R13 R12 R13 IC9 IC9 X3 X3
an SD card. It is connected through a
4k7
4k7
WDI
4k7
4k7
WDI
13 8 13
8
C23 C23
4k7
4k7
AF
4k7
4k7
AF
EXTI EXTI XO 32.768 kHz
XO 32.768 kHz
SDA2 24
SDA2
VDD
24
VLOGIC
VDD
20
2n2
VLOGIC
20
2n2 fast SDIO bus which allows reading and
SDA SDA SDA SDACPOUT CPOUT
SDA SDA R7 R7 SCL2 23
SCL2 23IC8 IC8 writing files much faster than over SPI.
SCL SCL BATT_BLE BATT_BLE SCL SCL
SCL AB0805 AB0805
SCL NTIRQ 1k
NTIRQ 1k MPU_INT 12
MPU_INT 12 10 10
INT INTREGOUT REGOUT
CLKOUT CLKOUT
R8 R8 1 1
RTC_INT RTC_INT CLKIN CLKOUT
CLKIN C2
CLKOUT C2
FOUT NIRQ2
FOUT 1k
NIRQ2 1k 100n 100n
GND GND MPU-6050 MPU-6050
6 6 7 7
AUX_DA AUX_CL
AUX_DA AUX_CL
R34 R34
11 11 9 9
RTC_INT_OUTRTC_INT_OUT FSYNC FSYNCAD0 1kAD0 1k
T2 T2 GND GND
18 18
R10 R10
RTC_INT RTC_INT
4k7 4k7
RTC CLOCKRTC CLOCK
BATT_BLE BATT_BLE BSS84 BSS84 WITH WITH GYROSCOPE AND ACCELEROMETER
GYROSCOPE AND ACCELEROMETER
INTERRUPTINTERRUPT
TRANSISTOR
TRANSISTOR
+4V1 +4V1
VOLTAGE DIVIDER
VOLTAGE DIVIDER Figure 3. The Nokia 6300 display is still
TP13 TP13 R39 R39 available on the Internet.
Li-Ion Li-Ion
1k
1k
3k3
SHDN LX
SHDN LX
4uH7 4uH7 BSS123 BSS123
D3 D3
GND GND
C8 BAT_ADC
C8 BAT_ADC
letter ’n’ in ‘nWatch’, as it was scavenged
RTC_INT_OUTRTC_INT_OUT 4x 4x 2 2
SBR1A40S1SBR1A40S1
R25 R25 from an old Nokia 6300 mobile phone
D4 D4 1u 1u
BLE_INT_OUTBLE_INT_OUT (Figure 3). Having picked this display
4k7
4k7
CPU_ON
R37
CPU_ON
1k
R37
was no accident. It is quite easy to con-
1k
160326 - 11 160326 - 11
trol as it uses an 8-bit parallel bus; it is
cheap (less than $5); and it has a con-
nector that is not unthinkable for use
by an amateur. Furthermore, it has the
right size. It is small enough for a watch
lar heights on the same side of the PCB. version and see where you went wrong The watch looks best when printed with a
If you mix them on bottom and top, the when you try to assemble everything. low layer height, meaning that the verti-
tallest part on each side determine the You are probably going to need at least cal step size should be really small. With
overall PCB height. A Li Po battery is three or four iterations to get it right. a 0.2 mm z-axis step size I obtained sat-
also a problematic part. If you can, it is Deciding to build a watch does not isfying results. My Prusa Mendel Itera-
the best to put it in a milled slot in the make things any easier as they tend to tion 2 (I2) 3D printer proved to have a
PCB. When this is not possible due to be rather small and thin. It starts by good-enough resolution and stability to
the small board surface a possible solu- drawing a rough, overall shape for the print a pretty nice case, showing that
tion is to make an area with only really watch, while keeping in mind the sizes most 3D printers will be suitable for the
flat components like resistors, etc. In my of the PCB, the Li Po battery and the LCD job as the parts are rather easy to print.
case I had no choice but to put the SRAM with touch panel. Then you measure, try,
memory under the battery (Figure 5). curse and iterate until it all fits. Building your own nWatch
It was the best compromise because it The parts that make up the nWatch case 1. Get all the parts
is only 1 mm thick. Other elements, like were designed in Solid Edge (Figure 6). Start by collecting the components, and
the 3.5 mm jack connector or the USB Initially, the idea was to make the case preferably with the hard-to-get compo-
socket, may be “mid” mounted, mean- at least splash-proof, but it turned out to nents. That way you quickly know where
ing that they are hanging in a cut-out in be too hard to make all the connectors you stand. Apart from the touch panel,
the PCB. Doing so keeps the height of waterproof (especially the SD card slot). which is probably the trickiest part of
the board within bounds. I had a few other ideas but eventually the nWatch, there are a few other com-
decided to make a two-part enclosure, ponents that may give you a hard time
3D printed parts held together by four tiny screws. This is finding them. The “mid-mount” 3.5-mm
3D printing is easy, the hard part is cre- a good solution, because after removing audio jack connector is such a part. I
ating the 3D models of your design. Not the screws we have an easy access to recovered it from an old tablet or smart-
only does it have to look nice, especially the main board, the Li Po battery, and phone of which the exact model and ref-
when you are designing a wristwatch, the LCD with its touch panel. erence elude me, used it in my prototype,
but the circuit board with all its parts The watch case has two rectangle slots and then wasn’t able to find a drop-in
has to fit in it too. Unfortunately, I have for the buttons. The wake-up button is replacement on the Internet. Those you
not discovered a magical solution to this the biggest, so it is easy to press it and can find either have a slightly different
problem, it still boils down to precisely is placed above the watch band mount. footprint, an incompatible plastic cover
measuring everything, 3D print a first The buttons are 3D printed as well. or both. However, it is possible to adjust
Figure 7. Several board iterations were needed before arriving at the final design of the nWatch.
as trial versions. Configuring Eclipse for cable with a 3-pin, 2 mm female connec- watch rather complicated). Solving all
the nWatch all by yourself might cause tor and you are ready to go. the problems encountered during devel-
headaches and may discourage you. opment of the watch taught me many
Android app things. Now I appreciate how much time
In-circuit programming Even though I’m not much of a Java pro- and effort is needed to build a device
I highly recommend investing in a cheap grammer, I decided to write a simple like this. I also learned that teamwork
ST-Link programmer. You will see that app to send data to the watch from a is a really good thing as I wasn’t able to
not only is it much more comfortable to smartphone. I found an example of a make every part of this project perfect
use compared to the USB bootloader, it Bluetooth low energy app and modified myself. However, I think the outcome is
also allows you to debug the code you it so that I could read the time and date quite interesting.
wrote. Being part of STM Discovery and from the phone and wirelessly send it to With this article I wanted to show that
Nucleo boards (that are often handed out the watch (Figure 10 & Figure 11). It everyone can build a device like this
for free at trade shows), make it the best is really comfortable, because there is no watch. It is not that hard after all and,
candidate. All you have to do is make a need to write a special app for the watch. in my opinion, it is the easiest way of
When you launch the app on the smart- learning something new. I hope you
phone it will look for an nWatch nearby, enjoyed reading the article as much as
and when it finds one just tap the send I did building the nWatch.
button to set the time and date. The (160326)
next version of the app should update
the watch without any user intervention. Web Link
[1] www.elektormagazine.com/160326
Conclusion
I think I managed to achieve my initial
objectives. The device I built was a great
learning experience that connected of
many skills like programming, electron-
from the store
ª160326-1
Figure 11. The Android app does not (yet) have ics, mechanics, and 3D design and print-
Unpopulated nWatch PCB
fancy graphics, but it allows you to set the ing. It was made of low-cost parts, some
nWatch time and date by a tap on the ‘Send of them scavenged from old cellphones
Data’ button. (unfortunately making reproducing the
Arduino Create
Although it has not stirred up
a lot of dust yet, the popular
Arduino platform is evolving in knows only one board). The diffe
a rather spectacular way. Ove rence with those platforms
the past months the people r is that Arduino Create can, like
at Arduino have been quietly Codebender could, program
running a background task with the board itself without the user
the objective to develop a having to manually copy a
full-fledged cloud-based onlin file to a disk. To make this wor
e development platform calle k, a piece of software giving
Arduino Create. It is an ambitiou d the browser access to the boar
s project, taking the concept d has to be installed first, so it
of the now defunct Codebender is not completely hassle-free,
a step further, up to the prefab but once that part properly in
BBC micro:bit level. Regular visit place the rest is automatic.
ors of the Arduino.cc website
have had access to this platform The second objective is to mak
almost from the beginning, e the development of IoT appli-
but its presence was not adve cations as easy as possible by
rtised too much. providing low-threshold cloud
services for free. Again, this
Arduino Create currently has is very much like mbed, but
two accessible to non-specialists.
Traditional Arduino aficionados
can continue
using the off-line IDE they got
to know so well.
However, when downloading a
new version from
the website they will notice that
Arduino Create
is being ‘pushed’ as the preferre
d way to go.
We look forward to what the
future will bring.
Arduino OS maybe?
(160404-a)
main
goa ls. The first is to com -
pletely remove the hassle of
inst allin g boa rds, tool s and
libraries. The Arduino Create
user logs into his/her account,
connects a compatible board
to
the computer and starts coding
— it should be that simple. The
board is recognized by the onlin
e
IDE, all the libraries published
in
the Arduino repository are avai
l-
able without inst alling, the
IDE
is always up to date, etc. This
is
very much like ARM’s mbed (wit
h-
out the programmer’s jargon) or
the
BBC micro:bit environment (wh
ich
Weird components
The LM0901A1411090451C Polish operational amplifier is a macro-power, low performance, degraded cir-
cuit operational amplifier designed to have a no-load power dissipation of less than 0.553 W at Vs = ±1 pV and less than 200 W
at Vs = ±2 pV. Open loop gain is greater than 0.001k and input bias current is typically 200 A.
© March 1878, Nominal Semidestructor Corporation
https://goo.gl/jFf75N
(160404-c)
Want to participate? Please send your comments, suggestions, tips and tricks to labs@elektor.com
Get 5 V from
One Exhausted Alkaline Cell
Juice it to the max
Every day we throw away tons of supposedly empty 1.5-volt alkaline (“dry”) cells. Triggered by the waste
caused by my battery-powered equipment failing to work with partially discharged cells, I designed a circuit
to step up the voltage of one exhausted cell to around 5 V for use in another application. Say, to make an
LED light, keep a lightweight microcontroller buzzing, or power remote sensors that do not demand much
energy… Until that battery, like The Parrot, is dead.
150p K1
C4 C2 1 The 1N5817 is a 1-amp Schottky (i.e.
1N4732A 2 5V
33u 2N3906 T2 220u low-dropout) rectifier diode. Do not use
25V T4 25V
1V5 R1 a regular silicon 1N400x in this position
10R
as it will waste output voltage.
R4 2x R2
2N3904
2N3904 C3 Interestingly, you can power the circuit
copyright
with a higher voltage without exceeding
1k
6k8
100n
the output voltage and the load coming
E C
to grief — the network that regulates the
150724 - 11 B
output voltage will stop the oscillation.
All within limits of course.
Figure 1. An experimental 5-V step-up converter for exhausted 1.5-volt batteries. (150724)
In order to test salvaged vacuum tubes, the author required a tube tester. Because a ‘real’ tester
like the Tek 570 was an unattainable ideal, he decided to build one himself — based on a modern
microcontroller. The version presented here can measure the cathode current as a function of either
anode voltage or grid voltage.
+5V
IC2 LCD1
+18V 7805T L1
10uH
C5 C6 GR-LCD-100x48 C7 C8 R12
C2 C1
DATA/CMD
10k
ENABLE
LED
R/W
D7
D6
D5
D4
D3
D2
D1
D0
1M
47k
10 30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 R16
VCC AVCC +5V +18V
38 40
2k7
PA2(ADC2) PA0(ADC0) R4
37 39
PA3(ADC3) PA1(ADC1)
56k
36 2W
PA4(ADC4) 8 T2
copyright 35
PA5(ADC5)
IC1 PD7(OC2)
21
IC4
34 20
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
PA6(ADC6) PD6(ICP1) 4
33
+5V PA7(ADC7) TIP50
29 PC7
PC7(TOSC2)
ICP 5 28 PC6 +5V 3 DUT
PB4(SS) PC6(TOSC1) 3 –18V T1
1 MOSI 6 27 PC5
PB5(MOSI) PC5(TDI) C3 C4 1
2 MISO 7 26 PC4 IC4.A 5
PB6(MISO) PC4(TDO) 2
3 SCK 8 25 PC3
PB7(SCK) PC3(TMS) 10u 100n MPSA42
4 24 PC2 8
PC2(TCK) R13 R2
5 RST 9 ATMEGA32-P 23 PC1 15 7 6 R7
RST PC1(SDA) 10k 15k
6 19 22 PC0 PC7 1 VDD 16 R3 R1
REFIN
1k
3k3
PD4(OC1B) DB6
17 1 PC5 3 IC3 12 R15
PD3(INT1) PB0(XCK/T0) DB5 PD
16 2 PC4 4 19
39k
10 13 7
X1 WR LDAC IC4.B
C9 11 9 6 D1
A/B CS R8 R5
DGND AGND
2x
100R
100n
10k
20 17 R9 R14 D2
RESET 16MHz 1N4007
39k 1k
160356 - 11
Design D1 adjustable
+32V R6 L1 BYV27-600 55 – 400V
The circuit has been designed such that 0R22
47uH
two types of measurement are possible: 0W5 R3 R5
C1
- varying the grid voltage with several
100k
1M8
6 7 8
different fixed values of anode voltage; 220u
VCC IS DC 2W
- varying the anode voltage with several T1
1
SWC D2
different fixed values of grid voltage. C5 C2 IC1 2
SWE
This is seamlessly controlled using a 100u MC34063AP
100n 1N4148
IRF740
microcontroller and for the user inter- 5
FB TC
3 T2
C6
face serves a small LC Display with a
GND 47u
set of four pushbuttons. The software 4 C3
R1
BC
R2
400V
has been designed in such a way that it 557B
6k2
10k
470p
is also possible to display the measured
characteristics on the display instead of
on the display of an external oscilloscope. R4 P1 P2
6k2
The Neptronix 570 is and remains built
C4 100k 10k 160356 - 12
on a breadboard; no circuit board has
been designed for it. 100n
copyright
Birds-eye view of the schematic
The schematic for the tracer is drawn in
Figure 3. On the left is drawn the outline
Figure 4. The high-voltage power supply; the input voltage of 32 V is supplied from an old printer
of IC1, the microcontroller — an ATMe-
power supply.
ga32-P. This µC was selected because
it has a large number of I/O lines, is
available in a DIP package for not much
money, and because the author had a
couple on hand.
To the left of IC1 we see the ICP pro-
gramming connection and the four push-
buttons for the user interface (and also
the reset button). The 8-bit wide data
bus from the µC goes in one direction to
the LC Display (LCD1) and in the other
direction to a dual-channel D/A-converter
(IC3). This provides the control voltages
for the different drive voltages for the
tube that is to be tested.
voltage is (much) lower, then it can be ler. To compensate for the voltage drop
difficult to obtain a sufficiently high out- across R5, voltage divider R7/R15/R8
put voltage. In that case a voltage-dou- applies one-fifth part of the cathode volt-
bler could offer a solution. age to the non-inverting input of IC4.B.
Figure 5 gives an impression of the vac-
A few details uum tube tracer/tester during the devel-
The (dual-channel) D/A-converter IC2 opment phase.
(an AD7302) is unfortunately not (at
an acceptable price, at least) available User interface
Figure 9. The Output tab.
in a DIP package. The author therefore The LC Display, together with four push-
mounted the SMD version of this IC on buttons (up, down, left, right), are used
an adapter board, so that it would still for operating the vacuum tube tester. The
be possible to built the tube tester on a display shows a series of tabs in which
breadboard without any difficulties. different settings can be made. Navigat-
The anode voltage of the tube to be ing between the different tabs is accom-
tested amounts to maximum of around plished with the left and right pushbut-
320 V. For this purpose, opamp IC4.A tons; the corresponding tab is opened
multiplies the voltage at the output A of using the down pushbutton. Now the left
the DAC (0 to 5 V) by 3.5. Subsequently, and right buttons can be used to change
T1 multiplies this voltage again with a the settings within that tab. Below is a
ratio of 17. Transistor T2 ensures that brief description of the implemented tabs.
sufficient current is also available.
Figure 10. The Run tab.
When we only want to vary the anode Start (N)
voltage (‘sweeping’), then it is not nec- On the start screen (Figure 6) the selec-
essary to know the exact amount of gain tion can be made between the two oper-
from IC4.A and T1. There is, however, ating modes:
also a ‘reversed’ operating mode imple- varying the grid voltage with different
mented (variation of the grid voltage for values of anode voltage (step plate/
different fixed values of anode voltage) anode, sweep grid) or
and for this the anode voltage needs to varying the anode voltage with different
be exactly regulated to known voltages. values of grid voltage (step grid, sweep
For this reason, the voltage divider built plate/anode).
from R11, R12 and R16 is used to feed The right button advances to the next
back one-eightieth part of the anode volt- tab.
age to A/D-input ADC0 of the microcon-
Figure 11. The calibration screen. troller. In this way the controller can cal- Anode (A)
ibrate the anode voltage. In this tab (Figure 7) the minimum and
The other output of the DAC goes to maximum anode voltage and the step
opamp IC4.B. Because the grid voltage size of anode voltage are set. Up/down
needs to be negative, this opamp con- are used to navigate to a particular value,
verts the 0 to 5 V from output B of the after which it can be changed using left/
DAC into a range of 0 to -18 V. Diodes right. The step voltage is used when in
D1 and D2 protect the circuit from volt- the Start tab the selected mode is step
ages that are too high. plate, sweep grid. This value deter-
To measure the cathode current, a resis- mines the amount that the minimum
tor R5 (100 Ω) is inserted between the and maximum voltages are increased
cathode and ground. The voltage drop or decreased.
across R5 goes via R6 to the second
Figure 12. Calculation of the transconductance. A/D-input (ADC1) of the microcontrol- Grid (G)
Run (R)
Push the down button on the tab (Figure 10) to start the mea-
surement process. When the output is selected to go to the LC
Display, the results will appear here. The sweep-parameter is
displayed on the horizontal axis.
Transconductance (T)
In this tab (Figure 12) the transconductance S can be mea-
sured. This works as follows: first the anode voltage is set to
the maximum value (anode tab). The grid voltage is also set
to the maximum value (grid tab). Now the current I1 is mea-
sured. Subsequently, the grid voltage is lowered by one step
value and the current I2 is measured. The transconductance
then follows from:
• firmware: AT I 3<Enter>
• revision: AT I 0<Enter>
See the ‘eBoB BL600 (2)’ (www.elektormagazine.com/150014) article for further information on the firmware.
FEEDBACK. The Live and Neutral connections are important when a single-pole switch is used to switch equipment on and off.
One example I have noticed, with fluorescent tubes. The ballast is a sort of auto-transformer wired in series with the
filaments at either end of the tube. When the on/off switch is in the Neutral wire the filament is at AC mains potential
even when switched off and this voltage is sometimes sufficient to cause a low-level glow discharge in the gas around
the filament to the earthed fitting. With the switch in the Live wire, the filament will be at AC neutral potential which is
much closer to earth and no discharge or glow is visible.
Lothar Freißmann, Germany
FEEDBACK. The problem is probably caused by electrolysis. There is always some DC component on the (AC) power
line and this causes deposits to form on electrodes which can be remedied to a certain extent by grounding the device.
Reversing the plug reverses this effect; but deposits will then be formed on the other electrode in the heater.
I have a similar problem here in Canada, namely a buildup of lime scale in my instantaneous water heater. Running
a solution of vinegar through the pipe work for a couple of hours is effective in removing the lime scale. To make the
FEEDBACK. Looking through the handbook for my old gas hot water boiler ‘Calenta’ made by the company Remeha
‘mains phase reversal detection’ is an option that can be enabled in the setup menu (parameter #43). In some
countries the mains plug design allows it to be inserted in one of two ways only so that the Live and Neutral con-
nection become swapped when the plug is inserted ‘upside down’. Well naturally I had to try this menu option
out. The default factory setting is with this phase detection disabled. With this option enabled I swapped the Live
and Neutral wires and sure enough, on switch on it produced the error code SU9 ‘mains plug incorrectly wired’.
In the boiler combustion chamber the igniter electrode produces a spark to start the gas burning and after ignition it is
fed with a high voltage producing ionizing current which is measured to check the combustion conditions are within safe
limits. The handbook states that this ionization current should be less than 3 µA. Replacement electrodes are included
in many of the standard service kits for the boiler. The high voltage is produced by a step-up switching regulator which
could possibly generate faults if the Live and Neutral wires are swapped. Measuring such low levels of current with a
worn and dirty electrode will also eventually lead to unreliable operation.
Peter van de Meerendonk, The Netherlands
1k
L14 NM C37 IC14 IC13 IC12 IC11
R21
1k T2 TPS79633DCQ +3V3 TPS79625DCQG4 +2V5D TPS73018DBVT +1V8 LP3891EMR-1.2/NOPB +1V2
K3 R23 K10
MIC C33 C36 22n 2 4 2 4 1 5 7 1
+3V3 +1V8 +3V3 IN OUT IN OUT IN OUT VIN VOUT
47k
5V DC C105 C104 6 2
L15 S/D VOUT
NM R22 1n C38 3
C99 C97 C96 C94 C93 C91 C90 VBIAS C89
EN
GND
GND
NR/FB
EN
GND
GND
NR/FB
EN
GND
NR
100n 47u
chip schematic!
copyright
1k C39 C40 C41 C42 C106 C43 R53
R20 0 16V GND GND PAD
1
3
6
5
1
3
6
5
3
2
4
C35 22n
4
5
9
1u 2u2 1u 2u2 1u 2u2 47u 47u
10k
C98 C95 C92
1k
1u 1u 1u 100n 100n 47u 16V 16V
16V
NM
100n 100n 100n
42
33
5
15
12
C31
AVDD
DVDD
L12 10p 35 30 C100 C101 C108 C109 C110
IOVDD
AVDD1
AVDD2
DRVDD 27
LSP K2 MICI+ CIDI-
C30 34 14
MICI- FSD
28 2u2 2u2 47u 47u 47u
SPKO- 16V 16V 16V
L13 10p 26
SPKO+ 48 +1V2
C32 37 NC +3V3 +2V5D +3V3 +2V5D
LCDAC 8
38 NC
HNSO-
10p 39 23 C65 C66 C67 C68 C69 C70 C71 C72 C102 C107
HNSO+ RESET C53 C54 C55 C56 C57 C58 C59 C60 C61 C62 C63 C64 +5V
40 22
K4 HNSI- MCLK
L31 41 IC3 21 2u2 100n 2u2 100n 2u2 100n 2u2 100n 47u 47u
HNSI+ M/S +3V3 100n 100n 100n 100n 100n 100n 100n 100n 100n 100n 100n 100n 16V 16V R41
1 2 L32 44 TLV320AIC20KIPFB 20 +3V3
LINEI+ SCLK
1k
3
7
8
7 8 L35 47 17
LINEO+ DOUT LED3
17
26
40
47
56
62
81
93
117
122
130
139
5
29
45
61
78
102
116
134
9 10 L36 1 11 100n
HDSI- SCL 100n 100n C82
VCC
VCC
VCC
L37 2 10 5 100n
HDSI+ SDA ASDI Power
L38 3 9 1 1
16
22
42
47
VCCIO1
VCCIO2
VCCIO3
VCCIO3
VCCIO4
VCCIO4
VCCIO5
VCCIO6
VCCIO7
VCCIO7
VCCIO8
VCCIO8
VCCINT
VCCINT
VCCINT
VCCINT
VCCINT
VCCINT
VCCINT
VCCINT
HDSO- PWRDN nCS IO
L39 4 6 2 144 48
www.elektormagazine.com
HDSO+ DCLK IO IO, DIFFIO_T1p, (DM1T) MODE AVDD
2 3 143 1 23
GSET
DVDD
DVDD
DATA IO IO, DIFFIO_T1n, (DQ1T) DA13 DB13
VSS
AVSS
AVSS1
AVSS2
IOVSS
TESTP
DVSS
DRVSS2
DRVSS1
R24 6 142 2 24
GND IO, DIFFIO_L1n, (DATA1,ASDO) IO, DIFFIO_T2p, (DQS1T/CQ1T#,DPCLK7) DA12 DB12
6
7
24
43
32
13
16
29
25
7 141 3 25
4
IO, VREFB1N0 IO, DIFFIO_T5p DA11 DB11
27R
+5V +2V5D 8 138 4 26
IO, DIFFIO_L2p, (FLASH_nCE,nCSO) IO, (DATA6) DA10 DB10
L6 R18 10 137 5 27
IO, DIFFIO_L4p, (DQS0L/CQ1L,DPCLK0) IO, (DATA5), (DQ1T) DA9 DB9
10R 11 136 6 IC6 28
C22 IO, DIFFIO_L4n IO, VREFB8N0 DA8 DB8
L1 L2 L3 L4 R17 L7 L8 L9 L10 L11 12 135 7 29
M25P40-VMN6PB DCLK IO, DIFFIO_T8n, (DQ1T) DA7 DB7
C103 C16 100n 13 133 8 30
IO, (DATA0) IO, DIFFIO_T10p, (DATA3), (DQ1T) DA6 DB6
10R
28 132 9 31
IO, DIFFIO_L6n IO, DIFFIO_T10n, (DATA2), (DQ1T) DA5 DB5
47u 100n 30 129 10 32
16V C21 IO, DIFFIO_L8p, (DQS1L/CQ1L#,DPCLK1) IO, DIFFIO_T11p DA4 DB4
C17 C18 C19 C20 L5 C23 C24 C25 C26 C27 C28 C29 31 128 11 33
IO, VREFB2N0 IO, DIFFIO_T11n DA3 DB3
32 127 12 34 R49
10n IO, RUP1 IO, DIFFIO_T12p DA2 DB2
100n 100n 100n 100n 100n 10u 100n 10u 100n 100n 100n 33 126 13 35 L26..L29 = 0805CS-181XGLB
15nH IO, RDN1 IO, DIFFIO_T12n DA1 DB1
100R
27
12
33
6
41
44
38 124 46 1 TR1 4 C83 C84 C85 1
IO, DIFFIO_B1p IO, DIFFIO_T13p IOUTA1
14 39 121 19 R42 2 180nH 180nH
2
DVDD
15 42 120 20 3 6 DAC A
AVDD2
AVDD4
AVDD1
AVDD1
VDRIVE
AVDD2 IO, (DQS1B/CQ1B#,DPCLK2) IO, DIFFIO_T16n, (DQ1T) WRTB/SELECTIQ
IC1 = OPA2374AIDG4 4 63 43 119 18 45 R50 120p 180p 120p
AVDD2 VDRIVE IO, PLL1_CLKOUTp IO, VREFB7N0 CLKA/CLKIQ IOUTA2 100R
24 61 44 115 17 39 K9
5 AVDD3 DB0 IO, PLL1_CLKOUTn IO, RDN4, (DQ1T) WRTA/WRTIQ IOUTB1 100R L28 L29
+2V5A 60 46 114 R51 6 C86 C87 C88 1
7 R12 DB1 IO, VREFB3N0 IO, RUP4, (DQ1T)
3
NM
1k
NM DB5 IO, DIFFIO_B11p BIASJ_A
C1 R1 R3 C7 R8 27p 55 53 110 41 R52 R40 C79
20 DB6 IO, DIFFIO_B11n IO, DIFFIO_T20p, (DQS0T/CQ1T,DPCLK6) BIASJ_B
DGND
DGND
AGND
C9
100R
100n
15
21
38
1k
NM 27p 48 64 100 R56 GPIO4
DB12 IO IO 100R
21 47 65 99 R57 GPIO3
2 VOUTA- DB13 IO, VREFB4N0 IO, DIFFIO_R4p, (CRC_ERROR) 100R
26 46 66 98 R58 GPIO2
+5V 1 18R VIN- DB14 IO, RUP2, (DQ1B) IO, DIFFIO_R4n, (INIT_DONE) 100R
IC1A R13 45 67 15 L22 PTT/GPIO1
3 DB15 IO, RDN2, (DQ1B) TDI
R7 +2V5A 40 68 20 L23
R15 R14 CS IO, DIFFIO_B20n, (DQS0B/CQ1B,DPCLK3) TDO KEY/GPIO0
10 39 69 16 L24 SCL/RxD
+2V5D 100R 10R VREF+ RD/WR IO TCK
330R
C12 38 70 18 L25 SDA/TxD
C13 DRDY IO, DIFFIO_B21p TMS +3V3
47u 37 71 94
16V RESET IO, DIFFIO_B21n MSEL0
R5 10n 9 36 72 96
REFGND SYNC IO, DIFFIO_B22p MSEL1
8 3 73 97 R34 R35 R36 R37 R38 R39
DECAPA MCLK C45 IO MSEL2
10k
+2V5A R25
30 2 74 21 +3V3
1k
1k
1k
C6 K6
17 65 +3V3 75
IC1 RBIAS EP 100p IO
3
100n R6 C14 C15 R16 76 92 1 2
4 4 2 IO, RUP3 CONF_DONE
C5 +5V 77 14 3 4
5
IO, RDN3 nCONFIG
160k
DGND
DGND
DGND
DGND
DGND
DGND
DGND
AGND1
AGND1
AGND2
AGND2
AGND2
AGND2
AGND2
AGND3
AGND3
AGND3
AGND3
AGND4
100n 33p
10k
IC8 L16 80 9 5 6
IO, VREFB5N0 nSTATUS
1
7
5
100n
35
42
43
53
62
64
34
13
16
18
28
23
29
31
32
11
100k 83 7 8
C46 IO 88 R44
R26 84 CLK7, DIFFCLK_3n 10k 9 10
100n IO, DIFFIO_R8n 89 R45
85 CLK6, DIFFCLK_3p 10k
IC8, IC9, IC10 = 74AHC1GU04W5-7 PMV65XP IO, DIFFIO_R8p, (DQS1R/CQ1R#,DPCLK4) 90 R46
T1 86 CLK5, DIFFCLK_2n 10k
IO, DIFFIO_R7n, (DEV_OE) 91 R47 +2V5D JTAG
R28 87 CLK4, DIFFCLK_2p 10k
R27 L17 IO, DIFFIO_R7p, (DEV_CLRn)
10k 35 L18
VCCA1
NM
23 107 L19
4
IC7 CLK1, DIFFCLK_0n VCCA2
5
+1V2
C49 R29 24 37 L20
P1 1 Vdd 3 2 4 CLK2, DIFFCLK_1p VCCD_PLL1
Vc 27R 25 109 L21
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
PAD
GNDA2
GNDA1
100p
4
2
10k 100n 100n 100n
100n 100n 100n 100n 100n 100n
ASVTX-09-20.000MHZ-T 150177 - 18
R30 +3V3
L40
10k R32 R33 R48
JP1 JP2 JP3
Ext. clock
10k
5
330R
330R
K5 C51 R31
1 2 4
27R
C52 LED1 LED2
2
3
100p
IC10
100n
Figure 2. If you manage to look through the mist of passive filters, decoupling capacitors, data buses and supply lines, what remains is basically a four-
312.5 kHz (see below) with the help of
a second LO signal provided by DAC B.
The second IF signal is digitized by the LPF 32 LPF
signals bandlimited
cos
to 1.6 kHz
Audio Audio
OSC
address ROM data
sinetable
1.7 kHz
sin
Q
Q 150177 - 16
150177 - 14
150177 - 15
Figure 5. AM signal demodulation. Figure 6. SSB and CW signal demodulation. Figure 7. The basic operating principle of DDS.
The block with the sigma symbol in it is the
phase accumulator.
The next step is to lowpass-filter the two using the Pythagorean theorem for two interface. The audio CODEC provides pro-
signals once more. This time the cutoff orthogonal vectors: √(I2+Q2), see Fig- grammable gain and can drive a speaker
frequencies are adjustable in order to ure 5. For SSB (and CW) demodulation or headphone directly.
match the selected mode of operation. is unfortunately a bit more complicated. The local oscillator (LO) signals at the
For AM, their cutoff frequencies are at In this design Weaver’s method was used outputs of the two DACs are produced
5 kHz for 10 kHz of information band- [2][3]. The main idea (Figure 6) is to by two Direct Digital Synthesis (DDS)
width. For SSB (Single-Side Band) tele- split the signal bandwidth in two and mix blocks inside the FPGA. Such a synthe-
phony, they are set to around 1.6 kHz again with a locally generated low fre- sizer consists of a so-called phase accu-
(3.2 kHz bandwidth), and for narrow quency quadrature signal in the middle of mulator register whose value is increased
band CW (Continuous Wave; Morse code) the band. Choosing between Upper Side by a fixed amount at every clock cycle of
they filter at only a few hundred hertz. Band (USB) or Lower Side Band (LSB) is the 120-MHz DAC clock (which is derived
Two times 24-bit resolution still yields then just a matter of sign manipulation from the internal PLL of the FPGA), thus
a lot of data to process. To extract the in the final adder. the increase determines the frequency.
information of interest, i.e. to demodu- The demodulated audio finally passes a The accumulated value is used as an
late, we do not need all these bits. The lowpass filter to remove any high-fre- address into a sine table; the value found
task of the next block, the Automatic quency components caused by distortion at that address is sent to the DAC (Fig-
Gain Control (AGC), therefore is to con- in the AGC or demodulator. It is then res- ure 7). The frequency word for DAC A,
tinuously monitor the signal strength and ampled to match the sampling rate of the which forms the tunable LO, is 25-bits
scale the signal so as to output only two audio CODEC and wide. This corresponds to a frequency
10-bit streams that can be demodulated. sent to the latter step of 120 × 106 / 225 = 3.57 Hz. In
The AGC block also outputs the Received over a standard addition, there is a fine-tune mechanism,
Signal Strength Indication (RSSI). serial implemented with fractional values, giv-
Next is the demodulator. For PCM ing a final resolution of 0.44 Hz.
AM signal demodulation For the second LO, which is a fixed fre-
this amounts to the quency for conversion between the first
extraction of the IF and the second, the corresponding
amplitude by DDS is implemented with a lower reso-
lution to save FPGA resources — it has
a precision of about 38 Hz.
FPGA programming
The compiled firmware for this project
is available as a ‘JTAG indirect configu-
ration’ file (trx.jic) that first configures
the FPGA as a bridge and then programs
the configuration memory through the
FPGA. This is done with the aid of a USB
Blaster adapter that connects to a PC
over USB to form a JTAG interface to the
board. Such adapters can be found for lit-
tle money on popular shopping websites.
The software to use at the PC side is
known as Quartus Lite and can be freely
downloaded from the Intel/Altera web-
site. If the complete development envi-
Conclusion
The project presented in this article is a
powerful building block for radio ama-
teurs and experimenters who want to
Figure 8. The prototype built by the author doing USB at 144 MHz. build their own radios without compro-
mising on performance. At the same time
it is hoped that this project will inspire
the more digitally oriented readers to
Web Links dive into the world of radio and signal
[1] www.elektormagazine.com/150177 processing.
[2] Donald K. Weaver Jr., “A Third Method of Generation and Detection of The project has a lot of room for improve-
Single-Sideband Signals”, www.h4.dion.ne.jp/~ja5fp/weaver.pdf ments and additions. A future install-
ment (hopefully in the next edition) will
[3] Daniel Uppström, “Weavers metod för SSB”, ESR Resonans 2/2014,
present a radio board and discuss the
http://resonans.esr.se/ESR_Resonans_2014_2.pdf (in Swedish)
transmission side of things; if enough
[4] www.elektormagazine.com/labs/ resonance is observed, we may present
fpga-dsp-radio-for-narrow-band-communications-150177-i more advanced radio boards.
[5] https://github.com/ast/dspsdr The VHDL code for the FPGA is available
as open-source on [5] and additions and
improvements are welcome.
ronment is not of interest there’s always ble through the project web pages [1], Finally, it should also be noted that the
the option to download the applications [4], and [5]. board is generic enough to be used as a
needed for programming only. The Quar- In a standalone radio the controller is development board for other FPGA-DSP
tus suite is available for both Windows likely to be a small microcontroller board applications.
and Linux. with a display and buttons (like the Elek- Please visit the project web page for
tor Platino). A suitable board will be updates and additions.
Control interface described in a subsequent installment. (150177)
At power on, the firmware gets loaded For experiments, or when the need for
from the configuration memory, and pro- a monitor and mouse/keyboard is not
grammed into the FPGA. Then the FPGA an obstacle, a Raspberry Pi should also
has to be initialized and controlled over make a flexible control interface. For the
I2C or the serial port. The FPGA is much RPi (or any other Linux computer), an
like a typical IC with a few registers that applet was written in Python using the
need to be set. Every data transmission GTK graphical framework, which makes
involves five bytes being sent to the the controls easily accessible. By default
FPGA. The first two bits set the regis- this applet connects to the FPGA board
ter address while the remaining 38 bits over the serial port. It also has an exper-
contain configuration data. imental socket mode to enable remote
A few status signals can be read as operation. The idea is to run a server
well as the value of the received sig- on a Raspberry Pi at the location of the
nal strength indication (RSSI). The con- radio and connect to the Pi with the
troller typically polls this information a applet from a remote computer. With
few times per second to update signal the large amount of man-made noise
from the store
strength indication to the user. in urban areas, and with the limitations ª150177-1:
Bare PCB for FPGA-DSP board
A detailed description of the control and regulations against installing large
interface, with full register map, is avail- antennas in these locations, the option ª150177-91:
able together with the firmware and its of remote operation becomes increas- Ready-built FPGA-DSP board
source files in a GIT repository, accessi- ingly interesting for radio amateurs and
Since its first release in 1991, the Python programming language got widely adopted, and today it has
become the preferred language of many programmers. Although intended for PC applications, a few years
ago Python got ported to embedded systems too. Called MicroPython (uPy), it was is a subset of Python
running on platforms like the BBC micro:bit and the ESP8266. And hey, it also runs on the pyboard, the
official uPy demonstrator board.
The Micro Python project (written as than six times the initial funding goal Ethernet module, and the NRF24L01+
two words at the time), including the of £15,000. This success implied that low-power wireless module. Now, almost
pyboard, was on Kickstarter by the the team had to throw in support for four years later, it’s time to see what
end of 2013 where it scooped up more the CC3000 Wi-Fi module, the WIZ820io has come of it all. Let’s have a play with
the pyboard and uPy.
Now that small companies and even start-ups can afford their own satellites, it’s good to know more about
components in space.
Figure 1. ISS astronauts practicing repair tasks for electronic components Single event effect (SEE) test: In this test a particle accel-
(photo: NASA). erator is used to bombard the component with protons or
heavy ions. The most serious result is data corruption due to
short noise pulses induced in the circuit. This effect is highly
Q What are the effects of radiation in space? dose received by the astronauts.
The Van Allen Belt provides additional protection. Objects inside
10000
Energy dose in Gy/yr
1000
100
10
1
0.1 1 10 100
Aluminium shield thickness in mm
Figure 2. Radiation protection by aluminum shielding in geostationary Figure 3. The first US satellite mission in 1958, Explorer 1, discovered a
orbit (black curve: energy dose due to electrons) belt of electrically charged particles surrounding the Earth
(source: Wikipedia, public domain). (graphic: NASA).
devices because they must operate under higher radiation lev- the design, so that the electronic functions are always inside
els. Deep space missions are even more difficult. Most of the the operational envelope. On the data sheet of a commer-
electronic devices are located inside the protective structure cial component you cannot see how it will behave under the
of the satellite. conditions of a space mission. Even the manufacturer does
not know. However, these properties are very important for
Q What types of components are used in space missions? deployment in space, so they must be determined empirically.
Redundancy helps to increase the useful operating time. In ESA and NASA now promote the use of FPGAs because pro-
the early days of space flight, all systems had multiple redun- grammable hardware can be repaired remotely. In addition,
dant modules. For example, up to eightfold redundancy was FPGAs pack a lot of functions in a single component, making
employed for the on-board computer. Especially for manned the electronics more compact. ESA also has a processor called
missions, the electronics must work flawlessly. Although redun- LEON, which is a soft IP core that can be implemented on an
dancy increases the complexity, power consumption, weight FPGA [1].
and size of the space vehicle, it is still one of the most import-
ant ways to increase the reliability of aerospace systems.
Q What are the effects of degradation or damage?
Advertisement
Raspberry Pi @ Elektor
It’s very easy to connect the Raspberry Pi 3
to a computer or a television set. You can
program this high-performance computer
yourself, use it to play videos, play
games with it, and use it do develop
your own highly innovative concepts. Pi3 R Model B
5
www.elektor.com/rpi3 Only €34.9
Raspberry Pi Advanced Programming Raspberry Pi 3 Starter Kit (Deluxe) pi-top DIY Laptop Kit
www.elektor.com/rpi-book www.elektor.com/rpi-deluxe www.elektor.com/pi-top
By Tam Hanna (Slovakia) dozens of other boards available from various manufacturers.
Espressif maintains a list of suitable candidates at [2], which
largely behave the same way as long as they have a USB IC
After the initial delivery of the ESP32 there were massive supply from FTDI.
problems with the breakout boards, although individual ICs were
only slightly affected. Due to the very small pin pitch, devel- A workstation for the ESP32
oping your own PCBs for prototype testing is not an attractive The ESP32 Thing is equipped with the familiar USB to serial
option. For this article we are using the SparkFun ESP32 Thing, converter IC from FTDI. That is advantageous for users who, as
which can be obtained from Mouser [1] and other suppliers. owners of an Arduino board or something similar, already have
The SparkFun board does not come with any pinheaders; the the corresponding driver on their PC. The following description
pins necessary for connection to a breadboard must be pur- is based on the Windows 8.1 Enterprise operating system and
chased separately. Along with the ESP32 Thing, there are now version 1.8.2 of the Arduino IDE.
which holds the SDKs manually entered by the user, but there
is nothing to worry about if this folder is missing.
Now you can determine what you should enter in the Target
Directory field — on the author’s PC this is C:\Users\TAMHAN\
Documents\Arduino\hardware\espressif\esp32.
Then click on the Clone button to start downloading the code
from the GitHub repository. This may take a while, depending
on the current load on the download server. You should not
worry if the Git window sometimes does not respond. After
the download is completed, the multicolor window shown in
Figure 1 appears. You can close it unchanged.
Remarkably enough, the SDK is supplied in two blocks. From
GitHub you only receive the data that is specifically related
to the Arduino environment. To download the data related to
the general ESP32 components, you need to use the program
C:\Users\TAMHAN\Documents\Arduino\hardware\espressif\
esp32\tools\get.exe, which with a bit of luck you can run by
double-clicking in Windows Explorer. This program opens a
console window which shows the download progress. After
the download is completed, you will have an additional direc-
tory named C:\Users\TAMHAN\Documents\Arduino\hardware\
espressif\esp32\tools\xtensa-esp32-elf, which contains the
ESP IDF development environment that will be discussed in
the next article of this series.
Figure 1. Downloading the Arduino SDK for the ESP32 from GitHub.
typedef enum {
GPIO_NUM_0 = 0, /*!< GPIO0, input and output */
GPIO_NUM_1 = 1, /*!< GPIO1, input and output */
. . .
Figure 2. You can see the COM port number in the Device Manager
window. GPIO_NUM_39 = 39, /*!< GPIO39, input mode only */
GPIO_NUM_MAX = 40,
} gpio_num_t;
Port as shown in Figure 2. Enter this port ID in the Arduino From the linear layout of this structure you can conclude that
IDE to complete the configuration. The default upload speed the ESP32 does not work with GPIO pin banks. Instead, each
of 921,600 bps can be left unchanged for now. If you experi- pin is uniquely described by its own ID. Closer examination of
ence problems with transferring binary files, especially very the code is not necessary here. As can be seen from the fol-
large ones, you should follow the lead of experienced ESP32 lowing method, you can use the supplied IDs directly in your
developers and reduce the data transmission rate. That nat- own code:
urally leads to longer cycle times for reprogramming, so you
should avoid being over-cautious in this regard. extern void IRAM_ATTR __digitalWrite(uint8_t pin,
uint8_t val) {
Hello World! if(val) {
Designers of evaluation boards normally equip their products if(pin < 32) {
with one or more LEDs, and pin 13 has become the preferred GPIO.out_w1ts = ((uint32_t)1 << pin);
choice for this in the Arduino world. True to their nature, Spark- }
Fun does not follow convention and puts the LED on pin 5. . . .
The sketch shown in Listing 1, which is included in software
for this article which you can download from the Elektor site Armed with this knowledge, you can consult the data sheet of
[4], is therefore a good choice for the first test. the ESP32 Thing, which can be downloaded from [5] as a PDF
There is nothing remarkable here from a programming per- file and contains the graphic shown in Figure 3. If you are
spective — the LED is periodically switched on and off. After using a different development board, you should consult the
the deployment process, which takes 30 to 60 seconds, the documentation from the corresponding manufacturer.
blue LED starts blinking at regular intervals. Here we are interested in the two pins GPIO5 and VUSB. The
first is connected to the LED which is switched by our pro-
How fast can it go? gram, and the second is connected directly to the Micro USB
The next thing we want to find out is how long it takes for the port and tells us whether or not voltage is present on that
ESP32 to complete processing of commands, which is import- port. Since the LeCroy 9354AM oscilloscope we used for the
following steps has four channels, we decided to also monitor
the 3V3 pin, which is connected to the output of the voltage
regulator on the PCB.
Developers with a background in the Raspberry Pi domain need
to be very careful here, because the ESP32 is a pure 3.3 V
microcontroller and will be permanently damaged by applying
voltages above 3.6 V. Unlike the Upton processor, the ESP32
is absolutely not 5 V tolerant. This is also an issue when the
board is connected to bus systems such as SPI or I²C.
The current specs call for a minimum supply voltage of 2.2 V,
which means that if you mount the ESP32 on you own board
you do not necessarily need to have a 3.3 V supply voltage
available. Incidentally, the voltage range of 2.2 to 3.6 V looks
a lot like the normal voltage range of lithium ion cells, which
is most likely an intentional application scenario.
However, let’s get back to our main task now. An analysis of
Figure 3. The pinout of the ESP32 Thing is fairly complicated. the oscilloscope output shows that the ESP32 needs about
. . . void loop() {
WiFiClient client;
================== SHOW INTERFACES ===================== const int httpPort = 80;
There is one interface present on the system: if (!client.connect(“tamoggemon.com”, httpPort)) {
Serial.println(“connection failed”);
. . . return;
}
SSID : Tamoggemon Holding k.s. BAa
In the absence of an HTTP driver, we have to formulate a valid
The WLAN header <WiFi.h> must be included in the program request by hand: Since we are not particularly interested in
code, and two other variables must be declared to hold the the overall HTTP protocol for this article, you do not need to
name and password of the network concerned: be concerned about the string shown in the listing:
After the data has been exchanged, we read it byte by byte Web Links
from the client object and forward it to the serial monitor: [1] http://eu.mouser.com/new/sparkfun/sparkfun-things/
[2] http://esp32.net/#Hardware
while(client.available()) {
String line = client.readStringUntil(‘\r’); [3] https://git-scm.com/download/win
Serial.print(line); [4] www.elektormagazine.com/160454
} [5] https://cdn.sparkfun.com/datasheets/Wireless/WiFi/
ESP32ThingV1.pdf
To avoid creating an overload from constant polling of the
[6] https://github.com/espressif/arduino-esp32/blob/master/
server, we call the method delay(…). It causes the ESP32 to
cores/esp32/esp32-hal-ledc.h
take a 50-second break.
[7] https://github.com/espressif/arduino-esp32/blob/master/
delay(50000); cores/esp32/esp32-hal-sigmadelta.h
} [8] https://github.com/espressif/arduino-esp32/blob/master/
cores/esp32/esp32-hal-dac.h
Now we are ready to send the sketch to the ESP32. You [9] http://espressif.com/sites/default/files/documentation/
shouldn’t be alarmed when the console is filled with various eco_and_workarounds_for_bugs_in_esp32_en.pdf
outputs: That’s because each HTTP request delivers an enor-
mously long header in addition to the actually requested data
(see Figure 7).
Summary
The Raspberry Pi Zero W and OrangePi Zero are serious com-
petitors for the ESP32 because the prices of the breakout boards
are roughly the same. However, if you are planning a small
production run you can save a lot of money with the ESP32.
For volume production, the extra effort of making your own
PCB pays off because the individual ESP32 ICs are significantly
less expensive than the breakout boards.
Our journey through the ESP32 world is not yet finished. In the
next issue of Elektor we will devote our attention to the native
API, which provides access to some additional functions and
additionally enables higher performance.
(160454-I)
Satellites are constructed from robust materials, simply because they have to perform flawlessly under
extreme environmental conditions. Their electronics require the use of specially manufactured — and
therefore extremely expensive — components. For small satellites (smallsats) regular commercial
components offer a cost-effective alternative, although their behavior must first be qualified in simulation
tests to international standards before deployment.
NASA astronaut Mike Hopkins removes a Dewar flask from the freezer to begin biological tests (photo: NASA).
In space there’s a variety of physical or disruption to the electronics. The pre- lite developers to design their systems
phenomena that affect the performance cise behavior of the components under accordingly.
of electronic components and materi- such adverse conditions depends on the
als. For satellite missions it’s vital to orbit of the satellite and can be simu- Figure 1 sets out the phenomena that
know this environment extremely well lated using software tools. The outcome determine the service life and depend-
in order to minimize any damage and/ of these simulations then assists satel- ability of electronic components:
• Radiation: A multitude of effects fold redundancy. Valid data was checked institutions like ESA and NASA to devise
result from this phenomenon. using a statistical method (voting algo- guidelines for developing qualifications
Gamma rays degrade the electronic rithm). However, this inclusion of redun- and standards. These guidelines underpin
components. Protons and heavy ions dant systems also enforced an increase the professional qualification of electronic
can at best falsify digital data or at in weight and power consumption as well components for space flight missions.
worst physically destroy the elec- as other challenges to hardware and soft- The standards laid down by ESA can be
tronics aboard the satellite. ware design. found on the ESCIES (European Space
As military-grade electronics did not Components Information Exchange Sys-
• Micrometeorites and space junk: really lend themselves to space flight tem) portal [2]. A database of qualified
The deadliest events in space are applications and the upscreening pro- integrated circuits together with their
caused by small artificial or natural duced no improvement of the compo- test results is available on the ESCIES
matter. The effects of micromete- nents, work began in the 1960s on the website [3].
orites or space junk should not be systematic development of dedicated For a qualification test the components
underestimated; they can damage space electronics, which demanded qual- under examination (Devices Under Test,
or destroy satellites. This very thing itatively high-end production techniques. DUTs) are made ready and the measure-
has already happened, resulting in As a basis for this new generation of ment environment configured. First the
the loss of spacecraft. components in the USA military compo- precise number of components is deter-
nents were selected, with complemen- mined and depending on the type of test,
Degradation in electronics tary tests defined for their qualification. either a small number or the entire quan-
In the early days of space flight his- This strategy made possible a reduction tity of the components is nominated.
tory, electronics designed especially for in production costs for space flight mis- This means that sometimes just a few
spacecraft did not exist. Instead elec- sions, at the same time achieving a high components will suffice for the qualifica-
tronic components designed for military level of ruggedness in the components. tion (for example during radiation test-
purposes were upgraded for deployment However, because the demand for com- ing), whereas for an outgassing text (for
in space. In this upscreening process ponents of this kind was obviously very instance) all of the components must
various supplementary tests were con- small, their price remained high. be tested. During testing the DUTs are
ducted, with the best-performing com- Nowadays the qualification process for just characterized.
ponents selected. one component to European Space Agency An important requirement in qualifying
In 1973 military-grade components were (ESA) or U.S. National Aeronautics and components is that all of the compo-
again used in the hardware for the Sky- Space Administration (NASA) standards nents for qualification must be identical
lab space station. In the qualification test requires an investment of a million dollars (in geometry, size, materials and so on)
the hardware had to be upgraded several or more. The time taken for certification is and must also come from the same pro-
times over on account of malfunctions around two years [1]. Of course the entire duction batch.
that arose. These improvements resulted test process can turn out to be complex or The test results are collated in a test
in the need for more than $3 million of simple, according to the type of compo- report. Following qualification a test
additional investment in procuring new nent. By way of example, testing a diode report will describe the behavior of the
electronic components required and on is less cost-intensive and protracted than relevant component parameters under
additional qualification exercises. checking out a microcontroller. space flight conditions. A complete,
Electronics in the first Skylab mis- highly extensive qualification is known
sion (1981) once more employed mili- Qualification tests as a ‘screening test’. A process of this
tary-specification components. In order The experience gained over the last sixty kind takes a couple of years and requires
to raise the dependability of the system, years during numerous space missions a high level of financial investment. In
most elements were installed with six- and using various technologies enabled the screening test the following individ-
5 parts 10 parts 10 parts (3) 10 parts (4) 10 parts 10 parts sampling (2)
Construction Electrical Electrical test Electrical test Electrical test Electrical test Radiation
Analysis characterization @ 25°C @ 25°C @ 25°C @ 3 temperatures Evaluation
@ 3 temperatures
Seal test (5) External visual Seal test (5) External visual
(minor or inspection (minor or inspection
major leaks) major leaks)
Figure 2. Evaluations tests carried out in Class 1 (ECSS-Q-ST-60-13C Evaluation tests flow chart Figure 3. Array of devices under test ready for
Class 1, source: ESA). radiation testing (source: Spectrum Aerospace).
ual tests are undertaken: cesses are carried out can be seen in a example, rising current consumption
brief description of the TID (total ionizing can be observed with increasing radi-
• Electrical test dose) testing of an LTC2052 drift-free ation dosage (Figure 6). At the end of
• Impermeability testing operational amplifier. Firstly, a rack is the test changes in electrical parameters
• Visual inspection prepared which contains circuit boards are detected; in some cases components
• Mechanical shock with the components to be inspected have even been completely destroyed.
• Vibration test (Figure 3). In this case, the two con-
• Constant acceleration figurations (bias condition) shown in Fig- The smallsat marketplace
• Thermal test ure 4 are of importance: an ‘off mode’ The market for small satellites is showing
• Radiation test in which all pins are connected to sys- fairly rapid growth. New products and
• Outgassing tem ground and an ‘on mode’, in which functionalities are sought to match the
• Stress test the device is configured for a specific growing requirement. For manufacturing
• Thermal shock operating point but the component is not smallsat hardware military ITAR (Interna-
• Solderability processing a signal (that is, in a kind of tional Traffic in Arms Regulations) com-
standby state). ponents are not the right solution; qual-
ESA document ECSS-Q-ST-60-13C_ Figure 5 shows the test setup. Cobalt-60 ified COTS (Commercial Off-The-Shelf)
Space Product Assurance describes the is used as the radiation source. The two mass-produced products) are.
various quality classes [4]. The differ- test configurations are subjected to irra- Market research carried out by analysts
ences between these classes lie in the diation. During irradiation, the test spec- Northern Sky Research indicates clearly
depths of the qualification processes. imens are measured from time to time that in the next ten years more than
Class 1 is concerned with complete by means of automatic test equipment 2,500 small satellites (weighing up to
qualification (Figure 2), whereas Class (ATE). These characterization results 100 kg) will be launched into space [5].
3 requires only a short qualification pro- show the degradation of the compo- Another market study, by the firm Space-
cess (mainly radiation tests). nents at ever-increasing levels of radia- work, forecasts 3,000 smallsats up to
tion dose. The reduction in performance 50 kg in the period 2014 to 2020 [6].
Characterization depends on the technology of the device Both forecasts envisage future constella-
The way in which these qualification pro- and the accumulated radiation dose. For tions of satellites (effectively mass-pro-
• A competition was planned to win a • How will the experiments be or entire PCBs is that in the case of a
place for a circuit board on board a monitored? malfunction it may not be possible to
StarLab flight. What has become of Electronics in space are observed using localize the error precisely.
it? telemetry data. Sensors measure Not all components are equally robust.
Yes, this is still live. However, delays specific parameters and the test results Consequently you need to determine
have arisen because a firm that wanted are then transmitted to Earth. This the ruggedness of the components
to co-sponsor the prize competition and way you always know exactly how first before you can develop a system
had experience in events of this kind your space electronics are functioning. for deployment in space. If you do this
has dropped out. We are in discussion Developers need to concentrate on in the opposite way order, a single
with other firms but this will definitely their own experiments nevertheless, for component may end up significantly
take a bit longer. which reason a StarLab development degrading the viability of the entire
kit is provided. This electronic assembly.
• When will the first flight take place? support package assists developers I have devised a new concept that lies
to prepare experiments involving between component and PCB level.
The first flight should take place
telemetry electronics quickly and In this way complete PCBs can be
in December, although while some
straightforwardly. qualified more accurately.
uncertainties remain, we don’t yet have
a fixed date. In principle flights should
• Can you test only components or also • Who can I ask if I have any
then be made in a three-month cycle.
complete assemblies? questions or a specific interest?
Can you give a ballpark idea of your Both. Although testing individual Jaime Estela
charges? components takes up more time and jaime.estela@gmail.com
The price depends on the size of the the costs are higher, the results are jaime.estela@spectrum-aerospace.
PCB. For a small board (5x3 cm2) you very precise. With complete PCBs com
can reckon on around €3000 / £2500 / the costs and time to test are lower, https://www.linkedin.com/in/
$3260 upwards. but the inaccuracy is greater. The jaime-estela-9045b63b/
problem with complete assemblies Skype: jaimeestela
duced and thus relatively low-priced to make space travel cheaper and more between non-qualified components (for
swarms of satellites, like GPS for exam- accessible, space-qualified COTS devices example, in CubeSats) and fully qualified
ple). Increased production-line manu- provide the means of getting commercial ITAR components. From the experience
facturing of satellites will create an even components qualified for use in space. gained with small satellite missions it is
greater requirement for qualified elec- The term and concept of ‘space COTS’ known that many commercial compo-
tronic parts. arose from work using commercial elec- nents can definitely function in space for
tronics in smallsat operations and also several years, despite not having been
Space-COTS out of long-term involvement with ESA conceived for space applications.
For the NewSpace [7] movement of mul- standards for qualifying electronic com- Space-COTS parts are tested at various
tiple (U.S.) startup companies aiming ponents. Space-COTS is a compromise levels and defined, by qualification level,
IC1.A IC6.A
2 4 2 4
1 1
LTC2052 LTC2052 DUT
R1 3 R3 3
Co-60
11 11 source
1k5
10k
T = 20ºC
Power Supply
–3V V = ± 3V
Figure 4. Two configurations of an LTC2052 for TID testing (source: Figure 5. Test setup using a Cobalt-60 radiation source (source: Spectrum
Spectrum Aerospace). Aerospace).
StarLab
Figure 6. A test result: current consumption increases with increasing radiation dose (source:
Many firms are developing new prod-
Spectrum Aerospace).
ucts for space flight. These products do
not have any flight experience (‘flight
heritage’). To test a product in space,
you need to invest at least €250,000 /
£212,000 / $274,000 (covering satellite
Space electronics: the bad old days
plus flight but excluding the cost of test I guess the question I’m asked the most often is: “When you
procedures). What’s more, as well as the were sitting in that capsule listening to the countdown, how did
financial wherewithal, you must have the you feel?” Well, the answer to that one is easy. I felt exactly how
patience to resign yourself for a flight you would feel if you were getting ready to launch and knew you
delay of at least 18 months. There are were sitting on top of two million parts — all built by the lowest
indeed dedicated satellites for technology bidder on a government contract.
proving trials but these launches take ― Astronaut John Glenn, the first American in orbit (1962), spoken in 1997.
place very infrequently and are reserved
for a very small number of privileged
companies [8].
However, moves are now afoot to make for making experiments in space? Check
the International Space Station (ISS) out the answers to your burning ques-
usable by a wider user base, enabling tions about the StarLab project in the
small private payloads to be installed on panel. The gateway to space stands wide
this platform. One of these initiatives is open!
the StarLab project. One container can (160036)
include multiple experiments; power and
data connections are available for each
experiment, with test data transmitted
to Earth virtually in real time. The Star- Sources and Weblinks
Lab project, with its innovative qualifica-
[1] The history of space quality EEE parts in the United States, www.cti-us.com/
tion, provides regular access into space
pdf/HistoryEEESpacePartsinUSA.pdf, Leon Hamiter, Components Technology
for everyman – and at moderate prices.
Good electronics can definitely arise in Institute
the Maker community too. Their devel- [2] European Space Components Information Exchange System, https://escies.
opments can also be of interest for org/webdocument/showArticle?id=167
space flight, even if the theme of space
[3] ESCIES Radiation List, https://escies.org/labreport/radiationList
electronics is largely unknown in Maker
circles. The StarLab project gives new [4] ECSS-Q-ST-60-13C_Space Product Assurance, https://escies.org/download/
electronics wings to pass tests in space. webDocumentFile?id=60887
Testing your own designs in space is cer- [5] Nano And Microsatellite Markets Report, Northern Sky Research LLC, One
tainly still a big ask, but the StarLab proj- Mifflin Place, Suite 400, Cambridge, MA 02138.
ect makes this elaborate and expensive
[6] Small Satellite Market Observations 2015 – Forecast, Dr. John Bradford,
exercise simple and advantageous. An
entirely new field of activity opens up Spaceworks Enterprises Inc., 1040 Crown Pointe Parkway, Suite 950, Atlanta,
to developers and the space flight sec- GA 30338 USA.
tor can profit from innovative, qualified [7] NewSpace - Wikipedia, https://en.wikipedia.org/wiki/NewSpace
products.
[8] DLR IOV/IOD Workshop, Marc Jochemich, DLR Space Administration,
Brussels, September 2016.
Is your curiosity aroused? Are you game
Figure 1. Screenshots of the cardioscope app, with and without buttons. Figure 2. Different implementations of the Android Menu button.
By Luc Lemmens (Elektor Labs) ton, which the user can use to switch between the apps that
are currently active. Our reader with the cardioscope project
apparently had such a device and we did have to hunt around
It does happen occasionally that software stops working, par- for a while before we found the solution. But fortunately this
ticularly when that software has been around for quite a few turned out to be very easy: the buttons on the screen for the
years and doesn’t want to function properly when running on cardioscope app appear when the Overview button is held for
the latest version of the operating system of a computer (sys- a slightly longer time. That is because the function of that but-
tem). The question we received at Elektor Labs about the app ton then changes from ‘App Switch’ to ‘Menu’.
for the Elektor Android Cardioscope from 2013 initially looked The question from our reader was answered reasonably quickly,
to be one of these instances. But fortunately that turned out but when you dig a little deeper into this relatively basic func-
to be not the case. tionality, you will realize the enormous diversity — or is that
One of our readers recently made a start on this project, but proliferation — regarding the operation of Android devices. And
he couldn’t find the buttons that should be at the bottom of then I remember again that last year I struggled quite a while
the screen of the accompanying app, which are used to oper- before getting used to operating my new smartphone. Hereby
ate the cardioscope and are therefore essential for the opera- my apologies to the people around me who may have heard
tion of this circuit (Figure 1). On his particular mobile device, the occasional expletive when I hit the wrong button again,
the Menu button that would have made these buttons appear, and that is not even mentioning the people I have disturbed
was missing. with unintended calls.
Android devices (both tablet and smartphones) originally had (160349)
three buttons (Home, Back and Menu) at the bottom of the
screen for navigation, some even had four (the three afore-
mentioned plus Search). On the really early models these
were real pushbuttons, but these days it is more commonly a
physical button for Home, flanked by two capacitive buttons.
The various manufacturers have quite different views about
the implementation, positioning and the icons used for these
buttons. In Figure 2 you can see a few examples of the Menu
buttons on different smartphones, this overview is in all like-
lihood not even complete.
On some, more recent devices, the Menu button had to make
way completely for the so-called Overview or App Switch but- Figure 3. Overview/App Switch buttons.
“Oh my gosh look at that, and they boast two channels — hilarious! My old ‘scope used
to do four or eight hands down!” It’s a common response from people first confronted with
the Tektronix Types 556 and 565 cathode-ray tube (CRT) oscilloscopes, two of the largest, heaviest and most
expensive instruments ever to serve electronicists in their labs if only for heating. These Goliaths are often
regarded as the pinnacle of the tubed oscilloscopes from market leader Tektronix, although they contain
more than a handful of semiconductors and there’s at least one Tek ‘scope that’s even heavier.
That’s dual-BEAM Sir designed — not a problem with most tiple-trace ‘scope image was a challenge.
Many CRT oscilloscopes are loosely and reputable ‘scope manufacturers as CRT That’s probably the reason for scientists
indiscriminately described by their proud technology in general can be said to have and research institutions with deep pock-
users as “1/2/4/x-channel”, “-trace”, reached great heights. ets (like NASA) to prefer a dual-beam
“-way” or “-beam”. I estimate 98% of Totally acceptable for daily work to this oscilloscope with a spec of 15 MHz over
all CRT ‘scopes ever sold are single-beam date, the rapid vertical alternating of a dual-or quad-channel specified as “oh
instruments where the electron beam the electron beam inside the CRT may yeah much faster and much cheaper”.
inside the CRT is chopped or alternated however cause flicker and artefacts with But if you require absolute and no-tricks
so rapidly your brain is tricked into per- really demanding signals, and even more observation of two signals on a single
ceiving two (or more) separate traces. so if the signals differ widely in repeti- CRT face then it’s the dual-beam ‘scope
This works fine for run of the mill sig- tion rate and/or frequency. Also, at a you want. Sadly, these came at a pre-
nal viewing in the homelab using up to time when digital photography was in mium due to the more expensive CRT
four traces, provided the CRT write speed the realms of sci-fi, making a proper with its double set of deflection plates,
is okay and the CRT itself is properly (Kodak Instamatic) screenshot of a mul- and in the instrument, the double V
amplifiers and more extra circuitry like 80 cm office table available retrofitted wonderfully preserved 556 is S/N 004584
two HV sections, and two timebases with swivel & lock castors and this was from Tek’s Portland, Oregon factory.
(though not often seen). able to carry the 556 and 565 monsters The 556 is a configurable ‘scope with
You really have to see it to believe it — as well as some tools, cables and a 214. two bays that accept a wide range of
the image on a dual-beam oscilloscope So I wheeled in the objects. plug-in units to choose from. Here I am
is extremely restful to the eye and no The head image shows the two Goli- fairly randomly using a Type 1A2 50-MHz
strange things happen when one signal is aths and one David (a 214) in action, dual-trace vertical amplifier (left) and a
positioned over the other partly or fully. jointly drawing about 1,600 watts from Type 1L20 10–4200 MHz spectrum ana-
And yes, you can chop or alternate each a single 230 VAC AC outlet in our former lyzer pictured separately in Figure 2.
of the beams to give 2 x 2 traces or even photo studio. The big fans in the 556 and The lower-trace signal proved difficult to
2 x 4. Or observe a glitch in one period 565 made a racket. The 556 (left) is dis- photograph due to the camera distance
of a 50-Hz signal on the upper beam and playing its 1-kHz calibrator signal on the and the non-periodic image due to our
ten or so periods of a 50-MHz signal on upper beam, and on the lower beam the busy computer and smartphone users!
the lower beam. RF spectrum of the 2.4-GHz Wi-Fi band In an attempt to indicate the sheer size
Tektronix produced a limited number of at Elektor House, picked up basically on of these instruments using a printed
oscilloscope models of the dual-beam two banana plugs. medium like this A4-size (approx. US let-
variety: the 502, 551, 555, and 565 from Although the big 556 is a dual-beam ter) magazine page I opened the 556’s
the famous ‘500’ series, the 7844 from all-symmetrical design with many dupli- top cover and placed a 9-volt battery on
the celebrated ‘7000’ series, and the cate circuits, it does have controls and its CRT cover (Figure 3). I could have
5113 from the economy ‘5000’ series. connectors common to both beams. put 20 there. A closer look at the CRT
I know of at least one more manufac- These are conveniently arranged in a connections is afforded by Figure 4 —
turer of dual-beam oscilloscopes and central area pictured in Figure 1. This specifically the five connections for the
that’s Philips with their transistorized
PM3230, PM3231, PM3232, and PM3233,
and the tubed PM3236. Let me know if
you are aware of other manufacturers. I
have never seen a triple- or quad-beam
oscilloscope, have you?
upper-beam plates. An identical set of a 1L10 and a 1L30 later, which gives me through the trouble of producing it. The
five wires for the lower beam is at the coverage from 1 MHz to 10.4 GHz. answer is probably to extend the pop-
opposite side of the CRT neck (the print ular 560-series of scopes with a dual-
is just visible). Note the cool use of the The 565 with trouble beam instrument. The 560 sub-series
words “upper” and “lower” to denote the Compared to the 556 the slightly smaller employs special plug-in units designed
vertical deflection plates. Also, the two and lighter 565 is marked by even more to drive a CRT’s V and H plates directly.
end compensation coils for the V plates, options for triggering, as well as time- Figure 5 shows the 3A6 dual-trace
and the famous Compactron tube! base separation, -sharing and –cross- amplifier plug-in unit used in my 565.
This 556 required no repairs, just minor ing. The 565 offers ‘just’ 15 MHz band- Comparing it to a 500-series plug-in like
cleaning. It came with the two plug-ins width compared to 50 MHz for the 556, the 1L20 (Figure 2 and the head image
pictured, to which I was fortunate to add which makes one wonder why Tek went refer) you can see it’s narrower. At the
rear side sit two fat E55L ‘SQ’ (special
quality) tubes which handle the driving
Tektronix 500-series dual-beam oscilloscopes of the V plates in the 565 main instru-
Weight Elektor Retronics ment at up to 10 MHz and low capaci-
Type Main features
(less plug-ins) Collection item tance to avoid losses and distortion. The
500 kHz; high sensitivity; low range of 560-compatible plug-ins is also
impressive, with 4-trace, 8-trace, GHz
√
cost; compact; 1x sweep;
502(A) 23.6 kg (52 lb.)
fanless. sampling units — a feat at the time and
again challenging the designers at Hew-
30 MHz or lower at high lett Packard!
Indicator: Although it came from a different owner,
sensitivity, 2 x V plug-in; 1x
√
551 23.6 kg (52 lb.) the 565 was transported to its new home
sweep; no delay, separate
PSU: in my Suzuki SX4, along with the 556 and
power supply; 1x fan.
19.2 kg (42 lb.) a boxful of plug-ins. Before it was even
allowed into my garage I had to give it
555 Indicator: 30 MHz or lower at high
a quick clean as the unit was positively
X
“Triple 31 kg (68 lb.) sensitivity; 2 x V plug-in; 2
filthy after about 20 years in an indus-
Nickel” PSU: x H plug-in; delay; separate
trial cellar along with 30 tons of e-debris.
20.5 kg (45 lb.) power supply; 2x fan.
I started up the 565 on a variac and after
50 MHz; 2 x V plug-in
a good four hours, on reaching about
(“letter” and 1xx series);
√
556 185 VAC (of 230 nominally), I was happy
40 kg (88 lb.) 2x sweep; integrated power
to see a trace appear. Just as I wanted
supply; 1x fan.
to position the mesmerizing blue trace
toward the center of the screen, a mini
15 MHz; 2 x 560-series (Type
explosion was heard, and the trace disap-
√
565
31 kg (68 lb.) 2xx/3xx) plug-in; 2x sweep,
peared. I switched off immediately but a
delay; 1x fan.
vile smell soon filled the room and gradu-
Conclusion
These instruments have so many options
they easily take 15 minutes to get the
settings right and allow the measure-
ments to commence. Consider having
two beams (Upper and Lower) writing
for example, two traces each (Upper-up-
Retronics is a regular section covering vintage electronics
per and Upper-lower; Lower-upper and
including legendary Elektor designs.
Lower-lower), two timebases A and B,
Contributions, suggestions and requests are welcome;
delayed and non-delayed, applied to www.elektor.tv please telegraph editor@elektor.com
Upper and/or Lower, with triggering
Sniffer using
RFM12 Radio Module
spy on the ether
Several years ago, I designed a thermometer with Nixie display using remote sensors. The thermometer
displays the indoor and outdoor temperatures as well as the time, captured from an external GPS module. A
specific application checks a remote mailbox on a regular basis (counting the passes of the mailman). All the
sensors send their data (wirelessly) for display every 30 minutes. For various reasons, I could not connect
the PC to the display box to capture the arrival of the data frames and debug them For this reason I made
use of an RFM12 radio module to spy on my thermometer. Now that the software is up and running, I’ll share
my experiences with you.
To be sure to see all the data sent to the thermometer display, Two essential ingredients: a PIC and a radio
I developed a simple tool: the RFM12 sniffer. It captures all module
that passes through the air and sends it via a USB connection To run my device, I chose a PIC 18LF2420 microcontroller
to a PC which displays the data. The first version of my device which runs on 3.3 V and an internal clock of 8 MHz, but you
was intended to capture the data frames from the thermome- could use any other microcontroller. For power, the USB serial
ter formatted to a (simple) proprietary protocol, with a header module used has two outputs: 5 V and 3.3 V. As the RFM12
and a checksum. Here, the principle was very simple: display needs 3.3 V, we will use that option with the correct filtering.
on the PC everything that passed over the ‘ether’ without any For information, I often use USB-to-serial modules of the Pro-
processing on the data structure, or verifying the control sum. lific brand.
100k
100k
10k
20 CLK GND +3V3
6 RF12C 9
100n 100n 10u VDD RES VDD
2 1 7 8
RA0/AN0 MCLR/VPP/RE3 GND ANT
3 U1
RA1/AN1
4
RA2/AN2/VREF–/CVREF
5 11
RA3/AN3/VREF+ RC0/T1OSO/T13CKI
6 12
RA4/T0CKI/C1OUT RC1/T1OSI/CCP2
7 13
RA5/AN4/C2OUT/SS/HLVDIN RC2/CCP1
10 14
RA6/OSC2/CLKO RC3/SCK/SCL
9 15
RA7/OSC1/CLKIN RC4/SDI/SDA
16
PIC18LF2420 RC5/SDO
S3 21 17
RB0/INT0/FLT0/AN12 RC6/TX/CK
1 16 22 18
RB1/AN10/INT1 RC7/RX/DT +3V3_USB
ON
copyright
1
2 15 23
RB2/AN8/INT2 D1
2
3 14 24
RB3/AN9/CCP2 K1
3
4 13 25 1
RB4/AN11/KBIO 3V3
4
5 12 26 R18 2
RB5/KBI1/PGM To-TxD
5
6 11 27 3
2k2
RB6/KBI2/PGC To-RxD
6
7 10 28 4
RB7/KBI3/PGD GND
7
8 9
S2 VSS VSS D2
Serial link
8
8 19
150712 - 11
To adapt the levels between the µC (3.3 V) and the USB (5 V), µC, R16 for the pushbutton S2 and R17 for the serial link on
the TX pin (17) of the µC is connected direct to the USB connec- connector K1. The bank of DIP switches uses the internal pull-up
tor while the Rx pin (18) is protected by a diode and equipped resistors of Port B. LED D2 flashes when data is received.
with a pull-up resistor.
A bank of DIP switches (S3) allows several parameters of the A morsel of code
circuit to be set. The first two switches define the rate of trans- The code is written with MikroC (download at [2]). The rou-
mission to the PC (see Table 1). tines for the RFM12 are the most sensitive. I adapted routines
If the RFM12 module receives nothing further, switches 3 and found on the internet. I added, for example, a watchdog timer
4 set the delay after which the PC receives an automatic line while waiting for data. This code is a stripped‑down version of
feed (CR/LF) (see Table 2). that used in my Nixie Thermometer. Some parts of this code
Note: switches 7 and 8 should not be used. These switches are are thus not used for the sniffer presented here.
connected to Port A without any pull-up resistors, and Port A The main loop is used for waiting for valid data: the IRQ out-
does not have any internal resistors. put of the RFM12 alerts the µC to the arrival of data (input
Switch S1 (run/stop) is primarily to reload the software with- PORTB.F0), following which the data is transmitted to the µC
out having to pull the µC off the board. The pushbutton S2 is (PORTC.F4) to be sent to the PC via the USB link (PORTC.F6).
to restart the program. I noticed that the RFM12 often sent erroneous data. It is thus
The resistors are mainly pull-up resistors: R4 for reset of the necessary to reset regularly the receiver and the FIFO register.
Table 2. Silence time before a carriage return / line feed (CR/LF) is sent (S3)
Pos. 3 Pos. 4 Pos. 3 Pos. 4 Pos. 3 Pos. 4 Pos. 3 Pos. 4
OFF OFF ON OFF OFF ON ON ON
no CR/LF 1 s 10 s 20 s
Here, I have used DIP switches 5 and 6 to program a delay Web Links
(see Table 3); the receiver and the register are automatically [1] Elektor Labs project:
reset when the timer times out. Without this, the RFM12 con- https://www.elektormagazine.com/labs/
tinues to receive data after each frame. sniffer-for-rfm12-display-exchanges-over-the-air-on-pc
Usually, I use a bootloader for all my applications with the
[2] Source code, compiled code, suggested PCB artwork:
18LF2420. For me, the best one is the Tiny Pic Bootloader
www.elektormagazine.com/150712
(see [3]). It is not compatible with all the PIC µCs, but it works
with the 18LF2420. Since the 18LF2420 cannot dynamically [3] Tiny Pic Bootloader:
change the watchdog timer frequency, you can perhaps recom- www.etc.ugal.ro/cchiculita/software/picbootloader.htm
pile the loader to set this frequency. The code used is around
100 bytes and is reliable.
I’m listening
There’s no magic needed to use the assembly: just connect it
to a USB port of the PC. You must first have installed the driver
from the manufacturer of the Serial USB module that you’ve
chosen. Then launch a tool like HyperTerminal or CoolTerm and
set the correct speed. Some data should be shown. If the timer
(Table 2) is active, the new lines should improve readability.
With the save function you are able to leave the sniffer run-
ning for several days and analyze the captured frames later.
With CoolTerm, the display of characters is frozen from time
to time, but if you examine the hexadecimal data, everything
is there.
(150712)
Have you come up with an inspired way of solving a really challenging problem? Or found an ingenious but
‘alternative’ way of using some component or tool? Maybe you’ve invented a better or simpler way of tack-
ling a task? Do write in – for every tip that we publish, we’ll reward you with UKP40 (or local equivalent)!
This time our subject is optical switches and their applications, As always, all sample programs and listings can be downloa-
from fork sensors to reflex light barriers and pulse detectors. ded from the web page for this article [5].
We’ll cover the best methods of interpreting and analyzing
the signals too. Once again we are using sensors from the 35 The tracking sensor
Sensors Kit, available direct from Elektor [1]. We’re all familiar with little robots on two wheels that can
S
A2
390R
10k
2k
10k
S
10k A1
IR
V+
V+ 330R +5V
LM393 +5V
G
IR GND
G
GND
Light Blocking/Heartbeat
Tracking
follow a white line. These assess work by assessing the The pulse sensor
reflectivity of the surface below them. An IR transmit diode Heartbeat monitors and other pulse meters frequently use an
illuminates the surface beneath them and an IR phototran- optical procedure. Light of an appropriate wavelength is pas-
sistor detects the reflected light. In basic principle terms sed through a finger or an earlobe and then received using
this uses what is called a reflex (or reflected) light barrier. a phototransistor. Part of the light is absorbed in the blood
To adjust for optimum sensitivity for differing surfaces and inside the body. The heartbeat varies the momentary blood
clearances the tracking sensor uses a potentiometer (pot) flow periodically and consequently modulates the light stream
and a comparator (Figure 1). to a small degree. Naturally these signals must be evaluated
Thanks to the LED on the output of the comparator we can analogly, as we are not expecting any major variations.
easily test its functionality. Your finger will provide the reflec- The heartbeat sensor is constructed around a fork sensor (see
tive surface if you hold it a centimeter away from the sensor. Figure 2), but with a greater distance between transmitter and
You can now adjust the pot to get the best switchover point. receiver. Both the IR transmit diode and the phototransistor
A digital signal will appear on the output and this can be ana- have long connecting leads, enabling you to adjust the opti-
lyzed and processed in the usual way. You can either use mum position. The PCB is identical to that used for the fork
the software described in part 2 of this series [3] or you can sensor, except that the connector and components are fixed
connect an actuator direct. What you do with this after that on the other side.
is left to your own imagination! It doesn’t have to be a robot In use you will need to bend the IR diode and the phototran-
even. Perhaps you need a light or a fan that is switched on by sistor so that a finger can be clamped between them both. It’s
a hand gesture, or you may have some other requirement. also vital that the finger cannot touch any conductive area on
the PCB, because additional mains (AC line) hum interference
Optical fork sensors could be picked up in this way. On our example the sensors
In many machines and devices (from scanners to 3-D prin- were flexed as seen in Figure 3. The IR LED then shines almost
ters) you will find limit switches for determining the position directly onto the phototransistor. The output voltage is now
of a moveable component. Mechanical contacts or microswit- close to zero. If you next lay your finger in the gap, the light
ches often suffer problems concerning their long-term stabi- is shaded. The phototransistor conducts less, meaning that
lity and need to be replaced after fairly long periods of use. the voltage rises. For longer tests it makes sense to hold the
A fork sensor gives better service because the IR diode and sensor onto the finger with a rubber band (Figure 4). It is, you
phototransistor used display no signs of ageing, al least with see, important that the finger is relaxed and the signal is not
moderate LED current. falsified by varying pressure.
A transmit diode and phototransistor (Figure 2) are positioned For your first test with the Arduino IDE the program VoltageAD2
close together. The fork-shaped housing contains a slot, in or from part 1 of the series [2] will be fine. The voltage on the
through which you can place or pass an object that is opa- phototransistor can now be represented using the serial plotter
que to light. The on/off switching transition achieved is easily (Figure 5). The light modulation caused by the pulse is clearly
reproducible with an accuracy of less than a millimeter. Fork visible. Overlaid on the signal are slower variations, caused
sensors of this kind are used also in computer mouse devices by unavoidable movement. This explains why evaluating the
and demonstrate their reliability day in and day out. signals can be a challenge.
The output signal at the collector of the phototransistor can To improve the interpretation we first used a lowpass filter (Lis-
be polled either analogly or digitally, according to your choice. ting 1). This simply produces a moving average of the value
Exactly what is done with the signal then depends on the parti- measured. For this we need nothing more than a couple of lines
cular assignment and the software. Your starting point can be of code. Each of the current values measured is added to a
with an accuracy of less than 1 mm — possibly exactly this, as sum total of average values mean that is afterwards reduced
required for a 3-D printer. In less critical cases a purely digital by 1/20. Each individual measurement can then influence the
(yes or no) query will suffice: light or no light. average by only 5 %. The time constant of the lowpass filter
void loop() {
Serial.println(pulseFreq);
value = analogRead(sensorPin);
lcd.setCursor(0, 0);
mean = mean - mean / 20;
lcd.print(pulseTime);
mean = mean + value;
lcd.print(“ ms “);
value = value - mean / 20;
lcd.setCursor(0, 1);
if ((old < 0) & (value > 0)) {
lcd.print(pulseFreq);
time2 = millis();
lcd.print(“ /min “);
pulseTime = time2-time1;
}
time1 = time2;
}
//Serial.println(pulseTime);
old = value;
n = n + 1;
delay(20);
pulseFreq = 60000 / pulseTime;
}
if (pulseFreq > 45) {
10k
10k
would use 60 Hz where this is the norm). The cutoff frequency
CLK
of the filter is f = 1 / (2 Pi T), in other words around 0.398 Hz. A0 (A4)
On the serial plotter you can now see how the filter works. SW
The moving average follows the signal with a degree of iner-
tia (Figure 6). If you remove your finger rapidly from the sen-
+5V (13)
sor, you can observe the pulse response of the lowpass filters
(Figure 7). GND
GND
All that remains is to generate the difference (input signal Rotary Encoder
minus the average) (Listing 2). You do this by creating a high-
pass filter and then obtain a clean pulse signal that is rid of all
the sluggish variations. With this done you can now set about Figure 9. Rotary encoder.
evaluating the pulse frequency.
As well as this you can now recognize some further details.
The signal always rises steeply and drops back more gradu-
ally (Figure 8). You can see how, with every beat, the heart
CLK
pumps blood at high pressure through the arteries into the
finger, from which the return flow through the veins takes lon-
ger. You can also spot easily any irregularities that may occur
DT
in the pulse rhythm.
To make a complete pulse meter device out of this now we need
to measure the intervals between the positive flanks (leading
Figure 10. Switching signals during rotation.
edges). The Arduino has a simple timekeeping function by the
name of millis(). This returns the time elapsed since the last
Reset operation in milliseconds. In this way you can measure
the interval between two heartbeats. The program (Listing 3) long waiting. It does nevertheless happen that a pulse can go
indicates the pulse time in ms and the pulse rate in beats missing, even after slight movement, which can then lead to
per minute on the LCD of the Elektor Extension Shield [6]. double or threefold pulse timings. This is why measurements
The frequency is calculated from the pulse duration for each are output only when the pulse frequency is greater than 45
individual heartbeat, meaning that you don’t have to spend beats per minute.
‘----------------------------------------
U = U + D
‘Pulse.BAS ADC2, LCD
Ticks = Ticks + 1
‘----------------------------------------
U1 = D - Du
If U1 > 0 And U2 < 0 Then
...
T = Ticks * 10
F = 60000 / T
Config Timer0 = Timer , Prescale = 1024
Ticks = 0
On Ovf0 Tim0_isr
If F > 45 Then
Enable Timer0
Print T
Enable Interrupts
Print F
Locate 1 , 1
...
Lcd T
Lcd “ ms “
Do
Locate 2 , 1
Loop
Lcd F
Lcd “ /min “
Tim0_isr:
End If
Timer0 = 100 ‘10ms
End If
D = Getadc(2)
U2 = U1
Du = U / 40
Return
U = U - Du
Measuring pulses with Bascom surement errors caused by missing pulses and outputting to
In Bascom you have to sort out time measurement on your own the Terminal and the LCD. The end product is a Bascom pulse
because there is no permanent timekeeping process running in meter with extremely similar characteristics to those of the
the background, only whatever you arrange yourself. A Timer Arduino project.
Interrupt works well for this. Here we are using Timer 0 for Anyone who has battled with a computer mouse of the older
the timekeeping. The Interrupt routine is invoked every 10 ms, design will have encountered the type of light barrier used for
meaning that you can assess time to this level of resolution. measuring rotation. The crucial factor is that you can detect not
With Interrupts comes precision. In this case it means that only impulses but also (using two light barriers) the direction
that the voltage measurements are also carried out by the of rotation. The two light barriers are arranged so that rotation
Interrupt. This has the advantage that they take place in ext- produces squarewave pulses offset in phase by 90 degrees.
remely accurate 10 ms tempo, eliminating any potential AC The same signals are produced by the rotary encoder in the
line frequency (50 or 60 Hz) interference. Sensor Kit (Figure 9). However, instead of using light barriers,
For an ATmega 10 ms represent a long time and that means the encoder employs mechanical contacts. It also has clearly
the entire analysis can be carried out in the (Listing 4). As in detectable mechanical detents, enabling you to feel, track and
the Arduino model above, this involves generating the moving count each step made. A complete rotation covers 20 steps
average, identifying the pulse edges (flanks), eliminating mea- by the way. Twenty may not sound plentiful but since there
...
New2 = Pinc.4
If New2 = 0 And Old2 = 1 Then
Do
If Pinc.5 = 0 Then D2 = D2 + 1 Else D2 = D2 -1
New1 = Pinc.0
If D2 > 1023 Then D2 = 1023
If New1 = 0 And Old1 = 1 Then
If D2 < 0 Then D2 = 0
If Pinc.1 = 0 Then D1 = D1 + 1 Else D1 = D1 -1
Pwm1b = D2
If D1 > 1023 Then D1 = 1023
Print D2
If D1 < 0 Then D1 = 0
Locate 2 , 1
Pwm1a = D1
Lcd D2
Print D1
End If
Locate 1 , 1
Old2 = New2
Lcd D1
Loop
C L U
G
sion Shield. Because all contacts are at GND potential no con-
X
N
E
UN V E I L I
flict arises. But in an emergency you could transpose the first
output value d1 with the pressbuttons. S1 would then provide
the Clock signal and S2 the direction of rotation.
We connect the second encoder to A4 and A5. On the Arduino it Board
e n ewe st Pa naVise Circu
the corresponding Portpins are brought out twice, the second of th rs
ed for Make
time diagonally opposite as SDA and SCL of the I2C interface. Holder design
Nearby there is also a GND Pin. What is missing, however, is
an additional 5 V connection, which we need for the pullups on
the encoder. No problem, however, as we switch Pin 13 HIGH,
See it at...
to which the Arduino LED is also connected. This is always a MAKER FAIRE
solution: whenever you are short of a GND or VCC connection, BAY AREA
just program a Portpin for this purpose. 2017
May 19-21
Encoding in Bascom
The Bascom version of the program is constructed almost
identically. You can switch between languages by mutually
accepting the source code, retaining the Variable names, and
revising only the specific syntax properties. In the end result
there is only one real difference: in Bascom you normally use
the two PWM outputs of Timer1 with 10-bit resolution, meaning
you now have 1023 steps and a step width of around 5 mV.
Two precisely adjustable PWM outputs, which almost scream
NEW
out for an experiment on the theme of bridge output stages, Model
201
especially since the two PWM signals originate from the same Innovative Holding Solutions
timer and have precisely matching pulses with synchronized
leading edges. A green and a red LED can be connected in
By Neil Gruending (Canada) side of the gap to be electrochemically still 20 of them still on the moon in the
transferred to the cathode side which descent module.
Coulometers are almost everywhere, made the gap to move towards the anode. Mercury coulometers do have some
quietly measuring the coulombs going Reversing the current will also reverse drawbacks though. The obvious one is
in and out of battery packs and estimat- the gap. The rate of movement is pro- that a large impact or shock can damage
ing the remaining battery capacity. Like portional to the amount of current and the capillary tube or disturb the electro-
most modern solutions they are imple- the distance moved shows the current lyte solution in the gap which can prevent
mented as an integrated circuit which over time. This behavior is what makes the meter from working properly, espe-
why I was intrigued when I read a thread
on the ‘TekScopes’ mailing list about a
mercury coulometer
that was being used as
an elapsed time counter
to estimate the amount
of time that a piece of
test equipment was on.
4
You would never know
they were there unless
you looked inside so 3
let’s take a closer look cially if the mercury leaks out. Another
at these impressive issue is that if the solution gets to the
devices. end of the tube then it can dissolve the
it a coulomb meter and also makes them electrode and cause a leak.
Mercury coulometers were originally suitable as an elapsed time counter.
designed and manufactured by Curtis No one manufactures mercury coulome-
Instruments in 1961 and remained in The simple design of the coulometer ters in North America anymore so unless
production until 2011. The coulometers means that it is very lightweight and you find one in a piece of equipment
were made from a glass capillary tube very shock resistant. It also makes them somewhere (Figures 2, 3, 4) they are
that was filled with liquid mercury at each very flexible because the total number hard to find. However, it is possible to
end and had a small amount of electrolyte of counted coulombs is fixed so the cur- find Russian versions available occasion-
solution between them making a small rent defined the total number of hours ally on EBay if you would like to get your
gap that formed the indicator as shown counted which was usually in the 1000’s hands on one — just be careful with the
in Figure 1. Electrodes were attached to of hours. These properties meant that mercury.
the ends of the tube so that current would mercury coulometers were used in some (160178)
Image sources
flow when a voltage is applied. The cur- interesting places like timers in the Apollo
(1) globalepower; (2) AskElectronics;(3) Octopart; (4) 4hv.
rent triggered the mercury on the anode Lunar Landing module. In fact, there are
Electronic devices often operate at well an inverter that provides my mini-office and low-cost, but precise and effective
below their maximum load for most of with 230 V from my 12 V solar installa- way to modify the devices to solve the
the time, and as a result a continuous- tion, and a rather old digital oscilloscope. problem. With just a few components it is
ly-operating fan is considerably more of a Both units work well, but nevertheless possible to add a simple controller to an
nuisance than it needs to be. In my small are continuously whirring away. off-the-shelf 12 V DC fan that is so small
workshop, for example, I have two such As an engineer, this naturally prompted that it can easily be fitted into almost
sources of irritating background noise: me to turn my hand to finding a simple any equipment. The project has a wide
8
ATtiny45
4 AT tiny, and LED warning indicator, a few
GND
VCC
Software
Of course, the ATtiny needs some soft-
ware in order for it to do its job. The
firmware must be programmed into the
device using a suitable external pro-
gramming adapter before it is fitted to
the board. It is therefore a good idea to
use a socket for the microcontroller so
that if necessary it can be removed to
have its software update at a later date
if necessary.
Ukule-LED
serially
addressable LEDs as
ukulele learning tool
USB ATmega1284P 5V 5V 5V
(Custom PCB) NeoPixel NeoPixel NeoPixel
R Mini PCB Mini PCB Mini PCB
TXD0 #1 #2 #16
PORTA.0 Din Dout Din Dout Din Dout
RXD0 330R
Serial C
Cable GND GND GND
100u
GND
Figure 1. This is a closeup of the completed Figure 2. This is a schematic of all of the ukule-LED hardware. This includes the microcontroller, the
ukule-LED fretboard. The 16 RGB LEDs are RGB LEDs, and the serial connection to the user’s PC.
connected in series and connected to a single
microcontroller I/O pin.
WS2812Bs are driven serially, using a there was about 1-2 millimeters of space
Features very timing-sensitive 1-Wire protocol, between each of the four PCBs placed in
• RGB-LED-driven music learning with the data output, power, and ground each groove in the ukulele’s fretboard.
system pins of one connected to the data input, Next, we wired these four groups using
• Play and Practice modes power, and ground pin of the next. The longer lengths of wire. Finally, we hooked
• Easy-to-understand file format data input pin of the first LED is con- all 16 NeoPixel PCBs to the main solder
nected to an I/O pin on the microcontrol- board with three long lengths of wire.
ler through a 330 Ω resistor to protect Our next task was adequately power-
Hardware the first LED from any voltage spikes. ing the LEDs. Because we only powered
We decided to use Atmel’s ATmega1284P As an additional protection, there is a four LEDs at a time and did not run them
microcontroller for this project because 100 µF capacitor between the power at maximum intensity, we could drive
it has the two 16-bit timers we needed and ground lines to prevent large inrush the RGB LEDs using the microcontrol-
for our project. One was used for task currents from destroying the first LED ler’s VCC pin instead of resorting to an
scheduling, and the other was used to (according to Adafruit’s NeoPixel PCB external power source. In the end, we
keep time for the music. Additionally, documentation [3]). only needed to use a 9 V power supply
we used Bruce Land’s custom PCB for Soldering the RGB LEDs together was the to power the entire system. A schematic
the ATmega1284P [2], which includes most time-consuming part of building of the electronics involved in ukule-LED
an external crystal, an LED, and a power ukule-LED. Each of the sixteen NeoPixel is shown in Figure 2.
regulator, among other components. This PCBs needed to be individually soldered. Finally, we connected all of the electrical
made interfacing with the microcontroller We used very short lengths of wire, sol- components — the microcontroller, the
easy. The Elektor Platino board can also dered to the pads on the PCBs, such that LED circuitry, the power circuitry, and
be used with the ATmega1284P.
To prepare the ukulele, we used a Dremel
tool to cut grooves in the ukulele’s fret-
board to accommodate the LEDs. Crit-
ically, we had to keep all the fret wires
intact and keep the LEDs below them
in order to maintain playability of the
ukulele. Otherwise, the LEDs, not the
fret wires, would stop the string, pulling
notes out of tune. We hot glued four sets
of four LEDs to the grooves in the fret-
board, one for each of the first four frets
on each of the four strings. Figure 1
shows the completed ukulele fretboard.
We used Adafruit’s NeoPixel Mini PCBs,
each of which includes a WS2812B RGB
LED. All of the RGB LEDs are driven Figure 3. This is the solder board, taped to the bottom of the ukulele. It contains all of the auxiliary
from a single microcontroller I/O pin. components used to drive the LEDs and the serial communication.
switched outputs 60 minutes or so. No particular difficulties board components (and no SMDs) are
with N-channel MOS- are expected, especially as only through- used.
FETs. Although the buzzer
connected to K2 draws very lit-
tle current (in the region of 5 mA
VCC
at this low operating voltage according
VCC
to type), making a BS170 small-signal K5 K3
3
switching transistor fully adequate, the 2
VCC/2
MOSFETs for the two high-power LEDs 1
T2
of the strobe lights connected to
R4
K3 and K4 are another matter. 1k
These two IRF540 devices (in T3
IRF540
VCC/2 R2
TO220 packages) handle high 100R
K2 R3
currents flowing through the VCC/2
BC547C
1R
3
pack (using at least two LiPo cells) via
its balancer connection cable [2]. A T4
void measureBattery() {
batteryVoltage = readVcc();
if (batteryVoltage >= 3800) { //more than 3.7V: battery full
ledBlink(3);
}
if (batteryVoltage >= 3500 && batteryVoltage < 3800) { //between 3.3V and 3.7V, apparently there is a
small ofset
ledBlink(2);
}
if (batteryVoltage < 3500) { //less than 3.4V: battery empty
ledBlink(1);
}
}
long readVcc() {
// Read 1.1V reference against AVcc
// first set the reference to Vcc and the measurement to the internal 1.1V reference
...
#elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
ADMUX = _BV(MUX3) | _BV(MUX2);
...
delay(2); // Wait for Vref to settle
uint8_t low = ADCL; // must read ADCL first - it then locks ADCH
uint8_t high = ADCH; // unlocks both
Web Links
[1] www.faa.gov/documentLibrary/media/Advisory_Circular/AC_20-30B.pdf;
www.buzer.de/s1.htm?g=luftvoanl_1&a=1-6; https://en.wikipedia.org/wiki/Navigation_light
[2] http://cache.freescale.com/files/32bit/doc/app_note/AN4428.pdf
[3] www.elektormagazine.com/130111
buzzers that whisper with just 72 dB and his electric glider with a wingspan of plus a slider switch for controlling the
also those that produce a loud alarm tone 4.5 meters (some 14 feet). The mod- flasher and the other functions.
of more than 105 dB under identical con- el’s first test flight with the strobe indi- I would be very pleased to receive feed-
ditions! In this respect the acoustic range cator will follow soon afterwards. At the back from anyone who replicates these
can be optimized by skillful selection. moment I am keeping busy by expanding flashers in their various versions. Fur-
the flasher to six functions. For this the ther suggestions and improvement ideas
Ideas for expansion flasher uses two servo connections on the would be extremely welcome too.
A little while back I built a larger lighting receiver. At the transmitter we use one (130111)
system for an aeromodelling friend. This 3-position switch
enabled us to control additional LEDs,
such as always-on red and green navi-
gation lights as well as the intermittent
ACL lights. Two white LEDs can be acti-
vated as strobe lights and a buzzer is
also provided.
To accommodate this, the functions of
the switch on the remote control have
been altered slightly. In position 1 the
strobe circuitry is deactivated, in
center position all the LEDs are
functional as stipulated by
regulations (with the
buzzer inactive) and
in position 3 the
flashing LEDs
are off and
the buzzer from the store
switched on. ª130111-1
Bare PCB
Bright prospects
ª130111-41
Right now an RC flight Programmed microcontroller
colleague is incorporating
these enhanced strobe lights in
By Tessel Renzenbrink maker. On the forum the maker sent the following message to
user Martin: “Your device with ID number 2f0036… has been
denied access to the server. Your only option is to send the
device back to Amazon.com and request a refund.”
cents, please.”
open. It said, “Five
The door refused to A web of relationships
thing. “I’ll
ts. No more coins; no
He searched his pocke With the advent of smart devices, a fundamental change has
ain he tried the
he told the door. Ag
pay you tomorrow,” taken place in the relationship between producers and con-
t I pay you,”
ed locked tight. “Wha
knob. Again it remain sumers. In the traditional scenario, buying a product is a one-
ty; I don’t
the nature of a gratui
he informed it, “is in time transaction: you buy a refrigerator, have it delivered to
have to pay you.” your home, and plug in the power cord. During the next ten
in the purchase
the door said. “Look years you don’t have to give a second thought to the refriger-
“I think otherwise,”
s conapt.”
when you bought thi ator, and you have no further contact with the vendor or the
contract you signed
since signing it
found the contract; manufacturer.
In his desk drawer he
document many By contrast, with smart products you enter into a long-term
sary to refer to the
he had found it neces
or for opening relationship with the manufacturer and/or vendor. Instead of
; payment to his do
times. Sure enough
. Not a tip. buying a product, you purchase a product service package. Part
uted a mandatory fee
and shutting constit
sounded smug. of this service, for example, could be maintaining the cloud
ht,” the door said. It
“You discover I’m rig platform that supports your smart refrigerator. This means you
ip got a stainless
side the sink Joe Ch
From the drawer be have to trust that the refrigerator manufacturer will actually
to unscrew
began systematically
steel knife; with it he keep the server up and running for those ten years. In many
ing door.
his apt’s money-gulp
the bolt assembly of cases there is more than one party involved, resulting in a
t scr ew fell out.
or said as the firs complex web of relationships. For their part, the manufacturer
“I’ll sue you,” the do
is dependent on the external developer of the cloud platform.
They have to stay solvent for the duration of the relationship.
– Philip K. Dick, Ubik.
You are also dependent on regular firmware updates to ensure
that your refrigerator does not become unsafe or unusable. This
already happens now with many smartphones, which despite
What do you actually get when you buy a smart device? Are having perfectly serviceable hardware become obsolete because
you giving uninvited guests access to your home when you the operating system is no longer supported.
replace your dumb devices by smart devices? In the science And what happens with the data that your device collects?
fiction novel Ubik by Philip K. Dick, the main character Joe Chip Recently the smart TV manufacturer Vizio had to pay a hefty
is constantly running into smart objects that demand some- fine because they sold the viewing profiles of 11 million cus-
thing from him before he can use them. That was a fanciful tomers to another party. Incidentally, the fine was not imposed
notion when the book was published in 1969, but now in 2017 simply because they sold the data, but because they did not
it looks prophetic. first inform the viewers.
This book will not only familiarize you with the world of Arduino Today there is a re-emerging, nostalgic interest in vinyl This high-quality sensor kit has been specially developed for
but it will also teach you how to program microcontrollers in records and associated music entertainment gear. With the most common open-source platforms. It is compatible
general. Having completed this fun and playful course, you this interest, there is a paralleled market for the repair of with single-board computers (Raspberry Pi, Banana
will be able to program any microcontroller, tackling and this gear. The intention of this book is to offer the reader Pi, CubieBoard, CubieTruck, Beaglebone, pcDuino) and
mastering I/O, memory, interrupts, communication (serial, understandings, ideas and solutions from the perspective microcontrollers (Arduino, ATmega, AVR, PIC, STM32, etc.). It
I²C, SPI, 1-wire, SMBus), A/D converter, and more. This third, of a workbench technician and electronics hobbyist. It is a contains a total of 40 different sensors. You can either solder
extended and revised edition contains two new chapters: AVR descriptive text with many tables of useful data, servicing the sensors or stick them on a board to work on different
Playground and Elektor Uno R4. tips and supplementary notes of not so common knowledge. circuits or experiments.
member price: £32.95 • €38.66 • US $43 member price: £22.95 • €26.95 • US $30 member price: £60.95 • €71.96 • US $79
+
If you really want to build some innovative projects it’s often
necessary to get down to component level. This can present
many beginners with major problems. That is exactly where
this book begins. It explains how a wide variety of practical
projects can be built using items supplied
in a single kit together with the Arduino
board. This kit, called the ‘RFID Starter Kit
for Arduino Uno’ is not just limited to RFID
applications but contains more than 30
components, devices and modules covering
all areas of modern electronics.
The StromPi 2 expansion board gives your Raspberry Every mobile phone in the world has a GSM/GPRS modem This supercool gadget built around an Arduino Uno writes the
Pi the flexibility to be deployed in a much wider range of which enables the phone to communicate with the world time into a layer of sand. After an adjustable time the sand is
environments such as vehicular, marine, truck and industrial outside. These modems enable the phone to establish audio flattened out by two vibration motors and everything begins
plant etc. On top of this, the Raspberry Pi USB outputs can be conversations, send and receive messages and connect to the all over again. This kit contains everything to build this sand
optionally upgraded to a high-power USB port; this allows the Internet. This book is aimed at people who want to learn clock by yourself: all mechanical parts, the motors, an Arduino
system to use power-intensive peripherals such as USB hard how to use the GSM/GPRS modems in microcontroller based Uno, a special RTC/driver shield, a power adapter and even a
drives without limitation. projects. Two types of popular microcontroller families are small bag with sand.
considered in the book: PIC microcontrollers, and the Arduino.
member price: £22.95 • €26.96 • US $30 member price: £34.95 • €26.95 • US $30 member price: £91.95 • €107.96 • US $119
Prize Winners
The solution of Hexadoku in edition 3/2017 (May & June) is: 1E709.
The €50 / £40 / $70 book vouchers have been awarded to: Vincent Pierdominici (USA); Ariaan Hoed (Belgium);
Nikos Chararas (Austria); Guy Savage (UK); and Jean Thevenoux (France).
Congratulations everyone!
5 E F 4 7 A
1 8
7 4 E 3 C
8 6
C 3 8 7 E B
A 5 4 3 2 F
2 D 0 A 5
3 1 5 B 8 6 C E 0
9 6 3 C D 1 0 F 2 B 4
3 1 C 2 7 F 8 B
7 A F C D B E 4 2 9
8 1 A 4 B D
B 1 9 3 E 4 0
9 F 1
A C 5 0 9 8
6 3
E D 4 6
C 3 7 2
The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.
The Core Independent Peripherals (CIPs) in Microchip’s PIC18F “K40” family of 8-bit PIC®
MCUs support filtering and signal analysis for advanced touch and signal-conditioning
applications.
www.microchip.com/EUPIC18FK40
The Microchip name and logo, the Microchip logo, MPLAB and PIC are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. All other trademarks mentioned herein are the property of
their respective companies. © 2016 Microchip Technology Inc. All rights reserved. DS30010138A. MEC2125Eng11/16