Beruflich Dokumente
Kultur Dokumente
90
electronics worldwide
...led bicycle light...bascom avr course...dcc controller...ultrasonic detector
e-CAD Software
free download
R39
ULTRA LOW DISTORTION BRIDGE MODE
AMPLIFIER MODULE ADAPTOR
KC-5470 £26.25 plus postage KC-5469 £7.75 plus postage & packing LOW COST DIGITAL
& packing
This ultra low distortion amplifier
IDEAL FOR STEREO AMPLIFIERS.
Lets you run a stereo amplifier in
MULTIMETER
module uses the new 'Bridged Mode' to QM-1500 £2.25 plus
ThermalTrak power effectively double postage & packing
transistors and is largely the power available This full featured Digital
based on the high- to drive a single Multimeter is perfect for the
performance speaker. There are no home handyman or young
Class-A amplifier. This mods required on the experimenter and will give
improved circuit has no need amplifier and the signal processing is done by the kit years of reliable service. It
for a quiescent current adjustment before the signals are fed to the stereo amp. Ideal for say, features a huge 10A DC
or a Vbe multiplier transistor and has an using a stereo amp as an occasional PA amp for social current range as well as
exceptionally low distortion figure. Kit supplied with PCB functions or using an old amplifier to drive a sub-woofer in diode and transistor testing
and all electronic components. Heatsink and power supply a home theatre. functions. Also measures AC
not included. • Kit supplied with silk screened PCB and all specified & DC volts and resistance. At
• Output Power: 135WRMS into 8 ohms components. this price you should buy two!
and 200WRMS into 4 ohms • Requires balanced (+/-) power supply.
• Freq Resp. at 1W: 4Hz to 50kHz
• Harmonic Distortion: <.008% from 20Hz to 20kHz
PIC LOGIC
PROBE KIT STAINLESS
LED WATER LEVEL KC-5457 £4.50 plus postage & packing
STEEL TOOLS
INDICATOR MKII KIT 5” Stainless Steel Long Nose Pliers
KC-5449 £10.25 plus TH-1888 £4.95 plus
postage & packing postage & pkg
This simple circuit Most logic probes are designed to operate on 5V rails. Made from polished
illuminates a string of This design operates on a wide voltage range down to stainless steel, have a leaf spring and have
LEDs to quickly 2.8V so it's suitable for use on the most modern circuits. serrated jaws..
indicate the water It's also extremely compact with SMT devices on a PCB Stainless Steel Side Cutters - 115mm
level in a rainwater only 5mm wide, so it will fit inside a very slim case. It's TH-1890 £3.50 + postage & pkg
tank. The more LEDs capable of picking up a pulse only 50mS long and will High quality small side cutters
that illuminate, the higher the also detect and hold infrequent pulses when in latch that have thick (2mm)
water level is inside the tank. The input mode. Kit includes PCB and all specified electronic blades and soft comfort
signal is provided by ten sensors located in the water tank components including pre-programmed PIC. You'll need to plastic spring loaded handles.
and connected to the indicator unit via-light duty figure-8 add your own case and probe - a clear ballpoint pen case
cable. Kit supplied with PCB with overlay, machined case and needle, works well.
with screen printed lid and all electronic components.
• Requires 12-18V AC or DC 500mA plugpack. RESISTANCE
IR REMOTE WHEEL
EXTENDER MKII KIT RR-0700 £5.75 plus
THEREMIN KC-5432 £7.25 plus postage & packing
postage & packing
SYNTHESISER KIT Operate your DVD
Great for experiments or
selecting the best
KC-5295 £17.50 plus postage & packing player or digital resistance for a circuit.
The Theremin is a strange musical instrument that was decoder using Choose from 36 x
invented early last century but is still used today. The its remote 0.25W 5% resistors
Beach Boys' classic hit "Good Vibrations" featured a control from ranging from 5 ohms to
Theremin. By moving your hand between the antenna and another room. 1M ohms. Comes complete
the metal plate, you can create unusual sound effects. It picks up the with leads and insulated crocodile clips.
Kit includes a machined, silkscreened, and pre signal from the
drilled case, circuit board, all electronic remote control and
components with clear English
instructions.
sends it via a 2-wire
cable to an infrared LED located FREE CATALOGUE
• Required close to the device. This improved model
9VDC wall features fast data transfer, capable of transmitting pay TV Checkout Jaycar’s
digital remote control signals using the Pace 400 series
adapter
(Maplin decoder. Kit supplied with case, screen printed front extensive range
#GS74R panel, PCB with overlay and all electronic components. We have kits & electronic
£7.99) • Requires 9 VDC power (Maplin #GS74R £7.99) and projects for use in:
2-wire cable
• Audio & Video
• Car & Automotive
POST & PACKING CHARGES HOW TO ORDER • Computer • Lighting
• Power • Test & Meters
Order Value Cost • ORDER ON-LINE: www.jaycarelectronics.co.uk • Learning & Educational
£10 - £49.99 £5 Max weight 12lb (5kg). • PHONE: 0800 032 7241*
£50 - £99.99 £10 • FAX: +61 2 8832 3118*
• General Electronics Projects
£100 - £199.99 £20
Heavier parcels POA.
• EMAIL: techstore@jaycarelectronics.co.uk • Gifts, Gadgets & Just for fun!
Minimum order £10. • POST: P.O. Box 107, Rydalmere NSW 2116 Australia For your FREE catalogue logon to
£200 - £499.99 £30
£500+ £40 • ALL PRICING IN POUNDS STERLING www.jaycarelectronics.co.uk/elektor
• MINIMUM ORDER ONLY £10
Note: Products are despatched from Australia, or check out the range at
*Australian Eastern Standard Time (Monday - Friday www.jaycarelectronics.co.uk
so local customs duty & taxes may apply.
09.00 to 17.30 GMT + 10 hours only)
Prices valid till 30/09/08
Expect 10-14 days for air parcel delivery
�
Dual Channel Digital Scope with industry
standard probes or POD connected analog
inputs. Fully opto-isolated.
�
Capture and display analog and logic signals
together with sophisticated cross-triggers for
precise analog/logic timing.
�
Display analog waveforms and their spectra
simultaneously. Base-band or RF displays with
variable bandwidth control.
�
Record to disk anything BitScope can capture. going on in real-time.
Supports on-screen waveform replay and export.
BS100U combines analog and digital capture and analysis in one cost
User Programmable Tools and Drivers effective test and measurement package to give you the tools you need to
�
Use supplied drivers and interfaces to build navigate this exciting new frontier.
custom test and measurement and data
acquisition solutions.
Standard 1M/20pF BNC inputs Smart POD Connector Opto-isolated USB 2.0 12VDC with low power modes
www.bitscope.com
9/2008 - elektor 3
Crossing the Pyrenees,
Alps, Atlantic & The idea behind this College project is to try to balance a ball on a
the Great Wall beam using a PID control loop. If the ball is pushed, the system moves
Electronics is a now a largely
the beam to return the ball to its initial position.
borderless activity as far as So get out your USB DAQ card and a PC, and show off!
publishing and exchange of infor-
mation are concerned. The only
barrier that seems to exist (mostly
in people’s heads) is language,
projects
26 Ball & Beam for Elektor
USB DAQ Card
34 DCC Command Station
44 Luxury LED Bicycle Light
50 Light as Air (ATM18 series)
56 BASCOM AVR Course (1)
26
60 Projection over
Hundreds of Metres
68 E-blocks:
Accelerated Design
72 Ultrasonic Sound Detector
technology
18 The Thought Cursor
20 Panorama: e-CAD Anthology
The November 2005
‘Kaleidoscope’ DVD with 30-odd
programs relating to electronics info & market
CAD (Computer-Aided Design)
was a huge success. Three 6 Colophon
years on, we decided to
repeat the exercise. This time 8 Mailbox
round, instead of physical DVD
10 News & New Products
with the magazine, the programs
come as free downloads! 20 Panorama:
e-CAD Anthology
80 Elektor SHOP
84 Sneak Preview
infotainment
With a few servos, a laser module
from eBay, a microcontroller and a little 76 Hexadoku
dexterity we can make a laser projector 77 Retronics:
which, depending on the laser, can be
E1T decade scaler tube
seen from several hundreds of metres.
(ca. 1954)
elektor electronics worldwide
English
German
Dutch
French
Chinese
Portugal
Italian
Spanish
Swedish
Finnish
Volume 34, Number 381, September 2008 ISSN 1757-0875 Elektor is also published in French, Spanish, German and Dutch. Together with franchised Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl)
editions the magazine is on circulation in more than 50 countries.
Elektor aims at inspiring people to master electronics at any personal level by Graphic design / DTP: Giel Dols, Mart Schroijen
presenting construction projects and spotting developments in electronics and
International Editor: Managing Director / Publisher: Paul Snakkers
information technology.
Wisse Hettinga (w.hettinga@elektor.nl)
Marketing: Carlo van Nistelrooy
Publishers: Elektor International Media, Regus Brentford,
Editor: Jan Buiting (editor@elektor.com)
1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 Customer Services: Anouska van Ginkel
4509, fax: (+44) 208 261 4447 www.elektor.com International editorial staff: Harry Baggen, Thijs Beckers,
Ernst Krempelsauer, Jens Nickel, Guy Raedersdorf. Subscriptions: Elektor International Media,
The magazine is available from newsagents, bookshops and electronics retail Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England.
outlets, or on subscription. Design staff: Antoine Authier (Head), Ton Giesberts, Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447
Elektor is published 11 times a year with a double issue for July & August. Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen Internet: www.elektor.com
elektor - 9/2008
Masterclass
High-End Valve Amplifiers
Specifically for audio designers,
Menno van der Veen, Msc
audiophiles, DIY enthusiasts etc. Leading designer of valve amplifiers and output
transformers
In this Masterclass Menno van der Veen will examine
Programme:
the predictability and perceptibility of the specifica-
Reception and registration (9.30)
tions of valve amplifiers. Covered are models that
Preamplifiers: equivalent schematics, limits in
allow the characteristics of valve amplifiers to be the frequency domain
explored up to the limits of the audible domain from Power amplifiers: modelling of class A to B, interaction
20 Hz to 20 kHz. This then leads to the minimum of the specifications for OPTs and frequency range
stability requirements that the amplifier has to satisfy. and damping factor
The coupling between output valves and output Lunch (12.15-12.45)
transformer are also modelled. This gives new insight Negative feedback: how negative feedback can be
into a unique type of distortion: Dynamic Damping done right, remarkable experiments in “the project”
Output transformer: limits and possibilities for the
Factor Distortion (DDFD). Negative feedback is
output transformer
often used in amplifiers. What is the optimum
Discussion and end (3.30)
and what are the audible consequences?
in cl u d
The correct amplification of micro details The course fees are £ 160.00 (Including handout,
in g
ro
n ic
s w
tificate
o r ld
REGISarTeEstRrictlyNlimOiteWd. !
More info and registration at Places
www.elektor.com/events
Email: subscriptions@elektor.com Email: p.brady@husonmedia.com publication is stored in a retrieval system of any nature. Patent protection may ex-
Rates and terms are given on the Subscription Order Form Internet: www.husonmedia.com ist in respect of circuits, devices, components etc. described in this magazine. The
Advertising rates and terms available on request. Publisher does not accept responsibility for failing to identify such patent(s) or other
Head Office: Elektor International Media b.v. protection. The submission of designs or articles implies permission to the Publisher
P.O. Box 11 NL-6114-ZG Susteren The Netherlands to alter the text and design, and to use the contents in other Elektor International
Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 Copyright Notice Media publications and activities. The Publisher cannot guarantee to return any mate-
The circuits described in this magazine are for domestic use only. All drawings, photo-
rial submitted to them.
Distribution: Seymour, 2 East Poultry Street, London EC1A, England graphs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs,
Telephone:+44 207 429 4073 software carriers and article texts published in our books and magazines (other than Disclaimer
third-party advertisements) are copyright Elektor International Media b.v. and may Prices and descriptions of publication-related items subject to change.
UK Advertising: Huson International Media, Cambridge House, not be reproduced or transmitted in any form or by any means, including photocopy- Errors and omissions excluded.
Gogmore Lane, Chertsey, Surrey KT16 9AP, England. ing, scanning an recording, in whole or in part without prior written permission from
Telephone: +44 1932 564999, Fax: +44 1932 564998 the Publisher. Such written permission must also be obtained before any part of this © Elektor International Media b.v. 2008 Printed in the Netherlands
9/2008 - elektor
info & market mailbox
elektor - 9/2008
www.vintage-radio.info/whis- The OC171 Mystery
kers/ for a similar effect in an (solved) (3)
AF117 which states that the Dear Editor — I just received
can is tin plated and that the my July/August 2008 edition
whiskers are tin. and read the above article
It would seem that tin plating with interest. It mentions ‘hairs’
is not such a good idea when growing. IMHO these are
applied to enclosures for elec- whiskers, i.e., needle-shaped
tronic circuits! monocrystals growing out of
Jim Thurgood (UK) layers separated by galvanic
or pyrolitic effects.
Thanks for the response to The hairs are just a few microm-
my article Jim — it seems to eters thick and may be removed
have generated an unexpec- by a current surge (alas, this
ted amount of feedback. Also may end transistor’s life).
thanks for the interesting link. I I was curious to read that sev-
am also grateful to Andy Emmer- eral theories had been created Marconi rebranding of pact high quality code, output
son for his advice that the history around this effect, realizing FUP1D formats include binary, Intel
of electronics contains a few that ‘whiskers’ formation is a Hi Jan — Retronics is always HEX and assembler source.
mistakes and it is useful to write well known problem. a very interesting section. I I wrote Turbo51 because
about them! H. Kobow (Germany) have a good few pieces of test I like Pascal programming
For more scientifically based the- equipment of that age and older language, still work a lot with
ories, you might want to have a Thank you for your response myself. I may start writing about 8051 and couldn’t find any
look at www.springerlink.com/ to my article, which also them when I retire next year! good Pascal compiler for
content/v77jl33102116274/ appeared in translation in Referring to the June 2008 8051. I believe that sooner or
which indicates that the cause the German Elektor. Whisker instalment I have the FUP1D, later there will be some project
of this dendritic growth problem growth is indeed a correct with the additional UHF band. published in your magazine
may be undercooling, but I am term to describe the effects. It is branded ‘MI’, which that will use Turbo51.
not sufficiently well informed to Although the theories behind stands for Marconi Instruments Igor Funa
know how relevant this article is. pyrolitic growth and dendrite and would originate in the UK.
This may be related also: formation from tin and metal It is identical to your photo but
www.nature.com/nature/journal/
v216/n5115/abs/216574b0.html
junctions and compounds have
been covered by advanced
is labelled TF2950, which was
the Marconi series of numbers
Corrections &
I agree that the exact nature
of the microscopic hair growth
metallurgy for many years, I
can only assume that the mak-
for test equipment.
Ed Dinning (UK)
Updates
inside these transistors is still a ers of the OC170/171 transis- Portable Thermometer
matter of debate or research but tors had no way of knowing Many thanks Ed an looking for- July & August 2008, p. 19,
in the title I was referring to the in the early 1960s. After all, it ward to seeing some articles ref. 080418-1
mystery of circuits suddenly fai- takes about 25-40 years for the from you. Thanks also to Ludo The type number shown in
ling after 25-40 years, and that hairs to become long enough to ON4AIO from Belgium who the circuit diagram for IC5
has been solved as far as I am cause short-circuits, the period mailed me a copy of the TF2950 should be: PIC16F684.
concerned. well exceeding the useful life- product information sheet.
time of a transistor radio.
As I wrote, ‘zapping’ the
whiskers is not a permanent
The OC171 Mystery solution. Good old 8051 MailBox Terms
(solved) (2) Dear Editor — I still see a lot • Publication of reader’s orrespondence
Hi Elektor — thanks for an of projects based on some is at the discretion of the Editor.
interesting Summer Circuits 8051 derivative. And almost • Viewpoints expressed by
edition; lots of nice, small pro- A stable audio signal (2) everybody uses some C compi- correspondents are not necessarily
jects off the beaten track. Dear Sir — this refers to the ler or assembler. those of the Editor or Publisher.
By the way, those funny short- request of Mr. Monteban for For those who like program- • Correspondence may be
circuits in the old OC trannies a stable a.f. signal source for ming in Pascal here is Turbo51 translated or edited for length, clarity
may be ‘tin whiskers’ i.e. e audio measurements (Mailbox, — a free Pascal compiler for and style.
growth of tin hairs from tinned June 2008). A construction the 8051 family of microcon- • When replying to Mailbox
surfaces. A nasty problem with project called ‘Spot Sinewave trollers. It’s found at http:// correspondence,
PCB tracks, too! Lots of infor- Generator’ was published in turbo51.com and features please quote Issue number.
mation out there on the web if the May and June 1985 issues a fast single pass optimiz- • Please send your MailBox
you Google for tin + whisker. of Elektor, which hopefully ing compiler, Borland Turbo
correspondence to:
Jan Philipp Wuesten will cover Mr. Monteban’s Pascal 7 syntax, full floating
(AskJanFirst) (Germany) requirements. point support, mixed Pascal
editor@elektor.com or
Darius Toorkey (India) and assembler programming,
Elektor, The Editor,
That’s right Jan Philipp, ‘whisker’ full use of register banks,
1000 Great West Road,
is a correct term to use in this Thanks for helping advanced multi-pass optimizer,
Brentford TW8 9HH, England.
case. Mr. Monteban, Darius. smart linker, generates com-
9/2008 - elektor
info & market news & new products
10 elektor - 9/2008
9/2008 - elektor 11
info & market news & new products
12 elektor - 9/2008
The only universal and
reusable development solution,
available online today
RS EMBEDDED
DEVELOPMENT
PLATFORM
rswww.com/electronics
9/2008 - elektor 13
info & market news & new products
14 elektor - 9/2008
and 32-bit microcontroller modules ence education worldwide by pro- tools such as NI LabVIEW graphi- from LEGO® MINDSTORMS® NXT
is fully compatible with NI ELVIS viding educators and students with cal development software, which in primary schools to research lab-
II and leverages the 12 new inte- powerful graphical system design helps students visualise and imple- oratories in universities.
grated instruments to teach embed- software and modular hardware ment engineering concepts. The
ded and microcontroller design. to connect the curriculum with the integration of LabVIEW in the www.ni.com/academic
National Instruments is committed real world. Professors and students classroom creates an effective, www.ni.com/nielvis
to enhancing engineering and sci- benefit from powerful, professional dynamic learning environment – (080264-IV)
9/2008 - elektor 15
info & market news & new products
16 elektor - 9/2008
EasyPIC5 C Starter Pack—everything needed to Get an oscilloscope, logic analyser and much more
start developing PIC projects in C for just £189 with the PoScope USB-based Instrument for only £79
The PoScope connects to one of your desktop or laptop PC’s USB interfaces (USB 1.1 or
USB 2.0), is Windows XP and Vista compatible and comes with easy-to-use software.
The EasyPIC5 C Starter Pack contains everything needed to start learning about and devel- The PoScope provides two BNC connectors for oscilloscope, spectrum analyser and chart
oping with PIC microcontrollers using the C programming language. The package contains recorder inputs and a 25-way female D-connector for logic analyser and pattern generator
the popular EasyPIC5 development board, a full version of MikroElektronika’s powerful input/outputs. Supplied with USB connecting cable and software and manual on CD-ROM.
mikroC compiler, USB and serial cables, blue backlit 16x2 character and 128x64 graphic
LCDs, touch-screen overlay for graphic LCD, DS1820 temperature sensor and a 40-pin A PoScope Bundle is also available for £119, which additionally includes two high-
enhanced Flash PIC16F887 microcontroller—all for just £189. quality oscilloscope probes and a logic analyser test lead and clip set.
The EasyPIC5 C Starter Pack is well-suited to beginners and experienced developers alike
The dual-channel oscilloscope provides
and comes with high-quality printed documentation and a large number of easy-to-understand
voltage and frequency measurement,
example programs for a number of PIC microcontrollers.
absolute, differential and external trigger-
ing, adjustable pre-trigger, marker meas-
The EasyPIC5 supplied in the starter pack urements and filtering. Specifications
is a full-featured development board for include a 100Hz ~ 200kHz sampling rate,
PIC10F, 12F, 16F and 18F microcontrollers 1126 samples/channel (1 channel) or 563
in 8, 14, 18, 20, 28 and 40-pin packages. samples/channel (2-channel) memory
The EasyPIC5 incorporates an on-board depth with pipe reading of 64k samples per
USB-based PIC programmer and in-circuit channel, 10-bit resolution A/D and input
debugger as well as a useful selection of voltages from –20 ~ +20V.
built-in I/O devices such as LEDs, switches,
7-segment displays, potentiometers, RS- The spectrum analyser provides Ham-
232 interface, PS/2 and USB connectors ming, Hanning, Blackman and Blackman-
and provision for fitting of the included LCD Harris window functions. Dual-channel oscilloscope view
displays, touch-screen and DS1820 tem-
perature sensor. What’s more, all of the The chart recorder provides dual-channel
PIC’s input/output lines are available for recording at sampling rates from 0.01Hz ~
connection to your own circuits or to any of 200kHz with a maximum record time of 24
our huge range of low-cost optional add-on hours at Fs < 100Hz. A/D resolution and
boards such as Ethernet, RS-485, CAN, LIN, IrDA and RFid communications, EEPROM, SD/ input voltage range are again 10-bit and
MMC and Compact Flash storage, 12-bit A/D and D/A, and many useful interfacing and –20 ~ +20V respectively.
prototyping boards.
The logic analyser provides 16 channels
Supplied in the EasyPIC5 C Starter Pack is a full (eight when pattern generator in use) with
version of MikroElektronika’s mikroC, a power- a sampling rate of 1kHz ~ 8MHz, internal
ful integrated development environment and C and external clocking, versatile triggering
compiler for PIC12, PIC16 and PIC18 microcon- and an input range of 0 ~ +5V. Memory
trollers. With its built-in user-friendly features, depth ranges from 1544 bits/channel (Fs
mikroC makes developing code for PICs easier <= 1MHz) to 128 bits/channel (Fs <=
than ever. When used in conjunction with the 8MHz). Built-in serial bus protocol Sixteen-channel logic analyser view
EasyPIC5 development board, mikroC provides decoding facilitates the decoding of
full in-circuit debugging capabilities. mikroC also UART, SPI, I2C and 1-wire serial buses.
provides a library of ready-written routines that
provide support for all of the EasyPIC5’s on- The pattern generator allows eight of the
board I/O devices and optional add-on boards. logic analyser’s channels to be used to
This enables programs to be quickly constructed provide output waveforms from 1kHz ~
even when working with advanced features such 1MHz with a memory depth of 1544 bits/
as CAN, Ethernet and USB communications, channel and an output voltage of 0V for
character and graphic LCDs and touch-screen, and EEPROM, MMC/SD and Compact Flash logic “0” and 3.3V for logic “1”.
data storage. mikroC also incorporates useful tools such as LCD custom character generator,
GLCD bitmap generator, USART, HID and UDP terminals and 7-segment display decoder. The PWM generator provides a
7.8125kHz output with a 1 ~ 100% adjust-
able duty cycle. Square waves can also be
EasyPIC5 BASIC Starter Pack and EasyPIC5 Pascal Starter Pack also available at £149 output with a 50% duty cycle and an
each. Similar starter packs also available for 8051, AVR and dsPIC—please see our website adjustable frequency ranging from 3.91kHz
at www.paltronix.com for prices and full details. to 1MHz. UART, SPI, I2C and 1-wire decoding view
Please see our website at www.paltronix.com for further products including components, microcontroller development tools,
prototyping aids, educational robot kits, test equipment and wireless communications products.
Pix-Cell GSM Controller ZeroPlus Logic Analysers Universal Development System
New product—the Pix-Cell is a A range of powerful 16 and 32-channel The UNI-DS3 is a versatile micro-
stand-alone controller offering logic analysers with advanced serial controller development system
GSM/GPRS communications, bus protocol decoding including CAN, supporting PIC, dsPIC, 8051,
three digital inputs, three 10-bit LIN, USB, UART, SPI, I2C, 1-wire and AVR, ARM and PSoC devices
analogue inputs, SPDT relay more. With prices from only £125, with an extensive range of built-in
output and RS-232 interface there’s a logic analyser in this range to I/O features and on-board USB
priced at £129. suit all needs and budgets. programmer priced from £109.
Paltronix Limited, Unit 3 Dolphin Lane, 35 High Street, Southampton, SO14 2DF | Tel: 0845 226 9451 | Fax: 0845 226 9452 | Email: sales@paltronix.com
Product information and secure on-line ordering at www.paltronix.com. Major credit and debit cards accepted. Prices exclude delivery and VAT.
9/2008 - elektor 17
technology medical electronics
How it works
The BBCI uses the ‘pre-movement’ principle, whereby the
patient must imagine themselves wanting to move a finger,
hand or foot, in order to execute a command. The brain cur-
rents are measured using electrodes attached to the skin of the
subject’s head. Using this principle and connection method
limits the system to just a couple of movement commands
(‘left’ and ‘right’, for example) as otherwise the error rate be-
comes too high. Nevertheless, this is enough to control a sim-
ple computer game using the power of thought alone. Robot
control has also been demonstrated [4]. Using a simple cur-
sor-based system, writing has been shown to be possible at
speeds of up to about seven characters per minute [5]. For this
example the user must be able to see the cursor on the screen
to allow feedback from the computer.
Many brain-computer interfaces demand that the subject un-
dergo training (possibly lasting as long as one week!) to learn
the thought patterns that give rise to brain currents that the
machine can discriminate reliably. The BBCI, however, shifts
the burden of learning to the computer, which can shorten
the adaptation process to just half an hour, with the subject
imagining themselves moving either their left or their right The brain currents fluctuate with typical frequencies between 0.5 Hz and 50 Hz,
index finger (for example) for periods of a second or so at a with the distribution being dependent on the nature of the brain’s activity. ‘Alpha
time. About one third of subjects tested manage to defeat the waves’, between 8 Hz and 13 Hz, are well known and are seen in the EEG when the
ability of the system to learn their thought patterns, for reasons brain is relaxed. When preparing to make a movement, lower frequencies (below
that are not yet understood. 4 Hz) also come into the picture.
18 elektor - 9/2008
3 Preprocessing 4 Signal analysis
The recorder PC takes the signals from the A/D converters and carries The analysis stage starts with further preprocessing, whereby the sig-
out some preprocessing operations which help to reduce the com- nal is downsampled again to 100 Hz. From thinking about making a
putational demands of the subsequent stages. The signals are band- movement to executing it takes around a second: this means that it is
pass filtered (between 0.05 Hz and 200 Hz) and then downsampled best to collect one second’s worth of data to analyse the correspond-
to 1000 Hz. Raw data packets are then sent to the next computer over ing fluctuations in brain currents. Data from periods of 128 samples
the network, and simultaneously are stored in a database. (corresponding to about 1.2 s) are collected and multiplied by a win-
dow function chosen to give greater weight to the later samples. A
Fourier transform is then applied, and from this the frequency com-
ponents below 7 Hz are extracted. An inverse transformation recon-
structs the signal, which is now resampled at 20 Hz. This forms the
result of the signal analysis stage.
5 Classification
The classification module is im-
plemented in C++ and in MAT-
LAB, and embodies the major-
ity of the technology that has
been developed. Two threads
running in parallel on the sig-
nal analysis computer examine
the signals, each looking for ev-
idence of one of the two poss-
ible control commands. The re-
sults from the two threads are
combined, and any detected
control command is transmit-
ted over the network every
40 ms.
Internet Links
[1] http://ida.first.fraunhofer.de/bbci/index_en.html [4] www.first.fraunhofer.de/owx_1_3836_2_2_0_e19487f27e917f.html
[2] http://bci.tugraz.at [5] http://ida.first.fhg.de/publications/BlaDorKraSchWilMurMue06.pdf
[3] www.bci-info.tugraz.at [6] http://ida.first.fhg.de/publications/KreBlaCurMue07.pdf (080332)
9/2008 - elektor 19
info & market cad
Panorama
An anthology of CAD programs
Guy Raedersdorf (Elektor France)
In our hunt for CAD software, we tried to collect as many (a Spanish edition was added to the European group three
evaluation versions as possible – demos with greater or years ago). So we’re suggesting a dual approach:
lesser restrictions, but also 100% functional versions of pro- 1. the various programs can be downloaded individually
grams – within this family of software. We’re well aware (particularly suitable for those readers who don’t have a
it’s impossible to be exhaustive and there are still some that fast internet connection); all you have to do is go into the
have ‘slipped through our net’. But don’t worry, that’s doubt- ‘virtual DVD’ and download the .zip file from the relevant
less just till next time round… directory.
Ed.: don’t hesitate to tell us about your finds, favourites, 2. or there’s a ‘virtual DVD’ that appears ‘physically’ as an
etc., we’ll share them with all our readers. .iso file to download from our website (warning: it’s almost
Unfortunately, it’s just not possible for us to go into all the 1.7 GB, which means a broadband connection is virtually
details of the dozens of CAD programs available on the obligatory!) and then burn onto a DVD using the burn soft-
market. So we’ll have to content ourselves with just mention- ware of your choice, Nero or Burning Studio. All you then
ing certain features that struck us while we were installing have to do is put the DVD into your drive and it will auto-run
and getting to know them. (if your operating system is suitably configured), or you can
Finally, let’s just add that ibfriedrich (Target3001!) and just manually run the index.htm file in the root directory of
Seetrax (Ranger2 XL) have offered us ‘Elektor special’ ver- the DVD drive containing your newly-burned DVD.
sions with possibilities that go beyond their usual evalua-
tion versions. We’re sure our readers will be able to make Now let’s move on to our review – the programs are ar-
the most of these. ranged in alphabetical order.
20 elektor - 9/2008
FRE
ww ED
w.e
le OW
kto NL
r.co
m/ OA
pa
n D ora
ma
automatic component numbering (standard in most of the Like its little brother, DesignWorks Professional 5 is a circuit
software in this category), component search, and the use entry application. 100% hierarchical design, standard and
of variables. custom netlist formats, extensive component library, are just
Sprint-Layout 5.0 is an easy-to-learn PCB design pro- a few of its features.
gram with all the standard functions for this type of activity. Let’s just note that there is also a version of DesignWorks
It takes only a few minutes to grasp how it works. Professional 5 with a simulation function.
Note the co-availability of French and German versions.
Extra on the Panorama ‘DVD’:
LochMaster 3.0 for your projects on prototype board. Cadence
FrontDesigner 3.0 for designing board overlays. The OrCAD® PCB Designer suite from Cadence, the
‘proto-genitor’ of circuit entry software, is now at version
16.0. Integration has reached its highest point, meaning a
AMS remarkable consistency in the commands common to the
AMS (Advanced Microcomputer Systems) offers Circuit-
CREATOR, an application that handles circuit entry, PCB
design, and the other usual functions. Like most current pro-
grams, it supports SMD components. Options for several
fonts per layer and for changing the shape of lands be-
tween layers. You can define supply and ground planes
with or without thermal dissipation option. Interactive com-
ponent placement. The rat’s nest suggests optimum com-
ponent layout, but also makes manual routing easy. Has a
DRC (Design Rule Checking) function used to check the built-
in design rules; it flags up an error and shows where it is.
Their program also includes a simulation application
SpiceCreator, also available as an extra on the DVD.
Baas
Many of our readers are familiar with the name Lay-
o1PCB; it was in fact one of the first PCB design programs
with more than one language to choose from. This is still the
case with this latest version, Layo1PCB version 10.19 on
offer from Baas Electronics. The version on offer here is the various modules that make up OrCAD PCB Designer, in
simplest version. As it is not linked to a netlist, this program this way making it possible to design a project from start
lets you place your components wherever you want and to finish, from entering the circuit, via component drawing,
draw tracks the way you want. To be able to read a netlist to designing the PCB. It includes an interactive autorouter
generated by a circuit entry program such as those created SPECCTRA (re-named Allegro PCB Router), a piece of soft-
by Mentor, multiSim, Calay, Protel, or Tango, you need to ware that seems to be becoming the must-have solution in
move up to the professional version, Layo1 PCB Design. the field of autorouting.
Once installed, the software appears in the form of two
programs, OrCAD Capture CIS for circuit entry (with a
Capilano DRC function that lets you eliminate the majority of errors
As part of the Panorama download we’re offering you two right from the outset) and OrCAD PCB Editor for PCB
products from the Capilano stable, the DesignWorks Ex- design and routing. A new ActiveParts function lets you
press for Windows program and the evaluation version search for information about an OrCAD component using
of DesignWorks Professional 5. DesignWorks Express various criteria.
for Windows (free) is a handy application for circuit entry
(single-sided) as long as the number of pins remains under
500. All options are open to you: editing, saving, print- Cadsoft
out, and even producing netlists for loading into a PCB Eagle 5.0 from Cadsoft is one of the most popular circuit
design program, for example Pad2Pad (also free) de- entry and PCB design programs amongst hobbyists in Eu-
scribed below. rope. It owes its popularity to the ease of use and perform-
9/2008 - elektor 21
info & market cad
LabCenter
The latest offering from LabCenter is Proteus Design
Suite 7.2. Proteus is in fact a combination of two pro-
grams in one: ISIS for circuit entry and ARES for PCB de-
sign with autorouting and 3D visualisation. Together, these
form a powerful, highly-integrated environment. There are
several versions, from the Starter Kit, with a netlist limited
to 500 pins, to the Level 3 version which handles unlimited
pins and layers.
FreePCB 1.20 McCAD
Allan Wrights’s FreePCB is a free PCB design program. McCad has made a reputation for itself in the Mac world
The Manual available on the author’s website is an excel- as the first manufacturer of CAD software to run on Mac
lent resource for finding out what’s involved when you want
to design a printed circuit. There’s no circuit entry function,
so you’ll either need to use a circuit entry program, or else
create your own netlist, making sure it can be imported into
FreePCB. The existence of a rat’s nest helps a great deal in
positioning the components properly, thus making it poss-
ible to avoid unnecessary track lengths. The presence of a
shape editor is quite surprising in such an environment, but
FreePCB’s specific function is to make printed circuits, and
it does this well.
ibFriedrich
TARGET 3001! V13 is the worthy successor to its pred-
ecessor V12, covered in November 2005.
A few points of interest:
Note: The version on offer here is an ‘Elektor special’ ver- Worth noting: the possibility of downloading a very in-
sion that lets you do a lot more than the standard demo structive e-book ‘Quickstart to Simulation’ devoted to
version. simulation.
22 elektor - 9/2008
National Instruments takes place during this operation, so the program works
right away. This version is limited to projects comprising a
Multisim from National Instruments is an old acquaintance maximum of 30 components and 50 nets (it is otherwise
to the Elektor designers. For years, they’ve been working identical to the full version). When the program is run, it of-
with Ultiboard, the forerunner of this program. Multisim, fers a button to search for updates.
the latest offering from the Electronic Workbench Group Note: After transfer of the licence file, the version of Rang-
– which has now become part of NI – has evolved into a er2 XL offered here is the ‘&500’ version that normally sells
multi-faceted tool combining circuit entry, interactive circuit for £90.
simulation, PCB design, and compliance testing. Multisim
is available in different versions: Base, Full, and Power Pro.
We are offering you a trial of the Base version. Those Engineers
Multisim in fact comprises two modules, Multisim for cir- Spicycle is a full program that lets you design a PCB di-
rectly from a netlist or in more conventional fashion from a
circuit diagram. As all the operations are carried out under
Active X control, it is possible to perform back annotation
between the circuit diagram, the netlist, and the simulation
parameters. One interesting aspect of Spicycle is that it
includes a very comprehensive symbol library, making it
possible to design not only an electronic circuit, but even
to create a sort of schematic diagram of any kind of system
(for a wind tunnel, for example).
Spicycle offers a simulation in ‘mixed’ mode (integrates
seamlessly with the SpiceAge simulator). Data transfer to
the circuit diagrams is bidirectional, meaning you can im-
port a SPICE netlist which is then presented in the form of
interconnected circuit symbols. Back annotation becomes
a real pleasure.
Tsien
BoardMaker3 has come a long way since it came out in
cuit entry and SPICE simulation, and Ultiboard, in its new 2000, and has been regularly updated. The V1.33.0022
livery, for PCB design with built-in routing. The possibility of version on offer here dates from 24 June 2008. Board-
using LabVIEW measuring instruments adds an extra dimen- Maker3 is an integrated environment for PCB design; it has
sion to this software. high-performance tools for circuit entry, Spice simulation,
3D visualisation, and autorouting.
Number One Systems
Easy-PC from Number One Systems has been well-known
for years, and is now at version 11.0. What struck us with
this new version is the existence of Design Calculators that
let you perform various operations like defining track size
according to current, and calculating their impedance, as
well as the temperature rise in operation. Naturally, DRC is
available here too.
One of the interesting options – found in other software too,
albeit under a different name – is the Intelligent Gerber Im-
port, which lets you re-create, from a Gerber file from any
source, an Easy-PC PCB from which it is then even possible
to derive a full circuit diagram.
In addition, you’ll also find a demo version of Easy-Spice,
a simulation program.
Seetrax
Seetrax has added two of its programs to our list: Rang-
er2 XL and Seetrax XL Designer (SXLD to its friends). Worth noting: on the www.tsien.info/guide.php site there
To install Ranger2 XL, all you have to do is run the setup.exe is a series of pages that explain extremely well what’s in-
file; once installation is over, you’ll have the demo version volved when you start to tackle a circuit entry and PCB de-
of Ranger2 XL with its original restrictions. sign application.
To now change your demo version into the 500-pin version
(a present from Seetrax), all you need do is copy the li-
cence.dat licence file (from the ‘Licence’ subdirectory; make Visionics
sure the name is right, without any other additional suffix) EDwinXP includes all the tools you could wish for required
into the ...\seetrax\ranger2xl\data directory. to produce a printed circuit: the circuit editor, PCB editor
Seetrax XL Designer is the second program from (with autoplacement and autorouting), simulators in EDSpice
Seetrax. To install the demo version, all you need do is mixed mode, the library manager, and all the rest.
run the XLDesignerDemo_1.49.exe file. Licence installation Worth noting: the presence of a thermal analyser (with sig-
9/2008 - elektor 23
info & market cad
nal integrity and field analysis), and a test for the effects of up. Some of them weren’t in a position to make an evalua-
electromagnetic radiation on the circuit. The installation of tion version of their programs available to us (for example,
this program alone is already a real feast for the eyes. Altium, which does however boast a most attractive virtual
Note: It’s important for the directory where the EDwinXP161 demonstration centre at www.altium.com/evaluate/demo-
files are going to be decompressed to have a name of 8 center/# and choose your language), others simply chose
characters or less (e.g. EDwinXP) if you want to be able to not to.
install the program (see the readme.txt file that comes with
the program).
Conclusion
Reviewing almost 20 programs, whether comprehensive
So where are the missing ones? or specializing in just PCB design, really brought home to
Despite all our efforts, we didn’t manage to ‘nail’ all the us the increasing complexity of this type of software. Using
CAD software manufacturers we’d have liked for our round- such programs demands a relatively up-to-date PC, if you
24 elektor - 9/2008
want to avoid its turning into a real trial of patience. In any Ed.: In view of the time that elapsed between writing this
case, you’ll need quite a lot of that to get to grips with any article and the ‘gathering’ of the software appearing on the
of these programs. Most of the top-end programs (price- virtual DVD, it’s still a good idea to look and see if there
wise too!) are hardly very different in terms of what they may be a new version of any of the software described in
offer, except in terms of certain details. this article you may be interested in (hence the links given
in the table).
And what for one user may seem to be an unforgivable (080356-I)
omission may be an option that another user has no need
of. It’s a question of taste and requirements. You are the The author would like to thank Cadence Design Systems, Inc. for
best judge of that. So why not take a look at our website allowing Elektor to distribute OrCAD software from their site and
and download the .iso file to create your own DVD, or pick a virtual DVD.
the programme you’d like to try out… By the same token, he would like to thank all the other compa-
Happy exploring! nies for their unconditional permission.
free www.pad2pad.com/
£ 90 to £ 460 www.seetrax.com/
£ 100 to £1,000
£ 45 to £ 195 www.spiceage.com/
£ 45
£ 350/yr or 6x price www.tsien.info/index.php
$ 110 to (N.I.) www.visionics.a.se/
9/2008 - elektor 25
projects pid balancing act
Like it or not, Ball & Beam is a compulsory item on the Electronics Engineering curriculum, specifically
for classes on PID (proportional-integral-derivative) control systems. The idea is to try to balance a ball
on a beam using a control loop. If the ball is pushed, the system moves the beam to return the ball to its
initial position. So let’s get out our USB DAQ card and a PC to show off!
Apart from your curiosity and eager- there is no need to do any Laplace or Z ferent fields of study. The elements are
ness to learn about PID (one of the transform. There is no need to do any shown in Figure 1.
great pillars of electronic engineering), calculation either; apart perhaps from The electronics comprises two printed
the ingredients of this project can be an empirical tweaking of the PID con- circuit boards:
summarised as troller by adjusting certain controls in 1. Elektor USB Data Acquisition Card
• the Elektor USB Data Acquisition the PC program. Of course, those of you (November 2007). This card has 8 dig-
(DAQ) Card [1]; with solid mathematics education can ital inputs, 8 digital outputs, 8 ana-
• a circuit which acts as interface rigorously analyse the system. logue inputs and 2 analogue outputs.
between the DAQ and the mechani- On the other hand, seeing how a ball From all this I/O capacity we employ
cal system; remains stable in a certain position on just one digital output, one analogue
• mechanics, i.e. construc- output and one analogue
tion of the ball & beam input. For a deeper knowl-
system, which is very Watch the Elektor Ball & Beam edge of this card, the article
easy and cheap com- scale model on YouTube in ref. [1] should be read.
pared to commercial
units; 2. Ball & Beam Interface
• A personal computer running a the beam not only has didactic or aca- Card. The card described in this arti-
program. demic interest! Aircraft of the vertical cle is used to adapt the Ball & Beam
This project can be interesting for any- takeoff type such as the Harrier employ Mechanics to the USB Data Acquisi-
one keen on electronics and/or comput- similar control loop systems to maintain tion Card.
ers; even more so if he or she is curious stability while stationary in the air.
about control and regulation systems For software, we add the Ball & Beam
or about discrete PID controllers using PC Program. This application for PC
Windows C++/CLI programming. It
Recipe for the system communicates with the Data Acqui-
may also trigger old hands at electron- The Ball & Beam system consists of sition Card to send and receive infor-
ics to re-live the PID experiments they electronics, software and mechanical mation from the Ball & Beam mechani-
once did at College in the dim past. elements and so makes a nice project cal assembly through the Ball & Beam
The project has a low threshold as to run by a group of students from dif- Interface Card. It is developed in C++/
26 elektor - 9/2008
ktor USB DAQ Card
9/2008 - elektor 27
projects pid balancing act
K4 K5
X1
S1
IC1 K4 K5 Ball & Beam Mechanics
K2 K2
Ball
Beam
USB L1
D1
R8 R6 K1 K3
D3 D2 R7
5VDC
K5 K4 Servo
K5 R6
K4
C5
P1 IC2
T1
R4
R7 K3 CURRENT VOLTAGE
C4 V
R11R5
R8 C8 POWER A
R9
C1 CURRENT VOLTAGE
C7 IC1 V
C6
R1
A
R3 C3 R10
R2 K6
K1 K2 D1
C2
R12
Dual External
Power Supply
K2 Ball & Beam K6 1V3DC
Interface Card
080002 - 11
This 6 dB/octave (first order) filter The relevant electronics is simple: one UCCP1 = 5D
effectively sits between the ball posi- astable and one monostable imple-
tion ‘potentiometer’ and the AN0 ana- mented using the ICM7555 or TLC555,
Where D is a constant between 0 and
logue input on the USB Data Acquisi- i.e., the low-power CMOS version of
1. As the CCP1 signal is going to mod-
tion Card. The simulation result of this the famous LM/NE555 (which, by the
ulate the monostable’s pulsewidth, it
filter is shown in Figure 3. Note that way, should not be used). Both IC1 and
is necessary to filter it to turn it into a
the roll-off frequency is very low at just IC2 are supplied from the USB port on
continuous level. This is done by R5,
7.5 Hz, but enough to perfectly register your computer through the USB DAQ
C4, R4 and C5, the components form-
the ball position due to the movement Card. More on the 7555 and relevant
ing a low-pass filter of modest fea-
by the beam. calculations in the inset.
tures with a roll-off at about 30 Hz.
That’s high enough for the sampling
3. Pulse generator to the servo — the Around IC2 a monostable has been frequency Fs and low enough for sup-
beam slope is determined by the posi- assembled. Its trigger signal is pro- pressing harmonics of the 2.9 kHz
tion of a servo. The beam will remain vided by IC1; that is why the pulses PWM signal on CCP1. The slope of
horizontal if the the filter is 12 dB/
servo is in the cen- octave (2nd order).
tre position. If the Provide video proof to Elektor if you did Notice that the
servo spindle is at charging of the
one extreme, the the project with a ball heavier than 1 kg. monostable’s
beam slopes some capacitor is not
15º. If it is at the done with the usual
other extreme, the beam slopes 15º generated by the monostable have the simple resistor — here, a constant-cur-
opposite. same frequency as the IC1 astable. rent source is used. Built around T1, it
The signal fed to a servo is composed The output pulsewidth controls the keeps the capacitor’s charge build-
of pulses with a frequency between servo position and must have a fre- up linear, enabling the monostable
50 Hz and 60 Hz. The pulsewidth quency between 50 Hz and 60 Hz. The pulsewidth to vary in linear fashion
determines the servo position and monostable pulsewidth should vary with the CCP1 signal. The constant
varies between 1 ms and 2 ms. The between 1 ms and 2 ms (typically). current flows in T1’s collector line and
servo’s central position corresponds to is adjusted by P1. See the Monostable
1.5 ms. These times may vary slightly The pulsewidth is determined by the IC2 dimensioning inset for the compo-
from a servo manufacturer to another. CCP1 analogue output. CCP1 supplies nent value calculations.
The pulsewidth is controlled by the a PWM signal with a frequency of about The servo, besides the pulse signal,
CCP1 analogue output on the USB 2.9 kHz whose average in volts can be needs a supply voltage. As its current
DAQ Card. calculated with the expression: consumption is rather high (hundreds
28 elektor - 9/2008
of milliamps), it is impossible to supply
it from the USB DAQ Card (remember VCC
where that card gets its power from?).
Hence it is essential to power the P1
R10
servo from an external supply rated at
5k
270k
5 V and 1 A, connected up to K5.
R7 R8
K4
Construction
2k7
1k
The component mounting plan of the
8
R
BC557B R
circuit board designed for the interface 7
DIS
7
DIS SERVO
R11
card is shown in Figure 4. As usual the IC1 T1 IC2
6 3 6 3
true-scale copper track layout (reflected
1k5
THR OUT THR OUT
and non-reflected) is in a free .pdf file TLC555 TLC555
2 2 K5
TR TR
found on www.elektor.com/080002 i.e. CV CV
+5VDC
(SERVO)
R9
.the web page for the project.
1
C6 C7 C8
Construction of this board should be a
2k7
breeze as only traditional through-hole 100n 100n 100n
components are involved.
K6 K3
R12 R4 R5
1 2 1 2
1k 47k 47k
The Ball & Beam PC program 3 4
R6
3 4
5 6 C5 C4 5 6
The program developed for the project K1 K4
220k
7 8 7 8
D1
implements a discrete PID controller +5V
9 10 100n 100n
+5V
9 10
with an F s (sampling frequency) of
10 Hz. The PID mathematical deriva- VCC
tion is given in the PID maths inset. K1
R3 POTENTIOMETER R2
1 2
The PC program is also a free down- +5V 10R 1k
K2 3 4
load from the project web page. C2 C3
R1
C1 5 6
K5
All PID parameters can be controlled
120k
7 8
100u 100n 22u
and observed in the program, see Fig- 16V 16V +5V
9 10
ure 5. A brief program description is
given below. 080002 - 12
9/2008 - elektor 29
projects pid balancing act
R11R5
R8 C8
C1
R9 a maximum of 1.3 V.
C7 IC1
C6
The servo used is the Futaba type S148
R1
or equivalent. It is connected to K4 on
R3 C3
K6
R10 the Ball & Beam Interface Card. The
R2 D1
K1 K2
C2 servo’s white wire connects to pin 1 of
K4, the red one to pin 2 and the black
R12
one to pin 3.
Figure 4. PCB design for the interface. The copper track layout is a free download. Starting up
The USB DAQ Card connection to the
PC and the installation of the corre-
COMPONENTS LIST Semiconductors sponding driver is explained in [1].
D1 = LED, low current, 3mm Once the USB DAQ is installed, you
Resistors T1 = BC557B
R1 = 120kΩ IC1,IC2 = TLC555 or ICM7555 (do not use
can launch the Ball & Beam PC pro-
R2,R7,R12 = 1kΩ plain 555) gram. Make sure that the application
R3 = 10Ω is stopped (Status: STOP). Connect
R4,R5 = 47kΩ Miscellaneous
R6 = 220kΩ the 5 V, 1 A external power supply
K1,K3,K6 = 10-way boxheader and adjust preset P1 until the ‘C’ arm
R8,R9 = 2kΩ7 K2,K5 = 2-way SIL pinheader
R10 = 270kΩ K4 = 3-way SIL pinheader (see mechanical assembly document)
R11 = 1kΩ5 PCB, ref. 080002-1 from www.thepcbshop. gets horizontal — the beam must be
P1 = 5kΩ preset com horizontal too. Click on the START but-
PCB artwork, free download from www. ton (Status: RUN); this will take con-
Capacitors elektor.com/080002
C1 = 22µF 16V radial Project software, free download from www.
trols r(n) and kp to their highest posi-
C2 = 100µF 16V radial elektor.com/080002 tion (the latter in the ×10 scale), whilst
C3,C6,C7,C8 = 100nF checking that the ‘C’ arm is at an angle
C4,C5 = 100nF
of 30º to 50º relative to the base. Then
stop the application (Status: STOP).
Now put the ball on the beam and
block schematic. an interesting discussion on selec- connect the 1.3 V/1 A auxiliary power
The second chart, located in the lower tion of the ball material (steel) and its supply. Move the ball by hand to the
part of the screen, shows the evolu- weight (approx. 64 g). far right of the beam, keeping it there,
tion of a selected (n) function. The sig- and write down the voltage meas-
nal can be any one of those included The beam has two wires made of ured across resistor R2. This should
in the VARIABLE or TERM CHART. nickel-chrome (NiCr 80%/20%) between be approximately 1.3 V. Adjust the aux
By clicking on its name, it will appear which the ball rolls. The steel ball rep- power supply to get exactly 1.3 V. Now
represented. resenting the wiper, the lot acts like everything is ready for the first try.
a linear potentiometer (or ‘rheostat’)
The program was written using C++/ that’s perfect to determine the ball
CLI with the free of charge Visual position on the beam. The resistance
Maiden run
C++ 2008 (Express Edition) compiler. wire is normally used for manufactur- Push the START button on the program
The most important function is called ing and repairing heating elements. and slide reference r(n) to the middle.
‘Void timer1_Tick’ and it is found in The wire has a diameter of 0.5 mm. Slowly raise the kp proportional con-
the archive ‘Form1.h’. In this function, Resistivity for the nickel-chrome wire stant until the ball rocks slowly on the
among others, sits the discrete PID at 80%/20% is about 1.1 Ω·mm2/m. The beam. Carefully increase the derivative
controller code. beam length being 40 cm, the resist- constant until the ball is stable. If so,
The free of charge .NET XYGraph was ance works out as push it a little by hand — the system
also used for the control of compo- should respond by keeping the ball
nentXtra.com. L steady.
R = ρ⋅ =
S Now increase the integral constant
little by little until the error is elimi-
Ball & Beam mechanics 40⋅10−2 nated and the ball is steady as before,
1.1⋅ = 2.24Ω
Parts lists, parts photos and details of 196.35⋅10−3 but this time approximately in the mid-
the mechanical assembly of the Ball dle of the beam. Got it! PID in action…
& Beam scale model may be found in S = π ⋅r 2 = tell everyone about it at College and in
a supplementary document that can the Elektor forum!
be downloaded free of charge from 0.5 2
the project web page as archive file π ⋅ = 196.35mm2 From here, you and your classmates can
080002-W.zip. The document also has 2 try as much you want, for example:
30 elektor - 9/2008
• choose different positions for the ball
using r(n). (ICM)7555 astable multivibrator
• Make the system respond slower
The (ICM)7555 chip is the CMOS low-power version of the renowned LM555/NE555. With
or quicker, with increased or reduced it, RC timers can be easily designed. Its functional schematic is given below.
accuracy, with more or fewer tendency
to oscillation, and so on, by changing V DD
FLIP-FLOP
8 4
kp, kd and ki. RESET
OUTPUT
R COMPARATOR DRIVERS
• study the system’s maths and adjust THRESHOLD A
-
1
T 080002 - 15
• Use a PC with fast CPU and a vast
amount of RAM memory. t H = ( R10 + R11)⋅C 6⋅ ln 2 = ( 270 k +1k 5)⋅100 n⋅0.69 = 18..7ms
• Execute the Ball & Beam PC program
only. Pull the plug on MSN & Co. t L = R11⋅C 6⋅ ln 2 = 1k 5⋅100 n⋅0.69 = 103.5 s
• Give your application a high level of
T = t H + t L = 18.7 ms +103.5 s = 18.8ms
priority in the Windows multitasking
scheme (this is done by the program). 1 1
• While the Ball & Beam PC program F= = = 53.2 Hz
T 18.8ms
application is executing, do not maxi-
mize not minimize windows or push The actually measured values are:
the Start button, etc. Allow the PC to tH=18 ms
interact with the application only.
tL=100 µs
If you stick to the above guidelines, the T= tH + tL =18.1ms, hence F = 1/T = 55.2 Hz
sampling frequency will be practically
free from irregularities.
The program has been successfully On the Ball & Beam Interface Card it
If something does not properly work tested on Windows XP and Vista PCs may happen that it is impossible to get
If something does not work, take some without encountering any problem. the adjustment done properly. This is
time to read this section, it will help However, the program may indicate probably due to tolerances, mainly
you locate the cause either in the PC some error if there is a problem with in the internal voltage divisor of the
program, the interface card, or the the USB Data Acquisition Card. If so, (ICM)7555 or TLC555 integrated cir-
mechanical assembly. go back to ref. [1]. Note that a correc- cuit (in the prototype we used a Philips
tion was published for the project. IC). With an oscilloscope, check up the
First, make sure of a running, fully signal on IC1 pin 3 (0 V and 5 V levels,
updated Windows XP or Vista. Ball & If the program is modified, it must be frequency between 50 Hz and 60 Hz,
Beam does not work under Windows compiled again with the Visual C++ low level of some 100 µs). If not, IC1 is
2000 or lower. Also check if you have 2008 Express Edition — do not use probably at fault or you have mounted
the latest update of .NET Framework the 2005 version. Besides, you should a wrong component value.
(from version 3.5). have NET XYGraph and Visual C++
The executable program Ball_Beam. 2008 Express Edition, all correctly If it proves impossible the get the ‘C’ arm
exe is in the same folder as mpus- registered. horizontal by adjusting P1, change C8 to
bapi.dll and XYGraph.dll. To run the a different value (47 nF or 150 nF).
program under Windows Vista, right- The program needs a screen resolution If during the start-up the ‘C’ arm is
click on ‘Ball_Beam.exe’ and from the of at least 1280×1024 so send the old noticeably higher than 30-50º relative
context menu choose ‘Execute as 15 inch CRT off to recycling along with to the base, try different values for R4
Administrator’. the 486 or Win98 PC. and R5 (68 kΩ or 100 kΩ).
9/2008 - elektor 31
projects pid balancing act
If
it’s
1V3 DC
Resistance Wire 40 cm
Ball to K2.1
Resistance Wire 40 cm Ball & Beam
Interface Card
to K2.2
080002 - 18
Figure 5. The Ball & Beam PC software in action. Figure 6. The position of the ball on the beam is read by a DIY rheostat or wire potentiometer.
Food for C++ programmers and quite a lot to tweak to get the ball stable on the beam!
Ug=0.6V
0.8ms @ U CCP1 = 0V
C 8⋅U CV 100 nF ⋅(1.65+ 0.54⋅U CCP1 )
t PULSE = = = 1.5ms @ U CCP1 = 2.5V
IQ1 203 A
2.1ms @ U CCP1 = 5V
Note that the variation of tPULSE is linear with respect to UCCP1. In practice, the pulse durations
obtained after adjusting P1 are well within the range 1ms to 2ms.
Reference
[1] USB Data Acquisition Card,
PID maths Elektor November 2007.
www.elektor.com/070148
n−1
e( n) − e( n −1)
u( n) = k p ⋅ e( n) + ki ⋅Ts⋅ ∑ e( i) + kd ⋅
Ts
i=0
About the Authors
1
Ts = Jose Luis Rupérez Fombellida and José
Fs Manuel Escobosa Bravo are teachers in
e( n) = r ( n) − y( n) electronics at San Blas Secondary School,
Madrid, Spain.
32 elektor - 9/2008
projects model train control
Electronics is making more and more inroads into the domain of model trains. Trains are now
controlled with digital codes, and in many cases the entire system can be operated from a computer.
In this article we present a design for the device that forms the heart of a digitally controlled model
railway: the DCC Command Station. The computing power in this design is provided by a high-
performance ARM7 processor.
One of the key elements of a modern difficult to control other functions in a decoupling, and lighting (including
digitally controlled model railway is locomotive, such as sound effects or a when the train is standing still).
the control unit that produces the dig- smoke generator. • Several trains can travel on the track
ital signals for controlling the locomo- If a decoder is fitted in the locomotive or in the same block at the same
tives. This device also has several sec- and the transformer is replaced by an time.
ondary functions, such as communicat- electronic control unit with a track • A computer can be added for easy
ing with a PC. booster, we enter the realm of digitally automation of control and protection
controlled model railways. functions.
This article describes a control unit
(called a ‘Command Station’ in model The electronic controller that makes all An additional benefit of the system
railway jargon) that employs the DCC this possible is called a ‘Command Sta- described here is:
standard and is built around a power- tion’. The Command Station described • The standard is widely used, so prod-
ful ARM7 processor, which is also used here is suitable for systems that employ ucts from different suppliers can be
on the Elektor ‘ARMee’ board. what is called the ‘DCC standard’. DCC used ‘mix and match’ in the same
First a brief introduction to the topic. is not the only method for digital con- system.
With conventional analogue control of trol of model railways, but it is one of
a model railway system, the speed of the few methods that is not tied to a
the locomotives is adjusted by varying specific manufacturer.
A brief history of DCC
the voltage on the track. The simplest The advantages of digital train control Despite what you might think, DCC
arrangement consists of a transformer can be summarised as follows: (which stands for ‘Digital Command
and a potentiometer, possibly comple- Control’) is not new. The history of DCC
mented by a rectifier. More advanced • Dramatically improved locomotive goes back to the late 1980s. At that
systems use pulse-width modulated running characteristics, especially time a working group of the National
(PWM) signals. The principal advan- at low speeds and on uphill grades. Model Railroad Association (NMRA),
tage of this approach is improved run- • Individually switchable auxiliary func- an umbrella organisation of model rail-
ning characteristics. This is quite nice, tions in locomotives, such as sound way enthusiasts in the USA, was look-
but even with these systems it is very effects, smoke generators, remote ing for a standard that could be used
34 elektor - 9/2008
ion
micro
for digital control of model trains. The railway world. Structure of a digitally
commercially available systems at that The requirements and expec-
time were proprietary and mutually tations that the new standard must
controlled model railway
incompatible. fulfil were specified by the DCC work- A digitally controlled model railway
After an extensive study of the avail- ing group of the NMRA in documents consists of the following functional
able systems and a few diversions, in called ‘Standards’ and ‘Recommended blocks (see Figure 1):
the early 1990s the NMRA decided on Practices’ (RPs). The electrical prop-
a system developed by Lenz, a Ger- erties that the signals must fulfil, as • Transformer. Every system needs a
man company. Reliable data transfer well as the form and content of the source of power.
and interference-free operation were transferred data, are defined pre-
naturally the most important criteria cisely. Among other things, the recom- • Decoder. This processes the signals
for their choice. In addition, the new mended practices define the require- that originate from the Command Sta-
standard had to be able to evolve with ments that must be met by the dig- tion and are placed on the track by the
the available technology and satisfy ital boosters that supply power to the booster. A decoder can be fitted in a
new requirements arising in the model model railway. locomotive, but it can also be used in
a fixed location for controlling compo-
nents such as turnouts and signals (in
the latter case, it is called an accessory
decoder). A remarkable aspect of these
decoders is that they receive power
and digital signals via the same leads,
so there is no need for separate power
leads. As each decoder has a unique,
configurable address, it is easy to
connect several decoders to the same
track. Each decoder only responds to
Command Booster
Station
Decoder the information intended for it.
9/2008 - elektor 35
36
projects
R1 R2 R3 +5V
+3V3 10k 470R 10k +3V3 R4
JP1 JP2
10k
+5V K1 K2 K4
1 P0.3 P0.14 1 P0.15
+5V +5V
2 P0.4 P0.15 2 C5
C1 3 P0.5 P0.16 3
R5
C3 4 P0.6 TRST 4 +3V3
100n
2
100n 5 RTCK TMS 5
100k
100n 6 DBG TCK 6 VDD
14
K3 1 16
7 P0.7 TDI 7 C4 C1+ VCC
14
1 S88 DATA VCC
8 P0.8 TDO 8 IC1
2 VCC 11 12 P0.5 100n 3
Y4 A4 9 P0.9 RST 9 C1-
3 S88 CLK 11 12 8 9 P0.4 P0.14 11 14
Y4 A4 Y3 IC2 A3 10 10 T1IN T1OUT K5
4 S88 LOAD 8 9 6 5 P0.6 TXD0 10 7
Y3 A3 Y2 A2 11 11 T2IN T2OUT
5 S88 RESET 6 IC3 5 P0.7 3 2 12 13 1
Y2 A2 Y1 A1 12 12 R1OUT R1IN
6 3 2 RXD0 9 8 6
+5V Y1 A1 74LS125 13 TXD0 13 R2OUT R2IN
13 4 C2 2
74LS125 OE4 14 P0.10 RXD0 14 C6 C2+
13 10 7
OE4 OE3 15 P0.11 15 MAX3232CPE
10 4 100n 5 15 100n 3 11
OE3 OE2 16 P0.12 16 C2- GND
model train control
4 1 8
OE2 OE1 17 P0.2 17 VEE
1 4 10
6
OE1 18 18 C7
GND +5V 9
19 19
7
GND +3V3 +3V3 5
20 P0.13 20
7
100n
SUB D9
+5V
+3V3
+5V
R22 C8
R6 +12V
D1 D2 IC4 IC5 R7 K10 K7
10k
100n
10k
L7812ABV L7805
8
IC6
1
2
3
4
5
6
1
2
3
4
5
6
680R
4
1
1 2 1 2 P0.10 2
P0.9 1 A 6 R8
IC7 R
3
3
D3 D4 C9 C13 C10 C11 C12 TLP521
120R
B 7
3
2
R9 D5 3
1N4001 1N4001 4700u 100n 100n 100n 100n
40V 10k P0.8 4
D R10
T1 1N4148
1
2
3
4
5
6
1
2
3
4
5
6
R11
GND
680R
1k
5
LTC1485CN
BC547B D6 D7
100R
390p
10k
R16
K12 R12 R13 C15 +12V 8R2 K13 +12V K14
P0.11 K11
1k
1k
100n 1 1
1 2
2 2
TRST 3 4 D10 D11
8
RE1 3 RE2 3
+3V3 TDI 5 6
VCC 40.61 4 40.61 4
TMS 7 8 1N4001 1N4001
K15 1
IC8 E0 R17 TCK 9 10
P0.8 P0.3 5 2 T2 T3
SDA E1 RTCK 11 12 R18 R19
P0.9 P0.2 6 3 P0.16 P0.13
10k
SCL E2 TDO 13 14 10k 10k
P0.10 7
WC RST RST 15 16 R20 R21
M24C64BN1 BC547B BC547B
17 18
GND
10k
S1
10k
+5V 19 20
4
070989 - 11
elektor - 9/2008
mikroElektronika
Advertentie
DEVELOPMENT TOOLS | COMPILERS | BOOKS
5 40 17
VDD1.8 VDD3-1 VDD3-2
K1 K2
P0.3/SDA 21 44 P0.14
P0.3/SDA P0.14
P0.4/SCK 22 45 P0.15
P0.4/SCK P0.15
P0.5/MISO 23 46 P0.16
P0.5/MISO P0.16
P0.6/MOSI 24 47 P0.17/TRST
P0.6/MOSI P0.17/TRST
RTCK 26 48 P0.18/TMS
RTCK P0.18/TMS
DBG 27 1 P0.19/TCK
DBG P0.19/TCK
P0.7/SSEL 28 2 P0.20/TDI
P0.7/SSEL P0.20/TDI
P0.8/TXD1 29
P0.8/TXD1 IC1 P0.21/TDO
3 P0.21/TDO
P0.9/RXD1 30 6 RST
P0.9/RXD1 RST
8 P0.27
P0.27
P0.22 32 9 P0.28
P0.22 P0.28
P0.23 33 10 P0.29
P0.23 P0.29
P0.24 34 13 P0.0/TXD0
P0.24 P0.0/TXD0
P0.10 35 14 P0.1/RXD0
P0.10 P0.1/RXD0
P0.11 36 15 P0.30
P0.11 P0.30 +5V
P0.12 37 16 P0.31
P0.12 LPC210x P0.31
P0.25 38 18 P0.2/SCL
P0.25 P0.2/SCL
P0.26 39 4
+3V3 P0.26 NC +3V3
42
NC NC
20 The system supports 8, 14, 20, 28 and 40 pin
P0.13 41
P0.13 NC
25 microcontrollers (comes with ATMEGA16). Each jumper,
element and pin is clearly marked on the board.
It is possible to test most industrial peripherals on the
VSS1
VSS2
VSS3
VSS4
040444 - 2 - 11a
pied, there will be a measurable cur- tion functions of a railway. This cer-
rent consumption (even if it is rela- tainly doesn’t have to spoil the fun of a
tively small). The measured signal is model railway – while you are piloting
usually sent to the Command Station a goods train through the marshalling
in the form of a binary signal. yard just like a real engine driver, the
PC ensures that no disasters occur in
• Hand controller (also called a cab other parts of the system.
controller, after the driver’s cab of
a locomotive). The hand controller • Booster. As a respectable model rail- The system supports 64-pin and 100-pin AVR
replaces the traditional rotary knob way system can consume a consider- microcontrollers (comes with ATMEGA128 working at
10MHz). Ready to go examples guarantee
on the transformer, and it also pro- ably amount of current, one or more successful use of the system. BIGAVR2 is an easy to use
Atmel AVR development system. BIGAVR2 has many
vides some extra functions, such as boosters are used to supply power features that makes your development easy. You can
choose between USB or External Power supply.
switching lights and sound effects on to the track. If several boosters are BIGAVR2 also supports Character LCD as well as
and off. Each controller can control its used, they are all driven from the same Graphic LCD. Touch screen controller with connector is
available on board.
own locomotive, but it is also possible Command Station. In this case, each Add-On Boards
to operate several locomotives with a booster supplies power to a portion of A wide range of additional daughter-boards
for development systems
single controller. the track system.
5V-3.3VReg Board -
handle the entire control and protec- here is called XpressNET, which is a Accel. Board - This regulator can provide
Accel. is an electronic device local on-card regulation
polled single-master EIA 485 bus. A that measures acceleration
forces .
changing your voltage from
AC/DC 8-16V to 5V or 3.3V.
link to the occupancy feedback detec-
tors is also essential. A separate bus Please visit our web page for more info
Figure 2a. Schematic diagram of the DCC Command Station.
http://www.mikroe.com
The ARM module is fitted onto connectors K1 and K2. can be used for this purpose, but in
9/2008 - elektor 37
projects model train control
Example:
An order for setting the direction of travel and the speed (in 28 individual steps) is constructed as follows:
A bit stream for setting locomotive number 83 to forward motion with a speed of 0 thus takes the form:
1 11 1 1 1 11 1 1 11 0 0 0 1 1 0 111 0 0 11 1 0 1 0 0 0 0 1 0 0 0 0 11 1
Preamble Address Data Byte Instruction Data Byte Error Detection Data Byte
Packet Start Bit Data Byte Start Bit Data Byte Start Bit Packet End Bit
070989 - 13
A complete description of the standard, including a summary of all the instructions, is available at the NMRA website (www.nmra.org) on the
DCC working group activities page
practice these devices sometimes Schematic diagram compatible serial ports, two versatile
share the cab bus. We decided to use 16-bit timers, an I2C interface, and an
a separate bus for this in our design: The circuit shown in Figure 2 is built SPI interface. A maximum of 32 I/O
the S88 bus. around an LPC2106. This is a powerful lines are available for connection to the
16/32-bit NXP microcontroller based on outside world.
Finally, there is the link to the com- an ARM7TDMI-S processor core with
puter, which in this case is an RS232 a maximum clock rate of 60 MHz. The The microcontroller is shown in the
port. Thanks to the use of an open pro- microcontroller has 128 kB of flash middle of the schematic diagram in
tocol that is supported by a variety EEPROM and 64 kB of RAM, which are the form of a separate daughterboard,
of software packages, expansion is more than adequate for quite a few which some readers will certainly find
problem-free. projects. There are also two 16C550- familiar. This board (o/n 040444-1) was
38 elektor - 9/2008
mikroElektronika
Advertentie
DEVELOPMENT TOOLS | COMPILERS | BOOKS
has a pin for a short-circuit feedback twice their forward voltage drop. Two Add-On Boards
A wide range of additional daughter-boards
signal. If the signal on pin 1 is pulled diodes connected in series are used for development systems
to ground (by the booster), the control here to ensure that T1 can be driven
unit will disable the output. into conduction at a suitable level. R11
The connectors for the hand control- and C4 form a low-pass filter that sup-
lers, which are driven via XpressNET, presses noise pulses. The LED in opto-
are located at the right. The hardware coupler IC7 is driven by the signal on
is a standard EIA 485 port implemen- the collector of T1. The collector cur- Digital POT - MCP41010 SPI CAN-1 Board -
tation. Driver IC8 (LTC1485) provides rent, and thus the current through the Interfaced digital
potentiometer.
Interfaces CAN via MCP2551.
CANSPI Board -
the signal shaping. Resistor R8 ensures LED, is determined by resistor R15. SmartMP3 Board - VS1001k Makes CAN network with SPI
MP3 decoder with SPI interface.
that the line is terminated properly. The optocoupler (which provides elec- Interface.
RS485 Board -
Although this is not especially criti- trical isolation from the traction volt- Serial 7-seg Display 2 Board
- MAX7219 SPI Interfaced,
Connects devices into RS-485
network
cal at the data rate used here, it’s bet- age) supplies the ack pulses to the LED Display Drivers with 8
Common-Cathode LED Serial Ethernet -
ter to be safe than sorry. Resistors R7 microcontroller. Displays Make ethernet network with
SPI Interface (ENC28J60).
LightToFreq Board -
and R10 hold the Transmit and Receive TSL230BR programmable
light-to-frequency converter.
lines in a defined state when they are Connector K11 is used for the JTAG
not being driven by a device on the port. S1 is reset button. If you want Please visit our web page for more info
http://www.mikroe.com
bus. This prevents the receivers from to develop your own software for this
9/2008 - elektor 39
projects model train control
S1
JP2 JP1
R2 R3 R1 R6 RE2 K14
IC5 R21R19 D11
1
2
T3
K11
R17
C11 C12
IC4
R20 R18
D10 RE1 K13
T2
C13 C10
19
20
R15
C9 R13 R12
C15 T1 C14 D8 D9
R11
D6 D7
D5
R16
K15
IC8 K2 K1 IC7 R9 C8
R22
IC6
C7 C5
C6 C4 R7
C3
IC3
D4 D1 R10
D3 R8
D2
IC1
K10 K7
K9 K6
IC2 C1
C2
C
K5
5 1
K8 R4 R5
R14
9 6 K4 K3 K12
Figure 3. The PCB is designed with a spacious layout to make assembly easy.
project and you have the right tools, A standard model train transformer is +12 V and then to +5 V. The 12-V sup-
you can use this port for downloading not especially suitable for this purpose, ply voltage is used directly to power
and debugging the program code. It is since it has a slightly higher output the two relays and the hand control-
not used during normal operation in voltage (14–16 VAC), which will cause lers connected to the XpressNET bus.
and around a model railway. IC4 to become rather warm. The trans- The +5-V supply voltage powers the
The circuit is powered by a transformer former voltage is full-wave rectified by microcontroller and its peripheral
with a secondary voltage of 13 to 14 V a set of four diodes, and the DC volt- logic. Four ceramic capacitors provide
connected to K8. A transformer rated age is smoothed by C9. This voltage effective suppression of undesirable
at 16 to 20 VA is more than adequate. is then reduced in two stages, first to oscillations.
40 elektor - 9/2008
mikroElektronika
Advertentie
DEVELOPMENT TOOLS | COMPILERS | BOOKS
With useful implemented peripherals, plentiful practical
code examples and a broad set of add-on boards,
The circuitry around IC2 and IC3 is bear the brunt of any inadvertent short mikroElektronika development boards make fast and
used to read the data from the S88 circuit, and you can replace them eas- reliable tools that can satisfy the needs of experienced
engineers and beginners alike.
feedback detectors. The S88 bus is ily if they are fitted in sockets.
designed as a giant shift register com- The following components are
posed of the S/R flip-flops of the indi- optional:
vidual feedback detectors, which reg-
ister their ‘occupied/free’ status until • JP1 and K11 can be omitted if you
they have been read out serially. Most do not intend to use the JTAG
of this work is done by software run- interface.
ning in the microcontroller. The con-
tribution of the hardware to this proc- • For K7/K8 and K9/K10, fit only the
ess is limited to buffering the control connector or connectors that you
signals. IC3 buffers the outgoing sig- personally prefer. All four of these
nals (Clk, Load, and Reset), while IC2 connectors are wired in parallel.
buffers the incoming signal (Data).
The serial data is clocked in at rate
of 5 kHz. With the maximum number
Initial use and testing
of detectors that can be connected to Connect the transformer to K8 and Thanks to many features UNI-DS3 is the world's easiest
to use development board for different types of
the bus (4096 inputs), this means that switch on the mains voltage. Check microcontrollers. The system supports PIC, dsPIC, AVR,
a full set of inputs can be read 10 times the +5-V supply voltage (e.g. between 8051, ARM and PSoC microcontrollers with a large
number of peripherals. In order to continue working with
each second. pins 5 and 8 of IC6) and the +3.3-V different chip in the same development environment, you
just need to switch a card. You can choose between USB
This all works as follows: supply voltage (e.g. between pins 15 or External Power supply. Each MCU card has its own
USB 2.0 programmer!
and 16 of IC1).
• Data supplied to the feedback detec-
tors in parallel format is loaded from The next step is to download the appli-
the S/R flip-flops into the shift regis- cation code to the DCC Command Sta-
ter by setting the Load signal high tion. You can use a standard NXP tool
and issuing a clock pulse on the Clk for this (LPC2000 Flash ISP Utility).
line. This tool enables you to download
• The S/R flip-flops are reset by set- code to the processor via the PC serial
ting Reset High, after which they are port. The instructions for using this
ready to register new data. tool are described in detail in the sup-
• The microcontroller then reads in plementary information for this article
the serial data by issuing a series of on the Elektor website. You can also
clock pulses on the Clk line. download the hex code for program-
ming the processor from the website.
These signals are output by a 6-way Alternatively, if you buy the Elektor kit
connector (K3). The +5-V supply volt- for this project you will receive a pre-
age on this connector is used to power programmed module.
the connected feedback detectors.
Finally, there is one more connector When the Command Station is Minimize your time from prototype to final product by
using the market-proven PICPLC16B development
(K15) at the bottom left of the drawing. started up the first time, it reconfig- board. PICPLC16B is a system designed for controlling
industrial systems and machines. 16 inputs with
It supports an alternative bus for the ures the non-volatile data stored in optocouplers and 16 relays (up to 10A) can satisfy most
hand controllers and feedback detec- the EEPROM. This can take a while industrial needs. The ultra fast mikroICD (In-circuit
Debugger) enables very efficient debugging and very fast
tors. Stay tuned for more information (around 20 seconds), so you can take prototype development. Features: RS485, RS232, Serial
Ethernet, USB 2.0 programmer and mikroICD (In-Circuit
about this. a short break before continuing with Debugger) are available on-board.
the next step. Add-On Boards
A wide range of additional daughter-boards
PCB assembly Now connect a pushbutton with a
for development systems
The PCB layout for the Command Sta- make contact (normally-open) between
tion is shown in Figure 3. Assembling the two pins of K12. This is the Stop /
the board is quite straightforward, as Go / Cold Start button.
there are no components that require If you press this button, relay RE2
special attention. If you allow yourself should engage so the digital signal for
CF Board - EasyConnect Board -
sufficient time and work attentively, driving the booster is present on con- Easy way to use Compact Connects your peripherals
flash in your design. easily and fast using
you are bound to achieve a good result. nector K4. Now the DCC Command connectors.
MMC/SD Board -
Fit the low-profile components first, fol- Station is ready for normal operation. Easy way to use MMC and
SD cards in your design.
IrDA2 Board -
Irda2 serves as wireless
lowed by the high-profile components. If you press the button again, relay EEPROM Board -
RS232 communication
between two MCU’s.
As the final step, solder the electrolytic RE2 is released, and the digital signal Serial EEPROM board via
I2C interface. Port Expander Board -
MCP23S17 is the 16-bit port
capacitor, IC4 and IC5 with their heat is no longer routed to K4. RTC Board - expander with SPI interface.
PCF8583 RTC with battery
sinks, and relays RE1 and RE2. backup. EasyInput Board - Make input
levels easy and fast using high
You can also use the pushbutton to quality DIP switch.
It is advisable to fit IC1, IC2, IC3 and perform a system reset. If the Com-
IC6 in sockets, since they provide the mand Station stops responding, even Please visit our web page for more info
http://www.mikroe.com
interfaces to the outside world. They after the supply voltage is interrupted,
9/2008 - elektor 41
projects model train control
Control software Figure 4. Fully assembled prototype with the ARMee module installed.
Various programs are available for
using the Command Station described
here with a PC to control a model
railway system. There is a very nice Web Links
‘native Dutch’ program available DCC: www.nmra.org/standards
called ‘Koploper’, which is entirely free XpressNET: www.lenz.com
(www.pahasoft.nl). It is supported by
P50x: www.uhlenbrock.com
an active forum where users can find
answers to their questions (www. Koploper: www.pahasoft.nl
koploperforum.nl). We’re sure these PT: http://people.zeelandnet.nl/rosoft
users won’t mind the odd question in NXP: www.nxp.com
English.
You can use the ‘PT’ program (also a
Dutch product) to program DCC decod-
ers. This program also provides exten-
sive functions for testing feedback About the author
detectors and accessory decoders.
After the completion of his studies in Telecommuni-
You’ll find it at http://people.zeeland-
cation & Microprocessors, Patrick Smout has been
net.nl/rosoft. actively involved in electronics product development
You can also use ADaPT (Advanced (hardware and software) since 1985. In recent years
Driving and Programming Tool) from his focus has moved away form hands-on engineer-
STP Software (www.stp-software.at) to ing, and he is now the coordinator of the develop-
program decoders. Although this soft- ment department.
ware (available in English and German His first electronic construction projects included the
versions) is not free, it can also be used Elektor Junior Computer and all of its subsequently
for locomotive management. published extensions. These were complemented by
Of course, you can also take on the chal- DIY extensions, such as a graphics card.
lenge of writing your own software. A His hobbies are model trains and (naturally) electron-
sample program for Microsoft Visual Stu- ics and embedded software.
dio Express 2008 is available and can
According to Patrick, the nicest thing about this pro-
be downloaded free of charge from the
fession is seeing how a design slowly comes to life,
project page on the Elektor website. right from the incipient stage, and then watching it
Let us and other readers know how travel around the world as a full-fledged product.
you get on — a simple message in the
Elektor forum does the trick.
(070989-I)
E-mail: dcccommandstation@versateladsl.be
42 elektor - 9/2008
tel. 01298 70012
fax. 01298 70046
www.peakelec.co.uk
sales@peakelec.co.uk
Handheld Test Gear - Cool, Smart.
Atlas DCA
£5 Atlas ESR
£8
5 5
9/2008 - elektor 43
projects led lighting
Having treated himself to a new bicycle fitted out with all mod cons including a shiny hub dynamo,
the author was looking forward to many miles of pedalling pleasure. But then disaster struck: after
just a couple of hours use the bulb in the front light burned out! Not finding the prospect of repeated
replacement attractive, he set out to substitute a power LED for the bulb.
Figure 1. A suppression diode is wired in parallel with the filament lamp in the front bicycle light. Figure 2. The voltage waveform from a hub dynamo is far from sinusoidal.
44 elektor - 9/2008
Light
increases linearly with applied volt-
age rather than exponentially, and so
are more resilient to excessive volt-
ages than bulbs.
Overture
The author had previously experi-
mented with white power LEDs for
bicycle lighting. At that time only 1 W
devices were available, and, when
used with a rim dynamo, the LED
was not bright enough. Despite its
higher efficiency the 1 W LED was
not as bright as a 2.4 W filament bulb,
although the whiter light was dis-
tinctly more noticeable and lifetime
was of course better.
L1
5 4
VIN VSW
100µH
IC1 R2
LT1076CT
560 Ω
Dynamo
D2 D1 2 1
VC FB
B1 Dynamo
R2 3 P1
6V C3 LED1
C2
3W
3Ω3
1k
6V(12V*)
C1 3W(6W*) 10n 3W
470µ
2W D4 D3 R1
C1 D5 R3 16V
B40C1500 LED1
2k7
1000µ
1k8
16V
1000µ 16V
3W
080153 - 11
D1...D5 = SB540 080153 - 12
Figure 3. The first experimental circuit for using a 3 W LED in Figure 4. This final circuit for the bicycle light gets the maximum possible illumination from the 3 W LED.
a bicycle light.
9/2008 - elektor 45
projects led lighting
the circuit in Figure 3 we have gained ohmic resistance increases overall effi-
a meagre 0.4 W. ciency. However, the component is not
So, theoretically at least, things are particularly critical, and even a 100 µH
not looking good. However, according toroidal suppression choke will give an
to [1] hub dynamos can develop up to efficiency of over 75 %.
12 V. At 0.5 A that corresponds to a
power of 6 W.
This is more than enough: working
Act III: Construction and test
backwards from the 3 W required for The printed circuit board (Figure 5)
the LED, we divide by 80 % to obtain an makes construction straightforward.
input power to the switching regulator The layout design was done using
of 3.6 W. At 0.5 A this means a voltage Eagle, and the design files and a PDF
of 7.2 V. Adding on the 0.8 V dropped of the layout are available for download
Figure 6. Very compact prototype of the switching regulator. by a Schottky rectifier bridge, and we from http://www.elektor.com. If IC1 is
need 8 V at the output of the dynamo, to be mounted flat against the board its
which is well within its capabilities. pins must be bent accurately. A small
LED with as little power loss as possi- The switching regulator gives us a heatsink made from a piece of alumin-
ble, with a corresponding increase in further advantage: it protects the LED ium angle (Figure 6) is adequate. IC1
current to 700 mA. from excessive current and, above a dissipates a maximum of 0.5 W, so it
At such low voltages an ordinary certain dynamo speed, ensures that is also possible to solder the M3 fixing
step-down converter will operate at the light output provided is constant. nut to the copper pad on the reverse
an efficiency of around 80 %. Rectify- side of the board.
ing the AC voltage from the dynamo The coil suggested in the parts list is a
using a bridge consisting of Schottky
Act II: The circuit low-cost SMD component to which two
diodes will cost a voltage drop of twice Figure 4 shows a type LT1076 step- lengths of wire need to be carefully sol-
0.4 V, giving an additional power loss down converter [3]. The device requires dered. The printed circuit board also
of 0.4 W at 0.5 A. Allowing 0.1 W for a minimal number of external compo- has pads for other package varieties.
the rear LED light leaves us with just nents and draws only 8.5 mA to power After populating the board and check-
2.5 W; 80 % of that is 2 W. Compared to its internal circuitry. It operates at ing over the soldering, the circuit can
100 kHz, can start up from an input volt-
age of 3.5 V and can deliver up to 2 A.
D1 to D4 form the bridge rectifier, and
D5 is the flyback diode. At 5 A the
SB540 is somewhat overspecified for
this application; at 0.5 A the diode only
drops 0.33 V. Good 1 A Schottky diodes
such as the SB140 can be substituted
for D1 to D5, with a resulting drop in
overall efficiency of around 2 %.
The RC network comprising R1 and C2
connected to pin 2 of IC1 provides fre-
quency compensation. The regulator
compares the voltage on pin 1 with its
internal reference (2.21 V), and so the
adjustable voltage divider comprising
R2, P1 and R3 allows the output volt-
Figure 7. The LED (mounted on its carrier board) and lens are age to be adjusted from 2.7 V to 4 V. Figure 8. The module from behind: the four plastic lugs of the
bolted to a piece of aluminium angle to make the lighting L1 is a fixed 100 µH inductor designed lens are melted slightly to secure them and the LED is isolated
module. for operation at 100 kHz and 1 A. A low using plastic washers and fixed using M3 locknuts.
46 elektor - 9/2008
be connected to a bench supply or if you look directly into it. The module by putting a meter in series with the
mains adaptor capable of delivering can be built into the old bicycle lamp LED the resistance of the meter will
9 V to 12 V at 0.5 A or more. The output enclosure with the filament bulb and significantly affect accuracy, and so
is loaded using a 4 W 4.7 Ω resistor. It suppressor removed. Figure 9 shows instead we connect the LED module
should be possible to adjust the output the author’s prototype where, with a directly to the output and measure the
voltage over the range given above and judicious bit of filing, he managed to input current. Starting at the bottom
IC1 should become gently warm to the attach the module to the inside of the of the adjustment range (P1 set to the
touch. With 10 V at the input and 3.75 V original lens in the lamp. The electron- far left position) we gradually adjust it
across the 4.7 Ω resistor the overall effi- ics can be mounted in a separate plas- until the input current is 0.4 A at 10 V,
ciency of the circuit should be about tic enclosure. for a total input power of 4 W. Since the
75 %: 4 W in and overall efficiency
3 W out. of the circuit is
Before turning the Never look directly into a approximately
circuit off, adjust power LED when it is on! 75 %, this means
P1 to obtain the that the power
minimum output delivered to the
voltage so that when the LED is con- LED is approximately 3 watts. If a 12 V
nected it is not immediately overloaded Finale: Adjustment input, for example from a mains adap-
when the circuit is switched back on. As explained in the text box, the volt- tor, is used the corresponding input
Before wiring up the power LED it, and age across the power LED needs to be current is 0.33 A. The forward voltage
the printed circuit board on which it is adjusted so that the correct current of the LED falls with increasing tem-
mounted, should be bolted to a length (approximately 0.7 A) flows through it. perature, and so the current though
of aluminium angle (not forgetting a For maximum LED lifetime (over 20,000 it will rise. P1 will therefore need to
dash of thermally conductive paste). hours) it is essential that this value is be adjusted several times until, after
It is best if the lens is also fixed to the not exceeded. With adequate cooling, perhaps five minutes, thermal equi-
aluminium angle. This makes a com- however, some devices can be run at librium is reached. The adjustment is
pact lamp module (see Figure 7 and up to 1 A. then complete.
Figure 8) which has the advantage of The adjustment is straightforward. If Warning: never look directly into the
not immediately damaging your retina we try to measure the current directly LED. The LED also gets hot!
Advertisement
9/2008 - elektor 47
projects led lighting
Encore! destroyed. It is therefore recommended ter again than an ordinary light with a
At low road speeds a hub dynamo to use an off the shelf LED-based rear blown filament!
delivers a low frequency AC voltage. light as well. (080153)
At 5 km/h the LED blinks, becoming
steady as the speed rises to 10 km/h. The attitude of the governments of
The circuit has not been tested with some European countries towards our Links and References
rim or other types of dynamo. efforts to equip our bicycles with bright [1] Hub dynamo laboratory test:
With a bit more pedalling effort (at and reliable lamps is hardly what one www.vintagebicyclepress.com/VBQgenerator.pdf
speeds of over 30 km/h) the voltage might call ‘enlightened’: in the author’s [2] P6KE7.5CA data sheet:
from the dynamo, without suppres- home country the law specifies the use www.fairchildsemi.com/ds/
sor diode, can reach 12 V. This will not of filament bulbs in bicycle lights, not- P6%2FP6KE7V5CA.pdf
cause any problems for the LED, which withstanding the fact that a brightly- [3] LT1076 data sheet:
is protected by the circuit; however, if shining home-made light is a definite www.linear.com/pc/downloadDocument.do?n
an ordinary 6 V 0.6 W filament bulb is improvement on an off-the-shelf regu- avId=H0,C1,C1003,C1042,C1033,
used in the rear light it will soon be lation-compliant light, and much bet- P1007,D2659
Light show There are good reasons for operating LEDs at a constant current rather
than at a constant voltage. A typical differential resistance for an LED
The power LED is the most important component in this circuit. The of the kind used in this project might be as low as 0.2 Ω, which means
photographs show sample devices from three manufacturers, all offer- that a voltage step of 20 mV gives rise to a current step of 0.1 A. Now,
ing efficiencies of between 90 lm/W and 110 lm/W, around the same 20 mV is not a large quantity, and the sharp temperature depend-
as a good fluorescent light. Cheaper, but decidedly inferior, 3 W LEDs ence of the LED’s forward voltage means that a temperature change of
are also available on the market, but purchasing these is a false econ- 10 °C could easily lead to a current change of more than 0.1 A.
omy. It is also best to avoid the ‘warm white’ variants, which have lower Unfortunately most switching regulator ICs are designed for constant
efficiency. The devices shown come mounted on a small printed circuit voltage rather than constant current operation. The internal reference
board which includes an aluminium slug that simplifies extracting heat. voltage of the IC used here is 2.21 V, which is too large to allow the
When run at 3 W some 2 W is dissipated as heat and a power LED not construction of a simple current feedback loop using a series sense re-
equipped with cooling will have rather a short life. sistor: at 0.75 A the power dissipated in the sense resistor would be in
This 3 W power LED from Cree is also an attractive piece of The Luxeon Rebel is particularly small and is mounted on a The Seoul Z-LED is encapsulated not in hard plastic but in a
electronics in its own right. ceramic substrate. silicone resin which offers long-term resistance to dulling.
48 elektor - 9/2008
Electronics Engineers - Join A Winning Team!
UK, Europe and Middle East
The Lektronix Group of Companies are the worlds leading provider of
Industrial Automation repairs with an enviable reputation for the best in
technical excellence and customer service.
Due to the huge demand for our services, and our future expansion plans,
we need to employ additional engineers at all our workshops to keep pace
with the additional work we are receiving.
• Walsall, UK • Bridgend, UK
• Newry, Northern Ireland • Katowice, Poland
• Brno, Czech Republic • Dubai, UAE
9/2008 - elektor 49
projects microcontrollers
Light as Air
Using the ATM18 to control
a magnet levitation device
Udo Jürß and Wolfgang Rudolph
Overcoming gravity is an age-old dream, which we can’t expect to see fulfilled anytime soon.
However, we can come closer to making it reality on a small scale. Commercial
levitation devices that cause a small piece of metal – often with some sort of
covering – to hover in the air have been available for many years. A coil provides
the lifting force, and a light barrier is used to regulate the levitation height. This
causes the levitated metal object to maintain a defined distance from the core of
the coil. Many of these devices are more expensive than need be.
We also want to make something hover, but here we take a slightly different
approach. Instead of a light barrier, we use a Hall sensor to detect the position of
the levitated object.
50 elektor - 9/2008
With the usual levitation devices,
which have already been described in The ATM18 project on Computer:club2
DIY articles in past issues of Elektor,
the beam of a light barrier is more or aTM18 was developed jointly by Elektor and Computer:club2 (www.cczwei.de) with contribu-
tions from Udo Jürss, the main developer of www.microdrones.de.
less obstructed by the ‘floating’ ob-
ject. The amount of light received by Each month, the latest developments and applications of the ATM18 system are presented by
the sensor of the light barrier is used Wolfgang Rudolph of CC2-TV in a TV broadcast on the German NRW-TV network. The levita-
to control the amount of current flow- tion controller with the ATM18-AVR board described in this article can be seen in instalment
12 of CC2-tv, initially broadcast on 26 June.
ing through the coil. The mechanical
and electronic construction of the de- CC2-TV is also broadcast as a Livestream on the Internet at www.nrw.tv/home/cc2.
vice is designed to maintain the lev- CC2-TV Podcasts are available from www.cczwei.de and — a few days later — from seven-
itated metal object in the prescribed load.de
position. Distance control using a Hall
sensor is based on a completely differ-
ent principle.
VDD
Controller the coil to keep the magnet ‘floating’ in for this ATM18 project, but instead
If we bring a magnet close to the Hall the air. The current is adjusted around with software in the form of a control-
sensor with the magnetic field lines 1000 times per second. This continual ler program. Every minute departure
perpendicular to the surface of the adjustment requires certain rules. PID of the levitated magnet from its in-
sensor, the output voltage of the sen- controllers (proportional, integral and tended position, every air movement,
sor varies in proportion to the magnet- differential – see the inset) are used in every change in temperature, every
ic field strength. This makes it possible electronic systems for this purpose. vibration, and many other things can
to determine the distance between the In our case the ‘I’ component is not directly affect the levitated behaviour.
sensor and a magnet with a known necessary, so we can use a PD con- If the magnet moves a bit closer to the
field strength. With this information, troller. However, it is not implemented solenoid coil, the current in the coil
a controller can adjust the current in as an analogue circuit with opamps must be reduced immediately. If the
9/2008 - elektor 51
projects microcontrollers
coil +5V
GND
DATA
CLK
LCD 20 x 4
12V
+12V
TSOP1736
magnet
VDD Vs
HAL815UTA
GND GND
Vo
OUT 080359 - 11
magnet moves even a small distance hand, the magnetic field of the fully magnets is cannibalised CD drives. A
away from the coil, the current must energised coil must be strong enough preliminary test with the solenoid coil
be increased immediately. As the coil to lift the magnet from its lowest posi- will tell you whether a particular mag-
is connected to the PWM (pulse-width tion. This means that you have to wind net is suitable. With an applied volt-
modulated) output of the microcontrol- the right coil on the right core and use age of 12 V, the coil should be able to
ler via a UL2003, this is done by chang- a magnet that is as small and light as lift the magnet from a height of at least
ing the duty cycle. The pulses are in- possible, but also strong. And you have 3 cm, but 4 cm or more is better.
tegrated in the ferrite core and coil to to adjust the device for a suitable levi-
yield an average current level. tated distance. A ferrite rod such as is commonly
found in medium-wave radios is used
Figure 2 shows the structure of our pro- Another difficulty is that the output for the coil. It should have a diameter
totype. The Hall sensor is connected to voltage of the sensor is not propor- of 10 mm and a length of 80 to 100 mm.
ADC6. The PWM output on PD6 drives tional to the distance between the coil Don’t try to rush things when con-
one or more inputs of the ULN2003 and the magnet. Nonlinear controlled structing the coil. As you can see from
power stage. The coil is connected be- systems can lead to stability problems. Figure 3, you start by sliding a length
tween the open-collector outputs and On top of this, the magnetic field of the of heat-shrink tubing over the ferrite
+12 V. It is important to connect pin 8 lifting coil also affects the sensor. The rod (a) and shrinking it in place (b).
to K6 so the internal protection diodes severe requirements imposed by the You can also use electrician’s tape in-
in the ULN2003 can limit the induc- controlled system make the job of the stead. After this, you can start wind-
tive spikes from the coil. Pushbutton controller more difficult. Here a bit of ing the coil (c). It consists of four layers
switches S1–S3 are used to configure help in the form of damping can’t hurt. of 400 turns each, wound with 0.2-mm
the control parameters. This lets you It arises in a rather unobvious manner enamelled copper wire. You can wind
raise or lower the levitation position due to the aluminium heat sink, under the coil entirely by hand, or you can
of the magnet by up to 10 mm. Alter- which the sensor is mounted. Every use an electric drill running at a very
natively, you can use an RC5 infrared motion of the magnet creates an eddy low speed (d). After you finish wind-
remote control unit to operate the de- current in the aluminium, and this pro- ing the coil, secure both ends with
vice via an IR receiver connected to the duces an opposing magnetic field. heat-shrink tubing (e), making sure to
circuit. The parameters are constantly In this way, magnet oscillations are feed out the free ends for the leads (f).
shown on the LCD display. damped by eddy-current losses. Finally, you can fit another length of
heat-shrink tubing over the entire coil
to protect it (g).
General requirements Magnet and coil
Making a magnet hover in the air is not The magnet must be very light and If you want to avoid counting turns
a trivial task. If it comes too close to very strong. A neodymium magnet and would rather wind the coil ‘helter-
the coil, it will immediately be pulled with a mass of less than 0.3 g is quite skelter’, you can wind the ferrite rod
all the way to the coil, and the control- suitable. We used a type Q-CDM50- over a length of 50 mm with 0.2-mm
ler can’t do anything to stop it. This G from www.supermagnete.de (mass copper wire until the winding reaches
means that the coil must be mounted 0.23 g) in our various prototypes. An- a diameter of 18 mm. The coil will then
at a sufficient height. On the other other potential source of small, strong have a resistance of 40 to 50 Ω, so the
52 elektor - 9/2008
current will not exceed 300 mA with of a ‘third hand’ (soldering aid) to hold was fitted to the rod, and the coil was
a 12-V supply voltage (this only holds the coil for initial testing. This makes it clamped to the bracket. The details are
true for DC current). When the coil is easy to adjust the height to the proper shown in Figures 5a–d.
driven by the PWM output of the pro- value (Figure 4).
cessor, amplified by the ULN2003, the After the coil has been secured, you
current is pulsating DC instead of pure can connect everything to the proto-
DC. The average value of the current is
Practical aspects typing board and start your levita-
thus less, and the coil characteristic is Our prototype (see the photo at the tion tests. Two ready-made sample
similar to that with AC operation, with head of the article) was built around programs are available on the Elektor
the result that a distinctly lower cur- an aluminium heat sink with the sen- website for downloading. One of then
rent flows through the coil. sor mounted underneath. A brass rod was written in Code Vision, and the
This completes the coil. After you have was fitted to the heat sink, and the other in BASCOM.
carefully protected the leads and the wiring that conducts the current to
ends of the coil with electrician’s tape, the coil was routed along this rod in The best approach is to start with the
you can simply use the alligator clips a suitable manner. A plastic bracket C program, since it shows all the par-
PID controllers
Our objective here is to use an electromagnet to attract a permanent magnet exactly enough to levitate it at a particular height. As the magnet le-
vitation system is an unstable, nonlinear controlled system, it must be stabilised as well as regulated. We use a PD controller for this purpose. The
task of a closed-loop controller is to continually and independently control a physical quantity in order to maintain a specified setpoint value – in
our case the magnet position – and eliminate the effects of disturbances. For this purpose, the controller constantly compares the actual value (the
position of the magnet) with the setpoint value (the desired position of the magnet). The control error determined in this manner is used to gene-
rate the control output, which acts to minimise the control error when the control loop is in balance. However, it takes a certain amount of time for
a system of this sort to respond and for the control output to take effect, and for this reason it must overreact at first and then underreact imme-
diately afterward in order to avoid overcompensation that would cause control failure. This requires the control output to have a damping effect,
depending on the system characteristics. The behaviour of the controller is described by differential equations.
The magnitude of the P component varies in proportion to the control error (difference between the actual value and the setpoint value). This only
affects the proportional gain factor.
The D branch of a controller is a differentiator that must always act together with the P component (or the I component). The D component arises
from variations in the control error over time and is multiplied by the integral action time. It does not depend on the control error, but instead on
the rate of change. A large integral action time cause a large change in the control output and often causes instability in the control loop.
An integral component is used when the control error must reduced to zero (or as close to zero as possible). It is not used here because the levita-
tion device always works with a control error and only the control gain is adjusted. The slope of the control curve decreases as the distance from
the sensor increases, which is offset by increased gain. This compensates for the nonlinear characteristic of the controlled system.
9/2008 - elektor 53
projects microcontrollers
Actuator
MLC in C Here the actuator for the controlled sys-
The C program for the magnet levi- tem is the electromagnet in the form of
tation controller (MLC) is very large a ferrite-core coil. A PWM signal with
g
and can only be described here in a pulse rate of 32 kHz drives the power
general terms. stage (ULN2003). The coil is switched
to ground. Thanks to the high PWM
Figure 3. Coil construction stages: ferrite rod with heat-shrink frequency and the large inductance of
tubing (a) shrunk onto the ferrite rod (b); start of coil the coil, the coil current is strongly fil-
winding (c); fully wound coil (d); coil ends covered with heat- tered (integrated). This yields a con-
shrink tubing (e) and with the leads fed out (f); finished coil stant magnetic field with a low ripple
covered with heat-shrink tubing (g). component.
54 elektor - 9/2008
a b
Figure 5. Details of the prototype assembly: (a)base plate (aluminium heat sink), (b)Hall sensor, (c)brass rod with coil leads, (d)coil bracket with cable ties.
c d
Display output the control loop the magnet exactly above the sensor
To avoid reducing the control frequen- 5. Start the next control cycle by positioning it to obtain maximum
cy as a result of time-consuming dis- at step 1 coil current.
play outputs, the outputs are divided
into many individual jobs. The function RC5 control The controller performs its calculations
‘mlc_write_lcd()’ uses a state machine With an IR receiver connected, you can with real numbers (single precision).
to perform a single display output in use an RC5 infrared remote control unit Here again the actual value is obtained
each control cycle. to operate the device remotely. Button by averaging eight individual readings.
1 increases the P value, while button 4 The controller can only use the range
Control process decreases it. Button 3 increases the D between 512 and 1023. The lower the
After the individual modules have been value, while button 6 decreases it. In ad- magnet position, the higher the meas-
initialised, the same process is ex- dition, button 0 acts an emergency stop ured value. The measured value is mul-
ecuted repeatedly in an endless loop: and causes the P value to be set to 0. tiplied by the P factor to yield the set-
ting for the PWM value. The system
1. Update the control loop: would also work without a D compo-
mlc_update(); // Update magnet
BASCOM example nent, but the motion is damped if this
levitation control The Basic program (see listing) has in- component is added. If the magnet ris-
2. LC display output: tentionally been kept simple, so it does es quickly, the controller anticipates an
mlc_write_lcd(); // Do a single not include the LCD and remote control imminent overshoot and reduces the
LCD operation functions. Only the P factor (and thus current accordingly.
3. Scan control parameter buttons: the effective levitation height) can be (080359-I)
mlc_scan_buttons(); // Check the adjusted using the S1 and S2 buttons.
Kp and Kd pushbuttons When the program is started, P is as- Assembly note
4. Synchronise with A/D converter: signed the value 0.1 to provide a cer- A parts kit with a ferrite rod, HAL815 and
while (!adc_ready) // Synchronise tain amount of gain so you can place magnet is available from www.elektor.com.
9/2008 - elektor 55
projects microcontrollers
Part 1
Burkhard Kainka
The AVR series of microcontrollers from Atmel are very popular. Many projects already
featured in Elektor have an ATmega beating away at their heart. In this mini course we
turn the spotlight onto software development for these controllers. BASCOM is an ideal
programming language for the newcomer; it has a steep learning curve ensuring that your
path to success (and a working prototype) is reassuringly short.
The ATmega controller and BASCOM together make a piece of perfboard. It also makes little difference whether
strong team! Whatever application you have in mind, con- you choose a Mega8, Mega88 or even the larger Mega16
trollers from the ATmega range are sure to have the majority or Mega32. They all basically have the same core; the
of the necessary peripheral hardware already integrated main differences are in the number of port pins and the
on-board: ports, timer, A/D converter, PWM output, and amount of internal memory space. In this first instalment
UART are all standard together with a choice of RAM, ROM of the course we look at the controller’s UART and A/D
and EEPROM size. BASCOM is one of the easier languages converter.
to use and makes interfacing to peripherals using LCDs,
RC5 and I2C a simple task requiring very few instructions.
There is a good range of development hardware for this The serial interface
microcontroller family. The STK500 from Atmel or the Elektor All of the ATmega series have a built-in serial interface
CC2 ATM18 AVR board [1] are both suitable platforms for (UART) using pins RXD (PD0) and TXD (PD1). The signals
this course. Alternatively there is no reason why you should are TTL compatible so it is necessary to add an RS232
not experiment with your own homebrew design built on a interface buffer such as the MAX232 to implement a true
56 elektor - 9/2008
RS232 interface. These buffers are already implemented
on the Atmel STK500 development system. A suitable serial
to USB Adapter can be connected directly to the Elektor
ATM18 AVR board for serial communication [2]. The PC
will need to be running a terminal emulator program before TXD RXD, PD0
9/2008 - elektor 57
projects microcontrollers
58 elektor - 9/2008
4XDVDU(OHFWURQLFV/LPLWHG 3RVWDJH 3DFNLQJ2SWLRQV8SWR.JJURVVZHLJKW8.6WDQGDUG
32%R[%LVKRSV6WRUWIRUG 'D\'HOLYHU\
8.0DLQODQG1H[W'D\'HOLYHU\
(XURSH(8
5HVWRI:RUOG
XSWR.J
&0:38QLWHG.LQJGRP
2UGHURQOLQHIRUUHGXFHGSULFH8.3RVWDJH
7HO :HDFFHSWDOOPDMRUFUHGLWGHELWFDUGV0DNHFKHTXHV32¶VSD\DEOH
)D[ WR4XDVDU(OHFWURQLFV3ULFHVLQFOXGH9$7
(PDLOVDOHV#TXDVDUHOHFWURQLFVFRP 3OHDVHYLVLWRXURQOLQHVKRSQRZIRUGHWDLOVRIRYHUNLWV
:HEZZZ4XDVDU(OHFWURQLFVFRP SURMHFWVPRGXOHVDQGSXEOLFDWLRQV'LVFRXQWVIRUEXONTXDQWLWLHV
&UHGLW&DUG
6DOHV
7KH(OHFWURQLF.LW6SHFLDOLVWV6LQFH
7KH(OHFWURQLF.LW6SHFLDOLVWV6LQFH
,QIUDUHG5&5HOD\%RDUG
0RWRU'ULYHUV&RQWUROOHUV &RQWUROOHUV /RJJHUV ,QGLYLGXDOO\FRQWURORQ
ERDUGUHOD\VZLWKLQFOXGHG
+HUHDUHMXVWDIHZRIRXUFRQWUROOHUDQG +HUHDUHMXVWDIHZRIWKHFRQWUROOHUDQG LQIUDUHGUHPRWHFRQWUROXQLW
GULYHUPRGXOHVIRU$&'&8QLSRODU%LSRODU GDWDDFTXLVLWLRQDQGFRQWUROXQLWVZHKDYH 7RJJOHRUPRPHQWDU\P
VWHSSHUPRWRUVDQGVHUYRPRWRUV6HH 6HHZHEVLWHIRUIXOOGHWDLOV6XLWDEOH368 UDQJH[PP6XSSO\9GF$
ZHEVLWHIRUIXOOUDQJHDQG3GHWDLOV IRUDOOXQLWV2UGHU&RGH368
.LW2UGHU&RGH.7
$VVHPEOHG2UGHU&RGH$6
&RPSXWHU&RQWUROOHG6WDQGDORQH8QLSR &K6HULDO,VRODWHG,25HOD\0RGXOH
ODU6WHSSHU0RWRU'ULYHU &RPSXWHUFRQWUROOHG
'ULYHVDQ\9GFRU FKDQQHOUHOD\ERDUG$ 3,& $70(/3URJUDPPHUV
OHDGXQLSRODUVWHSSHU PDLQVUDWHGUHOD\RXWSXWV
Laser projectors are often used for light mended, in principle, because of safety used to turn the laser on and off. An
effects at, for example, places of enter- considerations. RS232 interface is added so that an
tainment. These generally use power- LCD and keyboard interface are not
ful laser beams which generate strik- You can also use a single laser diode. required.
ing light patterns. These types of laser But you will need a so-called collimator The HyperTerminal program that is
projectors are not cheap however and to obtain a parallel light beam. part of any standard Windows installa-
even the individual parts such as laser tion can be used to communicate with
modules and fast servos are not really the projector. The correct port settings
that attractive either, considering their
Controller are 9600 baud, 8 bits, 1 stop bit, no par-
price. The alternative then, naturally, is The heart of the control system (see ity and no flow control.
to make your own. Figure 1) is an ATmega88 controller.
Although it would be possible to drive The schematic for the laser controller
the servos with a purely analogue sys- shows that the laser is driven with a
Laser diodes and modules tem, from a music source for example, constant current. Ri defines the laser
Through eBay and the like, laser point- using a microcontroller offers addi- current and the quiescent current can
ers and modules are frequently on offer tional possibilities such as the projec- be set with P1. This is sometimes bet-
for less than 10 pounds. These are typi- tion of text. ter because laser diodes start to work
cally red lasers with a power of less at a certain threshold current but only
than 5 mW. This is more than enough Analogue signals are required to drive produce optimal light when operating
to project something indoors during the servos. We generate these with at a certain temperature. By setting the
the day and outdoors at night up to two PWM DACs (X-Servo and Y-Servo). idle current just under the threshold
a distance of about 100 metres. More The 78 kHz PWM frequency is strongly current the light output is increased
powerful lasers, such as green lasers suppressed with a four-stage RC-filter. when used as a projector.
rated at 30 mW, can be used outdoors The two ADC inputs (X-in and Y-in) On pin 6 of the controller there is also
during the day over hundreds of meters allow for analogue control, for use as an output called ‘TTL optional’. This is
and at night over several kilometres. a XYZ-plotter and an X-T oscilloscope. because some laser modules are sup-
Using this type of laser is not recom- The Z-input (with internal pull-up) is plied with a control PCB which has a
60 elektor - 6/2008
ds of Metres
ALWAYS BE VERY CAREFUL WHEN WORKING
WITH LASER TYPES III-A AND III-B AND GREEN
DPSS LASERS. LOOKING INTO THE BEAM CAN
PERMANENTLY DAMAGE YOUR RETINA!
+12...15V 78L05
Laser modules, such as the ones used
2A T 1N4001
in laser pointers, often have a photo
diode which is used to control the 1000µ 100n 10µ
25V 12V
laser current. These common mod-
22k
1N4148
ules are usually intended for 3 V bat-
4k7
tery operation. If you measure the cur- P1
22k
LASER
this to determine what the value for Ri 1N4148 10k
1N4148 Y-in
22k
1N4148
X-in
1N4148
4k7
Ri
BD135
The servos Ri(K) =
3.5
BD137
BD139 20 1 7
22k
I LASER (mA) AVCC R VCC
Making your own servos that are rea- +5V
ADC0/PC0
23 1N4148 Z-in
24
sonably fast is not all that difficult. 1µ
6
PD4
ADC1/PC1
PC2
25
16V
tray, but sometimes a CD/DVD drive SUB D9
V-
6
20MHz
1µ
contains multiple motors of the same 22p 22p 100n 4n7 4n7 4n7 4n7
type. 16V
4n7
5
1
2 3 1
a lot of friction and is not very accu- 3
Id
PD LD
47k
R=
Id 2
1000µ case
The magnet is an especially powerful 25V
6/2008 - elektor 61
projects modding & tweaking
tional refraction and means that the DC motor side view top view
071141 - 13
angle of incidence is always equal to
the angle of reflection. This ensures
that the laser beam remains nice and
Figure 2. This figure shows how the mirror is attached to the servo shaft and how the angle sensor is constructed.
focussed after reflection. First surface
mirrors can often be found in older
(laser) printers/scanners/bar code
readers and can be cut to size reason- mounting screws. Make sure that the makes things somewhat easier.
ably easily using a glass cutter. The screws do not protrude too far into the When positioning the sensor you have
mirrors in the laser projector are cut motor so that they touch the rotor. The to take into account the desired mir-
with dimensions of about 6×8 mm. shaft coupling, complete with magnet ror position, which will usually be 45
When gluing the mirrors you have to and mirror, can now be attached to the degrees for a 90° reflection. The centre
make sure which side has the reflect- shaft. After this, the Hall effect sensor of the sensor package has to be exactly
ing layer. The rear side (the side with has to be mounted in front of the lit- opposite the magnet at a distance of
the glass) is obviously the side that is tle magnet. The Hall sensor used in about 1-2 mm. This is precision work,
to be glued. the prototype was in an SMD package but is not hard to do.
Once the glue has set properly the and therefore a small piece of circuit To ensure that the magnet cannot turn
servo can be assembled. The motor board was used as the mounting sup- too far away from the sensor, two end-
has to be mounted on a piece of circuit port for the sensor. The same sensor is stops are fitted that prevent this from
board, preferably using the original also available in a SIP package, which happening. The end stops are easily
V+ 7809 +9V
78L06 +6V
8
IC1
4 +9V
+6V
1N4007 1N4007
P2 470p
47k
IC1 = TL082
47k
3
47k
250k 1 5
P1 IC1.A P4 5 5
2 7 2 470p 2
IC1.B
6 4 4
1M 100k IC2 IC3
1 1
100k P3
3 3
TDA2030 TDA2030
500k
1n
47k
+6V
10n
S
HS
180k
A1301
N
18k
22n
1N4007 1N4007 22n
071141 - 12
Figure 3. Each servo motor is controlled by this circuit. The input is therefore connected to the X-servo and Y-servo outputs of the main schematic (Figure 1).
62 elektor - 6/2008
ometers have to be set to their cen-
tre positions. When the power sup-
ply is connected, and all is well, the
Hall sensor motor now turns such that the mag-
net is exactly opposite the sensor. If
the magnet turns away from the sen-
sor then the motor wires need to be
swapped around.
Servo Y
Servo X
Using HyperTerminal we can send
Hall sensor commands via the serial port to the
Servo PCB projector. There are two commands
LASER Main PCB for adjusting the step response of the
071141 - 14
servos: AX and AY (adjust X/Y). After
issuing an AY command the step
response of the Y-servo is projected.
Figure 4. To enable control in both the x- as well as the y-direction the servos can be positioned like this.
The potentiometers for the PD con-
troller and motor driver now need to
be adjusted so that the projection is
mounted and are in the form of two ICs, type TDA2030, are intended as a nice, clean pulse waveform with-
pieces of wire, cut from a resistor lead, an audio amplifier but are functionally out showing any oscillation artefacts.
for example. These can be soldered just big difference amplifiers that can The same is true for the X-servo after
onto the motor PCB to the left and deliver about 3 A. More than enough issuing the AX command. Repeat the
right of the screw for the shaft cou- for this type of motor. Four diodes pre- adjustment of both servos once more.
pling. This completes the servo. vent the inductive flyback voltage of Measured with an oscilloscope (at the
the motor from damaging the IC. sensor output), the step response time
The power supply voltage for these ICs of the prototype was about 2-4 ms,
Servo control is provided by a 7809 regulator. With depending on the step size. The –3 dB
The electronics for the servo drive can a 9-V power supply, IC2 and IC3 can sine response is about 150 Hz.
be kept quite simple (see Figure 3). drive the motor with plus and minus
P1 is used to set the input signal sen- 6 volts. In the prototype IC2, IC3 and
sitivity and determines the maximum the 7809 were all mounted without
In operation
projection format. P2 sets a DC-offset, insulation on a common heatsink. Once the servos are working and are
which is used to move the projection The current consumption of the servos adjusted properly, the projector itself
image a little, for example. IC1a ampli- depends on the amount of drive. This can be tried. The serial port of the pro-
fies the difference between the signal is typically not more than 100-200 mA jector is connected to the serial port of
from the magnet sensor and the input each. The average power consumption a PC/laptop. Start HyperTerminal and
signal. When this difference is posi- of the entire projector including a 5 mW enter the COM-port settings. A con-
tive, the motor turns in the opposite red laser module is about 300 mA. Bat- nection can now be established with
direction compared to when this sig- teries will therefore not last very long, the ATmega88. You can now enter
nal is negative. In this way a closed but powering from a mains adapter or commands using the keyboard. With
loop is created which is necessary for a small lead-acid battery for ‘in-the- the LC command (list commands)
controlling the servo. IC1b is a propor- field operation’ are good options. the list of available commands is dis-
tional-differential (PD) amplifier. This played on the screen. Each command
is indispensable to correct the phase consists of two (capital) letters. If there
of the feedback loop.
Adjusting the servos are no parameters this is then imme-
IC2 and IC3 are connected as a bridged When a servo is connect to the drive diately followed by pressing the enter
amplifier for driving the motor. These PCB for the first time, all the potenti- key. Commands with parameters are
An opened CD-drive. The little DC-motor under con- The little DC-motor as removed from the CD-drive All parts of the servos together: mirror, shaft cou-
sideration sits at the front in the middle. (keep the little mounting screws). pling, magnet sensor and the little magnet.
6/2008 - elektor 63
projects modding & tweaking
The little motor mounted on a piece of printed cir- The mirror, the shaft coupling and the little magnet, The mirror glued to the shaft coupling; the magnet
cuit board with the 45-degree line where the magnet ready to be glued together. is next.
sensor has to come.
entered by typing the command, fol- command. Once all is correct, the SS in a flickering image. This is however
lowed by a space, then a parameter, command can be used to store every- only a problem with large letters and
then another space, etc. Parameters thing (including the entered text). a scroll width of more than about 5
are a number, usually 0-9. There is no To project text, the MS 1 or MS 2 com- characters.
checking of the input and therefore mand need to be issued. In mode 1 the Should this experimenting with the
there are no error messages either! text scrolls letter by letter and in mode settings result in some problems with
Using the command MS (mode set), 2 word by word. With the latter there is the display, the LD command (load
one of four modes can be selected. the possibility that a word is too long defaults) can be used to set every-
If the projector is used on an occa- when the letter size is too large. No thing back to the initial state. Don’t
sion where music is played, it can be error detection for this situation is pro- forget to store this ‘reset’ with the SS
nice to show the music as an oscillo- grammed in, users will have to look out command.
scope image on the wall. In this case for this themselves.
the sound output from a CD-player, An important adjustment is the tim-
or from a microphone with pre-ampli- ing. The software assumes predictable
Positioning
fier, is connected to the Y-input of the response times of the servos. These are Figure 4 and the photos show how the
controller. After issuing the command stored as two parameters. Using the servos can be positioned. It is advis-
MS 3, the projector operates as a pro- TM command with 2 parameters these able that the position of at least one
jection oscilloscope. The command SS can be altered and saved with SS. In servo and also that of the laser is made
(save settings) can now be used to the TM command the first parameter to be mechanically adjustable. It is
save everything. If the projector is now is a fixed time and the second causes important that no laser light misses
switched back on, after having been a delay proportional to the size of the the mirrors. With a little bit of adjust-
switched off, it will continue to oper- projection. The default is: TM 3 4. The ment of the laser position (height and
ate with these same settings and can projector works well with the default direction) all of the correct settings are
therefore operate ‘stand-alone’. settings, but experimenting with the usually easily found.
If the projector is to be used as a non- settings gives you a better feeling for Note that with laser modules the hous-
stop text display this can be accom- the workings of the projector. For exam- ing is often the + connection. A little
plished as follows: the text is entered ple, TM 1 4 distorts the projection and piece of heatshrink sleeving is then
with the TX command. The text size with TM 4 4 is slower than necessary. required for insulation.
and scroll speed are set with TS. The Fine adjustment is possible however
entered text is now projected as a run- and can gain some speed which means
ning text display. If the text is dis- that texts with larger scroll widths
Lasers with larger powers
played in mirror image or upside down can be used. These would otherwise As mentioned before, working with red
then this can be corrected with the RE be delayed too much which results lasers can be considered safe for pow-
A small nail holds the magnet in place for gluing. The shaft coupling with mirror and magnet, all glued The complete shaft coupling, mounted on the motor
together. shaft. Now the Hall-sensor.
64 elektor - 6/2008
The complete servo including the magnet sensor We make the mechanical construction with M3 hard- The two mounted servos with the laser module
which is held in the correct place with a small PCB. ware and aluminium angle profile. in the foreground.
ers up to a few milliwatts (still, never additional circuit for driving a bigger sive laser module from currents greater
look into the beam). The advantage of laser diode with a constant current than about 550 mA. The potentiome-
a green laser compared to a red one and to modulate it. The assumption ter sets the quiescent current which
is that the eye is much more sensitive here is for a current of 500 mA for a is just below the threshold at which
to green light, so that the projection 30 mW DPSS module obtained from a the module starts to ‘laser’ This serves
appears much brighter. Green lasers laser pointer. to slightly increase the average tem-
are usually DPSS (Diode Pumped Solid The TDA2030 is configured as a current perature (for optimal light output).
State) types, where the beam of The resistor R is used to set the
an 808 nm infrared laser diode current through the laser diode
drives a pair of crystals. These and RL is for the current limit. If
crystals convert the 808 nm the nominal current needs to be
beam in two steps to 532 nm 500 mA, for example, it is safe to
(green). The efficiency of this calculate RL for 550 mA (500 +
is much smaller than 100% so 10%).
that, in principle, a big infrared
laser diode is required. To illus-
trate this: a 5 mW red laser diode
Applications
requires a drive of about 40 mA, There are of course a number
a 5 mW green DPSS module of interesting applications for a
needs typically 200 mA. laser projector. It is, for example,
possible to use it for chatting.
If you must work with more Two people and two tables with
power, then for a few tens of a computer on each can be posi-
Euro you can purchase a green tioned against opposite walls.
laser pointer rated at, for exam- The chatters can then see the
ple, 30 mW. These will have to text of the other person behind/
be dismantled, which usually The complete laser projector: the two servo driver PCBs are on the above their monitor on the wall.
right, the servos are at back left and the controller and RS232 in-
involves sawing to gain access Using the wall of a larger build-
terface are in front on the left.
to the driver PCB. ing it is possible to chat in a
group, provided each participant
The driver PCB often delivers too little source which can be modulated with has their own projector, of course.
current and/or is too slow. Driving the TTL signals and the L200 is added as
diode directly with a current source regulator with current limiter. This is Another application is the projection of
is often the best solution for optimum additional safety to protect the expen- advertising messages in a shop win-
speed and light output. When the dow, for example. This can be done
driver PCB is removed, after determin- from the inside because the text can
ing which are the connections to the Program fuse be projected mirror-reversed. The text
laser diode, it is best if the laser diode can then be read normally from the
and photo diode are connected in anti- settings outside.
parallel. This is just a case of soldering
BOOTSZ = 11
two pins to each other (usually pin 1 Many other applications can be con-
and pin 3, pin 2 is the housing). This BODLEVEL = 100 ceived of, but we leave those up to
is because a laser diode typically has you.
a reverse blocking voltage of no more CKSEL = 0111 (071141-I)
than 2 V and the photo diode prevents
SUT = 11
this from being exceeded. Laser diodes
are also sensitive to static discharge, (brownout VCC = 4,3 V,
so take the necessary precautions. ext. full swing XTal)
In the circuit of Figure 1 there is an
6/2008 - elektor 65
AEIS CCPIT CEIEC CEAC CLIK ELIAP IET IPCA TEEMA VDMA ZVEI
66 elektor - 9/2008
Receive i-TRIXX in
your mailbox
FOR FREE
each Wednesday!
www.
elektor.
com
e
PCB House ldwid
na t o Wor
Fro m Chi
CStart from £30
CPrototype & Production
CNo Min Order
CFast Delivery
Sales@flypcb.com
9/2008 - elektor 67
projects e-blocks
E-blocks:
Accelerated Design
E-blocks + Flowcode + TINA
John Dobson (Matrix Multimedia)
In this article we take a look at some of the latest techniques you can use to accelerate the
design process, in this case of a switch-mode power supply.
Vin VSW
1µ 100µ
R3
10 Ω
100µ only for driving a few opamps we only need a few tens of
IRFZ34 milliamps — if that. Having sniffed around the Internet we
came across a Microchip Application Note that describes
+5V VDD the use of the elementary circuit in Figure 1.
RB
1
K1 This is a fairly traditional ‘boost converter’. We intend to po-
C2
2 wer the circuit with a 5 V supply — shown as Vin. FET T1 is
100n Rload periodically switched on by a pulsed control input — more
14
about this later. At the point where the FET is switched on,
500 Ω
VSS
converter (note: schematic 5 than the supply voltage. At this time in the cycle diode D1
for use in TINA, redrawn in 080194 - 12
will start conducting and charge will be pumped across it
Elektor style). into C1. As long as the discharge current through the load,
68 elektor - 9/2008
R1, is not too large then the result of this circuit is that the
output voltage is larger than the input voltage.
So this is a great little circuit that can be implemented rela-
tively cheaply, and will — in theory — do the job we need.
Providing that the load is precisely known — and does not
change — and a switching waveform of an appropriate
frequency and period can be supplied, we are home and
dry. Of course these conditions rarely apply — loads vary
depending on the actions of the rest of the circuit, compo-
nents have tolerances and in practice a closed loop system
incorporating some method of regulation is going to be nee-
ded. A more practical circuit is shown in Figure 2.
Figure 3.
This is essentially the same circuit with some additions. As A section of the Flowcode
the currents drawn by L1 can be large, a couple of capa- program written for the
citors have been placed across the supply rail for decou- PIC-controlled SMPSU.
pling. The load resistor here is 500 ohms. This will give us
around 30 mA as the model load — more than enough for
our needs. The FET switching control is governed by a PIC
microcontroller output pin. The pulse waveform on this line
will determine the charge and discharge of L1. To complete
the feedback loop, the circuit output voltage is fed into the
PICmicro analogue input pin A1 via a potential divider Figure 4.
made up of R1 and R2. The RC network formed by R2 and TINA at work showing
CFB provides a little smoothing on the feedback signal. The the response of a virtual
value of CFB can be established empirically. circuit running Flowcode-
generated ASM code and
combining a PIC with
Software development analogue components.
The firmware to make the PIC supply the control pulses Now start optimizing
was developed using Flowcode, the software suite with E- without soldering!
Advertisement
If you have
9 an innovative or otherwise original design you would like to see in print
in Europe’s largest magazine on practical electronics
9 above average skills in designing electronic circuits
9 experience in writing electronics-related software
9 basic skills in complementing your design with an explanatory text
9 a PC, email and Internet access for efficient communication with our in-house design staff;
then do not hesitate to contact us for exciting opportunities in getting your designs published on a regular basis.
Elektor Electronics
Jan Buiting, Editor
P.O. Box 11, NL-6141-AV Susteren, The Netherlands, Fax: (+31) 46 4370161
Email: editor@elektor.com
9/2008 - elektor 69
projects e-blocks
The first trace shows the current drawn at point AM1 throu-
gh the inductor, the second trace shows the state of RB0, the
third trace shows the feedback voltage, the fourth shows the
input voltage Vin, the fifth trace shows the output voltage,
and the last trace shows the voltage at the junction of the
FET drain and the inductor. Whilst there is some ripple on
the output the voltage is a pretty steady 14 V. The big sur-
prise for me here was the amount of current taken in the
first few milliseconds and the size of the subsequent bursts
which are more than an amp!
70 elektor - 9/2008
able d
avail an
i s now range e
e R es ree
o w cod mel AV buy th f all th
l t n
d! F e A n now ndle o the
v o lve ers: th c a b u u ser
l u a e
as
e trol . Yo buy cod pgrad
e
o d e h icrocon range u can a Flow n u
wc 7 yo c a
m
Flo o new 1 ARM ally or ady ou
t w T 9 u r e alre how y
d f
for el A divi ou
a
ils o
Atm ucts in te. If y d eta
the d a fo r .
pro ltim tor ode
new code u t Elek f Flowc
w ac o
- Flo e cont ersion
a s t v
ple rren
r cu
you
I M ATE
T
UL wo!
E t
W COD e, pay
FLO hre t
Buy
93.85
£1
RM
lf or A e3
cod
.50 ess
i ona F low tch
184
f
y o a swi ine
rof cop , l
£ K it P ts of a 8 leds) lock (2 a USB
r t er n s is
o c k ( E -b ard,
Sta dle
co E-Bl D
n LC M b
o
i s bun an LED hes), a cks AR
R T h , tc E-blo
ARM swi
fo r AV e for ck (8 er), an upply.
nal cod l o c t s
E-b hara ower
ss io f Flow witch c p
o 16 e and
ofe
r cop
y ), a
s
line l
Our range of more than it P ts of a (8 leds lock (2 ith cab
r K s k
r te si c -b
con E-Blo LCD E board le
w
43 hardware circuit boards, Sta ndle n LED s), an s AVR SB cab
b u a
CD-ROMs, sensors and accessories This r AVR, witche E-block er, a U
s
3 fo ck (8 er), an gramm
has just got bigger. o
E-bl harac k2 pr
t o
6 c S P m ply.
In addition to the new versions of 1 I sup
AVR
an power
Flowcode we now have bundles an d
to allow you to rapidly develop systems
43.70 V3
£2
de
based on RFID and Zigbee technology. F l o wco ro-
f i c
Kit py o cro m
R FID e s a co PICmi LCD
y ud locks er ,
Eas incl mm RFID
dle , an E-b iprogra oard, ype
u n
BENEFIT NOW! b al lt b et
This ession SB mu switch Mirfar RFID
f U ,
The retail price of our bundles is at a significant pro roller board ly, two I type ice.
discount to the sum of the individual parts. 75.60 t p
con d, LED er sup ode S 7A de
L v
£4 o a r o w I - c F 8 7
V3 b
rd,
p , two 16
You’ll save a massive 30% discount w.r.t. de boa cards spare
F l o wco D a
I
individual items! Kit f
py o micr
o
, RF s and
i g bee es a cocks PIC mmers ree card
y Z c l u d -blo g r a d , t h
Eas ndle in three E multipr ch boar , power
o
Ordering
bu al, SB wit rds
Use the order form near the end of the magazine This ession ller U ard, s r boa ces.
f r o b o s o i
or go to www.elektor.com (shop). pr ocon LED o sen A dev
o t
r , 7
mic board rds, tw 16F87
E-blocks will be shipped after receipt of payment. LCD ee boa three
Prices are exclusive of postage. Zigb ly, and
p
sup electronics worldwide
Ultrasonic Sound
Detector
track down high frequencies
Ton Giesberts
Using the circuit described here you can quickly and simply check whether harmful sounds with a high
frequency are being produced somewhere nearby, especially important at locations where the so-called
ultrasonic teen-deterrents against loitering youths are installed. Ten LEDs indicate the sound pressure of
signals with frequencies between 16 and 40 kHz.
These days, to harass loitering youths these types of sound without the par- application with REF ADJ connected to
into leaving, an ‘ultrasonic’ sound sys- ents realising. ground. In this configuration the input
tem is often used (such as the Mos- So that you can quickly get an indi- signal has to be 1.28 VDC (typically) for
quito). Such a system generates, in the cation whether harmful sounds with ‘full deflection’.
vicinity of a popular gathering place, a high frequency are being produced Working backwards from this value
a sound with frequencies between 17 somewhere, we designed an indica- and the sensitivity of the electret-
and 20 kHz. This sound appears to be tor that can detect these signals and microphone that is used, we can cal-
very irritating to youths, with the result measures their intensity. Ten LEDs culate the required gain. For the micro-
that they soon move on. Older people show the sound pressure of sound in phone we chose a type that can be
appear to be unable to hear these fre- the frequency range from 16 to 40 kHz. obtained from Farnell (the Kingstate
quencies and are therefore not both- Lower frequencies are suppressed by a type KEEG1542TBL-A). This choice
ered by them. fifth-order, high-pass, Butterworth fil- was mainly determined by the fre-
ter so that the indicator will not react quency response curve shown in the
The term ‘ultrasonic’ is actually not to speech and other everyday sounds. datasheet (which can be downloaded
quite correct. Ultrasonic sound is nor- When designing the measuring range courtesy Farnell). This shows a slight
mally used to describe the range of fre- for the indicator the decision was made increase towards 20 kHz, which leads
quencies that are above the range of for maximum deflection at a sound us to conclude that it will still be usa-
human hearing, that is, above 20 kHz. pressure of 90 dB. If you are exposed to ble at frequencies a little over 20 kHz.
Because the frequencies used are 90 dB for more than an hour then there While there may be a lot of ripple in
below 20 kHz, they are not only audi- is the risk of permanent hearing dam- the curve above 20 kHz this is not a
ble to loitering youths (insofar as they age. Whether you can also suffer hear- problem since we’re only looking for an
don’t have any hearing damage), but ing damage from frequencies you can- indicative measure of sound pressure.
they are even better heard by babies, not hear any more, wear of the audi- At 90 dB the microphone module will
small children and pets. The sound tory ossicles for example, has not been give an output of about 8 mV. When
pressure is not all that high, according researched yet. we take into account that the rectifier
to data provided by the manufacturer. contains a peak detector (makes a dif-
But if the ultrasonic deterrent is never- ference of √2 in the gain) and that the
theless considered to be annoying, it
Schematic sensitivity of the microphone can vary
is very likely to be even more irritating The circuit shown in Figure 1 may look by up to ±3 dB, we therefore need a cir-
to babies and small children (and that quite involved, but it is really not that cuit with a minimum gain in the region
is not taking into account the poten- bad. The circuit comprises a micro- of 80 to 160.
tial hearing damage by prolonged phone amplifier, a fifth-order high-pass
exposure). filter, an active rectifier, a buffer stage The input contains a gain stage (IC1A)
and finally the display driver with ten which amplifies 40 times. This also cuts
Babies and pets cannot say what is LEDs. For driving these LEDs we used off the lowest frequencies at the same
wrong (with the exception of par- the old, trusty LM3915 in dot-mode (we time (C1 and C4). C3 and C5 compen-
rots perhaps). So if you are walking deliberately did not choose bar-mode sate a little for the slight drop of fre-
through the city with a baby there is because of the current consumption). quency response above 20 kHz. For the
the chance that the child is exposed to This IC is configured for its simplest opamps the ST type TS924IN quad rail-
72 elektor - 9/2008
+3V
R1 C5
P1
100R
R14
15p 2k5
R7 10k
39k R9
R2 C2 R11
R3 6
8k2
12k
2k2
1M
2 C7 C8 7
220u C6 C9 C10 IC1B
25V 1 5
C1 IC1A
3
1n 1n 1n 1n 1n
1n R8 R10 R12 R13
R4 R5 R6
MIC1
4k7
5k6
33k
10k
IC1=TS924IN
1M
1k
1k
C3 C4 C11
R16 C12
100k
100n
R15 +3V
R17 P2
1k
D1
100k
250k
D2
9 3
D11 D12
8
IC1C V+ D3
10 9 1
BAT85 R18 MD SEL LED1
BAT85 7
REF OUT LED2
18
D4
6 17
47R
DIV HI LED3
13 IC2 LED4 16
+3V D5
14 5 15
IC1D IN LED5
12 14
LED6 D6
Term.2 L Term.1 13
LED7
LM3915N LED8 12
D7
R19 8 11
BT1 4 C14 C13 REF ADJ LED9
3V 4 10
IC1
4k7
DIV LO LED10 D8
11 220u 470n V-
25V
2 D9
D10
080602 - 11
Figure 1. With this circuit you can very easily track down high-frequency audio signals.
9/2008 - elektor 73
PROJECTS MINI PROJECT
Advertisement
74 elektor - 9/2008
GIGANTIC!
+
Keep £44.80 in your pocket!
+
Cheaper than 11 issues from the newsstand
E le kt or -----
– £49.0 0 ----------------
-- -- -- -- -- -- -- ----------------
------
Your saving
= £44.80
Hexadoku
After the colossal — but reportedly not too difficult — AlphaSudoku puzzle in the Summer Circuits
Puzzle with an
electronics touch
edition we cheerfully continue with a regular Hexadoku. As before, do participate! All correct entries
received enter a prize draw for an E-blocks Starter Kit Professional and three Elektor Shop vouchers.
The instructions for this puzzle are straightforward. A number of clues are given in the puzzle and these determine
the start situation.
In the diagram composed of 16 x 16 boxes, enter numbers such All correct entries received for each month’s puzzle go into a
that all hexadecimal numbers 0 through F (that’s 0-9 and A-F) draw for a main prize and three lesser prizes. All you need to
occur once only in each row, once in each column and in each do is send us the numbers in the grey boxes. The puzzle is also
of the 4x4 boxes (marked by the thicker black lines). available as a free download from our website.
E-blocks Include with your solution: full name and street address.
76 elektor - 9/2008
retronics infotainment
Retronics is a monthly column covering vintage electronics including legendary Elektor designs. Contributions, suggestions and requests are
welcomed; please send an email to editor@elektor.com
9/2008 - elektor 77
ELEKTORSHOWCASE
To book your showcase space contact Huson International Media
Tel. 0044 (0) 1932 564999 Fax 0044 (0) 1932 564998
78 elektor - 9/2008
products and services directory
LONDON ELECTRONICS COLLEGE ROBOT ELECTRONICS SCANTOOL.NET
http://www.lec.org.uk http://www.robot-electronics.co.uk http://www.scantool.net
Vocational training and education Advanced Sensors and Electronics for Robotics ScanTool.net offers a complete line
for national qualifications in • Ultrasonic Range Finders of PC-based scan tools for under £50.
Electronics Engineering and • Compass modules • 1 year unconditional warranty
Information Technology (BTEC First National, • Infra-Red Thermal sensors • 90 day money back guarantee
Higher National NVQs, GCSEs and GCEs). Also • Motor Controllers • For use with EOBD compliant vehicles
Technical Management and Languages. • Vision Systems • Fast shipping
• Wireless Telemetry Links • Compatible with a wide range
• Embedded Controllers of diagnostic software
MQP ELECTRONICS Visit our website, or email us at:
www.mqp.com
• Low cost USB Bus Analysers
ROBOTIQ sales@scantool.net
http://www.robotiq.co.uk
• High, Full or Low speed captures
Build your own Robot!
• Graphical analysis and filtering
• Automatic speed detection
Fun for the whole family! USB INSTRUMENTS
• MeccanoTM Compatible http://www.usb-instruments.com
• Bus powered from high speed PC
• Computer Control USB Instruments specialises
• Capture buttons and feature connector
• Radio Control in PC based instrumentation
• Optional analysis classes
• Tank Treads products and software such
• Hydraulics as Oscilloscopes, Data
OBD2CABLES.COM Internet Technical Bookshop, Loggers, Logic Analaysers
http://www.obd2cables.com 1-3 Fairlands House, North Street, Carshalton, which interface to your PC via USB.
• Thousands of OBD cables and connectors in Surrey SM5 2HW
stock email: sales@robotiq.co.uk Tel: 020 8669 0769
• Custom cable design and manufacturing VIRTINS TECHNOLOGY
• OBD breakout boxes and simulators RADIOMETRIX www.virtins.com
• Guaranteed lowest prices www.radiometrix.com PC and Pocket PC based
• Single quantity orders OK The leading global developer virtual instrument such
• Convenient online ordering of ISM band, low power radio as sound card real time
• Fast shipping modules for wireless data transmission: oscilloscope, spectrum
Visit our website, or email us at: • Transmitters • Receivers • Transceivers analyzer, signal generator,
sales@obd2cables.com • RF modems • Evaluation Kits multimeter, sound meter,
9/2008 - elektor 79
SHOP BOOKS, CD-ROMS, KITS & MODULES
Going Strong
A world of electronics
from a single shop!
SAPS-400
(May 2008)
Bestseller!
DigiButler
(May & April 2008) Display Computer
Fully elaborated electronics projects
Coldfire 32-bit microcontroller. The project has been designed The present tenth
Programming edition of
a graphic the popular
display is dis-
with open source in mind and doubles as a powerful Coldfire ‘30x
tinctlyCircuits’ series
more diffi of books
cult than once again
programming a
development system using free CodeWarrior software from contains a comprehensive
text display. variety of cir-
Our mini microcontroller
Freescale. DigiButler activates electrical appliances in and cuits,
boardsub-circuits,
features a tips
newand tricks and de-
display-on-glass
around the home, accepting on/off commands from a WAP sign
module ideas
andfor electronics. Among
a high-performance many
Renesas
phone, through an Ethernet network or via a webpage at an other
M16Cinspiring topics, The
microcontroller. the following cat-
board is avail-
allocated IP address and with full access security. egories
able fullyare well presented
assembled, and thein microcon-
this book:
test & measurement;
troller is pre-loaded RF with(radio); com-
a TinyBasic
Kit of parts including SMD-stuffed PCB, programmed microcontrol- puters andtoperipherals;
interpreter audio & video;
simplify the development of
ler, all leaded parts and CD-ROM containing both Elektor articles, hobby
graphics and modelling;–microcontrollers;
applications even for novices.
TBLCF documentation, datasheets, application notes and source home & garden; etcetera.
code files. PCB, populated and tested
432 pages • ISBN 978-0-905705-69-9
Art.# 071102-71 • £29.00 • US$ 58.00 £19.95
Art.#070827-91
• US$ 39.95
• £78.80 • US$ 157.60
80 elektor - 09/2008
Elektor Internet Radio Bestseller!
(April 2008)
In the good old days, you had to modu- A DIY system made from recycled components Principles and Practice
late audio signals onto an RF carrier so
they could be received and demodulated
Design your own Computer Vision
to produce something more or less audi- Embedded Linux Computer vision is probably the most ex-
ble. Nowadays things are different. Au- control centre on a PC citing branch of image processing, and
dio signals are compressed and put into the number of applications in robotics, au-
This book covers a do-it-your-self system
IP packets that are ‘streamed’, and you tomation technology and quality control is
made from recycled components. The
can access every Internet radio pro- constantly increasing. Unfortunately enter-
main system described in this book re-
gramme in the world by receiving, buff- ing this research area is, as yet, not sim-
uses an old PC, a wireless mains outlet
ering and decompressing these ple. Those who are interested must first go
with three switches and one controller,
packages. This is all very easy with the through a lot of books, publications and
and a USB webcam. All this is linked to-
Elektor Internet Radio: listening to radio software libraries. With this book, how-
gether by Linux. This book will serve up
programmes with the latest ICs. And all ever, the first step is easy. The theoretically
the basics of setting up a Linux environ-
open-source! If you take a look on the founded content is understandable and is
ment – including a software develop-
Web, you’ll be astounded to see that supplemented by many examples.
ment environment – so it can be used as
Google presently finds more than 21 a control centre. The book will also guide 320 pages • ISBN 978-0-905705-71-2
million hits for ‘Internet radio’, so it’s ob- you through the necessary setup and £32.00 • US$ 64.00
viously a hot topic! configuration of a webserver, which will
be the interface to your very own home
PCB, SMD-populated
control centre. All software needed will
Art.# 071081-71 • £115.00 • US$ 230.00 be available for downloading from the
Elektor website.
PIC Microcontrollers
www.elektor.com
(March 2008)
An ECIO acts as the brains of this PLC This hands-on book covers a series of
board that has relays, opto-isolators CAN Elektor exciting and fun projects with PIC micro-
(!) connectivity and an LCD. All this I/O controllers. You can built more than 50
Regus Brentford
capacity together with Flowcode allows projects for your own use. The clear ex-
the board to act as a versatile, powerful
1000 Great West Road planations, schematics, and pictures of
PLC for quite complex control and auto- Brentford each project on a breadboard make this
Books
mation projects. The LCD module is used a fun activity. You can also use it as a study
TW8 9HH
to display ASCII characters to the user as guide. The technical background infor-
a means of troubleshooting during the
United Kingdom mation in each project explains why the
software development stage or for moni- Tel.: +44 20 8261 4509 project is set up the way it is, including the
toring the system. use of datasheets. Even after you’ve built
Fax: +44 20 8261 4447
all the projects it will still be a valuable
Kit of parts incl. PCB, ECIO-module and all Email: sales@elektor.com reference guide to keep next to your PC.
other components
446 pages • ISBN 978-0-905705-70-5
Art.# 070786-71 • £76.00 • US$ 152.00 £27.95 • US$ 55.90
09/2008 - elektor 81
SHOP PRODUCT SHORTLIST, BESTSELLERS
Books
Bestseller!
All articles published in 2007
duction! It clearly explains the technology peared in Elektor and complemented interactive, allowing the user to add, edit
using various microcontroller circuits and them with additional documentation and and complete component data. This CD-
programs written in several different pro- links to introductory articles on Ethernet ROM is a must-have for all electronics
gramming languages. interfaces. The documents are PDF files. enthusiasts.
ISBN 978-0-905705-67-5 • £19.95 • US$ 39.90 ISBN 978-90-5381-214-3 • £19.50 • US$ 39.00 ISBN 978-90-5381-159-7 • £17.50 • US$ 35.00
82 elektor - 09/2008
September 2008 (No. 381) £ US$
Bestsellers
Product Shortlist
Books Books
080228-41 ....Programmed controller PIC12C671 ....................................9.00........18.00
PIC Microcontrollers
Battery Discharge Meter
070821-41 ....Programmed controller PIC16F676-20I/P .........................5.90........11.80 3 ISBN 978-0-905705-70-5 ............... £27.95 .....US$ 55.90
070821-42 ....Programmed controller PIC16F628-20/P...........................9.00........18.00
Visual Basic for Electronics Engineering Applications
Operating Hour Counter
070349-41 ....Programmed controller PIC12F683 ....................................5.90........11.80 4 ISBN 978-0-905705-68-2 ............... £29.95 .....US$ 59.90
Lamp in a Wine Bottle
CD-ROMs
Microcontroller Basics
080076-41 ....Programmed controller ATtiny45 .......................................5.90........11.80
Energy-efficient Backlight 5 ISBN 978-0-905705-67-5 ............... £19.95 .....US$ 39.90
080250-41 ....Programmed controller ATmega32 ..................................22.50........45.00
FPGA Course
Deluxe ‘123’ Game
080132-41 ....Programmed controller ATmega8-PU ................................9.00........18.00 1 ISBN 978-90-5381-225-9 ............... £14.50 .....US$ 29.00
Reaction Race using ATtiny13
Kits & Modules Elektor 2007
080118-41 ....Programmed controller ATtiny13 .......................................4.90..........9.80
Underwater Magic 2 ISBN 978-90-5381-218-1 ............... £17.50 .....US$ 35.00
071037-41 ....Programmed controller AT90S8515P ...............................14.90........29.80
ECD 4
Flowcode for Garden Lighting
3
CD-ROMs
080113-41 ....Programmed controller PIC16F88 ....................................11.90........23.80 ISBN 978-90-5381-159-7 ............... £17.50 .....US$ 35.00
Tent Alarm
Ethernet Toolbox
4
080135-41 ....Programmed controller ATtiny13V .....................................4.90..........9.80
Programmable Servo Driver ISBN 978-90-5381-214-3 ............... £19.50 .....US$ 39.00
080323-41 ....Programmed controller PIC12F675 ....................................5.90........11.80
Home Automation
Simple USB AVR-ISP Compatible Programmer
080161-41 ....Programmed controller ATmega8-16AU ..........................11.90........23.80 5 ISBN 978-90-5381-195-5 ............... £13.90 .....US$ 27.80
Intelligent Presence Simulator
080231-41 ....Programmed controller PIC12C508 ....................................5.90........11.80 DigiButler
LiPo Manager 1 Art. # 071102-71 ........................... £29.00 .....US$ 58.00
080053-41 ....Programmed controller PIC16F84 ....................................11.90........23.80
GPS Receiver SAPS-400
2
Kits & Modules
080238-41 ....Programmed controller PIC16F876A ...............................23.00........46.00 Art. # 070688-91 ......................... £159.00 ...US$ 318.00
Universal Thermostat
080090-41 ....Programmed controller PIC16F628 ....................................9.00........18.00 Elektor Internet Radio
DTMF-controlled Home Appliance Switcher 3 Art.# 071081-71 .......................... £115.00 ...US$ 230.00
080037-41 ....Programmed controller ATmega8-16PC ............................9.00........18.00
Solar-powered Battery Charger Display Computer
080225-41 ....Programmed controller PIC12C671 ....................................9.00........18.00 4 Art. # 070827-91 ........................... £78.80 ...US$ 157.60
RGB Lights
080419-41 ....Programmed controller PIC12F675 ....................................5.90........11.80 ECIO PLC
Microlight Fuel Gauge 5 Art. # 070786-71 ........................... £76.00 ...US$ 152.00
080054-41 ....Programmed controller ATmega8 ......................................9.00........18.00
Digital Rev Counter for (Older) Diesels
071133-41 ....Programmed controller AT90S2313 ...................................5.90........11.80
Golf Tally
080181-41 ....Programmed controller ATTiny44 ......................................5.90........11.80
Order quickly and safe through
Outside Light Controller
080258-41 ....Programmed controller PIC16F628A .................................9.00........18.00 www.elektor.com/shop
June 2008 (No. 378)
Thermo-Snake
or use the Order Form near the end
070122-41 ....PIC18F2550, ready-programmed ....................................13.20........26.40
SAPS-400
of the magazine!
070688-91 ....PCB, populated and tested, ready-mounted
in aluminium U profile ...................................................159.00......318.00
USB-to-TTL Serial Cable Elektor
080213-71 ....USB-to-TTL converter cable ..............................................15.90........31.80 Regus Brentford
1000 Great West Road
May 2008 (No. 377) Brentford TW8 9HH • United Kingdom
Two-wire LCD Tel. +44 20 8261 4509
071035-93 ....SMD-populated board with all parts and pinheaders .......22.40........44.80 Fax +44 20 8261 4447
Email: sales@elektor.com
09/2008 - elektor 83
info & market sneak preview
RESERVE YOUR COPY NOW! The October 2008 issue goes on sale on Thursday 25 September 2008 (UK distribution only).
UK mainland subscribers will receive the magazine between 20 and 23 September 2008. Article titles and magazine contents subject to change, please check www.elektor.com.
84 elektor - 9/2008
Order Form
09-2008
Description
METHOD OF PAYMENT
(see reverse before ticking as appropriate)
for PIC Microcontrollers
NEW £23.00
Bank transfer
Design your own Embedded Cheque
Linux Control Centre on a PC NEW £24.00 (UK-resident customers ONLY)
✁
EL09 Email: custserv@audioXpress.com
Order Form
09-2008
Subscription-Plus
(11 issues plus the Elektor Volume 2008 CD-ROM)
Elektor
Regus Brentford
1000 Great West Road
Tel. Email Brentford TW8 9HH
United Kingdom
Date – – Signature Tel.: +44 20 8261 4509
Fax: +44 20 8261 4447
✁
www.elektor.com
EL09 subscriptions@elektor.com
ORDERING INSTRUCTIONS, P&P CHARGES
Except in the USA and Canada, all orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address
using the Order Form overleaf. Online ordering: www.elektor.com/shop
Readers in the USA and Canada may (but are not obliged to) send orders, except for subscriptions (for which see below), to the USA address
given on the order form. Please apply to Old Colony Sound for applicable P&P charges. Please allow 4-6 weeks for delivery.
Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00
(Priority) Outside Europe: £9.00 (Standard) or £11.00 (Priority)
HOW TO PAY
All orders must be accompanied by the full payment, including postage and packing charges as stated above or advised by Customer Services staff.
Bank transfer into account no. 40209520 held by Elektor Electronics with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20.
BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us.
Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or
subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country.
Giro transfer into account no. 34-152-3801, held by Elektor Electronics. Please do not send giro transfer/deposit forms directly to us, but instead
use the National Giro postage paid envelope and send it to your National Giro Centre.
Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is
SSL-protected for your security.
COMPONENTS
Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply
of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive.
TERMS OF BUSINESS
Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guarantee this
time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our
consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number.
If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods
must be received at our Brentford office within 10-days (UK); 14-days (Europe) or 21-days (all other countries). Cancelled orders All cancelled
orders will be subject to a 10% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits,
devices, components, and so on, described in our books and magazines. Elektor does not accept responsibility or liability for failing to identify
such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes
and software carriers published in our books and magazines (other than in third-party advertisements) are copyright and may not be reproduced
or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor
in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature.
Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability
Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in
connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser
any money paid in respect of the goods. Law Any question relating to the supply of goods and services
by Elektor shall be determined in all respects by the laws of England.
September 2007
Airmail
Rest of the World £71.00 £78.00
USA & Canada For US$-prices please check www.elektor.com
Bank transfer into account no. 40209520 held by Elektor Electronics. The standard subscription order period is twelve months. If a perma-
with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. nent change of address during the subscription period means that
BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name copies have to be despatched by a more expensive service, no extra
and address gets communicated to us. charge will be made. Conversely, no refund will be made, nor expiry
date extended, if a change of address allows the use of a cheaper
Cheque sent by post, made payable to Elektor Electronics. We can only service.
accept sterling cheques and bank drafts from UK-resident customers or Student applications, which qualify for a 20% (twenty per cent)
subscribers. We regret that no cheques can be accepted from customers reduction in current rates, must be supported by evidence of student-
or subscribers in any other country. ship signed by the head of the college, school or university faculty.
A standard Student Subscription costs £33.60, a Student Subscription-
Giro transfer into account no. 34-152-3801, held by Elektor Electronics. Plus costs £39.20 (UK only).
Please do not send giro transfer/deposit forms directly to us, but instead Please note that new subscriptions take about four weeks from receipt
use the National Giro postage paid envelope and send it to your National of order to become effective.
Giro Centre. Cancelled subscriptions will be subject to a charge of 25% (twenty-
five per cent) of the full subscription price or £7.50, whichever is the
Credit card VISA and MasterCard can be processed by mail, email, higher, plus the cost of any issues already dispatched. Subsciptions
web, fax and telephone. Online ordering through our website is SSL- cannot be cancelled after they have run for six months or more.
protected for your security. January 2008
Design your own
Embedded Linux
This book is not about X10, ZigBee, Z-wave or any that’s
available commercially. Instead, it covers a do-it-your-self sys-
control centre
tem made from recycled components. The main system descri-
bed in this book reuses an old PC, a wireless mains outlet with
three switches and one controller, and a USB webcam. All this
NEW! webserver, which will be the interface to your very own home
control centre. All software will be available for downloading
from the Elektor website.
Elektor
Regus Brentford • 1000 Great West Road
Brentford TW8 9HH • United Kingdom
Tel. +44 20 8261 4509
INDEX OF ADVERTISERS
Allendale Electronics Ltd . . . . . . . . . . . . . . www.pcb-soldering.co.uk . . . . . . . . . . . . . . . . 43 Lektronix . . . . . . . . . . . . . . . . . . . . . . . . . . www.lektronix.net/about/careers . . . . . . . . . . . 49
First Technology Transfer Ltd, Showcase . . www.ftt.co.uk . . . . . . . . . . . . . . . . . . . . . . . . . 78 USB Instruments, Showcase . . . . . . . . . . . www.usb-instruments.com . . . . . . . . . . . . . . . 79
FLYPCB . . . . . . . . . . . . . . . . . . . . . . . . . . . www.flypcb.com . . . . . . . . . . . . . . . . . . . . . . . 67
9/2008 - elektor 87
The Proteus Design Suite
Celebrating 20 Years of Innovation