02elek18 PDF
02elek18 PDF
02elek18 PDF
www.elektormagazine.com
ESP32
Design Contest 2018
Platino “Fits-All”
Serial Bus Tester
Debug serial comms issues
with ease
€2500*
in prizes
* or equivalent in £ / US$
Electromagnetic
submit your application
Interference
from LED Lamps and win!
Fourteen examples compared
BASIC and the Embedded World • Chimes for the Elektor Sand Clock • A Cloud
in the Shape of a Raspberry • Current Transformer for Oscilloscopes • DCF77
Emulator with ESP8266 • Electromagnetic Interference from LED Lamps •
Elektor Store • Elektor Video Olympics • Engraving Machines under Test • Err-
lectronics • ESP32 Design Contest 2018 • ESP32 Low Power • From Russia with
Love • Hexadoku • Homelab Helicopter • Internet Censorship during the Catalan
Referendum • KiCAD • Measurement Data Acquisition via USB • Multi-Timer •
Platino “Fits-All” Serial Bus Tester • Powerbank Surprise • Q & A: Nixie tubes •
Remote Water Level Meter • Retronics: HP650A Test Oscillator (ca. 1948) • RF
RF Power Meter Power Meter • A Simple Digital Audio Amplifier • Soft Start for PSU • Supercaps
For measurements • Tektronix Readout System • Temperature Logger Hack • Timers for the Wi-Fi
up to 10 GHz Desktop Thermostat • Universal USB Charge Controller Chip • … and more
Elektor Magazine
Edition 2/2018
Volume 44, No. 488
March & April 2018
www.elektor.com
www.elektormagazine.com
Solid advice
Elektor Magazine, English edition
is published 6 times a year by
Regulars Shape of a
21 Peculiar Parts, the series
Tektronix Readout System
48 Q & A
Raspberry
Everything (almost) you need to know
about Nixie tubes install a cloud
61 Homelab Helicopter
Remarkable items spotted for the home
electronics enthusiast
in your living room
80 Tips & Tricks
Temperature Logger hack
122 Err-lectronics
Corrections, Feedback and Updates on
Electromagnetic Interference
projects published from LED Lamps
123 Retronics:
HP650A Test Oscillator (ca. 1948)
Fourteen examples compared
12
From ‘boat anchor’ to pristine sine-wave For more than a hundred years
‘artificial light’ has almost
126 Elektor Ethics
exclusively meant incandescent
Internet Censorship
lamps. However, the relatively
during the Catalan Referendum
low output of incandescent
128 Elektor Store lamps has been criticized and
has ultimately led to their
130 Hexadoku
being banned in the EU. Low-
The original Elektorized Sudoku
energy fluorescent lamps are
certainly more efficient, but they
do not work well when turned on
ESP32
30 STORE Highlight: From Russia with Love
400+ circuits on 400 pages
51 Engraving Machines under Test
Are low-cost laser engravers from China Projects
good value for money?
60 ESP32 Design Contest 2018 8 Universal USB Charge Controller Chip
Participate in the contest! No microcontroller, just 6 pins
64 KiCAD 22 DCF77 Emulator with ESP8266
Community-powered PCB design Replace over-air time by Internet time
94 Supercaps 26 Multi-Timer
Low voltage but lots of current… or not? Switches up to 16 channels
€250z0es
98 Powerbank Surprise 32 ESP32 Low Power
*
ri £ / US$
Is there a design fault?
in qp
Programming the ULP coprocessor
in
uivalent
* or e
72
100 Timers for the Wi-Fi Desktop Thermostat
Seven channels with atomic accuracy
103 A Simple Digital Audio Amplifier
Using a CMOS IC in an analogue circuit
106 Measurement Data Acquisition via USB
For heating system optimization
42
112 BASIC and the Embedded World
Set to work with a PICAXE
RF Power Meter 116 Current Transformer for Oscilloscopes
Potential-free (floating) measurement
For measurements up to 10 GHz using current clamp techniques
Radio remote controls for model aircraft
and similar devices are rightly subject to
strict regulations. They govern not only
the transmit frequency, but also (and
primarily) the transmitter power
output. With the RF power meter
described here, you can easily Next Editions
check how much power
you are transmitting,
at frequencies up to Elektor Magazine 3/2018
10 GHz. Cross-Platform Basic-Compilers • LoRa Telemetry Pro-
jects • Floranium • Interference from LED Strings •
DAB/DAB+ Radio with RTL-SDR (RTL2832U) • Analogue
alternating linear LED Fader • Universal I2C Bus Isola-
tor and Level Adapter • Audio DAC Update • GPS-based
10MHz Reference • CPLD DIL Board • Remembering the
SN76477.
Contest 2018
Elektor Business Edition issue 2 / 2018 has a focus on
39 Chimes for the Elektor Sand Clock Industry 4.0 and Automation. Among the contribu-
Shake, rattle and beep tors are companies and research institutions including
Microchip, Mathworks, Atollic, AEG Power Solutions, Uni-
42 RF Power Meter
tronic, LoRa Alliance, SecureRF, OSRAM, and Avnet Silica.
For measurements up to 10 GHz
Plus you’ll find fresh instalments of all the EBM regulars
56 Soft Start for PSU like Infographics, Operation Marketing, Our Business,
Be nice to your power supply — and its load and Business Store.
72 A Cloud in the Shape of a Raspberry
60
Elektor Business Edition issue 2 / 2018 is published on
Install a cloud in your living room
11 April 2018 to Elektor Gold members in print, and Elektor Green
82 Remote Water Level Meter members as a pdf download. The edition is also available for
For a precious commodity purchase at www.elektormagazine.com.
In the September & October 2017 issue of Elektor we announced, with high expectations, the Elektor Video
Olympics — and challenged all Elektorians to make a video about an Elektor project and send it in. To make it
especially attractive for participants we also organised a number of spectacular prizes...
Now, were we surprised! We received a total of, count them, award the first (and biggest) three from the available prizes
an unbelievable four (say, four!) entries, one of which we – it was originally the intention of the jury to make their
had to disqualify immediately (see below). Apparently Elek- selection from those fifteen entries that received the most
tor readers rather spend time with a soldering iron than ‘likes’. After considerable deliberation the Jury has decided
with a video camera. to award the prizes as follows:
Considering the low response rate it was decided to only
Grand prize
The entry ‘Direct Current Traction — Elektor Teslameter on Traction’ from Mark van Helvoort (Netherlands)
has been viewed more than 1000 times. In this video Mark demonstrates that the Dutch trains, which run
on direct current, can cause interference in other circuits and
devices. He used the Elektor Teslameter for this, which was
published in the January 1997 issue of Elektor. By the way,
the Grand Prize is a Dremel 3D Idea Builder 3D40, a fancy
3D-printer with a retail value of €1449.
Second prize
In his video ‘Elektor Scherzartikel’ Rainer Schuster (Germany) takes a
closer look at a few of the famous (or infamous) ‘joke circuits’ that the
Elektor editors used in the seventies and eighties of the previous
century to liven-up the annual Summer Circuits editions. The
entry from Rainer has been viewed more than 400 times.
Especially our Retronics editor Jan Buiting was enamoured by
this entry. And for
those that do not
recall: the second
prize is a LabNation
SmartScope Maker Kit
with a retail value of
€300.
Ineligible
All employees from Elektor wish the winners much enjoyment with their prizes!
No correspondence will be entered into about the outcome.
(160562)
When designing systems with microcontrollers, SoCs, LCDs and touch screens it’s often useful to incorporate
a cheap Tablet or smartphone. In this sort of setup you need to think about power provision to keep the
smart device charged up. Anyone starting out to make their own charger soon learns that it’s not so simple.
Just connecting the charger output to ground and +5 V pins of the USB socket isn’t enough. There are at
least half a dozen different charging specifications. When the charger doesn’t provide the necessary states on
the USB data lines the charging process fails. Help is at hand in the form of a tiny chip with 6 legs.
Building your own 5 V charger for mobile devices is not quite Specification chaos
as easy as you may think. Mobile devices are really fussy about When designing a charger it is not such a sensible approach
how the charger responds to them; they expect more than just to build one that only conforms to the appropriate charging
regulated power at 5 V. It’s a triumph of common sense that specification for the smart device you happen to be using at
today almost all mobile devices can be charged from a standard the moment. The device can quickly become obsolete; you
5 V USB charger (see the collection in Figure 1), but nowadays, replace it with a new device and find that the old charger is
in addition to power, the USB data lines must also be correctly incompatible. It’s much better when you can design an (almost)
terminated by the charger or the mobile device will refuse to universal charger, able to provide the correct electrical signa-
charge. As can be seen in Figure 2 some manufacturers have tures and charge any mobile device.
their own ideas about how the data lines must be terminated There are different ways in which such an intelligent USB char-
which is not especially helpful and just adds to the confusion. ger can be built without using a dedicated microcontroller.
STANDARD USB
HOST CHARGING DEDICATED
DOWNSTREAM PORT APPLE SONY CHARGER
VLOAD PU VBUS VBUS VBUS
3V6 5V0 5V0 5V0
D+ ~ 0V22 D+ 2V D+ 3V3 D+
Figure 1. A collection of USB chargers. Clockwise from upper left: Apple Figure 2. Take your pick: Manufacturers have their own ideas how the
10-W iPad charger, Apple 5-W iPhone charger, Logitech 5-W charger, USB data lines should be terminated.
Noname 5-W charger.
USB Connector
If you plan to use it in your own design it’s sufficient to know DM1 6
D–
DM1 6
D–
TPS2513, TPS2513,
that it supplies signals on the data lines to tell the mobile device TPS2514 D+ TPS2514 D+
DP1 1 DP1 1
whether the charger is capable of supplying 5 watts (standard GND GND
charge) or 10 watts (power charge) to the device (Figure 4).
The TPS251xx series of devices only connect to the USB data
lines so the data sheet does not go into any detail about
charging voltage or current limiting. TI also produces the Figure 4. Depending on the connection the IC indicates to the mobile
TPS2561A dual-channel power distribution switch which may device if the charger can supply 5 or 10 watts.
also be a device worth considering for any engineer working
on a USB charger design. This connects to the USB power pin
and switches the charging current. Further details of its appli-
cation are outside the scope of this article. In our case the
general rule is: The charger must be capable of supplying the
corresponding power level (as indicated by the TPS251x) to
charge the mobile device.
Testing
The chip has just 6 legs and is only available from TI in an
SMD SOT23 package. Its tiny size makes it difficult to work
with in a prototyping environment. The best solution is to fix
the chip to a small break-out board so you can plug it in and
out without worrying about re-soldering, solder splashes and
short circuits. The author used a standard adapter board from
Aries (Figure 5).
The next step is to mount the module onto perf board using
two 3-way female header strips then fit the USB socket. Note Figure 5. Break-out-board for the SOT23 SMD-package from Aries fitted
that most USB sockets have mounting tabs requiring larger with the IC from TI.
charge mode.
Continuous Current
Next the author tried a Kindle Fire, the supply current read- 1.0 Regulation Allowed
ing between 1.6 and 1.8 A indicated that the Kindle was also VBUS
Current-Limit Trip
turned
happy with the power offered by the charger. off Operation Allowed
0
0 0.5 1.0 1.5 2.0 0.5
Troubleshooting Ampere
Circuits that include USB port connections can be a source
of trouble. Often the problem can be traced back to the rela- Figure 6. Template showing specified charging parameters for a USB
tively tight specification regarding USB voltage levels. Charging charger.
in power mode passes 2 A which can produce unacceptable
voltage drops through flaky connectors, thin PCB tracks and
skinny cables.
For his application it was important from the point-of-view of
Kick out the terminal blocks! system future-proofing and flexibility that the charger design
Use a terminal block in the USB wiring hookup and you will was compatible with the widest possible range of connected
introduce a voltage drop of a few hundred millivolts when the hardware. Incorporating a TI TRS-251xx series of charger port
charge current ramps up to fast charge mode. The device on controllers into a USB charger design ensures it will be com-
charge will recognize the voltage drop and switch to slow-charge patible with all the most important industry standards.
mode or stop charging altogether (see Figure 6).
(160360)
Use good quality cables
Web Links
One of my niggles is the poor quality of many MicroUSB cables.
Long thin cables introduce too much voltage drop which causes [1] http://composter.com.ua/documents/BC1.2_FINAL.pdf
the device to switch to slow-charge mode. [2] http://goo.gl/wxSyJV
Conclusion
When designing a USB charger just for one specific piece of
equipment you may not consider it worthwhile to incorporate
a dedicated charging port controller such as the TI TPS251xx.
As was pointed out in the beginning, the extra work required
to incorporate the chip into the design is not too onerous and
these chips are priced at around €2, which is not excessive.
What you gain is greater flexibility and a charger with more
universal application. For the author it proved a worthwhile
from the store
investment in the system design he is currently developing. ªUSB breakout board for Experimenting with USB
The setup uses a process computer to transfer information to www.elektor.com/usb-breakout
a standard tablet via Wi-Fi.
C O NDITIO NS:
H A R S H
LTS – A LSO IN
OPTIMAL RE
SU
LT I M E T E R S
I G I TA L M U
NEW D
Robust digital multimeter
with LED light
Ideal for daily field use in the service, construction
and industrial sectors, as well as for the ambitious
home user.
60.
Order no.: PEAKTECH 3443
23
Continuity check with buzzer and
diode test
E USED
NEW
CAN ALSO B
RKNESS!
IN TOTAL DA
Illuminated keypad +
integr. work light:
PEAKTECH 3443 and
PEAKTECH 3445
82.82 238.55
Order no.: PEAKTECH 3445 Bestell-Nr.: PEAKTECH
KTECH 1265
NEW BEST
Smartphone not included SELLER
www.reichelt.co.uk
The statutory cancellation provisions apply. All prices are stated in £ plus statutory value added tax,
plus shipping charges for the entire shopping basket. Our Terms and Conditions (available at www.
reichelt.com/agb, in the catalogue or on request) apply exclusively. Actual appearance of products
may differ from photos. We accept no liability for misprints or errors; prices subject to change.
reichelt elektronik GmbH & Co. KG, Elektronikring 1, 26452 Sande (Germany), Phone: +44 203 808 95 25 ORDER HOTLINE: +44 203 808 95 25
Electromagnetic
Interference
from LED Lamps
Fourteen examples compared
By Alfred Rosenkränzer (Germany)
8 9 10 11 12 13 14
Signs of trouble? German ‘Stiftung Warentest’ consumer 14 lamps provide a sample of the market,
At the beginning of September 2017 product testing organization also looked and include products from well-known
Elektor received a report from a mem- at LED lamps, but not with regard to companies, ‘no name’ brands and the DIY
ber of the German amateur radio club electromagnetic interference. And so it shed’s own-brand products. The sam-
DARC that suggested that significantly falls to Elektor to look at the question in ple is not fully representative but never-
increased levels of electromagnetic inter- more detail: in this article we will take a theless provides a good cross-section of
ference affecting broadcast radio, ama- closer look at 14 LED lamps, and give a what it is possible to buy today. Table 1
teur radio and WLAN signals could be brief guide to how you can find out for gives a list of the lamps we examined,
traced to LED lamps. We took up the yourself to what extent your own LED the main characteristics of each, and a
issue in an article online [1]. The Ger- lamps are polluting the ether, without qualitative indication of the results of our
man-language version of this article the use of large banks of test equipment. testing as a colour (green=good, yel-
alone attracted over 100 000 clicks. low=OK, orange=fair, red=poor).
At the end of 2016 the club published Procedure Of course there is still a lot more to be
on its website a list of various manufac- First we visited IKEA, our local DIY shed, said. Because anyone interested in elec-
turers’ LED lamps along with spectral and the Internet, purchasing a total of tronics will (rightly enough) be keen to
plots [2], and the October 2017 issue of 13 different LED lamps with E27 fittings. know more about the whys and where-
the club magazine ‘CQ DL’ included an To them we added a further lamp sup- fores of our testing, the following pages
article describing the measurements. The plied by an interested colleague. These give more background regarding the mea-
0V Current waveforms
1 Magnetic
field As an experimental control we measured
50
the waveform of the current drawn by a
60 W incandescent bulb. We do not have
50
coil
GND a photo of the lamp itself, but the plots
PE Current
show us what to expect from an inter-
ference-free lamp. Even when the mains
voltage waveform is slightly distorted,
we can see from the voltage (purple)
Figure 2. Test set-up for measuring LED lamps.
and current (yellow) traces in Figure 3
that there is no interference. The trace
sured using a 1 Ω shunt resistor, with a Our arrangement allows us to measure colour scheme is the same in the plots for
further 50 Ω resistor providing impedance current and voltage waveforms safely the LED lamps in Figure 4 to Figure 17.
matching to the connected BNC cable. A and accurately. But we want to go fur- The current waveforms immediately pro-
small mains transformer in parallel with ther than that: we add a suitable receiver vide us with our first surprise. The first
the LED lamp provides a stepped-down coil to measure the stray magnetic field lamp we tested (see Figure 4) exhibits
voltage on its secondary side proportional and an antenna for the electromagnetic sharp current spikes in its current wave-
to the supply voltage. This allows us to field. We will look at these latter two form near the extremes of the voltage
measure interference on the voltage sig- measurements in more detail below. waveform, rather than a smooth sinusoi-
nal, and in particular provides a conve- We are not just interested in the dal or trapezoidal shape. The needle-like
nient way to trigger the oscilloscope. time-domain behaviour of the current spikes correspond to the points in time
Figure 3. Current and voltage traces from the Figure 4. Current and voltage traces from Figure 5. Current and voltage traces from
incandescent bulb. lamp 1. lamp 2. Oh dear!
Figure 6. Current and voltage traces from Figure 7. Current and voltage traces from Figure 8. Current and voltage traces from
lamp 3. lamp 4. lamp 5.
Figure 9. Current and voltage traces from Figure 10. Current and voltage traces from Figure 11. Current and voltage traces from
lamp 6. lamp 7. lamp 8.
Figure 12. Current and voltage traces from Figure 13. Current and voltage traces from Figure 14. Current and voltage traces from
lamp 9. lamp 10. lamp 11.
Figure 15. Current and voltage traces from Figure 16. Current and voltage traces from Figure 17. Current and voltage traces from
lamp 12. lamp 13. lamp 14.
Figure 23. Low-frequency magnetic spectrum Figure 24. Low-frequency magnetic spectrum Figure 25. Low-frequency magnetic spectrum
from lamp 10: looks good. from lamp 12: a series of harmonics. from lamp 2: not exactly great.
Figure 26. High-frequency magnetic spectrum Figure 27. High-frequency magnetic spectrum Figure 28. High-frequency magnetic spectrum
from lamp 10: some noise at higher frequencies. from lamp 13: peaks at 14 MHz and 17 MHz. from lamp 2: it doesn’t look good.
lamp under test as a sensor, and we in the device, which in turn correlates
extended the frequency range we exam- with the effort put into the design. We
ined to 220 MHz. Although the experi- have listed the weight of each lamp in
ments were carried out in a basement Table 1: observe that lamp 5 is actually
room that provided good electromagnetic lighter than the incandescent equivalent.
attenuation, there were still background We used a photodiode to detect whether
signals at several frequencies, as shown the rectified mains frequency (100 Hz)
by the green reference line in our spec- or the switching frequency was present
tral plots. To get useful measurements in the light output of each device: the
for the better specimens among our test results are listed in the column headed Figure 29. Antenna signal near to lamp 11.
set we had to enable the preamplifier ‘Flicker’ in Table 1. Even the incandescent
on the spectrum analyzer. We then saw bulb exhibited a little flickering at 100 Hz.
some interference at 10 MHz from the The light output and power consump-
laptop’s mains power supply; unfortu- tion data in Table 1 are as given by the
nately by this point in the series of tests manufacturers, and from these we have
the machine’s battery was running low. calculated the efficiency in lm/W. The
Two of the lamps produced striking best performers here are lamp 3 and the
results. Figure 29 shows the result from two retro-style lamps, numbers 5 and 6.
lamp 11: a slightly increased level of In no case was the LED’s current wave-
interference above 100 MHz. Again, form sinusoidal. In order to verify that
lamp 2 (Figure 30) puts in the poorest the power figures correspond to reality, Figure 30. Antenna signal near to lamp 2: an
performance. It is practically impossible we tested lamp 1 with a power meter excellent generator of interference.
(a Voltcraft 4500 PRO DE). We mea- lent generator of interference and should and, if applicable, the results will appear
sured the power at 10 W rather than never have graced the supermarket shelf. in an update to this article covering a
the specified 9.5 W, which is accept- We cannot be sure, of course, whether wider range of manufacturers.
ably close. Direct calculations from the this is faulty design or whether our device (160610)
current and voltage waveforms that we is an outlier or defective. Things could
obtained, which should certainly be accu- be worse, however: see the ‘Electronic Web Links
rate enough, also indicate that there are transformers’ text box.
[1] www.elektormagazine.com/news/
no great deviations from the manufac- If you suspect that a LED lamp is caus-
led-rumpus
turers’ claimed figures. ing radio interference, you can follow the
procedure outlined in the ‘EMI testing [2] www.darc.de/der-club/referate/emv/
Conclusion using a radio’ text box. If you discover konformitaetsmessungen/#c201092
Happily almost all the LED lamps we a rotten apple, please write to Elektor at (in German)
purchased for this test exhibit either no [email protected] with subject line ‘LED [3] www.elektormagazine.com/150577
interference or so little interference that lamp EMI’. If it is a device that has yet [4] www.elektormagazine.com/160610
it can hardly be detected. to be tested then we will pass the details
[5] www.elektormagazine.com/080691
Lamp number 2, however, is an excel- on to the author for further investigation,
Electronic transformers
Every DIY store should really put up a mal conditions for radiating interference.
sign saying ‘Beware of electronic trans- The lack of input smoothing also results
formers’. And no, we are not talking in an enormous 100 Hz component in the
about ‘robots in disguise’! No, we mean output signal: and so we have not just
the devices that are used to power 12-V interference, but an RF carrier modulated
lighting systems, using halogen spotlights six ways to Sunday by a 100-Hz tone.
and more recently spotlights and bulbs The result is a not-so-soothing hum at
employing LEDs. Considering their power the output of any nearby radio receiver.
output they are small, lightweight and Astonishingly there seems to be noth-
cheap. They contain a small switching ing illegal about this set-up, or at least
Figure 32. The spartan interior of a 12-V
power supply, but of a special design as nothing illegal about selling the compo-
electronic transformer.
you will see if you take a second look at nents: electricians will continue to blithely
the photo, which comes from an article install such systems while radio amateurs
by Thomas Scherer in the December 2008 output is a rather brutal squarewave at nearby pull their remaining hair out.
issue of Elektor [5]. 12 Veff (albeit at a frequency of 30 kHz). There is certainly scope for government
The circuit lacks a smoothing capacitor on Connect this output to some spotlights via intervention to prevent these systems
its input and a filter capacitor on its out- a few meters of unshielded cabling behind becoming more widespread.
put. The latter omission explains why the a suspended ceiling and you have opti-
Tektronix needed a
X RANGE
= 40% I E way to display data on
LEFT EDGE (0.5 , 0.5) the CRT for their 7000
(X = 0.1)
series analogue oscil-
loscopes but it was a
Y RANGE
= 40% I E challenge because the
initial oscilloscopes
were analogue-only
DECIMAL BASE LINE designs. Originally they
POINT (Y = 0.1)
(0 , 0) had planned to use
fibre optics to create a
Figure 1. The readout is “drawn” using small display area next
CRT coordinates. to the CRT but then a
(Redrawn from Tekwiki [1]) Tektronix engineer
named Barrie Gilbert
had a better idea: how about drawing the characters directly
on the CRT? His prototype proved the idea so Barry went on
Tektronix 7904A readout board. The row and column decoders are on the
to design the readout system using several custom designed upper left, the timing ICs in the middle and the character generators are
integrated circuits. the right side column. (Image courtesy TekWiki)
Barrie’s solution allowed the oscilloscope plugins to use 2 resis-
tors to select the row and column of the characters to be dis-
played from an 11 × 10 matrix of available characters. Up to Please contribute your Peculiar Parts
10 characters could be arranged into a word which were then article, email [email protected]
displayed in the appropriate CRT area. Timing circuitry assigns
a timeslot to each character which is then decoded to select
the appropriate character generator IC to draw the character The triangle signal is important because it causes the CRT to
onto the CRT. The timing circuitry could also do things like pad draw lines between the points instead of them just appearing
words with zeros or skip words as well. as dots.
The character generator chips use a stroke font of sorts with The design of the character generator is also interesting because
7 strokes per character. A triangle-wave scan signal was used the emitter areas in the mask are the same for different vari-
to activate the CRT XY coordinates (Figure 1) [1] of each ations of the chip. Each area contains a number of emitters of
stroke which activates one of 8 groups of 3 transistors like in equal size that can be connected as needed by only changing
Figure 2, each biased with a constant current Ie. Two of the the metallization layers. That way the same silicon layout could
transistors provided the CRT’s X and Y current signals with be used for all of the variations.
the final transistor directing any unused current to the chip I’m impressed with what Barrie was able to implement with
substrate so that his design and fortunately there are online copies of Tektro-
nix’ excellent service manuals available for their 7000 series
Ie – Ix – Iy – Iz = 0 oscilloscopes with super detail about how the circuitry works
for your enjoyment. There’s also other excellent sources for
information like the TekWiki [2] or the TekScopes mailing list
[3]. Just remember that not all Tektronix 7000 series oscillos-
Ix copes use this design because Tektronix eventually transitioned
Iy
Iz to a digital readout circuit that was used on later models.
(160528)
A B C D E F G H
4 4 0 1 5 4 4 4 0 2 2 2 4 2 2 4 1 5 2 1 7 1 2 7
Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Web Links
IE [1] w140.com/tekwiki/wiki/7000_series_readout_system
[2] w140.com/tekwiki/wiki/Main_Page
Figure 2. Example of a readout cell. (Redrawn from Tekwiki [1]) [3] https://groups.yahoo.com/neo/groups/TekScopes/info
DCF77 Emulator
with ESP8266
Replace over-air time by Internet time
Features
• Always the right time
• Internet connected
• Replaces DCF77 receiver modules
• ESP8266-based
About twenty years ago I recycled and modernised a vintage clock with Nixie tubes built by my father in
the nineteen seventies. I replaced the digital logic by a microcontroller and used a DCF77 receiver module
instead of the original 50-Hz derived timebase.
C3
Transistor T1 will make interfacing the
emulator to your clock slightly easier as it 100n
3k3
3k3
2
VCC
DCF77 clock. Collector resistor R4 may 6
CH_PD
be omitted if the clock at hand already T1
R2
4
RST
5
has a pull-up resistor at the input of the K1 47k GPIO2
6 3
GPIO0
DCF77 decoder. 5 BC547 TX 8
RX TX
The DCF77 output signal gets inverted TX
4 RX 1
RX ESP8266
3 7
by T1, but the software fixes this. You JP1 2 GND
ESP-01
2
may need to check the documentation 1 FLASH
WiFi module
DCF
GND
Once the information in the Serial Mon- +
if (PulseArray[PulseCount]==1)
itor is correct, the circuit is ready to be
digitalWrite(LedPin,1);
UART
R5
4
break;
R3
R2
Remove the programming cable from K1 T1
1
digitalWrite(LedPin, 1); DCF77 receiver from your clock. In many
R4
1
C3
break; cases it will be a separate module with
three wires (power, 0 V and DCF77 sig-
Shown here is the active-high version nal). Connect K2 of our circuit to the now
(output normally logic low, pulses are unconnected input of the clock.
logic high). For an active-low output sig- If you want to be sure that the out-
nal (output normally logic high, pulses put of our DCF77 emulator produces a
logic low) invert the ‘0’ and the ‘1’s of valid DCF77 encoded signal, there are
the three digitalWrite commands. numerous Arduino-based (test) projects
on the Internet with DCF77 decoders.
Programming the ESP-01 We tested our prototype with the sketch
Before we continue, an important remark found at [3].
first: never connect power to K2 when (150713)
a USB-to-serial converter is powering
the circuit through K1 (or the other way
around). Disrespecting this No-No will Web Links
short two power supplies, and may dam- [1] www.elektormagazine.com/labs/
age your DCF77 clock, your computer or dcf77-emulator-with-esp8266-
both. Don’t come crying to us. elektor-labs-version-150713
Close jumper JP1 and connect a 3.3-V
FTDI-cable-compatible USB-to-serial
[2] https://github.com/esp8266/ from the store
Arduino
converter between K1 and your com- ª150713-1
[3] https://arduino-hannover. bare DCF77 emulator PCB
puter. JP1 must be closed at power on to
de/2012/06/14/dcf77-empfanger- ª150445-91
switch the ESP-01 module to flash (pro-
mit-arduino-betreiben/ ESP-01 module
gramming) mode. In the Arduino IDE, on
‘Tools’ menu, select ‘Generic ESP8266 [4] www.elektormagazine.com/150713
Multi-Timer
Switches up to 16 channels
By Willem Tak (The Netherlands)
A timer should be a piece of cake for the average electronics It is possible to connect a light sensor that influences the
hobbyist. But once you’ve built a few of them, you’ll be mak- behavior of the timer.
ing the same circuit over and over again for friends and fam-
ily. Not very enjoyable really, and it certainly isn’t much of a Hardware
challenge. The author therefore decided to design a timer “to The circuit for the eight-channel timer is shown in Figure 1.
end all timers” — with a predictable outcome: he is now busy This isn’t overly complex because most of the intelligence is
building the fifth or sixth one, and orders keep coming in. hidden inside the microcontroller. The author has chosen an
18F4685 for the microcontroller, mainly because of its large
To start with: eight channels RAM capacity. The microcontroller runs at 22.1184 MHz in
There are now two versions of the multi-timer: one with eight order to provide a straightforward interface to the GPS unit.
channels and one with sixteen channels. We begin with the This is an EM-408, which can be bought quite cheaply via the
first one. Each of the eight timers drives an output relay. They Internet; it is also possible to use a different receiver, such as the
can be configured independently to turn on within a 24-hour one from the Elektor Store [1]. In any case, the EM-408 requires a
period, with a minimum on-time of 1 minute and a maximum supply voltage of 3.3 V, which necessitates the use of a 74HCT00
of 23 hours and 59 minutes. level-shifter between the receiver and the microcontroller.
It is of course possible to turn on a load several times per day, The OLED display uses a standard interface, and there is no
simply by combining the outputs of several output relays. need to explain this in further detail. The brightness of the dis-
The timer always knows the correct time and date thanks to play can be adjusted using a potentiometer that is connected
the built-in GPS unit. Furthermore, each timer has a select- to the analog input of the microcontroller.
able mode whereby different switch times can be set up during A photocell (Sparkfun SEN-09088) is connected to another
the weekend. analog input; it is used to (amongst other things) turn on an
A combined rotary encoder/switch (Alps EC11B152442D) is LED when the ambient light exceeds a certain level, and turn
used for the operation and configuration of the timer. An OLED it off when it is dark. The light level at which it switches can
display completes the timer. be set using a potentiometer.
+12V IC6
TSR12450
+5V
12V IN OUT
R1
IC5 GND
TSR12433
330R
+3V3 14
IN OUT IC2
C1 GND C2 C3 7 LED1 +5V
R11 R12
+5V
4k7
4k7
+12V
R7 R6 LCD1 17 18 19
NC
MS
M80
10k
10k
11 32 3
VCC +5V
VDD VDD 2
1 15 4 VDD
MCLR RC0 D/C 1
7 16 5 OLED 12864L-SS03 GND
RA5 RC1 R/W 15
J1 P2 2 17 6 GND
+3V3 RA0 RC2 E
GND
20
S1 24 16
+3V3 RC5 RES
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
R8
4k7 18 IC1 19 7 8 9 10 11 12 13 14
RESET RC3 RD0
47k
23 20
RC4 RD1
1 5 21
RD2
ED VCC 9 12 22
4 IC2.C 8 IC2.D 11 26 RD3
TX 10 13 RC7 27
IC4 & & RD4
28
GPS RD5
R10 4 1 29
EM408 3 6 IC2.B 3 IC2.A 25 RD6
RX 1k5 5 2 RC6 30
& & RD7
GND
R9
2 +12V OUT 1
PIC18F4685
3k3
ROTARY S2
ENCODER
10 10 RE1
RE2 +12V
+5V 9 33 1 CD+ 18
RE1 RB0 I1 O1
8 34 2 17 D1
RE0 RB1 I2 O2
R5 35 3 16
RB2 I3 O3
6 36 4 IC3 15
8x OUTPUT STAGE
LDR RA4 RB3 I4 O4 8x RELAIS
SEN-09088 37 5 14 8x DIODE
RB4 I5 O5
3 38 6 ULN2803 13
RA1 RB5 I6 O6
4 39 7 12 OUT 8
RA2 RB6 I7 O7
5 40 8 11
RA3 RB7 I8 O8
GND RE8
P1 R3 R2 VSS OSC1 OSC2 VSS +12V
10k 9
12 13 14 31
330R
330R
X1 D2
R4
3k9
LED3 LED2 C4 C5
18p 18p
150188 - 11
22.1184MHz
+5V
IC8
TSR2433 +3V3 +5V +5V
5V IN OUT
LED5
GND IC3 = 74HCT14 3
14 LD1 LD2 LD3 LD4
R7 R14 VDD
C4 C5 IC3 8 a 7
+3V3 220R RX a a a a
330R
7 6
b b b b b
47u 47u P2 18 5
2k DATA OUT c c c c c
4
d d d d d
K1 IC4 2
14 20 e e e e e
1 IC3.A IC3.B 1 h h h h
+5V R5 VUSB VDD f f f f f
2 15 11 1 2 3 4 10 20
D– 27R RC4/D– RC0 1 1 ENA g g
B h
g
B h
g
B h
g
B h
3 16
h 19
D+ 27R RC5/D+ IC1
4
GND R6 +5V +3V3 IC3.C IC3.D MC14489
9 R15
4k7
24 5 6 9 8 11 B1
USB R8 R9 RB3 1 1 CLK 13
B2
R10 15
4k7
4k7
B3
LDR
IC3.E IC3.F 16
B4
SEN-09088 1 23 13 12 11 10 12 17
MCLR RB2 1 1 DATA IN B5 +5V
+3V3 2
RA0 PIC18F26J50 VSS OUT 16
22 +5V +5V
RB1 14 16
S1 13
P1 RC2 13 VDD 12 CHANNEL 16 RE1
10k
J1 21 INT P7 +5V
R12 R13 RB0 14 11 CHANNEL 15
27 R16 R17 SCL P6
R11 RB6 15 10 CHANNEL 14 D1
SDA P5
10k
10k
28
2k7 IC5
4k7
4k7
RB7 9 CHANNEL 13
3 P4 LED6 R18
7 CHANNEL 12
+V 21 17 25 P3 330R
7 RC6/TX RB4/SCL 1 PCF8574 6 CHANNEL 11
IC2 20 18 26 A0 P2
RC7/RX RB5/SDA 2 5 CHANNEL 10
GPS 4 A1 P1
1 Maestro 3
A2 P0
4 CHANNEL 9
18 4
1650 RA2 +5V VSS
GND GND 5 3
RA3 RA1 8
6 9 7
RA5 16x OUTPUT STAGE
USB CONFIGURED
USB ADDRESSED
12 6 8
RC1 VCAP +5V 16x RELAIS
VCC 16x DIODE
USB ERROR
220R
220R
220R
7 CHANNEL 4
P3
22p 22p 10u 1 PCF8574 6 CHANNEL 3 OUT 1
A0 P2
2 5 CHANNEL 2
A1 P1
3 4 CHANNEL 1 RE16
A2 P0 +5V
VSS
8 D16
LED22 R34
150188 - 12 330R
Figure 3. The circuit for the 16-channel version looks more complex than the ‘smaller’ version, but appearances can be deceptive.
Firmware
The software also turned out to be complex in this version,
since everything is taken care of by a single microcontroller.
This time the software has to perform two tasks: one part is
used for the USB connection (and hence the programming of
from the store
the timer); the other part is used to take care of all the nor- ª* 150192
GPS board
mal timer functions.
The operating mode of the timer is determined by how the
Baristor
In 2016 father and son Shustov, during the
Fast Forward Award event at the electronica
trade show in Munich, received a prize for
their baristor (a contraction of barrier resistor),
a new component, comprising conventional parts, that beha-
Probably driven by nostalgic feelings, ves as an open-circuit below a certain voltage and as a normal
Michael Shustov and his son Andrej have put together the book resistor above that voltage (or the other way around) — see
Electronic Circuits for All, a collection of more than four hundred Figure 1. It will not be a surprise that this component recei-
small and simple circuits that use conventional (‘old-fashioned’) ves extensive coverage in the book; Figure 2 shows a typical
components — actually somewhat similar to the style of the example.
3xx Circuits series (where xx = 00 through 11) from Elektor
and with an equally varied contents: there is something for Minimalistic
everyone, including power supplies, test equipment, generators, The circuits in the book give a minimalistic impression.
filters, (tele)communications, amplifiers and security. And it is Decoupling capacitors, protection resistors or inputs of unu-
Language use
When reading, there forms the impression that the English-lan-
guage version of the book was written or translated by some-
one who uses Russian, not English, as their native language.
Figure 1. The schematic symbol of the ‘baristor’.
Perhaps the authors have provided their own English-language
version or a translator, who goes unmentioned on the colophon
page, has worked on it — whatever the case may be, language
purists will be rubbed the wrong way from time to time, but
the mistakes (for example ‘capacity’ instead of ‘capacitance’)
and some awkward phrasings fortunately do not stand in the
way of an understanding of what has been written.
Esoteric
In addition to a large number of extremely practical circuits, the
authors also devote some attention to more esoteric subjects:
Kirlian photography, thunderstorm prediction, electrotherapy,
aerion detection (whatever that may be) and “psycho-emotio-
nal correction” (Figure 3) — subjects from the flower-power
age that also used to grace the pages of Elektor once. The
utility of those contributions can be debated, but in any case
they are a good excuse for spending a rainy Sunday afternoon
with a soldering iron.
Conclusion
Despite a few minor criticisms, we may thank the authors
that they have made this collection of circuits ‘from the past’
available to 21st-century electronics enthusiasts, as proof that
a µC or an RPi is not always an absolute necessity. Ladies and
gentlemen soldering devotees: dig out the box with ‘old stuff’
and heat up that soldering iron!
(160394)
Web Link
Figure 3. Circuit for psycho-emotional correction. Whoever knows how it
www.elektor.com/electronic-circuits-for-all works may speak up...
In this article we use the ESP32 DevKitC development board As usual, you should bear in mind that the ESP toolchain is
(Figure 1), which comes with a micro USB connector and allergic to space characters. For example, the ‘Documents
is conveniently available in the Elektor Store [1]. and Settings’ folders repeatedly found in older versions of
In a previous Elektor article [2] we described how to get Windows always cause problems, and unfortunately the
started with the ESP32. In the present article we provide manufacturer’s forums do not show much appreciation of
an introduction to using the ULP processor. this.
For users of the SparkFun board discussed in the previous
Preparations article [2], there is a small change here: instead of the
Like it or not, the manufacturer Espressif regularly updates previously used FTDI converter, the DevKitC board employs
its programming framework, which goes by the name IDF. the CP210x, which is considerably cheaper and provides
As a lot of water has passed under the bridge since the comparable performance. The driver should be present
publication of the last ESP32 article in Elektor Magazine, already, but if for some reason your PC has never heard
we recommend that you get the current version of the of it, you can find archives at [4] where you can obtain
framework before proceeding further. More information the driver.
about this is available at [3]. When you connect the board to your computer through a
cable with a micro USB connector, the red LED will light
up immediately. Under Ubuntu you can see the path of
the virtual serial port in the system log. On the author’s
computer, the DevKitC logs in as /ttyUSB0, just like its
U2
predecessor:
EXT_5V NCP1117 VDD33
3 2
VIN VOUT
R2 R25 (NC) tamhan@TAMHAN14:~$ dmesg
GND/ADJ
1% [19280.368821] usb 1-1.7: Product: CP2102 USB to UART
3k3
2k
1% 1
C1 C2 Bridge Controller
LED1 R24
10u 22u
C23 (NC)
25V 25V
. . .
0R
10u
25V
# . . .
# (Uses default behaviour of compiling all source
Figure 5. WLAN is not especially low-power (source: Espressif ESP32 data
sheet [6]). files in directory, adding 'include' to include
path.)
ULP_APP_NAME ?= ulp_$(COMPONENT_NAME)
ULP_S_SOURCES = $(COMPONENT_PATH)/ulp/
With the right setup, the author’s Solartron 7150 ammeter
ulp_source_file.S
measures a current consumption of about 48 mA. As the
ULP_EXP_DEP_OBJECTS := main.o
DevKitC board has an LED and some other bells and whistles,
if you design your own board you should be able to manage include $(IDF_PATH)/components/ulp/component_ulp_
with less. According to the data sheet, the board draws common.mk
between 30 and 50 mA in this state, which is designated
“Modem Sleep”. If you reduce the CPU clock to 80 MHz, If you are working with a ULP program, you can simply copy
you only need 20 to 25 mA, and at 2 MHz the current the make snippet provided by Espressif to your own project.
consumption drops to 2–4 mA. It uses the file ulp_source_file.S located in the subfolder /
Of course, these figures are only true as long as the WLAN ulp and includes it in the compilation process.
transmitter is disabled. When the radio module is active, After generating the assembly language file, you have
the current consumption depends on the operating mode to include the header. That’s because the assembler in
of the ESP32. Measurement is difficult in that situation, so the Espressif toolchain uses a preprocessor, which would
Figure 5 shows some information from the datasheet [6]. otherwise spit out various error messages:
tamhan@TAMHAN14:~/esp$ ls
esp32ulp-elf-binutils esp-idf hello_world
xtensa-esp32-elf
tamhan@TAMHAN14:~/esp$ export PATH="$PATH:$HOME/esp/
esp32ulp-elf-binutils/bin"
Stop and go
If you run the program as it is at this point, you will notice
that the counter is incremented by 3 each time. That is
because the timer starts after ulp_run is called, and it takes
Figure 7. This table lists the pins that can be accessed from the ULP
a while for the main processor to shut down. Any wakeup
processor (source: Espressif, [7]).
calls received earlier will not wake it up; the ULP processor
spends its time in a sort of endless loop that performs three
increment operations.
To clear up this problem, all you have to do is to wait
commands from the ULP processor. Then we start the ULP ‘actively’ by jumping back to the start if the main processor
program and put the main processor to sleep: is still awake.
RTC_GPIO_MODE_OUTPUT_ONLY); Espressif equips the GPIO pins with a function called “Hold”.
rtc_gpio_set_level(cpu_num, 1); By setting the corresponding flag, you instruct the GPIO
engine to hold the state of the pin concerned during the
rtc_gpio_init(ulp_num); transition between ULP and ESP32.
rtc_gpio_set_direction(ulp_num,
Next we have to make the ULP part of the ESP32 visible
RTC_GPIO_MODE_OUTPUT_ONLY);
on the oscilloscope. For this purpose, in ulp_source_file.S
rtc_gpio_set_level(ulp_num, 1);
we replace the incrementation code by the following code
block that performs the startup and shutdown operations:
Now we place code between the Init check and Good night WRITE_RTC_REG(RTC_IO_TOUCH_PAD0_REG,RTC_IO_TOUCH_
blocks that generates a characteristic waveform, which can PAD0_HOLD_S,1,0)
easily be viewed on an oscilloscope: WRITE_RTC_REG(RTC_GPIO_OUT_W1TS_REG,RTC_GPIO_OUT_
DATA_W1TS_S+10,1,1)
//BlinkBlink WRITE_RTC_REG(RTC_GPIO_OUT_W1TC_REG,RTC_GPIO_OUT_
rtc_gpio_hold_dis(cpu_num); DATA_W1TC_S+10,1,1)
char bctr=0; WRITE_RTC_REG(RTC_GPIO_OUT_W1TS_REG,RTC_GPIO_OUT_
while(bctr<4){ DATA_W1TS_S+10,1,1)
rtc_gpio_set_level(cpu_num, 0);
rtc_gpio_set_level(cpu_num, 1);
After this program is downloaded to the ESP32, you can see
bctr++;
on the oscilloscope how much time elapses between the
} sleep command and activation of the ULP routine (Figure 8).
rtc_gpio_hold_en(cpu_num); Figure 9 shows this situation with an expanded time base.
Web Links
[1] www.elektor.com/esp32-devkitc
[2] www.elektormagazine.com/160454
[3] http://esp-idf.readthedocs.io/en/latest/get-started/index.html#get-started-connect
[4] www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
[5] https://dl.espressif.com/dl/schematics/ESP32-Core-Board-V2_sch.pdf
[6] http://espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
[7] http://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
[8] https://github.com/krzychb/ulp-loop/blob/master/main/ulp/loop_blink.S
[9] https://github.com/espressif/binutils-esp32ulp/wiki#downloads
[10] www.elektor.tv
HP6624A
CH1
6V GPIO25 CH1
100mA
GPIO4 CH2
ESP32
GND
8Ω GND1, 2, 3
CH*...
CH3 GND*... LC9354AM
avg (CH3)
Figure 10. With this arrangement you can clearly see that the current Figure 11. Shutdown of the Xtensa core can be recognised from trace 3
consumption is lower when the Xtensa core is in sleep mode. Be careful: heading toward the baseline.
the grounds of the oscilloscope inputs are connected together.
Here you can see that the ULP routine is activated three to feel at home with the ULP processor. For those (including
times in total, which explains the incrementing of the counter the author) who think that assembly language programming
by 3 between the calls. on eight-bit processors is good preparation for working with
high-level languages on MCUs, this is a sort of (belated)
Now let’s see whether all this actually reduces power confirmation.
consumption. For this, we connect an 8-ohm resistor in (160549-I)
series with the GND lead and set up the measuring circuit
shown in Figure 10.
On the oscilloscope screen, the transition of the Xtensa
core to sleep mode is indicated by trace 3 heading toward
the baseline (Figure 11).
Summary
Espressif has learned from the problems with
the ESP8266. If you utilise the low-
power processor properly, you
can definitely reduce the
power consumption of
the ESP32. However,
the very large scope
of functions naturally
means that it is no match
for a true low-power
microcontroller — WLAN
is simply not a low-power
interface. If you have acquired
experience in assembly language
programming for PIC microcontrollers
and the like, it shouldn’t take you long
A video
If you find dealing with make a bit overwhelming, at
from the store
[10] you can find a small video provided by the author ªESP32 DevKitC
www.elektor.com/esp32-devkitc
that explains this in more detail.
Chimes for
the Elektor Sand Clock
Shake, rattle and beep
I bought the Elektor Sand Clock as soon as it was announced. It made an unusually daft Christmas novelty,
though the noise it produces renders it fairly useless in home or office environments. In this article we will
make it even noisier by adding chimes.
Having assembled the Sand Clock [1], Selecting a sound system these but you can set up your own. The
my first inclination was, as with any An old-fashioned mechanical clock chi- clockwork ‘knows’ when to start the chi-
worthwhile gadget, to add some bells, mes every quarter-hour, the melody get- mes just before of each quarter hour, and
whistles or — more obvious in this case ting longer as the full hour is approached. first boing of the hour bell (or cuckoo)
— chimes! Because one should not be Readers familiar with Big Ben (currently is supposed to be exactly on the hour.
overambitious when launching a well-di- silent) will know the sequence of four- I thought of programming the panto-
rected project, the present chimes are note motifs known as the Westminster graph to strike a set of gongs (or play a
disappointingly… digital. quarters or Westminster chimes; I chose xylophone or pluck some strings) at the
POWER
8 2 8 10k
GND GND
DIGITAL (PWM ~ )
DIGITAL (PWM ~ )
220n
MIDI applications. But Serial isn’t con-
1
VIN 7 VIN 7
~6 ~6
A0
A1
~5
4
A0
A1
~5
4 LS
venient and it may be ill advised in any
ANALOG IN
ANALOG IN
JP1
~3 ~3
case to add code involving precise timing
A2 A2 C1 1
A3 2 A3 2 2
A4/SDA TX 1 A4/SDA TX 1 100n
A5/SCL RX 0 A5/SCL RX 0 to the Sand Clock program.
active LS
(impedance usually ≥10k)
The audio output from pin 8 is connec-
160411 - 11
ted to an active loudspeaker. A low-pass
filter makes the sound less, erm, ugly.
Figure 4 shows my prototype.
Figure 1. Here is how I connected a “slave” Arduino to the Sand Clock.
The sketches
The software for this project can be
appropriate times. It could be done using However, with the arrangement shown downloaded from [4]. The sketch sand-
the commands provided but I abandoned (Figure 1) it must be a 5-V model. clockBigBen.ino is a version of the origi-
that idea for now, because you’d need Transmission is through the I2C bus as it nal Sand Clock software with a few lines
some kind of escapement mechanism is already ‘declared’ for communications of added code that simply send the four
and sadly I don’t have the revered skills between the hardware clock on the shield bytes of the hours and minutes digits
of ancient clockmakers, or harpsichord, and the Arduino. To be able to trans- via the Wire library to the Arduino that
piano makers for that matter. mit the hours and minutes, I soldered a executes the chimes with BigBenI2C.ino.
While software will never replace genuine 6-way ribbon connector (Figure 2) with For development and testing, I used
musical instruments, one feeble attempt a female header directly to the SCL, SDA sketch wire_master_clockV2.ino to send
is to make the Arduino family generate and power pins of the shield, which had four bytes via I2C from another Arduino
“acceptable” sounds using the Mozzi already been assembled. If you haven’t whenever a character is received from
sound synthesis library [2]. For a preli- started assembly there may be enough the terminal. There’s also a test receiver
minary tryout I decided instead to use headroom for angled headers which pro- sketch slave_receiver_clockV2.ino. I
Arduino’s built-in Tone function. vide a more adaptable plug-and-socket ran the two instances of Arduino on the
breakout; the usual Arduino stackable same computer, without an I2C isolator
Interfacing to the Sand Clock headers are too tall. The ribbon (and (see above).
Following best practice I made the fewest connectors I added to make the sand The I 2 C master is the Sand Clock’s
possible adaptations to the Sand Clock’s tray detachable) come out through a slot Arduino, so it doesn’t need an address.
hardware and software and sent the rele- I cut in the back plate (Figure 3). The chime-Arduino is set a Slave at
vant data to a separate Arduino Uno. Any address 0x08, the first available one.
other Arduino should work with this sim- Good practice when This address doesn’t matter unless you
ple application, and I’d suggest using the interconnecting connect any extra modules (weather sta-
cheapest version for a permanent fixture. microcontrollers is always to tion…) with fixed addresses. The real-
use an isolator time clock (RTC) built into the Sand Clock
I made direct connections between the shield has the fixed address 0x51. Inci-
I2C’s SCL and SDA pins of the two Ardui- dentally, though this module is tempera-
nos, with the Ground return on the same ture-compensated and highly accurate,
ribbon cable. Pull-up resistors are already you could place a clock with an external
provided on the Sand Clock shield. Cau- reference on the same bus, most likely
tion: this direct connection is possible via an additional inexpensive Arduino.
only between Arduinos of the same ope-
rating voltage (5 V here); a 3.3-V model The 15-minute interval mod
is likely to be damaged. In fact, the As supplied, the Sand Clock is program-
arrangement should be deprecated in any med to write the time in the sand every
case, because the USB cables used for minute. In response to complaints about
testing and control create a Ground loop (acoustic) noise, sketch sandclockBig-
with the 0-V power connections. Good Ben15min.ino vibrates and writes in the
practice when interconnecting microcon- sand every 15 minutes (or whatever
Figure 2. Clearly labelling connectors helps to trollers is to use an isolator invariably. you want to program). The sand bed is
avoid wiring mistakes. The components are cheap enough, but shaken just before the final minute arri-
ves. (I kept the default of five seconds corresponding arrays melodyx[] and apparatus, we need a more predictable
but should probably have made that a noteDurationsx[], and then recompile. solution. I propose that the pantograph
variable read from the Sand Clock.) We There’s space for longer melodies and be fitted with an additional tool that
assume that the chimes will be short that can be arranged by modifying arrays neatly rakes the sand, as in an Olym-
enough to start during each 14th, 29th, noteOnx[] and noteLenx[] . The pic long-jump sand pit. Alternatively,
44th and 59th minute and finish in time durations and timings are calculated someone has surely already designed an
for the shaking of the sand bed. automatically (I found that difficult and independent little robot that could drive
the code may be unduly clumsy). Each up to the tray when called upon. If you
Create your own melodies Tone command needs to be followed by did, please let us know.
The Arduino Tone function generates a a delay at least equal to the calculated Finally, the Sand Clock’s RTC, the
square wave at the frequency of the spe- duration. I added an extra 2 ms to make PCF2129A, is a pretty accurate com-
cified note and for the specified dura- sure. ponent that has several features (like
tion. The frequency of each note is read Alarm and Timestamp) that have not
from library file pitches.h, which you More Sand Clock enhancements been exploited yet. It might be interes-
can modify to obtain harmonically pure According to the designers of the Sand ting to make these options available to
intervals in lieu of the default equal-tem- Clock, the most difficult mechanical prob- external hardware too.
pered ones, or perhaps generate comi- lem to be cracked was smoothing out the (160411)
cally wrong notes. My software is musi- sand. Positioning the vibrator motors is
cian-friendly, the note durations being an empirical process, and with my kit the
calculated from note values (4 = quar- sand occasionally migrates to one end
ter note or crotchet, etc.). Since chime of the tray. The reasons for that, as well
melodies are short, I didn’t think it worth as for a tendency to segregate ungraded
providing an interface for you to input sand by particle size, have been elucida-
your own. If you want to do this anyway, ted by Nobel Prize winner Pierre-Gilles
you will have to modify the values in the de Gennes. For a mission-critical piece of
RF Power Meter
For measurements up to 10 GHz
Radio remote controls for model aircraft and similar devices are rightly subject to strict
regulations. They govern not only the transmit frequency, but also (and primarily) the transmitter
power output. With the RF power meter described here, you can easily check how much power you
are transmitting, at frequencies up to 10 GHz.
and live video link. The maximum Of course, there’s nothing to stop you
Features permissible transmit power of the from buying a ready-made RF power
• RF power meter radio remote control for this model, meter, but they can easily set you back
• Bandwidth 1 MHz to 10 GHz which operates in the 5.8-GHz band, several hundred euros. That makes DIY
• Dynamic range 55 dB is 25 mW. That is more than enough construction an attractive alternative.
• Compact: approx. 95 × 36 × 30 mm because the models are not allowed to
fly higher than 300 feet (100 m) and The approach
must remain within sight at all times. To avoid any misunderstanding, we
The home base of FMS Spaarnwoude should point out that this is not a
The author is an enthusiastic member is near Schiphol Airport, the largest simple DIY project. To keep the design
of the FMS Spaarnwoude model aircraft airport in the Netherlands, so it is of the RF power meter within the range
club and the proud owner of an especially important to avoid exceeding of advanced solder artists, we opted
octocopter with a wingspread of over 3 the maximum transmit power — if only for an approach with two (actually,
feet (1 metre), equipped with a camera to avoid hassles with the authorities. three) small circuit boards: a main
LCD1
2 x 16
LED+A
LED-C
VDD
VSS
R/W
RS
VL
D7
D6
D5
D4
D3
D2
D1
D0
E
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
+5V
R6
R5
+5V 330R C3
10k
P1 100n
10k
+5V
IC1
1 8
VDD FEEDBACK
GND
D0/RX
D1/TX
RESET
D11/MOSI
D10
D9
D8
D7
D6
D5
D4
D3
D2
D12/MISO
3 7
SHDN OUT
MCP1501
-20E/SN R4 MOD2
C2 Arduino Nano
GND
GND
GND
GND
D13/SCK
1k
RESET
AREF
2u2
+VIN
GND
+5V
2
4
5
6
A0
A1
A2
A3
A4
A5
A6
A7
Table 1
100 MHz (21.3 mV/dB) 1 GHz (22.1 mV/dB) 1.8 GHz (22 mV/dB)
Vin [dBm] Vout [V] mV/dB Vout [V] mV/dB Vout [V] mV/dB
0 0.423 0.417 0.391
–10 0.610 18.7 0.624 20.7 0.601 21
–20 0.834 22.4 0.832 20.8 0.786 18.5
–30 1.052 21.8 1.067 23.5 1.044 25.8
–40 1.274 22.2 1.292 22.5 1.244 20.0
–48 1.447 21.6 1.480 23.5 1.445 25.1
The second series of measurements (Table 2) was made without a cable: N/BNC adapter on the analyser, BNC/BNC adapter
(female/female), BNC/SMA adapter on the module.
Table 2
100 MHz (21.3 mV/dB) 1 GHz (22.1 mV/dB) 1.8 GHz (22 mV/dB)
Vin [dBm] Vout [V] mV/dB Vout [V] mV/dB Vout [V] mV/dB
0 0.421 0.409 0.380
–10 0.608 18.7 0.614 20.5 0.583 20.3
–20 0.832 22.4 0.821 20.7 0.770 18.7
–30 1.050 21.8 1.057 23.6 1.027 25.7
–40 1.272 22.2 1.283 22.6 1.233 20.6
–48 1.445 21.6 1.471 23.5 1.434 25.1
We also tried two other coax cables. The first (35 cm RGU400, BNC to SMA) proved to contribute an additional attenuation of
about 0.2 dB at 1.8 GHz, while the second (1 m RG223, BNC to SMA) yielded an additional attenuation of slightly less than 0.6 dB.
Table 3
Vout max. 1.718 V (without input signal)
Vout min. 0.359 V (measured at +10 dBm and 15 MHz)
Max. input power +12 dBm (according to data sheet)
Vin min. (K1) 6.6 V (at lower voltages the output of the 5 V regulator collapses)
Current consumption 85 mA
voltage for powering the various capacitor, which is already present on detectors — that convert the measured
modules is generated on the Arduino the Arduino Nano. power into an analogue output voltage.
Nano board. Diode D1 provides reverse- Finally, the schematic shows the RF A major part of the design process
polarity protection. front end in the form of MOD1. It is therefore consisted of finding a suitable
The internal reference voltage of the connected to the main board by just log detector IC. In the end we opted
Nano is not sufficiently accurate for three leads: power, ground, and the for the Analog Devices AD8317 [2]. It
our purposes, so we added a separate analog output voltage proportional to has a more than adequate bandwidth
2.048-V reference voltage source in the the RF power level. of 1 MHz to 10 GHz, along with a
form of IC1, an MCP1501-20E/SN [1]. dynamic range of 55 dB. The schematic
This Microchip IC provides an excellent The BoB diagram (see Figure 2) follows the
precision of 0.1%. For stable operation The design of the RF front end turned recommendations in the data sheet.
it needs a resistive load, provided here out to be easier than we originally The signal enters on connector K1.
by resistor R4. The AREF input of the expected or feared. That’s because The maximum input signal level is
Nano board is decoupled by a 100-nF there are ICs available — called log approximately 0 dBm, so an attenuator
52R3
0R
impedance, with a corner frequency C2
AD8317ACPZ-R7
8 4
of about 68 kHz. INLO VSET
47n COMM EP CLPF TADJ
Resistor R2 provides temperature 2 9 3 6
R3
200R
compensation. The value shown on C3 R2 R4
the schematic is recommended for
499R
NM
8p2
measurements at 5.8 GHz. See the
data sheet for other values. TADJ
is also fed out to connector K2, but
that feature is not used in the present
Figure 2. The RF module consists of a single IC and a handful of small components.
application. Capacitor C3 is for the
low-pass demodulation filter of the
output signal Vout. Since we are not
interested in demodulation in this
application, we chose the standard Wide bandwidth and large dynamic range
value of 8.2 pF here.
The output signal Vout is fed to the VSET
input via the voltage divider R4/R5. For
R5 the value shown on the schematic
is 0 Ω, while R4 is not mounted (NM).
This voltage divider can be used if
necessary to make the slope of the
output voltage characteristic steeper
than the minimum value of 22 mV/dB.
Here again, for more details you should
consult the data sheet of the IC.
Construction
Figure 3 gives an impression of the
fully assembled RF power meter. But
we aren’t that far yet — there’s still
some finicky work ahead of us (or four-layer board, which is absolutely the ground planes provides additional
actually, you). essential for a circuit intended to decoupling of the supply voltage.
Let’s start with the most difficult part: operate up to 10 GHz. One of the Another word of warning: don’t try
the RF front end. For this we designed hidden layers is dedicated to the to make this or something similar
a small (20 × 27 mm) PCB layout, positive supply voltage. The parasitic yourself, as otherwise the circuit is
shown in Figure 4. Note that this is a capacitance between that layer and guaranteed to not work properly.
Due to the high frequencies, all Figure 5 shows the PCB layout we index is calculated. Then the results
resistors and capacitors are in 0402 designed for this purpose, which is are sent to the display, and the next
packages except C4, which is in an about the same size as the display measurement cycle starts.
0603 package. module. Mount the normal components Before the correct values can be read,
Now we come to the only drawback first, but wait a bit with the two the attenuation and the frequency must
of the AD8317 used here: the CP-8-1 modules and the display. be selected. For this we implemented a
SMD package. The eight contacts are simple menu structure, which uses the
barely visible, and on the bottom of Assembly Up and Down pushbuttons as well as
the package there is an exposed pad On our first prototype we fitted bus strips the Enter button for confirmation of the
that must be bonded to GND. That is for the two modules and the display. selected entry. The frequency options
simply not possible with an ordinary However, that manner of assembly is not are 900 MHz, 1.8 GHz, 2.2 GHz,
soldering iron, no matter how fine the recommended, even though the circuit 3.6 GHz, 5.8 GHz, and 8 GHz. The
tip may be. The only way to solder this works properly, because the overall unit characteristic curve for conversion of
IC is to use a hot-air soldering station is nearly 4.5 cm high as measured from the input voltage of the A/D converter
or a reflow oven. And don’t use too the display to the ICSP header of the and calculation of the actual power in
much solder paste! Nano board. dBm is a straight line with a slope of
After the BoB, the main board is a If the modules and the display are –22 dB/V, but the origin of the line is
piece of cake. Only ordinary SMD instead soldered directly on the main different for each frequency (see the
components are mounted on it. board, the overall assembly is only data sheet).
28 mm high. Proceed as follows: The software issues a warning when
First mount the two modules (see the input power is too high or too
Figure 3 again), plug the header for the low. According to the data sheet, a
display into the right holes, and then low input power level leads to a large
from the store secure the display in place with four measurement error.
ª160193-1 5-mm standoffs (male/female) and
PCB RF module matching screws. After this you can Attenuators
ª160193-2
solder the pinheader for the display The author uses two attenuators from
PCB main board module. Mini-Circuits: the VAT-20W2+ (20 dB)
[3] and the VAT-30W2+ (30 dB) [4].
ª17002
Arduino Nano Firmware and use They are supplied complete with
The software of the RF power meter is datasheets. The characteristics of these
ª18241
Franzis Nano Board
fairly straightforward. In the main loop two attenuators are incorporated in the
of the program, 500 samples are taken firmware. By the way, the firmware
ª120061-77
and then the average power, the peak also has a built-in calibration function,
LCD 2×16 white on blue
power, the minimum power during the so it is possible to use attenuators
ª120061-74
last ten seconds, and the maximum other that the two previously
LCD 2×16 standard
power during the last ten seconds mentioned types preprogrammed in
are determined and the modulation the firmware.
component list
Q Where does the name ‘Nixie’ come from? the drawings of the display tube. The abbreviation stood for
‘Numerical Indicator eXperimental no. 1’, and it quickly became
ond World War, there was more and more demand for elec-
tronic displays. The first patent for a display resembling the Q Are Nixie tubes still being made?
A For a quick test, you can hold the tube next to a ‘plasma
ball’. If the neon gas inside the tube lights up, you at
least know that air has not leaked into the tube. For a better
test, you need a Nixie power supply with an output voltage
of 160 to 190 V. These are available at reasonably low prices,
either as kits or ready-made. You can also build your own on
a piece of perfboard [6].
Connect the positive lead of the power supply to the anode
though a resistor with a value of 33 kΩ to 47 kΩ; that can be
a bit less with relatively large tubes. Now carefully touch the
ground lead of the power supply to the cathode pins one by
one; the associated numeral should light up each time. If that
does not work, you can try reducing the anode resistance a bit.
If that does not help, the tube is probably defective.
A Nixie tubes can last for a very long time. Forty years of
continuous operation is by no means exceptional. How-
ever, they can also suddenly stop working. The most common
[6] https://threeneurons.wordpress.com/nixie-power-supply/
[7] https://en.wikipedia.org/wiki/Nixie_tube
causes are a crack in the glass envelope, air leakage into the
tube, cathode poisoning, an internal short circuit, or an inter-
nal open circuit due to mechanical effects [7].
There are also bargraph Nixie tubes, such as the IN-9 (Fig-
ure 3). They have a long, cylindrical nickel-plated anode grid
and a molybdenum cathode wire. This wire displays a light
column whose length depends on the amount of current. The
combination of molybdenum and neon results in a low ignition from the store
voltage. The lower end of the cathode is coated with zirco- ª150189-71
nium, which has an even lower ignition voltage. This ensures Six Digit Nixie Clock (complete kit)
that the light column starts at that end. An improved version ª150189-72
(IN-13) has an auxiliary electrode to initiate the light column Acrylic glass case for Six Digit Nixie Clock
at the lower end.
(160618-I)
VS.
By Peter Krengel, DG4EK (Germany)
The price of a European-made laser engraving machine puts it out of the reach of most private users. The
Internet, however, is full of low-cost alternatives in kit form from China, though it is tempting to believe that
the components might not be of the best quality. So what do you actually get for your money? A piece of
junk or a usable item of equipment?
After some research I was able to find tant to torsion. The EleksLaser version The heatsink on the EleksLaser engrav-
a relatively low-cost (around US$450, has been designed to look rather pret- ing head is also anodized, in a beau-
including a 5.5-watt laser) CNC engrav- tier than the other machine, for exam- tiful shade of blue, but unfortunately
ing machine kit from China on the Inter- ple through the use of anodized screws the result of this is that ambient light
net [1]. The kit has a similar basic con- and washers. is reflected in a distracting way when
struction to another machine called Elek-
sLaser, also produced in China, which is
around US$100 more expensive [2]. I
have tested both machines, and in this
article I am wording both my positive and
his negative experiences from putting the
kits together, from using the machines
in practice, and from experimenting with
the software and hardware.
Mechanical quality
As can be seen from the lead photo-
graph, both machines are built on the
well-known ‘gantry’ principle. The solid
aluminum extrusions mean that this
construction is very stable and resis- Figure 1. The two pairs of guide rollers above and below the rail and the stepper motor.
into the supplied Arduino Nano clone. is freely available. This software includes not already done so) install the neces-
The manufacturer has configured Ben- a simulator, a function to allow the vec- sary driver. Download the most recent
box in such a way that it will verify that torization of a range of pixel-based GRBL firmware as a .HEX file and copy
the original Nano clone is present before image formats, the ability to engrave it to the Arduino Nano using program-
it will allow you work with variable laser drawings and photographs, and a unique ming software such as XLoader [5]. Once
power. If the contents of the device are capability to automatically smooth the you have successfully flashed the device
changed then Benbox will irrevocably edges of, for example, freehand draw- and set up the COM port correctly you
switch to a mode where controlling the ings. A range of demonstration videos should be able to explore virtually all of
laser power is not possible. If you wish can be found on YouTube [4]. the available functions even though no
to experiment with alternative software, In the future it should be possible to engraving hardware is attached. If you
which normally will involve flashing the load an additional module, written by the connect an LED to port 11 of the Nano
controller with new code, then you will author of this article, into LaserGRBL, to you will be able to observe the PWM con-
need to use a second, blank, Arduino allow the machine to find and track laser trol of the imaginary laser as the G-code
Nano: in both cases the controllers are focus automatically with the help of a simulation runs.
fitted in sockets. webcam and a z-axis drive. It will also
As well as the rudimentary PC-based then be possible to make clean cuts in Conclusion
software supplied, it is possible to use thicker materials without having to adjust Mechanically speaking the two machines
both engraving machines with com- the focus point manually. are practically identical, even if the Elek-
mercial software such as T2Laser (Fig- Finally one last tip, in case you want to sLaser version is more slickly presented.
ure 7). There is also a free alternative in try out LaserGRBL without the engrav- The only differences are in the frame fix-
the form of LaserGRBL [3], which is of a ing hardware: connect a spare Arduino ings, the feet and the fitting for the laser
very high quality and whose source code Nano to the PC over USB and (if you have head. Is that worth the US$100 or so
Figure 7. The commercial T2Laser software and the free (as in beer and as in speech) LaserGRBL.
(160448) M
CM
MY
CY
CMY
Web Links
[1] www.ebay.com/itm/122760898329
[2] http://store.eleksmaker.com/
www.banggood.com/5500mW-A3-30x40cm-
Desktop-DIY-Violet-Laser-
Engraver-Picture-CNC-Printer-Assembling-
Kits-p-1009577.html
[3] http://lasergrbl.com/en/
https://github.com/arkypita/LaserGRBL/releases
[4] www.youtube.com/watch?v=conZiopJF3k
www.youtube.com/watch?v=wEygWyIo6n0
[5] http://russemotto.com/xloader/
Features
• Allows the output voltage of a lab
power supply to rise gradually
• Voltage rate of rise approximately
800 V/s
• Suitable for installation in many
power supplies
• Maximum voltage 30 V, maximum
current approx. 5 A
• Perfectly suited to capacitive loads
The simplest lab power supplies have However, most lab power supplies found Switch
an adjustable output voltage and (ide- in the enthusiasts’ domain (professional Of course, you could simply place a
ally) short-circuit protection. That’s types are generally too expensive for the robust switch — which means a switch
fairly basic, but for a budding electron- home lab and are therefore not consid- able to withstand heavy currents and
ics enthusiast it’s an excellent way to ered here) lack a button for enabling or high voltages — between the output of
start their career. The better models disabling the output without switching the power supply and the connected load,
also have adjustable output current the power supply on or off. The power but that option has a significant draw-
limiting, and precise indication of the switch of the power supply is often used back: mechanical switches bounce a lot,
output voltage and current is a feature for this purpose, but if you do that very and that is not what you really want.
that should be present in any respect- often it tends to shorten the lifetime of Furthermore, a switch does not solve
able lab power supply. the electronics in the power supply. another issue: the high inrush current
K4
+5V
5Vin
K1
Vin NVD6824NL NVD6824NL
T1 T2
1
2 K2A
D1
R4 R1 R5
K2 D2 C5
1 8
100R
1k
3k6
IN IC1 OUT
2
EN 2x 1N4148 1n
C1 4 5 C4
Vaux RESET HOLD Vout
MAX5024 C2 C3
100n 7 220n 11 10 9
SET
GATE SCR OUT
GND EP 22u 1u 50V 12 2
IN THERM
3
IC2 R6
1 SHDN 8 T3 K2B
240k
FLAG
MAX16126 3 1
NC
4 5
+5V UVSET OVSET 2
R2 R7
IC GND EP 2N7002
Vout
10k
10k
6 7 6
VCC
5
IC3 OUT
1
IN MAX16054 +5V
4
OUT
160383 - 11
GND CLR LED1
2 3
bicolor
S1
R3
1k
Figure 1. The complete schematic of the soft-start circuit, which is built around three Maxim ICs.
Power supply
IC1 (again a Maxim IC, in this case a
MAX5024 [3]) is an ordinary linear reg-
ulator that generates a 5 V supply volt-
age from a fixed input voltage that must
be obtained from somewhere in the lab
power supply. This IC has a maximum
input voltage of 65 V, which should be
more than enough to allow a suitable
voltage to be connected to K2 for this
purpose. The MAX5024 has reverse volt-
age protection for the input voltage, so
This yields voltage (with in certain limits) by adjust- you don’t have to worry about it going
ing the value of C4. up in smoke if you make a mistake.
dV / dt = 180 µA / 220 nF = 818 V/s The 5 V supply voltage is necessary for
Switching on and off powering IC3. It is also used to power
If we assume that the circuit to be pow- IC3 (a MAX16054, also from Maxim [2]) IC2 when the output voltage of the lab
ered forms a capacitive load with a value looks after switching the output voltage power supply is less than 5 V, because IC2
of 1000 µF, then the peak input current on and off (which effectively means con- requires a minimum supply voltage of 3 V.
is limited to necting or disconnecting the load). This The voltage from the lab power supply
IC generates a logic signal whose level is logic-ORed with the output voltage of
818 × 1000 ≈ 800 [mA] switches back and forth when the button IC1 via D1 and D2, ensuring that IC2
(S1) is pressed. This signal drives the always has an adequate supply voltage.
That is a value that most lab power sup- SHDN pin of IC2. If your lab power supply has a fixed 5 V
plies can easily handle. If necessary, you As the IC generates complementary out- output or a fixed 5-V internal voltage,
can alter the rate of rise of the output put signals (OUT and OUT), it is very it can be connected to connector K4. In
that case IC1 can be omitted. Note that
K4 does not have any reverse polarity
protection, so mistakes here can have
Web Links fatal consequences.
[1] https://datasheets.maximintegrated.com/en/ds/MAX16126-MAX16127.pdf The minimum input voltage for IC2 is 5 V
[2] https://datasheets.maximintegrated.com/en/ds/MAX16054.pdf minus the forward voltage of D1 and D2,
which means about 4.4 V. In that case
[3] https://datasheets.maximintegrated.com/en/ds/MAX5023-MAX5024.pdf
the gate-source voltage for T1 and T2
Figure 1. Please make sure to set the project’s ‘contest’ field to:
ESP32 Design Contest 2018.
Deadline: March 31, 2018 @ 0:00 hours CET Improve your chan
ces to win
• Be creative
• Document, docum
ent, document2
• Include photograph
s and drawings
• Provide complete
schematics and
full source code files
• Add a video showin
g your project
0 0 w o r t h o f prizes!
€2,5
(160672)
For the latest information about the contest visit
www.elektormagazine.com/labs/esp32-design-contest-2018
Forgotten Problems
Following the item “The incandescent lightbulb fights back” in HH installment 6/2017
I received a message from a German reader. It contained a link to a discussion on a
German radio amateur forum about the very same lightbulbs as the ones mentioned
in the piece. Someone had observed that these lightbulbs produce electromagnetic
interference, measured at around 60 MHz and up (depending on the lamp’s wattage)
and an investigation was started to find the reason for this. Finally, Barkhausen-
Kurz or Gill-Morell oscillations, a phenomenon discovered somewhere in 1920, were
proposed as the most probable cause of the interference. It appears that at the time
of their discovery it was a common problem encountered in radio valves.
What this message showed me besides the fact me that my retro-lighting subject was
not as “avant-garde” as I had hoped — the discussion dates back to in 2008 — is that
by reintroducing forgotten technologies we may also reintroduce forgotten problems.
Many of these problems have forgotten solutions that in the end have brought
technology to where it is today. Kick out the chair from underneath it, and we will be in
“another fine mess” (to cite a forgotten movie).
P.S. I tried to measure the interference of a vintage bulb with a small RF spectrum
analyser but didn’t see any.
https://www.radiomuseum.org/forum/gluehlampe_als_ukw_stoersender.html
In the real world AI development and research is more oriented to helping humans dig through large amounts of data, classify
images and photographs, translate texts from one language to another or
patiently answer customer support requests over and over again. Of course, a
sizeable amount of money is spent on AI research for military applications, but
that is not where it stops.
Did you know that AI systems are being used to write weather forecasts and
other data presentations in a human friendly way instead of spitting them
out as a list of numbers? Since readers of such forecasts will suppose it was
written by a human, the AI that composed it can be considered as having
passed the Turing test.
Bogus or not? Difficult to say as the author, E. Labs, is cited several times in the
article’s reference section (and apparently even co-authored an article with Stephen
Hawking). (Download the complete article from www.elektormagazine.com/160622.)
Must-have
Homelab Tool
To add to your collection of cameras, here is the
USB Endoscope (sometimes also called Antscope).
They come in several lengths, up to 20 metres, with
and without Wi-Fi connectivity. Pieces of hooked wire
can be clipped or screwed on the camera head, allowing its
user to recover the car keys that accidentally fell into the sewer. A ring of
dimmable white LEDs around the lens provides light in the darkness.
Pareidolia is the tendency to perceive a specific, often meaningful image in a random or ambiguous visual pattern, for instance
recognizing a human or animal form in a cloud or the famous face on the moon. DeepDream can apply the “style” of one image to
another. By combining a painting from Vincent Van Gogh and a selfie, DeepDream can come up with a selfie that looks as if it was
painted by Van Gogh.
George Orwell
was an Optimist
Did you ever count the number of cameras you have in your home? I did and
quickly lost count. Smartphone cams, tablet cams, laptop cams, webcams, IP
cams, baby cams, dash cams, wildlife cams, drone cams, robot cams, rear-view
cams, spy cams, camcorder cams, you-name-it cams. Not only is every object
around us being connected to the Internet, they are getting ears and eyes too.
Want to participate? Please send your comments, suggestions, tips and tricks to [email protected]
When building a professional or home electronics project, you need good CAD software to obtain a good-
quality PCB that will meet the needs of the project. Is KiCAD, open source software developed by a
community, capable of rivalling the electronic CAD software in an ultra-competitive and lucrative market?
A bit of history lar. Today, Eagle has an interface that is easier to get to grips
KiCAD will not be unknown to regular Elektor readers — it has with, but KiCAD lets you do more sophisticated things, as the
already been covered in the November 2015 issue about elec- free version of Eagle is very limited: only two circuit sheets,
tronic CAD and in an article back in February 2007. More than two copper layers, and a circuit area limited to 80 cm2. This is
ten years have gone by, the electronic CAD software market why KiCAD remains the only open source electronic CAD soft-
has seen a great many developments and changes. So it’s ware that is without limitations, facing giants in the industry
time to talk again about KiCAD, which in my humble opinion like Altium [3], SolidWork PCB [4], PADS [5], OrCAD PCB [6],
is still the solution that is able to satisfy the greatest number and Pulsonix [7].
of users, whether amateur or professional. It’s important to remember that the first version of KiCAD,
in 2017, we saw Eagle [2] bought out by Autodesk. Eagle used created by Jean-Pierre Charras, was published in 1992. Today,
to be the major competitor for KiCAD, since in terms of cost, more than five hundred people around the world are working to
they were affordable for everyone. improve this software. At the time of writing, the current ver-
Certainly, even just a year ago, it was difficult to choose sion is 4.0.7. Version 5 was announced at FOSDEM 2017 (Free
between KiCAD and Eagle, as they were technically very simi- and Open-source Software Developers’ European Meeting).
Figure 4. Selecting the capacitor in eeschema. Figure 5. Choosing the capacitor footprint in eeschema.
Also add the VCC and GND components, without assigning them
footprints. Then use the Place wire tool (Figure 4, pos. 2) to
create the first connections between the capacitor, VCC, GND,
and the ATtiny85: left-click to start a wire and double-click to
end it. Note the labels (global label, Figure 4, pos. 3) on
the left-hand pins of the ATtiny85: these let you create an
invisible wire between two pins on components that have the Figure 9. Final circuit after numbering in eeschema.
same global label. In this way, the circuit is easier to read and Table: Pcbnew tools
it limits the number of wires to be drawn in eeschema. But
these tracks will still have to be drawn in Pcbnew.
Now place two 3-pin connectors (Filter conn_01x03) for
the GND and VCC signals, then two 4-pin connectors (Fil- Add Add Add Add
ter conn_01x04) for the eight pins of the ATtiny85. graphic line dimension zones text
The connector footprints are free, let’s start with easy-to-sol-
der types (Figure 7):
Pin_Headers:Pin_Header_Straight_1x03_Pitch2.54mm and
Pin_Headers:Pin_Header_Straight_1x04_Pitch2.54mm is just a quick tour to help you find your way around. We’re
We still have to add a component reference number so as to not going to cover designing footprints, as the ones for the
get rid of the “?” (Figure 4, pos. 4). In the window that opens, components in our example are already present in KiCAD.
set the options as in Figure 8 and click on Annotate. Attention: Thanks to its many options, Pcbnew is very com-
We then get the final circuit (Figure 9). As it is rudimentary, prehensive, and hence sometimes complex; we can’t detail
we’ll dispense with the electrical rules test (Figure 4, pos. 5). everything here. However, the documentation will be able to
In eeschema, all that remains to be done is to create the list answer all your questions.
of interconnections, the netlist (Figure 4, pos. 6) which will In Figure 10, the tools on the left (blue surround) let you mod-
convey the essential routing information to Pcbnew. When ify the options for displaying the lands, tracks, or net. In the top
the window opens, click on Generate. Now let’s move onto to strip (yellow surround), we find the track widths and hole sizes,
designing our board in Pcbnew (Figure 4, pos. 7). along with the grid pitch. The right-hand column (red surround)
groups together the tools needed for designing the circuit board.
PCB layout And lastly, right over on the right, the green frame lets you select
While eeschema is easy enough to grasp, it’s going to take a the working layers. Just as in eeschema, right-clicking with the
little longer to get used to Pcbnew. So what I’m offering here mouse is useful when it comes to using the various tools.
Figure 12. Copper area properties in Pcbnew. Figure 13. Edges, dimensions, and copper area in Pcbnew.
Now we’re going to add the PCB’s copper areas. Position your-
self on the F.Cu layer and select the Add filled zones tool
(see table). Select F.Cu and GND then confirm with OK. In this
way, the whole copper layer F.Cu will be connected to ground
(Figure 12). We’ll pass over the other options available, as
they are not needed in this example and can lead to some quite
weird results if they are incorrectly defined. Draw a square that
follows the edges on Edge.Cut. Do the same for B.Cu. You
ought to get a result similar to the one in Figure 13.
Figure 18. Autorouted board in Pcbnew. Figure 19. Autorouted and optimized board in Pcbnew.
Figure 20. Window for creating Gerber files in Pcbnew. Figure 21. Window for creating drill files in Pcbnew.
Author’s biography
Web Links
[1] KiCAD: http://kicad-pcb.org
[2] Eagle: www.autodesk.com/products/eagle/overview
[3] Altium: www.altium.com
[4] SolidWorks PCB: www.cadvision.fr/logiciel-cao/logiciel-ecad-solidworks-pcb
[5] PADS: www.pads.com
[6] OrCAD PCB: www.orcad.com/products/orcad-pcb-designer/overview
[7] Pulsonix: www.pulsonix.com
[8] Europlacer: www.europlacer.fr
[9] Technalp: http://technalp-electronique.fr
[10] Official KiCAD forum: https://forum.kicad.info
[11] SnapEDA: www.snapeda.com/home/
[12] Donations towards the development of KiCAD via CERN: https://giving.web.cern.ch/civicrm/contribute/transact?id=6
[13] MicroChip: www.microchip.com
[14] Datasheet for ATtiny85 from MicroChip: www.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-
Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf
[15] SeeedStudio: www.seeedstudio.com
[16] EasyEDA: https://easyeda.com
[17] Eurocircuits: www.eurocircuits.com
[18] Github repository for the project: github.com/Anderson69s/attiny85
A Cloud in
the Shape of
a Raspberry
project information
Raspberry Pi
Cloud ownCloud
Apache2 HTTPS RPi
entry level
intermediate level
Æ expert level
4 hours approx.
Computer,
Today the cloud is a popular solution to save and share files as well as SMD soldering iron
allow access to your files from any computer anywhere in the world.
Because many people are wary of the reliability and security of cloud
€150 / £135 /$185
storage, this article shows you how to create your personal cloud and its
power supply board.
sudo raspi-config
K4 K3 K2
auto eth0
USB-B USB-A USB-A
iface eth0 inet static
address 192.168.yyy.xxx <= +5V
4 1 2 3 4 3 2 1 4 3 2 1
Desired IP address
GND
GND
VBUS
VBUS
D–
D–
D–
GND
D+
D+
D+
VBUS
netmask 255.255.255.0
gateway 192.168.yyy.zzz <= IP
address of your router
VIN R3 R2
Press Ctrl-O then enter to save the 1k 2k87
1k
EXP 10n
GND
4
C1 C2 C6 D2 C7 C3 C4 C5 LED1
Here ‘6f20736b-01’ corresponds to my With R2 = 2.87 kΩ and R1 = 1 kΩ, the value of Vout is 4.97 V. If a fixed 5-V
hard disk, replace this value with the regulator is used, don’t fit R3 and make R2 = 0 Ω (or a link).
identifier of your hard disk. Press Ctrl-O The two large electrolytic capacitors at the input serve to provide the extra current
then Enter to save the file, Ctrl-X to needed by the SATA hard disk at startup.
quit the editor. Take care not to make
wget https://download.owncloud.
Figure 3. Preparation of the data base for user ‘root’ with password ’user_passwd’.
org/community/owncloud-
10.0.4.tar.bz2
tar -xjf owncloud-10.0.4.tar.bz2
any typos, because the results can be
sudo cp -r owncloud /mnt/usb
disastrous, you would be obliged to
reinstall the image on the SD card, etc.
Restart the Raspberry Pi with the Create a database
command: For ownCloud to function, it is necessary
to create a database:
sudo reboot
mysql -u root
If all goes well, you can read (after create database owncloud;
connection, of course) the contents of grant all privileges on
/mnt/usb with the command: owncloud.* to <user>@localhost
identified by ‘<user_passwd>’;
ls /mnt/usb
exit;
Worldwide access?
To access your cloud from the computer in your office — sudo chmod 755 /etc/init.d/noip
or from anywhere on the planet — you will ideally need a sudo update-rc.d noip defaults
dynamic DNS address. For this I advise you to use the service sudo service noip configure
‘NO-IP’ [3]. Get onto the site and register your desired domain
name. It’s free but the only downside is that every month you Start the service manually:
receive a message to continue to use your account.
Installation is simple enough. From your Raspberry Pi, sudo service noip start
execute the commands below in a working directory of your
choice: You can verify the status of the service with the command:
cp owncloud.crt /etc/ssl/certs
cp owncloud.key /etc/ssl/private
nano /etc/apache2/sites-available/
Figure 5. That’s it, here we are with the dashboard of our cloud.
Now it’s up to you to manage your cloud. owncloud.conf
<VirtualHost *:443>
DocumentRoot /var/www
SSLEngine On
SSLOptions +FakeBasicAuth
+ExportCertData +StrictRequire
SSLCertificateFile /etc/ssl/certs/
owncloud.crt
SSLCertificateKeyFile /etc/ssl/
private/owncloud.key
Figure 6. Don’t panic! You can have confidence </VirtualHost>
in yourself and your own systems, right?
component list
What now?
a2ensite owncloud.conf You are now in possession of your very
apachectl configtest own cloud, of a good size, over which
service apache2 restart you have total control. You can choose
Press Ctrl-O then Enter to save the file, to switch it on or off whenever you want,
Ctrl-X to quit the editor. You can now connect to your cloud launch an automatic backup of your
using the address https://192.168. cloud, etc. It’s you who is in command,
Finally, we activate the new configuration yyy.xxx/owncloud (with an ‘s’ on the it’s you who is piloting the cloud.
and restart the Apache2 web server: HTTP). Your browser will warn you of (160494)
Web Links
[1] Raspbian: www.raspberrypi.org
from the store
ª160494-1
[2] ownCloud: owncloud.org Power supply printed circuit
[3] Service NO-IP: www.noip.com board, bare
Advertisement
Die-cast enclosures
+ 44 1256 812812
standard • [email protected] • www.hammondmfg.com
and painted
www.hammondmfg.com/dwg.htm
www.hammondmfg.com/ dwg_SBVer.htm
01256 812812
[email protected]
A solution?
Feeling rising frustration, I take a deep breath
and sit down in front of the PC hoping that
Google will help me out here. Solution:
in the fuse box at the front of the engine
compartment, there’s a copper strip with a
‘direct line’ to the positive pole of the bat-
tery; seems like Toyota has already antici-
pated my predicament. I hooked up a small
12-V 4.5-Ah AGM battery and the car was
1 2
ready to go — the energy needed to crank
the starter actually comes from the HV bat-
tery, the 12-V battery doesn’t need to supply the hundreds of It looked like I needed to monitor the battery over a longer
ampères starter current, it only supplies a short 15-A burst of period to detect any ‘transient event’ draining the battery.
energy. This is used to pressurize the braking system and then What I needed was a voltage data logger; I turned to eBay
briefly a few amps are taken by the hybrid control unit before it hoping to find something not too expensive. Oddly I didn’t
switches over to HV battery power via a switched-mode power find any cheap voltage logging devices listed, even from the
supply and from where the 12-V battery is charged. With the Far East. The only users of voltage loggers are obviously pro-
car running sweetly I took the small 12-V AGM battery and a fessionals using top-spec loggers so there isn’t a market for a
couple of leads along for the ride… you can never be too sure. cheap and cheerful version. For my purposes, I couldn’t really
The story didn’t end there, one week later the Prius did the justify the expense for what is likely to be just a one-off use.
same thing again. This was starting to get annoying, the 12-V The only cheap data logging devices available were tempera-
battery in a Prius really doesn’t undergo much stress in its ture data loggers... Hmm “Maybe this is a good opportunity
life, also it’s an AGM type which should last much longer — 12 for a little bit of tinkering?” was my first thought. I went ahead
Have you come up with an inspired way of solving a really tricky problem? Perhaps you’ve discovered an ingenious but
unconventional way of using a component or tool? Maybe you’ve invented a better or simpler way of tackling a task?
You deserve a reward, write in — for every tip we publish you win £40 (or local equivalent)!
project information
Arduino Water
Sonar Wireless
433 MHz or equivalent By Somnath Bera (India) Although I make no claim to being a
water-management specialist, I believe
Æ entry level I have identified some problem areas that
intermediate level Drinkable water is a costly commod- might be improved with cheap technology
expert level ity or ‘resource’ if you like, and due to and a bit of ingenuity. Water level indi-
the ever-increasing world population cators for instance often create issues.
it will be even more so in the coming Many of these are mechanical and have
4 hours approx. years. Already in many large cities in wires and pulleys that get jammed easily.
South Asia (21% of the world popula- The resulting false indications will derail
tion lives in the so-called SAARC coun- the management system of the water
Soldering iron, tries) water can be very scarce at times. tanks that use them.
computer with Arduino IDE, Major Indian cities like Chennai, Mumbai In the light of the above I present in
USB/Serial converter or Colombo which rely on the monsoon this article a sonar-based contact- and
for their year’s water supply face acute wireless water level indicator which can
water shortage when the rain season is be slapped up over a weekend for less
£25 / €30 / $35 approx. shorter than usual. Good, efficient water than €20 (£18 / $24). With two sepa-
management therefore is primordial in rate power supply units the price of a
these places. complete set comprising a water level
RX1
GND
GRN
BLK
TX0
VCC
+5V
are taken and averaged, allowing 1-cm TX0 RAW
MOD2 RX1 GND
level changes to be detected very clearly.
RST RST
Besides the ultrasonic ranging mod- T GND VCC
4 A5
ule the transmitter requires an Arduino 5V
3
D2
A4
A3
TRIG D3 A2 MOD3
(Pro) Mini compatible board (an Arduino ECHO
2
D4 A1 ANT1
VSS
R/W
Principles of operation
VO
RS
C
A
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
The water level sensor is built on the
R1 +5V
Arduino platform to which I added an 47R
P1 K1
SR04 ultrasonic sensor and a 433-MHz 2 VIN
1
transmitter module equipped with a
long-distance spiral antenna (Figure 1). 10k 12VDC max
GRN
BLK
TX0
VCC
Web Links
[1] Article support page: www.elektormagazine.com/160626
[2] Elektor Labs: www.elektormagazine.com/labs/remote-water-level-meter-a-need-of-the-hour
Platino “Fits-All”
Serial Bus Tester
Debug
serial comms issues
with ease
Even though the more expensive oscil- ter. In this article we therefore present A word about vocabulary
loscopes on the market can interpret a Platino-based system that speaks and Let’s start by defining some context. A
certain digital signals formatted in a understands various serial protocols, and ‘bus’ is a group of signals. A ‘commu-
known way, like SPI, I2C or plain serial, is intended as a debugging tool for serial nication protocol’ is a set of rules that
a microcontroller can do this much bet- communication busses. dictates the way data gets conveyed
project information
Platino Arduino 1-Wire
Serial Communications SPI
MIDI I2C PMBus SMBus
AREF
GND
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
PC7
PC6
PD0
PD1
PD2
PD3
PD4
PD5
PD6
PD7
PB0
PB1
PB2
PB3
PB4
PB5
PB7
PB6
PC0
PC1
PC2
PC3
PC4
PC5
2 4 6
1 2 3 4 5 6 K7
K3 K6 1 2 3 4 5 6
GND
GND
RST
VIN
K1, K3 ... K7 to PLATINO
+5V
3V3
1 3 5
+5V GND D2
+5V
+5V K11
1N4007
+5V 2
C6 C12 VIN
R10
R11 +3V3 +5V 100n 100u 1
3k3
GND
50V
10k
R9
RX_MIDI
220R D3
IC5 PB5
K12 1 6 5
2 D1 T3 1N4148
1 R14
PA7
1N4148 4k7
+5V
RX MIDI 2 4N35 4 2N7002
+5V
+5V +5V
14 R4
IC6 = 7400 IC6 C4 +EVCC
100k
R12
7 T1
R7
100n
220R
PA4
K13 4k7
680R
8 1 GND
TSM2307CX
VCC R6 7
K9 1 RX_485 C5 C11 C13
RO
IC3
10k
1 7 2
B RE
100n 1u 100n
2 6 3 PA0
A DE 50V
R2 LT1785 4 TX_485
DI
RS-485
680R
GND
5
+5V
C7 +5V C1
1u 100n
2 50V
16
1 VS+
C8 C1+ 16 VDD
VCC RX_232 1
2Y0
3 IC4 RX_MIDI 5
1u C1– 2Y1
K8 50V 8 9 RX_485 2
R2IN R2OUT 2Y2 IC2
1 14 11 TX_232 4 13 PD1
T1OUT T1IN 2Y3 1Z
2 13 12 RX_232
R1IN R1OUT 74HC4052
3 7 10 TX_232 12 3 PD0
T2OUT T2IN C2 1Y0 2Z
4 TX_MIDI 14
C9 C2+ 1Y1
RS-232 MAX232 100n
TX_485 15
1Y2 S0
10 PA2
15
5 GND 11 9 PA3
1u C2– 1Y3 S1
50V VS-
EN VSS VEE
6 C10
1u 6 8 7
130409 - 11
50V
Figure 1. The Platino multi-standard serial interface board has interfaces for RS-232 (K8/IC4), RS-485 (K9/IC3), MIDI (input on K12/IC5, output on K13/
IC6) multiplexed by IC2. K10/IC1 provide the interface for I2C, SPI and other 5-volt (T1) or 3.3-volt (T2) level signals where IC1 ensures the required
level shifting. Other signal levels are possible through EVCC (1.2 V to 5 V) and by mounting JP2. T3 is intended to act as the 1-Wire output.
ui.cpp
ui_splash.cpp
ui_main.cpp
ui_bus.cpp
ui_bus_serial.cpp
ui_bus_spi.cpp
ui_bus_i2c.cpp
ui_bus_smb.cpp
ui_bus_pmb.cpp
ui_bus_midi.cpp
ui_bus_1wire.cpp
Figure 4. The source code “tree” has the Figure 5. The Platino Serial Port Tester all stacked up. Platino is in the middle, the LCD is at the
Arduino INO file at its root, all other files are bottom, the interface board sits at the top.
C++ files. The header files are not shown for
clarity. Most of the files are concerned with the
user interface (UI).
component list
In the third edition of that well-known electronics bible The Art Two types of supercap?
of Electronics by Horowitz and Hill there is a so-called ‘Ragone When choosing a supercap for an application you quickly real-
chart’ on page 690 which compares the energy density of super- ize that there are in fact two basic types which distributors like
caps with capacitors and batteries. It shows that supercaps are to class as ‘Supercaps’ or ‘Ultracaps’:
moving into the category of the classic rechargeable battery.
This prompted the author to delve a little deeper. • The first type of supercap has very low internal impedance
The first thing to be aware of is that the chart has a logarithmic and is the type we will be looking at here (Figure 1).
scale, in reality supercaps still have a long way to go before
they get close to rechargeables when it comes to energy den- • The second type, mainly used for applications such as
sity. However that doesn’t mean that they should be just dis- keep-alive memory power, is called a Goldcap. Although
counted. Supercaps differentiate themselves from batteries these cannot supply high levels of current they have very
in that they can deliver enormous levels of current per unit low self-discharge (Figure 2).
weight. Supercaps also boast an almost unlimited number
of charge/discharge cycles provided they are not thermally The most important data for a Supercap or Goldcap capacitor
stressed in the process. are shown in Table 1. Notice that the relatively high inter-
nal impedance of the Goldcap has a big effect on the rate of
voltage rise.
To provide the charge current for the supercaps here we used
a simple linear voltage regulator such as the LM317. Most
regulators will limit the output current to the maximum speci-
fied value — this isn’t the most efficient way of doing it but in
practice it works without problem.
Charge waveform
Imax =1 A
sary to make use of an old trick. The voltage across a capacitor Table 2. Results of five Supercaps from the same
discharging through a known value of resistance will describe supplier (in an RC network).
a curve with a time constant t = R × C; after one time con- RC time, 63.2% of Vin
stant RC the capacitor voltage falls to 63.2% of its start value
Sample 1 27.6 s
Vin. To plug a few values in, the capacitor is first charged to
Sample 2 29.9 s
2.7 V and discharged through a 21-Ω resistor. The resulting
discharge curve can be easily captured using a digital oscillo- Sample 3 28.4 s
scope but we first need to think about calibration. To estab- Sample 4 29.5 s
lish a zero reference the capacitor terminals must be shorted Sample 5 29.6 s
together for some time.
Using this setup and with a little patience it was possible to Why is it so important to have an exact value of capacitance?
make measurements of the five supercaps under test (all from In practice supercaps are rarely used singularly, almost always
the same supplier) and the results are given in Table 2. Inter- several are connected in series. This is because of their low
estingly it is fairly obvious from the results that we don’t need maximum voltage rating: the type used here has a maximum
to look much further; just by using the formula t = R × C it’s rating of 2.7 V. When several are connected in series it forms
clear that the values of capacitance are subject to quite a wide a capacitive voltage divider. Capacitors with different values of
tolerance. capacitance will produce different values of final charge volt-
age across each capacitor when they are charged in series.
Next we take a look at the issue of measuring short-circuit If you find this difficult to believe try measuring the voltage
current. We are dealing with fairly low voltage levels and quite across two different value electrolytics in series plugged into
high levels of current so things like connections to the load a bench power supply.
must be carefully considered otherwise they could introduce
an unacceptable voltage drop. For example, standard screw
terminal strips have a resistance of around 1 ohm; at 2.7 V
the maximum current will then be limited to less than 3 A.
4.5
3.5
U SC1 SC2
3
2.5
Energy[J]
U SC
2
1.5
U SC2 SC1
1
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5
Voltage[V]
Figure 4. Energy stored and voltage has a quadratic relationship. Figure 5. Two resistors tame as well as protect the supercaps.
Table 3. The ALD8100XX series from Unlike conventional electrolytic capacitors, the internal struc-
Advanced Linear Devices. ture of Supercaps makes them extremely sensitive to over-
Threshold Threshold
voltage: with a difference of ten percent you have a choice of
Part No Part No reducing the cell voltage and accepting a lower energy storage
Voltage Voltage
capability or risking damage to the supercaps. Reducing the
ALD810016 1.6 V ALD810023 2.3 V
supercap maximum voltage has a dramatic reduction on the
ALD810017 1.7 V ALD810024 2.4 V
energy stored (Figure 4).
ALD810018 1.8 V ALD810025 2.5 V In practice overvoltage stress in a series-connected supercap
ALD810019 1.9 V ALD810026 2.6 V leads to a progressive decay which is difficult to characterize
ALD810020 2.0 V ALD810027 2.7 V without more detailed lab tests; usually the capacitor either
ALD810021 2.1 V ALD810028 2.8 V functions or Ka-Boom! The researchers Linzen, Buller, Karden
ALD810022 2.2 V and De Doncker have devised a formula [1], relating capacitor
operating voltage to lifetime and although it shows an expo-
nential relationship the units used are in years.
Balancing circuits can be used to compensate for the difference
in capacitance between supercaps connected in series. The
circuit can be made up of one or more components which in
one way or another equal out the voltage across each capac-
itor and prevent over charging any individual capacitor. The
most basic form of protection is provided by two equal-value
resistors (ideally, matched) arranged as shown in Figure 5
connected in parallel across each supercap.
and limit the voltage across each supercap to a certain level. 1000
Current
1
at the time of going to press).
0.1
0.01
It would seem these ALD series of ICs offer the ideal solu-
tion; we just need to wire them in parallel to the capacitors as 0.001
As we said this is extreme situation and according to the data tive chips for use with supercaps. Linear Technologies are the
sheet from Advanced Linear Devices this operating condition is market leader but Table 4 shows some interesting candidates.
forbidden. Their recommendation is that the supercaps are all
from the same manufacturing batch so that their characteristics Conclusion
are closely matched — the diagram in Figure 7 shows why this Supercaps are not the average sort of component you are
is necessary. Due to the chip’s limited maximum current (the likely to use for general purpose applications. Measuring their
Y axis is logarithmic), in the case of massively out of balance properties is an interesting exercise in itself when you find that
supercaps, the IC will quickly give up the ghost and the elec- the component can’t be characterized by standard test equip-
trolyte will get zapped before a sufficiently high voltage can ment. For some specific applications such as military equip-
be achieved to allow the charging current to decrease (expo- ment design, metalworking and robotics, there is sometimes
nentially) to a safe level. By the end of the charging process little alternative, in this case you could say that supercaps are
both capacitors will be at same potential and consequently the in fact the Gold standard.
balancing currents will be smallest. (160098)
Web Links
[1] Dirk Linzen, Stephan Buller, Eckhard Karden, Rik W. De Doncker, Analysis and evaluation of charge-balancing circuits on
performance, reliability, and lifetime of supercapacitor systems, IEEE TRANSACTIONS ON INDUSTRY APPLICATIONS, 2005,
41(5), 1135-1141, www2.isea.rwth-aachen.de/dataint/alumni/buller
[2] Comparison of the Different Circuits Used for Balancing the Voltage of Supercapacitors: Studying Performance and Lifetime
of Supercapacitors, https://hal.archives-ouvertes.fr/hal-00411482/document
[3] Datasheet ALD8100XX-Serie from Advanced Linear Devices, www.aldinc.com/pdf/ALD8100xxFamily.pdf
By Luc Lemmens (Elektor Labs) them. But here I recognised these immediately as great power
supplies and mounting bases for those USB lamps. “A small,
wireless desk/read/bed lamp will certainly come in handy one
I spotted them for the first time during the Peltier lamp project day”, was the thought. And for those few euros it’s a bargain…
(‘Candle2light’, September & October 2017, [1]): these cute With the packaging promising a capacity of 2000 mAh, such
little USB LED spotlights from a certain Swedish retailer that a power LED with a measured current consumption of 65 mA,
we don’t need to name. Not that I knew of an immediate appli- should run a good 30 hours.
cation for these, but it is one of those things that continue to
stick around in my head. Some time later, in one of the local I unpacked the powerbank immediately when I got home and
discount stores, I came across a Li-ion powerbank that had connected a lamp to it, and as expected, it worked perfectly
modest dimensions. These are actually intended for an emer- right away. Despite the fact that such powerbanks are not
gency charge infusion of your tablet or mobile phone when fully charged when bought from the shop, the light remained
you’re away from home or when you have forgotten to charge on for several hours. The experiment was a success, nothing
5
BAT
LED1 7
LED1 IC1 L1 C3
LED2 6 3uH3 R3
LED2 10u 4 IC2 5
1 TD VCC 100R
SW DW01A C5
K2 Battery
2 Protection 6 100n
4 8 1 CS GND
VDD OUTP OUT+
TAB 2 OC OD
D– R2
K1 R1 3 3 1
TP4303 D+ C6
1 3 4
1k
160472 - 11
The standard application schematic that is shown in the data- [1] www.elektormagazine.com/160441
sheet for the TP4303 makes it clear what this IC does: it is a [2] www.alexanderb.tk/index.php/2017/02/06/
step-down regulator for charging of the battery, and at the same hacking-a-powerbank-to-use-as-a-pi-ups
time a step-up converter for the output of the powerbank. The [3] www.haoyuelectronics.com/Attachment/TP4056-modules/
Chinese text from the datasheet ([5], I have been unable to DW01-P_DataSheet_V10.pdf
find an English version) comes out surprisingly readable from
[4] www.maritex.com.pl/product/attachment/91261/8205A.pdf
Google Translate. This indeed states that the IC switches off
after 16 seconds when the load is disconnected or when the [5] www.datasheetspdf.com/pdf/949049/TPOWER/TP4303/1
Features Indeed, why limit the Wi-Fi Desktop controlling the temperature in your home.
Thermostat [1] to the desktop? As Besides adding timers we will also add
• New firmware adds seven timers
it is, the device is already capable of the possibility to disable the temperature
• Workday & Weekend mode
controlling the heating system in your sensor to allow the thermostat to act as
• Up to seven single-shot events
home but if we add some features to a pure timer with Internet connectivity.
anytime in the future
it, it will be even better suited for this
• Up to seven daily events
task. For instance, a timer, and especially Get the time from the Internet
• Temperature sensor can be
one that can be programmed for every Barring egg timers and stopwatches,
disabled
day of the week, is a great extension for a timer needs to know the time.
Timer modes
Each timer can be assigned to a day of
the week, and for each timer the start
and stop time can be set (Figure 2).
For a week this means setting up seven
timers. However, if your working week
is from Monday through Friday and your
weekends are Saturday and Sunday, Figure 1. The new user interface section ‘Time’ is required to set up the NTP server. Note that
and if you can live with one preset daylight saving time (DST) must be set manually as it is not easily available from the Internet.
Web Links
Figure 3. Selecting ‘Timer’ as ‘Switch on’ mode will deactivate thermostat mode and turn the
device into a pure timer. [1] Wi-Fi Desktop Thermostat:
www.elektormagazine.com/160269
[2] Article support page:
www.elektormagazine.com/160631
defined by the value in the ‘Switch on’ code for it is generated and inserted [3] W3C HTML validator:
field of the ‘Thermostat’ section of the UI. into the page where it behaves like if it https://validator.w3.org/
By adding the value ‘Timer’ (Figure 3), had always been there. Consequently,
the thermostat can be told to ignore the timer customization has to be done
temperature sensor and let its output in the JavaScript file, while adding or
control by the timers only. This is a great removing timers is done in the HTML
mode for switching lights and window file. This also implies that modifications
blinds while you are on holidays or to affect all timers in the same way.
control Christmas decorations. Surely you The JavaScript code — at the end of the
can come up with other applications too. file script.js — is not very involved as
it mainly produces HTML code (see
Don’t repeat yourself the function timerBuild) adapted
Let’s have a closer look at the way for each timer so that every timer
the timers are implemented. As you uses unique variable names. This,
may recall from [1] the UI is written in of course, is necessary for the C++
HTML, JavaScript, and CSS (and talks to application to keep them apart. The
an application written in C++). Adding only complication in the code is the
seven timers to it in a naïve way would way the start and stop time boxes are
mean adding almost identical code seven changed according to the selected type of
times. In software engineering this is the timer. A future event (‘Once’) needs
something that is to be avoided at all date and time whereas daily, ‘Workday’
times as it is a great way to introduce and ‘Weekend’ events only need the
bugs and create hard-to-maintain code. time. The function timerChange takes
This programming principle, known as care of this. Inserting the HTML code into from the store
“don’t repeat yourself” or DRY, is difficult the UI is done by the function timerShow. ª160631-1
to respect when it comes to HTML, which Wi-Fi Desktop Thermostat bare
is why all sorts of wrappers and add-ons Updating the thermostat PCB
have been invented for it like JavaScript Compiling the new software and ª160100-92
and stylesheets. We have therefore programming the ESP-12F is described ESP-12F ESP8266-based Wi-Fi
defined our timer in JavaScript and put in detail in [1]. The only thing not to module
seven placeholders in the HTML page. overlook is to replace the old thermostat ª080213-71
Only when a timer is marked for use files by the new files you can download USB/TTL Serial converter, 5 V
(its checkbox is checked) the HTML from [2].
A Simple
Digital Audio Amplifier
Using a CMOS IC in an analog circuit
By Hans-Norbert Gerbig (Germany) (based on an idea from the Elektor book 301 Circuits)
Analog circuits have had their day; everything is digital now. Here we present a simple digital amplifier
built with standard CMOS logic gates, which digitizes the analog audio signal and then converts it back to
analog for output to the loudspeaker. Along with being interesting, this project can be used as the basis for
countless experiments.
N2
C1 pulse waveform.
11 10 In an FM transmitter modulation stage,
N1...N6 = IC1 = 4069U, (4049U) 1 100u
(5) (4)
noise spikes on the signal amplitude can
T2
N3 easily be eliminated by clipping them
13 12
(7)
1
(6)
with a limiter. The pulse waveform gen-
BS250 erated here is essentially the same as a
N1 N4
R2
9 8 1 2
L1 C2 PWM signal. The advantage of frequency
AF 2k2 1 1
(3) (4) (9) (10) 47uH
470u
modulation and demodulation is that it
N5 enables noise-free audio transmission,
C4 R3 T1
100k
3
1
4 as we all know from FM radio broadcasts.
(11) (12)
1u With amplitude modulation and demod-
P2 N6 BS170 ulation (as used for broadcasting in the
C3 C5 LS1
5 6
10k 1 long-wave, medium-wave and short-
lin (14) (15) 8
330p 1u
wave bands), noise cannot be eliminated
7 (8)
this way, only attenuated. Noise voltages
(for example, from atmospheric noise)
can easily alter the amplitude of the sig-
nal, and they cannot eliminated by simple
clipping because that would adversely
Figure 3. Circuit diagram of the simple digital audio amplifier. affect the demodulation process.
Why unbuffered?
You may have noticed that the circuit
calls for a particular sort of CMOS IC
with a “U” in its type designation. 2 mV to 3 mV of Noise
This “U” stands for “unbuffered” and
refers to the configuration of the output
stage of this logic IC. The input signal Input
to N1 (leaving the audio signal out of Transition begins
the picture for now) does not have
the nice steep edges you are used to
seeing with digital signals. Instead, Output
it rises or falls gradually according to
the charge/discharge characteristic
of the RC network. As a result, the
two MOSFETS at the output of the IC
remain conducting at the same time
(in a sort of short-circuit condition) for amplification factors, while buffered ICs More information about this subject is
longer than with steep signal edges. should be used in noisy environments available in an application report from
This causes periodic current spikes as well as in low-speed systems and Texas Instruments [2].
which create noise in the output signal systems with high gain. Buffered
and significantly increase the current logic is also preferable in applications
consumption of the circuit, which where constant output impedance is
is clearly undesirable with battery important, such as R-2R networks for
powered operation. digital to analog conversion.
There is also a second effect. If the
input signal has a slight amount of
noise superimposed on slow edges, Parameter Buffered Unbuffered
buffered ICs produce short oscillations Propagation delay Slow Fast
on the output signal in the transition Noise sensitivity Very high High
region.
Output impedance and
Both effects occur with buffered as well High and constant Low and variable
output transition time
as unbuffered CMOS ICs, but to a much
AC gain High Low
smaller degree with unbuffered types.
AC bandwidth Low High
Generally speaking, unbuffered CMOS
logic ICs should be used in applications Output oscillation with slow
Yes No
with very fast signals as well as inputs
systems with very low frequencies (and Input capacitance Low High
associated slow signals) and moderate
Measurement Data
Acquisition via USB
For heating system optimization
If you want to optimize a heating system, you first have to record a wide variety of parameters continuously
and precisely. Once you have this data, you can quickly assess the impact of even relatively small changes.
The data logger described here acquires a large number of analog and digital parameters and outputs them
— electrically isolated for safety — over a PC interface.
Modern heating systems have a large number of configuration system, there is no substitute for continuously recording a
options for a bewildering array of parameters. In many cases wide variety of parameters, such as the water temperatures
it is not clear or not easy to determine how these parameters in the supply and return lines and the boiler and the operating
affect the behavior of the system. Another complicating fac- states of the pumps, valves and possibly the burner. Armed
tor is the slow response of the system, which means it takes with this data, you can quickly see the effects of even rela-
a fairly long time to determine the optimal configuration by tively small changes.
adjusting the various settings. In order to truly optimize the Although many heating system controllers (including older
100k
50mA, Littelfuse
10u
on the details of its modular components.
The concept
The measuring system needs two or three different interfaces
between the input parameters and the PC. Figure 1. Schematic diagram of the digital inputs for 230 VAC line voltage.
10k0
100n
bridge over negative half-cycles.
The PCA9539 I/O expander connects the 16 digital channels
to the I2C bus (see Figure 3). The I/O expander can be set to
four different addresses with pins A0 and A1, enabling a max-
imum of 64 digital inputs for data acquisition. That should be
Figure 2. Schematic diagram of the digital inputs for DC voltages from
enough for even the most elaborate heating systems.
5 V to 24 V.
Analog inputs
The circuitry of the channels for the input voltage range of The analog inputs share a common ground and have the same
5–24 VDC is a bit more complicated. Due to the extent of the structure. The 12-bit A/D converter ADS1015 with I2C interface
input voltage range, limiting the LED current with a series has an input voltage range of 0 to 4.096 V and can measure
resistor is not appropriate because it would vary depending on four single-ended voltages sequentially. At the input of each
channel there is an opamp to amplify the measured signal if
necessary (see Figure 4).
The analog signal first passes through an RC low-pass filter
PCA9539 (R9/C4) to suppress any high-frequency noise. The dual diode
CNY17F-3 I/O Expander
D1 after the filter clamps the input signal to the supply voltage
P00
230VAC (+5 V) or ground to protect the opamp against out-of-range
input voltages. It is important that this clamping occurs after
the low-pass filter or the input resistor, in order to limit the
P07 SCL
current through the diode. If the clamp diodes were located
8x
P10 SDA directly at the input, the current would not be limited and the
CNY17F-3 diodes could be damaged by overheating.
A type OPA335 CMOS opamp is used here. The high imped-
5 ... 24VAC/DC
P17 ance of its CMOS inputs minimizes the load on the sensor. The
opamp only needs a single supply voltage, and its extremely
low and long-term stable temperature drift of 0.05 µV/K makes
8x it especially suitable for all forms of precision temperature
measurement.
VIN The circuit and the PCB layout are designed so that the opa-
R14 ... R18: see table 2 mps can be used either as buffers or as non-inverting gain
C4 stages. In the former case you simply omit resistor R11 and fit
R19 R13 R14 R15
a wire bridge (or a zero-ohm resistor) in place of R10, and in
100n
10k0
0R
24
the latter case you choose the values of R10 and R11 for the
HV DIG BUS1 4 VCC desired gain, which is equal to 1 + (R10/R11). Resistor R6 is
P0.0
HV DIG BUS2 5
P0.1 INT
1 not fitted in either case.
HV DIG BUS3 6
P0.2
U3
If neither gain nor buffering is necessary, you can omit the
HV DIG BUS4 7
P0.3
HV DIG BUS5 8 opamp and route the input signal directly to the A/D converter
P0.4
HV DIG BUS6 9
P0.5 A0
21 through a wire bridge (or zero-ohm resistor) in place of R6.
HV DIG BUS7 10 2
P0.6 A1
HV DIG BUS8 11 3
P0.7 RESET
Circuit boards
PCA9539 R16 R17 R18
LV DIG BUS8 13
P1.0 There are basically three different types of input to be han-
open
LV DIG BUS7 14
P1.1 dled here, each with multiple channels, which the author has
LV DIG BUS6 15
P1.2
LV DIG BUS5 16 grouped onto two PCBs.
P1.3
LV DIG BUS4 17
P1.4 Three addressable A/D converters are located on the analog
LV DIG BUS3 18 22
LV DIG BUS2 19
P1.5 SCL
23
SCL board. The ADS1015 A/D converter can be set to four different
P1.6 SDA SDA
LV DIG BUS1 20 addresses (see Figure 5). However, a closer look at the sche-
P1.7
GND matic diagram reveals an interesting detail: The ADS1015 has
12
only one address pin. How can you set four different addresses
with that? The answer is that the address pin can be tied to
GND or VDD as usual, but it can also be tied to the SCL or
Figure 3. Grouping of the digital inputs and connection to the I2C bus. SDA lines to set two additional addresses. However, tying the
open
VCC VCC
D1
BAT54S
R2
1 2
10k0
C2
3
100n
Analog Input
J1 U2
R9 5
1 3
VSNS 10k0 R8 AN_CH
2 1
GND OPA335 10k0
4 R10
0 ... 5V DC 2
0R
C4 C3
R11
100n 100n
open
nels are routed to the I/O expander located on the right side
ADS1015
of the board. The resistors (R14–R18) which determine the
OPA335
Buffer
12-Bit ADC address of the expander (see Table 2) are located to the right
AIN0 of the IC. Four of these boards are necessary to achieve the
SCL
0 ... 4.096V maximum possible number of digital inputs (64).
SDA
AIN3
100n
VDD 0x49 (73) ● – – –
Summary
The data acquisition system described here has been working
faultlessly for several months and has made a decisive contri-
+5V
bution to the optimization of the heating system settings, and
thereby to the efficiency and lifetime of the system. Thanks to
MSP430G2553 visualization of the relevant quantities, such as temperatures
ISO1541 and operating states, it can be seen relatively quickly whether
USB
SCL SCL changes to the parameters of the heating system controller
SDA SDA
have the desired effect and whether they are effective in the
longer term under different conditions.
PCA9539
As previously mentioned, the project described in this article is
SCL not limited to heating systems. We have shown how to route
SDA
any desired analog and digital input signals to a microcontrol-
VCC
ler and connect them to a PC for evaluation. This knowledge
can be applied to a wide variety of instrumentation tasks.
(160358-I)
Figure 8. How the microcontroller and its USB interface are isolated from Web Links
the instrumentation inputs.
[1] www.ti.com/tool/MSP-EXP430G2#0
[2] www.elektormagazine.de/160358
[3] http://energia.nu/
Isolated Power Supply
VIN [4] www.abacom-online.de/uk/html/realview.html
5.0V
VCC
C6
TR1 5.0V
10u D4
3 1 1 : 1.3 6 1 5
D2 IN U3 OUT
4
GND BAT54 LP2985-5.0
U4 2 2 5
3
ON/OFF BYPASS
4
VCC
GND
5 SN6501
GND D5 2
1 3 4
D1 C7 C9 C10
750313638
BAT54
10u 10n 2u2
100n 100n
The download package [2] for this homelab project
R21 R22
U5 R23 R24 contains:
3 A/D-Converters
1k50
1k50
1k50
1k50
1
VCC1 VCC2
8 • The firmware for Energia 16 and Energia 18
2 7
SDA
3
SDA1 SDA2
6
SDA-S • Component lists
SCL SCL1 SCL2 SCL-S
4
GND1 GND2
5 • A complete set of schematics in PDF format
• The PCB layout with component overlay in PDF format
ISO1541
• The PCB layout as an Altium project (which can be
imported into Eagle)
• Drilling files (Gerber)
Figure 9. Isolating the I2C bus and the supply voltage.
Getting started with microcontrollers can be daunting for the complete beginner. It’s not just writing the
programs but also getting to grips with some basic electronic principles at the same time. PICAXE is a solution to
the problem. It is a complete, simple to use learning platform which offers quite sophisticated capabilities. You
can later expand the basic system and transition to professional programming. We took a closer look...
PICAXE — an overview
So what is PICAXE? It is in fact a complete and extensive
modular microcontroller teaching platform comprising of both
hardware and software. The system is based on the popular
PIC family of microcontrollers. The complete system has been
designed to ensure a problem-free introduction to the tech-
nology. Several boards, offering various levels of sophistica-
tion are available but for a simple, minimal introduction the
Figure 1. Parts kit for the PICAXE 08 prototype board
starter kit includes a preprogrammed controller together with
(photo: www.picaxe.com).
a few passive components, a data transfer cable and battery
holder and is available for around 30 euros. The software can
The press and media are keen to point out that the shortage of be downloaded for free from the PICAXE home page. It con-
engineers and technologists is hampering the growth of indus- sists of all the important components such as the drivers for
try and the situation is likely to get worse if the young fail to the boards and the complete IDE.
engage with technology. The ubiquity of computing and elec-
tronics in the 21st century is undeniable and unlikely to diminish The Starter Pack
but most of us remain passive ‘users’. With all the technology Whenever you start something new it’s a golden rule that ever-
hidden behind a shiny exterior it seems almost impossible to ything’s got to go smoother with a starter pack! The PICAXE
hope you could ever understand how it’s all put together. system has a number of boards which offer various classes
Anyone starting out on the quest to learn more can be sure of power. Basically any one of these boards will be suitable to
that any introduction to the world of microcontrollers will not be run the first example. The boards differ in their input/output,
restricted to software alone but must also touch on the hard- interfacing and prototyping capabilities. The type of controller
ware aspects of a design application. Don’t ever doubt that any supported also varies depending on which board you choose.
time invested in the pursuit of knowledge will be wasted, as we The simplest is the PICAXE-08 prototyping board. In kit form
move to an ‘always connected’ future more and more devices you can order it at a cost of around 5 Euro. By selecting the
will need to communicate as the ‘Internet of Things’ takes off. corresponding starter pack (less than 30 euros) you have all the
Where do you start? Whenever you begin to explore any new hardware you need to begin. What’s include is the PICAXE-08
field of knowledge it’s important to use a tried and tested project board (Figure 1), a battery holder to power the sys-
approach which guarantees some early success. Unnecessary tem, a PICAXE microcontroller type PICAXE-08M2 and a pro-
complexity and frustration and can cause the student to throw gramming cable which connects to a USB port. Software is
in the towel too soon. PICAXE is a teaching platform with the downloadable from the project home page free of charge. At
aim to introduce the student to the secrets of microcontroller first you can use the battery holder as a power source so you
programming in a convenient and structured way. The system won’t need an external mains adapter. The system operates
has resources in the form of documentation, worked examples, at a maximum of 6 V so don’t be tempted to connect a 9 V
projects and the support of an active community to ensure that battery to the battery clip, it will damage the chip.
anyone starting out with the system will not feel out on their Choosing a kit means that some soldering will be necessary to fit
own. This article gives a brief introduction and overview of the the components. If this doesn’t appeal then you can order a fully
PICAXE development platform. By the end you should be able assembled board with the starter pack. For the more ambitious
to make up your mind whether PICAXE is the right system for there is the large AXE091U development board which supports
you (or for a third party) to start out on the path of micro- all versions of the PICAXE controller and has features to allow
Figure 2. The PICAXE IDE Editor running in Microsoft Windows. Figure 3. Overview of the PICAXE microcontrollers [1].
more sophisticated circuit experimentation and development. ware. For the first test we will just be satisfied to blink an
Together with all the other accessories this works out at just LED on the board. The LED connects to the controller via a
over 80 Euros. Altogether not an unreasonable expense for your series resistor. For complete beginners it will be necessary to
first foray into the world of microcontroller programming. The get familiar with the pin configurations of the controllers and
larger starter kit has much more potential for experimenting their capabilities. The range of microcontrollers offer different
thanks to all the additional components and devices on board. levels of processing power and control capabilities but they
In detail, amongst other features it includes: are all based on the original PIC design. Figure 3 gives an
overview (memory size, I/O pins, clock frequency etc.) of the
• Support for all the PICAXE range of microcontrollers. different models available. The chip’s pin layout will depend
• Power supply from batteries or mains adapter. on which model you choose. The three smallest versions use
• Socket for program download plus cable. the pinout shown in Figure 4. The input/output pins are mar-
• Integrated prototyping plug board. ked with capital letters (B or C) indicating the port and then a
• Power-on status LED and three control LEDs. number representing the port pin number. Circuits don’t get
• Three miniature push buttons, photoresistor, pot to simu- much simpler than Figure 5. Depending on the board you are
late analog signals, temperature sensor, IR LED and TSOP using, this can either be wired up on the prototyping area or
for testing IR remote control, 7-segment display, socket alternatively with short lengths of wire.
for PS/2 keyboard, socket for DS1307 real-time clock and The program code (Listing 1) for this first program is written
MAX202 interface chips for serial communication. in Basic and is about as complex as the hardware. The PIC
microprocessor supplied in the kit is preprogrammed with the
Let’s go! bootstrap code for program download. Some common routines
Before we get down to any serious play we need to make sure or language macros are also implemented in the code to reduce
everything is set up properly. Its always best to be working the size of the transferred code. For example to set port C pin
with the latest software version, even though the starter pack
includes a CD with all the necessary development environment
software there is likely to be a newer version available from
the home page [1] so check this out first, it also good for soft-
ware support. In addition to Microsoft Windows there are also
tools for Linux and the Mac OS. We will use Microsoft Windows.
So to begin we install the latest version of the development
environment PICAXE Editor (Figure 2). It runs on Windows 10
and versions all the way back to XP. The system library .NET
3.5.1 is required here; if you are using Windows XP or Vista
this must be installed later. Connect the download cable bet-
ween the PC USB port and the development board. The Device
manager in the System option of the Control Panel installs the
driver. A serial COM port is emulated using the USB port. In
our case COM3 is automatically chosen. This information will
be required later on during use and setup of the IDE.
First test…
The PICAXE projects emphasize the interplay between soft-
ware and hardware. First you need to connect the hardware
up according to the schematic then program the system soft- Figure 4. PICAXE microcontroller pin assignment [1].
330R
with no previous experience of programming will soon pick it
high C.1
up and in no time will be writing their first program. The pro-
LED1 pause 1000
gram implements a continuous loop which switches the LED low C.1
on for 1 second and off for 0.5 second. pause 500
0V
In this way you can use Basic dialect to create software and loop
program the PICAXE controller. Only PIC controllers supplied
by PICAXE with the preloaded bootstrap code will work with the Figure 5. The LED circuit connects to the PICAXE microcontroller.
system. This code is not available for programming into blank
controllers. All other essential information (language command
set, board specifications and uses, pinouts etc) and a whole
host of application ideas are available on the company web your own ideas and learning. It’s easy to lose track of time and
page [1]. The PICAXE environment has some unique features that’s always a good sign you are engaging with the system
that make it an ideal learning tool and we will briefly take a and actually learning something. As for the question — what
look at what’s on offer. comes next? — the PICAXE system lends itself to expansion
and already offers a wide range of expansion boards. There
From graphics to source code are for example other microcontrollers in the series which
Graphics tools such as flow charts are an effective aid for new- can offer more power and extension boards to expand capa-
comers to the dark art of coding. The PICAXE development bilities with LED displays, sensors etc for the development of
environment supports their use and also has other options. control systems for real world events. More importantly the
The entire program or parts of the program can be generated system gives a good grounding and familiarity with the PIC
using flow charts (Figure 6). The resulting code can then be range of microcontrollers. Even though in the future you may
transferred directly to the microcontroller (referred to here as a be developing commercial systems with PIC processors using
Download). More often however you will want to edit the source languages such as C or Pascal the underlying processor will
code. For this you have the possibility to convert the complete be identical and you will have a good knowledge of its capa-
flow chart into Basic. This approach allows you to graphically bilities. The PICAXE learning environment is therefore a good
define the program’s structure quickly using loops and branches solid entry-level platform with lots of potential.
etc. and then to zone in on the detail and expand the code with (150762)
individual commands and variables. It’s not possible to convert
Web Link
back in the other direction i.e. from Basic to a flowchart. Ano-
ther option is the graphical representation of the code using [1] www.picaxe.com
Blockly. This is reminiscent of the program language Scratch.
The program is broken down into a series of interlinked blocks
(For example, the body of a loop). Each block can be configu-
red individually and other constructs added such as inner or
nested blocks. Whether you choose Blockly or the classic flow
diagram is really just a matter of taste. The representation in
Blockly is a variant of a Nassi-Shneiderman diagram but both
methods are good for implementing algorithms.
Another feature of the PICAXE IDE is its ability to simulate
the program on a PC before downloading it to the chip. The
simulator is built in to the IDE and shows things such as level
changes at the microcontroller pins.
Made in England
PICAXE products are developed and marketed by Revolution Education Ltd in the UK. Components can ordered from their online
store at http://picaxestore.com.
U C T
O U R PROD
C H Y
LAUN
ONTO THE
INTERNATIONAL
MARKET PLACE!
Participate in 2018
November 13-16. 2018
Munich
Current Transformer
for Oscilloscopes
Potential-free (floating) measurement
using current clamp techniques
By Karsten Böhme (Germany) and Ton Giesberts (Elektor Labs)
Voltage
Current A
Hall
Figure 1. This block diagram shows the Sensor
Wire
functional principles of a current clamp.
L1
R13
LED1
TMR 1-1211
330R
8 LT1021 5 4u7
DNC TRIM R10
50V LED2
+5V GND 10k
8 C3 8 C5 4
IC1 IC2 S2
R1
4 470n 4 470n R8
7k5 GAIN
12k
R9 4 10
6
R5 R6 30k
P1 7
–5V 100R IC1.B 10k 20k
5
2
R2 R11 K4
IC1 = AD8552ARZ 6 1 1
C2 R7 IC2.A 0R
IC2 = OPA2197IDR
12k
7 3 2
IC2.B 6k8
1u 5
+5V C4
K2
R4 1u
K5
S1 MOD1
1 2 3 9
20k
1
2
+5V R3 2
1
IC1.A 10k Filter On
25A MOD1 7 3 AC+DC
OUT
LTS 25-NP C1
K6
0V
1u
C6 MOD1
K3 1
4 5 6 8
2
1u
150170 - 11 AC
Figure 3. Schematic for a current clamp with toroidal core, Hall sensor and output amplifier.
Testing
A first test with no connection to the
input should produce a few mV at K4
and more or less exactly 2.5 V at K5. If
this is the case, your soldering efforts
must have been successful. Now come
the adjustments: P1 is set to exactly
0.000 V at K4. A moment’s humour here:
Figure 6. Screenshot (taken by author Karsten Böhme) of current measurement of an electric don’t short-circuit K2 to K3 for this — the
motor. The sluggish curve 1 illustrates the brush contacts being displaced by the commutator. The input is sufficiently low-resistance ;-).
speedier component 2 shows the PWM frequency of the motor driver (7.8 kHz). With this dealt with, a test using ‘real
Web Links
[1] http://goo.gl/HDB7kb
[2] www.linear.com/product/LT1021
[3] http://goo.gl/uqW1vw
[4] http://goo.gl/FSiAoX
[5] www.ti.com/product/OPA2197
[6] http://goo.gl/JziUKZ
[7] www.elektormagazine.
com/150170
SDA
SCL
S B1 B2 BN P
I programmed an ATmega (with a DHT22 sensor attached) as an I²C slave and thought that I could just read the data
from the DHT22 as required in my own time. The I²C controller in the ATmega keeps the clock line low until the TWINT-
bit is reset but it takes too long! This can be accommodated by changing the timeout-register value in the BCM2835 (see
URL above), but this is not a general solution. Instead I split access into two parts: Firstly a write transaction (the data
value is ignored) triggers a read out operation and the five bytes are stored in a buffer in the ATmega. About a second
later, I can then retrieve the data without any delay.
Josef Möllers (Author of the article)
I bought the oscillator back in 1979 in Switch it on 0A3 neon-filled cold-cathode glow dis-
defective condition for five Dutch guldens and see what happens charge tube. The power dissipation of the
from a company where I was on a work My first measurements — nearly 40 years anode voltage regulator alone was a tidy
placement stint. The original new price ago — quickly revealed that the power
was US$475 in 1948, rising to US$550 transformer had given up the ghost. And (450 – 180) × 0.1 = 276 watts
a number of years later (with fairly suc- it was not a garden-variety example, with
cessful sales figures). Unfortunately my two 435 V secondaries for the anode volt- augmented by more than 28 W of fil-
unit came without documentation, so I age and four filament voltage windings ament power for the previously men-
wrote to the company to ask for help. I — three separate 6.3-V windings rated tioned tubes.
simply sat down and typed a letter, put it at 2.5 A, 2.5 A and 1 A, plus a winding Finding a replacement for such a specific
in an envelope with a stamp, and dropped for 5 V @ 3 A. The latter winding was power transformer is anyhow difficult, let
it in the post box. Nowadays you need dedicated to a 5U4G dual rectifier, whose alone rewinding it yourself, and particu-
an old dictionary to find out what those task (in combination with an electrolytic larly considering the high power dissipa-
words mean. I was more than willing to capacitor) was to convert the full-wave tion of the power supply I went looking
pay a reasonable price for a good service high voltage from the transformer to a for a different solution. By chance I had
manual, but clearly HP liked the idea that supply voltage of 450 VDC. This unregu- two identical power transformers from
someone wanted to breathe new life into lated anode voltage then passed through salvaged tube radios, which in combina-
an old device from their stable and kindly a 6 H choke to a second hefty electro- tion could provide the desired voltages
sent me an original manual free of charge. lytic capacitor. After that the voltage was and the necessary power. However, I
Nowadays hobbyists can simply search regulated down to 180 VDC, at a current switched to BY127 silicon diodes to rec-
the web for a suitable manual. of over 100 mA, by two 6L6GB tubes tify the secondary high voltage. The hefty
The photo in Figure 1 shows the test (similar to the European EL34) wired in 6-H choke remained, but anode voltage
oscillator in its present state. Read on parallel. They were driven by a 6SQ7 that regulation is now provided by an LM723
to learn how it got there. took its reference voltage from a type IC (an old stalwart) and four BU426A
transistors wired in parallel. supply, the test oscillator worked nicely specifications over a range of six decades
In the original circuit, the filaments of five right away, so I could turn my attention (10 Hz to 10 MHz), which is nearly twenty
5654 tubes (similar to 6AK5/EF95) were to the rest of the circuit. octaves. A Wien bridge oscillator is used for
powered from a sort of regulated filament the lower four decades (10 Hz to 100 kHz),
voltage obtained from a 12.6 VAC source Two oscillators while an oscillator with three RC phase-
(two of the three 6.3-V windings in series) The HP650A is a pure sine-wave gen- shift stages (see the inset ‘3 × 3 × 3 and
in series with a type 12-4 ballast tube, erator, which means it is not a function a bit’) handles the upper two decades
which has a characteristic similar to a PTC generator that derives a sine-wave signal (100 kHz to 10 MHz). The frequency range
resistor. If the filament current rises, the (or something that looks like one) from selector switch also switches the supply
resistance of the ballast tube also rises; a triangle wave or square wave signal. voltage for the two oscillators.
the result is a regulated filament current. More precisely, the generator comprises For frequency adjustment in a modern
I solved this issue by powering the fila- two completely separate oscillators. The signal generator, we would use a (multi-
ments of the five tubes concerned from state of the art and the available compo- turn) potentiometer to set the frequency
a regulated 6.3-VDC supply, which also nents at the end of the 1940s were not up within each decade range, and capaci-
enhances the hum characteristics of these to the task of building a signal generator tors with values a factor of 10 smaller
tubes. After this overhaul of the power that could work properly and within tight for each increasing decade. The approach
used in the HP650A is exactly the oppo-
site. The frequency decade switch selects
3 × 3 × 3 and a bit fixed resistors, and tuning is performed
using rotary variable capacitors (visi-
The oscillator for the two upper
A ble in the foreground in Figure 2 and
frequency decades (100 kHz to 10 MHz)
Figure 3). Here it should be mentioned
of the HP650A is a conventional phase-
that Figure 2 shows the test oscillator
shift oscillator, which consists of an
before the start of the renovation, and
inverting amplifier and three RC phase
this photo was made a long time before
stages, each contributing a phase shift
Jan Buiting asked me to write this article.
of 60 degrees, see image A.
The resolution of this photo is accordingly
However, the amplifier in this sort of
much lower than the current standard
oscillator needs to have a gain of -29,
for publication in a magazine.
in this case all the way to 10 MHz, and
The three capacitor sections on the left
that was not really feasible at the end
in the photos — with 603 pF per sec-
of the 1940s.
B tion according to the manual — form the
HP therefore opted for three amplifier + 180V
capacitive part of the phase-shift stages
stages, each with a gain of slightly
R3 R4 R6
C4 C6 C9
V1 V2 V3
of the high-frequency oscillator (see the
more than 3, see image B.
inset). The four capacitor sections on the
An additional benefit of this circuit is + 140V
the lower four frequency decades. from the AC line (in the original version) for 38 years
The two oscillators feed their signals to an serves to keep the vicinity of the device now I have the privilege of using a
output amplifier composed of three tubes, pleasantly warm. sine-wave generator that was designed,
which produces the maximum output sig- developed and manufactured in the tube
nal amplitude of 3 Vrms at the output termi- Voltmeter included era, but now operates with a combina-
nals. Even now, building an amplifier with Naturally, the user wants to know the tion of tubes (there are still eleven left
a perfectly flat frequency response from amplitude of the output signal from after getting rid of the tubes in the orig-
10 Hz to 10 MHz (within 1 dB according the sine-wave oscillator. The HP650A is inal power supply), a handful of transis-
to the specifications) is not easy, and a bit therefore equipped with a true vacuum tors and a single IC. They cooperate in
less than seventy years ago it was virtu- tube voltmeter (VTVM) with scales in mV, perfect harmony and produce sine-wave
ally impossible. Nevertheless, the para- V and dB. Due to the structure of the signals up to 10 MHz with significantly
sitic impedances of the tubes in the output output attenuator, the voltmeter read- less distortion than many function gen-
stage are compensated as well as possible ings are only accurate when the oscillator erators.
over the frequency range by implement- is connected to a load that matches its (160621-I)
ing all anode and cathode impedances as characteristic impedance of 600 Ω. For
Web links
networks of resistors, inductors with a that reason, I normally have a pair of
value of several microhenries and small resistors (330 Ω and 270 Ω) connected [1] www.hparchive.com/Manuals/
capacitors, in some cases in the form of in series over the output terminals. HP-650A-Manual.pdf
trimmers. With a maximum output power [2] www.elektormagazine.com/130423
of 15 mW (3 V into 600 Ω), it’s apparent Let’s see you do this with DDS
that most of the 165 watts of power drawn Following the revision described above,
Demonstration in Barcelona during the general strike on 3 October 2017. (Photo: Ernerst CS. CC BY-SA 4.0 licence)
On the day before the independence referendum in Catalonia, the ICT centre of the Catalan government
was raided and occupied by the Spanish police. With the shutdown of the IT centre, the official Internet
infrastructure intended to facilitate the referendum was largely rendered ineffective. Nevertheless, voting
was possible on 1 October 2017 thanks to an alternative system set up and maintained by volunteers with
technical expertise, along with the wireless Internet connections of thousands of citizens.
By Tessel Renzenbrink (Netherlands) cat, on 13 September. The site content was no longer visible;
visitors only saw a message saying that the domain name
had been taken over by the Spanish authorities. In the fol-
In the weeks leading up to the referendum in Catalonia, the lowing days, other .cat sites related to the referendum were
Spanish federal government engaged in large-scale Internet also seized, including www.ref1oct.cat. (The Internet domain
censorship. With this censorship the government restricted .cat is not dedicated to cat pictures, but instead to the Catalan
free access to information by limiting what could be published language and culture.)
and viewed on the Internet. The various censorship methods, The .cat domain is administered by the foundation Fundació
and how they were circumvented by citizens and the Catalan puntCAT. The foundation received three court orders in suc-
government, have been charted by a social activist and Linux cession, with increasingly longer lists of websites they were
programmer named Matthias (surname unknown). He pre- supposed to take down. Along with specific websites, the foun-
sented his findings at the 34th Chaos Communication Congress dation was ordered to block ‘all domains that contained any
(CCC), the annual convention of German hackers, on 27–30 information about the referendum’, which meant that Fundació
December 2017 in Leipzig [1]. puntCAT was tasked with active monitoring of all .cat web-
sites. That is an extraordinary and probably unlawful demand
.cat domains removed from the Web because the foundation, as a top-level domain operator, only
According to Matthias, the censorship started with the seizure handles registration of .cat domain names. It is like holding
of the official website for the referendum, www.referendum. Verisign, which administers the .com domains, responsible for
NEW
This book helps those responsible for providing good acoustics This book includes 400 new and original radio electronic This is an upgrade kit for Elektor’s earlier published sand
in performance and worship spaces to understand the multipurpose circuits. The technical solutions presented in the clock. Instead of writing the time in a layer of sand, it uses
variables and choices entailed in proper acoustic design for book are intended to stimulate the creative imagination of a laser module to plot the time onto a piece of glow-in-the-
performance and worship. Practicing acoustical consultants readers and broaden their area of thought. The chapters are dark sticker material. The upgrade-kit comes with all parts
will find the book a useful reference as well. The level of devoted to power electronics and measuring equipment and required to transform your sand clock into a laser writer: all
presentation is comfortable and straightforward without contain numerous original circuits of generators, amplifiers, acrylic parts assembled in a precut plate, glow in the dark
being simplistic. filters, electronic switches based on thyristors and CMOS sticker material, laser module, pushbutton and wire, brass
switch elements. spacer and small mounting hardware.
member price: £19.95 • €22.46 • US $27 member price: £31.95 • €35.95 • US $44 member price: £35.95 • €40.46 • US $49
Raspberry Pi 3
Basic to Advanced Projects
This book is about the Raspberry Pi 3 computer and its use in various
control and monitoring applications. The book explains in simple
terms and with over 30 tested and working example projects, how
to configure the Raspberry Pi 3 computer, how to install and use the
Linux operating system, and how to write hardware based applications
programs using the Python programming language. The nice feature
of this book is that it covers many Raspberry Pi 3 based hardware
projects using the latest hardware modules such as the Sense HAT,
Swiss Pi, MotoPi, Camera module, and many other state of the art
analog and digital sensors.
NEW
Talking Pi is your intelligent, universal open source speech This book is an introduction to the ESP32 processor and This DVD-ROM contains all editorial articles published in
control assistant for the Raspberry Pi. The extension module is describes the main hardware and software features of this Volume 2017 of the English, Dutch, French and German
compatible with Google Home / AIY project. Simply use voice chip. The book teaches the reader how to use the ESP32 editions of Elektor. Using Adobe Reader, articles are presented
commands to control home lighting, switch your power outlets hardware and software in practical projects. Many basic, in the same layout as originally found in the magazine. An
on and off or activate your coffee machine when you open simple, and intermediate level projects are given in the extensive search machine is available to locate keywords in
the front door. There are hardly limits to your imagination! book based on the ESP32 DevKitC development board, using any article.
the highly popular Arduino IDE and also the MicroPython
programming language.
member price: £27.95 • €31.46 • US $38 member price: £27.95 • €31.46 • US $38 member price: £21.95 • €24.75 • US $30
The Hexadoku puzzle employs numbers in the hexadecimal and these determine the start situation.
range 0 through F. In the diagram composed of 16 × 16 boxes,
enter numbers such that all hexadecimal numbers 0 through Correct entries received enter a prize draw. All you need to do
F (that’s 0-9 and A-F) occur once only in each row, once in is send us the numbers in the gray boxes.
each column and in each of the 4×4 boxes (marked by the
thicker black lines). A number of clues are given in the puzzle
Participate!
Ultimately March 23, 2018, supply your name, street address
and the solution (the numbers in the gray boxes) by email to:
[email protected]
Prize Winners
The solution of Hexadoku in edition 1/2018 (January & February) is: 7164C.
The €50 / £40 / $70 book vouchers have been awarded to: Artigue Francis (France); Joe Young (Canada);
Jean-Paul Winberg (Belgium); Mguel Án. Gimeno (Spain); Ursula Kronberger (Germany).
Congratulations everyone!
The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.
Using a 300 MHz 32-bit MCU with 2 MB of buffer memory, the MPLAB® ICD 4 programs
at twice the speed of its predecessor. Speed and flexibility are the most important
factors when selecting a debugging tool. The MPLAB ICD 4 reduces wait time—and
in turn—improves debugging productivity. With speed, compatibility, durability,
comprehensive device support and the award-winning MPLAB X IDE, the MPLAB ICD 4
is sure to help you win with your design.
www.microchip.com/ICD4
The Microchip name and logo, the Microchip logo and MPLAB are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. All other trademarks are the property of their registered owners.
© 2017 Microchip Technology Inc. All rights reserved. DS50002577B. MEC2171Eng08/17