Documente Academic
Documente Profesional
Documente Cultură
www.elektormagazine.com
Android meets
Arduino through the
Blynk framework
All models include full software and 5 year warranty. Software includes measurements, spectrum analyzer, advanced triggers, color
persistence, serial decoding (16 protocols including 1-Wire, CAN, Ethernet, IC, IS, LIN, RS-232, SENT, SPI, USB 1.1), masks, math
channels, all as standard, with FREE updates. Free Software Development Kit also available.
www.picotech.com/PS452
Edition 3/2016
Volume 42, No. 473 & 474
May & June 2016
56
precise one presented back in November2014. Here,
again we combine modern and legacy
LEARN DESIGN SHARE technologies (meaning microcontrollers
and vacuum tubes), but this time add GPS
8 Welcome to the LEARN section synchronization, and a sixth Nixie tube to
shows the seconds.
9 Tips & Tricks from readers for readers
10 Programmers and Debuggers
An overview of development tools for
beginners.
16 Which Scope?
A technically-driven survey of aspects to
consider when buying an oscilloscope
26 Q & A
49
Nearly everything you wanted to know about 56 New Precise Nixie Clock
Printed Circuit Board Planes Among the unusual features of this clock are
18
After the multimeter an oscilloscope is the most
important piece of test equipment of every active 120 From the Labs: Diversity super abounds
electronicist. It complements usefully other essential A small parade of hot projects from Elektors
devices such as lab power supply and a function kitchen.
generator. If youre looking to buy an oscilloscope for
121 Web Scouting: Handy Electronics Tips
hobby purposes or for a small lab, these days youll
The Internet comes to the rescue with your
find a wide selection of devices in a variety of price
repair and design work.
ranges. This report aims at taking the worry out of choosing and make the
right decision easier for the buyer. 116 Err-lectronics: Corrections, Updates, and
Feedback: Platino Solder Station; Platino, the
Return; Let There be LED!
70
50-W SOLAR CELL REGULATOR
next edition
Compact and Self-contained WLAN
Its easy enough these days to connect a microcontroller to
a WLAN and make it part of the Internet of Things (IoT),
Originally intended for a small weather station, this solar panel power and a wide range of chips and add-on boards is available
regulation module is ideal for all other low consumption applications too. to help. But is it possible to replace these two-part designs
The project also doubles for driving LED outdoor lighting under control of with something more compact, where the WLAN chip itself
a time switch. takes over the job of the microcontroller?
LEARN DESIGN SHARE Elektor Magazine edition 4 / 2016 covering July & August
is published on June 14, 2016.
118 Welcome to the SHARE section Delivery of printed copies to Elektor Gold Members
is subject to transport.
119 From the Labs: Ceramic versus Tantalum Contents and article titles subject to change.
Elektor breaks the constraints of a magazine. Its a community of active e-engineers from
novices to professionals eager to learn, make, design, and share surprising electronics.
Elektor Web Store: 24/7 candy store for every Elektor Magazine: Six times per year a thick
electronics engineer! Permanent 10% dis- publication packed with electronics projects,
count for GREEN and GOLD Members. news, reviews, tips and tricks.
www.elektor.com www.elektormagazine.com
Elektor PCB Service: Order your own PCBs, Elektor Weekly & Paperless:
both one-offs and larger runs. Your digital weekly news update. Free.
www.elektorpcbservice.com www.elektor.com/newsletter
www.elektormagazine.com
A World of
Electronics News
Sign up today:
www.elektor.com/newsletter
success. The investment however is well worth it if you plan to write more than,
say one small app per year.
Those of you interested in achieving your goal more quickly also have lots of tools at your disposal.
There is now more than one system on the market which can be used to build a user interface for
smartphones very easily. Using Drag and Drop, you can place basic widgets such as sliders and buttons
and also assign an action to the control element. A major benefit is that the underlying framework
also offers a certain level of platform independence, so to switch platforms to iPhone for example,
you dont need to start developing from scratch again. In this LEARN section we might suggest for
example the Blynk Framework. Also worth a mention is the NetIO by David Eickhoff. In fact, even I
managed to implement a system control (in connection with ElektorBus projects) based on HTML and
using an Android-Smartphone UI.
Whichever path you choose, you can rely on Elektor to be here for you with the latest inspirational
projects to help you on your way.
(150772)
DC motors and end stops Using this simple and cost-effective solution its
By Martin Wei important to ensure that the diodes chosen can
handle the motor current. The circuit 140562-1
DC motors are often used to drive actuators which pro-
in the article DC motor control [1] uses standard
vide a defined range of linear or rotational movement.
1N5401 diodes; they have a 3-amp rating.
Its also common practice to use a limit switch at either or
both ends of the actuator travel to stop the motor. [1] www.elektormagazine.com/140562
Have you come up with an inspired way of solving a really challenging problem? Or
found an ingenious but alternative way of using some component or tool? Maybe youve invented a better or simp-
ler way of tackling a task? Do write in for every tip that we publish, well reward you with $40(or local equivalent)!
Programmers and
Development tools for beginners
Debuggers
Atmel
AtmelICE[1] (Figure1) is capable of in-system pro- bugger has three LEDs in different colors to indi-
gramming and debugging for two very well known cate its status. The adapter board is only required
and widely used microcontroller families: the 32-bit if a particular layout of the connections is required;
SAM series based around ARM Cortex-M cores, and otherwise the ribbon cable can be used on its own.
the 8-bit AVR series. AtmelICE is available in var- The target microcontroller must always be externally
ious kits. The cheapest is a bare board without en- powered with a voltage of between 1.6V and 5.5V.
closure or cables and sells for around US$45. The
basic kit includes the debugger and an enclosure Turning now to debuggers and programmers avail-
as well as a USB cable and a ribbon cable for pro- able from other manufacturers, we find for exam-
gramming; it costs around US$70. The most com- ple at about US$60 the AVR ISP mkII[2], which is
plete kit includes an extra ribbon cable and a small only capable of programming AVR-family microcon-
adapter board for the programming connections, but trollers. Another debugger for AVR microcontrollers
comes in at a rather more expensive US$120. It is the extremely powerful AVR ONE![3], which is
is of course possible to save some money by mak- however rather expensive at around US$800. The
ing the enclosure, ribbon cables and adapter board JTAGICE3[4] has been available for a while, and
yourself. can work with both AVR- and SAM-family devices. It
1 costs around US$150. The Internet is full of other
As well as its USB2.0 interface, At- AVR programmers from more- or less-
melICE has two programming interfac- well-known manufacturers. One con-
es, one for AVR-family devices and one venient and low-cost (around US$18)
for SAM-family devices. The AVR con- example is mySmartUSB light, made by
nection includes aWire and debugWIRE Laser&Co. Solutions GmbH[5].
interfaces, a program and debug inter-
face (PDI), a tiny programming inter- All debuggers are supported by the free
face (TPI) and an SPI port for in-sys- Atmel Studio7 development environ-
tem programming (ISP). Both pro- ment (Figure2) and by most others.
gramming interfaces also offer serial Atmel Studio automatically suggests a
wire debug (SWD) and Joint Test Action debugger or programmer firmware up-
Group (JTAG) ports, with the pinouts of date if it detects that a newer version
these ports differing on the two inter- is available.
faces. Depending on the interface used,
AtmelICE is capable of operating at bus
2
clock speeds of up to 7.5MHz. The de-
Microchip
target. It features three LEDs in different colors to indicate its
status. A button is also provided to activate a special feature
of the debugger: Programmer-To-Go. In this mode the firm-
ware can be downloaded to the PICKit3 and then subsequent-
ly, by pressing the button, programmed into a microcontroller
without the need for the host PC to be connected. For larger PICKit3 was developed primarily to work with Microchips
projects and for production purposes a larger-scale debugger MPLABX IDE, and this combination does indeed work smooth-
and programmer such as the Softlog ICP2 production-quality ly (Figure4), not least because the HID driver is automatically
in-circuit programmer[7] is more suitable: its price starts at installed by Windows without any fuss.
about US$450.
NXP
For the regular LPC-series mi- For NXPs newly-acquired (from
crocontrollers from NXP the Freescale) Kinetis series of mi-
venerable LPC-Link2 is avail- crocontrollers the USB Multi-
able (Figure5), and this de- link Universal Debugger by P&E
sign is also included in a sim- (Figure6) is recommended[9].
plified form on most of the It costs around US$220. Its
Xpresso development boards. big brother, with an FX suf-
The cost is around US$20[8]. fix, is around twice as expen-
There are many headers on sive but is more powerful and
the board, and the JTAG and 5 supports a wider range of mi-
SWD interfaces are accessible crocontrollers (Kinetis, Cold-
via J6 toJ8. The other headers are simply Fire, LPC, STM32, PSoC4 and others). Un-
used to bring out the other pins of the three- der the plastic lid of the debugger there are
core LPC4370 debug microcontroller. Indeed, many headers, and suitable ribbon cables are
the debugger can be used as a development supplied. Interfaces include SWD and JTAG,
board if an external debugger or programmer as well as many specialized interfaces for the
is connected to the LPC4370 microcontroller. wide range of microcontroller families sup-
A ribbon cable is supplied to connect the de- ported. The debugger can operate at clock
bugger to the target microcontroller. frequencies of up to 50MHz, and the supply
6 voltage can be between 1.6V and 5.25V. The
Since this debugger is compatible with both FX version of the debugger can, if required,
the CMSIS-DAP and J-Link interfaces, it can be used with most supply power to the target at 3.3V or at 5V.
IDEs including LPCXpresso. The software tool LPCScrypt can be This debugger is supported by most of the popular IDEs (Kinetis
used to modify and update the firmware in the debugger. Design Studio, Keil, IAR and so on), which are compatible with
the P&E protocols and driver.
STMicroelectronics
The ST-Link/V2 debugger[10], which costs about US$35, is (9.7kbyte/s) and high-speed (12.8kbyte/s) modes and a sup-
based on an STM32 ARM Cortex-M3 microcontroller. It can be ply voltage range of 1.65V to 5.5V. The microcontroller must
used with STMicroelectronics ARM-based STM32-series micro- be provided with external power.
controllers as well as the 8-bit STM8 series. It The physically larger interface for STM32-fam-
is supplied with all the necessary cables (Fig- ily devices carries both the usual ARM SWD
ure7). It is also available in slimmed-down interface as well as the larger JTAG interface,
form on many ST development boards. Besides and hence many more pins are needed. The
the USB2.0 interface to the host PC there is a allowable supply voltage range is from 1.65V
small four-pin connection for STM8 microcon- to 3.6V, although the data inputs are also 5V
trollers and a two-row 20-pin connection for tolerant. A bi-color LED is fitted to the board
STM32 devices. and acts as a status indicator, lighting or flash-
ing in various colors depending on the state of
Cables are provided for both connections so the device.
that the microcontroller can be programmed
and debugged directly on its circuit board. At about double the price, the ST-Link/V2s
The STM8 microcontroller interface is called bigger brother, the ST-Link/V2-ISOL, differs
SWIM (for single wire interface module) and in two principal respects: for safety in criti-
requires just a reset and a data signal along- cal applications there is isolation (at up to
side power and ground lines. With the inter- 2500VRMS) between the USB port and the
face the ST-Link/V2 supports both low-speed 7 programming interface, and the SWIM inter-
Infineon
to the USB connector indicate when the debugger is powered
and when any activity takes place. The debugger should cost
less than US$100 (the exact price is not known at the time of
writing) and is supplied with a suitable cable for each interface.
All current IDEs support this new debugger. To those we can
also add the DAVE IDE from Infineon, which makes using the
9 device particularly problem-free (see Figure10). An XMC flash
tool will be available in the near future, which will simplify still
XMC Link[12] is a new debug probe for the widely-used XMC further the job of programming these devices.
series of ARM Cortex-M microcontrollers from Infineon (see Fig-
ure9). This small unit is based on an XMC4200 microcontroller
(with software based on the SEGGER J-Link) and does every-
thing you might wish for when designing projects to work on an
XMC microcontroller. It has an eight-way XMC debug connector
that works with both XMC1000 Cortex-M0 and XMC4000 Cor-
tex-M4 microcontrollers, and a standard ten-way Cortex debug
connector that works with the devices in the more powerful
XMC4000 Cortex-M4 family only.
The first of these connectors brings out an SPD (single pin
debug) and an SWD interface. A USB-to-serial bridge is also
provided, which gives you a virtual serial port that can come in
handy during code development. The larger interface also in-
cludes an additional signal (SWO) to help implement the SWV
(serial wire viewer) trace function, as well as a JTAG interface.
Both interfaces require external power from the target micro-
controller at a voltage of 2.5V to 5.5V. The debugger also has
two isolator ICs on board, giving isolation between the PC and
the programming connections of up to 1kV. The two LEDs next
10
Texas Instruments
Coming in at rather more than US$100 is the Texas Instru- a JTAG interface. By using the Spy-Bi-Wire interface this re-
ments (TI) MSP-FET[13]: see Figure11. It supports all micro- quires fewer connections than normal. Another special feature
controllers in the MSP430 and CC430 families from TI. The main of MSP-FET is the EnergyTrace (and EnergyTrace++) function,
difference between the MSP430 16-bit microcontroller family which helps to optimize code for power consumption by logging
and the newer CC430 family is that the latter includes additional and displaying it as the code is executed. UART, I2C and SPI
integrated functions to support radio communications. MSP-FET interfaces are also provided to allow the target microcontroller
is similar to the eZ-FET built into the LaunchPad development to exchange date with the host PC.
board, but offers many more functions. As well as the USB con- It is also possible to program the microcontroller over the UART
nector there is a 16-way programming connector which carries or I2C interfaces if the device contains a suitable bootloader.
11
MSP-FET is capable of supplying the target with up to 100mA
of current at a voltage adjustable from 1.8V to 3.6V. As well
as the programming interface there are two multi-color LEDs to
indicate the status of the programmer. The unit is shipped with
a USB cable and a ribbon cable for the programming interface.
This debugger is supported by IAR (see Figure12) as well as 12
Code Composer Studio (CCS) in both its stand-alone and cloud
versions. As a last resort for use with other compilers the MSP any compiler and burns it into an MSP430 microcontroller us-
Flasher program is available: this takes the output file from ing MSP-FET.
Renesas
nectors have to be wired together. The real programming in-
terface can power the target microcontroller with up to 200mA
at 3.3V or at 5V. The LEDs on the edge of the unit show the
various states of the debugger. The E20 emulator[15] is the
big brother of the E1 emulator and offers more functions, but
costs well over US$1000.
Cypress
For the rather specialized PSoC family of devices there is a small devices. It has the appearance of a USB stick and includes
debugger called the MiniProg3 (see Figure15) at a price of just two programming connectors. The first is a five-way header for
under US$100. It can program PSoC1 to PSoC5LP devices, plugging directly into the target circuit board, while the second
but the debugging functions only work with PSoC3 to PSoC5LP is a normal ten-way connector, for which a suitable ribbon cable
15
turns the Batego into an in-system programmer. bit devices such as the Rene-
Various microcontroller families are supported, from the popu- sas RX and Microchip PIC32
lar AVR and PIC series to the less well-known 80C51 microcon- families. Programming inter-
trollers from Goldstar, Dallas, Intel and Philips. The program- faces include SWD and JTAG
ming operation is very fast, and the accompanying Prog Express ports on a 20-way program-
software is very intuitive, offering all the functions needed for ming connector; a USB ca-
mass production. For example, the unit can automatically iden- ble and a programming ca-
tify unknown ICs or add a serial number into each programmed ble are supplied. If required,
device. All in all a professional-level tool. the J-Link can also power the
target board at up to 5V and
In the ARM debugging world one of the first names that comes 300mA. An isolator can also
to mind is the SEGGER J-Link debugger (Figure19). Often semi- be purchased separately.
conductor manufacturers will add a J-Link Lite circuit on their
evaluation boards or develop their own debugger hardware The J-Link devices also of-
based on the J-Link technology. It is also possible to buy J-Link fer interesting functions such
Debugger separately[20] with a range of different versions with as Real Time Transfer (RTT)
different feature levels. mode, which allows data
19
transfer to and from the mi-
The cheapest student (EDU) model costs around US$65, the crocontroller while it is running, and a program called System
PLUS model nearly US$600. One difference between the PLUS View which allows visualization and analysis of certain system
model and the EDU model is that the former allows unlimited parameters during execution. There is plenty of other soft-
breakpoints in flash memory. Even more expensive versions are ware for the J-Link: for example, for programming there is the
available, offering still more features: the most expensive have J-Flash software tool. SEGGER also offers the Flasher series
a peak download speed of 3Mbyte/s rather than 1Mbyte/s, of production programmers. In summary, the J-Link family cov-
and for example networking or more advanced trace functions. ers practically everything that is required for ARM debugging
and programming, and it is supported by almost all IDEs.
All J-Link debuggers support any microcontroller based on an (150725)
ARM7, ARM9 or ARM11 core, as well as all ARM Cortex-based
microcontrollers. On top of that, they also support other 32-
Web Links
[1] www.atmel.com/tools/atatmel-ice.aspx
[2] www.atmel.com/tools/avrispmkii.aspx
[3] www.atmel.com/tools/avrone_.aspx
[4] www.atmel.com/tools/jtagice3.aspx
[5] http://shop.myavr.com/index.php?sp=article.sp.php&artID=200006
[6] www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=PG164130
[7] www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=TPG100001
[8] www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc-cortex-m4-single-multi-core/
lpc4300-series/lpc-link2:OM13054
[9] www.nxp.com/products/interface-and-connectivity/wireless-connectivity/sub-1-ghz-wireless-solutions/
universal-multilink-development-interface:UMultilink
[10] www.st.com/web/catalog/tools/FM146/CL1984/SC724/SS1677/PF251168?sc=internet/evalboard/product/251168.jsp
[11] www.st.com/web/catalog/tools/FM146/CL1984/SC724/SS1677/PF122903
[12] www.infineon.com/cms/en/product/productType.html?productType=5546d462501ee6fd015023aeb65733b3
[13] www.ti.com/tool/MSP-FET
[14] www.renesas.com/products/tools/emulation_debugging/onchip_debuggers/e1/
[15] www.renesas.com/products/tools/emulation_debugging/onchip_debuggers/e20/
[16] www.cypress.com/documentation/development-kitsboards/cy8ckit-002-psoc-miniprog3-program-and-debug-kit
[17] www.diamex.de/dxshop/mediafiles//Sonstiges/Prog-S-Anleitung.pdf (in German)
[18] www.diamex.de/dxshop/USB-ISP-Programmer-fuer-AVR-STM32-NXP-Cortex-Prog-S2 (in German)
[19] www.batronix.com/shop/programmer/BX48/batego-II.html
[20] www.segger.com/j-link-debugger.html
Which
Scope?
How to choose the best oscilloscope to buy
By Alfred Rosenkrnzer (Germany)
Number of channels
Oscilloscopes are offered with typically 4 or 2 fully-fledged
inputs. By this we mean that they have all functions are avail-
able. These include adjustable amplitude, switchable AC or
DC coupling, 50 termination, connection to ground for off-
set adjustment and triggering capability, together with signal
bandwidth restriction for noise reduction and signal inversion.
Alongside the full-function inputs there are generally also some
purely trigger inputs with restricted functionality; on four-chan-
Figure 1. LeCroy is a manufacturer of high-end oscilloscopes. The range
nel scopes these inputs may be located on the rear of the
also includes entry-level models too, such as the type WaveAce 1001
device for space reasons.
(Photo: Teledyne LeCroy).
olution. Especially with low-cost devices you should examine or peak values. Other standard options include calculated DC
the display closely, in particular from all side angles. A lowly voltages, positive and negative peak values, pulse widths, rise
vertical resolution of 240 lines cannot manage to display all and fall times, the duty cycle, over and undershoots, the fre-
the steps of an 8-bit A-D converter. Whats more, there are quency of the trigger signal and much more.
even devices that although equipped with displays having 640
x 480 pixels, are nevertheless driven by controllers designed Most of these values can also be measured using the cursor, as
for only 320x240 pixels, which is pretty useless. Alongside the long as you operate the oscilloscope manually. Under remote
previously standard 4:3 aspect ratio, more and more displays control this often doesnt work though.
are being made in the 16:9 format. These widescreen displays
provide sufficient space available on either side for soft keys Operating systems
or menus. On quite a number of devices you can even hook Ever since oscilloscopes were equipped with microcontrollers,
up a large-screen monitor or beamer (data projector) using operating systems have also been drawn into the equation.
VGA, DVI or HDMI although the usable screen resolution Initially (and frequently still to this day) each of the manu-
can seldom be increased in this way. facturers followed their own agenda. Often you find that dif-
ferent products from the same manufacturer do not share a
Resolution of the A-D converter uniform software basis. In previous times even the way that
Currently 8-bit chips are still commonplace, which do not make data was stored on diskette was in a proprietary format that
full use of the available vertical resolution of displays. Only the PCs could not read. Expensive oscilloscopes even had indus-
expensive devices are equipped with 10-bit A-D converters.
Some high-priced examples offer a high resolution mode using
12bits. With these you must definitely check whether there
are any restrictions with the sampling rate and whether the
resolution is genuinely 12bits or simply interpolated.
Storage depth
The greater the storage depth, the longer the sequences that
you can record, so that afterwards you can search back for some
special event or occurrence that you cannot trigger or force to
recur. Memory in itself has definitely become cheaper to buy.
All the same, you need to be aware that it for this application it
needs to be very fast memory and this doesnt come cheap.
In this regard the ability to retrofit memory varies. With some
models a fairly large amount of memory is already installed
and (for money) you can activate it by entering a code. Other
oscilloscopes need to be upgraded hardware-wise (if this is
feasible). Frequently you need to send the device back to the
makers for this.
Trigger options
Figure 3. So-called soft keys beside or below the screen are standard on
Not without good reason, the trigger options of a modern oscil-
more expensive models too (Photo: Siglent).
loscope fill many pages of the user manual, covering the exten-
sive options available for analog devices. You should research
whether any special modes that you require are available. trial computers built-in, along with all their pros and cons. In
Surefire triggering on analog video signals is generally not those days you had typical PC interfaces together with PC-type
provided nowadays, but there again there is ever less need for memory and processing performance (no longer any problem
this. Detecting symbols in serial bit streams or specific words with data formats).
on digital ports has become far more important now. Frequently
you are able to trigger on pulses that are too narrow, too wide, In the main the useful life of an oscilloscope is significantly
missing altogether or otherwise abnormal. longer than the support for a PC operating system can be
guaranteed. For this reason even today you will find scopes
Cursor measurements still running Windows95, as substituting a more modern OS
Very straightforward values in a signal can be established with would also require replacing the processor module. A further
the help of the cursor. Here were talking about not just abso- risk is that a PC can catch viruses. Getting to the point, you
lute or relative voltages but also the timing. On superior-class then need to install a virus scanner in the scope and update
instruments you can lock one or more cursors to the wave- it regularly as well.
form, in order to take measurements at specific points in time.
Boot-up time for a PC oscilloscope is usually longer than for
Automatic measurement functions a proprietary system (and seems to get longer with increas-
Modern oscilloscopes offer many and varied functions in this ing age). Firmware upgrades are installed easily by USB stick
department. AC voltages can be displayed either as effective these days.
USB devices
For their control arrangements and screen these devices rely
on a connected PC, which looks after not only the display but
also controls and sometimes even a power supply for the hard-
ware. These days there are even USB oscilloscopes that are
optimized for use with a tablet. These portable gadgets are
highly convenient for outdoor use and for site visits to custom-
ers. In these situations you generally have a laptop or tablet
with you. USB oscilloscopes with high sampling frequencies are
available at correspondingly high-end prices from manufactur-
ers with world-class reputations. The model from Pico capa-
ble of 5GS/s shown in Figure5 is an example of this kind of
device. For lab use, however, many developers prefer a real
oscilloscope of the static or bench variety. Mobile devices are
also made with screens and controls optimised specially for
field servicing applications (Figure 6).
Figure 4. Highly practical: Devices with large front panels provide separate
operator controls for each of the channels (Photo: Tektronix).
Interfaces for remote control
Digital oscilloscopes are particularly well suited as measurement
Control concepts devices in automated test configurations. A central computer
The multiple configuration options demand thorough examina- initiates the measurements and collects the data. This is often
tion. You should be able to modify the frequently used func- carried out in association with other measurement apparatus
tions like amplitude, offset, timebase, triggering etc. with their and/or switch boxes. In this situation the automated mea-
own individual controls. Functions used only occasionally can surement functions mentioned earlier come into their own.
be adjusted using menus. Captured waveforms can be transferred complete to the host
Many scopes make use of so-called soft keys. Effectively these machine. On better-equipped oscilloscopes you can even define
are virtual buttons displayed beside or below the main screen, tolerance ranges for the expected waveforms, meaning that
on which any corresponding function are displayed (Figure the scope alerts you only if this range is exceeded. This tech-
3). Touch screens are not normally provided and even opera- nique avoids any need to transmit the entire data to the host
tion by mouse is hardly ever an option, as this kind of luxury and saves valuable time for its evaluation.
appears to be reserved for royalty, whose budgets are not
matched by small labs. How intuitive the operation is in real- Initially the GPIB interface was favored in many cases. It uses
ity is something that you will discover only after a period of parallel transfer for the data, making the massive connectors
practical use, mores the pity. and cables used seriously expensive. An advantage was that
One point must be stressed in particular. With the more basic the GPIB bus could be looped through from one device to the
oscilloscopes there is frequently only one set of controls for next so. All you needed do was assign them different addresses.
In order to avoid ground loops in large measurement config-
urations, special GPIB isolators were used.
Web Links HAMEG uses the good old RS-232 interface. It is, however,
slow and is found very little on newer PCs and hardly at all
[1] https://en.wikipedia.org/wiki/Oscilloscope
on laptops. In the meantime, and not without reason, the
[2] www.keysight.com USB interface has come to dominate. Its disadvantage is the
[3] www.tek.com lack of ground isolation but practical workarounds can be had
[4] http://teledynelecroy.com/ using USB isolators. All the same, the last-named have a dis-
advantage: their built-in DC-to-DC converters may produce
[5] www.rohde-schwarz.com
interfering signals.
Mathematical functions
Most modern oscilloscopes offer the ability
to combine mathematically the displayed
waveforms with one another. This extends
well beyond the options on analog oscillo-
scopes like simple adding, inverting and
subtracting. Frequently FFT spectra can
also be calculated. That said, this integral
function is not a complete substitute for a
real spectrum analyzer, as the resolution
of the 8-bit A-D converter restricts the
dynamic range significantly. On models
with PC operating systems you can also
take advantage of software packages.
Probes
Figure 5. High-end USB oscilloscope by Pico, with 5GS/s and USB 3.0 connector
An oscilloscope measures the sequence of
(Photo: Pico Technology).
voltages over time. The inputs are gener-
ally equipped with the proven and RF-ca-
pable BNC connectors. The input imped-
ance is typically 1M with a parallel
capacitance in the range of 10 to 15pF.
Normally a 10:1 probe is provided per
input channel. Its bandwidth should be
no smaller than that of the oscilloscope. A
10:1 probe raises the input impedance to
10M with slightly reduced capacitance.
It should be noted that with RF applica-
tions the capacitance is more likely to be
the relevant dimension.
Have you heard about CircuitMaker, the free PCB design tool by Altium? It shares its DNA with Altium
Designer and is focused on the Open Hardware and Maker communities. In this edition we introduce the
product by opening The Community Vault and visiting the Octopart Library. Welcome!
Community storage
The Community Vault is more than an online
file system as it also has collaboration and
versioning features that make CircuitMaker
a powerful community platform. One
example is the project team feature
Figure 1. CircuitMaker start window.
shown in Figure2 where you can add new
members to a project. Team members also
get assigned access rights which specifies
One of the great things about CircuitMaker is that its 100% what they can do to the project files (like editing). Another nice
free to use once you register on the CircuitMaker website [1]. team feature is that all of the team members project activities
In this first installment of a 3-part get-u-going article, lets will show up on the CircuitMaker workspace start page so all of
take a look at some of its unique features. the members will see whats been happening with the project.
The Vaults file versioning system is integrated right into
Open by design CircuitMaker which makes it very easy to use. When you
CircuitMaker is open by design which emphasizes sharing checkout a project, CircuitMaker will download it and store all
and encourages open hardware designs. Every time you of the files in a local cache on your computer. You can then edit
start CircuitMaker it connects you to the online CiruitMaker and save the files as normal which triggers the Vault to notice
community like in Figure1 where you can see a list of popular that the files have changed. However, those changes wont be
projects as well as your own. What makes CircuitMaker open updated in the Vault until you commit them with the Commit
is that all of the projects are stored online in the Community Project command. The Vault then creates a new version of
Vault and are available to everyone. the files every time you commit changes so that none of the
Sharing project files is a step in the right direction for creating previous changes are lost. You can also add a small message
an open design but what about all of the component libraries to each commit to keep a history of what was change. For
that were used? Quite often they can be a significant about of example, Added a green status LED makes more sense than
Revision 32. If you ever want to go back to a previous version Web Links
or revert your changes you can use the Revert command to
[1] www.circuitmaker.com
see all of the stored file versions that you can pick from.
[2] http://documentation.circuitmaker.com/display/CMAK/
Project+Management+in+CircuitMaker
File versions are essential when working as a team because
the canonical version is always the last revision stored in the [3] https://octopart.com/
Vault. A file automatically becomes locked in the Vault while a [4] http://documentation.circuitmaker.com/display/CMAK/
team member edits it locally and that lock is released when the Component+Management+in+CircuitMaker
file is committed. Locking the file prevents anyone else from
editing it at the same time to prevent someone else accidentally
overwriting the file. Once the Vault has been updated, any
other team members locally cached files become out of sync
and is called a conflict until they update their files with the
Update command.
The Vault also supports forking a project like in Figure3 which
is a great way share it because it lets others make their own
version of your project without disturbing yours. Its called
forking because the new project will get a copy of the original
projects version history up to the fork point in the new projects
Vault. Any changes that are committed to the fork will only
update the fork and not the original project giving a timeline
that resembles a fork. But fork carefully because its not possible
to combine or merge forks together in the future.
Another key part of the Vault version system is snapshotting Figure 2. Adding team members to a project [2].
which CircuitMaker calls Releases. A Release is a reference to
a project version in the Vault that then gets displayed in the
project releases tab. You cant change a release but its great
for referencing the project at a particular point in time like
when you generate all of the board output files.
Octopart libraries
Everyone dreads component libraries because they are a lot of
work to create and maintain. The worst part is that components
can be remade over and over as people make them for their
own use because there really isnt a good way to share them.
CircuitMaker tackles this problem head on by providing a public,
shareable library in the Community Vault thats also linked to
Octopart [3] as shown in Figure4.
When you search for a component in CircuitMaker it returns the
matches that are found in the Octopart parts database. Thats
a great resource because it contains almost any component
Figure 3. Forking projects [2].
imaginable along with technical information, suppliers, pricing
and stock levels. This information is then summarized and
displayed in the CircuitMaker Libraries panel so that you can
select the part that best matches your needs. Each component
also contains a reference to the component in the Community
Vault if it already exists so that you can use it right away in
your design. Otherwise you can make a new component that
will then get stored in the Vault to be shared with everyone.
That way the CircuitMaker community can constantly improve
and extend the component library as needed.
But dont worry if the component you need isnt in the Octopart
library because CircuitMaker also lets you create custom parts
as part of your project as well. The custom parts will always be
shared with the project but wont be part of the Octopart library.
Those are some of the features that CircuitMaker an interesting
community platform.
Next time we will make a project, add a schematic to it and
get everything ready for layout.
(150741) Figure 4. CircuitMaker component library [4].
Figure 1. Example plane. Figure 2. Hatched plane (top), solid plane (bottom).
Printed circuit board planes have a variety of uses. Lets take a Web Links
closer look and answer some common questions about them. [1] www.sigcon.com/Pubs/edn/
Board Planes
strmicromodes.htm
[2] www.maximintegrated.com/en/
app-notes/index.mvp/id/4636
side isnt a straight line because there isnt High-power circuits also tend to make
a current path between the two planes. In use of planes, especially smaller ones to Equi-potential
electric field
contours
this case the return current will eventually connect different components. Large cop-
find an indirect route back to the source, per areas have lower resistance, which
Electric
creating signal integrity issues and noise increases the current rating for the same Signal Trace
field
Q:
Dielectric
How are planes used? to ambient air, which allows the board
to be used as a heatsink for the compo-
A:
V CC
The Blynk framework works by using a vantage to the Blynk approach, which is the screen looks after configuration has
server on the Internet through which all its response speed. been successfully completed. The cryp-
communication passes. An app running tic sequence of characters in the screen-
on the Android- or iOS-based smart- Baby steps shot is the authentication token that you
phone connects to this server as a cli- Blynk comes with default settings for a have been allocated for the project. This
ent, while the microcontroller board is wide range of microcontroller boards. An globally unique ID code will later be pro-
programmed with firmware that also Arduino Uno, connected to a gateway PC grammed into the microcontroller.
talks to the server (see Figure1). over USB, suffices for simple experiments. Tapping the Create button takes you to
In many ways, however, the Arduino Yn the design view. If you tap in an empty
The smartphone app includes a GUI stack is an ideal solution. Its Linux-based sec- area of the layout screen you will bring
that lets you put together user interfaces tion can establish a connection to a WLAN up the list of control elements that you
and even entire applications with just a which can then be used to provide wire- can add: choose, for example, the slider
few taps. However, there is one disad- less communication without any further and drag and drop it wherever you like on
fuss. the screen (see Figure3). Touching the
To try the whole slider opens the parameter window shown
thing out first in Figure4 where you can choose the pin
install the Blynk on the microcontroller board that is to be
App[1] on your driven. Closing this window returns you
smartphone. The to the main layout screen. Now you can
first time the app switch the app into run mode by tapping
is launched you the play symbol in the upper right corner
will be required to of the screen. The control elements go
register: it is not a live immediately.
good idea to use a
throw-away e-mail Arduino code
address. When On the Arduino side it is necessary to
setting up a new download the Blynk library, available
project you must at[2]. If you use the download button on
select your par- the main site you will run into trouble, as
ticular category the version there is not compatible with
Figure1. The architecture of the Blynk system is fairly straightforward of hardware. Fig- the current edition of the Arduino IDE.
(source: http://docs.blynk.cc/). ure2 shows how Instead, open the URL in your favorite
Figure2. The cryptic string of characters in the Figure3. A slider is the only element in our first Figure4. D3 is the pin which we shall control
middle of the screen is the authentication token. user interface design. using the slider.
Tapping the button marked E-mail sends the
code to you.
browser and click on the Download ZIP for initialization and in the main program Whats going on?
button highlighted in Figure5. loop: this is done using the methods The Arduino Yn uses its WLAN module to
Then, in the Arduino IDE click on Sketch begin() and run(). create a connection to a server provided
- Include Library - Add .zip library and by Blynk, and identifies itself to it using its
then select the archive file Blynk-library- After programming the Arduino, switch unique authentication string. Basically the
master.zip. Once the library has been the smartphone application briefly into same thing happens on the smartphone
installed successfully it will appear in the stop mode and then restart it. You will side, the only difference being that here
list of libraries under the name Blynk. then find that you can without difficulty instead of an application written inC, the
In the next step, replace the code in the control an LED connected to port pin D3 programming language is Java (under
sketch with the contents of Listing1 (all via a suitable current-limiting resistor. If Android) or ObjectiveC (under iOS).
listings can be downloaded from[3]). there are connection problems you may The communication proper is imple-
Dont forget to change the value of find some help in the messages output mented using text-based commands. So,
auth[] to match the strong shown on on the serial monitor port. for example, the GPIO pins are controlled
your smartphones display: otherwise you
will end up controlling the Arduino Yn
sitting on the authors bench!
If you link in Blynk directly from the
library menu you will be rewarded with
a large number of header files that cannot
be compiled. For simple experiments with
the Arduino Yn we need only Bridge.h
and BlynkSimpleYun.h, as shown in the
listing.
Defining the constant BLYNK_PRINT
means that the library will output debug-
ging information as it runs. When you
are satisfied that the network connection
is operating as it should you can delete
this definition and thus save a few bytes
of code.
The rest of the code is really very simple.
Blynk needs to execute some code both Figure5. This button downloads the entire archive.
using the pm command, with parameters Virtual pins of Digital select the Virtual option and
separated by null bytes. Directly switching the state of an then associate the three sliders with the
The documentation available at[4], individual pin from your telephone is not pins V0, V1 andV2.
in combination with the open-source always exactly what you need. Although
Arduino Blynk library, is helpful in the we have not made any measurements of The code for the Arduino is shown in
early stages. In the case where a system the latency of the system, it is clear that Listing2. The three pins connected to the
refuses to operate at all, the author has routing commands via the server is not cathodes of the RGB LED are configured
found a network sniffer very handy. the ultimate in efficiency. Blynk mitigates as outputs in the setup function.
this problem through the use of virtual Blynk uses an event-driven structure. The
One point to note is that Blynk does pins. These are really nothing more than advantage of this for the programmer is
not necessarily require an Internet simple variables which can be written to that the code of the main loop does not
connection to run. The server, written in and read from in the Arduino software, need to be changed: as before it just
Java, is available for download from the and again communication between the involves a call to the run() function.
developers pages at[5]: all you need smartphone app and the Arduino is done The intelligence in our program resides
is a suitable computer with the Java8 by exchanging text strings. Of course in the three event handlers, which are
runtime installed. there is still a delay, but now the Arduino declared using BLYNK_WRITE macros
After the server code has been installed can respond to a command by changing taking as argument the number of the
the smartphone app must be reconfigured the state of several pins, or by running virtual pin in question. The param object
by tapping the traffic light icon highlighted any other code you might want. then represents the data source. Tex-
in Figure6. You can then make the tual data from the smartphone app can
app connect to the new server. On the Again we can test this using an example. be converted to various types: in this
Arduino side a small change is needed to Instead of connecting a single LED to example asInt() is used to produce an
the firmware: the call to Blynk.begin() D3 connect an RGB LED to the Arduino integer variable.
must specify the host name or the IP using pins D3, D5 andD6. Stop the Blynk
address of the server as follows. app on the smartphone and remove the The RGB LED we are using has a common
slider (by tapping on it and then selecting anode connection. We must therefore
Blynk.begin(auth, your_host); Delete). Now add three new sliders to invert the values received from the
Blynk.begin(auth, the window, and tap on the pin attribute sliders, so that a value of zero in the
IPAddress(xxx,xxx,xxx,xxx)); to open the pin selection dialog. Instead smartphone app corresponds to the LED
being dark.
The Blynk app does indeed include a
special-purpose RGB color controller
element, but unfortunately at the time of
writing it does not seem to work correctly.
on the setup() and loop() functions. Future revenue will be generated from the
SimpleTimer periodically calls a method sale of widgets for the Android app (with
called sendLightInten(), which we must prices from US$5 to US$20).
implement ourselves: see the listing. In
that function the call to virtualWrite() Conclusion
is used to send the data produced by the If minimal latency is important in your
analogRead() function to the smartphone application you are unlikely to have much
app. joy with the Blynk framework, even if you
run your own server. The library shows its
The reward for all this effort is shown real strengths when an application must
in Figure8. be built with an absolute minimum of
effort: a good example of a situation like
Data on the Internet this is building prototypes.
Another interesting feature of Blynk is (150198)
that the Arduino can now take advan-
tage of the smartphone to which it is
Figure8. Blynk can show the trend of readings
connected to send all kinds of different
from a sensor.
messages.
So, for example, a sketch can fire off an Web Links
e-mail or send a tweet using a simple
[1] www.blynk.cc/
Unfortunately in practice this approach call to the appropriate method, along the
causes the network connection to drop lines of the following example. [2]https://github.com/blynkkk/
(among other problems): the reason blynk-library
is that the delay() function puts the Blynk.tweet(Hey, Blynkers! My [3 www.elektormagazine.com/150198
Arduino into a deep sleep mode, in which Arduino can tweet now!);
[4]https://github.com/blynkkk/blynk-li-
it can no longer maintain the connection brary/blob/master/extras/docs/Imple-
Blynk.email(my_email@example.com,
to the Blynk server. menting.md
Subject, Your message goes
here); [5]https://github.com/blynkkk/
An alternative approach is to use the
blynk-server
SimpleTimer library, which can be
[6]http://playground.arduino.cc/Code/
downloaded from[6]. Download the Who pays for it all?
SimpleTimer
header files and the .cpp files, and then The project is funded by Kickstarter
extract the archive into the directory C:\ and at the moment is completely free
Program Files (x86)\Arduino\libraries\ to use. Use of the Blynk server should
SimpleTimer. You can now restart the remain free in the future: after all the
IDE and then enter the code in Listing3. source code is freely available and so if
SimpleTimer is conceptually similar to push came to shove you could compile
Blynk: this library is also a parasite it yourself.
SimpleTimer timer;
void sendLightInten()
void setup() { {
Serial.begin(9600); Blynk.virtualWrite(V0, analogRead(A0));
Blynk.begin(auth); }
Saturable Reactors
Peculiar Parts, the series
By Neil Gruending (Canada)
In this third and closing installment we deal with custom BOM output goodies.
Adding the Elektor list type button executed when that button is selected, but this is optional.
to the dialog box In our case the radio button will have the text Elektor and the
The first thing we will do is add an Elektor option to the output selected radio button will be stored in the global variable List-
format portion of the dialog box like in Listing 2. Type. ListType will be0 if the Parts list type button is selected
and will be 2 if the Elektor type is selected. When the Elektor
dlgGroup(tr ("List type")) button is selected, the function GenerateElektorList will be
{ executed to update the displayed text which we will implement
dlgRadioButton(tr ("&Parts"), ListType) later. Also, the List attributes dlgCheckBox object shows
GeneratePartList ();
how to use a statement block using braces instead of a single
dlgRadioButton(tr ("&Values"), ListType)
function call. Now when you run the BOM script you will see
GenerateValueList ();
the Elektor option just like in Figure1 even though it doesnt
dlgRadioButton(tr ("&Elektor"), ListType)
GenerateElektorList ();
actually do anything yet when you click on the Elektor button.
dlgCheckBox(tr ("List &attributes"),
UseAttributes) { Writing GenerateElektorList
if (!UseAttributes) { The BOM ULP uses a global variable called Lines that stores
NumParts = 0; each line of text in the generated BOM. The Lines data is then
} used to update the displayed text, viewing the output file and
CollectPartData(CurrentVariant); saving the BOM to a file. That means that all we need to do is
GenerateList(); to update the Lines variable from within our GenerateElektor-
}
List() function and the BOM ULP will be able to handle every-
}
thing else for us.
Figure1 shows the BOM output for the Parts list type where
Here Ive modified the BOM ULP dialog box setup code to add the components are grouped together by type and displayed
a radio button called Elektor to the Output format group. A one per line along with all their properties. That wont work
radio button is a small circle that changes state when you click for the Elektor format but the Values list type is very close to
on it. When you put multiple radio buttons into a group like the output we want because it groups matching components
in Listing2 Eagle will make sure that one and only one radio together on the same line. This is done in the GenerateVal-
button in the group is active at a time. The first dlgRadioButton ueList() function so we will use it as the basis for the Genera-
parameter is the text to display next to the button. If the text teElektorList() function and modify it like in Listing3.
contains an ampersand (&) then the next character with will be
shown with an underscore and the user may select that radio void GenerateElektorList (void)
button by using the Alt key and the underscored character. The {
second parameter is an integer that stores which radio button int NumLines = 0;
int Index [];
is currently selected. If theres a statement after that then its
string attr[], s, s_val; Headline), the part library name (PartDevice), the part PCB
footprint (PartPackage) and then any extra component attri-
if (UseAttributes) s = strjoin(AttributesList, ','); butes (created earlier by joining the PartAttributes separated
by commas into a string).
Lines[NumLines] = tr ("Parts = Value, Description,
At this point the Elektor format will work within the BOM ULP
Device, Package");
but it gives the perception of too many commas if any of the
if (s != "") Lines[NumLines] += ", " + s;
part fields are empty. This is especially true if no user attri-
NumLines++;
sort (NumParts, Index, PartValue, PartDevice, butes are present because every line would end with a comma.
PartPackage, PartAttributes, PartName, I fixed that by replacing the code that added the part fields to
PartHeadline); Lines with the code in Listing4.
for (int n1 = 0, n2 = 0; ++ n2 <= NumParts; )
{ // add part fields and skip empty ones
int i1 = Index [n1]; Lines[NumLines] += " = ";
strsplit (attr, PartAttributes[i1], Separator); int fieldCount = 0;
if (UseAttributes) s = strjoin(attr, ','); if (PartValue[i1] != "")
s_val = attr[i1]; {
if (n2 < NumParts) Lines[NumLines] += PartValue[i1];
{ fieldCount++;
int i2 = Index [n2]; }
strsplit (attr, PartAttributes[i2], Separator); // this if statement is repeated for each field
if (PartValue[i1] == PartValue[i2] && if (PartHeadline[i1] != "")
PartDevice[i1] == PartDevice[i2] && {
PartAttributes[i1] == PartAttributes[i2]) if (fieldCount > 0)
continue; {
} Lines[NumLines] += ", ";
Lines[NumLines] = ""; }
for (;;) Lines[NumLines] += PartHeadline[i1];
{ fieldCount++;
Lines[NumLines] += PartName[i1]; }
if (++n1 < n2) // the rest of the fields
{
i1 = Index [n1]; The new code will skip empty fields and will only add commas
Lines[NumLines] += ", "; if more than one field as already been printed. The number of
} printed fields is maintained by fieldCount.
else With those changes, were finished adding the Elektor list type
break; the BOM ULP. I ran it on the example Arduino project included
} with EAGLE and got the output in Listing5.
Lines[NumLines] += " = " + PartValue[i1] + JP1, JP2, JP3, JP4 = PIN HEADER, PINHD-1X1, 1X01
", " + PartHeadline[i1] + C8, C11 = 100n, CAPACITOR, European symbol, C-EUC0603,
", " + PartDevice[i1] + C0603
", " + PartPackage[i1] + RN1, RN5 = 10K, Array Chip Resistor, 4R-NCAT16, CAT16
", " + s; Y1, Y2 = 16MHz, RESONATORMU, RESONATOR
Q1, Q2 = 16MHz, CRYSTAL, XTAL/S, QS
NumLines ++; R1, R2 = 1M, RESISTOR, European symbol, R-EU_R0603,
} R0603-ROUND
Lines[NumLines] = ""; RN3, RN4 = 1k, Array Chip Resistor, 4R-NCAY16, CAY16
} C10 = 1u, CAPACITOR, European symbol, C-EU0603-RND,
C0603-ROUND
The first part of the function takes all of the user defined attri- RN2 = 22R, Array Chip Resistor, 4R-NCAY16, CAY16
bute names stored in AttributeList as an array and joins them
together into one string separated by commas. These extra
names are then added to the first line Line[0]. Line[0] is spe- Conclusion
cial because it defines all of the column labels for the text, but This concludes the series on how to write EAGLE ULP programs
in our case there will just be one column with all of the data. by looking at the EAGLE BOM ULP and then modifying it to
Then all of the part data is sorted so that all of the components add a custom Elektor format. There are a lot of other great
are arranged by type and identical parts are next to each other ULP examples included with Eagle and be sure to check the
in the arrays. The code then loops through all of the parts in online documentation as well the next time you need a cus-
the arrays by grouping any identical parts and then updating tom command. It may be easier add than you think! A good
the next Line location with the part information. The reference way to learn EAGLE and its powerful ULP is to study Mitchell
designators (PartName) are added first and are separated by Duncans reference book THE EAGLE COMPANION available
commas if theres more thanone. Then an equals sign fol- from Elektor
lowed by the part value (PartValue), the part description (Part- (150477)
The Professional You hack things to make this world a better place. You work 40 hours a week (most likely as an engineer), but youre
a Maker the other 128 hours. You spend way too much time on Hackaday and Hackster.io. You love datasheets and application notes!
The Novice You might be a student, real or self-proclaimed. You spend hours on the Instructables website. Youre learning your way
through a cool invention. Youre an electronics tinkerer or always wanted to be one. You have an AVR Man mask from the latest Maker Faire.
The Entrepreneur Youre about to start a company with a new project. Or youve already created the thing that will change the world.
Your favorite websites are Kickstarter and Indiegogo. Your motto is Fund me, Fund me, Fund me..please! Your best friend is coffee.
The Professor You teach students how to use electronic systems and devices. You tinker around so you can educate your class on new
technologies. You know the answer to the question before the student asks it. Your favorite website is a book. Your office is chocked full
of dev boards and eval kits.
The Hacker You are the type to tear apart a toaster just to put it back together, but this time as an alarm clock. You always want to
reverse engineer things that already work. You were the most photographed attendee at the last Maker Faire. You think labels are lame.
Check out how you compare to the Makers around you! Show everyone your favorite or coolest projects and check out what others are doing.
http://blog.atmel.com (150777-3)
www.cypress.com/ble (150777-1)
Jan Buiting,
your ElektorBusiness Editor
Now shipping:
NXPs QN902x Bluetooth SoCs and dev kit
Mouser Electron- stack and profile software on a single chip, providing a flexible and
ics is now stocking easy-to-use BLE SoC solution. The SoCs include a four-channel 10-bit
QN902x ultra-low- analog-to-digital converter (ADC), two analog comparators, and up to
power Bluetooth 31 general-purpose input/output (GPIO) pins. QN902x SoCs operate
systems-on-chips from a power supply range of 2.4V to 3.6V and have very low power
(SoCs) and the consumption in all modes, enabling long lifetimes in battery-operated
QN9020 Blue- systems while maintaining excellent RF performance. In addition, engi-
tooth d evel op - neers can use the QN902x as a network processor to add Bluetooth
ment kit from NXP Smart connectivity to almost any product by connecting the SoC to an
Semiconductors. application processor via UART or SPI.
QN902x SoCs are The NXP QN9020 Bluetooth development kit provides easy-to-access
highly integrated ultra-low-power, high-performance Bluetooth v4.0 buttons, a piezo buzzer, and LEDs, allowing engineers to evaluate the
Low Energy (BLE) solutions for Bluetooth Smart applications such as onboard QN9020 SoC. The development board features a USB port for
sports and fitness wearables, human interface devices, and app-en- UART communications, a JLink debug interface, and a GPIO or optional
abled smart accessories. sensor board connector is also included. The kit includes USB Bluetooth
NXP QN902x SoCs integrate a high-performance 2.4-GHz radio fre- dongle, which works with the board as a pair for evaluation and debug-
quency (RF) transceiver with a 32-bit ARM Cortex-M0 microcontrol- ging, and a USB cable for power and data transfer.
ler, 128KBytes of flash memory, and 64KBytes of system memory, www.mouser.com/new/NXP-Semiconductors/nxp-qn902x/
providing additional signal processing and room to run applications www.mouser.com/new/NXP-Semiconductors/nxp-qn-9020-devkit/
for a true single-chip Bluetooth Smart solution. In addition to the BLE
(150777-5)
radio and microcontroller, QN902x SoCs incorporate the BLE protocol
Anzeige
T choice is yours.
The
Enclosure for all round
protection
Housings for Raspberry Platform for all round
Pi, Arduino and many access
other bareboard Design-specific versions
computers for all popular models
Enclosure Visit hammondmfg.com
Platform for full details
+ 44 1256 812812
sales@hammondmfg.eu /1593HAM.htm /1593HAMEGG.htm
/15
593HAMEGG.htm
593HAMEGG.htm
HA
AMEGG ht
Web Links
[1] www.atmel.com/tools/attiny104-xnano.aspx
[2] www.atmel.com/devices/ATECC508A.aspx
[3] www.microchip.com/mplab/mplab-xpress
[4] http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB%20Xpress.pdf
[5] www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847
[6] www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc-cortex-m4-single-multi-core/
lpc54000-series/lpc54114-audio-and-voice-recognition-kit:OM13090?tid=vanOM13090
[7] www.nxp.com/products/identification-and-security/authentication/lpc43s67-a70cm-cloud-connectivity-kit:OM13086
[8] www.ti.com/ww/en/simplelink_embedded_wi-fi/ecosystem.html
[9] www.temboo.com/library/
[10] www.cypress.com/products/32-bit-arm-cortex-m0-psoc-4
[11] www.cypress.com/documentation/development-kitsboards/s6sae101a00sa1002-solar-powered-iot-device-kit
[12] www.infineon.com/cms/de/product/evaluation-boards/KIT_XMC48_RELAX_ECAT_V1/productType.
html?productType=5546d46250cc1fdf0150f6bdd1236ec8
[13] https://synergygallery.renesas.com/auth/login
[14] http://am.renesas.com/products/tools/introductory_evaluation_tools/renesas_starter_kits/sk_s7g2/index.jsp
[15] www.renesas.com/products/mpumcu/rl78/rl78g1x/rl78g1d/
[16] www.silabs.com/products/wireless/bluetooth/Pages/BGM111-bluetooth-smart-module.aspx
[17] www.silabs.com/products/wireless/wi-fi/wi-fi-modules/Pages/wgm110-wi-fi-module.aspx
[18] www.indiegogo.com/projects/cleo-the-smart-tft-display-for-arduino#/
The Elektor PCB Service is the most extensive fully customized service for printed circuit board production in Europe.
With convenient online tools allowing you to visualize and analyze your design before you order and pay .
For a more advanced service, there is the PCB Visualizer that shows you how your PCB will look after production,
with a PCB Checker performing a DRC for you and the PCB Configurator that lets you customize your order details.
Smart menus and select options guide you through the ordering process. You can see in advance exactly what our
machines can produce so there wont be any surprises!
www.elektorPCBservice.com
ElektorBusiness Feature Article
In order to support 5G, the 5GIC proposes a disruptive, revolutionary architecture thats flat, cloud
based but distributed. In the Flat Distributed Cloud Network architecture all nodes are both service and
communications enabled with suitable processing and storage.
The network is arranged in dynamic virtual Cell Clusters that to enable caching either at the edge of the network or point of
are in turn overlaid onto Hardware Clusters that are located aggregation across a number of cells in order to provide com-
at key Datacenters of various sizes according to location type puting and storage enhancement to the mobile functions. In
and available transmission support. an NFV/SDN (network functions virtualization / software-de-
fined networking) flat distributed cloud scenario this means
The architecture is very close to that of the CUPS (Control and that the CC, CM functions when providing user plane service
User Plane Separation) architecture evolved from LTE (Long operate local caching and application processing capabilities.
Term Evolution; Figure1), but the Control Plane nodes are
mapped directly to MACRO/Umbrella cells as a single function Based on the architecture shown in Figure2 the FDC operates
per cluster of cells called the Cluster Controller (CC) and the user as follows: a user device connects to a Cluster, umbrella Cell,
plane nodes are mapped to Small Cells as User plane functions which supports a Cluster Controller (CC) and directly connects
called Cluster Member functions whilst the user operates dual to it to setup the networks communications connection signal-
connectivity to both the Control-Plane associated Macro-Cell ing using a contended group connection system.
system per Cluster and the most appropriate User Plane Cell
within the cell-cluster. So the FDC approach combines Dual Once the device has a Control Plane communications con-
connectivity from 3GPP Rel-12, CUPS from Rel-14 and adds nection to the cluster at the Cluster Controller it establishes
Context awareness and clustering to the architecture approach. a group NAS (Network Access Stratum) connection to the
It should be noted that there are circumstances where the CC Cluster at the Cluster Controller virtual node. The user is then
also provides local CM functionality e.g. in the case where it setup a default UP bearer according to their Device/ user pro-
supports a mobile travelling at high speeds and a user plane file and mobility (e.g. connect to umbrella id operating with
function at the Macro-Umbrella level is more applicable to sup- high mobility) by connecting to the most appropriate CM, user
port this specific user context type. plane node functionality.
The term function is used on purpose as these functions are Significant use of a user profile is made to optimize default
intended to be implemented as soft entities over an SDN/NFV bearer setup as a dialogue between the User and Network.
implemented set of equipment across variously sized datacen- The Cluster Member (CM) node provides UP control separately
ters in order that the cluster may be re-organized over time to the Cluster Controller functionality. As this network is con-
according to service evolution requirements, network slicing text-aware, for fast moving mobiles, connection to the Cluster
configuration and demand load. Re-configuration of this net- Controller itself is possible in the UP for this type of user context.
work architecture is envisaged with a suitably named Auto- Intra-cluster communications connections may be connected
matic Cluster Organization (ACO) algorithm. or Parked to minimize connection overhead and then reloaded
The architecture is envisaged as being implemented across for UP service. However the signaling connection and bearer
a cloud based architecture but unlike the huge centralized connection are managed independently with local network sig-
clouds that the likes of Google, Apple, Amazon and Microsoft naling between each instance to minimize over-the-air usage.
operate that are distributed physically according to used stor- The architecture assumes an underlying NFV based imple-
age demands, the FDC architecture is distributed according to mentation architecture with a 2-level Orchestration Controller
mobile demands. approach. One controller is located at the CC level and one at
the inter-CC level. This approach allows algorithms for topol-
The FDC also embraces the MEC (mobile edge computing) ini- ogy optimization to operate at the inter-CC level and then
tiative from ETSI which adds hardware and software resources direct the periodic re-organization of the clusters at the CC
1.
Extract. The full 5G Whitepaper article may be downloaded from www.elektormagazine.com/150470
SGW-C PGW-C
Figure 1. 3GPP (3rd Generation Partnership Project), evolved LTE-A CUPS architecture (LTE-Pro).
orchestration level according to information such as load vs bearer from multiple technologies to be combined to support
time and user dominant usage type(s) collected at the cluster one common, dynamic, virtual connection from a device towards
level. This allows periodic re-organization of the clusters and the FDC network. The CRCP connection is managed across the
their number and sizes at the inter-cluster topology level to bearer types depending on user context and available commu-
realize Automatic Network Optimization (ANO). nications bearers. The connection may at any one time involve
simultaneous paths across one or more available communi-
Context Aware Networking cations technologies under the common control of the CRCP.
The FDC network will enable contextual information to be
exchanged by the network and between different users of In this manner the FDC network enables the potential to dynam-
the network in a controlled and secure manner such as using ically operate simultaneous radio and multi-fixed access tech-
brokered certificates per group of information. The Subscriber nology pooling, on a per user basis (multi-RAT/ FAT). The avail-
Data Management (SDM) system that in previous mobile gen- able bearer pool formed is then operated using one or more of
erations has remained HLR centric is envisaged to be extended these bearers at a RAT/FAT) to best support the connection to
to support user profiles, so that the user may share informa- each user locale potentially operated at the same as required,
tion selectively with the network in order to improve their user to provide always sufficient capacity for the communications
experience. It is proposed that each user will have a User task(s) in hand.
Profile (Upr) that will be extensible in a negotiable manner (150740)
to provide information keys into new applications and network
SON (self-organizing network) algorithms to improve the net-
work and user experience.
The reasons for these failures are manifold. First of all, they dont
DESIGN
teach students anything they will not learn in real life. Loops and
conditions that form the basis of these courses are structures we encounter daily.
Every day millions of people spend hours and hours on solving Sudokus and crossword puzzles prov-
ing that they have the patience and intellectual capacity to be excellent software engineers, yet they
cannot be challenged to solve a problem with a bit of programming. They just dont care. Making pro-
gramming accessible is one side of the problem, making it attractive is quite another.
BBC micro:bit
Even the BBC jumped the make-program-
ming-fun bandwagon with the ambitious
micro:bit programme which consists of
giving a microcontroller board to every
LEARN
i-Pendulum
Part 1
modeling, control laws, Kalman filter
When I presented
my prototype of
the inverted
pendulum, a
colleague
asked me:
And so you
just woke
up one morning
and said to yourself
today Im going to make
an upside-down pendulum!?
This project ought to elicit the
same astonishment among your more, the movement equations are
far from being linear, leading to com-
own family and friends, because this plex control laws. To keep it simple, Ive
pendulum is capable of not only remaining gone from a 3D cube to a 2D square, of
balanced, but also raising itself up on its own. course with a certain thickness, capable
of balancing around a single axis. And
since this square didnt need to actually
roll, Ive cut it in half, to end up with
this triangular shape.
By Jean-Sbastien Gonsette (Belgium) a moving trolley, a quadcopter carrying
a rod with a glass balanced on top of it. Anatomy of an inverted
The specific feature of an inverted pendu- But none of those matches my design pendulum
lum is that its center of gravity is higher criteria, namely: Figure1 is an exploded view of the var-
than its rotational or pivoting axis. So Compact (around 4 / 10cm) and ious elements of the pendulum; it has a
its a pendulum with its head at the bot- light, so I can display it on my desk. limited number of parts. Its skeleton is
tom, and all it wants to do is fall over Completely self-contained, i.e. the made up of two plastic half-shells, pro-
like the human body. However, the brain pendulum carries its own battery. duced using a 3D printer (well come back
works in conjunction with the eyes and Simple, so as to demystify the gen- to this in Part 2 of this article). The first
ears to send adjusting nerve impulses to eral principle without adding unnec- half shell is used to support the PCB, while
the muscles when our torso moves with essary complexity. the second contains the motor and its
respect to our ankles (pivoting point). inertia wheel. The brains of the pendulum
Inverted pendulums are based on this I found a recent project by the scientists are a PIC microcontroller that controls
principle. The video [1] shows my pen- at the Federal Polytechnic in Zurich, spe- and powers the motor. The Lipo battery
dulum in action. On the Internet, youll cializing in dynamic systems and con- (common in modeling) slips directly into
find a great many videos on this recurring trol: Cubli. Its a cube that balances on its holder behind the PCB. The motor, the
university subject. It allows students to one of its edges or corners and jumps to pendulums sole control device, is held in
test all sorts of regulating techniques, to move from one position to another (video a housing provided for this purpose in the
get to grips with a multi-discipline sub- [2]). Cubli does meet my first two cri- plastic shell. An inertia wheel is directly
ject and has a surefire Wow! factor teria, but maybe not the last one. With coupled to this motor. This inertia wheel
to boot. Theres something in it for every- three degrees of movement so as to move consists of a plastic shaft, also 3D printed,
one: on two wheels, as in the Segway, a and keep its balance in all directions, the onto which is crimped a metal ring whose
vertical bar (single, double, or triple) on modeling is pretty challenging. Whats mass provides the desired inertia.
Figure 2. Pleasing to the eye: the simulation of the stabilization of the Figure 3. Dynamics of the pendulum and its inertia wheel.
pendulum.
that the total angular momentum does left, sometimes to the right, but wont and then to dimension the various ele-
not change, i.e. it remains zero (2nd prin- fall over. ments correctly: size of the pendulum,
ciple). And this is indeed the case: the battery weight, motor torque, electronic
sum inertia wheel angular momentum And the jump? circuit power, etc.
(+) + angular momentum of the rest The pendulums ability to jump up (go Since I am starting off from nothing, I
of the satellite () never varies if the from the lying down position to the bal- choose to define certain parameters arbi-
only forces involved are those between ancing position) is surprising, but easy trarily and use simulation to verify that
the internal elements. to explain. All we have to do is acceler- my model stands up, before building the
ate the inertia wheel in the direction in prototype (see Figure2, the result of a
For the pendulum, the situation is which we want it to jump, until it gets up regulation tested on a PC). The model lim-
practically the same, except that the sufficient speed. At this point, the wheel its the risk of failure, but it is also essen-
external force is not zero because must be locked so the whole pendulum tial for writing the pendulums onboard
of the action of gravity. If you try will lift off. Lets come back to Newton: algorithms (motor control, analyzing the
to keep the pendulum balancing on data received from the detectors, and
its tip, gravity will turn the slightest a. When the pendulum is on the floor, estimating the state of the pendulum).
imbalance into a non-zero angular with the wheel stopped, its angular To obtain the pendulum dynamics equa-
acceleration until it hits the baseplate. momentum is zero. tions, we need to determine the number
To counter this, the pendulums center b. It accelerates its inertia wheel and of degrees of movement in the system,
of gravity would have to be brought thereby gains angular momentum draw up an exhaustive list of the forces
back to exactly above its pivot point. by pushing against this floor. In the and torques acting on each of the ele-
As this point is tiny, in practice this absence of a support, this operation ments, describe the dynamic effects of
is impossible. However, it is perfectly is impossible; this wouldnt work in each of them, then sift through every-
possible to bring the pendulums center space. thing, keeping just those parameters that
of gravity above the pivot, on average. c. When the rotational speed is high are of interest.
Thus the pendulum is pulled back to enough, blocking the wheel amounts The pendulum has two degrees of
the left when it moves to the right, to reducing the angular momentum movement:
and vice-versa, making it possible to to zero. Since the angular momen- the body, which pivots around its
counter the action of gravity and keep tum of an isolated system is con- point of contact with the floor, with
it balancing. This is where the motor served and cannot disappear, it is an angle
and its inertia wheel come into it. Just transferred somewhere else: to the the rotation of the motor and its iner-
as for the satellite, the body of the pendulum itself! The total angular tia wheel, with an angle.
pendulum accelerates in one direction momentum does not vary.
when the inertia wheel goes off in The object of the exercise is to find how
the other direction. It is necessary to Modeling the pendulum dynamics the second derivatives of these two
constantly detect in which direction In order to regulate a physical system like parameters change, i.e. their accelera-
the pendulum is falling and deduce this pendulum, you need to be familiar tion, as a function of the torque deliv-
from this the motor torque value to with the laws governing its movements ered by the motor. Figure3 lists all the
be applied in order to compensate according to the commands being applied. parameters acting on the pendulum body
this imbalance. If the drive is done So it is necessary to model the pendu- and the wheel:
correctly, the pendulum will oscillate lums dynamics, which lets you study the Wheel: the motor torque itself m, the
by a small amount, sometimes to the problem to be solved in greater detail, frictional couple between the rotor
Motor Torque
stabilisation (to 0)
Figure 4. The eigenvalue, master of the universe. Figure 5. State feedback control..
and the stator f, and also the two dish. n: birth rate of the organisms; The equations governing the behavior
forces that hold the rotor in place fwx d: their death rate. of the pendulum are a bit more compli-
and fwy. If both these rates are propor- cated than in this example. The various
Pendulum: the forces and torques tional to the size of this population, states of the system, like the angle and
acting on the wheel, but in the oppo- then y=nydy. velocity of the pendulum or the motor
site direction; the two forces between speed, have to be converted into vec-
the pendulum and the floor fbx and fby If these rates are constant, it is easy to tors, while the multiple differential equa-
that maintain the pendulum pivot in integrate this equation the result is the tions must be transposed into matrices.
place. population growth rate. If the initial pop-
ulation is y0, we obtain: At the end of the day, we are calculating
Gravity g acts on the mass of both the the eigenvalues of a matrix hence it is
pendulum mb and wheel mw. Ill spare you y(t)=y0e(nd)t=y0et less easy to see why the system is sta-
the calculations; we obtain the following ble or not. If one of the eigenvalues is
two dynamic equations: The exponential function shows that the positive, then something in the form of
M g sin m + f population will develop in a radically dif- et appears somewhere as soon as you
!! = ferent way, depending on the sign of perform an integration on your system,
I
nd. If the death rate is higher than the and everything goes awry.
(I + Iw ) ( m f ) M g sin
!! = birth rate, the exponent is negative: the
I Iw I population gradually dies out. In the other Regulation
where M=m b l b +m w lw and case, the population grows endlessly and PID regulation is best suited to a sys-
I=Ib+mblb2+mwlw2 colonizes the universe (at least, if the tem with one control input and one out-
equations still have any meaning at this put variable. Now our pendulum has two
The terms mb, Ib, mw and Iw are the mass scale). The exponent in this equation is degrees of movement: the angle of its
and the inertia of the pendulum body called the eigenvalue of the system. The body and the rotational speed of its iner-
and inertia wheel respectively mb ; lb and sign of this value is what determines if the tia wheel. These two dimensions have
lw are the height of the center of grav- system is stable (value ) or unstable to be both controlled using a single con-
ity of the pendulum body and the height (value +) (Figure4). trol input: the motor torque. The tricky
of the inertia wheel with respect to the Modifying the pH in the dish makes it point here is that a motor can only deliver
floor. These equations are used not only possible to control the rate of growth/ torque over a given speed range. If I fail
for simulating the pendulums behavior, decline. If this control is proportional to to regulate the rotational speed, it will
but also for establishing the motor con- the quantity of individuals, the develop- drift until it reaches unacceptable values
trol laws. ment equations become: and it will no longer be possible to control
the pendulum. Out goes PID regulation!
Stability of the pendulum y=nydy+ky; So I am going for state feedback con-
In order to mathematically study the y(t)= y0e(nd+k)t trol, which is based on the value of the
pendulums instability, Im suggesting an systems internal states. In concrete
analogy with biology. A Petri dish makes This is where the operation is smart. As terms, the loop is created by introducing
it possible to grow micro-organisms in the parameter k can be freely chosen a real gain factor for each output-to-input
order to study their development. Here (within the physical limits of the system), feedback possibility. In the case of the
are my assumptions: it is possible to force a positive eigen- pendulum, the states being controlled are
value to become negative, which allows the angle of the pendulum, the rotational
y: number of organisms in the the system to recover its stability. speed of the pendulum, and the rotational
Control
Measure
Instant t+1
Sensors
Figure 6. Gaussian probability density function. Figure 7. Principle of the Kalman filter.
speed of the inertia wheel hence three pendulum speed, and motor speed? Either of the pendulum will be determined in
outputs. So the feedback loop is based on predict these states, or measure them. accordance with the model and the mea-
the sum of three gains applied to a single If the initial state is known, I can predict surements from the detectors, weighted
control input (Figure5). It is possible to the way it will change depending on the according to their respective validities.
calculate gains such that the eigenvalues torque setpoint applied to the motor. I This principle lies at the heart of the Kal-
of the pendulum are all negative, giving integrate the differential equations in the man filter: a states filter that performs
a stable pendulum. model in order to find out where the pen- a weighted average of the various mea-
dulum will be an instant later, and I do the surements and predictions in a dynamic
Different approaches are possible, but same again for the next instant Its like process. This filter removes as far as pos-
its fairly convenient to apply the Lin- trying to drive a car with your eyes shut sible the noise affecting the measure-
ear Quadratic Regulator (LQR) theory. on the basis of a mental image of the road ments and predictions in order to obtain
This provides an algorithm for calculating ahead and the behavior of the car. That an optimum estimate of the state of the
these gains automatically, in accordance will work OK for a few seconds! Due to process. It breaks down into two steps:
with the system equations and a series modeling errors, the prediction departs
of weighting factors. These weightings, from reality. So measurement seems to 1. Using the model of the system,
defined by the designer, correspond to the be a more reliable method. However, all together with the commands pro-
importance given to the different states detectors have a certain degree of inac- duced at an instantt, to predict the
of the system and to the control during curacy and are subject to measurement state of the system at t+dt. The
regulation. The higher a weighting is, the noise. This means that two successive prediction also estimates how the
greater the extent to which the algorithm measurements of an identical state will current uncertainty about the state
will optimize the associated state or con- not yield the same result twice. Whats of the system changes depending on
trol; it will converge faster towards its more, its not always possible to measure the uncertainty on the model itself.
set value. everything. Depending on the process, All the uncertainties in a Kalman
The most important thing here is to re-es- certain states will be deduced indirectly. filter are the subject of Gaussian
tablish balance using minimum torque, So on the one hand I have a method that approximations. For a system hav-
whether this takes one second or three. In is accurate in the short term, but whose ing only a single state, the classic
point of fact, the motor torque is limited: error increases rapidly, and on the other, Gaussian curve is shown in Fig-
hence the aim is to get the maximum a method with a fixed but non-negligible ure6. In other cases, this becomes
out of the motor, while compensating for error range. The ideal is to use the one a multi-Gaussian curve with several
the largest possible imbalance. Im not that offers the lowest error at a given dimensions.
going to say any more about the control moment. Lets take an example: I mea- 2. Measuring the state of the sys-
theory. The subject is too huge to be sure a resistor using a top-end multime- tem at t+dt. These measurements
fully discussed here. Go and take a look ter (68), then using one costing only too have their own share of uncer-
at the University of Michigans series of a few dollars (70). The first measure- tainties, once again modeled by a
tutorials about controlling systems using ment seems to be the most reliable. In number of Gaussian curves. All the
Matlab, including one on the regulation fact, I need to take the weighted average measurements are weighted by their
of an inverted pendulum[3]. of both measurements using weightings respective uncertainties, as in the
calculated in proportion to the accuracy multimeter example.
Pendulum state after passing of each of the instruments. The more
through the Kalman filter accurate the instrument, the higher the Then the result of the measurements is
How can we find out the states of the pen- weighting of its measurement. I apply merged with the prediction, here again
dulum at all moments: pendulum angle, this principle to the pendulum. The state taking the respective uncertainties of the
two estimates into account. Figure7 only the first two are used in the Kalman The accelerometer measures pri-
offers a summary of the process. If you filter. The latter is rather rudimentary, but marily how the acceleration due to
are interested in this subject, read the yields a result that is more than sufficient. gravity is projected onto the X andY
book referred to at [4]. How is the information from the two axes. Thus by trigonometric inver-
Here, a gyroscope and an accelerometer detectors merged? sion, it gives a direct measurement
measure the angle of the pendulum to the the gyroscope provides the pendu- of the angle the pendulum makes
floor. The gyroscope is only interested in lums rotational speed. By integrat- with the floor.
a single axis, oriented in the Z direction, ing over a time increment dt, we
perpendicular to the PCB. The acceler- can predict the future angle of the The prediction and the measurement are
ometer has three axes, X, Y, andZ, but pendulum. combined in proportion to the errors in
+3V3 +3V3
+3V3
K2
R1 MCLR 1 2
C8 C9 C10 C11
3 4
10k
AVDD
VDD
MCLR 1
100n MCLR +3V3
130R
130R
130R
C1 5
VSS
VSS
C7 C2+
7
8 19 27 V-
10u 6
100n C2- C5
1 12 100n
EN FORCEON
GND
14
+3V3 +3V3A +3V3 +12V
VDD VS
4 33 10n D2 220n
IC4 14 SPI CLK 50V 50V
ADX INT 8 SCL/SCK VSA VSB
INT1 12 SPI MISO BDLC FWD 26 7
SDO/ALT ADDR FWD/REV VCP
7 ADX CS BDLC BRAKE 29 30 1N4148W K3
9 CS BRAKE VBOOT
INT2 13 BDLC TACHO 22 11
SDA/SDI/SDIO TACHO
IC5 BDLC DIAG 11 IC3 9 10
ADXL345 1 DIAG H3
GND GND GND 4 10 9
XY
=1 2 R7 H1
2 4 5 BDLC EN 27 8 8
Accelerometer 100k EN H2
SN74AHC1G32 7
R12
SPI MOSI BDLC REF 28 32 6
56k VREF OUT3
+3V3A +3V3 5 5
PWM to DC C16 OUT2
tau = 0.11ms 15 4
L6235 OUT1
5n6 3
C23 C24 13 12 2
RCOFF SENSE A
24 25 1
RCPULSE SENSE B
100n 10n R13 R14 R15 R8 R9 R10 R11 R16 R17 R18
C17 C18 C19
GND
GND
GND
GND
16 1 Motor
24k9
11k
20k
4k7
4k7
4k7
1R
1R
1R
1R
10 8
F1 VBAT SYNC/SHDN EXT
100n
C32 IC7
1u FDS6680
8A R20 1 6 AS VBAT +3V3
LDO CS+ 1 5
K4 IN IC9 OUT
MAX668
20k
2 4
REF
LP2992-33
3 4
BAT SENSE 2 5 ON/OFF BYPASS
1 C33 FREQ FB
R21 220n R25 R24 R26 GND
C26 C31 GND PGND C29 C34
C38 2 C39 C40
0R015
160k
24k9
10k
3 7
100n 100n 68u 16V 100p
1u 10n 10u
150175 - 11
each of the detectors. The speed of the why particular care must be taken when control the torque delivered, since this
wheel is estimated following the same choosing this capacitor. motors torque is proportional to the cur-
principle. The torque demanded from the rent drawn.
motor allows us to make a prediction of Motor
the wheels acceleration or deceleration, Ive chosen a brushless motor from the Detectors
and hence of its speed after a time incre- EC Flat series by Maxon. Compared to The pendulum can only remain balanced
ment dt. This prediction is then associ- a traditional DC motor, the absence of if it measures its position in space and
ated with the speed measurement per- brushes avoids the associated electro- corrects it accordingly. A pair of detec-
formed every time a tachometer pulse magnetic noise and premature mechan- tors enable it to measure its angle with
is received. ical wear. Whats more, this model allows respect to the floor: a single-axis gyro-
better power conversion. However, its scope (ISZ-2510, IC6) and a 3-axis accel-
Pendulum electronics wiring and control logic are more com- erometer (ADXL345, IC4). These two ana-
Thats enough theory, now for the prac- plex. You cant just hook this motor up log detectors are each housed in a sepa-
tice. The pendulums onboard electronics to a power source: it must be powered rately-powered digital IC. In this way, the
are very conventional, and have to ful- in three phases, switching their mag- analog measurement is polluted as little
fill four major functions that are brought netic flux at a precise rotational rate of as possible by the digital noise from the
together in the schematic in Figure8: the rotor. Hence an electronic system is rest of the circuit. The two ICs dialogue
necessary to supervise the sequence in with the C via anSPI bus.
1. Converting the voltage from the Lipo which the windings are powered. This is
battery to power the brushless motor the role of the L6235 (IC3), which con- Microcontroller
2. Delivering the motor drive signals tains all the logic for driving this motor, All the pendulums brain-power is con-
3. Measuring the dynamic parameters including the power transistors. It has a tained within a 16-bit dsPIC microcontrol-
of the pendulum via an accelerome- set of simple I/Os: ler. Compared to a 32-bit PIC, the 16-bit
ter and a gyroscope family is ideal for a project like this, where
4. Implementing the motor control law Fwd/Rev: rotation direction wanted responsiveness is more important than
(C) according to the values returned Brake: enables the electromagnetic calculating power. Whats more, the RAM
by the detectors. braking function (this is what enables and ROM memory space is fairly generous
the pendulum to jump) and makes it possible to develop more
Powering En: activates the rotation of the complex applications than on an 8-bit
The voltage provided by the Lipo battery motor C. And lastly, the dsPICs also have the
varies between 7V and a little over 8V, Vref: analog input for selecting the advantage of PWM outputs, used here to
depending on its state of charge. The limiting value for the current supplied control the motor. Theres nothing special
Maxon motor requires a nominal voltage to the motor about the programming of the C: ICD/
of 12V. The switch-mode power supply Diag: signal when internal protection ICP interface wired to connector K2. One
based on a MAX668 chip performs the is tripped of the UARTs is used to produce a serial
necessary power adaptation (boost reg- Tacho: delivers tachometer pulses. port via the SN65C3221 (IC2).
ulator). The motor draws a current of 2A
for a torque of 55mNm; the power supply The conversion of a PWM signal into an The next installment is devoted to more
will supply at least double this current. analog voltage via the low-pass filter concrete tasks like assembling the cir-
When pin8 of the MAX668 is high, power formed by R12, R13, and C17 makes it cuit, the mechanical construction, and
transistor T1 conducts and the current possible to define the limit value for the calibrating the detectors.
through power inductor L1 increases. torque. The connection to the motors (150175)
Diode D3 prevents the output capacitor three phases is made via outputs Out1 to
C29 from discharging at the same time. Out3, while the position signals from the
When pin 8 goes low, the transistor is motors Hall-effect sensors are decoded
turned off, forcing the magnetic energy via inputs H1 toH3. The IC checks the
accumulated in L1 to flow into C29 via current drawn by the motor by measuring
the diode. The MAX668 regulates the it across resistors R8R11 and compar-
cycles of this process at a configurable ing it with the setpoint defined on Vref.
frequency, here set to 300kHz by R25. This circuit makes it possible to correctly
This regulation is based on the output
voltage via divider R23 / R26, together
Web Links
with the current flowing in the inductor,
measured across R24. The +12V output [1]www.youtube.com/watch?v=6xe19XnX5L0
voltage inevitably contains high-frequency [2] www.youtube.com/watch?v=bMuCACqwI4s
ripple due to the repeated charging and [3] http://ctms.engin.umich.edu/CTMS/index.
discharging of C29. This ripple is however php?example=InvertedPendulum§ion=SystemModeling
dominated by the value of its equivalent
[4] Dan Simon:
series resistance (ESR) and the high-fre-
Optimal State Estimation: Kalman, H Infinity, and Nonlinear Approaches
quency currents flowing through it. This is
A GPS
synchronized
clock with
seconds display
By Willem Tak (Netherlands)
+180V'
470k
470k
mins-10 mins-1
27k
27k
27k
27k
27k
27k
V1 V2 V3 V4 V5 V6
Nixie IN12 Nixie IN12 Nixie IN12 Nixie IN12 Nixie IN12 Nixie IN12
1
1
LA1 LA2
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
2
11
10
9
8
7
6
5
4
3
12
2
11
10
9
8
7
6
5
4
3
12
2
11
10
9
8
7
6
5
4
3
12
2
11
10
9
8
7
6
5
4
3
12
2
11
10
9
8
7
6
5
4
3
12
2
11
10
9
8
7
6
5
4
3
12
1 2 1 2 1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4 3 4 3 4
5 6 5 6 5 6 5 6 5 6 5 6
7 8 7 8 7 8 7 8 7 8 7 8
9 10 9 10 9 10 9 10 9 10 9 10
+180V'
K4 K6 K8 K10 K12 K14
K3 K5 K7 K9 K11 K13
1 2 1 2 1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4 3 4 3 4
5 6 5 6 5 6 5 6 5 6 5 6
7 8 7 8 7 8 7 8 7 8 7 8
9 10 9 10 9 10 9 10 9 10 9 10
+180V
T1
R6
10k
16
15
13
14
11
10
16
15
13
14
11
10
16
15
13
14
11
10
16
15
13
14
11
10
16
15
13
14
11
10
+5V +5V +5V +5V +5V
8
9
1
2
8
9
1
2
8
9
1
2
8
9
1
2
8
9
1
2
MPSA42
O0
O1
O2
O3
O4
O5
O6
O7
O8
O9
O0
O1
O2
O3
O4
O5
O6
O7
O8
O9
O0
O1
O2
O3
O4
O5
O6
O7
O8
O9
O0
O1
O2
O3
O4
O5
O6
O7
O8
O9
O0
O1
O2
O3
O4
O5
O6
O7
O8
O9
R7
T2 5
VCC IC1 GND
12 5
VCC IC2 GND
12 5
VCC IC3 GND
12 5
VCC IC8 GND
12 5
VCC IC9 GND
12
10k 74141 74141 74141 74141 74141
A0
A1
A2
A3
A0
A1
A2
A3
A0
A1
A2
A3
A0
A1
A2
A3
A0
A1
A2
A3
MPSA42 +5V +5V +5V +5V +5V
3
4
T3 T8
T4 C6 C4 C5 C16 C17
R9
10k
100n R8 100n 100n R23 100n 100n
MPSA42 MPSA42
MPSA42
3k3
3k3
39
38
37
33
34
35
36
24
15
16
17
27
28
29
19
20
21
22
2
3
4
5
RB6
RB5
RB4
RB0
RB1
RB2
RB3
RC5
RC0
RC1
RC2
RA0
RA1
RA2
RA3
RD4
RD5
RD6
RD0
RD1
RD2
RD3
K1 +5V
IC5 +3V3
LP2950-33 RST
1V8
11 31 +5V +3V3
VDD VSS
1 3 IC4
C11 C1
PGD
C7
32
VDD PIC18F4420 VSS
12 R18 R19 R10 R20
PGC
10k
10k
2
T6
10k
10k
OSC1
OSC2
25V 25V
RB7
RA5
RA4
RC3
RC4
RC6
RC7
RD7
RE0
RE1
RE2
PICkit 21 1
RX0 RST
10k
20 2
1
40
7
6
13
14
18
23
25
26
8
9
10
30
TX0 BOOTSEL
+5V VCC 2N7000 19 3
EXT/INT VCC 3V3
18 4
ON/OFF WAKEUP
R12 X1 17 MOD1 5
SDA VOUT
L1 D1 +180V 16 6
SCL A2035H GND
1k
15 7
330uH GPIO5 GPIO6
BYV26 R13 22.1184MHz 14 8
IC6 +5V +5V +5V +3V3 GPIO4 GPIO7
C8 C9 13 9
+3V3
470k
6
NC GND
D2 VCC
1 7805 3 1 5 R14 R15
12
NC NC
10
SC CI T5 LED1 22p 22p R21 R22 11
NC C2
1N4004 IC7
10k
10k
GND
GND
GND
GND
GND
GND
GND
GND
T7
10k
10k
K2 7 2 C10
IS SE P1 JP1 S1
2
100n
MC34063 500k
29
28
27
26
25
24
23
22
8 3 10u
DC TC 250V
GND R16 R17 2N7000
C12 C13 C15 C3 C14
4
150R
5k6
Figure 1. The circuit of the original Precise Nixie Clock has been expanded with two more tubes, along with a microcontroller with more I/O pins to drive
the additional digits.
The original Precise Nixie Clock was pre- to be obtained by dividing down. The PIC mounted between the hours, minutes and
sented in the November2014 issue of microcontroller drives an optional indica- seconds segments, each driven by its own
Elektor magazine. It received time sig- tor LED (LED1) that blinks briefly after a transistor.
nals from a Maestro A2035H GPS receiver reset and then flashes each time a valid The Nixie tubes in the original clock
module for very high accuracy. However, GPS string is received. If this LED is con- are replaced here by IN-12 tubes. They
the time was displayed with four Nixie stantly lit, there is a problem somewhere. should be easier to obtain and less expen-
tubes, without the seconds. It turns out The microcontroller can be programmed sive than the IN-14 tubes used in the
that there is interest in a version of this in circuit via connector K1, using a original clock. The IN-12 tubes are also
GPS-driven clock that also shows the sec- PICkit2 or PICkit3 programmer (see the pin compatible with other oval-shaped
onds, which means a clock with a six-digit Programming Pitfalls inset). Jumper tubes, such as the ZM1100 and the CD56.
display. In principle thats perfectly possi- JP1 determines whether a leading zero is The new type is a top-view tube, so we
ble, and the software (even in version2) displayed (no leading zero with J1 omit- put the Nixie tubes on their own PCB,
already includes code for this. However, ted, leading zero with J1 fitted). separated from the main board. That way
a 28-pin PIC18F2480 microcontroller was The GPS module MOD1 (A2035H) con- it can be used directly as a front panel.
used in the Elektor version of the origi- tains all the electronics needed to receive However, this also makes it easier to build
nal Precise Nixie Clock, and it does not
have enough I/O pins to directly drive
two additional Nixie tubes.
More pins
One solution to this dilemma would be
to use I 2C expanders, but that would
make the circuit too complex for our
taste. Instead we opted to use a PIC
microcontroller in a 40-pin package, the
PIC18F4420. It is not expensive and is
readily available.
All the ports have basically remained the
same, although some of the pin num-
bers have changed due to the different
pin count. The schematic diagram of the
updated clock in Figure1 shows the new
microcontroller in familiar surroundings,
with very little changed in the rest of the
circuit aside from the two additional Nixie
tubes and associated drive circuitry. Port
D is new here. Seven pins of this port are
used to drive the decoders for the seconds
display. The remaining pin is used for an
additional neon lamp that separates the
minutes from the seconds.
Another update
Along with requests for displaying the sec-
onds, there were many comments about
the fixed time zone setting (GMT+1) GPS signals, as well as an antenna. The your own display module on a piece of
for Central Europe. This could only be GPS module operates at 3.3V and the perfboard or to use other tubes with a
changed in the source code for the micro- microcontroller operates at 5V, so level different pin layout. The display board is
controller, which was admittedly not espe- converters (consisting of FETs T6 and T7 connected to the main board through six
cially convenient. With the new version of with resistors R18/R19 and R21/R22) are box headers.
the Precise Nixie Clock, the time zone can included in the data lines between the The circuit can be powered from an AC
be set with a button (S1) after a reset. two. adapter with an output voltage of 9 to
We chose the customary 74141 ICs to 15V. The high voltage supply for the Nixie
Schematic drive the Nixie tubes, although these tubes is provided by a step-up converter
Lets have a quick look at the sche- devices are now very difficult to obtain. built around an MC34063 (IC7). The fly-
matic. The PIC18F4420 reads the time An alternative is to use the Russian back voltage from the inductor (L1) is
data from the GPS module and drives K155ID1 devices. The tens of hours rectified by a fast diode (D1) and stored
the Nixie tubes. The clock frequency of digit (V1) is driven by a triplet of tran- in a high-voltage capacitor (C10). If the
22.1184MHz allows the serial bit rate for sistors (one each for 0, 1 and 2) instead feedback path to pin5 is interrupted, the
the 4800-baud output of the GPS module of a separate IC. Small neon lamps are supply voltage can rise to a very high
Figure 2. We opted for a black PCB, which makes a much better background for the Nixie tubes and gives the clock a nicely finished
appearance.
Figure 3. All components except the GPS module are leaded types, which
makes board assembly relatively easy.
Network Connected
Signal Analyzer (2)
Software and maths are your friends
In the previous instalment [1] we presented the hardware of this compact instrument that combines an
oscilloscope, spectrum analyzer and signal generator in one low-cost system. This time we take a closer
look not only at the software that makes it all work, but also at the maths that made this tool possible in
the first place.
reg_wizchip_spi_cbfunc(wizchip_
In this installment we will first look at the Ethernet communication
read, wizchip_write);
software of both the microprocessor and Lets have look at how the Ethernet
the PC. Little by little some mathematical communication is accomplished. On the
//Functions
principles will be introduced to transform microprocessor end of the communica-
void wizchip_select(void)
you in a digital signal processing expert. tion, the ioLibrary_BSD drivers are used
{
to handle the W5500 communication [2].
WIZCS = 0;
In order to use these drivers, four func-
}
NCSA key features tions had to be written to control the
dsPIC33s SPI peripheral that talks to
Compact oscilloscope, spectrum void wizchip_deselect(void)
the W5500.
analyzer and signal generator {
Sampling rate up to 1MHz WIZCS = 1;
The C code to accomplish this is shown
Supports subsampling }
here:
Input signal max.: 0dBm void wizchip_write(uint8_t wb)
(0.225VRMS) {
// Declare W5500 driver SPI
Sensitivity: 80dBm (22.5VRMS) uint8_t dummy;
Functions
Ethernet connection SPI1BUF = wb; // write to
reg_wizchip_cs_cbfunc(wizchip_
Open source buffer for TX
select, wizchip_deselect);
while( !SPI1STATbits.SPIRBF ); all that is needed to pass commands and amplitude. To select the desired value
// wait for TX complete data between the PC and the analyzers for the PWM duty cycle we use a one
dummy = SPI1BUF; W5500. cycle waveform lookup table. We simply
} select the amplitude from the table that
Signal generators corresponds to where the desired wave-
uint8_t wizchip_read() There are two separate signal generators form would be in its cycle when the DDS
{ available to the user. One is located in update occurs and update the duty cycle
SPI1BUF = 0x00; // write to the P and generates an analogue signal accordingly. A 32-bit phase accumulator
buffer for TX utilizing Direct Digital Synthesis (DDS). It (DDSp in the code) is used to keep track
while( !SPI1STATbits.SPIRBF ); can be used as a simple signal source for of the phase of the desired waveform.
// wait for TX complete external applications or fed back into the Once per DDS update cycle, the phase
return SPI1BUF; // read the analyzers input for analysis. It is included accumulator is incremented by the phase
received values mainly as a means of experimenting with increment (DDSd in the code) that is set
} the NCSA System, and not meant to be for the desired waveform frequency. The
a general replacement for a commercial phase increment is calculated as follows:
Once this is done, the communica- bench signal generator.
tion between the W5500 and the PC Phase increment =
are readily accomplished by using the The other signal generator is in the PC 232 FrequencyDesired / DDS update rate
recv(sn,buf,size) and send(sn,buf,- application. It allows the user to gener-
size) functions included in the ioLibrary_ ate arrays of numbers representing var- For example, if you wanted a 10,000-Hz
BSD drivers. ious signal types that can be viewed and (10-kHz) sine wave, the phase increment
Fourier transformed in the PC application. would be 91,625,968. This value is added
On the PC end of the Ethernet commu- Lets briefly discuss the P based DDS to the contents of the phase accumula-
nication, the C# code required to estab- generator first. tor at the DDS update rate. Therefore
lish a connection and pass commands/ Looking at the block diagram (Figure1), the 32-bit phase accumulator accurately
data back and forth is very straightfor- you see a Pulse Width Modulator (PWM) tracks the phase of the desired wave-
ward. When the PC application is started attached to a Low-Pass Filter (LPF). This form at any point in time. Since having
it checks to see which of the four IP combination acts like a digital-to-analog a lookup table with 232 entries in RAM is
addresses are present on the local net- converter. If, for example, the duty cycle prohibitive, we take the upper 8bits of
work and uses the detected address for all of the PWM is kept constant the LPF out- the 32-bit phase accumulator and use
subsequent communication. It is import- put would be a DC value. If we vary the it as the address into the single cycle
ant that the user plugs the analyzer into duty cycle to match the varying amplitude lookup table.
the network first and allows a few seconds of the waveform we want to generate, the
for the W5500 to get initialized before LPF output will be that waveform. The NCSA source code allows the user
opening the PC application. The dsPIC33 PWM is running at to choose either a sine, square or trian-
gle wave and select a frequency rate. An
The PC application uses the TcpClient fsys / 256 = 120 106 / 256 = 468,750Hz ambitious user could easily modify the
Class available in Windows to handle the source code to include other waveforms.
communication. Here is the C# code used This is also the DDS update rate. Once Incidentally, one needs to be careful when
to make the connection between the PC per PWM cycle we calculate the amplitude selecting the cut-off frequency of the LPF
and the W5500: of the desired waveform and then we located at the PWM output. You want the
set the PWM duty cycle to generate that cut-off to be low enough to adequately
var result = client.
BeginConnect(IPAddress.
Parse(ipaddress),4000,null,null);
result.AsyncWaitHandle. Sine Lookup Table Update Signal
WaitOne(TimeSpan. PWM Generator
Duty Cycle
FromSeconds(1)); //timeout if no 255 PWM LPF
PCB Output
t
if (client.Connected)
{ 0
clientStream = client.
GetStream(); //get a client
Address
stream
8 bits 24 bits Phase Accumulator
}
+
Once the connection is established, the 32 bits Phase Increment
clientStream.Write(TxBuff,off-
set,size) function and clientStream.
Read(RxBuff,offset,size) function are Figure1. Block diagram of the Direct Digital Synthesis (DDS) signal generator.
{
case 1: Wave[i] = (uint8_t)
(128+127*sin((PI*i)/128)+.5);
//sine
break;
case 2: Wave[i] = (i<128) ?
255 : 0; // one cycle square
break;
case 3: Wave[i] = abs((i
% 256) - 128); //one cycle
triangle
break;
}
}
form (DFT) is the sampled data system So applying the transform we have N/2 the amplifiers gain. The time domain real
approximation to the Fourier Transform. complex numbers. What do we do with voltage samples are then fed into the
The following is the equation for the DFT them? In our spectrum analyzer we want DFT which results in N/2=1000 com-
algorithm: to know the power levels of the various plex frequency bins in the form (a+jb).
sinusoidal components. The (a+jb) is a Since the input is applied to a 50-ohms
Spectrum(m) = complex representation of the amplitude input impedance, the power in each bin
N1
2 nm N1 2 nm and phase of the sinusoid. Since we are of the output spectrum is calculated using
(n)cos j (n)sin measuring this amplitude across a 50-
n=0
N n=0 N
resistor at the NCSA input, the power in
the sinusoid is therefore
where:
x(n) represents the input data samples; PRMS(m) = (a+b) / 50
N is the total number of samples;
n keeps track of the individual samples;
m keeps track of the frequency domain
bins.
Windowing
Lets look at an example that demonstrates why windowing spectrum levels across the spectrum. Also note how the main
is required for some DFTs. Figure4 shows the spectrum of a peak gets spread out. These raised background levels are called
sine wave that goes through exactly 10cycles over the sam- leakage and when present can cause signals located across the
pling period. Figure5 shows a signal that has slightly more spectrum to be masked.
than 10 cycles over the same sampling period. The difference Why does this happen? Since the DFT tries to reproduce the
in the spectra is dramatic. Note in Figure5 the high non-signal sampled data over a sampling period T, the algorithm in a sense
assumes that it is working with one period of the signal that is
repeating every T seconds. Consequently when the beginning
and end of the sample data arent approximately equal, the DFT
attempts to recreate a discontinuity at this point. This causes
all kinds of high-frequency content to be generated and folded
back into the spectrum causing the spectral distortion.
You could just keep playing with the sampling frequency until
you get an integral number of cycles in the signal being tested,
but obviously, you dont always know what the signal is sup-
posed to be. This is where windowing comes in.
To soften this discontinuity, windowing lowers the amplitudes of
the samples at the beginning and end of the block of sampled
data. This is accomplished by multiplying the sampled data by
a function (window) that attenuates the beginning and end-
Figure 4. The 1000-Hz signal being analyzed goes through an integer
ing samples amplitudes. Figure6 shows a 500 point Hanning
number of cycles over the sample duration. Note that the first data
window used in this example. If you multiply the input data
sample and the last data sample are approximately the same.
Figure 5. This is what happens when there is not an integer number of Figure 6. The Hanning window.
cycles for the 1020-Hz signal being analyzed. You can see that the first
and last data samples are very different. Note how the main peak has
widened masking the area near the peak signal. Also note how the rest
block shown in Figure5 by the Hanning window, you get the
of the spectrum levels are raised which masks signals in this area as
well. windowed data shown at the top of Figure7. Note how the
discontinuities at the beginning and end of the data blocks are
attenuated.
Now look at how the spectrum is improved (lower graph in Fig-
ure7). The leakage artefacts are much lower. This isnt com-
pletely free, however. There is a bit of spectral spreading that
takes place when windowing is used. This spreading widens
the signal peaks a bit. The total power is the same, but now
it is spread across a few adjacent spectrum bins. This spread-
ing is usually not a problem and the benefits of windowing are
worth it.
There are six different window types included in the UI. Each
type has different characteristics as to how much spectral
spreading results and how much high-frequency content it lets
through. A lot of information is available online that discusses
Figure 7. Applying the Hanning window to the same 1020Hz sine wave the advantages and disadvantages of the various window types.
used in Figure5, you can clearly see how the window improves the They are fun to experiment with.
spectrum.
(on my laptop computer). The update interactivity, a user can quickly develop a
rate includes all steps in the process: DCterm = myFunctions.DCtermCalc(N, very practical feel for what digitizing and
sampling, data transfer, windowing, and RxBuff, ScaleFactor); // Fourier transforming is all about. Creative
performing the FFT and plotting. calculates DC term users can readily add arbitrary signals to
the current set of signal generator options
Spectrum Update Rate // Subtracts DC, scales for ADC and further adapt the NCSA System to
N
(Hz) bits, puts data in real part of unique applications. Getting proficient at
5,000 8.33 din[] moving back and forth between the time
10,000 3.96 myFunctions.Filldin(N, DCterm, and frequency domains can add a lot of
15,000 2.48 RxBuff, ScaleFactor, AmpGain, insight into the signals being analyzed.
20,000 1.70
din); In addition to all that, it is a lot of fun to
play with!
myFunctions.windowing(N, din, (150694)
Finally, here is a code snippet that is WindowType, 1, din); //window
Web Links
the heart of the PC C# application. This data
shows how the data is transferred from plotTime.PerformClick(); //plot [1] www.elektormagazine.com/150211
the NCSA and the subsequent digital pro- input time series [2] http://wizwiki.net/wiki/doku.
cessing steps: fftwf.execute(fplan); //Do FFT php?id=products:w5500:driver
[3] http://sim.okawa-denshi.jp/en/PWM-
// Receive data over the network //convert to dBm and average tool.php
int read = 0, offset = 0, toRead = spectra (code not shown here)
[4] https://github.com/tszalay/FFTWSharp
2*N;
while (toRead>0 && plotFreq.PerformClick(); // Plot
(read = clientStream. frequency domain data (spectrum)
Read(RxBuff,offset,toRead))>0)
{ Conclusion
toRead -= read; The flexibility to adjust many system
offset += read; variables, the ability to generate signals,
} and because the UI has a high degree of
Subsampling
An important topic that greatly expands the number of
applications where the analyzer can be used is that of
subsampling, or sometimes referred to as harmonic sampling
or sub Nyquist sampling. Ill use an example to explain the
concept.
If we connect a commercial grade signal generator to the
NCSA System input and set it to generate a 10-kHz sine
wave and set the NCSA System sampling rate to 500kHz
we will get a set of samples. As it turns out, in this low noise
environment, if we set the generator to 510kHz or 1,010kHz
or 1,510kHz, etc. we will get the exact same set of samples.
The reason for this is that we are sampling the higher Figure8. Sub sampling allows you to view signals with frequencies much
frequency signals at the exact point in their cycles as that of higher than the NCSA Systems maximum sampling rate of 1MHz. The
signal being analyzed here is a 4.41-MHz sine wave. The sub sampling
the lower frequency 10kHz signal. Keep in mind, however,
causes the signal to appear at 410kHz.
that if the signal generator is set to 490kHz, 990kHz or
1,490kHz (these are referred to as image frequencies) we
will also get a set of samples that look like we are sampling a
10kHz signal. station located at 1,140,000Hz using a sampling frequency
As the noise in the system increases, the noise in the of 504,201Hz. The peak on the spectrum plot is located at
subsampled spectrum also increases. If there is significant 131,598Hz which is 1,140,0002504,201.
content located at the image frequencies, the subsampled The only hardware limitation to this technique is the allowable
spectrum gets distorted. Even with these limitations, you will bandwidth of the analogue front-end amplifier. As mentioned
be surprised at how often this technique can be utilized to earlier, we have a GBWP of 6MHz in the front-end amplifier.
view signals far above the fs of the analyzer. The AM radio If you can live with amplitude rolloff, you can get even higher
signal shown in Figure7 of the first installment [1] uses than that (Figure8). Very cool!
this approach. In that case, we are looking at an AM radio
Originally intended for a small weather station, this solar panel power regulation module is ideal for all
other low consumption applications too. The author has also used it for driving outdoor LED lighting
controlled by a time switch.
The block diagram in Figure1 gives at 1050watts. It can easily be adapted for the Vin input to the switching regulator
a glance a clear idea of the principle of higher power. IC1. This is driven by its pin 5 via T5 and
this regulator, which is inserted between MOSFET T6.
a solar panel and the battery it has to Powering and thresholds When the circuit is powered up (with a
maintain charged. A serial/USB interface A switch-mode power supply has been charged battery), as the voltage is higher
makes it possible to connect a terminal used to reduce the power dissipated and than the threshold of zener D1 (11V),
to check the software operation. improve efficiency; this means the circuit transistor T5 conducts and forces the gate
Here, we use useful load (or user can be used at 24V with no dissipation of T6 to 0V, allowing the 5V supply to be
load) to refer to the circuit that con- problems. This circuit makes it possible to unblocked. Diode D11 prevents the bat-
sumes the photovoltaic current supplied reduce the consumption significantly com- tery supply voltage from being applied to
by the solar panel and its regulator, e.g. pared to a linear regulator. The voltage the microcontroller. This is useful if you
a weather station. conversion is performed using an LM2674 want to start the circuit manually using
The functional blocks can be easily identi- step-down regulator from TI. The battery S3: in this case, D1 is not fitted.
fied on the detailed circuit diagram (Fig- voltage arrives from connector K1.B via In this operating mode, when you press
ure2). The regulator is designed for a fuse F1, which together with diode D5 S3 (start), the circuit is powered; then,
12-15V solar cell panel and a power of provides reverse-polarity protection for as soon as the microcontroller has started
up, it sends via its pin 16 a new high development work. below 11.3V in order to protect it from
to D11, which has the effect of keeping The circuit status is indicated by the two- deep discharge.
the converter powered via T5 and T6. In color LED2. The user load is reconnected above 12.6V
the event of low voltage, under 10.8V To reduce consumption, the drive to this in order to avoid annoying pumping
(measured by the microcontrollers ADC), LED is chopped by the software: very effects, e.g. with a battery that charges
and in order to protect the battery, the brief flashes (Ton) alternate with fairly long poorly. Pumping means rapidly alternat-
microcontroller cuts the power to the cir- pauses (Toff). ing disconnections and re-connections in
cuit by setting a low on its PB2 output The quadruple DIP switch S2 lets you the event of instability in a circuit around
(pin 16). In this situation, restarting can make the selections summarized in the a single switching threshold.
only be done manually (S3). table. In remote mode, transistor T3 makes it
If the voltage drops below 10.8V with The user load (K1.C), protected by fuse possible to turn off the load using a float-
D1 fitted, the circuit goes into stand-by, F2 in the event of short-circuit or over- ing contact or a time-switch. Connector
drawing no more than 800A. load, is driven via MOSFET T3. This turns K2 (Remote) makes it possible to drive
As soon as the battery voltage rises above off the output and disconnects the user the output to the user load (K1.C) via a
approx. 12.6V again, the 11V zener load if the battery terminal voltage falls floating contact or by a programmable
D1 conducts again and takes the con-
verter high via T5/T6. From that point,
the switching regulator automatically
powers the circuit again. Summary of Features
When fitted, jumper J2 (override) keeps The microcontroller-driven solar cell regulator is designed for a 12V solar panel
the circuit powered, e.g. to allow us to and a power of 1050W.
program the microcontroller when com- Use of a switching step-down regulator reduces the power dissipated and
missioning the unit for the first time or improves efficiency.
updating the software. The ATmega8 microcontroller turns off the electronics in the event of deep
Zener D13 limits the control voltage on battery discharge; it starts it up again automatically as soon as the terminal
T6 gate to 5V. voltage rises again above a certain threshold.
High and low thresholds can be set manually.
Hardware The regulator also takes into account the type of battery (lead-acid or gel) and
The circuit is built around an ATmega8 the number of charge/discharge cycles so as to avoid the memory effect.
with a crystal clock running @ 4MHz. The A serial link with a PC is possible by using a standard Elektor BOB-FT232R USB
battery voltage (K1.B) is measured with interface.
the help of the A/D converter ADC0 via a A remote control input makes it possible to turn on or off the user load circuit,
voltage divider and light filtering (R13/14/ for example using a time switch.
C4). The other two A/D converters, ADC1 The software in BascomAVR can be modified to suit special requirements.
and ADC2, are used for manually setting
the high and low battery voltage thresh-
olds using P1 and P2.
A serial link with a PC under HyperTermi- Solar Cell Lead/Acid
nal is possible with the aid of a standard Array Battery
Elektor BOB-FT232R USB bridge (MOD1,
in green, on the right of the diagram).
This option will be handy for testing and
Temperature User Load
for developing the software if you want Sensor
to modify it. In normal operation, the On/Off
information transmitted over this link
Remote Microcontroller
give the software version, followed by Control
the voltages measured, then the number ATMEGA8L
5V
of battery charge cycles. Jumper J1 will Supply
only be used if you want to power the Configuration On/Off
regulator via the USB port (e.g. during
testing possible software modifications).
Diode D14 protects module MOD1 when Serial Port
J1 is fitted while the regulator is powered
by the battery.
Watch out! Powering the electronics via Bicolor
LED
the MOD1 interface will not let you per-
form all the functional tests, in particular
Max. Threshold Status
measuring the battery voltage. So this 080305 - 12
time-switch (12V), which in this case LED1 indicates the solar panel is operat- regulation: solar when the battery is
could even be powered from the battery ing correctly. charged, it acts a virtual shunt on the
voltage (K2, pins 1 & 3). panel.
Schottky diode D3 prevents the battery
Connector K1.A (Solar) makes it possible discharging through the solar panel. Diode D2 protects this transistor from
to connect the solar panel to the regu- MOS transistor T1, driven from the micro- inadvertent solar panel polarity rever-
lator. High-brightness, low-consumption controller via T2, is the lynch-pin of the sal. When the switching regulator is
D3
STPS745D R4
T1 STP22NF03L
10k
D2
K1.A R1
R2 VCC
1
1k
T2
2 R3 R6 R18
P1
LED1 1k 10k
STPS745D
100k
D4 R5
Solar C15 100k
V33ZA5P BC547A
100k
VCC
BATTERY
100n
LOW VOLTAGE
* Optional
SETTING
+12V BZX79-C5V1 L1 R16
5k1
F1
2 100n 10n
100n VCC 1N4148 100n BATTERY
1 HIGH VOLTAGE 10k
D6 VCC RST SETTING
S1
GND C14 LM336BZ
K1.D
1N4148 R7 DS1813-10+ 3
8 10n
RESET
100k
7 - NTC
VCC
Temperature BATTERY TEMPERATURE
Sensor R8
C3
18k
10n C11 J1
MOD1
R22
R23
R24
R25
K1.C 100n
F2 VCC 7
D14
6 USB
100k
100k
100k
100k
VCC
5 3.15A F R10 R12 R13 23 20 1N4148
D8 PC0(ADC0) AVCC BOB-FT232R
24 21
Elektor 110553
100k
PC1(ADC1) AREF
10k
51k
User T3 25 15 9
Load 1N4148 PC2(ADC2) IC3 RTS DTR
26 2 16 8
PC3(ADC3) PD0(RXD) TXD DSR
27 3 17 7
PC4(ADC4/SDA) PD1(TXD) RXD DCO
T4 28 4 18 6
R9 R11 PC5(ADC5/SCL) PD2(INT0) RI RESET
STP22NF03L 1 5 19 5
1k PC6(RESET) PD3(INT1) CTS CBUS0
100k
D7 R14 6 20 4
C4 PD4(XCK/TO) GND CBUS1
14 ATMEGA8L 11 21 3
BC547A PB0(ICP1) PD5(T1) +3V3 CBUS2
12k
15 -8PC 12 22 2
10n PB1(OC1A) PD6(AIN0) VCCIO CBUS3
BZX79-C5V1 16 13 23 1
PB2(SS/OC1B) PD7(AIN1) +5V CBUS4
17 Module
PB3(MOSI/OC2)
VCC 18 R21 R20 USB Serial Bridge
PB4(MISO)
K3
VCCIO
19
220R
220R
GND
PB5(SCK)
RXD
CTS
TXD
2 1 MOSI PB6 PB7
GND XTAL1 XTAL2 AGND
4 3 3 1 5 6 7 8
+12V VCC 8 9 X1 10 22 ON
6 5 RESET LED2 S2
10
11
12
13
14
C12 8 7 SCK
C10 C9
10 9 MISO 4MHz
R15 100n bi-color LED 2 4 3 2 1
D9 22p 22p
K2 ISP
100k
1 1N4148
2
2 4 3
3
C5 +12V NC FB NC C18 L2 VCC
7 1
VIN BOOST
Remote 10n
IC1 100uH
R27 10n
D1 D11 C17
LM2674M-5.0 8
/NOPB VSW
100k
ON/OFF GND
100n
BZX79-B12 1N5819 5 6
T6
R26 D12 C19 C2
10k
100n 100u
T5 D13 J2 1N5819RL 16V
C20 S3 2N
7000
10n
START
BC547A
BZX79-C5V1 OVERRIDE 080305 - 11
Figure 2. Solar cell regulator schematic. The components within the dotted line are not used and should be omitted in this version.
A thorough visual check is vital before switching regulator circuit (12.6 V DC). loadable software [1]. Then plug in the
applying power, paying particular atten- Fit jumper J2 and check the presence of MOD1 interface and check on the terminal
tion to the orientation of the integrated the 5V rail (VCC). If it hasnt already (9600/8/1/N) that the indications are con-
circuits (Figure 4). been done, youll need to program the sistent with your setting and the configu-
Well start by applying power to our microcontroller with the help of the down- ration of switches S2 (all of, by default).
Component List
Resistors
Default: 0.25W 5%
R1,R6,R11 = 1k
R4,R10,R17,R18,R19,R26 = 10k
R3,R5,R9,R12,R15,R22-R25,R27 = 100k
R20,R21 = 220
R13 = 51k 1%
R14 = 12k 1%
R8 = 18k 1 %
R2 = varistor V33ZA5P
R7 = 100k NTC
P1,P2 = 100 k trimpot
Inductors
L1 = 10H
L2 = 100H
Capacitors
C1 = 470F 35V
C2 = 22pF
C3-C5,C14,C18,C20 = 10nF 50V
C8,C11-C13,C15-C17,C19 = 100nF 50V
C9,C10 = 22pF
Semiconductors
D1 = 12V zener diode
D2,D3 = STPS745D
D4,D7,D13 = 5.1V zener diode
D5 = 1N5821
D6,D8,D9,D10,D14 = 1N4148
D11,D12 = 1N5819
LED1 = LED, green, high efficiency, 5mm
LED2 = LED, bicolor, 5mm, red/green
T1,T3 = STP22NF03L
T2,T4,T5 = BC547A
T6 = 2N7000
IC1 = LM2674N
IC2 = DS1813T
IC3 = ATMEGA8-16PU, programmed, Elektor
Store # 080305-41
Miscellaneous
X1 = 4MHz quartz crystal
S2 = 4-way DIP switch
S1,S3 = pushbutton
F1,F2 = fuse, 3.15A, slow
K1 = 8-pin pinheader, 0.1 pitch
K2 = 3-pin pinheader, 0.1 pitch
K3 = 10-pin (2x5) pinheader, 0.1 pitch
J1,J2 = 2-pin pinheader, 0.1 pitch, with
jumper
2 pcs. fuseholder, 5x20mm, PCB mount, with
cap
2 pcs, heat-sink, TO220
Enclosure, 180x130x50 mm e.g. Fibox PC
150/50 LT
2 pcs. cable gland, straight, PG9
2 pcs. nylon nut
MOD1 = BOB-FT232R Elektor (optional)
PCB # 080305-1 [1]
R16,C7,IC4,P3 = not used.
A load connected to the User Load connec- the bottom of the case to drain off any Thanks to Ludovic and Vincent.
tor should be maintained on (powered). condensation. (080305)
Close switch DIP2 (S2): the load should The authors circuit has been operating
Web Link
now be turned off. Now short pins 2 and for four years now and is used to light
3 on K2: the load should now be pow- two LED spots for two hours a day. [1] www.elektor.com/080305
ered. The 12V rail present on K2 pin 1
will let you power a time-switch if fitted.
A bench supply (variable voltage) is useful
to test the high and low battery thresh- The information gathered by the PC via the serial interface
olds. The solar panel input test can be
performed by connecting a battery to
K1.B (Battery) and to K1.A a variable sup-
ply, current-limited so as not to exceed
the current the MOSFET can take. Start
the test at 12.6V then gradually increase
the voltage: it should be possible to see
the battery charge current, and, as soon
as the voltage on the battery exceeds
13.8V, the charging stop by shunting
the solar panel.
By the same token, by lowering the volt-
Lead-acid battery mode In lead-acid gel battery mode
age, youll be able to test the status of
LED2 and the charging cut-off, and then
the supply cut-off.
Youll be able verify the remaining options
by referring to the S2 function table.
The circuit within the dotted line (R16/
C7/IC4/P3) is an external voltage refer-
ence that is no longer used and should be
deleted. So these components no longer
appear in the list.
A battery temperature measuring circuit
using the NTC thermistor R7 forming a
potential divider with R8 makes it possible
to adjust the charging voltage automat- Manual control Things are getting hot!
ically depending on the temperature. If
another thermistor is connected to K1.D,
R7 must be removed.
The dimensions of the circuit (exclud-
ing the battery) correspond to those of
a Fibox watertight case. The
cable outputs pass via cable
glands (PG9). Two 2mm
holes must be drilled in
Figure 4. On this
prototype fitted with its
serial communication module,
T1 and T3 are not (yet) fitted with
heatsinks. However, depending on the current
levels, you will need to provide adequate cooling.
The
Speaking
Sonar
Stick
Raspberry Pi
+ ultrasonics
+ voice synth
= Aid
4 The Blind
In good experimental fashion, this project is a valuable study into what can be achieved with commodity
embedded technology like a Raspberry Pi. This ultrasonic distance measuring robot will greet you,
measure distances to objects continuously and read the values out loud. It can also be programmed to
activate alarms when the measured distance crosses a user-programmed limit. Got a pair of U/S distance
sensors and an RPi ready? Then go.
VDD
VSS
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
R/W
4
can be packaged to make a distance sen-
VO
RS
A
C
E
5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
sing walking stick for the blind and visu-
ally impaired for navigating their course. Raspberry Pi
PWR IN
For instant tactile feedback to the blind P1
+5V 18
10k
user, the relay outputs may activate small VCC
6
vibration devices. K1
RST
GP0
10
11
4 TRIG 8 GP1
INT IC1 12
GP2
Why-the-Pi 3 SDA 2
HC-SR04
R1 SDA 13
2 ECHO SCL 1 GP3
For games Microsoft Windows is King, 1
1k
R2
SCL
GP4
14
MCP23008 15
for networking Linux or Unix is King but 5
A0
GP5
1k8
16
4 GP6
for small scale automation where power A1
GP7
17
+3V3
3
A2
consumption is a major factor, the Rasp-
GND
berry Pi microcomputer is one of the best 9
K3
D1 RE1 1
options. Arduino can also do it to a certain
2
extent but being a mere microprocessor,
+3V3 +5V
it is more suited to slave functionality 1N4148 T1
time elapsing between a transmit and a language and/or preferred voice your The other bit of software needed for this
receive burst of the 40-kHz (approx.) sig- need to install a voice synthesizer pro- project is rpi-gpio. Its present version can
nal is used to compute the distance bet- gram. There are many voice synthesizer be checked at [3]; download the latest
ween the ultrasonic transducer device and software available on Internet but out version and then install it, which is just
the reflecting object, using sound velocity of these espeak is the most versatile a few clicks down the road.
as a constant. In case another person software, besides, its free. Some other
comes in range with a similar ultrasonic voice synthesizer softwares are Festi- Avoiding repetition
sensor (or a car equipped with a par- val, Pico, and Cepstral [2]. The Raspberry Pi will become long in the
king sensor!) mutual interference may tooth when voicing the same values over
occur. The author is working on a solu- eSpeak produces reasonable quality and over again. Thats why the software
tion to this problem. The type HC-SR04 English speech. It uses a different syn- has an array where the last 20distance
ultrasonic ranging module has a detec- thesis method from other open source values are stored.
tion range of 2cm to 5m approximately text-to-speech (TTS) engines, and has a
with an accuracy of about 0.3cm and a unique sound. Its perhaps not as natural When the current reading differs from
15-degree aperture angle. or smooth, but in the authors opinion the last one by more than the set value
its articulation is clearer and easier to (here, we set 2cm) RPi will speak up, else
A small loudspeaker is connected to the listen to for long periods. it will just remain quiet. Simply change
RPis audio output, or earphones are the value of sv at the beginning of the
used as an alternative. The LCD panel $> sudo apt-get update program to suit your requirement.
is optional. $> sudo apt-get upgrade
$> sudo apt-get install alsa-utils 1-2-3, testing
Software Set the volume high if you connect the
The software developed for the project is Now edit the /etc/modules file to include audio socket with an amplifier, else use
a free download you can find on the Elek- the following line beside its other lines. earphones and then run the Python pro-
tor Magazine website |1]. We recommend gram in su mode, like so:
opening and viewing the RPi code, some $> sudo nano /etc/modules
aspects of which will be discussed below. snd_bcm2835 $> sudo python ultra3.py
A piece of the code is shown in Listing1, The first initialization takes some time.
this is the ultrasonic echo routine. Save nano (ctrl+o) and then exit (ctrl+x) You will hear your RPis greeting mes-
The speech synth sage and then the program enters into a
To be able to adapt the project to your $> sudo reboot loop where it repeats the distance measu-
while shutdown == 0:
GPIO.output(GPIO_TRIGGER, False)
time.sleep(0.1)
# Send 10us pulse to trigger
GPIO.output(GPIO_TRIGGER, True)
time.sleep(0.00001)
GPIO.output(GPIO_TRIGGER, False)
start = time.time()
while GPIO.input(GPIO_ECHO)==0:
start = time.time()
while GPIO.input(GPIO_ECHO)==1:
stop = time.time()
elapsed = stop-start
#multiplied speed of sound (cm/s)
distance = elapsed * 34300 / 2 cases the RPi and the ELPB-NG board
lcd.setCursor(0,0) will be secured on the stick not far below
lcd.message("TIME -------- CM") the handle, and the battery pack (lead-
acid, NiCd, Li-Ion) again a little lower. The
lcd.setCursor(0,1)
sonar probe is at a position a little below
buf = "%.0f" % distance
the middle of the stick to securely iden-
if distance>99:
tify low objects that can cause tripping.
lcd.message(datetime.now().strftime('%H:%M:%S ')+buf)
if distance<=99:
The length of the stick is critical and
if distance>9: should be adapted individually to the per-
lcd.message(datetime.now().strftime('%H:%M:%S ')+buf) son using it. The earphones will produce
if distance<=9: the sonar readings only when there is a
lcd.message(datetime.now().strftime('%H:%M:%S ')+buf) change in the reading exceeding the pre-
set amount (setpoint, sv). Some earpho-
print " Distance : %.1f cm" % distance nes have built-in volume control. If not,
the volume can be adjusted in the ultra3.
if distance<=200 and distance>100: py program by changing the a220 value
GPIO.output(motor1,1) to something a little softer; note that
GPIO.output(motor2,0) a200 is India Default i.e. full volume.
(150401)
elif distance<=100:
GPIO.output(motor1,0)
GPIO.output(motor2,1) Web Link
[1] Project software:
else: www.elektormagazine.com/150401
GPIO.output(motor1, 0) [2] Cepstral voice synthesizer:
GPIO.output(motor2, 0) www.cepstral.com/raspberrypi
[3] RPi-GPIO:
# if the difference between the previous distance and the current https://sourceforge.net/projects/
# distance is greater than a set value raspberry-gpio-python/
if abs(prevDistance-distance)>=sv:
exitCode = subprocess.call(["espeak","-ven+f3","-a200",
"-s120","%.0f" % distance])
prevDistance = distance
TwinBot
A telepresence
electric scooter
By Chris Krohne (Germany)
Telepresence
The idea of a mobile virtual presence is not entirely
new. It was already explored by Sheldon Cooper in the
cult series The Big Bang Theory. There the head nerd
had built a more or less improvised mobile robot
equipped with a camera and a monitor, which
could be controlled over the Web. Given a
fast Internet connection, this concept can
be applied anywhere in the world. The
essential components of a telepresence
robot are a camera, a monitor, a loud-
speaker and a motion unit. These mod-
ern avatars are much more versatile than
a simple video connection, because they
allow you to communicate and interact as
though you were physically present.
Components
Internet
Browser HTML5 Browser HTML5
ControlAPP
webRTC
Video Communication
Tablet Control Data Remote Device
Serial Bluetooth
Connection
twinBot
Figure 2. The TwinBot consists of a control unit and an Android tablet. It is Figure 3. The mounting frame for the motors and electronics.
controlled over the Internet.
The potential applications for telepresence robots are extremely sequence to take the TwinBot out of Park mode and start it
diverse. They include meetings with participants in widely moving with the Forward command. This command has to be
separated meeting rooms as well as building surveillance, sent continuously; otherwise the TwinBot enters Stop mode for
for example. These avatars can be useful for supervision, safety reasons. The control unit sends status data, such as the
support and parenting. In future, it might even be possi- battery charge state, inclination angle and speed, to the tablet.
ble to rent avatars on site in distant locations for exam- When the control unit is connected to the tablet, a gateway
ple, you could take a telepresence tour of the Museum of app on the tablet connects the control unit to the Internet.
Modern Art in New York from your living room in Europe.
In that scenario you would personally steer the robot through Mechanics
the museum and view the imagery picked up by the avatars The mechanical structure of the TwinBot is fairly simple. All
HD stereo camera on your HD 3D television set. According to necessary components are fitted on a mounting frame (see
marketing studies, the demand for telepresence robots will Figure3). The aluminum wheels are 20cm in diameter and
grow enormously in the next five years, even though some of have special rubber tires (Figure4) to keep the contact area to
the potential application areas and ideas have not yet been a minimum in order to reduce friction. The wheels are mounted
imagined. directly on the motor shafts using collets. Both DC gear motors
have an output rating of approximately 20W, which is sufficient
The TwinBot is a telepresence robot development platform you for this application. Power is supplied by a 12V rechargeable
can build yourself. What makes it special is that the robot is battery. The TwinBot has two parking braces, each extended
designed as a self-balancing electric scooter, similar to a small and retracted by a conventional servo of the type used in
Segway. By contrast, other telepresence robots need a fairly model construction. The forces are distributed to minimize the
large wheelbase for sufficient stability. The TwinBot is very required servo holding current.
slender, which enables it to move more like a real person and
gives it a more humanoid appearance. Tipping over is virtually As can be seen in Figure3, a standard AGM 12V lead-
impossible thanks to the balance control algorithm. The turning acid battery is installed in the main mounting frame, along
circle is very small because the two wheel motors are driven with the motors and the control unit. The entire assembly
independently. The mobile TwinBot communicates through is enclosed in a stylish tubular plastic housing, as shown in
a compact and inexpensive Android tablet with an 8-inch Figure1. A pipe clamp for a 35-mm upright tube is located
screen. The tablet provides the link to the outside world and on top of the mounting frame. The plastic housing is pre-
drives the TwinBot control unit through a serial Bluetooth link. fabricated with all necessary openings for the upright tube,
Figure1shows the attractive appearance of the finished Twin- main switch, LED, charging connector and parking braces.
Bot from various angles. The housing is attached to the mounting frame by two screws
at the bottom. The cable for the tilt servo, which allows the
Components tablet to be tilted over a range of 45, runs through the
Along with the electromechanical drive, the TwinBot consists of upright tube. The three-wire servo cable is plugged into the
a control unit and an Android tablet (see Figure2). The con- control unit, which is located directly below the pipe clamp.
trol unit of the TwinBot is equipped with a Bluetooth module, The height of the telescopic upright tube can be adjusted and
which is paired with the tablet and receives control commands secured with a plastic clamp. This makes it very easy to adapt
from the tablet. If necessary, you can establish a direct con- the height of the TwinBot to specific situations. The tablet tilt
nection to the control unit to drive the TwinBot without the aid servo is mounted on an angle bracket at the top of the upper
of the tablet. The control unit supports a simple protocol for tube. A universal mount for tablets with an 8-inch screen is
this purpose. For example, you can send a simple command glued to the servo.
Figure 4. The mounting frame with the wheels mounted. Figure 5. The electronics assembly of the TwinBot.
Electronics generates standard PWM signals for these servos on three con-
The control unit is built around an AVR ATMega microcontroller trol lines, with a period of 20ms. The servo supply rail has two
clocked at 20MHz (see Figure5 and the detailed schematic extra-large electrolytic buffer capacitors because servos can
diagram in Figure6). Its main task is to read data from the often cause large current spikes. This is also the reason why the
MPU6050 module, which contains a gyroscope and a three- microcontroller is powered from a separate voltage regulator.
axis acceleration sensor, process the sensor data, and drive
the motors to keep the TwinBot balanced when it is standing Firmware
still or moving slowly as desired. The MPU6050 module is The firmware was written in BASCOM AVR. It consists primar-
connected to the microcontroller over an IC bus. The two DC ily of the main loop, which is interrupt driven at a frequency
gear motors are driven by an STL6205P dual bridge driver IC of 100Hz (see Figure7).
(IC6), which is located in the control unit. This IC has internal In the main loop the sensor data from the MPU6050 neces-
overload and overtemperature protection circuitry. The motor sary for balancing the TwinBot is read via the IC bus and pro-
driver IC is driven by two PWM signals and two control lines that cessed by a PID filter. The values for driving the two motors
determine the rotation direction of the motors. These control are derived from the PID filter output signal. They are written
lines are applied to NAND gates that feed the PWM signals to directly to the PWM control register to determine the actual
the appropriate inputs of the driver IC according to the desired PWM ratios of the motor outputs. In Stop mode the PID param-
rotation direction. The driver IC also has two Enable inputs that eters are chosen to keep the TwinBot standing on the spot.
allow the microcontroller to disable the bridge driver circuits. A prerequisite for this is a properly balanced condition obtained
The Rx and Tx lines of the microcontroller hardware UART are by defining an offset angle that causes the overall system
connected to the BTM222 Bluetooth Class1 module (IC3), to remain in balance. This angle depends on several factors,
which has as usable range of up to 100m. This enables very including the mass of the tablet, the mounting point of the
reliable Bluetooth connections. tablet, and the inclination of the floor. The offset angle can be
Two other inputs of the microcontroller are routed to a GPIO adjusted manually. If it is not correct, the TwinBot tends to
header, which can be used to connect other sensors and user bob slowly back and forth when it is in Stop mode. The offset
extensions. For example, it could be used to connect Hall sen- can be adjusted using a calibration tool so that the TwinBot
sors to measure the rotation speed of the wheels. stands still, balanced on the spot. A subroutine of the main
loop controls the three servos. They are driven by standard
The battery voltage is measured by an ADC input of the micro- servo pulses with widths from 1 to 2ms, proportional to the
controller through a voltage divider. Another ADC input is used servo displacement. This routine is executed on every second
to measure the speed of the robot by means of two diodes and pass through the loop, resulting in a standard pulse period of
a capacitor connected to one of the motors. For this purpose, approximately 20ms. Another subroutine measures the bat-
the bridge driver is briefly disabled every 500ms and the back tery voltage and computes a moving average. The two motor
EMF of the motor (acting as a generator) is measured because bridge drivers are briefly disabled every 50 passes through
it is proportional to the speed. The resulting signal is smoothed the loop, corresponding to a frequency of 2Hz. During these
by the capacitor and sampled several times by the ADC during short breaks the back EMF generated by the rotating motors
the off period, and the average of the samples is calculated to is measured after the inductive components have decayed.
obtain the measured value. The main switch, indicator LED and This voltage is used to determine the current speed. Despite
charging connector are connected to the control unit through averaging of several samples, the measured speed is never
a five-pin header. very accurate, but it is good enough to prevent the TwinBot
The control unit has two voltage regulators. One of these from exceeding the maximum permissible speed.
LM317s is dedicated to the three servos. The microcontroller The main loop also sends the measured battery voltage to the
Bluetooth module via the UART. Then it checks the command specific control commands or changes the operating mode.
buffer for pending commands. The command buffer has a width
of 50 characters and is driven by a small interrupt routine. When There are three operating modes: Park, Stop and Drive. In Park
a command is received over the Bluetooth link and passed on mode the parking braces are extended and the motors are dis-
to the UART, the characters are written to a ring buffer to wait abled. A Stop command puts the TwinBot back into the balanced
for processing. The Parse Command routine checks the buf- state. If the TwinBot then receives a motion command, such
fer for executable commands and either converts them into as Forward, Backward, Left or Right, the PID control parame-
ters are altered and the offset
angle is changed for a brief
D4
+5V
IC5 interval. As a consequence,
1 5 MLL41
VIN VOUT
IC8 the TwinBot tips slightly for-
LP2981M
C15 C13 3
ON
3.3V
2 17
C17 C16 LM317 +5VSERVO ward (for forward motion)
GND
4u7 100n 2 3
PVCC VCC
5 100n 4u7 ADJ
R26
or backward (for backward
50V AIO0 PIO0 50V
4 6
motion) and is accelerated
1k
AIO1 IC3 PIO1
16 7 C20 C22 C19 C21
RESET
AVRTX 34
BTM-222 PIO2 8 by the balance compensation
SPI_MISO PIO3 R27
R15 4u7 100n 470u 470u
33
32
SPI_CLK PIO4
9
11
50V 16V 16V mechanism. The magnitude of
3k
1k8
SPI_CSB PIO5
31
SPI_MOSI PIO6
12 BAT+ the acceleration depends on
26 13
AVRRX 27
UART_RX PIO7
14 ANT
three factors: 1. The mount-
UART_TX PIO8
30
UART_CTS PIO9
15 F2 D1 ing height of the tablet 2. The
28 36
25
UART_RTS PIO10
35
MLL41 angle difference 3. The floor
PCM_CLK PIO11 JP10 IC7
LSP1
24
PCM_OUT RF_IO
37 1 B+
LM317 +5V friction and the rolling friction.
23 21 2 B++
PCM_IN USB_DN
R16 R17
22
PCM_SYNC USB_DP
20 3 GND
ADJ
R1 The acceleration behavior of
4 GND
the TwinBot can be modified
GND
GND
GND
GND
GND
GND
1k
5 LLED1
3k
3k
C2 C3 C8
1 10 18 19 29 38 directly by changing the off-
R2
4u7
50V
4u7
50V
4u7
50V set angle. These parameters
3k
BAT+ +5V can also be altered with the
+5V
R19
R9 R10
calibration tool. Particularly in
4k7 15R
C10 C12
JP2 Stop mode, the modified PID
36k
1
4 6 18
100n
VCC VCC AVCC
100n 2 control loop parameters result
R7 29 23 GOUTX 3
PC6(RESET) PC0(ADC0/PCINT8)
24 GOUTZ 4
in gentler acceleration adjust-
PC1(ADC1/PCINT9)
20k
VBAT 19
ADC6 IC1 PC2(ADC2/PCINT10)
25 SERVO3 5 ment. To prevent the TwinBot
SPEED 22 26 SERVO1 6
ADC7 PC3(ADC3/PCINT11)
27 SERVO2 7
from accelerating indefinitely,
+5V PC4(ADC4/SDA/PCINT12)
28 ENABR 8 which would ultimately lead to
RESET
PC5(ADC5/SCL/PCINT13)
JP1 +5VSERVO
MEGA48/88/168-AU
2 1 12 30 AVRRX falling over, the altered offset
PB0(ICP1/CLKO/PCINT0) PD0(RCX/PCINT16) JP3
4 3 PWM 13
PB1(OC1A/PCINT1) PD1(TXD/PCINT17)
31 AVRTX SERVO2 1
angle is changed back to the
6 5 PWM2 14 32 2
PB2(SS/OC1B/PCINT2) PD2(INT0/PCINT18) SERVO2
8 7 MOSI 15
PB3(MOSI/OC2A/PCINT3) PD3(INT1/OC2B/PCINT19)
1 3 normal value after a defined
10 9 MISO 16 2 CCW2
SCK 17
PB4(MISO/PCINT4) PD4(T0/XCK/PCINT20)
9 JP5
number of loop executions.
PB5(SCK/PCINT5) PD5(T1/OC0B/PCINT21) SERVO1 1
PD6(AIN0/OC0A/PCINT22)
10
2
This and the modified PID con-
20 AREF 11 CCW SERVO1
PD7(AIN1/PCINT23) 3 trol loop parameters cause the
GND GND XTAL1 XTAL2 AGND R21 R20
3 5 7 Q1 8 21 JP7 TwinBot to gradually come to a
47R
47R
SERVO3 1
2 stop when it does not receive
SERVO3
LED2 LED1
C11 C9 18.4320MHz C7
3
any new control commands. As
100n 18p 18p long as Drive mode is active
BAT+
and the TwinBot receives peri-
SPEED
ENABR
6 9
14 14 IN1A OUT1A
IC2 IC4
7
IN2A OUT2A
3 D5 any new control commands
IC2.C 14 12 R23
7 7 8 IC2.A IN1B OUT1B
during a 1second interval, it
10 1 R13 15 18 D6 36k
9 1 3 IN2B OUT2B
1 4k7
2 8
SENSE A
SLUG 2x
automatically switches to Stop
13
SENSE B 1N4148 R24
IC2.D IC2.B C4 C18 mode with a harder PID con-
12 PWM2 5 R12
GND
GND
GND
GND
20k
11 4
13 1 CCW2 6 1 4k7
220n 1 10 11 20 1u
trol loop characteristic. From
25V
Stop mode it can change to
150312 - 11
Park mode.
For remote control over the Internet, the control unit is con-
nected to the tablet over the Bluetooth link and the tablet is Firmware
Interrupt routine: Timer 100 Hz
connected to the Internet through a WLAN.
This is supported by a gateway app on the tablet. It receives Sensor Data &
control commands sent from the control device to the Firefox ADC values of battery voltage
to the tablet, and the gateway app transmits this data to the
control device in the form of WebRTC messages. A WebRTC- Set PWM for servos
A suitable website has been created for the TwinBot to enable For everyone else, especially those of us who are not as keen
automatic login to a database and the communication server. to work with drills, saws and files, a parts kit for this project
The TwinBot tablet first logs in to the communication server and is available on the web page for this article [2]. The kit con-
obtains the unique socked ID necessary for further communi- tains all necessary mechanical and electronic parts, including
cation from that server. Then it logs in to the database. After a fully assembled and tested control unit. If you want to cus-
successful verification of the login data, the socket ID received tomize the TwinBot, you can also download the software from
from the communication server is sent to the database. To allow the article page.
the TwinBot to be controlled from another device, that device (150312)
first logs in to the database via the twinrobotics website [1]
Web Links
and receives the current socket ID for accessing the TwinBot.
After the control device has logged in to the communication [1] www.twinrobotics.eu
server, it can simply contact the TwinBot directly using a Call [2] www.elektormagazine.com/150312
function. After a connection has been established with Call,
both clients (TwinBot and the control device) can exchange
video and audio data in real time.
The website of the control device has a JavaScript function
that sends keydown events directly to the tablet of the Twin-
Bot using the WebRTC SendMessage function. This means that
when a navigation key (for example, a cursor key) is pressed
on the control device, a text message is immediately sent to
the tablet. This message in turn calls a JavaScript function on
the website of the tablet. The gateway app then sends the
control data to the TwinBot control unit, which is connected to
Lego Mindstorms
Electricity Monitor
The Lego Mindstorms NXT, originally launched in 2006, is still a very popular microcontroller. Among
other things, this can be seen from many articles, books, and references on the Internet. One of the
most significant improvements relative to the previous Lego RCX microcontroller is the support for the
I2C protocol. Software and hardware for this two-wire communication bus are now fully supported. This
makes it possible to use the latest (non-Lego) sensors in a Lego application, such as a compass sensor, an
acceleration sensor, or the TSL2561 light sensor used in this design. We use this sensor from TAOSinc [2]
together with the NXT brick to monitor household electricity consumption.
The TSL2561 is a light sensor that con- light sensors, which are often imple- consumption. These meters also have a
verts brightness into a digital value. It mented using a combination of LDRs, flashing LED. The time between succes-
employs two photodiodes: one to mea- LEDs and opamps with other electronic sive flashes of the LED is directly related
sure visible and infrared light (channel0), components. The sensor costs less than to the electricity consumption. This means
and one to measure only infrared light three pounds/euros and is readily avail- that you can determine your electricity
(channel1). These two sensor channels able (from Conrad and other sources). consumption, in both physical units and
can be read out individually in digital form The manufacturers data sheet provides financial cost, by continually measuring
with 16-bit resolution via a serial link extensive information to help you use the this time.
compliant with the I2C protocol. Thanks sensor in your own designs.
to an optimised measuring range, this Here we use the TSL2561 for the (overly)
results in a visual capacity comparable Many modern household electricity simple purpose of detecting the presence
to that of the human eye. This sensor is meters have a counter mechanism (some- or absence of light. The sensor gener-
an excellent replacement for analogue times digital) that indicates the energy ates one numeric value when the LED
82k
82k
1k8
the software. If you aim the sensor at
K1
the flashing LED or tape it onto the elec- 1
tricity meter and then connect it to the 2
1
NXT brick, you can use the NXT as a data 3
4
logger. The readings can be shown on 4
5 SCL IC1
the NXT display and/or written to a file,
6 TSL2561
RJ-11
which can subsequently be uploaded and 6
SDA
D1
NXT
processed for further analysis. Another 3V3
5000
The ShowResult procedure shows the
4000 results on the NXT display.
3000
2000
Figure2 shows a record of electricity
consumption in watts versus time. The
1000
measurements were made by the Enimon
0 program and stored in the dataNXT.txt
8 9 10 11 12 13 14 15
file. The measurement data was imported
Time [min] 090204 - 11
into an Excel file and used to generate
a chart. A short period when a clothes
dryer and washing machine collectively
guages. The standard Lego software has value depends on the type or model of caused a consumption of 6700watts is
a fully graphical user interface that can be the electricity meter. clearly visible.
used to generate programs by simply link- After the supply voltage Vdd is connected, (080262-I)
ing functional blocks together. If you want the sensor needs a start command before
Internet Links
to use it for this monitor application, you it starts operating. The InitTSL2561 pro-
will have to download additional plug-ins cedure starts the sensor. A value of 0x03 [1] www.elektor.com/080262
to support I2C bus programming. Real hex is sent to the control register in the [2] www.taosinc.com
programmers prefer to tackle the job in a sensor. After this, the two A/D converters [3] www. mindsensors.com
text-oriented programming environment. start working with a default integration
[4] www.philohome.com/nxtplug/nxtplug.
time of 400ms. The results are available
htm
The author used the free BrixCC compiler in the Channel0 and Channel1 registers
and development environment [5] (spe- at the end of the integration time. [5] http://bricxcc.sourceforge.net/
cifically developed for the Lego microcon-
trollers) to generate the software for the Next, the dataNXT.txt file is opened. The
online electricity monitor. This compiler previous file is overwritten in this process. Download
is still being enhanced, and good sup- The maximum file size is set to 60KB. 080262-11 NXC source code,
port is available from Web forums. You This is fairly small, but still large enough from www.elektor.com/080262
can use USB or Bluetooth to upload and to allow data to be collected for several
download files. Full NXT control is also hours.
possible with this software.
Variable t0 is assigned a start time before
The energy monitoring program (Enimon) the while loop is executed. Procedure
includes all the routines necessary for ReadTSL2561 reads Channel0. Channel1
communication between the NXT and (infrared) is ignored in this application.
the TSL2561 via the I2C bus. The source
code can be downloaded free of charge When the LED is on, the elapsed time
from the expected location: the Elektor since the previous measure-
website [1]. ment is calculated and the
The most important routine executed in power consumption in
the Enimon code is shown in Listing1. watts is calculated.
The threshold value (the digital value the The conversion
sensor supplies when the LED is on) is set factor needed
in the configuration section of the soft- for this var-
ware. It has a value of 3 in this example, ies from one
but the actual value must be determined electricity
experimentally. meter to the
next. In this
A value for the on time of the LED (in example the con-
milliseconds) must also be specified, version factor is
since the program should not store any 500 pulses per kilo-
sensor measurements during this period. watt-hour (kWh).
A value of around 500ms proved to be The calculated value is compared
adequate in this example. The actual with the result of the previous calcu-
for only a few months. With other apps meter box. I designed two versions of this
Features you have to pay for this service. interface module: one for wired networks
Reads daily, monthly and yearly (Figure1) and another for transmitting
electricity and gas consumption What the SM does the data over a Wi-Fi network (Figure2)
Reads current power consumption The data from the interface port of the to make it available wirelessly everywhere
Reads current power generation smart meter in my case a Landys+Gyr in the house. The interface module reads
Logs data on an SC card G350 single-phase meter using the the full data from the smart meter every
Choice of Wi-Fi or wired network DSMR4.0 protocol is made available 10seconds using the DSMR4.0 proto-
connection everywhere in the house over a wireless col at 115,200baud and sends the data
Sends data over the Internet to any network. This data can then be shown as an UDP package. The signal from the
desired recipient on the SM controller or on a large LED meter is first inverted to convert it into a
display. With the controller you can read conventional serial data signal. This serial
out all the data from the smart meter and signal is also available as a TTL signal on
If you have a smart meter [1] in your keep track of you daily, monthly and yearly CON1 (TCP/IP interface) or DATA_OUT
home, you can extract a lot of data from electricity and gas consumption. The data (Wi-Fi interface).
it. There are all sorts of apps that let you is written to a CSV file on an SD card every
keep track of your consumption, but I fifteen minutes. The saved data can later The TCP/IP interface consists of just two
wanted a large LED display to see the be used to create overview charts. components: a TTL inverter IC and a USR-
data in real time. I also wanted to be able TCP232-T module, which has to be con-
to save the data for as long as I liked. How it works figured. This can be done completely via
Many apps only show the data for the A small interface module is connected the network using the software supplied
previous day and save the meter readings to the P1 port of the smart meter in the with the module. The interface status is
220R
220R
2 1
3
4 DATA POWER
IC1.D
IC1.A copyright necting the interface module to a PC via
9 8 +5V
1 1
1
2
the mini-USB connector. A USB to RS232
IC1.E converter (IC2) is included in the circuit
11 10 100n SJ1
1
7 6
1 2 for that purpose. A user guide for module
IC1.F
VDD VCC
configuration is available at [2]. Once you
2 CONFIG
RXD
13
1
12
MODULE1 TXD
3 1 have completed the initial configuration,
4 2
+5V
USR-TCP232-T
RST
1 3
any future changes that may be neces-
CFG
CFG
1 sary can be made over the network in a
14 GND
C1
IC1
C2
5
2
Telnet session.
10u 7 10u
100n
IC1 = 74LS04D 150598 - 11 Here again the data signal from the smart
meter is inverted by a 74LS04 gate. Level
converters (T1T3) are fitted because the
+5V
WiFly module operates from 3.3V. There
are also several LEDs for status indica-
R7
tion: network status (green, slow blink-
10k
IC3.D
27 26 25 24 23 22 21
9 8 ing when a network connection is pres-
1
ANTENNA
28 20
GND
GND
GND
GND
GND
GND
29
GND
SENSOR_0 VDD_3V3_SW
GND
19 copyright ent, fast blinking when no connection is
30 18 IC3.E
31
SENSOR_1 SPI_MOSI
17 11 10
present); data reception from the smart
SENSOR_2 SPI_CLK IC3 = 74LS04D 1
32
33
SENSOR_3 SPI_MISO
16
15
meter (blue); and data transmission over
+3V3 SENSOR_POWER FLASH_CS IC3.F
34
VDD_3.3V_RF GND
14
13 12
Wi-Fi (red). In addition, there are three
35 13 1
+3V3 +3V3 +5V
36
SENSOR_4
SENSOR_5
GPIO_1
GPIO_2
12 SMD LEDs for status indication during
37 IC1 11 IC3.C
38
SENSOR_6 GPIO_3
10 5 6
programming over the USB port.
SENSOR_7 VDD_3.3V 1
39 9 DATA OUT
GND GPIO_4 3
40 WiFly RN-171 8
RESET GPIO_5
41
FORCE_AWAKE GPIO_6
7
1
2
Each interface module can be fitted in a
42 6 R1 R2 R3 R4
43
GPIO_14 GPIO_6
5 small plastic enclosure (Hammond type
GPIO_13(UART_RTS) GPIO_8 +5V
1k
1k
1k
1k
44
GPIO_12(UART_CTS) GPIO_9
4
1591MBK). The interface module can be
3V3_REG_CTRL
45 3 RJ11
GPIO_11(UART_RX) ISP_RX LED1 TX WIFI DATA
46 2 1 connected to the P1 port of the smart
VDD_BATT
GPIO_10(UART_TX) ISP_TX
47 1 2 IC3.B
GND GND
3 3
1
4 meter by a one-to-one cable with an RJ11
48 49 4
5
plug at each end. It can be powered from
IC3.A
6
1
1
2 an AC adapter with 5V output and a mini-
100n 100n
USB plug. The Wi-Fi interface board has
an MCP1703 that converts the 5V supply
+5V voltage to 3.3V for the WiFly module.
Naturally, the data sent by the TCP/IP or
+5V R12 R11
+5V +3V3 +3V3 +5V Wi-Fi interface module has to displayed.
220R
220R
100n
R13 R14 R6 R5 There are two ways to do that in this
TXD RXD
C7
project: with the controller or with an
10k
10k
20 4
10k
10k
T2 T1
VCC VCCIO PROG 2 NORMAL
10u 16V
23
CBUS0 TXD
1 3 1
LED display
22 3
CBUS1 IC2 RTS MODE
13 11 +5V BSS138 +3V3 BSS138
CBUS2 CTS
USB 14 2
12
CBUS3 DTR
9 R15 R16 Data reception with the
CBUS4 DSR
1 FT232RL 10
controller
10k
10k
DCD T3
2 R9 16 6
22R USBDM RI
3 R10
22R
15
USBDP RXD
5 OUT
IC3
The SM controller analyzes the data
4 19
MCP1703 3.3V
5 27
RESET
OSCI OSCO
28 BSS138
+5V +3V3
received from the smart meter over the
17 26
3V3OUT TEST
Wi-Fi link. The data can be viewed in remaining data is retrieved again from The data is fed directly to the PIC micro-
real time on a four-line display. The main the next message sent by the meter. The controller through a level converter built
data is also written to an SD card and SD card can be removed to view and/or around T3. The microcontroller processes
forwarded to the LED display over Wi-Fi. process the data on the computer. the data, drives the LCD and buzzer, and
When the controller receives Wi-Fi data writes the data to the SD card. As an
from the smart meter, it first decodes the As you can see from the schematic dia- extra feature, a DS18S20 temperature
data and then analyzes the various meter gram in Figure3, the transmit and sensor is mounted on the board and con-
readings. The totals, net amounts and receive circuitry around the WiFly mod- nected to the microcontroller through JP2.
ratios are calculated by the PIC18F2620 ule is nearly the same as on the Wi-Fi This is necessary to manage with the
microcontroller. Every 15minutes the interface board. A green LED indicates available I/O count of the microcontroller
main parameters are written to a text the Wi-Fi status, a blue LED indicates (IC4 shares a pin with the ISP connector).
file on the SD card in CSV format. This incoming data, and a red LED lights up The same applies to the control buttons,
way the daily, monthly and yearly data is when data is sent to the LED display over which are connected via the Switches con-
saved in the event of a power outage. The the Wi-Fi link. nector. For convenient mounting in an
10k
+5V +5V
SD_ACCESS LC DISPLAY
CLOCK
C16
LATCH
DATA
HD44780
R13 C4 C3 R3 R1 R2
1u ACTIVITY
10k
10k
10k
10k
100u 100n
VDD
VSS
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
R/W
SD-CARD
VO
+5V
RS
4
A
C
E
+3V3 1 +5V 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
CS 20
2
SDI VDD
3 R9 4 1
1k5 RA2/AN2/VREF-/CVREF+ MCLR/VPP/RE3 PIN16 1 PIN15 1
5 R8 5 2
CLK 1k5 RA3/AN3/VREF+ RA0/AN0 2 2
6 6 3 TR1
RA4/T0CKI/C1OUT RA1/AN1
7 R7 7 10k
SDO 1k5 RA5/AN4/SS/HLVDIN/C2OUT 3 3
8 R12 R10 R11
9
3k3
3k3
3k3
21 11 D4
SW1
SW2
SW3
RB0/INT0/FLT0/AN12 RC0/T1OSO/T13CKI R6
22 12 D5
RB1/INT1/AN10 RC1/T1OSI/CCP2 22R
23 IC1 13 D6
RB2/INT2/AN8 RC2/CCP1
+5V 24
RB3/AN9/CCP2 RC3/SCK/SCL
14 D7
25 18F2620 15 RS
ISP RB4/KBI0/AN11 RC4/SDI/SDA
6 26 16 E
PGM RB5/KBI1/PGM RC5/SDO
5 27 17
PGC RB6/KBI2/PGC RC6/TX/CK
4 28 18 D1
IC3 +5V
PGD RB7/KBI3/PGD RC7/RX/DT
3 R4 POWER
VPP VSS RA7/OSC1 RA6/OSC2 VSS ON/OFF 7805
2 1N4004
100R
+5V 8 9 10 19
1 JP2 1 Q1
GND
BUZZER C15 C16 C17
ICSP
C6 C5 100u
+5V 25MHz 100n 100n
R5
A
3
SWITCHES
4k7
VDD 6 5 TX PIC
IC4 2 4 3 IC6
DQ 27 26 25 24 23 22 21 +5V +3V3
DS18S20 2 1 DOUT MCP1703 3.3V
ANTENNA
28 20
GND
GND
GND
GND
GND
GND
220R
+5V 100n 35 13
1 2 3 1 2 3 SENSOR_4 GPIO_1
R24 R25 36 12 +3V3 +3V3
SENSOR_5 GPIO_2
TXD RXD 37 11
SENSOR_6 GPIO_3
10k
10k
20 4 T2
38 10
VCC VCCIO SENSOR_7 VDD_3.3V
1 23 1 39 9
CBUS0 TXD GND GPIO_4
JP1 22 3 40 WiFly RN-171 8
CBUS1 IC2 RTS RESET GPIO_5
13 11 +5V BSS138 +3V3 41 7
CBUS2 CTS FORCE_AWAKE GPIO_6
USB 14 2 42 6
CBUS3 DTR GPIO_14 GPIO_6 R16 R17 R18 R19
12 9 R26 R27 43 5
CBUS4 DSR GPIO_13(UART_RTS) GPIO_8
10 44 4
1k
1k
1k
1k
10k
DCD T3
R20
3V3_REG_CTRL
2 16 6 45 3
22R USBDM RI GPIO_11(UART_RX) ISP_RX
R21 15 5 OUT 46 2 LED1 TX WIFI RX
VDD_BATT
3
22R USBDP RXD GPIO_10(UART_TX) ISP_TX
4 19 47 1
RESET GND GND
5 27
OSCI OSCO
28 BSS138
17 26 48 49
3V3OUT TEST
GND GND GND GND
7 18 21 25
C9 copyright 100n 100n
100n
150598 - 13
Figure3. The controller processes and saves the data, and it drives the LED display over a Wi-Fi link.
enclosure, the control buttons are fitted played is selected in the Settings menu:
JP3 on a separate small PCB (Figure4). either net daily electricity consumption or
6 5
4 3
SD card access is indicated by a red LED. net daily gas consumption. The brightness
2 1 The SD card should never be removed of the LED display can also be configured:
while this LED is lit, as otherwise the data either automatic (adapts to the ambient
S6 S5 S4
may be corrupted. It is a good idea to light level) or maximum. The currently
B MENU A stop data logging (menu9, keyB) before generated and consumed power is always
removing the SD card. After the SD card shown. If you configure the controller to
150598 - 14
is reinserted, you should check the card disable the beep tone when the Wi-Fi link
(menu9, key A) before using it. After is not available, this also applies to the
Figure 4. The buttons on the controller are this you can restart logging. LED display. The 8x8 LED displays can
located on a separate small PCB, which is also be connected directly to the EXT_
attached to the PCBs for the TCP/IP and Wi-Fi The controller sends the data for the LED DISPLAY connector on the controller PCB
interface modules for fabrication. display over Wi-Fi. The data to be dis- if so desired.
+5V
C22 C21 C7 C20 C23 C19 C16
+5V
+5V
+5V
+5V
+5V
+5V
+5V
+5V
+5V
5 6 5 6 5 6 5 6 5 6
CLKI CLKO CLKI CLKO CLKI CLKO CLKI CLKO CLKI CLKO
4 7 4 7 4 7 4 7 4 7
ENAI ENAO ENAI ENAO ENAI ENAO ENAI ENAO ENAI ENAO
3 8 3 8 3 8 3 8 3 8
DIN DOUT DIN DOUT DIN DOUT DIN DOUT DIN DOUT
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
2 9 DISP 8x8 2 9 DISP 8x8 2 9 DISP 8x8 2 9 DISP 8x8 2 9 DISP 8x8
+5V
R4 R1 R16 R2
C3 C4
CLOCK
LATCH
10k
10k
10k
10k
DATA
20
100n 100u VDD
4 1
RA2/AN2/VREF-/CVREF+ MCLR/VPP/RE3
5 2
RA3/AN3/VREF+ RA0/AN0
6 3
7
RA4/T0CKI/C1OUT
RA5/AN4/SS/HLVDIN/C2OUT
RA1/AN1
1
copyright
LDR
21 11 20 - 50k
RB0/INT0/FLT0/AN12 RC0/T1OSO/T13CKI
22 12
RB1/INT1/AN10 RC1/T1OSI/CCP2
23 IC1 13
RB2/INT2/AN8 RC2/CCP1
+5V 24 14
RB3/AN9/CCP2 RC3/SCK/SCL
25 18F2620 15
ISP RB4/KBI0/AN11 RC4/SDI/SDA
6 26 16 9V IC3 +5V
PGM RB5/KBI1/PGM RC5/SDO
5 27 17
PGC RB6/KBI2/PGC RC6/TX/CK D1 7805
4 28 18
PGD RB7/KBI3/PGD RC7/RX/DT
3
VPP VSS RA7/OSC1 RA6/OSC2 VSS 1N4004
2 C15 C18 C17
+5V 8 9 10 19
1 Q1
GND
JP3 1 BUZZER 100u 100n 100n
ICSP
+5V C6
25MHz
C5 ANT
R5 SPARE
SWITCH 22p 22p
3
4k7
VDD
IC7
IC4
27 26 25 24 23 22 21 +5V MCP1703 3.3V +3V3
2
DQ
ANTENNA
28 20
GND
GND
GND
GND
GND
GND
GND GND
DS18S20
TX PIC 29 19
GND SENSOR_0 VDD_3V3_SW
DOUT 30 18
+5V 1 +5V SENSOR_1 SPI_MOSI
31 17 C10 C11 C12
SENSOR_2 SPI_CLK
32 16
SENSOR_3 SPI_MISO
100n 100n 1u
33 15
1 R13 R12 EXT USB MODE +5V +3V3 +3V3 SENSOR_POWER FLASH_CS
34 14
VDD_3.3V_RF GND
JP1
220R
220R
100n 35 13
3 2 1 1 2 3 SENSOR_4 GPIO_1
R21 R22 36 12 +3V3 +3V3
SENSOR_5 GPIO_2
TXD RXD 37 11
SENSOR_6 GPIO_3
10k
10k
20 4 Q2
VCC 38 10
C2 VCCIO SENSOR_7 VDD_3.3V
23 1 39 9
CBUS0 TXD GND GPIO_4
22 3 40 WiFly RN-171 8
1u CBUS1 IC2 RTS RESET GPIO_5
13 11 +5V BSS138 +3V3 41 7
CBUS2 CTS FORCE_AWAKE GPIO_6
USB 14 2 42 6 R18 R19 R20 R3
CBUS3 DTR GPIO_14 GPIO_6
12 9 R24 R23 43 5
CBUS4 DSR GPIO_13(UART_RTS) GPIO_8
1k
1k
1k
1k
1 FT232RL 10 44 4
GPIO_12(UART_CTS) GPIO_9
10k
10k
DCD Q3
R14 16 6 45 3
3V3_REG_CTRL
2
22R USBDM RI GPIO_11(UART_RX) ISP_RX
3 R15 15 5 OUT 46 2 LED1 LED2 LED3 LED4 LED5 LED6 LED7
VDD_BATT
150598 - 15
Figure 5. The LED display uses the same PIC18F2620 microcontroller as the controller and can therefore also operate stand-alone.
Visitor Counter
for Web Pages
With wireless LCD
By Bert van Dam (Netherlands)
In this article we will demonstrate how you can make a web page on a
Raspberry Pi server, where the number of visitors is shown on the page
itself. In addition, this information is also shown on a wireless Arduino
with LCD.
We assume in this article that you know on the page is 286 pixels wide, so we
how to operate the Raspberry Pi, how you set the viewport slightly bigger, namely
can install software on it and how you 300 pixels, so that we will have a small
issue commands. If this is not so, then white border on the left and right of the
it is perhaps a good idea to read the pre- image. You can also make the viewport
viously mentioned book or the new title exactly the same size, but then the user
The Internet of Things In 35 projects may wonder whether part of the page is
with the Raspberry Pi and Arduino first. missing because there is no white bor-
The new title should be in our STORE as der to be seen.
you read this. The program started by the index.html
page, visitor.py, firsts attempts to open
Design a file that keeps track of the number of
A simple Python internet server runs on visitors. This file is stored on the Rasp-
the Raspberry Pi. The home page for this berry Pi server. If the file does not exist
Figure 1. Tablet and the XinoRF with LCD shield server (index.html) shows an image and then the page has not yet been visited
on top.
then automatically starts a Python pro- and the counter is initialized to 0. If the
gram on the Raspberry Pi. The result of file exists then the value that is stored in
this program is shown in the index.html it is retrieved. Subsequently this value is
The hardware for this project comprises page in an iframe (see Listing1). This incremented by one and then stored back
an XinoRF (an Arduino Uno with built-in is a frame that is inside a web page. You into the file. After this, the text You are
radio module) and an LCD-shield. For the can use it to show another web page visitor number: is added and sent via
web server a Raspberry Pi is used with from within a web page. In this project the wireless connection to the Arduino.
a Slice of Radio module. The XinoRF the second web page is generated by the Finally the program generates a web page
and the Slice of Radio module are part Python program. containing this text and sends this back to
of the Wireless Inventors Kit for Rasp- That the home page is able to run a pro- the index.html page, where it is shown in
berry Pi (abbreviated RasWIK), which gram on the Raspberry Pi is because of an iframe. In Listing2 we only show the
you can find in the Elektor STORE [1]. the CGI, the Common Gateway Interface. final part of the program, the complete
The Raspberry Pi has to be connected to As a security feature against unautho- source code is included with the download
your router using either a network cable rized use, this only works on the Rasp- that accompanies this article [2].
or Wi-Fi and you need to know what the berry Pi with programs that are stored in You will see that the program prints
IP address of your Raspberry Pi is. a special directory with the name cgi-bin. an HTML page. In reality, whatever a
In addition, the owner of the Raspberry CGI-program prints does not go to the
This project was tested with the SD card Pi has to give these programs execute screen (or a printer), but is sent to the
accompanying the Elektor book Rasp- rights beforehand. In this way unautho- browser as a file. The browser will then
berry Pi Explore the RPi in 45 Elec- rized users are prevented from running show the file as a web page, in this case
tronics Projects and also works with the any arbitrary program. in the middle of the page index.html, at
SD card from the RasWIK set. Other SD You may not be familiar with the HTML the position of the iframe.
cards dont have the necessary settings viewport tag at the head of the page (see The Arduino is running the program vis-
for radio traffic and/or Python web serv- Listing1). This tag is used to scale the itor.ino. This program runs continuously
ers and it is preferable that you do not page so it fits properly on tablets and and is therefore not started by index.
use those. smartphones (see Figure1). The image html. This program initializes the LCD
Listing 1. Listing 2.
Figure 2. The Raspberry Pi with the Slice of Figure 3. Web page index.html on a laptop.
Operation
Radio module.
Here follows a summary of the steps you
need to follow:
1. Copy the program visitor.ino using (you will get a message in the win- http://192.168.178.21:8080/index.html
the Arduino IDE from your PC to the dow in which the server is running You will now see a page as is shown
XinoRF. that the file cannot be found, even in Figure3. Each time when you
2. Make sure that the distance between though it is there). refresh the page the counter will
the Arduino and the Raspberry Pi is 6. Give the file execute permissions by increase by 1. What this looks like is
at least 50cm, because of the wire- executing the following instruction in shown in Figure1.
less connection. There is therefore the cgi-bin directory:
no wired connection between the chmod u+x visitor.py You can find more projects like this in the
Arduino and Raspberry Pi! If you forget to do this, you will still newly published book IoT GET-U-GOING
3. Create a directory for this project on see the index.html page, but no In 35 projects with the Raspberry Pi and
the Raspberry Pi and call this direc- counter value. An error message Arduino by Maartje Jansee.
tory server. Inside this directory also appears in the window in which (150551)
create a sub-directory with the name the server is running.
cgi-bin. Note: you have to use the 7. Go back to the sever directory and
name cgi-bin (without any capital start the server using:
letters and with the hyphen), other- python -m CGIHTTPServer 8080
wise you will not be able to run any This has to be done from the server
programs remotely. directory. If you do not do that then
4. Copy into the server directory the you will not see the index.html page.
following files 8. Now go to a web browser on your
(you can copy these from the down- PC or tablet and enter the following
load for this article): index.html, address (dont forget to replace my
favicon.ico and welcome.jpg IP address with that of your Rasp-
5. Copy into the directory cgi-bin the berry Pi). If you do not know the
following file: visitor.py. Note: do not IP address of your Raspberry Pi,
open this file on your PC, not even then log into your router and go to Weblinks
just to read it. If you do this, then the page that lists the connected
[1] www.elektor.nl/raswik
the file will be stored in a different devices. There you will see the Rasp-
way and it doesnt work anymore berry Pi, including its address. [2] www.elektormagazine.com/150551
It doesnt matter if you are in New York, Frankfurt, Vienna or worry we will take you through the whole process step by step.
Beijing: scrolling banner displays will be relaying the latest
stock prices and market statistics. The circuit
Making your own running text display is an interesting project; The schematic is shown Figure1. An LED is connected at each
it needs some hardware as well as software skills but dont crossing point of the matrix rows and columns in the diagram.
8 4 15
GND G2A Y0
DIGITAL (PWM ~ )
A7 5 14
VIN 7 G2B Y1
A6 A3 6 IC2 13
~6 G1 Y2
A5 12
AN0 ~5 Y3
A4 11
AN1 4 Y4
A3 A0 1 10
AN2 ~3 A Y5
ANALOG IN
A2 A1 2 74HC238 9
AN3 2 B Y6
A1 A2 3 7
AN4 TX 1 C Y7
AN5 RX 0 A0
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
1k1
+5V
copyright 2 4 6 8 11 13 15 17 2 4 6 8 11 13 15 17
1A0
1A1
1A2
1A3
2A0
2A1
2A2
2A3
1A0
1A1
1A2
1A3
2A0
2A1
2A2
2A3
1 1
1G 1G
IC3 IC4
16 16 20 20
19 74HC244 19 74HC244
IC1 IC5 IC3 IC4 2G 2G
1Y0
1Y1
1Y2
1Y3
2Y0
2Y1
2Y2
2Y3
1Y0
1Y1
1Y2
1Y3
2Y0
2Y1
2Y2
2Y3
8 8 10 10
18 16 14 12 9 7 5 3 18 16 14 12 9 7 5 3
A10
A11
A12
A13
A10
A11
A12
A13
A4
A6
A7
A8
A9
A5
A6
A7
A8
A9
140520 - 11
Figure 1. The schematic. The 238 decoder ICs enable each row in sequence. The LEDs in the row will be lit according to the digital pattern presented by the
224 buffers driving the columns. All of the Arduinos port pins are used.
Figure 2. Import a system font using the GLCD Font Creator tool. Figure 3. Select the font size; when the size is not available as an option,
enter it manually.
solved by using a monospace font so in the following steps we from all this is the C-Array shown in Figure5.
will be using Courier. Next make a copy of the code using Notepad and select the
unneeded length byte in the table as shown in Figure6. Copy
The microcontroller Tool chain developer Mikroelektronika pro- the length byte text into the Find field of the edit options
duce a useful program which amongst other things, can be used and use Find and Replace to delete all the occurrences of the
to import and edit fonts and convert them into source code. The length byte (Figure7). Lastly replace the data type short with
basic version of GLCD Creator is free and can be downloaded Int and the editing is finished.
from [1] we can now create a new font based on Courier. Here
you need to import a new system font, as shown in Figure2. Now copy the Courier10x13-Array in the .c-file. Our version of
Set the character height to 13. This value is not a standard the LED matrix control must control the left half and then the
size so its necessary to enter the value by hand as shown in right half of the matrix in sequence (which we didnt take care
Figure3. The next step is to confirm the import settings as of in the running LED dot routine earlier). The method used
shown in Figure4 the subsequent optimization process takes in Listing4 activates either the left or right hand 244 buffer
a little while to complete. depending on the state of Bit _hi.
Check the size of the generated character as it appears at the At this point experienced readers will probably point out we
bottom of the screen. If its not 10 x 13, select Batch -> Col- could save a controller I/O pin by using an external inverter to
umns -> Ins Column and then Batch -> Invert All. enable either the left or right hand buffer. This is correct but
Next click on Export and then the microC tab. What you gain would increase hardware complexity.
Figure 4. The GLCD Font Creator can automatically remove unnecessary pixels. Figure 5. The result: A C-array of the character representation.
Figure 6. These bytes are not required. Figure 7. With the Replace with field empty, all the Length Bytes will be
removed.
The next stage now is to render individual characters on the trick: digitalWrite allows all values greater than 0 as true.
display matrix. For testing and development we will write a We AND the value from whichToWrite for each bit with a mask,
small demo routine. In the For loop it takes characters in the produced by the left-shifted bit address.
font table with values from 32 to 127. Each character is written The right side of the LED matrix is driven similarly. The vari-
to the matrix 120 times before the next character is displayed. able offset is initially incremented. This gives us access via
This makes the character readable; otherwise it will be just a
faint blur (Listing5).
A font created with GLCD Font Creator contains characters Listing4. Switching between left and
from 32 to 127. Since the first characters are not part of the right hand halves of the display.
array the offset of a particular character can be determined void pickPartOfDisplay(bool _hi)
by subtracting 32. {
Listing3. Iron out those hardware errors. Listing5. Run through the character table.
one byte whichToWrite to control columns on the right side offset by _shoveHowMuch. When the resulting value becomes
of the matrix as shown in the schematic. invalid we increment the offset and begin the next loop.
The character is written to the same location 10 times (the
Off we go! outer loop) to make the display brighter.
To produce a running banner we need to be able to write the
character to any position on the LED matrix. Its usual when Instead of a single character the main loop loop is used to
writing control firmware to migrate pre-existing software to output a small greeting message made up of different char-
add required functionality. acters. Each character is given a specific Offset value so that
In addition to the Offset displayChar uses an integer variable they follow one another across the LED matrix. The For loop
to determine whether the shift is to the right (positive) or to produces the scrolling effect (Listing8).
the left as shown in Listing7.
Adapting to an AVR
The basic principle of the render function remains unchanged. Now we get to shoehorn the design into an Arduino Uno. The
The new version differs from the previous one in that the cal- font just squeezes into the available RAM space and thanks
culated coordinates (for the rows in the schematic) are now to the resource-optimizing structure of the program we can
int offset=widthOfChar*offsetC;
whichToWrite=Courier10x13[offset];
for(int j=0;j<10;j++)
{ activateRow(j);
char whichToWrite=Courier10x13[offset]; pickPartOfDisplay(true);
for(int i=0;i<8;i++)
activateRow(j); {
pickPartOfDisplay(false); digitalWrite(6+i,(whichToWrite&(1<<i)));
for(int i=0;i<8;i++) }
{ delayMicroseconds(20);
digitalWrite(6+i,(whichToWrite&(1<<i)));
} offset++;
delayMicroseconds(20);
}
offset++;
Figure1. Building plans and description for a glider with automatic directional control.
Early in 2014 the author won a to be slightly greater than the main wing at the rear. Now as
prize in a competition staged by Circuit Cellar [1] and the aircraft approaches the stall condition the small wing with
sponsored by the Japanese semiconductor manufacturer Rene- its higher angle of incidence, stalls before the main wing, the
sas. We agree, we thought this project was so interesting that winglet loses lift and the aircraft nose drops, preventing the
it must surely deserve an appearance in Elektor Magazine. main wing from stalling. All of this without any intervention
from the pilot or any complex control system.
The flying duck
While browsing through a bookshop the author discovered an Nothing new under the sun?
old paperback with technical details of a fascinating control What was really interesting about the antique model aircraft was
system. The booklet dating from the 1930s is entitled Compass the design of its early form of autopilot. In the age of vacuum
control for model gliders by Gustav Alding and Heinz Emmer- tubes this must have been like some sort of crazy science fiction
ich. The original German cover can be seen in Figure1. The concept. For its time the design is ingenious. Figure2 shows
publishers Otto Maier Publishing are now Ravensburger AG the principle of electromagnetic steering using a magnetic com-
and well known for making family games and jigsaw puzzles. pass to provide directional corrections. The contraption works
The author was immediately fascinated by the details of the
control system described in the paperback and recognized it
as an early attempt at autonomous flight control. The type
of model aircraft described in the book is whats known as a
canard (the French word for duck).
Aircraft usually have the main wing at the front and a smaller
tail plane at the rear, with a canard it is the other way around.
The plane looks like it is flying backwards when you see one
overhead. The model pictured here flies off in the upper right
direction. It may look a bit weird but aerodynamically the
design has one big advantage.
When a stall occurs it is usually accidental and if you are
close to the ground, usually fatal. When the main wing angle
of incidence is increased too much to sustain a smooth air-
flow over its upper surface the airflow becomes disrupted and
the aircraft suddenly loses lift (a stall). When there is a small Figure2. Course correction by magnetic compass: Magnetic pointer (red),
winglet at the front of the aircraft, its angle of incidence is set contacts (blue) and switch contact (green).
Figure3. The RMK simulator drawing tool allows you to rough out the Figure4. Simulated flight of a rudder controlled glider.
model design. The flight characteristics are in another step.
as followers: The red magnetic needle moves like a compass and cost. It is not a canard design; the wings dihedral gives
pointer to point north. There are two contacts (blue) fitted to the model stable flight characteristics. For simplicity the auto-
a rotatable disk (which sets the desired heading). When the pilot controller only provides control in one axis.
aircraft turns away from the preset heading the pointer turns
and one of the blue wafer contacts touches the green switch The electronic solution
contact. This activates an electromagnet to pull the rudder in From the above considerations, we can work out the minimum
the right direction to correct the course. requirements for the on-board electronics. To control the air-
There must be some doubts as to whether this was ever a prac- craft heading we could just use a microcontroller and a mag-
tical solution when you take into account the effects of wind, netic sensor. Modern magnetic field sensors use MEMS (Micro
vibration and the magnetic field produced by current flowing in Electro Mechanical Systems) technology; they are tiny and
the wires. The idea is however simple and in principle sound. use very little power. Many of the examples available today
With all the advantages of new technology there is no reason combine several functions such as a gyroscope, accelerometer
why we cant build a modern day equivalent without any of and a compass in the same tiny SMD outline also with a serial
the drawbacks and maybe build in a few extra capabilities. interface. Such a 9-axis sensor is only suitable for providing
information on the relative movement of the model in space.
Design revision Information on the models absolute position can only be sup-
The model described in the article had a wingspan of over two plied by a GPS receiver. The components required to build the
meters and a weight of a few kilograms but theres really no circuit together with a servo and power supply are shown in
need for our purposes to build anything on that scale. At one the block diagram in Figure5.
point the author toyed with the idea of hanging a variant of Figure6 shows the circuit diagram orientated in the same
the control mechanism from a weather balloon to steer it to a order as the blocks in Figure5. The layout is simple and uses
predetermined position. energy saving features. The circuit is powered by a 3V lithium
For such a project it is important to take into account the weight coin cell which feeds two low-drop voltage regulators (IC2 and
and size of the model and also the amount of work involved. IC10) to provide 2.5V for the Renesas R5F100AA RL78/G13
The author also considered a paper glider fitted with solar cells and 1.8V for the FASTRAX UC430 GPS module. Also on the
to power the electronics and actuator but this was abandoned board is a status LED and a header for programming (K10) as
after disappointing trials. The energy from so few solar cells
just wasnt sufficient. In the end, the author decided to design
and build his own glider from scratch.
Nowadays engineers dont start their design with the help of a GPS Telemetry
sharpened pencil, they are more likely to fire up a PC and launch UART SPI
a simulator (see Figure3). For this purpose we have used the 2P5
Gyro
I2C
CPU 1P8 Power
Reflex-XTR [2] flight simulator software. This can simulate the
Timer
flying characteristics of a model design very well [3]. Precise 3P3
measurements of the flying surfaces are not critical here, it is Compass Servo
sufficient for the representation to have similar proportions to
the model in order to produce a reasonable simulation of its
flying characteristics. After some design iterations, the author Figure5. Block diagram of the required electronic elements. GPS, CPU,
settled on a traditional hand launched glider design as the best Servo and voltage regulators are necessary. Gyro, compass and Telemetry
compromise between stability, controllability, payload capacity are optional add-ons.
C10
The GPS receiver is the most important and capable sensor to
100n 12
provide information in order to calculate the desired heading.
VDD
9
ADC0 1
P20/ANI0
VDD
P21/ANI1
30
R15
R
At switch on the GPS module searches for signals from GPS
LED1
1
2
EIT WAKEUP
30
29
GPS 2
3
P01/RXD1 P22/ANI2
29
28
satellites so that it can generate the so-called NMEA messages.
EIT2 TM P00/TXD1 P23/ANI3
3
6
ECLK DN_OFF
28
26
GPS-ON GPS-ON
TOOL
4
5
P120/ANI19 P147/ANI18
27
26
CS
CLK
First it will go into hibernation mode. After a reset sequence
TSYNC RXD P40/TOOL0 IC11 P10
7
SCL MOD5 TXD
25 GPS RESET 6
RESET P11
25 MISO
(Low-High-Low sequence on GPS_On input pin28) the module
8 24 IRQ 7 24 MOSI
SDA RTS P137/INTP0 P12
16
ANT RESET
23 8
P122/X2 P13
23 is ready for operation.
17 20 9 22
There are many different GPS messages. The RMC-Sequence
RF_IN CTS P121/X1 P14
4 31 10 21
GND GND REGC R5F100AA P15
5 27 SCL 13 20 POWER
UC430
10
GND
GND
GND
GND
22 SDA 14
P60/SCLA0
P61/SDAA0
P16
P17
19 SERVO is best suited for this application. A typical message has the
11 21 15 18 MAG
GND GND
16
P31 P51/INTP2
17 following structure:
GND
GND
GND
GND
GND
GND
P30/SCL11 P50/SDA11
12 13 14 15 18 19 VSS
C24
11
VBAT 100n
$GPRMC,095634.316,V,5109.9119,N,1108.0903,E,0.1
T1
9,33.26,060112,,,A*;
R1
POWER
10k
K5
1
PNP
SERVO
RESET
R4
10k
2P5
The individual elements are:
2 C8 C26 C25
$GPRMC = Start
3 C36
4
330u
K2
1 TOOL
10n 100n 100n
V = valid
2
3
RESET
VBAT 5109.9119 = Latitude
1
VIN
IC2
VOUT
5
1P8 N = North
VBAT R2
R
ADC0 3
LP2985AIM5-1.8
ON/OFF R 4
1108.0903 = Longitude
R3
C12 GND E = East
C9 2 C17 C4
R
1n 33.26 = Heading
1u 100n 1u
K1
1 A* = String terminator
2
2P5
2P5
IC10
K10
1
2P5 1
VIN VOUT
5
For navigation we need three values: the geographical Longi-
K9 LP2985AIM5-2.5
2 IRQ 1 BT1 3
ON/OFF R 4 tude and latitude and the heading (direction). Using this infor-
3 MOSI 2
4 MISO 3 SCL
C37
GND
2 C38 C39
mation and comparing it to the desired course, we can find the
5 CLK 4 SDA
6 CS 5 MAG
CR2025 10u 100n 1u
required heading. The calculation sounds straightforward but
7 6
is not quite so simple: GPS data is based on the Great Circle
140071 - 11
or Orthodrome geographical model for course calculation. The
destination is pre-assigned and the current position is given
Figure6. The navigation computer circuit. Linear regulators take care of
by the GPS receiver. In Figure7 pointA is the aircraft and
the two supply voltage levels. Headers are available where an optional
compass and telemetry can be connected. point B its destination. The angle a is all we need to control
the rudder position. The necessary calculations are:
Figure7. The Orthodrome path (c) is the shortest distance between points Figure8. Course calculations based the orthodrome. The red cross is the
A und B on the surface of a sphere (Figure: Kassel University). start point and the blue cross the end point.
Figure9. The electronics and servo mounted at the front of the model. Figure10. The complete GPS-steered model.
The servo horn links to the rudder with thin cables. The spring helps
compensate for mechanical tolerances.
Formula1 gives the required heading and Formula2 the dis- that go to make up this autonomous glider design. If you are
tance. As an example, the glider is launched from a low hill by interested in the PCB layout and software for the project you
hand and steered to a fixed destination point. The start point can download the details for free from the relevant Elektor
coordinates are: 51610N; 111115E. Destination point web page for this project [5]. Figures9 and 10 give a good
coordinates are: 51545N; 11930E. Figure8 shows the impression of the finished construction. The purpose of this
corresponding positions on a map. The image was generated article is to build a development platform on which you can
using data from the Openstreetmap project. The free Maper- carry out your own experiments. To experiment with autono-
itive [4] tool was also useful. The Listing shows the calcula- mous control you need knowledge of both electronics and model
tions coded in C. building. You can also fit the control electronics into an off-the-
shelf model glider kit that will already be kitted out with servos
Prototype and batteries and will usually require little modification.
We dont have enough space available to detail all the parts (140071)
Course calculations in C
Start position: Latitude
51610
= 0.89199 Rad Latitude A (sin(A.Lat)*sin(B.Lat)) /* A and B */
Longitude 111115 = 0.19525 Rad Longitude A +(cos(A.Lat)*cos(B.Lat)*cos(B.Lon-A.Lon))
Landing area: Latitude
51545
= 0.89176 Rad Latitude B );
Longitude 11930
= 0.19466 Rad LongitudeB = 0.00038851 /* radian */
-> 2.474 km (0.00038851 * 6370 km) /* convert to km */
/* code snippet */ --------
typedef struct stPos{
float Lat; /* Latitude */ fAlpha = acos( /* course angle */
float Lon; /* Longitude */ (sin(B.Lat) - (sin(A.Lat)*cos(L)))
}stPos; /(cos(A.Lat) * sin(L))
);
stPos stKoordA = {0.89199, 0.19525}; /* coordinates from */ = 1.88856
/* radian */
stPos stKoordB = {0.89176, 0.19466}; /* figure 8 (Rad) */ = 251.79 (360 -(1.88856 * 360 / 2 / 3.1415)) /* convert
to degree */
fDist = acos( /* distance between */ --------
Yet Another
Button Cell Charger
Now feat. Clothes Peg & ATMega328P
By Bas Schmidt (Netherlands)
Even if you can insert a different type kept an eye on the milli-amps display and Tell us your requirements
of button cell at all in these chargers, my wristwatch to monitor the charging First thing required is a universal but-
they either undercharge or overcharge time. Because the cell voltage rises during ton cell clip or holder. The contraption
the button cell. I must have about five charging, potentiometer adjustment is should allow cells with a nominal voltage
types of rechargeable button cells in constantly called for. That, exactly, is between 1.2 to 3.6 volts to be charged,
use and I dont want to buy five sepa- the thing I want to see automated, so also accommodating a maximum cell
rate chargers. I am aware of one type I can do something else, like designing capacity of 180mAh. Second: charge cur-
of charger which is said to handle both new electronic projects. rent adjustable from 1 to 180mA. Third:
3.0V and 3.6V cells (you have to set a charge time adjustable in hours and min-
switch on the thing), but reviews on the Like me, you may be perfectly aware how utes from 00:00 to 14:00. Fourth: ability
Internet show that a whopping 3 out of to correctly charge rechargeable batter- to set maximum cell voltage, after which
4 customers return it as not functioning ies, but not in a truly user friendly way. constant-voltage charging is applied.
(properly). While the current charger can be safely Fifth: cell temperature monitoring and
classified as user unfriendly L, at least it protection from 20 to 50 degrees Celsius.
In response I made a universal charger, does allow you to set various parameters, Sixth: no-frills 12VDC input power (per-
albeit of the manually operated type. It and subsequently the charging gets exe- mitting e-z connexion of my mini-bat-
was based on an LM317 with a multi- cuted accordingly. Meaning: any errors tery, which is charged by a small solar
turn potentiometer as a current limiter. in this respect are yours to regret any panel). Seventh: it will be very hard to
It worked fine as long as I constantly successes, yours to enjoy. realize all this without a microcontroller.
That controller should be an ATMEGA328P,
the heart of the Arduino UNO. Eighth: if
possible the project to be built on a piece
of stripboard (Veroboard), avoiding high
costs for a dedicated PCB.
of this really universal cell holder. The Talk electronics ration originates from the LTC1451 DAC
temperature sensor is a mini-TO92-cased Looking at the schematic in Figure3, the datasheet, and is here taken to a 200-
PTC I found in my junkbox. Other small heart of the charger is a kind of current mA drive level.
PTCs may also do the job, provided R9 is driver. The ATMEGA328P micro on the The rest of the circuit is straightforward.
adapted to suit. I drilled two small holes I-Board [1] is programmed to employ To measure the voltage on the positive
in the clothes peg for its terminal wires, Arduino I/O9 as a pulsewidth modulation and negative side of the cell, R5/R6 and
covered them with heatshrink sleeving (PWM) output for the setpoint to opamp R7/R8 divide these voltages to bring them
and fixed all wires with two thick layers of IC1, an LT1077. R11 and C11 turn the in the microcontrollers ADC range.
universal glue. All four wires are passed pulses into a 05V control voltage. The A 7805, three LED, a 16x2 LC display and
through the metal clamp as opamps IN pin is connected to a 25- a rotary encoder complete the circuit.
a kind of strain relief. resistance composed of R1R4, which Using an I-Board I was able to effec-
on passing 200mA tively plug the ATMEGA328P onto the
flags 5V to stripboard, see Figure4.
the opamp. The power supply may be anything sup-
The opamp plying 12VDC or so. Like a small solar
output panel in my window (Figure5), the type
drives a sold to keep the battery alive when your
2N3439 tran- vehicle is parked for a long time. Here it
sistor (T1) fitted with slowly charges 10 rechargeable AA batter-
a small cooling fin or ring. The configu- ies thats my 1.8-Ah mini-battery. Any
VR1
F1 7805 +5V
D1
500mA R9
C1 C2
2k2
1N4004
0u33 100n
BATT1 +
PTC1
12V DC
1.2 - 3.6V
2k @ 25C
IC31
T1
8
VOS TRIM 7 R5 R7
V+
IC1 LC DISPLAY 16 x 2
6
330k
330k
OUT
LT1077 V
4
1
VOS TRIM
VDD
VSS
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
R/W
VO
RS
IN +IN
2N3439
A
C
E
2 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+5V
R31
R1 R2 R3 R4 R11 R6 R8
C11 39R
100R
100R
100R
100R
18k
T31
180k
180k
2u2
0W6 0W6 0W6 0W6 C3
P3
+5V 100n 10k
BC547
I-BOARD
R23 13
270R 8
7
6
5
4
3
2
1
0
D E A5
A4
A B A3
A2
C
A1
A0
ward Arduino Sketch. The source listing and for keeping the charge time up to
is commented for easy reading. Its avail- date. The variables to go with this are
able for free downloading [2]. Do open it declared right before the ISR.
to follow the discussion. The listing starts Next come two declaration blocks to hold
with include-ing the LCD driver, followed the variables of the settings and the var-
by the definitions of all I/O pins except ious measurements in engineering units
A4 and A5. Immediately followed by the we understand. Then some functions are
definitions to convert the various ana- declared to help to transfer integer and
log and PWM signals from/to engineering floating point values to the LCD screen
units (volts, milliampres, degreesC, ). in an easy way.
These values have to be tweaked once Then the two basic functions of an Arduino
when commissioning the charger. Values sketch follow; setup() and loop(). setup
may be slightly different for each charger is unexciting; set Timer0 to CTC mode
built depending on tolerances in resistor and value of 250, declare various pins
values, etc. as input, output or PWM (9), set some
After that you see an interrupt ser- default values.
Figure 4. The brains of the project is the vice routine connected with Timer0. In Loop() consists of three major parts; first
ATMega328-based I-Board with its SIL pinheader setup() the Timer0 is configured to gen- the rotary encoder inputs are checked
for plugging onto another board in this case, a erate an interrupt every millisecond. From and from these one-shots are calculated.
piece of stripboard thats home to the remaining this a 500-ms pulse is generated which A oneshot variable (os_ ) is High for
components. acts as blinking signal for the green LED one cycle of the loop if a certain condi-
Only sophisticated chargers recognize when the cell voltage exceeds a certain
level and then start applying a constant voltage, as well as watch how the charge
current diminishes. When that current reaches some lower limit, the cell is truly
fully charged and the charging is finished. Our Arduino program does something
like that, but not exactly. Because its pwm output drives current and not voltage,
supplying a constant voltage is not possible. What happens instead is that in mode
22, when the cell voltage is measured, the number of minutes is counted that
the cell voltage exceeds the target voltage set in the SET mode. If that number
of minutes equals, or is greater than, the number of minutes set in the #define
minutes_high_volt (3 in my version), the charger changes to mode 23. In that
mode, the current gets lowered 1mA per second as long as the voltage between
the + and side of the cell is higher than the high voltage level. If the voltage
drops below the set high voltage, the countdown stops until the cell voltage rises
Figure 5. Slow and indirect as it may be in
above the set level again. This goes on until the current is lower than 0.05C (or
terms of energy transfer, a solar panel and some
5/100th part of the originally set current) or lower than 1mA just to make sure
Dutch sunshine make a fine (and indirect) power
source for the charger. that the charging finishes. Ah.. C is the cells nominally rated capacity.
S1
S2 A
K1B M1
SCL
SCL
K4
SDA
SDA M
GND GND GND
DGND
M
12V
max. 2A
0..5V DC 0..10V DC
12V
D
K3
140562 - 12
Figure 1. Simplified block diagram of the motor control device with all actuation options.
the motor driver linked to +5 Table 1. Jumper settings The D-to-A converter is permanently
V via resistors R11 and enabled when the circuit is powered up.
Mode JP1 JP2
R12. The H-bridge Its current consumption is admittedly only
I2C I2C closed
then switches 150A but you can reduce this further to
into Brake 0/5V Ext. closed as low as 200 nA using three power-down
mode. In 0/10V Ext. open modes. Using a serial data command you
Brake man. Ext. closed can select the defined output resistance
mode of the switched-off voltage outputs to
the out- either 1k, 100k or tri-state (high
put of the indicator LED1. impedance). With safety-critical appli-
H-bridge for the The two electrolytics cations, in which no actuation voltage
DC motor is 0V and C9 and C10 are well able for the PWM modulation is permissible
the motor doesnt move. to cope with the high currents at the input of the SG3524, the variant
of the switched H-bridge driver. with 1 k output resistance to GND is
With EN=0 the analog switch The components on the ILIM input recommended. If you wish to use soft-
corresponding to the settings on are part of the standard wiring for the ware-based configuration, the PD jumper
the F/R input determining forward or current-limiting amplifier located in the JP7 must be plugged in the 0 position;
reverse direction and the rotational speed SG3524D. otherwise set the jumper in position1.
of the motor is conveyed using the analog The output voltage of the DAC is prac-
voltage. If the EN input at K1A is open, The I2C interface tically the same as the supply voltage.
pull-up resistor R10 prevents any unin- Pull-up resistors R13 and R14 are con- With a reference voltage from the PWM
tended start of the motor. If you wish to nected to the two I 2C wires SDA and modulator of 4.934V the maximum out-
start up the motor gently, this must be SCL, which are activated using jumpers put voltage of the AD5301 amounts to
handled upstream in the system. Resis- JP3 and JP4. Of course these are neces- 4.898V, only 36mV less. The minimum
tors R9 and R10 (and the connections sary only when no pull-up resistors of voltage we measured was 9.28mV on
to the unused elements of the analog this kind are provided on the I2C Bus of one of the first prototypes.
switches) prevent open (floating) con- the actuating system. The address of the
nections occurring when nothing at all D-to-A converter can be selected between Construction and commissioning
is connected to K1A. 0001100 and 0001111 with the help of In order to keep the size of the PCB
At lower left you can see a number of the two jumpers JP5 and JP6. In this way (available from the Elektor Store [4])
decoupling capacitors for the (stabilized) four DC motors can be controlled inde- compact, we specified mainly SMD com-
12 V supply voltage, along with power pendently with one I2C Bus. ponents (thats just an excuse really;
JP4
+5V
+5V
R13 R14 R10 R11 R12
JP3
K1A
10k
10k
10k
10k
10k
+5V
EN
F/R
K1B R3
SCL
JP2 +12V
11k
SDA 0..5V R9
DGND +12V
10k
R4 C6
R1 R2
K2 +5V Control 2k7 8k2
11k
100n
+5V JP1 +5V
0..5V / 0..10V 15
IC4 21 22 23
AGND Ext. I2C 2 VCC 16 IC2 11 10 9 6
IN+ REF OUT VCC VCC VCC
Ext. R5 1 12 A B C EN
+5V IN- COLL A 3 17 1
9 13 4 VREF OUT1
COMP
IC1 COLL B 5 K4
5k6
4k7
5 5 16
PD I LIM- 6 7 8
PD GND 100n GND MC74HC4053
ADTG BD6222
1 0 8 8
JP7 AD5301
+12V +5V
R15
12V 2k2
K3 P1 R7
C8 C9 C10 LED1 C1 C2 C3 D1 D2 C5 C4
330R
2x 1N4148 140562 - 11
7. Platino v1.4
www.elektor.com/six-digit-nixie-clock www.elektor.com/platino-v1-4
This book covers a series of exciting and fun projects for the If you want to add a simple oscilloscope, basic signal If you want to add a simple oscilloscope, basic signal
Arduino, such as a silent alarm, people sensor, light sensor, generation and spectrum analysis to your workbench, this generation and spectrum analysis to your workbench, this
motor control, internet and wireless control (using a radio inexpensive Network Connected Signal Analyzer (NCSA) inexpensive Network Connected Signal Analyzer (NCSA)
link). Contrary to many free projects on the internet all is a perfect fit. NCSA allows you to digitize signals using is a perfect fit. NCSA allows you to digitize signals using
projects in this book have been extensively tested and are variable sampling rates up to 1 MHz. The digitized signals variable sampling rates up to 1 MHz. The digitized signals
guaranteed to work! are displayed in an oscilloscope like format. The user can also are displayed in an oscilloscope like format. The user can also
employ the applications Spectrum Analyzer to generate a employ the applications Spectrum Analyzer to generate a
frequency-domain power spectrum. frequency-domain power spectrum.
member price: 24.95 31.46 US $35.00 member price: 28.95 35.96 US $40.00 member price: 53.95 67.46 US $74.00
eRIC Nitro is a small (2.5 x 5.5 cm or 1 x 2 inch) Arduino Thanks to the rapid development in 3D printing tools and If you are an advanced robotics user, or a beginner looking
compatible module with an on-board low-power ISM-band services, anyone can now make things without being a to develop your robotics knowledge and understand, the
radio module. The radio module can work stand-alone, it can member of a large organization, or without specialized Formula AllCode is perfect for you. Formula AllCode is a
be controlled by the MCU loaded with an Arduino-compatible facilities. This book provides you with basic knowledge and complete course in robotics with an impressive specification
bootloader or it can be controlled by a PC. Two pin-compatible information about 3D printing technologies so that you can get set. The robot itself is Bluetooth enabled and can become a
radio modules are available: eRIC4 for 433 MHz and eRIC9 started.You will learn about the latest trends in 3D printing slave for platforms including Android and Apple devices and
for 869/916 MHz. and gain a background to product creation. the Raspberry Pi.
member price: 21.95 26.96 US $30.00 member price: 28.95 40.46 US $45.00 member price: 176.95 224.10 US $245.00
By Frans Andries
I had to wait a little while until the VFD Shield for Arduino kit was
delivered, but it was definitely worth the wait! I truly enjoyed
myself over the holidays while I was soldering up this kit. And it was
a challenge as well: there are surprisingly many components in a
tight space. I realized I made a mistake by accidentally swapping
two transistors because the
rightmost VFD wasnt
functioning as it should. After some measuring I could
easily locate and fix the problem and the VFD
Shield has been working properly ever since! If
only I would have followed the guidelines I
currently plan to load the clock software and
probably adjust it a bit so that it can run an
I2C RTC clock, and to fit the shield inside a
DIY retro case. Summing up: the VFD is a
beautiful and very high quality kit!
The All-new Pro Tech Toolkit kit contains all the poking, prying, gripping, lifting, ESD safety, ARM
and screw driving tools needed to service consumer electronics. Microcontroller
Kit Contents Projects
Anti-Static Wrist Strap - protection for circuits against static electricity
Limited time offer
Small Suction Cup - suction cup for holding onto things lacking handles for GREEN and GOLD
3x iFixit Opening Tool - soft plastic prying tools members:
6x iFixit Opening Picks - thin prying tool for opening 15% Discount
electronic devices plus free shipping!
Nylon Tipped Reverse Tweezers - to elevate and hold your
work
Angled ESD Tweezers - ESD-safe, feature teeth for tougher
grip All-new Pro
Blunt ESD Tweezers - ESD-safe, feature teeth for tougher grip
Tech Toolkit
2x Plastic Spudger - tough antistatic tool for a variety of
purposes High Performance
Metal Spudger - for more powerful prying, scraping, probing, Toolkit for All Things
and poking action Repair!
Jimmy - handy tool for Jimmying open
electronics
Magnetic Pad - Holds tiny screws and parts
during repairs
64 Bit Driver Kit - all the bits needed for
repairs on small electronics Elektor Store
Tool Roll - Durable and compact
An Aladdins Cave of
books, kits, gizmos
MEMBER PRICE: 45.95 58.46 US $64.00 and more. Fill your
shopping cart today!
www.elektor.com/all-new-pro-tech-toolkit
In 35 fun projects, this book will show you how to build your This book is all about building your own DIY home control The original smartphone multimeter and data logger is here!
own Internet of Things system. Well cover the hardware system. It presents two innovative ways to assemble such a The Mooshimeter is a multi-channel circuit testing meter that
and the software that makes control via Internet possible. system: By recycling old PC hardware - possibly extending the uses your smartphone or tablet, through Bluetooth 4.0, as
We employ Wi-Fi and radio links so no requirement any life of an old PC, or by using Raspberry Pi. In both cases, the a wireless, high-resolution graphical display. Safely measure
longer to install cabling crisscross through your home. In this main system outlined in this book will consist of a computer 600V and 10A with 24bit resolution from up to 150 feet away
unique book, Raspberry Pi, Arduino and HTML webpages with platform, a wireless mains outlet, a controller and a USB while logging results for up to 6 months.
stylesheets and JavaScript come together in clearly-described, webcam - All linked together by Linux.
easy-to-build projects.
member price: 28.95 35.96 US $40.00 member price: 30.95 38.66 US $43.00 member price: 95.95 121.46 US $133.00
On the following pages you can again read about other interesting pieces of information that we would
like to share with you: about the Fairphone, corrections, updates and feedback, lab highlights, a 1000-
watt audio amp from 1986, and of course we conclude with the now world famous Hexadoku puzzle.
(150782)
Web Links
[1] www.element14.com/community/community/news/blog/2012/04/30/why-do-they-even-make-tantalum-capacitors
[2] www.kemet.com/Lists/TechnicalArticles/Attachments/93/2008-11%20Update%20-%20Ceramic%20versus%20Tantalum.pdf
Dot Labs...
Diversity superabounds
Diversity comes to mind when browsing
the projects at Elektor.Labs. Here is an
eclectic selection of projects that keep their
initiators busy over weekends.
Err-lectronics
Corrections, Updates and Feedback to published articles
Platino Solder
Station
Elektor 4/2015 (July &
August), p. 98 (140107)
FEEDBACK. My solder
station is now around
six months old and I am
very pleased with it. For
all those planning to build
it for themselves I just
have a word of warning
and a couple of improve-
ment suggestions.
My first improvement suggestion is the addition of an earthing point to provide electrical continuity between the outer sur-
face of the soldering pen and the work surface and component to be soldered via a wire or cable with a crocodile clip. Some
extension cables and mains installations may not have a protective earth connection and there can be sufficient leakage
current to destroy a sensitive component. Some time ago a faulty earth connection cost me an expensive microcontroller
although that occurred with one of my previous solder stations.
timer has run out. The speaker size and loudness is a matter of personal taste and you can experiment as necessary. When
the bit gets to the right temperature the speaker emits a quiet twitter, during heating the sound is louder.
Many thanks for your useful feedback and advice! The latching force with some sockets is generally quiet weak. Another
suggestion is to fully insert the plug (with the power off) and then secure the connection with a length of self adhesive heat
shrink.
Thanks again for your suggested improvements. The acoustic alert idea reminded me of the old Weller WTCP solder station.
The temperature is controlled via the magnastat principle which uses a ferromagnetic plate near the soldering tip. As the
bit gets hotter the magnetic field weakens until it releases a switch to turn off the element, the tip cools and the magnetic
field gets stronger and switches on. The regular clicks are also responsible for unhealthy bursts of wideband RF interference.
DIN 6169
Let There be LED! TEST COLO
RS
Elektor 1/2016 (January & February), p. 16 (150183)
#1
FEEDBACK. In the article about LED lighting Ra is
#2 #9
given as the color rendering index of a light source.
According to my unofficial interpretation Ra stands for #3 # 10
Rarely useful. The main purpose of this figure (since
#4 # 11
the DIN 6169 color chart used to assess this rating has just
a limited range of desaturated color samples) seems to be to # 12
#5
allow poor, low quality light sources to be labeled with impres-
sively high ratings. Two suggestions: #6 # 13
# 14
#7
1. When the printer technology allows, you can print out the
color chart, commented correspondingly, and take it with #8
you when you go shopping.
2. My favorite hack on this theme involves an empty ice cream carton and an old
CD; with these you can build a simple junk box spectroscope. I wouldnt call it a precision instrument
but it gives a good impression of the spectral content of a light source and allows you to identify, for example a mercury
vapor lamp from an LED lamp at a distance (take it with you to the hardware store). My advice would be if the lamp
manufacturer quotes the Ra value instead of CRI (or CQS) just leave them on the shelf.
(150773)
Jrgen Friker
Elektor High-Power
AF Amplifier (1986)
One kilowatt from 30years ago
By Dr Thomas Scherer (Germany)
Characteristics
2x 250W (8), 2x 500W (4) or 1x 1000W (8)
Bandwidth: 8Hz to 100kHz
Distortion: 0.1% (1kW); 0.01% (600W)
Damping factor: >100
Switch-on delay, fan control, voltage monitor
Input level: 0.775VRMS for full output drive
Weight: you dont want to know!
Ah, those were the days! Components had legs, circuit boards
had holes, and a bit of solder left over from your last plumb-
ing project was all you needed to put together your own audio
amplifier. And you could save a good deal of money by doing-
it-yourself, as well as having a lot of fun and ending up with
something unique. Power amplifier projects had become some-
thing of an Elektor tradition, beginning in the very first issue
(in Germany, May 1970, In the UK, December 1974, Ed.) with
the Edwin, a fantastically simple 20-watt design for home
construction. Years later I recreated it.
Shortly after that came a version with the awesome (for the
time) output power of 54watts! Power amp followed power
amp, all based on different ideas and with different charac- Killerwatts
teristics and output power figures. I built them one after the In 1986 I decided, with a heavy heart, to leave
other and so it was not exactly by chance that in 1980 I took Elektor and go to University to continue my education. It was
a job at the place where these designs had originated: Elektor. a hard decision to make: at Elektor Id not just been at the
It was an exciting time: the first Elektor homebrew computer, cutting edge of technical developments, but also I was sur-
running BASIC and based on the National Semiconductor SC/ rounded by colleagues and a creative aura without equal. And
MP (read [1] and Google it!) had just been ousted by the Junior so I decided to present Elektor and its many readers with a
Computer, which used the MOS Technology 6502; telephones rather special parting gift: at home, unbeknownst to my col-
came only in beige and had strange rotary dials where the leagues, I had been working away on an audio amplifier that
buttons should be; and a typical amplifier of the time had an could deliver high-quality sound to its loudspeakers at the
output power of 40W to 200W. Things were about to change... then-unimaginable power of 1000watts.
I designed the analog circuitry using the power of mental arith- I went through all the calculations again, and then launched it
metic alone (well, maybe Ill admit to a bit of help from a Sharp as an Elektor project with the working title Gigant (English:
programmable calculator): no simulator, no PC-based design Giant), which was how it became known in the German edi-
tools. With the design finished and the circuit diagram drawn tion of Elektor; in the English edition it went under the more
up using ruler, pencil and paper, I submitted my efforts to the demure title of High Power AF Amplifier. The process went
Elektor evaluation process and waited with anticipation for the like this. First the drawing office took my attempt at a circuit
judgment of my colleagues at the next editorial meeting. Of diagram and made it look beautiful, as you can see in Fig-
course I wasnt the only audiophile on the Elektor team, and ure1. Meanwhile the components were procured and a board
I was ready for anything from the best-case scenario (nods of was laid out, by hand using Seno ruboff symbols. The board
approval) to the worst (subtle tapping of fingers on foreheads was assembled and I finally got to see the physical manifes-
and comments like thats supposed to work, is it?). You can tation of my work. I whisked it off the audio lab, hoping that
relax: the design was approved! I had not made too many mistakes and that the magic smoke
After wading through the many written comments on the circuit would stay put.
Figure1. The schematic: a fully symmetrical output stage consisting of twoICs, 20transistors, 10diodes, 17capacitors, 56resistors and 1 (one) trimpot.
Each of the eight power MOSFETs dissipates about 40watts at full load.
The next step was to test the unit for a long period at high
power. A heat haze soon formed above the load resistors and
even the amplifiers massive heatsink quickly became warm,
a but you could still touch it after it had been running for five
minutes. Everything seemed to be stable. As you might imag-
ine, I was rather relieved! All I had to do now was test the
performance of the unit for distortion and make some other
measurements of its characteristics: see the text box. Then
I busied myself with building a prototype with its own trans-
former power supply, tested the protection circuitry, and wrote
the accompanying two-part article that you can download for
free, compliments of Retronics, from[2] or retrieve it from
your Elektor 1980s DVD [3].
D-I-S-C-O
I was very proud when the May 1986 issue finally appeared
in the newsagents. The handsome retro-style magazine cover
(head photo) had my design as the lead article, a fact which
impressed my fellow students no end!
The original article goes into lots of detail about the building
the unit, including not only the power supply and protection
circuitry, but also the mechanical construction. Figures2a
and 2b show sketches illustrating possible layouts with pas-
sive cooling and with active cooling. A few notes on protection:
it was essential to delay switching on the loudspeaker (the
turn-on click of a 1-kW power output stage is not something
b you want to hear twice) and have a soft start for the mains
transformer. This is because when a 1500-VA load is connected
its always possible to hit the wrong point in the mains wave-
Figure2. Possible construction with passive cooling(2a) and with form: the transformer core will saturate and the mains fuse
active cooling using a fan(2b). will go bang. Even just the inrush current required to charge
I still wonder from time to time who exactly would want to build
a
such a huge power amplifier and why. One answer came from
a friend of my younger brother called Bernd Engist, who was
about to become an electronics engineer. Of course he had
been an avid Elektor reader since his adolescence and had fitted
out a nearby disco with two of my amplifiers. He told me tales
of hours of continuous overload, of wrong connections and of
destroyed output transistors, and, whats more, that he had
also seen my amplifier being used in other discos. Any readers
who feel the need to be reminded of the music from the era
of shoulder pads and bad haircuts should boogie over to[5].
Reunion
Id almost forgotten this whole story when four years ago I
found myself standing in Gnters workshop at the Segway Clon-
ers Club meeting. He had been itching to show me his amplifier
for a few days, and now there we were. I was impressed that it
still had the original 80s patina: Figures3a and 3b show the
front panel and the internal construction. I could only imagine
how many thousands of people had strutted their funky stuff b
to songs played LOUD through that amplifier.
Gnter is an expert in radio and television engineering and has Figure3. Front view(3a) of Gnter Gerolds amplifier with its original
80s patina. His mobile disco rejoiced in the name of Lets Fetz! From
his own workshop where he designs electronics for industrial
above(3b) you can see the effect of pumping thousands of cigarettes
applications. Back in 1986 his younger self had been capti-
worth of fumes through the unit.
vated by the amplifier design. Full of enthusiasm he etched
his own boards and built a passively-cooled 2x500watts ver-
sion of the amplifier (the two channels could of course also
be bridged). Together with friends he then organized several
discos for parties in local halls and festivals in the countryside,
taking along his own lighting, mirror balls, strobes and other
Retronics is a monthly section
paraphernalia. This all helped to bolster his meager salary as a
covering vintage electronics including
trainee. Despite the rough conditions and being dragged from
legendary Elektor designs.
show to show, Gnter says his unit held up well. Its always www.elektor.tv
Contributions, suggestions and
nice to have a satisfied customer...
requests are welcome; please telegraph editor@elektor.com
(150738)
PEOPLE NEWS Ren Bohne from RWTH Aachen University (Germany) will be advising Elektor on setting
Engineering Gazi Akdag will be working from Istanbul to attract even more members in Turkey Yoshihiro
Pitaya a household name using Elektors new Japanese edition Numerous responses in Julia Grotenraths
selected clients at Embedded World 2016 went down really well. ... ... ...
The Hexadoku puzzle employs numbers in the hexadecimal thicker black lines). A number of clues are given in the puzzle
range 0 through F. In the diagram composed of 1616 boxes, and these determine the start situation.
enter numbers such that all hexadecimal numbers 0 through
F (thats 0-9 and A-F) occur once only in each row, once in Correct entries received enter a prize draw. All you need to do
each column and in each of the 44 boxes (marked by the is send us the numbers in the gray boxes.
Participate!
Ultimately June1, 2015, supply your name, street address
and the solution (the numbers in the gray boxes) by email to:
hexadoku@elektor.com
Prize winners
The solution of Hexadoku installment 2/2016 (March & April) is: 2F01C.
The 50 / 40 / $70 book vouchers have been awarded to: Martin de Goes (Netherlands),
Hans Berglund (Norway) and Futuh Coklu (Turkey).
Congratulations everyone!
4 3 5 B 1 2 7 A F 6 8 C 0 E 9 D
F 9 E 6 C 0 B 8 1 3 D 7 2 4 5 A
0 1 2 8 4 D 3 6 9 A E 5 F B 7 C
A C 7 D F E 5 9 B 0 2 4 6 1 3 8
5 6 A E B 4 C D 8 7 F 0 3 9 1 2
B 4 D 0 E 3 F 2 A 9 1 6 C 5 8 7
8 F C 2 9 1 A 7 D B 5 3 4 6 E 0
9 7 1 3 8 5 6 0 C 2 4 E A D F B
6 0 3 A 7 F D 1 E C 9 B 8 2 4 5
7 5 4 9 0 6 E C 2 F 3 8 D A B 1
C D B F 2 8 9 5 6 4 A 1 7 3 0 E
E 2 8 1 A B 4 3 7 5 0 D 9 C 6 F
D E 6 5 3 7 2 F 0 1 C 9 B 8 A 4
1 8 F C 5 9 0 4 3 D B A E 7 2 6
2 A 9 4 6 C 8 B 5 E 7 F 1 0 D 3
3 B 0 7 D A 1 E 4 8 6 2 5 F C 9
The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.
.co.uk
By ordering youre
More than 45 years
of experience
supporting Paul
thank you!
24-hour shipping Find out more:
Payment Methods:
33,14
Continuity test
Switch-on LED
work light
Protection type: IP65
Professional digital multimeter
26,
UT 18D
with Bluetooth
50 Display: EBTN, 60,000 counts
Accuracy: 0.01 % EN EN
61010-1
True RMS measurement 61010-1
Varied frequency (VFD), loop, LoZ (ACV) CAT III CAT IV
600 V
1000 V
Diode test, continuity test
USB data logger Duty cycle, data-hold, MAX/MIN
measurement, REL measurement
for temperature, humidity and UT 171B
151,91
Data memory for 9,999 values
barometric pressure Non-contact voltage test
Connectivity alarm
47,32
Software with data Horizontal time base:
analysis functions 10 ns/div 50 s/div
included Trigger types: flank, pulse width,
alternating
Interfaces:
subscribe now! USB OTG,
Newsletter
Pass / Fail
UTD 2025 CL
151,91
Receive weekly fresh information about
product innovations
Price reductions
specials
Fax: +44 (0)20 3808 9524 Phone: +44 (0)20 3808 9525 Onlineshop languages: