July Elektor #392

July Elektor #392
www.elektor.com
July/August 2009
AUS$ 19.95 - NZ$ 24.50 - SAR 129.95
£ 6.95
electronics & microcontrollers
SUMMER CIRCUITS CIRCUS
more than 100 circuits, ideas & tips
Top Act
ElektorWheelie
R35
1
$)&#
%"
!
#
!
"#
"
#
$!
%"
#
! #
&#
' %!
#
()
#
$!
*
&+,)$-.
(
+
#
"
$! -#
%!
+.%! %
! #!
$ /
,/0%"
,
!!
! " !
# ! ! " $!%!
&'" (%
)$* ! ! #*
+!$
,$ !!
$ ! #! &+,)
$
(
.
mikroElektronika
DEVELOPMENT
TOOLS
OK.EasyPIC5
DEVELOPMENT TOOLS | COMPILERS | BOOKS
Now you need a...
DEVELOPMENT TOOL
&7=? 79443687? .? .? .? .? . &2)? .- '!% 1.(63(3286300*67? .8? (31*7? ;.8-? 8-*
? "-*? $!"(& &6);&6*? [email protected](.6(9.8? *'9,,*6? *2&'0*7? :*6=? *++.(.*28? 78*4? '=? 78*4
)*'9,,.2,?<&140*7?.2??
?)# &2)?
))$#, 0&2,9&,*?&6*?463:.)*)?;.8-?8-*?'3&6)
&7=? (31*7? ;.8-? 8-*? +3003;.2,? 46.28*)? )3(91*28&8.32? &7=? &29&0? 0&7-
? &29&0
&2)?1./63?&29&0
79443687?8-*?0&8*78
?&2)[email protected]??1.(63([email protected]
86300*67? .8? .7? )*0.:*6*)? ;.8
? "-*6*? &6*
#!?
[email protected]'3&6)?463,6&[email protected]
1*[email protected]'3&6)?1./63?&2)
[email protected]'3&6)?"39(-&2*0?
(3286300*6
.7?&2?&):&2(*)
7=78*1? +36? .278&00.2,? .283
)*:.(*7? &2)? +36? )*:*034.2,
.2)9786.&0?&2)?-31*?36?3++.(*
(328630?*&896*7??6*0&=7
? 3483(3940*)? .24987
!?
!
? !*6.&0
8-*62*8?*8(
.7? &? 7=78*1? +36
.278&00.2,?.283?)*:.(*7?&7?;*00
&7? +36? )*:*034.2,? .2)9786.&0
(328630?*&896*7??6*0&=7?
3483(3940*)? .24987? !
!
? !
? &2)? #!? [email protected]'3&6)? 463,6&11*6? &2)
1./[email protected]'3&6)
#) -+!*
$!"(&
-
#) - +!* - $!"(&
7944368? .7? &? +&78? #!
463,6&11*6? &2)? [email protected](.6(9.8
)*'9,,*6? +36? 8-*? .(63(-.4
? !? 1.(63(3286300*6
+&1.0=?
$?79443687???&2)
?4.2?<<<<?1.([email protected]
(3286300*67?.8?(31*7?;.8?"-*6*?&6*
#!?
[email protected]'3&6)?463,6&[email protected]
1*[email protected]'3&6)?1./63
&2)[email protected]'3&6)?"39(-&2*0?
(3286300*6
.7? &? 7=78*1
)*7.,2*)? +36? (3286300.2,
.2)9786.&0? 7=78*17? &2)
1&(-.2*7?:.&?*8-*62*8?;.8-?
6*0&=7?94?83??463,
463,6&11*6? (&2? '*? *&7.0=
(322*(8*)? 83? '3&6)?:.&??(322*(836
)
),)
-.
) 79443687? &2)[email protected]'!% )7?1.([email protected]
(3286300*67? .8? (31*7? ;.8)7?"-*6*?&6*
#!?
[email protected]'3&6)?463,6&[email protected]
1*[email protected]'3&6)?1./63?&2)
[email protected]'3&6)?"39(-&2*0?
(3286300*6
"-*?7=78*1?79443687??
&2)?.'!% )7?1.(63([email protected]
86300*67? .8? .7? )*0.:*6*)? ;.8)7? "-*6*? &6*
#!?
[email protected]'3&6)?463,6&[email protected]
1*[email protected]'3&6)?1./63?&2)
[email protected]'3&6)?"39(-&2*0?
(3286300*6
"-*? 7=78*1? 79443687? &2)? - '!%- ? ) 1.([email protected]
(3286300*67? .8? (31*7? ;.8
? "-*6*
&6*? #!? ? 463,6&11*6
&2)? "39(-&2*0? (3286300*6
[email protected]'3&6)
),&
),
"-*? 7=78*1? 79443687? ? &2)? 4.2?!3A?1.([email protected]
(3286300*67? .8? (31*7? ;.8%
? "-*6*? &6*
9086&? +&78? #!? ? 463,6&[email protected]
1*6? &2)? ? "39(-&2*0? ([email protected]
86300*[email protected]'3&6)
"-*? 7=78*1? 79443687? .
'!% &2)? .'!% $
1.(63(3286300*67?.8?.7?)*0.:@
*6*)? ;.8-? "
;36/.2,? &8? >? "-*6*
&6*?9086&?+&78?#!?
[email protected]
,6&11*6?&2)??"39(-&2*0
(3286300*[email protected]'3&6)
"-*? 7=78*1? 79443687? ? ? &2)? 4.2?1.(63([email protected]
86300*67? 8? .7? )*0.:*6*)? ;.8"?"-*6*?&6*?9086&
+&78? #!? ? 463,6&11*6
&2)? ? "39(-&2*0? (3286300*6
[email protected]'3&6)
),
),
$(*
"-*? 7=78*1? .7? (314&8.'0*
;.8-? ? ? ? &2)? '!% #7? .8? (31*7? ;.8"!
?"-*6*?.7?&?+&78
#!? ? 463,6&11*6? [email protected]
'3&6)? 073? 8-*6*? &6*
?&2)?
?
73(/*[email protected]'3&6)
"-*?7=78*1?79443687? &2)
'!%) 1.(63([email protected]
86300*67?.8?(31*7?;.8-?-.0.47
? "-*6*? &6*? 9086&
+&78? #!? ? 463,6&11*6
&2)?"39(-&2*0?(3286300*6?
[email protected]'3&6)
$(* .7? &
)*:*0341*28? 8330? 8-&8? ;.00
-*04? .2? (0*&6? 92)*678&2).2,
3+? !? ? !? 8*([email protected]
,.*7?28*22&?(&2?'*?40&(*)
[email protected]'3&6)? +36? '*88*6? 7.,2&0
59&0.8=?!=78*1?79443687?
).++*6*28?!?13)90*7
h t t p : / / w w w . m i k r o e . c o m /
S O F T W A R E
A N D
H A R D W A R E
S O L U T I O N S
F O R
E M B E D D E D
W O R L D
electronics & microcontrollers
Summer Circuits —
made for you, by you
As the days shorten
and the first autumn
winds howl and buffet the castle walls,
the initial plans are
drawn up. Seasons
pass, autumn and
winter make way for
spring, and when
everyone looks like
they could do with
a bit more sunshine
on as well as in their
faces, it’s finished
and ready for printing: Elektor’s Summer Circuits edition!
To mark the real
start of ‘SC’, however, we must go back
even further in time
— to the beginning of the summer of 2008, when many of you
were thinking up exciting new ideas for the edition and eventually got round to sending them by email — and some even by
snail mail.
Summer Circuits has been a collective effort since it was first
produced, now over 30 years ago. Every year we receive over
500 entries and ideas for publication! The projects come from all
over the world, and we happily evaluate each item because the
effort confirms the creativity and ingenuity of you, our readers.
All circuits in this edition have been tried and tested by Elektor
Labs so repeatability should not be an issue if you read and
work carefully.
Plus
Colophon
ElektorWheelie
Hexamurai Puzzle
Elektor SHOP
Coming Attractions
SUMMER CIRCUITS 2009
(Colour of title indicates category, bold type = PCB design included)
Audio, Video & Photography
Audio Source Enhancer
Automatic TV Lighting Switch
DMX Transmitter
Guitar Amplifier PSU
Guitar Pick-up Tone Extender
Improved Hybrid Headphone Amplifier
Load Protection for Audio Amplifiers
Sensitive Audio Power Meter
SRPP Headphone Amplifier
Stereo Widening
S-video Converter
Two TV Sets on a Single Receiver
Vocal Adaptor for Bass Guitar Amp
Wireless S/PDIF Connection
ElektorWheelie
Computers, Software & Internet
While ElektorWheelie was mostly ‘under cover’ in the June 2009
edition, this month we are unveiling the electronics starting
on page 66 . Our DIY ‘self-balancing two-wheeler’ will take you
further, both in distance and knowledge. In distance, because
it is designed to take you from A to B in spectacular fashion. In
knowledge, because ElektorWheelie is an ‘Open Development’.
Open for students and companies to redesign or modify, to
make it even faster, or to make it go farther on a battery charge.
Who knows, we might even organise an ElektorWheelie Competition.
Have fun exploring this electrifying collection of more than 100
circuits, tips and ideas. None of our competitors has ever managed to publish anything remotely resembling our Summer Circuits edition. And don’t forget, after a long day spent reading,
soldering or measuring, comes well deserved recreation.
Cheap Serial Port for the Mac
Control Interface via PC Keyboard
Fan Speed Controller
Network RS232
One Wire RS-232 Half Duplex
PC Power Saver
Powering a Second Hard Drive
Pseudo Fan
Remote Control for Network Devices
TurboGrafx-16 (PC Engine) RGB Amplifier
USB Switch
VGA Background Lighting
On behalf of the Elektor Team,
Wisse Hettinga
International Coordinating Editor
6
66
124
128
132
94
52
108
105
60
114
72
97
15
38
41
100
59
23
11
46
49
81
24
122
77
17
120
48
64
22
Hobby, Games & Modelling
Acoustic Distress Beacon
Annoy-a-Tron
106
34
CONTENTS
Braitenberg Robot
Breadboard/Perfboard Combo
Full-colour Night-flight Illumination
Going for Gold
Impact Clock
Lighting Up Model Aircraft
Lipo Monitor
Low-drop Series Regulator using a TL431
Servo Driver
Speed Control
116
26
84
102
74
30
21
22
91
43
Home & Garden
12 V AC Dimmer
Automatic Bicycle Light
Automatic Curtain Opener
Bathroom Fan Controller
Chill Out Loud
Daylight Switch
Dimmable Aquarium Light
with Simulated Sunrise and Sunset
Economy Timer
Long Duration Timer using ATtiny2313
Luxeon Logic
Phone Ring Repeater
Power On Indicator
Power-up/down Sequencer
Pulse Clock driver with DCF Synchronisation
Remote Washing Machine Alert
Snail Mail Detector
Solar-driven Moisture Detector
Switching Delay
Two-button Digital Lock
Wireless Baby Monitor
62
121
75
97
92
45
93
83
111
10
53
99
50
54
31
107
86
19
78
80
Microcontrollers
Driver-Free USB
Easy LEGO Robotics Set Up
An E-blocks IR RC5 Decoder
I2C Display
Port Expander
Six-digit Display with SPI Port
USB Radio Terminal
29
16
118
88
14
20
101
Power Supplies, Batteries & Chargers
Desulphater for Car Batteries
Doubling Up with the PR4401/02
Lead-Acid Battery Protector
35
95
75
Volume 35
July & August 2009
no. 391/392
LEDify It!
Lithium Charger using BQ24103
Single Lithium Cell Charger
Single-cell Power Supply
SSR 2.0
32
61
110
82
42
RF (radio)
0-18 MHz Receiver
FM Audio Transmitter
Pre-emphasis for FM Transmitter
12
90
96
Test & Measurement
Digital Sweep and Sinewave Generator
Frequency and Time Reference with ATtiny2313
Measuring Milliohms with a Multimeter
Preamplifier for RF Sweep Generator
Quartz Crystal Tester
Servo Scales
Simple Temperature Measurement and Control
SMD Transistor Tester
Smoggy
Tester for Inductive Sensors
104
56
106
10
112
28
62
39
85
101
Miscellaneous Electronics &
Design Ideas
Backlight Delay
98
Cut-rate Motorbike Alarm
103
Floating Message
51
Four-component Missing Pulse Detector
44
Freezer Trick
32
Frequency Divider with 50% Duty Cycle
58
Hassle-free Placement of SMD Components
44
LED Bicycle Lights
30
Micropower Crystal Oscillator
52
Momentary Action with a Wireless Switch
27
PR4401 1-Watt LED driver
47
Programmable Nokia RTTL Player
18
Simple Wire Link Bender
82
Simple Wireless and Wired Emergency Stop System 35
Slow Glow
14
Start-up Aid for PCs
13
Stress-o-Meter
76
TL431 Multivibrator
40
elektor
electronics worldwide
elektor international media
Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics.
From professionals passionate about their work to enthusiasts with professional ambitions.
From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment.
Analogue and digital; practical and theoretical; software and hardware.
English
German
Dutch
French
Chinese
Portugal
Italian
Spanish
Swedish
Finnish
Volume 35, Number 391/392, July/August 2009
ISSN 1757-0875
Elektor aims at inspiring people to master electronics at any personal level by
presenting construction projects and spotting developments in electronics and
information technology.
Publishers: Elektor International Media, Regus Brentford,
1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261
4509, fax: (+44) 208 261 4447 www.elektor.com
The magazine is available from newsagents, bookshops and electronics retail
outlets, or on subscription.
Elektor is published 11 times a year with a double issue for July & August.
Elektor is also published in French, Spanish, American English, German and
Dutch. Together with franchised editions the magazine is on circulation in more
than 50 countries.
Editorial secretariat: Hedwig Hennekens ([email protected])
International Editor:
Wisse Hettinga ([email protected])
Managing Director / Publisher: Paul Snakkers
Editor: Jan Buiting ([email protected])
International editorial staff: Harry Baggen, Thijs Beckers,
Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens.
Design staff: Antoine Authier (Head), Ton Giesberts,
Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen
Graphic design / DTP: Giel Dols, Mart Schroijen
Marketing: Carlo van Nistelrooy
Subscriptions: Elektor International Media,
Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England.
Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447
Internet: www.elektor.com/subs
elektor - 7-8/2009
Elektor PCB Service
Your professional PCBs
and Prototypes
Elektor PCB Service is a new service from Elektor. You
can have your designs converted into a professionalquality PCBs via the www.elektorpcbservice.com
website. Elektor PCB Service is intended for prototype
builders and designers who want to have their PCBs
made to professional standards, and for users who
want customised versions of Elektor PCBs. If you need
a couple of ‘protos’ with fast turnaround or a batch of
5 to 50 units,
we can meet
your needs at
a favourable
price.
NEW!
The advantages at a glance
•
The PCBs are professional quality.
•
No film charges or start-up charges.
•
There is no minimum order quantity or charge
for this service.
•
Available to private and commercial customers.
•
We’ll first check if your project is producible.
We’ll let you know within 4 hours!
•
In order to supply two PCBs, we make three.
If the third board is also good, you receive it
as well – free of charge.
•
You can use our online payment module to pay
easily, quickly and securely with Visa or MasterCard.
Procedure:
1.
2.
3.
4.
5.
Create your account
Place your order
Your project is checked
Payment
Your order is shipped
Now available for everybody at
www.elektorpcbservice.com
Email: [email protected]
Rates and terms are given on the Subscription Order Form.
Head Office: Elektor International Media b.v.
P.O. Box 11 NL-6114-ZG Susteren The Netherlands
Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161
Distribution: Seymour, 2 East Poultry Street, London EC1A, England
Telephone:+44 207 429 4073
UK Advertising: Huson International Media, Cambridge House,
Gogmore Lane, Chertsey, Surrey KT16 9AP, England.
Telephone: +44 1932 564999, Fax: +44 1932 564998
7-8/2009 - elektor
Email: [email protected]
Internet: www.husonmedia.com
Advertising rates and terms available on request.
Copyright Notice
The circuits described in this magazine are for domestic use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs,
software carriers and article texts published in our books and magazines (other than
third-party advertisements) are copyright Elektor International Media b.v. and may
not be reproduced or transmitted in any form or by any means, including photocopying, scanning an recording, in whole or in part without prior written permission from
the Publisher. Such written permission must also be obtained before any part of this
publication is stored in a retrieval system of any nature. Patent protection may exist in respect of circuits, devices, components etc. described in this magazine. The
Publisher does not accept responsibility for failing to identify such patent(s) or other
protection. The submission of designs or articles implies permission to the Publisher
to alter the text and design, and to use the contents in other Elektor International
Media publications and activities. The Publisher cannot guarantee to return any material submitted to them.
Disclaimer
Prices and descriptions of publication-related items subject to change.
Errors and omissions excluded.
© Elektor International Media b.v. 2009
Printed in the Netherlands
8
elektor - 7-8/2009
Your source for MikroElektronika Development Tools and Accessories in the United Kingdom
We can supply all MikroElektronika development tools including compilers, development boards, add-on boards, programmers and starter packs. We aim to keep all products in stock for
same-day dispatch and can offer next-day delivery within the UK as well as insured delivery by airmail post or courier worldwide.
EasyPIC5 PIC Development Board - £89
Get off to the best start with
PIC microcontrollers with
the EasyPIC5. Supports 8,
14, 18, 20, 28 and 40-pin
PIC10F/12F/16F/18F
devices and features builtin USB programmer, incircuit debugger and useful
I/O devices. LCD displays
sold separately.
EasyPIC5 Starter Packs also available comprising
EasyPIC5, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler.
EasydsPIC4A dsPIC Development Board - £89
A versatile development
board for 18, 28 and 40-pin
digital signal controllers in
the dsPIC30F family, the
EasydsPIC4A provides
built-in USB programmer,
in-circuit debugger and
useful I/O devices. LCD
displays sold separately.
EasydsPIC4A Starter Packs also available comprising
EasydsPIC4A, character and graphic LCDs, touch panel,
temperature sensor and either BASIC, C or Pascal compiler.
EasyAVR5A AVR Development Board - £89
Get off to the best start with
AVR microcontrollers with
the EasyAVR5A. Supports
8, 14, 20, 28 and 40-pin
AVRs and features onboard USB programmer
and useful I/O devices.
LCD displays and SD card
sold separately.
EasyAVR5A Starter Packs also available comprising
EasyAVR5A, character and graphic LCDs, touch panel,
temperature sensor and either BASIC, C or Pascal compiler.
EasyARM ARM Development Board - £109
Easily develop for NXP¶s
32-bit ARM microcontrollers
with the EasyARM.
Includes on-board USB
programmer and useful I/O
devices and supports 64
and 144-pin devices. LCD
displays and SD card sold
separately.
Compilers
mikroBASIC, mikroC and
mikroPascal compilers now
available in versions for
PIC, dsPIC, AVR and 8051
microcontrollers. All feature
user-friendly development
environments, built-in
library routines and easy
integration with MikroElektronika¶s programmers and
debuggers.
NEW PRO versions just released for PIC and AVR existing mikroBASIC, mikroC and mikroPascal customers
can upgrade free-of-charge! Contact us for details.
BIGPIC5 PIC Development Board - £119
An advanced development
board for 64 and 80-pin PIC
microcontrollers in the 18F
family, the BIGPIC5 provides
on-board USB programmer,
in-circuit debugger plus
extensive I/O devices and
communications interfaces.
LCD displays and SD cardsold separately.
LV18FJ PIC Development Board - £89
Designed for low-voltage
PICs in the LV18FxxJxx
family with on-chip Ethernet
connectivity, the LV18FJ
incorporates USB programmer, in-circuit debugger and
useful I/O devices and
supports 64, 80 and 100-pin
MCUs. LCD displays and SD
card sold separately.
BIGPIC5 Starter Packs also available comprising BIGPIC5,
character and graphic LCDs, touch panel, temperature
sensor and either BASIC, C or Pascal compiler.
LV18FJ Starter Packs also available comprising LV18FJ,
character and graphic LCDs, touch panel, temperature sensor
and either BASIC, C or Pascal compiler.
dsPICPRO4 dsPIC Development Board - £149
LV24-33A PIC/dsPIC Development Board - £99
The new dsPICPRO4 is an
advanced development
board for 64 and 80-pin
dsPIC30F devices with builtin USB programmer, in-circuit
debugger and extensive I/O
features and communications
interfaces. LCD displays and
SD card sold separately.
dsPICPRO4 Starter Packs also available comprising
dsPICPRO4, character and graphic LCDs, touch panel,
temperature sensor and either BASIC, C or Pascal compiler.
BIGAVR2 AVR Development Board - £89
Work with 64, 80 and 100-pin
AVR microcontrollers with the
BIGAVR2 development
board. Includes built-in USB
programmer and range of onboard I/O devices. LCD
displays and SD card sold
separately.
Easily develop 16-bit PIC24
and dsPIC33 applications
with the LV24-33A. Features
USB programmer and incircuit debugger plus useful
I/O devices and supports 64,
80 and 100-pin low-voltage
devices. LCD displays and
SD card sold separately.
LV24-33A Starter Packs also available comprising LV24-33A,
character and graphic LCDs, touch panel, temperature sensor
and either BASIC, C or Pascal compiler.
Easy8051B 8051 Development Board - £89
Get off to the best start with
Atmel¶s Flash 8051 microcontrollers with the
Easy8051B. Supports 14,
16, 28, 32, 40 and 44-pin
8051s and features onboard USB programmer and
useful I/O devices. LCD
displays sold separately.
BIGAVR2 Starter Packs also available comprising BIGAVR2,
character and graphic LCDs, touch panel and either BASIC,
C or Pascal compiler.
Easy8051B Starter Packs also available comprising
Easy8051B, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler.
EasyPSoC4 PSoC Development Board - £89
UNI-DS3 Universal Development Board - £99
Learn about and develop for
Cypress¶s exciting PSoC
mixed-signal array devices
with the EasyPSoC4.
Features built-in USB
programmer and advanced
I/O devices and supports 8,
20, 28 and 48-pin PSoCs.
LCD displays and SD card
sold separately.
Add-on Boards
We stock an extensive
range of add-on boards that
plug straight onto MikroElektronika¶s development
boards including A/D, D/A,
RS-485, CAN, LIN,
Ethernet, IrDA, RTC,
EEPROM, Compact Flash,
SD/MMC, MP3, Bluetooth,
ZigBee, RFid, stepper motor
driver and many more.
NEW range of GSM/GPRS and GPS add-on boards and
accessories just released. Contact us for details.
With the UNI-DS3 you can
easily work with a number of
popular microcontrollers from
different manufacturers simply
by buying optional plug-on
MCU cards. Devices supported include PIC, dsPIC,
AVR, 8051, ARM and PSoC.
MCU cards, LCD displays and
SD card sold separately.
Starter Packs
Save money by buying one
of our Starter Packs. Each
includes a development
board with options such as
LCD displays, touch panel,
temperature sensor and
come with a full version of
either mikroBASIC, mikroC
or mikroPascal. Available for
PIC, dsPIC, PIC24/dsPIC33,
AVR and 8051.
NEW PIC and AVR Starter Packs now come with PRO
versions of mikroBASIC, mikroC or mikroPascal.
Please see our website at www.paltronix.com for further details of these and other products
We also stock components, control boards, development tools, educational products, prototyping aids and test equipment
Paltronix Limited, Unit 3 Dolphin Lane, 35 High Street, Southampton, SO14 2DF | Tel: 0845 226 9451 | Fax: 0845 226 9452 | Email: [email protected]
Secure on-line ordering. Major credit and debit cards accepted. Prices exclude delivery and VAT and are subject to change.
Luxeon Logic
Brightness control for LED
torches
type, since the maximum rated current of the
2N2222 is 600 mA.
With regard to the quite simple circuit, we
can mention that it lacks a crystal because
the clock is provided by the internal 8-MHz
oscillator of the ATtiny microcontroller. The
firmware [1] is written in BASCOM and works
with PWM control using the internal clock
divider (1:8). If any changes are made, this
should be maintained to ensure that the
firmware runs at 1 MHz, which reduces the
current consumption.
A suitable small PCB is available via the Elektor website, and as usual the layout can be
downloaded free of charge [1]. The author
[2] designed a round PCB that fits nicely
in a pocket torch with three AA
batteries.
Oliver Micic (Germany)
COMPONENT LIST
Features
• Three selectable brightness levels
• One-button operation
• Microcontroller control circuit
• Current consumption in sleep mode only 1.2 µA
R1
C2
C1
22u
100n
3R3
The small super-bright Luxeon LEDs from Philips
are suitable for many applications, including
small but handy (that is, bright) pocket torches.
However, you don’t always need maximum
brightness, so it would be nice to have a simple brightness control. After giving this question a bit of thought, the author designed the
circuit described here. An ATtiny microcontroller enables convenient one-button operation. Three brightness levels can be selected by
pressing the button one to three times
in succession, and pressing it yet again
switches the LED off. In this state the
ATtiny enters sleep mode with a current consumption of around 1.2 µA.
The current consumption rises to
around 12 mA in normal operation,
plus the current through the LEDs. At
4.5 V, the currents measured by the
author at the three brightness settings
were 50 mA, 97 mA, and 244 mA.
The LED current can be set to other
levels by adjusting the value of R1
in the circuit, although the maximum operating current of the LED
should not exceed 350 mA. If you
want to use more than one LED, you
will have to use a different transistor
LED1
8
1
BT1
T1
2
4V5
2N2222
5
PB5(RESET)
PB4(XTAL2)
IC1
PB3(XTAL1)
PB1(MISO)
ATTiny25
PB0(MOSI)
S1
PB2(SCK)
3
6
7
T2
(081159-I)
Internet Links
[1] www.elektor.com/081159
[2] www.dg7xo.de
Downloads
R2
390R
081159-1: PCB design (.pdf), from [1]
081159-11: Source code and hex files, from [1]
2N2222
4
Product
081159-41: ATtiny25 microcontroller, ready
programmed
ON
081159 - 11
Resistors
R1 = 3Ω3 (1206)
R2 = 390Ω (1206)
Capacitors
C1 = 100nF (1206)
C2 = 22µF 10V (SMD)
Semiconductors
T1,T2 = 2N2222 (SOT-23)
IC1 = ATtiny25-20SU (SOT-8)
LED1 = Luxeon LED, 1W (SMD), white
Miscellaneous
Pushbutton
PCB # 081159-1 [1]
Preamplifier for RF Sweep Generator
Gert Baars (The Netherlands)
The RF sweep frequency generator (‘wobbulator’) published in the October 2008 issue of
Elektor has a receiver option that allows the
instrument to be used as a direct-conversion
receiver. This receiver does however have
a noise floor of only –80 dBm, which really
should have been –-107 dBm to obtain a sen-
10
sitivity of 1 µV. So, for a good receiver some
more gain is required. A wideband amplifier,
however, generates a lot of additional noise
as well and as a consequence will not result
in much of an improvement.
As an experiment, the author developed a
selective receiver with a bandwidth of about
4 MHz. Because a gain of at least 35 dB is
required, the preamplifier consists of two
amplifying elements.
The input amplifier is designed around a
dual-gate MOSFET, type BF982. This component produces relatively little noise but provides a lot of gain. The output stage uses a
BFR91A for some additional gain.
elektor - 7-8/2009
1k2
220Ω
470Ω
Preamplifiers where both the gate
of clicking the scan stop button and
and the drain are tuned often strugthen clicking on the signal in the dis+9V
gle with feedback via their interplay window using the right mouse
nal capacitance. Here, the drain cirbutton. Af ter this, the receiver
C5
*
cuit has a relatively low impedance,
switches directly to this frequency
100µ 16V
which prevents this from happening.
and you can listen to the signal. You
R1
In the prototype that was tested, the
can subsequently resume the scanK2
L2
C6
C3
*
input and output are located at right
ning so that you can continue to
100n
100n
50Ω
angles with respect to each other
look for other signals.
*
to prevent inductive coupling (see
photo). Despite the high gain, the
For narrowband FM detection you
T2
amplifier was perfectly stable even
need to select the FMN button in
T1
without any shielding.
the window for the receiver and this
BFR91-A
The two air-cored coils in the circuit
then provides the required offset for
both consist of 4 turns and have an
the edge detection at 25 kHz bandBF982
L1
width. This value is adjustable via the
internal diameter of 6 mm, made
K1
* C1 R2 C2
R3
C7
from 1-mm diameter silvered copper
‘setting’ menu (default is 12,500 Hz)
C4
50Ω
and can be changed experimentally
wire and with a tap after 1 turn.
22p
100n
100n 22p
The amplifier is mainly intended for
for best results.
the 144 MHz amateur band, but with
090134 - 11
other coils can also be used for the
To power the circuit you can use a 9FM broadcast band, for example. FM
V battery. It is also possible to power
detection is achieved by tuning near
the amplifier directly from the RF
the edge of the IF filter. At an offset of 15 kHz outdoor antenna will give good results. Add- sweep generator, if output capacitor C6 is
this is only a few dB lower than at the cen- ing this wobbulator/receiver option results in replaced with a link; in the ‘options’ menu
tre of the pass-band, so that damping is not a nice monitor receiver. By setting the scan you will then have to select the option ‘use
noticeable. The measured sensitivity in the frequencies of the spectrum analyser to 144 probe’.
(090134-I)
2 m band was about 1 µV (6 dB).
and 146 MHz (or 148 MHz where applicable),
A good antenna always contributes to the any signal within this range is directly visible.
reception, of course. A wideband (scanner) When a signal is detected it is merely a case
Cheap Serial Port for the Mac
Gerrit Polder (The Netherlands)
Many people would agree that the Apple
Macintosh is a fantastic computer. Even so,
it’s been less popular for a good while
amongst electronics engineers and
enthusiasts. Of course there was a
good reason for this: Apple was one of
the first companies that left out the
ever so useful RS232 port. And not
only on their notebooks (sorry, MacBooks), they also left them out from
their desktop computers. It’s been
a good 10 years since Apple started
delivering those beautiful, futuristic
iMacs in a range of colours, but unfortunately without an RS232 port.
However, times change and Apple has
steadily increased its market share, also
amongst electronics enthusiasts. And as far
as ‘the other brands’ are concerned, there is
virtually no laptop made nowadays that does
come with an RS232 port.
The RS232 port is still considered very useful by many electronics-minded people
though. These days microcontroller circuits
that employ ersatz-RS232 often work at 3 V
7-8/2009 - elektor
rather than 5 V. The ±12 volt swing
originally specified for RS232 isn’t
found or indeed useful anymore. For
that reason a checklist was created to
help you add a 3 or 5 volt RS232 port to
your Macintosh (or other computer) at
v e r y l i t t l e cost.
be 3 volts for most modern telephones; for
older models it is usually 5 volts.
3. You will usually get some software for Windows with the cable — if you can use it you’re
done. Congratulations!
4. Mac users have to do a bit more work
though. Connect the cable to the computer and have a look in the System Profiler
(Applications/Utilities) under Hardware/
USB to see what type of interface it is.
A s a n e x a m p l e, yo u co u l d s e e t h e
following:
usb data cable:
Version:
Bus Power (mA):
Speed:
Manufacturer:
Product ID:
Serial Number:
Vendor ID:
1. Buy a GSM USB cable from a shop or via
the Internet from Hong Kong; it shouldn’t
cost a lot.
2. Look at [2] for the pinout of the plug. It will
tell you what connections are used by RS232
and what the operating voltage is. This will
1.00
500
Up to 12 Mb/sec
Silicon Labs
0x10c5
0001
0x10ab
5. You can see from this that you have a ‘Silicon Labs’ interface. From the website of this
company [1] you download the CP210x USB
to UART Bridge Virtual COM Port (VCP) driver
for Mac OS X.
11
6. The driver is installed by double-clicking on
the SLAB_USBtoUART Installer.
7. Unfortunately, the standard Product and
Vendor ID of this driver do not correspond
with those of the GSM cable, but that is easily
rectified. The Product and Vendor ID that discovered in step 4 can be included in the file:
/System/Library/Extensions/SLAB_USBtoUART.
kext/Contents/Info.plist. All that’s left to do is
to type a few instructions to load the driver.
tty.SLAB_USBtoUART
as proof that the new COM port is available.
8. Open a terminal session and type:
$ sudo kextload /System/Library/Extensions/
SLAB_USBtoUART.kext
$ touch /System/Library/Extensions
$ ls -al /dev/tty.SLAB*
(090092-I)
Internet Links
[1] www.silabs.com
If all went well you should see something like
this:
[2] http://pinouts.ru
crw-rw-rw- 1 root wheel 9, 8 Oct 18 08:32 /dev/
0–18 MHz Receiver
+5V
IC4
78L05
+9V
330 Ω
R1
ANT1
C18
L1
10µH
C3
C12
C13
100n
4µ7
100n
220µ
C17
F1
8
C1
1n
1
2
IN A
IN B
7
OUT A
OUT B
4
1
L3
5
3
1n
7
OUT
AD8307
+IN
INT
OFS
6
C6
C8
10p
C5
8
IC2
–IN
4
R2
3
10k
C16
5
680nH
OSC
C2
4µ7
EN
45M15AU
IC1
NE612
6
150p
C9
15p
C10
C11
22p
3
C14
C15
3n9
3n3
2
1n
10p
10n
P1
2
1
6
8
IC3
7
4
5
C20
47µ
LS1
C19
LM386N-3
68n
50k
+5V
090082 - 11
P3
5k
BAND
P2
100k
15p
C7
22p
T1
BC547B
R4
4k7
L2
C4
25k
FINE
R3
R5
820 Ω
D1
BB204
270nH
Gert Baars (The Netherlands)
The receiver shown in the schematic has
some characteristics not unlike those of the
so-called ‘world band receivers’ from the old
days, which could usually receive LW, MW
and SW up to about 20 MHz in AM and which
were crammed with transistors. Because
of the ‘low-budget’ character of this circuit
it forgoes a tuning scale/indicator and the
design has been kept as simple as possible.
Nevertheless, the name ‘Mini World Receiver’
would not be inappropriate for this design.
12
In the RF bands up to 30 MHz, the majority of
stations can actually be found below 18 MHz.
It is possible to make a receiver for this with a
relatively simple circuit. The simplicity of the
circuit is therefore its primary strength, but
that does not mean that the results are poor.
The receiver is a single superheterodyne with
the salient characteristic that the receiving
range from DC to 18 MHz can be tuned in a
singe range.
The circuit uses a high intermediate fre-
quency (IF). This makes the image frequency
large, so that its suppression is very easy,
which contributes to the simplicity of the circuit. This also means that the ratio between
the highest and lowest required VFO frequencies remains small as well.
The circuit starts with a NE612 mixer IC (IC1),
which also contains an oscillator. The oscillator is a Colpitts type and is tuned here using
a dual-varicap diode (D1). The Mixer is followed by a crystal filter which has a centre
elektor - 7-8/2009
frequency of 45 MHz and a bandwidth of
15 kHz. This bandwidth is a little large for
AM, but the advantage of the filter, type
45M15AU, that is used here, is that it is priced
quite favourably.
noise suppression.
The AF amplifier follows this filter and is
configured for a gain of approximately 200.
This is enough to drive a speaker so that it
exceeds the ambient noise. If necessary the
volume can be adjusted with P1.
To tune such a large frequency range it is certainnly preferable to use a multiturn potentiometer. Because of the low-budget character
of this design, a circuit around two potentiometers is used instead. A transistor configured as a current source provides a constant
voltage of about 1 volt across the ‘Fine’ tuning potentiometer (P2). The ‘Band’ potentiometer (P3) has a negligible effect on the
voltage across the ‘Fine’ potentiometer, but
it does allow the voltage at both extremes
to be changed. In this way the ‘Band’ control
can be used to select a window within which
the ‘Fine’ potentiometer is used for the actual
tuning. The ratio is about 1 to 5. If you prefer a ratio of, say, 1 to 10, you can increase
the emitter resistor R4 from 4.7 kohms to
10 kohms.
Because the VFO has to be stable, only the
power supply to the mixer/VFO IC has been
regulated. The power supply voltage to the
AD8307 has been reduced with a resistor to
a safe value, while the AF amplifier is pow-
With an IF of 45 MHz and a receiving range
from DC to 18 MHz, the VCO frequency therefore has to be IF+F0 = 45 to 63 MHz. The image
frequency is now 90 MHz higher than the
desired receiver frequency, at 90–108 MHz. A
single coil in series with the antenna provides
sufficient suppression at these frequencies. It
really cannot be any simpler.
After the IF filter follows an LC combination
which suppresses the fundamental frequency
of the IF filter (45M15AU is a 3rd overtone
type) and increases the damping. A logarithmic detector was chosen for the IF amplifier.
The advantage is mainly the small number
of external components that are required for
this. The detector is an AD8307 (IC2) and has
a sensitivity of about –75 dBm, which works
out to about 40 μV. Together with the gain
of the mixer (around 17 dB) the sensitivity of
the receiver ends up at about 5 μV. Because
of the logarithmic characters of the detector,
an AGC (automatic gain control) is not necessary. A simple RC filter subsequently provides
some additional fundamental frequency and
ered directly from the battery. The current
consumption of the circuit without a signal
is less than 20 mA and with good audible
audio about 50 mA. The circuit continues to
work well with power supply voltages down
to about 6.5 volts. This means that a 9 V battery will last extra long.
Calibration of the circuit is simple. The tuning potentiometers have to be set to the
lowest frequency first. Use trimmer capacitor C7 to find a point where AC power line
hum becomes audible. Here the receiver
frequency is at 0 Hz. Optionally you can also
tune to a strong longwave station as the lowest receiver frequency.
As a minimum a simple telescoping antenna
with a length of 50 cm is required, which
makes the receiver eminently suitable for
portable use. With such an antenna dozens
of stations are audible, particularly during
the evening when propagation becomes
favourable. A length of wire several meters
long does however increase the signal
strength, particularly during the day, but it
is not strictly necessary.
(090082-I)
Start-up Aid for PCs
A
VSTANDBY
A
R3
33k
100k
R2
R
B
8
2
7
3
RSI
IC1
8
RST
RST
SEN
TL7705
CT
CRF
5
B
C3
THR
C
1n
1
E
R
6
6
4
2
IC2
TR
D
OUT
NE555
7
3
R4
T1
C
100Ω
BC547
DIS
D
CV
4
68µ
C2
R1
4k7
C1
1
100n
C2
C
2µ2
5
C4
E
10n
090128- 12
090128 - 11
Egbert Jan van den Bussche (The Netherlands)
Since one of the servers owned by the author
would not start up by itself after a power failure this little circuit was designed to perform
that task.
The older PC that concerned did have a
7-8/2009 - elektor
standby state, but no matching BIOS setting that allows it to start up unattended.
Although a +5 V standby supply voltage is
available, you always have to push a button for a short time to start the computer up
again. Modern PCs often do have the option
in the BIOS which makes an automatic start
after a power outage possible. After building in the accompanying circuit, the PC starts
after about a second. Incidentally, the pushbutton still functions as before.
The circuit is built around two golden oldies:
a NE555 as single-shot pulse generator and a
13
TL7705 reset generator. The reset generator
will generate a pulse of about 1 second after
the supply voltage appears. The RC circuit
between the TL7705 and the NE555 provides
a small trigger pulse during the falling edge
of the 1 second pulse. The NE555 reacts to
this by generating a nice pulse of 1.1RC. During that time the output transistor bridges
the above mentioned pushbutton switch of
the PC, so it will start obediently.
Other applications that require a short duration contact after the power supply returns
are of course also possible.
(090128-I)
Port Expander
Steffen Graf (Germany)
D1
R2
P4
P5
P6
P7
P8
P9
P10
P11
P12
P13
IC1
K1
P14
34
33
35
4
P15
DIN
P16
SCLK
P17
CS
P18
DOUT
P19
P20
P21
SPI
P22
P23
C2
100n
100µ
P24
P25
P26
P27
1
P28
ISET
P29
P30
R1
P31
2
32
30
28
K2
The instruction
26
5
io_max7301(0xF, Portpins);
7
9
11
6
GPIO
8
io_max7301(0x0, Portpins);
10
12
13
configures port pins as inputs. To output
data from the port pins use
K3
14
set_max7301(data, Portpins);
15
where data = binary data. And the
instruction
16
17
18
19
selects port pins used as outputs. A
macro expression such as PCONF8_11 is
used for Portpins to refer to port pins 8
to 11. The instruction
GPIO
20
data = get_max7301(Portpins);
reads the binary value of input data.
(080247-I)
MAX7301
39k
The circuit shown here solves the problem using the I/O port expander IC type
MAX7301 from Maxim [1]. This device
can be powered from a supply between
2.5 V and 5 V which makes it suitable for
use with both 3.3 V and 5 V controllers
(the value of resistor shown as R2 is suitable operation from a 3.3 V supply).
The port expander uses the SPI interface
so it only requires four microcontroller
pins: Data In, Data Out, Clock and Slave
Select. Many microcontrollers have an
SPI interface already implemented onchip but if not it should be relatively easy
to implement the function in software.
We have sacrificed four pins on the interface but this port expander now gives
us 28 general purpose I/O pins (GPIOs)
which can be configured as either inputs
(with or without pull-ups) or outputs.
Providing the microcontroller is fast
enough the GPIOs can be switched at a
C1
36
330 Ω
It can sometimes happen that even
when using the largest version of a
microcontroller for a particular design
application there are just not enough I/
O port pins to handle all the inputs and
outputs. This can be the case when for
example several LCDs are driven in parallel or when it is necessary to input values from a large number of switches and
pushbuttons.
rate of 26 MHz.
The project page of this article [2]
includes full listings (in the form of a
small C library) of the author’s software
implementation. This allow the ports to
be configured as inputs or outputs and
the value of the input port pins to be
read or output pins to be set.
VCC
21
22
23
K4
Internet Links
24
[1] http://datasheets.maxim-ic.com/en/ds/
MAX7301.pdf
25
27
29
GPIO
[2] www.elektor.com/080247
31
Download
3
080247 - 11
Software
080247-11 source code, from [2]
Slow Glow
Dirk Visser (The Netherlands)
There are many different ways in which a
lamp can be made to light up gradually. This
circuit presents one of them. What is special about this circuit is that it can be turned
into a power potentiometer with only a small
modification.
Slow Glow operates as follows: the instant
the circuit is turned on, the inverting input
14
of the opamp is at the same voltage as the
inverting input, which is equal to the supply voltage. However, C1 will slowly charge
up, which causes the voltage on the inverting input to drop. This voltage therefore
looks like an inverted RC charging curve.
The reduction of this voltage causes the
output voltage of IC1 to increase, and T1
is driven open harder. This in turn causes
the voltage across the lamp to follow the
shape of an RC charging curve, and the use
of a transistor means that a large current
can be supplied.
When it comes to the choice of op amp you
have to keep in mind its common mode
range. In this circuit it needs to be equal to
the full supply voltage. As a voltage follower
the need is therefore for a rail-to-rail opamp.
An LM8261 was picked mainly because it
elektor - 7-8/2009
combines an exceptionally small
package (SOT23-5, 2.92 x 2.84 mm)
with an equally exceptional supply
voltage range of 2.7 V to 30 V. There
are very few rail-to-rail opamps
offering such a large supply voltage range. The opamp has been
decoupled with C3 because of its
speed (GBWP: 21 MHz). The speed
isn’t critical in this case though. R3
is connected in series with the MOSFET to prevent spurious oscillations
from occurring.
It stands to reason that this circuit is best built using SMD components. C1 can be obtained in an
0805 package (ceramic multilayer)
and all other parts are also available in SMD packages. For the MOSFET we found an SOT-223 variant made by ST,
the STN4NF03L. It can switch more than 6 A,
which is impressive considering its dimensions (7 x 6.5 mm). If more power is needed
than the maximum dissipation of 3.3 W (at
25 °C) permits, there is no problem if a bigger FET is used (for example, one in a larger
pate the maximum power for only
just over a tenth of a second. This
power is obviously dependent on
the type of lamp connected up. The
gate-source voltage of the MOSFET
determines the permissible supply
voltage range. The absolute maximum value here is 16 V, and there
is also a minimum voltage required
to obtain a low channel resistance
(<0.05 Ω at U GS = 5 V). Hence the
supply voltage range for this circuit
is 6 to 15 V and a 16 V rated type for
C1 is sufficient.
S1
LA1
C3
100n
C1
BT1
6...15 V
1
IC1
2u2
16V
3
R2
100k
4
T1
5
LM8261
1
STN4NF03L
2
C2
100k
R1
R3
100R
D
1n
G
D
S
090029 - 11
D2PAK package). There is a large number of
FETs available in this type of package that can
cope with significantly higher currents and
power.
The circuit can also be used with normal 12 V
halogen lighting if a bit of cooling and a TO220 package is used. With the values used
for R1 and C1 the transistor needs to dissi-
When C1 and R1 are replaced with
a potentiometer (with the slider
connected to R2), the whole circuit
behaves much like a potentiometer, but one with very large output power.
The MOSFET is driven by IC1 such that a
balance exists between the inputs of the
op amp. The voltage at the drain therefore
becomes equal to the voltage at the wiper
of the potentiometer.
(090029-I)
SRPP Headphone Amplifier
40mA
230V
65W
C8
D5
470uF
400V
F3
C2
4700uF
10V
Mention valve amplifiers and many designers go depressive instantly over the thought
of a suitable output transformer. The part
will be in the history books forever as esoteric, bulky and expensive because, it says, it
is designed and manufactured for a specific
valve constellation and output power. There
R6
470uF 100n
400V 400V
5W
5W
K4
290V
80V
C11
R8
0
2W
C7
TR2
4A T
6V3
40W
100R
F4
100R
200mA T
(400mA T)
C10
100n
400V
D6
K2
6V3
1A52
C9
270k
D4
R7
100k
5
200mA
D3...D6 = 4x1N4007
C4...C7 = 4x1n/1000V
Martin Louw Kristoffersen (Denmark)
7-8/2009 - elektor
C5
C6
9
2V4
R2
62R
100k
R1
100k
P1
315mA T
(630mA T)
F2
100k
7
2V4
62R
V1
EL84
6BQ5 2
C1
220n
TR1
145V
3
10V
1W3
230V
(120V )
R3
5
D2
10V
1W3
K3
7
10k
R4
470uF
350V
R5
470R
5W
D3
0
F1
4
D1
C4
2
3
C3
290V
9
4
V2
EL84
6BQ5
K1
R9
K5
6V3
R10
081151 - 11
exist thick books on valve output transformers, as well as gurus lecturing on them and
winding them by hand. However, with some
concessions to distortion (but keeping a lot of
money in your pocket) a circuit configuration
known as SRPP (series regulated push-pull)
allows a low-power valve amplifier to be built
that does not require the infamous output
transformer. SRPP is normally used for pream-
plifier stages only, employing two triodes in
what looks like a cascade arrangement.
Here we propose the use of two EL84 (6BQ5)
power pentodes in triode SRPP configuration. The reasons for using the EL84 (6CA5)
are mainly that it’s cheap, widely available
and forgiving of the odd overload condition.
Here, two of these valves are SRPP’d into an
15
amplifier that’s sure to reproduce that ‘warm
thermionic sound’ so much in demand these
days.
Before describing the circuit operation, it
must be mentioned that construction of this
circuit must not be attempted unless you
have experience in working with valves at
high voltages, or can rely on the advice and
assistance of an ‘old hand’. As a safety measure, two anti-series connected zener diodes
are fitted at the amplifier output. These
devices protect the output (i.e. your headphones and ears) against possibly danger-
ous voltages at switch-on, or when output
capacitor C3 breaks down.
The power supply is dimensioned for two
channels, i.e. a stereo version of the amplifier.
The values in brackets are for Elektor readers on 120 VAC power. Note the doubled values of fuses F1 and F3 in the AC primary circuits. The PSU is a conventional design, possibly with the exception of the 6.3 V heater
voltage being raised to a level of about +80 V
through voltage divider R7-R8. This is done
to prevent exceeding the maximum cathodeheater voltage specified for the EL84 (6CA5).
R6 is a bleeder resistor emptying the reservoir
capacitors C8 and C9 in a quick but controlled manner when the amplifier is switched
off. Rectifier diodes D3–D6 each have an antirattle capacitor across them.
In the amplifier, assuming the valves used
have roughly the same emission, the halfvoltage level of about +145 V exists at the
junction of the anode of V1 and the control
grid of V2. The SRPP is no exception to the
rule that high quality, (preferably) new capacitors are essential not just for reproducibility
and sound fidelity, but also for safety.
(081151-I)
Easy LEGO Robotics Set Up
Tilo Gockel (Germany)
At the beginning of 2006 the Danish company LEGO introduced the NXT programmable brick into their ‘Robotics Invention System’. Many schools and universities all over
the world have since recognised this as an
ideal tool to introduce the concepts of software and hardware design. Spare parts or
additional components for the system can
be purchased from on-line auction sites or
ordered from the LEGO web shop [1].
If you are planning to invest in the system for
a child, teenager or even for your own personal use you should be aware that you may
encounter some issues when first installing the software. The problems can occur
on machines running Windows XP or Vista
because the software is not officially supported. The following tips will be helpful and
should solve the main problems you are likely
to come across.
First off, try installing the software on the
supplied CD as suggested in the manual.
With any luck it will be successful. Choose
‘complete installation’ option and then tick
Quicktime 2.1 option and not the Quicktime
3.0 and DirectX 6.1. It is likely that there is a
more up to date version of DirectX already
installed on your machine. It is important to
specify Quicktime 2.1; more recent versions
are not recognised!
In some cases the computer may now ‘hang’
when it tries to execute probe.exe, if this is
the case then it is necessary to make a few
changes to the installation:
1. Uninstall the LEGO software (Program files
/ LEGO MINDSTORMS / ... / uninstall)
2. Uninstall all versions of Quicktime (Start /
Control Panel / Add or Remove Programs
/ right click on Quicktime)
16
3. Re-install the LEGO software selecting screen Display Properties; a solution to the
Quicktime 2.1.
problem can be found at [2].
4. Start / Control Panel / System / click
‘Advanced’ tab / Per formSome practical tips for newcomers to
ance click ‘Settings’ / click
the LEGO system: commu‘Advanced’ tab / Now on
nications between
‘Virtual memory’ reduce
the brick and
the size to 384 MB.
the IR transmitter can be disStep 4 is imp or tant,
rupted by strong
otherwise Quicktime
ex ternal light
reports that there is
sources such as
too little memory
table lamps and
available and does
fluorescent lighting.
not even start —
A green LED on the IR
a somewhat
transmitter indicates
curious bug.
that the communication
was successful. When it
Now a
is anticipated that the syschange
tem will not be used for a
i s n e cperiod of time don’t forget
essar y to
to remove the battery from
the start icon
the IR transmitter station.
for Mindstorms;
The IR tower needs a serial port
right click on the LEGO
but newer computers do not usuMindstorms desktop icon and
ally have this type of port, in this
select ‘Properties’, now click the Shortcut
case try a USB — infrared transmittab and change the ‘Start in’ path from ‘C:\ ter
dongle these can be found on InterProgram\LEGO MINDSTORMS\probe.exe’ to net auction sites and retail at relatively low
‘C:\Program\LEGO MINDSTORMS’. Occasion- prices. Alternatively an even cheaper solually a problem will occur with the Windows tion is a USB to RS232 interface (e.g. the USB2
installer service (error 1281) which causes Serial USB 1.1 from Reichelt in Germany).
the computer to hang. To get round this you
can either reboot before each new installa- Several alternative programming environtion or you can manually stop the installer ments have been developed for the LEGO
by going to Start / Control panel / Adminis- system and for more adventurous projects
trative tools / Services / right click Windows like those described in [3] it is better to use
Installer and click on the service status box a high-level compiled language rather than
‘Stop’. Now run the software by clicking on the LEGO graphic programming environment
the desktop LEGO icon (make sure that the which comes bundled with the controller. A
CD is in the computer’s CD drive). Installing good choice is the free NQC (Not Quite C)
the older LEGO Robotics Invention Version 1.0 cross compiler [4] which uses a C-like syntax.
can sometimes generate a problem with the
(081129-I)
elektor - 7-8/2009
Internet Links
[1] http://shop.lego.com/ByCatalog
http://www.lego.com/education/school
[2] www.crynwr.com/cgi-bin/ezmlm-cgi/7/21888
[3] www.tik.ee.ethz.
ch/tik/education/lectures/PPS/mindstorms/#finished
www.youtube.com/results?search_type=&search_qu
ery=lego+mindstorms&aq=f
www.informatik.uni-kiel.
de/rtsys/lego-mindstorms/projekte/#c1798
[4] http://bricxcc.sourceforge.net/nqc/
Pseudo Fan
Dr. Thomas Scherer (Germany)
V+
The aim of this circuit is to trick a so-called
‘intelligent’ fan controller that a fan is connected to it when it is not. This may sound
like madness, yet there is method in it.
D1
SB140
R1
47k
P1
The author was so pleased with his small private server (a network attached storage, or
NAS, device) that he recommended it to a
friend. The friend had found a good source of
low-cost SSDs (solid state disks) and replaced
the spinning hard disks with semiconductor
memory, with the aim of saving power. With
the drives replaced, it became apparent that
there was an opportunity to make the unit
quieter still. Since the SSDs only dissipated a
4
8
R
6 THR
IC1
7
2
OUT
DIS
3
470k
NE555
TR
CV
5
C3
47µ 16V
C1
C2
100n
10n
1
090445 - 11
Characteristics
• simulates a fan of any size(!)
• pseudo-rotation frequency adjustable from
15 Hz to 150 Hz
• current consumption less than 5 mA
Old hands will no doubt be able to guess
what comes next: the 555 timer, one of the
best-selling ICs ever, is ideal for this task. It
can cope with the range of supply voltages,
and conveniently features a traditional open-
• operating voltage from 4 V to 15 V
It immediately became clear that the fan had
a standard three-pin connector. The cable
carried a voltage of between +5 V to +12 V on
the red wire and ground on the black wire; on
the yellow wire the fan produced a squarewave signal with a frequency of about 35 Hz.
To fool the controller into thinking that the
fan is turning we simply needed to generate
a square wave!
7-8/2009 - elektor
IC1
©Elektor
C2
RT
GE
SW
C3
C1
P1
R1
Resistors
R1 = 47kΩ
P1 = 470kΩ, small, upright
Capacitors
C1 = 100nF
C2 = 10nF
C3 = 47µF 16V
Semiconductors
D1 = SB140 (Schottky diode)
IC1 = NE555
Miscellaneous
Branched cable with 3-way plug
PCB # 090445-1
090445-1
rotkelE©
1-544090
total of 5 W, surely it would be possible to disconnect the noisy internal 60 mm fan?
Unfortunately it was never going to be that
easy. The moment the fan was disconnected
an annoying buzzer started to sound continuously: the electronics in the NAS box does
not just control the fan speed to maintain a
reasonable temperature inside the unit, it
also checks that the fan is indeed spinning.
If the controller thinks the fan has stopped, it
sounds the alarm. The author was called in to
see if he could solve the problem.
COMPONENT LIST
D1
• low noise!
collector output.
The circuit diagram contains no great surprises. Rather than using the standard astable configuration of the device, the frequency-determining resistance (comprising
the series connection of R1 and P1) is wired to
pin 3, which is normally used as the output.
This has the twin advantages of leaving pin 7
free to use as an open-collector output and
of giving a 50 % duty cycle. With the component values suggested the output frequency
can be adjusted from approximately 15 Hz to
approximately 150 Hz, which should be more
than enough for any application.
It is of course possible to build a simple circuit like this on a small piece of prototyping
board. However, a much more professional
look can be achieved using the printed circuit board we have designed for the job. The
layout file can, as usual, be found on the Elektor website on the pages accompanying this
article [1].
The pseudo-fan is of course not limited to
being used in small servers. It is becoming
more and more popular to build PCs that
are quiet, especially if they are to be used
as media centres. This means using passive
cooling wherever possible. Unfortunately in
some cases the BIOS throws its spanner in
the works by not allowing the fan rotation
sensors on the motherboard to be disabled
individually. The pseudo-fan provides a simple and quick solution to this problem and
avoids complicated BIOS patches. Some fans
use a four-wire cable, and these too can be
‘virtualised’ using this circuit by ignoring the
fourth wire and connecting the remaining
three in the way described above.
If it will not be necessary to adjust the pseudofan speed P1 can be replaced by a wire link
and R1 chosen appropriately. The frequency
is then given by f = 1.44 / (2 x R1 x C1).
(090445-I)
Internet Link
[1] www.elektor.com/090445
Download
090445-1: PCB design (.pdf), from [1]
17
Programmable Nokia RTTTL Player
Sajjad Moosavi (Iran)
18
FurElise:d=4,o=6,b=125:8e, 8d#, 8e,
8d#, 8e, 8b5, 8d, 8c, a5, 8p, 8c5, 8e5,
8a5, b5, 8p, 8e5, 8g#5, 8b5, c, p, 8e5,
8e, 8d#, 8e, 8d#, 8e, 8b5, 8d, 8c, a5,
8p, 8c5, 8e5, 8a5, b5, 8p, 8e5, 8c, 8b5,
2a5
The string consists of three parts
separated by colons. The first part is
the song name, ‘FurElise‘ (apologies
from Mr ASCII to the Beethoven Heritage for the non-umlauted u). The
second part contains the defaults,
with ‘d=4’ meaning that each note
without a duration specification is by
default a quarter note, ‘o=6’ setting
the default octave, and ‘b=125’ defining the tempo. The third part comprises the notes proper. Each note is
separated by a comma and includes,
+5V
in sequence: a duration specification,
a standard music note (as shown in
first column of the table) and an
C3
octave specification. If no duration
R2
or octave specification is present,
C2
100n
the default applies.
100µ
8
The circuit shown in Figure 1 con16V
tains an ATtiny13 microcontrol1
7
PB5/RESET
PB2
ler programmed to read the RTTTL
IC1
2
6
PB3
PB1
T1
format (with some modification),
ATTiny13
R1
3
5
PB4
PB0/OC0A
220 Ω
store strings in its program memory and generate notes in the form
BD139
4
of square waves. The note frequenS2
C1
LS1
cies are read from a table stored in
8Ω
220n
memory and durations will be calNEXT
culated in the program. The com090243 - 11
monly used octaves 3 through 7
(110 Hz – 3323.7 Hz) can be played
by this circuit.
The microcontroller is an 8-pin
ATtiny13 Atmel microcontroller
employing its internal oscillator.
The music signal generated at the
PB0 pin applied to a simple emitter
follower circuit that’s open to your
improvements in terms of filtering
and amplification. Also, because the
program puts a low demand on CPU
use and resources, you can make the
free microcontroller I/O ports do
other jobs. The microcontroller’s 1 KB
program memory is good for storing
The data section consists of a set of charac- about 20 songs. Other microcontrollers with
ter strings separated by commas, where each larger memories may be used to be able to
string contains a duration, note, octave and store more songs. As a minimum hardware
optional dotting (which increases the dura- requirement, the micro should have an 8-bit
tion of the note by one half). For example timer with compare/match capability.
here is RTTTL ringtone for the famous Für The microcontroller must first be pro Elise piece:
grammed with the firmware for the project.
4Ω7
This circuit is an easy way to play
monophonic music as you may
remember it (fondly or not) sounding from those good old Nokia 3310
cellphones. The circuit can be used
in applications like doorbells, phone
ringers, bike horns or any other alarm
circuit — waves of recognition and
cellphone wistfulness in the audience guaranteed!
Monophonic music is made of some
notes in a specific order with a
given duration for each note. These
notes are selected from a range
specified in the table shown here.
Nokia developed a programming
language to transfer monophonic
music to its cellphones and called it
RTTTL, for Ringing Tone Text Trans1
fer Language.
Looking at the table, each note has
a different frequency according to
selected octave. An octave is the
interval between two points where
the frequency at the second point is
twice the frequency of the first. So
to select a specific note in this table,
you specify its column and row like
A4 (220 Hz) or A#7 (1864.7 Hz). Two
successive notes in the table differ by a factor of exactly the 12th
root of 2 (approximately 1.059). For
S1
example: E6 (1318.8) = D#6 (1244.8)
× 1.059 Hz.
PLAY
After selecting the note, the next
issue is its duration, i.e. how long
it should sound. In contemporary
music you will typically observe
see the following basic note dura2
tions 1/1, 1/2, 1/4, 1/8th, 1/16th. A
Whole Note, a.k.a. ‘1/1’ or semibreve,
is typically equal to four beats in 4/4
time. A Beat is the basic time unit of
a piece of music. The real duration of
a beat is related to Tempo. Tempo or
BPM (beats per minute) is the speed
of a given piece and specifies how
many beats should be played in a
minute.
The RTTTL format is a string divided
into three sections: name, default
value, and data. The name section consists
of a string describing the name of the ringtone. The default value section is a set of values separated by commas. It describes certain defaults which should be adhered to during the execution of the ringtone. Possible
names are: d (duration), b (tempo), o (octave).
elektor - 7-8/2009
Octave
Note
A
A#/Bb
B
C
C#/Db
D
D#/Eb
E
F
F#/Gb
G
G#/Ab
1
2
3
4
5
6
7
8
9
27.5
55.0
110.0
220.0
440.0
880.0
1760.0
3520.0
7040.0
29.1
58.3
116.5
233.1
466.2
932.4
1864.7
3729.4
7458.9
30.9
61.7
123.5
247.0
493.9
987.8
1975.7
3951.3
7902.7
32.7
65.4
130.8
261.6
523.3
1046.6
2093.2
4186.5
8372.9
34.6
69.3
138.6
277.2
554.4
1108.8
2217.7
4435.5
8871.1
36.7
73.4
146.8
293.7
587.4
1174.8
2349.7
4699.5
9398.9
38.9
77.8
155.6
311.2
622.4
1244.8
2489.5
4979.1
9958.1
41.2
82.4
164.9
329.7
659.4
1318.8
2637.7
5275.3
10550.6
43.7
87.3
174.7
349.3
698.7
1397.3
2794.6
5589.2
11178.4
46.2
92.5
185.1
370.1
740.2
1480.4
2960.8
5921.8
11843.5
49.0
98.0
196.1
392.1
784.3
1568.2
3137.1
6274.1
12548.2
51.9
103.9
207.7
415.5
830.9
1661.9
3323.7
6647.4
13294.8
The programming procedure comprises
these steps:
1. Convert your favorite RTTTL format songs
using the ‘Converter’ utility.
2. Compile the ASM file using an AVR assembler like the one provided with Atmel
AVRStudio.
3. Write the HEX file to the microcontroller
using a suitable device programmer.
using Visual Basic which runs under Windows operating systems. Paste or type the
song data and specify the clock frequency of
the microcontroller in Megahertz, then press
the ‘Convert’ button. Note that the ATtiny13
micro uses its 9.6 MHz internal oscillator. The
software converts the songs and copies them
to a file called ‘ringtones.inc’. Next, Assemble
the ‘rtttl.asm’ file with ‘ringtones.inc’ using
an AVR assembler. The assembler outputs are
two main files, ‘rtttl.hex’ and ‘rtttl.eep’. These
files should be written to the microcontrol-
In the first step, use the ‘Converter’ software
shown in Figure 2. This utility was developed
ler’s program memory (or EEPROM) using a
serial or parallel programmer.
(090243-I)
Downloads & Products
Programmed Controller
Order code: 090243-41 (plays ‘Popcorn’ song only)
Software
File: 090243-11.zip (free download)
Content: ATtiny13 source & hex files; ‘Converter’ utility
Location: www.elektor.com/090243
Switching Delay
Thorsten Steurich (Germany)
+12V
C1
1
2
&
10k
IC1.A
R7
10µ
25V
C2
4
10n
R4
S1
15k
7
4k7
R2
BC547
T2
2
6
8
D2
100n
1N4148
DIS
IC2
OUT
555
TR
R5
C5
5
1
3
5
6
10
R9
4k7
12
IC1.D
13
&
11
IC1.B
&
4
+5V
14
IC1 = 4093
IC1
C3
7
22µ
25V
1N4148
&
THR
3k
D1
IC1.C
9
R8
T1
8
R
CV
R1
C4
3
100 Ω
K1
R6
10k
10k
R3
At the heart of the circuit is NAND gate IC1.C.
The output of the circuit (after inverter IC1.D)
only goes high when both inputs to IC1.C are
at a high level. When the circuit is triggered
7-8/2009 - elektor
+5V
F1
3k
The circuit described here was
designed as an addition to a
remotely-controlled garage
door opener. The problem was
that a brief burst of interference,
arising from a thunderstorm or
a mains spike, was enough to
trigger the mechanism, and
the author found this a nuisance. The effect of the circuit
is to enable the output from the
receiver module only when a
relatively long pulse (more than
about 0.5 s) is received. The circuit can of course also be used
in other similar situations, such
as electrically-powered shutters, alarms and the like.
BC547
T1 conducts, and the output of inverter IC1.
A, and hence also pin 8 of IC1.C, go high. If we
now arrange things so that for a preset time
the other input to IC1.C remains low, the trigger signal will not be propagated to the output until this period has elapsed. In the case
4µ7
25V
081086 - 11
of the author’s garage door opener, this will
only happen if the button on the transmitter
is held down.
The 555 timer is used to generate the
delayed gating signal for IC1.C. It is wired
as a monostable multivibrator in a similar
19
fashion to the arrangement in the ‘Economy
Timer’ circuit elsewhere in this issue. When
the circuit is triggered T2 will briefly conduct
as a result of the positive edge at the output
of IC1.A. This triggers the 555 timer: its output will go high, and thus pin 9 of IC1.C will
go low. Because of the propagation delays
through the components a very short low
pulse will appear at the output of IC1.C when
the circuit is triggered. The RC combination
at the input to IC1.D ensures that this does
not affect the output.
When the period of timer IC2, as determined
by R7 and C5, expires its output returns low.
This allows the input signal to pass through
IC1.C. If the button on the remote control has
been released before the timer expires, no
signal will pass to the output.
When the trigger signal is removed the output of IC1.A goes low, which resets the timer:
the 555’s reset input, like its trigger input, is
active low. The circuit is now again in its quiescent state.
(081086-I)
Six-digit Display with SPI Port
VCC
10k
R1
18
SEGA
IC1
SEGB
SEGC
SEGD
K1
VCC
DIN
DOUT
CLK
LOAD
GND
1
24
13
12
SEGE
DIN
SEGF
SEGG
DOUT
SEGDP
MAX7219
CLK
CNG
DIG0
DIG1
LOAD
DIG2
DIG3
DIG4
DIG5
DIG6
DIG7
4
LD1
SC52-11
19
ISET
14
7
16
6
20
4
23
2
21
1
15
9
17
10
22
5
2
7
a
6
b
4
c
2
d
1
e
9
f
10
g
dp
LD2
SC52-11
5
CC
CC
3
8
7
a
6
b
4
c
2
d
1
e
9
f
10
g
dp
LD3
SC52-11
5
CC
CC
3
8
7
a
6
b
4
c
2
d
1
e
9
f
10
g
dp
LD4
SC52-11
5
CC
CC
3
8
7
a
6
b
4
c
2
d
1
e
9
f
10
g
dp
LD5
SC52-11
5
CC
CC
3
8
7
a
6
b
4
c
2
d
1
e
9
f
10
g
dp
LD6
SC52-11
5
CC
CC
3
8
a
b
c
d
e
f
g
dp
CC
CC
3
8
11
6
7
3
10
5
8
9
081154 - 11
Characteristics
• six-digit seven-segment display
• just two components, plus display modules
• driven using software SPI emulation
• C driver routines easily adapted to any type of
microcontroller
Uwe Altenburg (Germany)
There is no essential difference between
a seven-segment display and seven
individual LEDs with either their cathodes
or their anodes connected together.
Often the display will be driven by a
microcontroller, and when several digits
are wanted, they are usually driven in
a multiplexed fashion. This involves
connecting together each segment in
a given position across the digits, with
each of the seven common segment lines
(plus decimal point) being driven by an
output port pin of the microcontroller via
20
a series resistor. Each digit also requires a
transistor, which again needs an output
port pin to drive it. For a six-digit display,
this means a total of fourteen output port
pins: almost two whole ports on an 8-bit
microcontroller.
Maxim offers a solution to this problem
in the MAX7219. The device is controlled
over an SPI port, requiring just four I/O pins
on the microcontroller. It can drive up to
eight individual seven-segment displays.
Contrary to popular belief, multiplexing
the displays does not reduce overall power
consumption: although each digit is only
driven briefly the LED current must be
correspondingly increased in order to
achieve the same average brightness.
According to the device’s datasheet the
MAX7219 can deliver up to 500 mA per
digit. The rapidly changing current draw can
cause interference to the microcontroller’s
power supply if adequate decoupling is
not provided.
An advantage of the MAX7219 is that
neither series resistors nor drive transistors
are required. Only one external resistor is
needed, which is used to set the segment
current for all the digits. Since it is also
possible to adjust the segment current
over the SPI port, a fixed 10 kΩ resistor is
suitable.
The small printed circuit board is designed
to accept Kingbright SC52-11 common
cathode display modules, which have
a digit height of 13.2 mm. The display
is available in a range of colours. If you
wish to modify the board layout to suit a
different display, the Eagle file is available
for download from the web pages for this
article [1].
A special feature of the MAX7219 is the
ability to cascade multiple devices, allowing
several display boards to be driven from a
single microcontroller. No extra I/O pins
are required on the microcontroller as the
data bits are shifted through the chain of
elektor - 7-8/2009
devices: the output DOUT of one module
is connected to the DIN input of the next,
and the LOAD and CLK signals are wired in
parallel.
How do we program the device? The
MAX7219 contains 16 internal registers that
can be serially addressed and written to.
Each seven-segment display is configured
using a separate 16 bit message, where
bits 0 to 7 carry the data to be displayed
and bits 8 to 11 carry the register address.
Bits 12 to 15 are not used.
Each bit is clocked into the device on
the rising edge of the CLK signal. While
the data bits are being transmitted the
LOAD signal must remain low; when it
goes high the message is written to the
addressed register. It is not necessary for
the microcontroller to have dedicated
SPI hardware: a low data rate is adequate
in almost all cases and so the necessary
waveforms can be generated in software.
The author has written suitable routines in
C [1], which are easily adapted for any type
of microcontroller. The routine SendCmd()
is responsible for ‘bit banging’ the I/O ports
to generate the SPI signals.
A couple of the MAX7219’s registers
require initialisation. The mode register
determines whether the internal BCD-toseven-segment decoder is used or whether
the data stored in the registers correspond
directly to segment patterns. The latter
option is more general but requires the
use of a look-up table in the driver: in the
author’s source code this array is called
Segments. A further register sets the total
number of digits to be driven; and finally
the segment current must be set and
the display enabled. Once everything is
initialised the digit registers can be written
to using the function UpdateDisplay().
The display module is also supported by
the M16C TinyBrick [2] described in the
March 2009 issue of Elektor. A simple
example program can be downloaded
from the project website, showing how
easy it is to control the display using the
built-in BASIC interpreter.
(081154-I)
Internet Links
[1] www.elektor.com/081154
[2] www.elektor.com/080719
Downloads
081154-1: PCB layout (.pdf), from www.elektor.
com/081154
081154-11: source code, from www.elektor.
com/081154
CAD files, from www.elektor.com/081154
COMPONENT LIST
Resistors
R1 = 10kΩ
Semiconductors
D1–D6 = SC52-11 (Kingbright)
IC1 = MAX7219CNG
Miscellaneous
JP1 = 6-way pinheader
PCB # 081154-1 [1]
LiPo Monitor
Werner Ludwig (Germany)
390Ω
470Ω
9k1
91k
590k
6k8
68k
270k
tains two comparators plus an
internal 1.3 V voltage reference.
2x Lipo
3x Lipo
The LiPo Monitor simplifies
Each comparator has two outR1B
R1A
R4
voltage monitoring of Lithium
puts, OUT and HYST. This enaPolymer (LiPo) batteries during
bles you to monitor each of the
use. You clearly want to avoid
two inputs SET1 and SET2 for
D1
8
discharging them too far and
over and under-voltage.
[email protected]
[email protected]
another thing on your wish
3
7
OUT1 is an inverting output,
SET1
OUT2
R2B
R2A
list should be a warning when
HYST2 5
whereas the other three are nonBT1
IC1
the permitted limit of safe disICL7665
inverting. The maximum current
2,
3x
Lipo
2
HYST1
[email protected]
[email protected]
charge is approaching. A green
R5
6
1
is 25 mA per output. OUT1 and
SET2
OUT1
LED remains on for all the time
OUT2 are current sinks (openthat the battery voltage remains
R3B
R3A
4
drain outputs of N-channel
C1
D2
adequate. If the volts drop as far
MOSFETS, source to ground).
2µ2
as the terminal voltage level, a
HYST1 and HYST2 are current
25V
red LED lights to signal that fursources (open-drain outputs of
090038 - 11
ther use (and discharge) of the
P-channel MOSFETS, source to
battery will be harmful and not
+UB). The truth table shown bemonitoring the LiPo propulsion batteries
allowed. Before this happens, in
low
provides
information on the switching
the lower but still OK voltage range, both of radio control models that are used pri- behaviour of the ICL7665.
LEDs illuminate to warn that the end is marily in short range operation, such as
The two comparators in the LiPo Monitor
nigh. The circuit is particularly suitable for indoor model helicopters.
The ICL7665 device used in this circuit con- form a window discriminator (voltage range
7-8/2009 - elektor
21
sensor). The batging and avoids
ICL7665 Truth Table
tery voltage under
deep discharge
SET1/SET2
OUT1/OUT2
HYST1/HYST2
observation is appof propulsion
USET1 > 1.3 V
OUT1 = ON = LOW
HYST1 = ON = HIGH
lied, via a voltage
batteries.
divider, to both of
(090038-I)
USET1 < 1.3 V
OUT1 = OFF = high-impedance
HYST1 = OFF = high-impedance
the inputs. The volUSET2 > 1.3 V
OUT2 = OFF = high-impedance
HYST2 = ON = HIGH
tage dividers in this
USET2 < 1.3 V
OUT2 = ON = LOW
HYST2 = OFF = high-impedance
circuit are designed
Internet Link
for situations using
two or three LiPo cells and are arranged so light together, lies between 3.0 and 3.3 http://datasheets.maxim-ic.com/en/ds/ICL7665.pdf
that the warning range, in which both LEDs volts per cell. This makes for timely char-
Low-drop Series Regulator using a TL431
Lars Krüger (Germany)
T1
+15V
+13V8...+14V4
R2
51k
R1
150 Ω
BD249
TL431CP
IC1
K1
C
2
1
P1
R
3
1k
TL431CP
A
(090014-I)
R3
10k
Like the author you may keep some 12 V leadacid batteries (such as the sealed gel cell
type) in stock until you come to need them.
A simple way of charging them is to hook up
a small unregulated 15 V ‘wall wart’ power
supply. This can easily lead to overcharging,
though, because the off-load voltage is really
too high. The remedy is a small but precise
series regulator using just six components,
which is connected directly between the
power pack and the battery (see schematic)
and doesn’t need any heatsink.
The circuit is adequatele proof against short
circuits (min. 10 seconds), with a voltage drop
of typically no more than 1 V across the collector-emitter path of the transistor.
For the voltage source you can use any transformer power supply from around 12 V to 15 V
delivering a maximum of 0.5 A. By providing
a heatsink for T1 and reducing the value of R1
you can also redesign the circuit for higher
currents.
Internet Link
http://focus.ti.com/lit/ds/symlink/tl431.pdf
090014 - 11
VGA Background Lighting
+5V
R4
3k3
10k
R3
R9
8
3
IC2
IC3
4
12
100k
5
R12
4
100k
R7
4
100k
R6
R
555
DIS
7
R1
1
7
R10
R13
3k3
IC2.A
T1
IC2.B
7
100n
IC3.B
1
9
R14
BC
557
C1
6
100k
6
5
R15
330 Ω
R16
330 Ω
5
10k
CV
1
3
8
100k
R5
R8
R11
10k
OUT
1k5
3
100k
R2
3k3
IC1
TR 2
6
THR
2
2
100k
8
IC3.A
IC2 = LM358
IC3 = LM339
C2
C3
C4
1u
16V
1u
16V
1u
16V
IC3.C
14
R17
330 Ω
090080 - 11
Heino Peters (The Netherlands)
22
More and more people are using a PC (conventional or notebook) to view films. The VGA
output can be used to provide a matching
‘Ambilight’ effect for this. If you restrict your-
elektor - 7-8/2009
self to a single RGB LED, you can also draw
the power for this circuit from the VGA connector, along with the RGB signals.
The following pins of the 15-way VGA connector (three rows of five pins) are used for
this circuit:
Pin 1:
Pin 2:
Pin 3:
Pin 5:
Pin 9:
Red video signal
Green video signal
Blue video signal
GND
+5 V
The video signals for the red, green and
blue channels are available at the RGB outputs. These signals have an amplitude of 1 to
1.35 V, and they output the screen imagery at
the rate of dozens of frames per second. This
produces the visible image on the screen.
The circuit described here drives an RGB LED
according to the average values of each of
these three signals. Of course, this is not a
full-fledged ‘Ambilight’ system, but the RGB
LED will produce a nice green light during a
football match or an orange hue if a sunset is
shown on the screen.
A sawtooth generator is built around IC1
and T1. It supplies a nice sawtooth signal
to opamp IC2a via R6. The frequency of the
sawtooth signal is approximately 850 Hz, and
its amplitude ranges from 1.6 to 3.4 V. IC2A
subtracts approximately 1.6 V from this due
to voltage divider R4/R5. After this, voltage
divider R10/R11 reduces the peak value of
the sawtooth to around 1.35 V. The resulting sawtooth signal is buffered by IC2b and
used to drive the three comparators in IC3.
The level of the red video signal is averaged
by the R12/C2 network. IC3a constantly compares the previously generated sawtooth signal with the average value of the red video
signal. If the image has a high red content,
the output of IC3a will be logic Low a good
deal of the time, while with a low red content
it will be Low less often. This comparator circuit thus implements a PWM driver for the
red LED. The same arrangement is used for
the green and blue channels.
Note that with a notebook computer you
always have to enable the VGA first, usually by pressing Fn-F5. If you use a desktop
or tower PC, you can tap off the video signals from an adapter connected between the
video cable and the monitor.
You can also use several LEDs or a LED strip
(available from Ikea and other sources) in
place of a single RGB LED. In this case you
will need an external power supply for the
LEDs, but the control circuit can still be powered from the PC. If you use multiple LEDs or
a LED strip, connect the cathodes (negative
leads) of the LEDs to the comparator outputs
of IC3 as shown on the schematic diagram,
and connect all the anodes (positive leads) to
the external power supply. Resistors R15–R17
are often already integrated in the LED strip.
There’s no harm in using an external supply
with a higher working voltage, such as 12 V.
Remember to connect the ground terminal
of the external supply to the ground of the
control circuit.
IC3 can handle a current of 15 mA on each
output. If this is not enough, swap the connections to the inverting and non-inverting
inputs of the three comparators in IC3 and
connect their outputs to the bases of three
BC547 transistors. Connect a 10-kΩ resistor
between each base and the positive supply
line (+5 V). Connect the emitter of each transistor to ground, and connect the collector
to the LED strip. A BC547 can switch up to
100 mA with this arrangement, and a BC517
can handle up to 500 mA.
(090080-I)
Wireless S/PDIF Connection
Ton Giesberts (Elektor Labs)
or any extra circuitry! At the
video output of the receiver
you then have a copy of the
S/PDIF signal — well, that is
the theory.
A question came to mind
after the ‘Hi-fi Wireless Headset’ article was published in
the December 2008 issue of
Elektor: why don’t we design
a wireless S/PDIF connection?
This would of course have
been a very useful option
(the modules in question
digitise an analogue signal in
the transmitter, which is then
converted back to analogue
by the receiver).
The idea is therefore to create a digital (in other words,
lossless) connection between
two devices. As a compromise we could have added
an S/PDIF input to the transmitter mentioned above. However, in that case the D/A
converter in the receiver would mainly determine the quality of the analogue signal, and
that was something we didn’t want.
Amongst lots of other things, a possible
7-8/2009 - elektor
solution was found on the Internet, which
we wanted to try out in practice. It concerns
the use of wireless audio/video modules to
transfer the signal. However, no use is made
of the audio section of the modules! The S/
PDIF signal is connected directly to the video
input of the transmitter, without modification
The bandwidth of the modules we used is just enough
to transfer the digital signal
from a CD. We tested this
with a Gigavideo 30 made by
Marmitek. This is a somewhat
older version, and equivalent devices shouldn’t cost
much more than a few tens
of pounds.
To reliably transfer an S/PDIF
signal from a CD player you
need a bandwidth of at least
6 MHz. The minimum pulse
width of an S/PDIF signal of
44.1 kHz is 177 ns. The video bandwidth of
5.5 MHz (this depends very much on the quality of the modules used) seems to be sufficient to create a usable link.
The shape of the signal at the output of the
receiver no longer consists of a tidy square
23
wave, but looks more like a sine wave. This
is of course the result of the limited bandwidth available. Everything will be fine as
long as the zero crossing points (or original
pulse edges) haven’t shifted with respect to
each other. This is because an S/PDIF receiver
retrieves the clock signal from the input signal with the help of a PLL circuit.
Because the edges are less steep, the receiver
will be more susceptible to noise and some
jitter could occur. If the edges start shifting
with respect to each other it is likely that the
PLL can no longer cope with the signal. The
quality of the connection is therefore not as
good as that provided by a coaxial cable, but
for those of you who don’t want to lay a cable,
between two floors for example, this is obvi-
ously a cheap alternative!
Something that should also be taken into
account is that walls can signif icantly
reduce the maximum distance between the
transmitter and receiver. In our lab are two
areas that are partially divided by a 1-metre
(3 feet) thick brick wall. When this wall was
between the transmitter and receiver the
maximum range was reduced to barely two
metres (6.5 ft).
We decided to test the circuit with an S/PDIF
signal with a sample frequency of 96 kHz
(DVD with 24-bit audio). The minimum pulse
width for this signal is only 81 ns. This would
seem to be too short to be transferred reliably by the modules. The oscillogram shows
the signal at the input of the transmitter (top
waveform) and the output from the receiver.
This shows clearly how the shorter pulses are
attenuated (the bottom waveform has been
delayed by about 440 ns compared with the
top one).
We tried adding a frequency dependent
amplifier to compensate for the restricted
bandwidth, but the amplitude of the attenuated pulses could not be increased enough
without affecting the phase of the pulses.
We found out that the S/PDIF receiver just
couldn’t cope with this ‘improved’ signal
at all.
(081034-I)
One Wire RS-232 Half Duplex
1
Traditional RS-232 communication
needs one transmit line (TXD or TX)
and one receive line (RXD or RX)
and a Ground return line. The setup
allows a full-duplex communication; however many applications are
using only half-duplex transmissions,
as protocols often rely on a transmit/
acknowledge scheme.
With a simple circuit as shown in Figure 1 this is achieved using only two
wires (including Ground). This circuit is designed to work with a ‘real’
RS-232 interface (i.e. using positive
voltage for logic 0s and negative
voltage for logic 1s), but by reversing the diodes it also works on TTL
based serial interfaces often used
in microcontroller designs (where
0 V = logic 0; 5 V = logic 1). The circuit needs no additional voltage supply, no external power and no auxiliary voltages from other RS-232 pins
(RTS/CTS or DTR/DSR).
Although not obvious at a f irst
glance, the diodes and resistors form
a logic AND gate equivalent to the
one in Figure 2 with the output connected to both receiver inputs. The
default (idle) output is logic 1 (negative voltage) so the gate’s output follows the level of the active transmitter. The idle transmitter also provides
the negative auxiliary voltage –U in
Figure 2. Because both receivers are
24
R1
TX
R2
4k7
4k7
D1
D2
1N4148
TX
1N4148
RX
RX
GND
GND
080705 - 11
2
2x
1N4148
TX1
D2
RX1
TX2
D1
RX2
R1
080705 - 12
-U
3
R2
RX
RX
4k7
GND
D1
TX
R3
T1
BC547B
47k
Andreas Grün (Germany)
1N4148
R1
4k7
D2
1N4148
C1
GND
10µ
080705 - 13
connected to one line, this circuit
generates a local echo of the transmitted characters into the sender’s
receiver section. If this is not acceptable, a more complex circuit like the
one shown in Figure 3 is needed
(only one side shown). This circuit
needs no additional voltage supply
either. In this circuit the transmitter
pulls its associated receiver to logic 1
(i.e. negative voltage) by a transistor (any standard NPN type) when
actively sending a logic 0 (i.e. positive voltage) but keeps the receiver
‘open’ for the other transmitter
when idle (logic 1). Here a negative
auxiliary voltage is necessary which
is generated by D2 and C1. Due to
the start bit of serial transmissions,
the transmission line is at logic 1 for
at least one bit period per character. The output impedance of most
common RS-232 drivers is sufficient
to keep the voltage at C1 at the necessary level.
Note: Some RS-232 converters have
quite low input impedance; the values shown for the resistors should
work in the majority of cases, but
adjustments may be necessary. In
case of extremely low input impedance the receiving input of the
sender may show large voltage variations between 1s and 0s. As long as
the voltage is below –3V at any time
these variations may be ignored.
(080705-I)
elektor - 7-8/2009
mikroElektronika
ACCESSORY BOARDS
DEVELOPMENT TOOLS | COMPILERS | BOOKS
6, /"
6, /"
6, /"
,*- !16) 0&
6, /"
4#-3(.-).-3 ('/+-+
0#-"3,+#%3
#'-+ 4#-33#').-33
('/+-+3 0#-"
,+#%3#'-+ (+30#-"3 -+',#/+3'3
3('-+(%%+
,23-(3(''-3,*- !1
) 0& (+30#-"3 %-3%
(''-(+
(''-3&.%-#)%3/#,
#'-(34
3'-0(+$30#-"
%#'3-+',#/+
&/##74'06!!#)
6, /"
#/' )61&#/+#1
,/164- +"#/
'%'1 )6,1
#,3 3 ,&%%3 -"#'
%(03 )(0+3 (&)%-3 4
1#,3%+(&-+
,23023-(3.,3
+,3#'32(.+3,#!'3-
*.#,#-#('3-
-'4%('
-"+'-3('-+(%%+30#-"
3'-+ ,23 -(3 (''-3 (+
0#-"3 43 4#31)'+
(+30#-"3
,#'!%3 43 "''%3 #!#-%
)(-'-#(&-+3('4(+
OK.
Now you need a...
/ '+6$,/61&#6$212/#
ACCESSORY
BOARD
!!#00,/56 , /"0 0+3 ,#!'3 -(3 %%(03 ,-.'-,3 (+
'!#'+,3-(3,#%231+#,3'31)%(+3-"3)#%#-#,3(
-"3 /+#(.,3 &#+(('-+(%%+,3 0#-"3 )+#)"+%3 /#,3 ,."
,3 3 3 3 1&#/+#13 /3 3 '
&'23&(+
#/' )6
70#%6
* /1
'%&161,6/#.
6, /"
'"6# "#/
3'-+ 3#,)%23+#/+,3('4
(+30#-"36!,**,+ -
( 3 .#(
%2+3 3 (+3 0#-"3 '-+ 3'3 %(-
(+3 0#-"3 %#!"-4-(4 +*.'23
('/+-+
(+3 0#-"3 +',#/+3 0#-"3 /(%-!
+!.%-(+
3 '"6 /# "#/ -(3 2(.+
)+(-(-2)3/#3,#%2
05##
1#--#/6,1,/6/'3#/
*'(/,2$$#/
*'(/,/'3#
,1#+1',6, /"
(''-32(.+3/%()&'(+3-(30#+%,,3'-0(+$
.,#'!3'%'16,"2)#
3,-))+3&(-(+3('-+(%
-(3 2(.+3 )+(-(-2)3 /#
0#-"3
2$$#/ -"3 '%(!3 ,#!'%,
(''-3-(3/%()&'(+3#').-,
(+30#-"3
"#!"4.++'-3+%#'!-('
++2,
,-3'%(!3#').-,3('32(.+
/%()&'-3 (+3 ,#%2
0#-"36-,1#+1',*#1#/0
h t t p : / / w w w . m i k r o e . c o m /
S O F T W A R E
A N D
H A R D W A R E
S O L U T I O N S
F O R
E M B E D D E D
W O R L D
Breadboard/Perfboard Combo
Based on an idea from Luc Heylen (Belgium)
Electronic hobbyists and engineers often use
breadboards to experiment with small circuits. A breadboard consists of a thick strip
of plastic with an array of holes and embedded metal contact strips that interconnect
individual rows of holes. A few long rows
extending over the entire length are located
along the sides; they can be used for supply voltages. With this arrangement of holes
and strips, you can plug all sorts of electronic
components (including ICs) into the breadboard and build a circuit by interconnecting
them as desired with short lengths of wire. Of
course, we don’t have to explain this to most
of our readers, since they have probably used
a breadboard occasionally.
The advantage of a breadboard is that you
can try out different ideas to your heart’s
content without having to use a soldering
1
26
iron every time you make a change. It’s also
a lot easier to see what you’re doing than
when you build a circuit on a piece of perfboard, where the wiring on the copper side
can quickly turn into a rat’s nest that isn’t
so easy to sort out when you want to make
changes.
Of course, breadboards also have their disadvantages. They can’t be used for RF circuitry,
which is something you always have to consider. The spring contacts also tend to wear
or weaken over time, which can lead to poor
connections. Despite these disadvantages,
breadboards are especially convenient and
affordable tools for electronic designers.
If you do a lot of work with a breadboard, you
are often faced with the problem that after
you have managed to build and test a circuit that works the way it should, you have
to take it all apart and rebuild it on a piece of
perfboard because the circuit has to be used
somewhere right away. In such cases, leaving the circuit in its breadboard form is not a
long-term option.
The person who thought up the idea
described here, who is a fervent breadboard
user, encountered this problem regularly and
came up with the following solution. Make a
printed circuit board with the same layout,
hole spacing and interconnections as a standard breadboard. Secure this PCB on top of the
breadboard, and then plug the components
and interconnecting wires through the holes
in the PCB, mounting them the same way as
you would normally do with the breadboard
(Photo 1). Use slightly longer component
leads and wire ends than usual, due to the
extra thickness of the PCB. Fit ICs in sockets
with extra-long pins (wire-wrap pins). In a cir-
2
elektor - 7-8/2009
cuit built using this arrangement, the contact
strips in the breadboard provide the interconnections, so there’s no need for soldering.
Once the circuit is finished and works the
way it should, you don’t have to rebuild it
before you can use it somewhere else. Press
a sponge or a bag filled with styrofoam particles on top of the circuit (Photo 2) and clamp
it securely in place (Photo 3). After this, you
can pull the PCB with the components free
from the breadboard, turn it over, and then
trim all the leads protruding from the copper
side and solder them in place (Photo 4). The
interconnections are exactly the same as on
the breadboard.
To make it easy to work with this combination of a breadboard and a PCB, it’s a good
idea to mount the breadboard on a piece
of wood with four long M3 screws arranged
to fit exactly through the corner holes of
the printed circuit board. This way you can
mount the PCB precisely and securely on top
of the breadboard.
For the breadboard, we used a type SD12N
from Velleman [1], which is carried by a
number of electronics retailers. Note that
other types of breadboards may have different dimensions or contact arrangements,
which means that they cannot be used with
the PCB layout shown here.
(080937-I)
Internet Link
[1] www.velleman.be/nl/en/product/view/?id=40573
Download
080937-1: PCB layout (.pdf), from www.elektor.
com/080937
4
3
Momentary Action with a Wireless Switch
7-8/2009 - elektor
actuated as long as the current is sufficiently
large. The current decreases as the voltage
on C4 rises, with the result that RE2 drops out
and the contact of RE2 (the ‘momentary’ contact) opens again.
*
S1
R1
100 Ω
Many different types of wireless switch modules with a relay for switching AC power loads
are commercially available. However, some
applications require a short On or Off pulse,
such as is provided by a momentary-action
(pushbutton) switch. Here we describe a solution that simulates a pushbutton switch with
a standard wireless switch. A supplementary circuit converts the switch module into
a remotely controllable momentary-action
switch.
In the supplementary circuit, S1 is the switching contact of the relay in the wireless switch
module. This contact energises a 24-V power
supply connected directly to the AC power
outlet, consisting of a bridge rectifier (D1–D4)
with a series resistor (R1), a series capacitor
(C1), and a charging capacitor (C2). The two
Zener diodes in the bridge rectifier (D1 and
D2) limit the DC voltage on C2 to approximately 24 V.
When the wireless switch module closes contact S1, 24 VDC is applied to the coil of relay
RE1, which closes. At the same time, capacitor
C3 charges via D5. When the contact of RE1
switches, capacitor C4 provides the charging current for C3. The charging current
flows through the coil of RE2, which remains
D1, D2 = 27V, 0W5
D3, D4 = 1N4004
2W
L
D1
230V
( 120V
D2
+24V
D5
)
1N4148
N
D3
C4
D4
C2
R2
220k
Matthias Haselberger (Germany)
0W5
C1
330n
275V
X2
D6
100µ
35V
RE1
1000µ
35V
24V
1N4148
RE2
C3
24V
1000µ
35V
080912 - 11
27
S1 opens when the relay in the wireless
switch module is de-energised, which causes
RE1 to drop out shortly afterward and connect capacitor C4 to ground. The capacitor
discharges through the coil of RE2, causing
its ‘momentary’ contact to be actuated again.
The timing diagram shows the switch-on and
switch-off sequences of the wireless switch
(S1 contact).
The duration of the ‘button press’ (engagement time of RE2) depends on the capacitance
of C3 and C4. The equation Q = C × U = I × t
can be used to calculate suitable capacitor
values for a specific hold time (t1 in the timing diagram) with a given relay current. The
value shown in the circuit diagram (1000 µF)
corresponds to a hold time of 1 second with a
relay current (holding current IH) of 10 mA:
C = IH × t1 / U = (0.01 A) × (1 s) / 10 V = 1000 µF.
A reed relay cannot be used for RE2 because
the voltage across the coil reverses. This
Timing
U
ON
OFF
S1
t
+24V
+14V
+24V
0
t
RE2
t1
080912 - 12
t
also means that a free-wheeling diode cannot be used, but it is anyhow not necessary
due to the slow discharge of C4. RE2 should
be a 'Class II' relay (such as the Omron G6D1A-ASI 24DC) to provide adequate insulation of the switch contact. RE1 does not have
to be a Class II relay. Due to the presence of
AC power line voltage, R1 and R2 must have
a rated working voltage of 250 V (150 V),
although they can also be formed from two
resistors with half this rated working voltage
connected in series, each with half of the
specified power rating. In this case, R1 consists of two 47 Ω / 1 W resistors and R2 of two
100 kΩ / 0.25 W resistors. Readers on 120 VAC
60 Hz power networks should change C1 into
680 nF.
The circuit can be fitted in a plastic enclosure
with an integrated AC power plug, which can
easily be plugged into the wireless switch
module. The contact of RE2 can then be fed
out to a terminal strip as a floating contact.
For adequate AC isolation, a safety clearance
of at least 6 mm (air and creepage paths) to
other conductors must be maintained, in
addition to using a Class II relay.
(080912_1)
Servo Scales
2
1
+6V
IC2
7806
Im
+9V...+15V
a
PWM
R3
100k
PWM/U
U1
220k
3
2
C2
C3
100n
100n
Servo
IC1
M
U2
4k7
R8
R1
7
TL081
6
4
R4
470k
M1
D1
M1
33k
C1
100uA
1N4148
R6
0R1
100k
b
R2
P1
100R
R5
+6V
R7
100n
5k
FS
P2
100R
ZERO
OFFSET
Servo
PWM
090086 - 12
With a bit of adeptness, you can build an
electronic scales based on a servo motor.
Depending on the type of servo you use, it
can measure weights of up to around five kilograms (11 lbs) with reasonable accuracy.
+6V
c
PWM
Servo
U(m) = U0 + K.m
090086 - 11
Gert Baars (The Netherlands)
28
If you examine the operating principle of a
servo motor in more detail (Figure 1a), you
can see that in simple terms, it consists of
a control loop that uses a potentiometer to
convert the motor position to a voltage that
is compared to the voltage from a PWM converter. Based in this information, the motor is
rotated so that its measured position corresponds to the desired position (U2 = U1).
As can be seen from Figure 1, all you need
for a scales based on a servo motor is a
square-wave oscillator that supplies a signal at a constant frequency of around 50 Hz
with a fixed duty cycle of approximately
10%. This defines a fixed setting for the position of the motor axle. If a mechanical force
tries to rotate the motor axle in this situation, the servo control loop adjusts the drive
signal to the motor to counteract the rota-
elektor - 7-8/2009
tional force. The motor thus has to supply
an opposing force, and that costs power,
with the result that the current through the
motor increases. With a type RS-2 servo, this
current can rise to as much as 1 A, while the
quiescent current is no more than a few
dozen milliampères. If you attach an arm to
the motor axle and fit it with a weighing pan,
and then connect an ammeter in the servo
supply line, you have a sort of simple electronic scales. The scales can be calibrated
using a reference weight, with the length of
the arm set to produce a certain amount of
current with a certain weight, such as 0.5 A
with 1 kg. Two kilograms would then draw
1 A, and so on.
The scales can also generate a voltage output if you measure the voltage across a sense
resistor in series with the ground lead of the
servo (Figure 1c). Due to the quiescent current consumption of the servo motor with no
load, this voltage is not zero with no weight
on the scales, but it is low compared with the
value with a certain amount of weight. Naturally, this offset can be compensated by using
an instrumentation amplifier. This increases
the accuracy, and you could even consider
equipping the scales with a digital readout.
Figure 2 shows a simple finished version
with a PWM oscillator and analogue readout. The two potentiometers can be used to
adjust the offset and weighing range. The
length of the scale arm multiplies the torsion on the servo motor due to the weight.
Doubling the arm length reduces the weighing range by half and thus doubles the accuracy, but it also increases the zero offset due
to the weight of the arm. In practice, an arm
length of around 10 cm proved to be a good
compromise.
embedded file system and data logger chips
use the MSD interface.
A particularly flexible friend is called ‘expandIO-USB’. As its name suggests, it is an I/O
expander with a USB interface. But that’s
a modest description, considering its ana-
The chip takes the measurement and reports
the result as a 4-byte response: 0x96 0x06
0x02 0x36.
In this example, the voltage measured is 5 V
× 0x0236 ÷ 0x03FF = 2.76 volts. Similarly, the
following command exchanges three bytes
with a slave SPI device:
(090086-I)
Driver Free USB
Richard Hoptroff (United Kingdom)
USB (universal serial bus) was supposed to
solve a lot of problems when connecting
devices to PCs, but in many ways it’s still a bit
of a pain in the plughole. Typically, each new
device needs a new driver to be installed.
Often, a COM port then gets assigned, and
you have to find out from the operating sys-
1
VDD
C2
0xAF 0x03 0x45 0x67 0x00. Command: Send
C1
2
100n
1µ 16V
VDD
IC1
RC0/AN4/C12IN+/INT0/VREF+
1.00-2.00
RST
2.25
11.75
A
1.25
USB
RC1/AN5/C12IN-/INT1/VREFRC3/AN7/P1C/C12IN3-
1
RC4/P1B/C12OUT/SRQ
RC5/CCP1/P1A/T0CKI
4. VSS
12.00
RC2/AN6/P1D/C12IN2-/CVREF/INT2
D-
2
D+
3
RC6/AN8/SS/T13CKI/T1OSCI
0.50
3. D+
1.00
2. D-
3.00
RC7/AN9/SDO/T1OSCO
1. VDD
1.00
EXPAND IO-USB
RB4/AN10/SDI/SDA
4
RB5/AN11/RX/DT
RB6/SCK/SCL
RB7/TX/CK
C
VUSB
OSC1
OSC2
B
090367 - 12
VSS
X1
C5
tem what the COM port number is. And with
some products, that COM port number can
change if you plug it into a different socket!
A sneaky way round the driver problem is
to use the Human Interface Device (HID), as
used by mice and keyboards, or the Mass
Storage Device (MSD) interface, as used by
flash drives. This is because just about all the
flavours of Windows, Mac and Linux operating systems available today have HID and
MSD drivers pre-loaded. HexWax Ltd. have
adopted this approach for their driver-free
USB chip sets. Their USB to UART, SPI and
I2C bridges use the HID interface and their
7-8/2009 - elektor
22p
12MHz
C4
C3
22p
470n
090367 - 11
logue-to-digital inputs, interrupts, PWM,
comparators, counters, timers, SPI, I2C, UNI/
O, etc. The USB interface is designed so that
all the programming is done on the PC rather
than on the chip, which saves a lot of development time. For example, to measure the
analogue voltage on AN6, you send the following 4-byte command from the PC (0x prefix denotes hexadecimal):
0x96 0x06 0x00 0x00
0x45 0x67 0x00 to slave.
0xAF 0x03 0x00 0x00 0x89. Response: Slave
sent 0x00 0x00 0x89.
The commands are sent using the operating
system’s HID interface, which is very similar to
reading and writing to a file. Example source
code is provided at [1].
In the basic circuit of the driver, Figure 1,
only a cr ystal and f ilter capacitors are
required in addition to the ‘expandIO-USB’
chip also described in some detail at [1].
Although it is available as a through-hole
device, the surface mount version has the
29
advantage that it is small enough for ‘dongle’-style applications as shown in Figure 2.
Surface mount USB plugs can be quite difficult to source, but an elegant, zero-cost
solution exists. You can design one into the
printed circuit board itself, so long as you
don’t mind a PCB 2.0–2.20 mm thick including tracks (arrow ‘A’ in Figure 2) for the
dimensions. For best reliability, the PCB contacts (‘B’) should be plated with hard gold
flash (0.25-1.27 μm) over nickel (2.6-5.0 μm).
Finally, shoulders (‘C’) are required to pre-
vent over-insertion force. The overall PCB
width should be 16.00 mm or less.
(090367-I)
Web Link
[1] www.hexwax.com
Lighting Up Model Aircraft
Werner Ludwig (Germany)
+UB
D1
1N4148
C2
IC1
4µ7 25V
16
3
CTR14
R1
1M
11
R2
10
180k
9
C1
CX
4
5
+
6
6
CT
4n7
14
7
13
8
15
9
12
11
12
CT=0
13
8
D2
5
4
!G
RCX
RX
7
1
LA1
LA2
A
B
1N4148
R3
T1
33k
T3
R4
68k
2
BC557
3
T2
4060
BS170
R5
The sample circuit is for operating
voltages between 5 and 12 V. Current flow through the two BS170 FET
devices must not exceed 500 mA.
BS170
33k
This circuit provides aircraft modellers with extremely realistic beacon and marker lights at minimum
outlay. The project’s Strobe output (A) provides four brief pulses
repeated periodically for the wing
(white strobe) lights. In addition the Beacon output (B) gives
a double pulse to drive a red LED
for indicating the aircraft’s active
operational status. On the prototype this is usually a red rotating
beacon known as an Anti-Collision
Light (ACL). The circuit is equally
useful for road vehicle modellers,
who can use it to flash headlights
and blue emergency lights.
All signals are generated by a 4060
14-stage binary counter and some
minimal output selection logic.
Cycle time is determined by the
way the internal oscillator is configured (resistor and capacitor on
pins 9/10) and can be varied within
quite broad limits. High-efficiency
LEDs are your first choice for the
indicators connected to the Beacon and Strobe outputs (remember to fit series resistors appropriate to the operating voltage Ub
and the current specified for the
LED used).
090036 - 11
(090036-I)
LED Bicycle Lights
Ian Field (United Kingdom)
30
*
D4
220u
D1
D2
1N4148
1N4148
BT1
6V
C1
C2
100uF
25V
2u2
63V
R1
1N4148
D7
T1
D
C3
100p
T2
BC337
D6
G
S
R2
1k
NTD4815N
tor R3, this keeps T2 turned on and T1 turned
off, so the flyback phase is not clamped until
it has given up all its energy. Capacitor C3
provides positive feedback to ensure reliable oscillation and sharpen up the switch-
D5
C4
22V
1W3
10u
63V
D8
NTD4815N
D9
R4
D3
1N4148
*
*
R3
12R
1R
L1
4k7
Before getting started an acknowledgement
is due, the circuit presented here uses an
ingenious method of controlling a flyback
converter by the voltage developed on a current sensing resistor, this was published by
Andrew Armstrong in the July 1992 issue of
ETI magazine.
The reworked circuit is quite simple. At the
instant that power is applied only a small current flows to charge C4 so insufficient voltage
is developed on R3 to switch T2 on. Also, D1
allows C2 to charge from the 6 V battery, so
R1 feeds enough voltage to switch on T1 —
this shunts the voltage across L1 and the current in it starts to rise. At a certain point the
current which returns via R3 will develop sufficient voltage to switch on T2 which shunts
the gate voltage to T1 causing it to switch off,
initiating the flyback voltage from L1. The flyback pulse forces a current around the circuit,
charging C4 and feeding the LEDs. As the
return current is via the current sensing resis-
G
D
S
080702 - 11
ing edges. Components D1, D2 & C2 form a
bootstrap boost circuit for the MOSFET gate,
although it is logic level it only guarantees
the stated R D-S(on) at a Vg level of about 8 V
— by happy coincidence the combined Vf of
elektor - 7-8/2009
four ultrabright red LEDs is about 8.8 V and
this is the value that the output is normally
clamped to.
There are some notes on the components
specified. For position T1 an n-channel MOSFET with a very low RD-S(on) of 15 mΩ (at 10 V)
Is suggested, although its high ID rating (35 A)
is not strictly necessary. Purists may wish to
use Schottky barrier diodes for D2 and D4,
but a quick look at the data sheet for the
popular BAT85 shows that with a Trr of 4 ns it
is not actually any faster than the 1N4148. It
is doubtful whether the lower Vf would make
any noticeable difference.
Zener diode D5 has been included as a safety
measure in case the output should ever find
itself open circuit. The flyback converter can
develop a quite impressive voltage when
run without load and would have no difficulty damaging the MOSFET. If a higher voltage MOSFET is used then C4 could easily fall
prey to excessive voltage if the lead to the
LED breaks. In the final working prototype D5
was a 1.3-watt 22-volt zener, but any value
between 18 and 24 V is fine. Bear in mind that
with four white LEDs on the output the voltage will be somewhere in the region of 13 V.
L1 is a 9 mm diameter 0.56 A 220 µH inductor
with a low DC resistance (Farnell # 8094837);
don’t even think about using those small axial
lead inductors disguised as resistors — even
the fat ones last only a few seconds before
failing with shorted turns.
On R3, this resistor is selected depending on
the configuration of LEDs. A value of 20 mA
is fairly typical for 5 mm LEDs, on this basis
four red LEDs will need about 12 Ω; five red
LEDs about 10 Ω, and four white LEDs about
6.8 Ω. Resistor R4 (1 Ω 1%) is provided to use
as a temporary connection for the LEDs’ negative lead so the volt drop can be measured
to indicate the current flowing during setting
the correct LED current by adjusting R3.
The efficiency of the circuit depends on the
LED current, which also determines to some
extent the switching frequency. At 10 mA (4
white LEDs) 170 kHz was measured on the
prototype — and that’s about the maximum
normal electrolytic capacitors are able to
withstand. If more current is drawn (e.g. three
white LEDs at 30 mA) then the switching frequency drops to about 130 kHz and the efficiency rises to around 75%.
The circuit is simple enough to construct on
stripboard, which can be built as a single or
double unit to suit whatever lamp housings
are ready to hand. The double unit should fit
comfortably in a 2x D cell compartment and
the single board is only a whisker bigger than
a single C cell.
Suggested lamp housings are the Ever Ready
and the Ultralight but there should be many
others that can be modified to house the
stripboard. In many cases the hole for the
bulb will need 4 notches cut with a round file
so that the LEDs can be pushed far enough
through. These can be secured in place with
a spot of hot melt glue.
The battery and switch box can be surprisingly challenging, the unit built for a family member went on a bicycle with a wire
basket so it was easy to bolt a Maplin ABS
project box to that. With only the tubular
frame to fix things onto, it’s not so easy. The
authors’ battery box for the present project
is an old Halfords lamp — the one that drops
into a U shaped plastic clip that does nothing to deter thieves, but it’s far more secure
when cut down to make a battery box and
clamped to the handlebar with a jubilee clip.
It easily holds a 6 V 1.3 Ah SLA battery from
Maplin but any nominal 6 V type can be used
as per individual preference. Deep discharging should be prevented.
Please Note. Bicycle lighting is subject to
legal restrictions, traffic laws and, additionally in some countries, type approval.
(080702-I)
Remote Washing Machine Alert
Götz Ringmann (Germany)
4M7
on C1 starts to fall. Changing
the value of R1 will increase
D1
U+
It is often the case these days
sensitivity if the LED is not
that the washing machine
bright enough.
R1
and tumble dr yer are
When the voltage on C1 falls
installed in an outbuilding
below 1/3 of the supply volt4
8
4
8
1M...2M2
R
R
or corner of a garage. This
age IC1 switches its output
7
7
DIS
DIS
not only makes the kitchen
(pin 3) High, removing the
T2
IC1
IC2
R3
R5
ICM7555 3
ICM7555 3
a much quieter place but
reset from IC2. T2 conducts
OUT
OUT
4k7
2
2
also leaves room for a dish
and LED D1 is now lit, supTR
TR
R2
6
6
BC237
4k7
THR
THR
washer and gives additional
plying current to charge C2.
T1
CV
CV
cupboard space. The probWhen the voltage across
C2
C1
5
1
5
1
lem now is how to tell when
C2 reaches 2/3 supply IC2
100n
22µ
the wash cycle is finished. In
switches its output Low and
Tant.
bad weather you don’t want
C2 is now discharged by pin
081156 - 11
to make too many fruitless
7 via R3. The discharge time
trips down the garden path
is roughly one minute before
just to check if the wash cycle is finished.
light output (they are often driven by a mul- the transistor is again switched on. The procThe author was faced with this problem when tiplex signal) producing a more stable DC ess repeats as long as light is falling on T1.
he remembered a spare wireless door chime voltage to inputs 2 and 6 of IC1. The circuit
he had. With a few additional components is battery powered so the CMOS version of Transistor T2 is a general-purpose small sigand a phototransistor to passively detect the familiar 555 timer is used for IC1 and IC2. nal NPN type. The open collector output is
when the washing machine’s ‘end’ LED comes The output of IC1 (pin 3) keeps IC2 reset (pin wired directly in parallel with the bell push
on, the problem was solved.
4) held Low while there is no light falling on (which still functions if the transistor is not
T1. When the wash cycle is finished the LED switched on). Ensure that transistor output is
C1 smoothes out any fluctuations in the LED lights, causing T1 to conduct and the voltage wired to the correct bell push terminal (not
7-8/2009 - elektor
31
the side connected to the negative battery
terminal).
Each timer consumes about 60 µA quiescent
and the circuit can be powered from the
transmitter battery. Alternatively a 9 V battery can be substituted; it has much greater
capacity than the original mini 12 V battery
fitted in the bell push.
Before you start construction, check the
range of the wireless doorbell to make sure
the signal reaches from the washing machine
to wherever the bell will be fitted.
(081156)
Freezer Trick
Reuben Posthuma (New Zealand)
There are a number of explanations to why
putting devices in the freezer often repairs
them. Firstly, cooling PCBs down to minus
20 degrees Celsius or so can often repair
dry joints, because of the effects of expansion/contraction due to temperature change.
Although the wholesome effect of a night in
the freezer may be temporary, it may help
you track down rare or otherwise elusive
errors in circuits.
Secondly, with rechargeable batteries on
boards, the cold temperatures basically cause
the cell(s) to do a complete discharge cycle,
Thirdly, the low temperatures can (sort of)
rejuvenate the chemicals in the battery,
which results in a ‘good as new’ battery!
which effectively resets corrupted memory
by causing a complete ‘factory’ reset to be
performed.
Although any or all of the above explanations may be refuted scientifically, the ‘he
who dares, wins’ approach prevails. In other
words, no harm in giving it a try. Be sure to
use good quality plastic bags to securely
package circuit boards, components or batteries before putting them into the freezer.
This will eliminate any risk of contaminating
foodstuffs.
(090205)
LEDify It!
Mobile 3-watt LED Lamp
Jürgen Stannieder (Germany)
A traditional hand-held torch could hardly
be described as a cutting-edge piece of technology; in fact it’s probably the exact opposite, circuits don’t come much
simpler! Text books have for
years used a battery, light
bulb and switch to describe
just what a circuit is. We are
also aware of the shortcomings of the filament lamp; the
light dims as the battery discharges and occasionally you
need to replace a burnedout bulb. Why not treat an
old torch to a 21st century
make-over? Replace the bulb
with more efficient LEDs, the
5 mm 70 mW types will not be
very illuminating but 1-watt
white LEDs are now reasonably priced.
It ’s not quite as simple as
removing the bulb and replacing it with an LED. Unlike a fila-
32
Features
• Three 1 W LEDs powered from 4.8 V
• Efficiency > 80 %
• Light output independent of battery voltage
• Battery deep-discharge protection
ment bulb an LED exhibits differential resistance i.e. its resistance depends on the applied
voltage. It is necessary to supply it with a constant current. This can be achieved (approximately) by using a series resistor but power
loss in the resistor reduces efficiency. Also,
light output will decrease as the battery voltage sinks. The LEDify design
solves both these problems:
firstly, a switching regulator
reduces losses and maintains
a constant light output as the
battery voltage falls. Secondly,
an adjustable constant current
source maintains stable operating conditions for the LEDs.
The LM2577T-ADJ step-up
voltage regulator [1] forms
the centre point of the design.
Together with coil L1 and the
flywheel diode D1 it boosts
the input voltage from 4.8 V
up to 10 to 12 V. The 4.8 V
input is provided by four
NiMH rechargeable batteries
connected in series while the
10 to 12 V output is used to
power three series connected
white LEDs. One half of the
elektor - 7-8/2009
L1
D1
100n
2
GND
330n
6
C4
LM2577TADJ
C1
5k
P1
10k
C5
R7
100k
C6
100n 470u 470u
16V 16V
R3
D2
2V7 0W5
5
C7
IC2B
R8
3M9
10u
25V
7
D3
3
2
IC2A
1N4148
IC2 = LM358
1
T1
R11
560R
C8
100p
A
K
3x 1W
Lumileds
4
BD139
R10
4k7
R12 R13 R14 R15
1R
R1
FB
1k
R4
47u
25V
C3
100n
IC2
1R
10k
C2
SW
CMPEN
3
4V8
1
1k
22k
IN
P2
2k2
BT1
P3
K1
8
C9
4
5
IC1
R9
100k
2k2
1k
S1
R6
R2
1R
1N5822
R5
1R
100uH
080585 - 11
dual op amp IC2 forms an adjustable current
source while the other half switches the light
off when the supply voltage sinks too low to
avoid discharging the cells too much.
IC2A is configured to generate a constant
current. Zener D2 supplies a reference 2.7 V
at its cathode which is divided by the R9/P3
network to supply an adjustable voltage of
0 to 128 mV to the non-inverting input of
IC2A. IC2A controls T1 so that the voltage
at its inverting input, produced by the voltage drop across the resistors R12 to R15, is
the same as at its non-inverting input. The
adjustment range of P3 produces a current
of between 0 and almost 0.5 A through the
0.25 Ω resistor formed by the four parallel 1 Ω
resistors. The typical operating current of a 1watt LED is around 350 mA, this produces a
voltage of 88 mV across the four parallel resis-
tors. With the LM358 even with the input at
zero there will be an output voltage of 0.6 V
so with P3 at a minimum a few milliamps will
still be flowing through the LEDs.
The adjustment range on P2 produces a
voltage of around 3 V to over 10 V. Although
four cells are shown in the diagram the circuit can accommodate anything from three
to six. Do not use more than six cells when
driving three LEDs in series, the input voltage would produce excessive dissipation in
IC1 which can result in the battery voltage
being applied directly to L1 and D1. The voltage step-up function of IC1 ensures that the
cathode of D1 is at a higher voltage than the
anode so D1 is not conducting. When the IC
output switches, energy stored in L1 is converted into a higher voltage but lower current passing through D1 and then stored on
capacitors C5 and C6. The 52 kHz switching
frequency gives a stable output voltage with
very little ripple.
IC1 reads the feedback voltage measured
at pin 2 and compares it with a reference
COMPONENT LIST
Inductor
The LEDs are turned off when the battery
voltage falls too low, IC2B comparing a proportion of the battery voltage via P2 with
the reference voltage on D2. If the battery
voltage is below the reference voltage the
output of IC2B will go high and the current
source IC2A will be switched off. The circuit
still draws a few milliamps when under-voltage is triggered so a good lower threshold to
set is around 1 V per cell. With four cells P2
should be adjusted so that the LEDs switch
off when the battery voltage falls below 4 V.
Resistors
R1,R3 = 2kΩ2
R2 = 22kΩ
R4,R5,R6 = 1kΩ
R7,R9 = 100kΩ
R8 = 3MΩ9
R10 = 4kΩ7
R11 = 560Ω
R12,R13,R14,R15 = 1Ω
P1,P2 = 10kΩ preset, miniature, horizontal
P3 = 5kΩ preset, miniature, horizontal
Capacitors
C1 = 330nF MKT lead pitch 5mm or 7.5mm
C2 = 47µF 25V radial, lead pitch 2.5mm, ø max.
8.5mm
C3,C4,C9 = 100nF ceramic, lead pitch 5mm
C5,C6 = 470µF 16V radial, lead pitch 2.5mm, ø max.
8.5 mm
C7 = 10µF 63V radial, lead pitch 2.5mm, ø max.
6.5 mm
C8 = 100pF ceramic, lead pitch 5mm
7-8/2009 - elektor
L1 = 100µH axial, upright mounting, suggested
types: 5800-101 (Bourns) rated 0.63A/0.2Ω (DigiKey # M8290-ND), B82111EC25 (Epcos) rated at
1A/0.65Ω (Farnell # 9752102) or MESC-101 (Fastron)
rated at 1A/0.65 Ω (Reichelt # MESC 100µ)
Semiconductors
D1 = 1N5822
D2 = 2V7 0W5 zener diode
D3 = 1N4148
T1 = BD139
IC1 = LM2577T-ADJ (TO-220-5 case, straight pins)
IC2 = LM358 (DIP-8)
Miscellaneous
K1,S1,BT1 = 2-way PCB terminal block, lead pitch
5mm
S1 = single-pole on/off switch
BT1 = holder for 4 NiMH batteries*
3 pcs 1-watt power LED
PCB # 080585-1
* see text
33
of 1.23 V. It adjusts the peak switch current
accordingly to maintain a constant output
voltage. The divider chain formed by R2, R3
and P1 allow the output voltage to be varied between 3.5 V and 19 V. A typical 1 W LED
has a forward voltage drop of around 3.25 V.
Three LEDs in series gives 9.75 V, when the
voltage drop across T1 and R12 to R15 are
added to this we get 10 V. The adjustment
range of P1 is sufficient to cater for LEDs with
a forward voltage drop of up to 4.0 V.
In the Elektor lab we measured a supply current of 0.87 A from the 4.8 V battery pack
giving a current through the LEDs of 0.35 A.
Using 2000 mAh rechargeables you can
expect a full battery pack to last for more
than two hours. The circuit efficiency is over
82 % with a 4.8 V battery pack and around
89 % with a 5.6 V battery.
too low. Lastly adjust P2 so that the LEDs turn
off when the supply drops below 4 V. Should
the LEDs not light at all check that P2 has not
been set too high.
The set up procedure for the completed circuit is simple. Using an adjustable power
supply set the output voltage to 4.8 V. Connect three LEDs in series to the anode and
cathode (A, K) contacts of K1 and adjust P1
so that the voltage measured between the
A connection of K1 and ground is 12 V. Now
set the current by adjusting P3 until 88 mV is
measured across resistors R12 to R15. To operate the circuit at optimum efficiency reduce
the 12 V supply by adjusting P1, check that
a constant 88 mV is maintained across R12
to R15, if it starts to fall then you have set P1
(080585-I)
Internet Links
[1] www.national.com/mpf/LM/LM2577.html
[2] www.elektor.com/080585
Download
PCB
080585-1 PCB design (pdf) from www.elektor.
com/080585
Annoy-a-Tron
Tolunay Gül (The Netherlands)
the code starts with a regfile that
states which AVR is used. This is
followed by the Xtal/internal
oscillator choice. Next come the
software and hardware stack,
the frame size and the configuration settings. First portb.3
is configured as an output and
given the name ‘speaker’. Then
the variable ‘seconds’ is defined
as a ‘word’ type.
When the AVR is turned on it first
comes to an endless loop. In this
it checks if the mode jumper is
in place or not. If it’s not in place
(a logic ‘1’ caused by the pull-up
resistor) the micro jumps to sub1.
Here it comes to an endless loop
again. Within this loop it creates
a constant beeping noise.
The idea for this circuit came
from the website www.thinkgeek.com [1]. The author thought
that it could be made better and
simpler. A search on the Internet
didn’t get any results so the next
logical step was to design something himself. With the help of a
small AVR microcontroller from
the spares box and a buzzer the
experimenting could begin.
JP1
BT1
3V6
The mode switch is used to
choose between normal mode
and a test mode. In the latter
mode the Annoy-a-Tron will
beep constantly. In normal mode
the tone generator creates irritating beeps with a random pause of 10 to 500
seconds between successive beeps.
34
When the mode jumper is put in
place and the power is removed
from the circuit and then reapplied (a reset), the controller
K1
once more comes to an endless
10
1
IC1
8
9
2
loop. However, this time it sees
8
3
1
PB5/RST/ADC0
a ‘0’ because the jumper pulls
7
4
6
3
PB1/AIN1/CC0B/INT
PB4/ADC2
6
5
5
2
the I/O pin to a low level. This
PB0/AIN0/OC0A
PB3/CLKI/ADC3
7
PB2/ADC1/T0
causes the program to jump to
ISP
BZ1
sub2. This is again an endless
4
ATTINY13
JP2
loop, which immediately generates a beep. It then generates
MODE
a random number from 0 to 50,
adds one to it and stores it in the
090084 - 11
variable ‘seconds’. The number
in ‘seconds’ is then multiplied
The controller obviously needs a program by 10 to obtain a longer pause before the
written for it. As is usual for BASCOM-AVR next beep. The program then waits for the
R1
R2
10k
PWR
10k
The circuit consists of little more
than the AVR micro, a buzzer
and an ISP header to program
the code into the microcontroller. Apart from two resistors, a
jumper to select the mode and
an on/off switch, the circuit just
needs a batter y. The author
used an old battery from a Nokia
mobile phone because it had a
large capacity, but was still fairly
small. In principle a small button cell and a holder will suffice
as well, and possibly even some
solar cells from an old calculator
could work.
elektor - 7-8/2009
required number of seconds before jumping
back to the beginning of the loop.
circuit could be made very small. The software can be downloaded from the Elektor
website [2].
The circuit can be easily built on a piece of
stripboard. Alternatively, an SMD board could
be designed, which means that the resulting
(090084)
Internet Links
[1] www.thinkgeek.com/gadgets/electronic/8c52
[2] www.elektor.com/090084
Download
090084-11: source code and hex files, from [2]
Simple Wireless and Wired
Emergency Stop System
Jacquelin K. Stroble (USA)
This circuit allows a cheap or discarded wireless doorbell set (i.e.
transmitter and receiver unit) to be
used as a remote emergency stop
on a high-power electrical motor
or motor controller system.
S2
As an EMC precaution, small capacitors (100 pF) are fitted across base resistors R1 and R2, preventing the motor
from being shut down by external
electrical noise and interference. The
set and reset coils of the latching relay
each have a flyback diode to prevent
back-emf peaks damaging T1 and T2.
The contacts of the latching relay can
be used to switch a more powerful
relay, or a motor driver.
MOTOR
RESTART
D1
D2
RE1
2x
1N4004
BC557B
R1
C1
10k
ANT1
100p
T1
MOTOR
E-STOP
S1
(090148-I)
+5V
T2
R2
MOTOR
E-STOP
C2
1k
When the button on the wireless
doorbell unit is pressed, the resulting 0 V signal from the receiver
unit (‘motor E-Stop’) causes PNP
transistor T1 to be turned on. Via
transistor T2, latching relay Re1
then changes state. The same is
achieved when the wired Motor
E-Stop button, S1, is pressed. The
reset button, S2, must be pressed
to reverse the state of the latching
relay.
The choice of T1 and T2 is not critical — they are general purpose,
low voltage PNP and NPN switching
transistors respectively, for which
many equivalents exist.
+24V
100p
BC547B
090148 - 11
Desulphater for Car Batteries
Christian Tavernier (France)
PbSO4
Even if you take great care of your car or
motorbike battery, you’re bound to have
noticed that its life is considerably shorter
than the high purchase price and sales pitch
probably led you to expect. Of course there
are several reasons for this, and high on the
list is the phenomenon of slow but inevitable
sulphating of the plates. To understand properly what this involves, we need to look at a
bit of chemistry.
This indicates that, in contact with sulphuric acid, the porous lead of one plate and the
porous lead dioxide of the other are both
converted into lead sulphate and water. During charging, the following reverse chemical
reaction occurs:
A lead/acid battery exploits a chemical
reaction which is written as follows, when
discharging:
Pb + 2H2SO4 + PbO2 —> PbSO4 + 2H2O +
7-8/2009 - elektor
PbSO 4 + 2H2O + PbSO 4 —> Pb + 2H2SO 4 +
PbO2
This time, the electric current being passed
converts the lead sulphate and water into
lead, lead dioxide, and sulphuric acid. In theory, the reaction is totally reversible, which is
why a battery can be charged and discharged
a great many times.
Unfortunately, with the passing of time and
successive charge/discharge cycles, the second reaction, i.e. the one that converts the
lead sulphate back into lead, becomes incomplete, and leaves some lead sulphate on the
surface of the battery plates. As this is a poor
conductor, it tends to get thicker in places
where it has started to collect, and unfortunately this phenomenon of sulphating, for
that’s what it’s called, is cumulative and gets
worse and worse as time goes by.
Once a battery has got badly sulphated
beyond a certain point, no standard charging
process is able to recover it. What happens
is that, because the lead sulphate Is a poor
conductor, the battery’s Internal resistance
Increases, which In turn reduces the charging
current, and thereby the effectiveness of the
35
22k
470k
charging chemical reaction;
cially if you use the printed cir+12V
this in turn leaves even more
cuit board design suggested
lead sulphate on the plates…
[1], but for optimum performR1
C5
and so it goes on, in a vicious
ance, you do need to pay carecircle. There is a chemical
ful attention in choosing the
100µ
4
8
25V
process that makes it possible
components.
R
low ESR
7
to eliminate the lead sulphate
The induc tors used must
R2
DIS
T1
IC1
R3
from a battery before it’s too
not be changed. They are
3
OUT
330
D1
late, but it’s a tricky operaavailable, for example, from
555
C1
2
TR
C4
6 THR
tion and uses highly corrosive
Radiospares (RS Components)
IRF9540
100µ 15V
47n
chemicals that are dangeras part numbers 228-422 (L1)
CV
0W4
25V
L1
5
1
ous to handle. What’s more,
and 334-9207 (L2). Diode D2
many of the batteries sold
is a readily-available type and
220µH
C3
C2
3A5
these days are sealed and so
should only be replaced if this
2n2
100n
D2
it’s impossible to gain access
is unavoidable, and then only
L2
to their electrolyte without
by an ultra-fast device. Capac1mH
R4
1A
BYW29-100
damaging them.
itor C5 must be a low series
220
The project we’re suggestresistance type, such as those
081175 - 11
ing here lets you desulphate
intended for switch-mode
your battery electronically —
power supplies. As can be
and the sooner you start doing it, the more mark/space ratio of the signals produced.
seen from the component overlay of the PCB
effective the process will be. It is based on
designed by Elektor Labs, T1 and D2 are fitresearch carried out in the United States, Construction shouldn’t be any problem, espe- ted with small U-shaped heatsinks designed
which showed conclusively that if you
to take TO-220 packages.
apply short, high-amplitude pulses to
It is advisable to install the circuit into
the battery, the resulting ionic agitaan earthed metal case, as it generates
tion produced at the battery electrodes
quite severe electromagnetic interfergradually breaks up the lead sulphate
ence that it’s best not to allow to radicrystals. Even if you’re a bit sceptical
ate out as it is likely to upset the operabout the effectiveness of this process,
ation of other equipment. EMC reguyou can try it out for yourself without
lations and recommendations apply
any great financial risk, as the circuit
here.
required is simple and cheap. Nothing
The bat ter y connec tion must be
ventured, nothing gained!
made using short wires, of at least 2.5The circuit used is very similar to the
3.0 mm² gauge (AWG # 12-13), securely
one currently to be found in the United
connected to the battery terminals,
States, where this type of desulphatsince for the process to be effective, it’s
ing process is popular as well as wideimportant to minimise any series resistspread. Apart from a few details, it’s
ance between the circuit and the batpretty much like a ‘boost’ type switchtery. If necessary, it can be left permamode power supply unit (SMPSU) —
nently connected.
i.e. one that steps up the input voltage. IC1
Some writers and pundits advise connecting
is wired as an astable multivibrator running
a charger (even a low output one) to the batCOMPONENT LIST
at a frequency of the order of a kilohertz and
tery at the same time, to avoid the circuit’s
generates very short mark/space (on/off)
discharging the battery in the long term. But
Resistors
R1 = 470kΩ
ratio pulses at its output.
we would not recommend doing so, since the
R2 = 22kΩ
When T1 is turned off by the level of these
charger’s relatively low output impedance
R3 = 330Ω
pulses, capacitor C5 is able to charge up to
distorts the pulses produced by the circuit
R4 = 220Ω
the battery voltage through inductor L2.
and hence diminishes its effectiveness.
When T1 turns back on again, which happens
Capacitors
for only a very short time, given the mark/
Cautionary advice. If you use this desC1 = 100μF 25 V
space ratio of the pulses, capacitor C5 disulphater directly on your vehicle battery,
C2 = 100nF
C3 = 2nF2
charges abruptly via T1 and L1. When T1 then
remember to disconnect at least one of the
C4 = 47nF
turns off again, the inductor L1 means that
connections to the battery, as the parallel
C5 = 100μF 25 V, low ESR
the discharge current can’t stop instantly. So
impedance of the many devices that stay perit is obliged to pass through the battery via
manently powered in modern cars once again
Semiconductors
diode D2.
diminish the effectiveness of the system.
D1 = 15 V 0.4 W zener diode
With a high-quality capacitor for C5 (mean(081175-I)
D2 = BYW29-100
IC1 = NE555
ing a device with a low ESR) and a short conInternet
Link
T1 = IRF9540
nection in heavy-gauge wire from the circuit,
[1] www.elektor.com/081175
we can push a peak current of some 5 to 10 A
Inductors
through the battery. Despite this, the power
L1 = 220μF 3.5A
Download
consumption of the circuit is still fairly low, of
L1 = 1mH 1A
081175-1: PCB layout (.pdf), from [1]
the order of 40 mA, because of the very low
36
elektor - 7-8/2009
Stereo Widening
Huub Smits (The Netherlands)
many portable devices, ghettoblasters and
PC loudspeakers, even though it is usually
called something else in these applications.
To generate the stereo image, the left channel
Although the principle is quite old, ‘widening’
of the sound image is still done these days in
also contains part of the sound from the right
channel, shifted a little in phase compared
to the right channel. The same is true for the
right channel, where the signal from the left
+12V
+12V
C3
+12V
C7
100n
100n
R1
6k8
2
C11
7
3
6
IC1
R3
4
7
3
6k8
R4
2
6k8
100n
6
IC3
R22
L–R
6k8
7
3
R23
4
6k8
2
6
IC5
C8
C4
L
4
R25
100n
100n
6k8
R24
–12V
–12V
C12
6k8
L
R7
100n
6k8
–12V
R8
470R
R9
470R
R10
S1
560R
A1
A2
R11
A3
560R
A4
A
10µ
63V
A5
R12
A6
510R
C1
+12V
+12V
+12V
C5
C9
100n
C13
R5
R
R2
6k8
7
3
2
6
IC2
100n
6k8
100n
R6
7
3
6k8
4
2
6
IC4
R26
L+R
6k8
R27
4
R13
2
6
IC6
R
4
R28
6k8
6k8
C6
6k8
C10
7
3
100n
100n
C14
–12V
–12V
R14
510R
R15
1k1
R21
1k3
100n
C1
C2
C3
C4
C5
C6
C
C2
–12V
10µ
63V
R16
1k6
R20
1k8
R17
IC1...IC6 = TL071
1k1
R18
1k6
R19
2k2
38
090174 - 11
elektor - 7-8/2009
channel is slightly shifted in phase. To make
the stereo image ‘wider’, you can amplify the
difference signals of both channels.
To do this you generate a sum- and a difference signal from the left and right channels. With a couple of opamps you can realise a ‘left+right’ signal and a ‘left-right’ signal.
So the (left–right) signal needs to be made
stronger with respect to the (left+right) signal. Expressed as a formula:
(L+R) + (L–R) = 2L and (L+R) – (L–R) = 2R
With a suitable circuit, the left signal in the
left channel is increased and the right signal
is decreased. Similarly, in the right channel
the right signal is increased if the left signal
reduces. To maintain a constant volume, we
also have to make sure that the total signal
strength remains the same.
From the schematic you can see how this
problem was solved. IC1 and IC2 are the
input buffers. After the buffer, the left and
right signals are combined with the other
channel respectively. IC3 generates the
(L–R) signal and IC4 the (L+R) signal. With
two times six resistors and a multi-position switch, the amount of the effect can
be adjusted. The values of resistors R7–R12
and R14–R21 are selected such that the
total volume remains about the same when
changing the switch. IC5 and IC6 generate
the final left and right signal from the (L+R)
and (L–R) signals.
For additional protection, electrolytic
coupling capacitors of 10 μF 16 V can be
added to the inputs and outputs. Each of
the inputs of IC1 and IC2 will then also need
a 10 kΩ resistor to ground, otherwise the
opamp outputs will run up against power
supply rail.
The power supply requires a symmetrical
voltage of ±12 V. This voltage can usually be
found in an existing amplifier, so normally
there is no need to build a special power
supply.
(090174-I)
SMD Transistor Tester
Ludwig Libertin (Austria)
out the need to hook up an external transistor (and the extra bother).
Features
• Standalone SMD transistor tester
The actual procedure for using this SMD transistor tester is no different from checking out
transistors that have wire leads. In most cases
all you are interested in is whether the TUT
is dead or alive and also if it is of the NPN or
PNP variety. This much you can discover with-
7-8/2009 - elektor
S1
• Identifies defective transistors
• Distinguishes NPN from PNP
which in turn feed IC1.B and IC1.E. If no transistor under test is connected, LEDs D1 and
D2 will both flash together in anti-phase and
half the operating voltage will be present at
base connection B.
Now insert a transistor in the test device:
D5
BAS32
TEST
1
8
R1
R3
1k
R4
IC1
1k5
The article ‘SMD Soldering Aid’ by Gert Baars
in the December 2005 issue of Elektor [1] was
the original inspiration for a truly ‘electromechanical’ version of this design for a transistor tester for SMD transistors in SOT23 case
outline. However, Gert’s strip metal construction method was not chosen and instead an
alternative design was created out of strips
of soldered PCB material. Glassfibre epoxy
resin PCB material cannot compare with strip
metal for springiness so the spring from a discarded ballpoint pen was used, which provides adequate clamping pressure. The key
advantage of this choice of materials is that
the TUT (transistor under test) is pressed hard
onto three PCB tracks that lead directly to
sockets into which a conventional transistor
tester can be plugged. It really is this simple
(without any soldering) to check whether the
TUT is flaky or worth keeping for reuse.
No sooner said than done. The result is a
project that’s equally useful as a simple ‘test
connector’ hook-up for the TUT and as a simple transistor tester. The very minimalist circuit consists of a CD4049 (CMOS HEX inverter/
buffer) and a few additional components —
naturally all in SMD form factor. IC1.D and IC1.
C together with R1 and C1 form a squarewave
generator with a frequency of around 2 Hz.
This drives inverters IC1.A and IC1.F (connected in parallel for higher output current),
B
1M
BT1
IC1.D
C2
12V
9
1
IC1.C
10
7
1
IC1.A
6
3
1
IC1.B
2
5
15
11
4
1
100n
IC1.F
C1
14
1
IC1.E
1
12
R2
C
1k
220n
D1
IC1 = 4049
PNP
D3
BAS32
D2
NPN
D4
BAS32
E
060267 - 11
39
flashes. In similar fashion only D1 flashes for
a PNP device. The circuit draws only 10 mA
or so and using pushbutton S1 for operation means that the battery will have a very
long life.
both LEDs flashing indicate an open circuit,
in other words the transistor is defective. An
internal short circuit (connection between C
and E) is indicated by the two LEDs glowing
dimly. A functional NPN transistor conducts
only when the voltage on C is higher than on
E. LED D1 Is now short-circuited and only D2
COMPONENT LIST
The type GP23A 12 V battery is an integral part of the mechanical structure and
is clamped between the upper and lower
printed circuit boards. A small section sawn
from a piece of plastic pipe is used as a de
facto battery clip glues to the vertical printed
circuit board improves stability (2). The naillike metal pin is passed through a small ring
of brass soldered to the upper PCB. To simplify the task of replicating the PCBs the
author has made the layout files of the three
small PCBs available on the article’s web page
[2]. To use these you will not need the full version of the Sprint-Layout software, as you can
open the files just as well with the free Viewer
programme [3].
(060267)
Internet Links
[1] www.elektor.com/magazines/2005/december/
smd-soldering-aid.57995.lynkx
[2] www.elektor.com/060267
[3] www.abacom-online.de/html/dateien/demos/
splan-viewer60.exe
Semiconductors
D1, D2 = LED, 3 mm
D3, D4 = BAS32
IC1 = 4049 (SO16)
Resistors
R1 = 1MΩ
R2 = 1kΩ
R3, R4 = 10kΩ
Miscellaneous
S1 = pushbutton, push to
make
12 V battery GP23A
Mechanical parts as
described
PCBs (see text)
Capacitors
C1 = 220nF
C2 = 100nF
TL431 Multivibrator
Gilles Clément (France)
Oscillators have a certain appeal to electronics enthusiasts. They’re rather ‘alive’ because
there’s something ‘beating’ inside them,
isn’t there?
Here the TL431 ‘super zener’, an easilysourced standard device, is made to oscillate.
It’s a 3-pin IC: cathode, anode, and ref. input.
An op amp compares Vref with an internal
2.5 V reference and drives a bipolar transis-
tor that ‘shorts’ the cathode to the anode. So
the cathode voltage Vk has two stable states:
Vk = Vsupply if Vref < 2.5 V and Vk = 2 V (the Vce
of the transistor) if Vref > 2.5 V. A bit like a
transistor that works with voltage instead
of current, so with a little effort it should
+10V
R1
270Ω
R4
82k
R3
82k
270Ω
R2
42Hz
IC2
IC1
C2
C1
270n
270n
C3
TL431A
TL431A
10p
081167 - 11
40
elektor - 7-8/2009
be possible to force it to oscillate between
these two states.
If two TL431s are wired as an astable multivibrator you’ll find that it works! But actually, it
ought not to, since the op amp’s V+ input is
unable to sink the capacitor charging current!
So, how does it work then?
In fact, the current passes via a stray internal
diode between Vref and the cathode (which is
certainly noted on some data sheets like [1],
but not on all of them).
free) LTspice simulator [2]. The frequency is
defined by R and C (and of course the supply voltage). It gives a very good squarewave
(see scope trace) up to around 50 kHz. The
signal is much better than using bipolar transistors. However, the low voltage stays at 2 V,
but this can be solved by using a FET on the
output, or by using similar ICs with lower reference voltages like for example the TLV431
(threshold 1.24 V) or the ZXRE060 (threshold
0.6 V).
The 10 pF capacitor C3 is only there to make
the LTspice simulation start up correctly; it’s
This was checked using the excellent (and
not needed in the real circuit, which makes
use of natural asymmetries.
The author’s LTspice model is available for
free download from [3].
(081167-I)
Internet Links
[1] www.datasheetcatalog.org/datasheet/calogic/
TL431.PDF
[2] www.linear.com/designtools/software/#Spice
[3] www.elektor.com/081167
S-video Converter
Christian Tavernier (France)
video signal into a composite signal and so
will perhaps enable you to give a new lease
of life to your old CRT television.
With the astonishingly rapid growth in the
market for flat-screen TVs and high-definition TV, many CRT television sets have been
consigned to the attic, even though many of
them were still working perfectly and could
have been used as spare sets in a bedroom or
The principle of S-video is very simple, as
it merely consists of carrying the chrominance and luminance information, which
form the basis of all colour video signals,
IC1
7805
D1
that our CRT television is expecting to see.
In order for this recombination to be correct, there is just one constraining factor
to be taken into account, concerning the
respective levels of the components, as the
chrominance one is only half the amplitude
of the luminance one.
+9V...+12V
1N4004
27k
P1
75 Ω
R8
100n
C4
Comp
R10
150 Ω
150 Ω
10k
R9
COMP VIDEO
470µ
25V
470 Ω
R6
M
100n
2N2222A
1k
75 Ω
470µ
25V
R11
C1
560 Ω
75 Ω
220n
2N2907A
25V
R2
10µ
25V
T2
T1
R4
R1
10n
C3
470 Ω
L
C8
C2
470µ
R3
C
C7
1-971180
S-VIDEO
C6
R7
470 Ω
R5
C5
M
M
081179 - 11
another room, for example. Although all current flat-screen receivers have very comprehensive facilities and include digital inputs via
DVI or HDMI connectors and analogue inputs
in S-video format, this was unfortunately not
the case with the CRT televisions that were
being sold only a few short years ago, which
were more often than not fitted with only
composite video inputs, either directly or
via their SCART socket. The converter we are
suggesting building, very simple since it only
uses two transistor, lets you convert any S-
7-8/2009 - elektor
over separate channels. In composite video,
by contrast, both these signals are combined over a single path, and the resulting
inevitable interferences between them
degrade the appearance of the image being
reproduced. Fortunately, the components
of an S-video signal, whether in the SECAM,
PAL, or even NTSC standards, are almost the
same as the ones found in a composite signal of the same standard. So it’s going to be
relatively simple to combine them in order
to reconstitute the composite video signal
Our circuit picks up the component signals on
the two standardised pins of the 4-pin miniDIN socket normally used for S-video (also
known as an Ushiden socket), taking care to
maintain the 75 Ω impedance via R1 and R2.
The mixing of the two signals is then taken
care of by R3, R4, and P1; the latter lets you
adjust the respective levels of the two component signals exactly.
The two transistors that come next are wired
in such a way as to create a wideband ampli-
41
fier, the gain of which is set to 3 by the ratio
between R8 and R9. Combining the input
components has had the effect of dividing
the overall amplitude of the video signal by
a factor of 1.5, and the output impedance
matching resistor is going to divide the signal in half again (once the signal is terminated
at the input of the destination equipment),
all of which adds up to a total attenuation of
2×1.5, corresponding to the make-up gain we
have designed into our amplifier. In this way,
inserting our converter into a video chain will
have no effect on the level of the signals passing through it.
The composite video output passes via 75 Ω
resistor R11 in order to match the circuit’s
output impedance to the input impedance
of the composite video input on the device
to which it is connected. At both input and
output, note the parallel combinations of C1
/ C2 and C3 / C4, so that the video signals,
with a frequency range extending from a few
tens of Hz to several MHz, can pass through
these capacitors under the best possible
conditions.
If we want to avoid unwanted colour or
brightness variations, it is vital to power the
circuit from a stabilized supply, achieved here
by using a standard 3-pin regulator IC to provide a 5 V rail for the circuit. So the project
can be powered from a ‘plug-top’ mains unit
that gives 9 to 12 V at 100 mA or so. Diode D1
is there just to protect against any accidental
inversion of the PSU polarity that might possibly occur.
The circuit itself is very easy and construction
shouldn’t present any difficulties. It can be
built on the PCB we suggest [1] or on a piece
of prototyping board, but in either case, we
recommend using fibreglass board, because
of the high frequencies involved in the video
signals.
If you want your converter to follow the
proper standard in terms of connectors,
you’ll want to use a female 4-pin mini DIN
S-video socket for the input and a female
phono socket (a yellow one, for the purists!)
for the output. As for the power supply, all
you’ll need is a simple jack to suit the mains
unit you’ve chosen.
The circuit should work right away, and all
that you then have to do is to adjust the preset P1 so as to obtain a composite video signal that gives correct contrast and saturation
on the TV receiver you are using.
(081179-I)
Internet Link
COMPONENT LIST
Resistors
R1,R2,R11 = 75Ω
R3,R7,R8 = 470Ω
R4 = 560Ω
R5 = 27kΩ
R6 = 10kΩ
R9,R10 = 150Ω
Capacitors
C1, C3 = 100nF
C2, C4, C8 = 470μF 25V
C5 = 10nF
C6 = 10μF 25V
C7 = 220nF
Semiconductors
D1 = 1N4004
T1 = 2N2222A
T2 = 2N2907A
IC1 = 7805
Miscellaneous
4-pin mini DIN connector
Cinch connector (yellow)
DC supply connector
Download
081179-1: PCB layout (.pdf), from [1]
[1] www.elektor.com/081179
SSR 2.0
OptoMOS semiconductor
relays
Fredi Krüger (Germany)
OptoMOS or PhotoMOS relays are something
of a special category. Looking at a block
diagram the device falls somewhere
between an optocoupler and a conventional SSR (Solid State Relay).
To compare technologies the input signal to a standard analogue optocoupler
modulates the light of an LED. The light
induces a current in an isolated phototransistor or Darlington. The output current from this type of device is
relatively small (a few milliamps) and
is approximately proportional to the
input signal.
Solid state relays by comparison have
a similar input LED but this time the
light is used to trigger a built-in triac
or thyristor. They are used to switch
42
AC loads and some variants include circuitry
to ensure switching occurs as the AC passes
through zero. This reduces switching EMI but
also makes them unsuitable for phase control
applications.
Conventional mechanical relays have been
around for years. They switch both AC and DC
supplies and can be designed to handle high
current and voltage. Standard semiconductor relays can switch high current and high
voltage loads but are not suitable for DC supplies and cannot be switched at high
frequency.
Taking a closer look at the block diagram of a typical modern optoMOS
relay shows an LED at the input as
in the a normal optocoupler, but
this time the light is used to switch
two complementary photo MOSFETs
which form a bidirectional switch. This
bidirectional configuration is capable
of switching both AC and DC supplies at speeds of around 1 ms. Most
of the major IC manufacturers produce their own versions and amongst
those stocked by one supplier include
NEC (PS7141-2B), International Rectifier (PVN012APbF), Clare (LBB110) and
Vishay Semiconductors (LH1502BB).
The characteristics of these devices
elektor - 7-8/2009
range from a maximum load current from
50 mA to 10 A with a voltage range from
20 V up to 2 kV. The switch resistance can be
as low as a few mΩ to 100 Ω and the input
control current ranges from around 2 mA
to 10 mA depending on the type of relay.
Some other manufacturers are Toshiba,
Fairchild, Aromat (NAiS), Panasonic, Sharp,
Cosmo and Avago. Some of the advantages
of OptoMOS relays are:
• Small package outline — also in SMD!
• Long service life
• No contact wear
• No contact bounce
• No generation of EMI
• High switching speed
• Insensitivity to vibration
• Insensitivity to magnetic fields
• No magnetic field emission
• Low control power requirements
There are several different package outlines
including one with eight relays in the same
+ CONTROL 1
4 LOAD
- CONTROL 2
3 LOAD
is described as ‘2 form B’, i.e. two normally
closed relays. The contacts are capable of
switching 350 V at 150 mA. Without any current flowing in the LED the device is on and
we measured an output resistance of 15 Ω.
With an LED current of 0.5 mA the resistance starts increasing and at around 0.9 mA
it rises sharply giving an off resistance of
around 300 MΩ.
080683 - 11
The FOD3180 is another variant from Fairchild; it is a high speed MOSFET gate driver
optocoupler which has additional load supply voltage connections. It is capable of
switching 2 A at 250 KHz. At this speed it is
necessary to take precautions to suppress
EMI generation generated in the load.
package. When choosing a relay for a particular application the description will include the
specification ‘X form Y’. X is a number indicating how many switches are in the package
and Y indicates the type of contact: ‘B’ = normally closed while ‘A’ = normally open. Some
of these relays have both normally open and
normally closed in the same package, useful
for making a changeover switch.
In the Elektor labs we took a look at the
TLP4227G-2 from Toshiba. This 8-pin version
(080683-I)
Internet link
www.toshiba.com/taec/components2/Datasheet_
Sync//214/4495.pdf
Speed Control
Mark Donners (The Netherlands)
7-8/2009 - elektor
VCC
VCC
R4
R2
10k
C1
4k7
R3
10k
The author went for a ride in a
rental Citroen a while ago. This
car had a nice gadget onboard
that the author was unable
to find available as a separate
accessory. In such cases, there’s
only one option for an electronics enthusiast: do it yourself!
The device in question monitors how fast you are driving. An alarm sounds if you go
faster than the preset speed.
This gives the driver good control over how fast he actually
drives. You can regard it as a
pseudo cruise control.
This circuit is built around an
Atmel ATtiny25 microcontroller,
which has all the features necessary for achieving the desired
objective. The microcontroller
operates at 1 MHz using a clock
signal generated by an internal
oscillator. The desired speed
is set by a pushbutton switch
connected between pins 3
and 1 of connector K1, which is
connected to input PB1 of the
microcontroller.
The idea is that the driver should
push the button when the
car reaches the desired speed
K3
100n
50V
8
5
K1
6
R1
7
1k2
IC2
1
6
5
4N35
PB5
IC1
PB1
PB4
ATtiny25
PB2
PB3
3
2
C3
100n
50V
4
1
4
BZ1
C2
2
PB0
100n
50V
D1
1N4001
IC3
LM7805ACZ
VCC
F1
K2
500mA
C4
C5
C6
10u
63V
100n
50V
100n
50V
081127 - 11
detection limit. After this
speed has been ‘stored’ via
input PB1, the microcontroller will generate an acoustic alarm if the set speed is
exceeded. It produces two
short beeps if the speed is
slightly higher than the set
value, or a long, loud beep
if the speed is significantly
higher.
The speed is measured via
pin 2 of connector K1. Optical isolation with IC2 protects the PB2 input of the
microcontroller against
excessively high voltages.
You can tap off the speed
i n p u t si g n a l o f th e c a r
speedometer for this purpose, or you can fit a magnet and reed relay to the
driveshaft or an axle.
The firmware is written in C
and assembled using Codevision. All the firmware does
is to monitor the speed
input signal using an interrupt-driven routine. The signal is monitored by measuring the interval between
two successive pulses: the
shorter this interval, the
higher the speed. If the set
43
speed level is exceeded, an alarm signal is
generated. You can use connector K3 to program the microcontroller (1 = SCK; 2 = MISO;
3 = MOSI, 4 = RESET).
Information about available speed signals in
different makes of cars is found on the Internet, for example, at [2].
Caution. Tapping off or altering the speed
signal generated by a vehicle for use on public roads may be illegal and/or void manufacturer’s warranties.
(081127-I)
Internet Links
[1] www.elektor.com/081127
[2] http://koti.mbnet.fi/jylhami/trip/speedsignal.pdf
Download
081127-11 Source code and hex code, from www.elektor.com/081127
Four-component Missing-pulse Detector
Lars Näs (Sweden)
A missing-pulse detector is a ‘one-shot’ triggered device that is continuously retriggered
by incoming pulses before a predefined timing cycle is completed. At room temperature, the positive-going threshold voltage
(V th+) for the CD40106BC hex Schmitt trigger IC falls in the range of 60% to 86% of its
supply voltage (Vcc: 5 V–15 V). If we also take
into account that capacitor C1 takes a time
constant defined as R1×C1 [seconds] to reach
63% of its full charge voltage, the constant
is roughly the time C1 takes to charge up to
the level Vth+, thus changing the logic state
of pin 6 on IC1.C.
Based on the above assumption, if a pulse
train with a High-level period shorter than
T = R1C1 [s]
is present on the base of T1, this pnp transistor will remain in the cutoff state. This allows
VCC
R1
*
IC1.C
5
TRIGGER
T1
1
6
C1
*
2N3906
IC1 = CD40106BC
080137 - 11
R1 to charge up capacitor C1, but not sufficiently to reach the positive voltage threshold set at input pin 5 of the gate. Consequently Schmitt trigger output pin 6 will
remain High. For a retriggered pulse period
of 3 seconds (or 0.3Hz) you’d use R1 = 330 kΩ
and C1 = 10 µF.
Now, if the High-level pulse duration on the
base of transistor T1 is longer than T, the transistor will remain cut off, but the capacitor will
charge until Vth+ is reached and the output
pin 6 of the Schmitt trigger gate will change
to logic Low.
When no pulse (i.e. a logic Low state) is present on the base of T1, the transistor is driven
into saturation. This allows C1 to instantly discharge, setting up the initial conditions for
the next pulse.
The trigger signal can for instance be supplied by a Hall-Effect switch set up to measure if a wheel with a magnet is rotating or
not.
This circuit uses one gate in the CD40106BC,
leaving the other gates free for use for other
purposes. Do take into account that CD40106
devices from different manufacturers or production batches may have slightly different
threshold voltages, which requires the calculated value of T to be adapted carefully to
match the specifications of the gate used.
(080137-I)
Hassle-free Placement of SMD Components
Leo Szumylowycz (Germany)
but if you can’t find it, a good substitute is
Blu-Tack adhesive putty (or one of the several
similar products), which you can buy in strips,
square or small pads. You’ll need to knead it
in your hands a while for this kind of assembly work.
Gadgets can be very useful to assist the task
of placing components in printed circuit
boards. Some people clamp the PCB in a small
vice, either the vacuum-fixing variety (with a
sucker) or the type that clamps to the edge of
the workbench, or else they use one of those
‘third hand’ devices with several crocodile
clips. But none of these is much help when
you are dealing with surface mount (SMD)
components. Even the steadiest hand is of little use if just the smallest slip causes the PCB
to jump out of the croc clips. In this kind of
operation you cannot steady your hands on
the work surface and they soon get tired.
The author has discovered a better, albeit
unconventional, solution: a substance like
modelling clay that is sold for cleaning the
44
gummy mess out of the metal type letters on
traditional typewriters (yes, some people do
still use these good old machines). This substance is sold in specialist stationery shops
Once you have softened a lump to a suitably
elastic consistency, you can press it onto the
actual work preparation area and place the
printed circuit board on top (see photo). The
underlay should be rectangular or circular,
about 20 to 25 cm (8 to 10 inches) across. This
approach enables you to manoeuvre the SMD
printed circuit board into the best position
at any time during the parts placement process and fix it firmly in place with both hands.
Using a conductive material for this underlay
enables it to be earthed for discharging any
static electricity charge. Many mousepads are
elektor - 7-8/2009
suitable for this purpose, used with the conducting surface uppermost.
although the author has not tested these personally. Here practitioners will state that SMD
printed circuits boards can also be populated
using double sided sticky tape. Blu-Tack has
the advantage, however, that you can use it
Instead of Blu-Tack you could use other materials such as Plasticine or even chewing gum,
to fix individual components onto the PCB
tidily and ‘squarely’ before soldering, leaving
both hands free for the actual soldering.
(090368-I)
Daylight Switch
Mickael Bulet (France)
nal dimensions) IP55 junction box,
for example, the Plexo® range from
LA
Legrand. It is easy to install; all you
have to do is cut into the cable leading to the light and wire it in series.
The circuit is AC powered, without
using a transformer. The impedance
of a capacitor is used to drop the 230
B
VAC power voltage and limit the curK3
rent. Resistor R1 protects the capaciLA
tor (C1) against surge currents when
power is applied at lighting-up time,
and R2 ensures that it is discharged
K1
at turn-off. Readers on 120 VAC, 60 Hz
R3
power should change component valK2
LDR
ues as follows: R1 = 2x 100 Ω in parallel (stacked) or 1x 47 Ω, 2 watts; C1 =
2.2 µF. Also note P = phase, N= neutral,
090049 - 11
P (PE) = protective earth.
Rectification is achieved using a bridge
enough, fitting into an 80×80 mm (inter- rectifier, which makes it possible to double
A
P
This project was originally designed
for lighting up an illuminated sign for
N
a wine-grower. The sign was originally
controlled by a simple time-switch,
E
which had to be reprogrammed every
day to avoid the sign’s lighting up
while it was still daylight. This is timeP
consuming, and can lead to wastage
of electricity and other resources. A
better solution would be an autoN
matic switch capable of detecting
E
the transition between daylight and
night-time. In addition to that fundamental requirement, the specifications also demanded a very compact
unit that would be easy to install and
not require major modifications to the
existing electrical installation.
The project described here is compact
COMPONENT LIST
R2
Resistors
470k
C1
R1
P
K3
R1 = 47Ω 1W
R2 = 470kΩ
R3 = LDR
R4, R5 = 100kΩ
R6 =1kΩ
P1 = 1MΩ multiturn preset, vertical
47 Ω
1W
1µ5
D2
D1
IC2
7812
4x
1N4007
+12V
N
D3
D4
D5
15V
E
K1
1000µ
25V
100n
C1 = 1µF5 400V MKT
C2 = 1000µF 25V axial
C3 = 100nF LCC 63V
C4 = 10µF 25V radial
Semiconductors
2
1
7
µA741
5
6
D1–D4, 6 = 1N4007
D5 = 15V 1.3W zener diode
T1 = BC547 or equivalent
IC1 = μA741 or equivalent
IC2 = 7812, or low-drop equivalent
T1
R6
1k
BC547
4
LDR
Capacitors
IC1
3
R3
C3
R5
100k
100k
R4
C2
D6
RE1
Miscellaneous
C4
P1
10µ
25V
1M
12V
1N4007
K2
LA
090049 - 12
7-8/2009 - elektor
RE1 = relay, 12V coil, 1x 10A, 250V c/o contact
K1,K2,K3 = 2-way PCB terminal block, 5mm (0.2”)
lead pitch
Type IP55 electricity junction box, internal
dimensions 80 x 80 mm (3.15” x 3.15”) e.g. plexo
LEGRAND # 922-06
20 mm length of electricity conduit, diam. 20 mm
(0.8”)
45
the usable current compared with
the conventional rectification often
encountered in this sort of power supply. A zener diode of around 15 V (minimum, as the 12 V regulator needs to
be allowed enough headroom to do its
job properly) limits the voltage in the
first instance; it is then smoothed by
C2, then more accurately regulated by
IC2 and finally decoupled by C3. The
stable 12 V supply is required above all
for the voltage divider that acts as a
reference for the comparator.
The darkness is detected by an LDR,
which in conjunction with R4 forms a
voltage divider, the output voltage of which is
inversely proportional to the intensity of the
light falling on the LDR. Capacitor C4 absorbs
rapid changes in this voltage, in order to
avoid unwanted triggering. R5 and P1 form a
voltage divider for the comparator (IC1) reference voltage — this is what determines the
threshold for the light to be turned on. When
the voltage on pin 3 of IC2 is higher than the
voltage on pin 2, the comparator activates
the relay via T1, and the sign is lit up.
to pass through from the LDR, which
you will need to glue to the lid. In front
of the LDR, fit a piece of 20 mm diameter plastic conduit about 20 mm long
as a shield, so that the LDR won’t be
affected by the light coming from the
light you are trying to control. Install
the switch as far away as possible from
the light it is operating, to avoid ending up with a flasher!
Last of all, adjust P1 for the light level
at which you want the relay to switch
on.
Cautionary Notice
When you’re handling the circuit for testing
etc., be really careful to avoid getting a shock,
as there is live AC power present over most of
the PCB. Never connect the circuit’s internal
ground rail to the protective earth (E) line.
A printed circuit board has been designed (the
design is available free from [1]) to make building the switch easier. Don’t forget to tin the
tracks switched by relay RE1 so they can carry
as much current as possible to the light to be
controlled. In some cases, it may be necessary
to beef up the tracks with pieces of solid copper wire.
The circuit fits into a sealed IP55 box, like an
electricity junction box, for example. Drill a
hole in the lid of the box to allow the leads
(090049-I)
Internet link
[1] www.elektor.com/090049
Control Interface via PC Keyboard
Jacob Gestman Geradts
(France)
VDD
One of the more difficult
aspec ts when making a
control or security system
that uses a PC (a burglar
alarm using a PC, for example), is the connection of
the sensors to the computer. In addition to typically
requiring specialist interface expansion boards, the
writing of the program that
includes interrupts is often
also an insurmountable
obstacle. But when only a
simple system is concerned
consisting of, for example, four light barriers or, if
need be, trip wires giving a
digital on/off signal when
uninvited guests enter, then
a much cheaper but nevertheless effective interface is
possible.
For this interface we use an
(old) computer keyboard.
T h i s c o n t a i n s a s m a ny
switches as there are keys.
46
IC2.D
L1
8
D1
LED
SCRL
D2
D3
LED
NUM
30
VDD
CAP
C7
C6
IC1
NUM
C5
C4
C3
SCRL
C2
C1
C0
38
37
5
6
C1
C2
25
34
10u
100n
36
HT82K28A
DATA
R17
R16
CLK
R15
R14
IO0
R13
IO1
R12
R11
NC
R10
NC
R9
NC
R8
R7
1
R1
R6
OSC1
R5
R4
R3
2
R2
VSS
R1
VSS
GND
12
3
LED
CAP
31
CLK
11
6
32
DATA
IC2.C
9 10
4
R0
12
11
10
1
9
IC2.A
13
8
CTRL A
7
2
40
39
35
33
3
27
26
IC2.B
5
CTRL B
24
15
4
14
13
29
IC2 = 4066
28
23
22
21
20
VDD
19
18
17
16
14
IC2
7
090379 - 11
These switches are scanned
many times per second in
a matrix in order to detect
the potential press of a key.
The number of columns is
usually eight (C0–C7 in the
schematic); the number of
rows varies for each type
of keyboard and can range
from 14 to 18 (R0–R17 with
the HT82K28A keyboard
encoder mentioned in the
example). To each switch
there is a single column- and
a single row connection.
The intention of the circuit
is that sensor A will ‘push’
the letter A, when it senses
something. This requires
tracing the keyboard wiring to figure out which column and which row is connected to the A key. One of
the four analogue switches
from the familiar CD4066
CMOS IC is then connected
between these two connections; that is, in parallel with the mechanical A
key on the keyboard. When
the Control-A input of the
elektor - 7-8/2009
CD4066 is activated by sensor A, the letter
A will be sent to the computer by the keyboard. The PC can then act appropriately,
for example by entering the alarm phase.
could, for example, shunt the ‘next channel’ button using one of the 4066 switches,
which itself is activated by a 1-Hz square
wave generator.
The system is not limited to (burglar) detection using a PC. The remote control of a TV
set or other electronic devices can also be
operated with a 4066 in the same way; for
example to scan through a number of TV
channels in a cyclical fashion. To do this, you
In the schematic only switches A and B of the
CD4066 are connected to the keyboard. You
can, of course, use all four of the switches
and if you need more than four you can use
multiple CD4066 ICs. The indicated wiring
between the keyboard IC and the 4066 is an
example only, and each ‘typed’ letter has to
be determined by the user for the specific
keyboard that is used. It is important that
each CD4066 switch is always connected
between a row- and a column connection.
The output signal from the sensors has to be
suitable for the CD4066 and the power supply voltage of 5 volts used by the keyboard.
The power supply for the CD4066 may be
obtained from the keyboard.
(090379-I)
PR4401 1-Watt LED Driver
D1
L1
22µH
IC1
PR4401
2
1
T1
R1
FF
BD140
BT1
L2
1V5
3
Where Tdis is the discharge time of inductor L2 through the LED. The
LED’s brightness can be increased or decreased by varying the inductance of L2. In practice, any value between 10 and 56 µH will work just
fine. The inductor current increases on each cycle until T1 goes out
of saturation, hence a small resistance (R1) is required at the base of
T1. Without the ‘stopper resistor’, the final current goes out of control
due to the DC gain of T1. A transistor with a high DC current gain and
low collector-to-emitter saturation voltage is the best choice if you
want to tweak the circuit for efficiency. Regarding L2, make sure the
peak current through it is below the saturation level.
*
(080825-I)
Advertisement
080825 - 11
T.A. Babu (India)
The PR4401 chip from Prema can be used to drive an LED directly,
but not a high-power LED like one of the popular 1-watt types currently available on the market. The circuit shows that the drive signal at the Vout terminal of the PR4401 chip (pin 2) turns a mediumpower PNP switching transistor (T1) on and off. When T1 is switched
into conduction, inductor L1 is charged. When T1 is switched off, the
inductor discharges its stored energy through the LED during flyback
with enough current to allow a one-watt LED to light up at nominal
brightness.
During the ‘on’ time of transistor T1, the current through inductor L2
ramps up linearly to a peak value as expressed by.
IL2(pk) = [(Vbatt – VCEsat(T1)) ×Ton ] / L2
where VCEsat(T1) is the collector-to-emitter saturation voltage of T1
(here, a type BD140 is suggested).
During T1’s ‘off’ time, the inductor voltage reverses, forward-biasing
the LED and discharging through it at a constant voltage roughly
equal to the forward voltage of the LED, while its current ramps down
to zero. Because this cycle repeats at a high rate, the LED appears
to be always on, its brightness depending on the device’s average
current, which is proportional to the peak value. The LED current is
roughly a triangular pulse with a peak current approximately equal
to the inductor’s current because of the finite turn-off time of T1. The
estimated average current may be calculated from
ILED(avg) = 1/2 × IL2peak × [Tdis / (Ton + Toff )]
7-8/2009 - elektor
China PCB Supplier
(Prototype thru Production)
✓ 1-layer up to 30-layer
✓ Cost and quality
✓ On time delivery
✓ Dedicated service
✓ Instant Online Quote & Order
. . . . . Day and Night
No minimum quantity – 1 piece is welcome
Check our low price and save big $$$...
86(571)86795686
[email protected]
www.pcbcore.com
47
TurboGrafx-16 (PC-Engine) RGB Amplifier
Marco Bettiol (France)
loscope, and calculator!
The principle of this circuit is very simple and
is based around a single IC, the LT6551 from
Linear Technology. The package contains four
independent video amplifiers with a fixed
gain of 6 dB. This IC is available in MSOP format, which means the overall size of the circuit can be kept down. The RGB + sync signals are picked up directly from the expansion port.
The input impedance of the circuit is set at
10 kΩ so as not to overload the HUC6260. R9
for the sync circuit, R10, 11, and 12 for the RGB.
Next, we need to eliminate the 3.6 V DC component and set the RGB signals at a more suit-
The PC-Engine, also marketed under the
name TurboGrafx-16 [1] is an 8-bit games
console made by NEC/Hudson Soft which
appeared in Japan in 1987. In terms of units
sold, for some time it exceeded Nintendo
and its famous Famicom (NES in Europe).
Despite this success, it was never officially
distributed in Europe. Sodipeng was the
only company to market it, but it remained
a pretty well kept secret.
Nowadays, people who want to play again
with this excellent machine are faced with
a problem of incompatibility of the video
B
G
SYNC
R
SR
+5V
SL
+5V
39k
10u
R7
R9
C2
C16
C11
22u
47u
47u
+5V
C6
R8
100n
2
3
4
IN1
IC1
OUT1
IN2
OUT2
IN3
OUT3
IN4
OUT4
LT6551
GND
5
R17
C5
75R
10
220u
VCC
1
R4
270R
R10
8k2
10u
R6
10k
10k
R11
C15
10k
10u
R5
8k2
10k
C14
8k2
10u
R16
39k
C13
8k2
C12
R12
R15
39k
R14
39k
R13
9
8
7
6
R3
K1
C4
8
75R
220u
R2
7
3
1
C3
5
75R
220u
R1
6
2 4
PE
C1
PE
MAB8SH
75R
220u
090041 - 11
signals, as the PC-Engine’s NTSC video output may not be compatible with some PAL/
SECAM television sets. The only way to be
able to use this console and obtain a colour
picture is to connect directly to the HUC6260
video processor which provides the red,
green, and blue primary signals plus sync. As
luck would have it, these signals are directly
available on the machine’s rear expansion
port. This port also provides the left and
right audio signals, along with a 5 Vdc power
rail. Even though the RGB signals are at the
standard level of 0.7 V p-p, they still can’t be
fed to the TV set directly, as the HUC6260 is
not capable of driving into a 75 Ω load. This
is where you get out our soldering iron, oscil-
SCART socket wiring [2]
able level. If the signal were to be amplified
as is, the amplifier would be bound to saturate. So the choice of a proper level is vital
in order not to distort the reproduction of
the image being amplified. Capacitors C12–
C16 provide coupling, and only the wanted
AC component of the signal passes on to the
next stage.
PC‑Engine expansion port (resembles DIN 41612) [3]
Ground
4, 5, 9, 13, 17, 18, 21, (14)
A1
Audio Left
R
15
C1
Audio Right
G
11
C2, 20
ground
B
7
A2, 21
+5 V dc
Video/Sync
20
A23
Red
Audio Left
6
B23
Green
Audio Right
2
C23
Blue
RGB switching
16
C22
sync
48
elektor - 7-8/2009
This AC signal needs to be fixed or ‘clamped’
to an optimum level. The specifications of the
LT6551 offer an input range from 0 to 2.5 V
maximum with a 5 V supply (see data sheet).
R5/R13 and the three other identical pairs of
resistors create voltage dividers. By choosing
the values of 8.2 kΩ and 39 kΩ, you obtain an
operating point around 0.86 V. A little calculation just to check: 0.7 V plus 0.86 V gives a
maximum input signal of 1.56 V.
It’s important to choose the coupling capacitor value correctly, according to the value of
these resistors. Together, they form a highpass filter that attenuates the lower frequencies of the wanted signal. As a rule-of-thumb,
you need to calculate this filter in such a way
as to set the cut-off frequency at one tenth of
the lowest frequency to be passed, which in
this case is 30 Hz, the NTSC frame rate (25 Hz
for PAL/SECAM). So let’s take 30 Hz as the
cut-off frequency. The formula for the cut-off
frequency of a first-order filter fc = 1/(2πRC)
gives C = 3.9 µF (with R = R5//R13 = 6,775 Ω
and f c = 3 Hz) and so you’ll choose the
slightly higher value close to this: 4.7 µF for
example.
The LT6551 amplifies the video signal by a
factor of two (+6 dB) and so we find at its
output terminals a signal of 1.4 V, together
with a DC component. A capacitor (C1, C3,
C4, C5) removes this unwanted DC component and the output impedance is set to the
standard value of 75 Ω by a resistor (R1–R4).
This 75 Ω output impedance is effectively
in series with the 75 Ω impedance of the TV
set’s input stage, which divides the voltage
by two, bringing the video signal back down
to its standard value of 0.7 V. And that’s why
we need to use an amplifier with a gain of
6 dB.
An 8-pin DIN socket carries the RGB + sync
signals. The sound signals are filtered of any
DC component and the RGB switching signal
needed by the SCART input is also provided.
All that remains is to make up the cable with
the correct pin-outs.
This little project helps us remember that
video games can generate very serious activities, and that in electronics nothing is ever
chosen by chance. Enjoy your gaming!
(090041-I)
Internet links
[1] http://en.wikipedia.org/wiki/PC-Engine
[2] http://en.wikipedia.org/wiki/SCART
[3] http://www.gamesx.com/misctech/pcebp.php
Fan Speed Controller
Andreas Vogel (Germany)
The solution of course is to install a new
fan speed controller and fit a temperature
sensor to the CPU heat sink. The controller
senses the air temperature in the PSU as well
as the processor heat sink and adjusts the
fan speed according to the warmest read-
7-8/2009 - elektor
R4
R3
10k
C1
10k
R2
4k7
R1
100n
8
VCC
K3
12V
GND
NTC1
NTC2
5V
IC1
MISO
5V
SCK
MOSI
RST
GND
1
7
PB5 (PCINT5/RESET/ADC0/dW)
(SCK/ADC1/T0/PCINT2) PB2
2
6
PB3 (PCINT3/CLKI/ADC3)
(MISO/AIN1/OC0B/INT0/PCINT1) PB1
3
5
PB4 (PCINT4/ADC2)
(MOSI/AIN0/OC0A/PCINT0) PB0
ATtiny13
GND
K1
K2
4
R5
220R
R6
4k7
The specification of Intel’s ATX type PC form
factor even suggests that the cooling air
should be used in this way but to be successful on modern machines it is necessary to
pay careful attention to a number of factors.
Firstly it is important to use a processor which
has the lowest possible power consumption
(especially in idle mode), the lower cost 45 nm
technology chips are a good place to start
here. Secondly it is important to pay attention to the air flow in the case to ensure that
it is ducted efficiently from the PSU through
the passive CPU heat sink. The main drawback with this setup is that fan speed is only
controlled by the temperature of the PSU, not
the processor.
5V
4k7
Anyone who uses a computer for long periods will appreciate the benefits of a silent
PC. Quite a few websites now sell computer accessories specifically designed to make
your desktop run more quietly. The CPU
fan is often the main culprit in a noisy PC;
in many cases it can be replaced by a large
passive heat sink to dissipate the heat more
efficiently. The heat sink fins are arranged to
make optimum use of air blown through the
case by the power supply fan.
12V
C2
1u
25V
T1
BC850
T2
BCX56
070579 - 11
ing. This approach ensures that everything
remains cool.
With this in mind the author built this versatile fan speed controller using little more than
a small microcontroller, a few transistors and
two NTC thermistors. The main circuit element IC1 is an 8-pin 8-bit ATtiny13 microcontroller from Atmel. This controller has more
than enough 10-bit resolution analogue
inputs for the job.
The circuit diagram is not so complicated:
Two thermistors are connected between
NTC1 and NTC2 of K3 and ground. Together
with R1 and R2 they form two voltage divider
networks. The voltages produced at NTC1
and NTC2 are proportional to the measured
temperatures. These are sampled by the analogue inputs ADC2 and ADC3 of the microcontroller. The controller will select one of ten
fan speed settings depending on the measured values of temperature. The higher of
the two temperature readings will always be
used. The output from pin 6 is a pulse modulated waveform to control fan speed. The output Darlington configuration of T1/T2 drives
the fan from the PWM waveform integrated
by R6/C2. This low pass network filters out the
15 Hz fundamental of the PWM output signal
to reduce any PWM noise generated in the
fan windings.
49
The power connections to 12 V and 5 V on K3
can be supplied from an unused floppy disk
drive or spare hard disk power cable. K1 provides the connection for the in-circuit programming cable for the microcontroller. R4
should ensure that the fan is switched on if
the microcontroller hangs or a fault occurs.
The circuit is so simple that it can comfortably fit on a square of perforated stripboard
and housed in a small plastic enclosure. Fix
one of the thermistors onto the heat sink
(doesn’t matter which one but make sure it is
electrically insulated from the heat sink). The
other thermistor can be positioned in the air
flow from the PSU so that air can pass freely
around it. The PSU fan can now be connected
to the new fan speed controller. Some fans
have a built-in thermistor which regulates
the fan speed autonomously. In this case
remove the thermistor and replace it with a
fixed resistor to make sure it runs at full speed
(try 1 kΩ).
The firmware for IC1 is written in assembly
language and would also run in principle on
other variants of the ATtiny microcontroller
family.
(070579-I)
Download & Product
Programmed controller
070579-41 Controller ATtiny13
Software
070579-11: source code and hex files, from www.elektor.com/070579
Power-up/down Sequencer
Whether you’re talking about a home cinema
or a computer system, it’s very often the case
that the various elements of the system have
to be turned on or off in a quite specific order,
or at least, automatically. Constructing this
sort of automation system is well within the
capability of any electronics enthusiast worthy of the name, but in this ‘all-digital’ age,
most of the circuits of this type to be found
in amateur electronics magazines or websites use a microcontroller. Even though that
is indeed a logical solution (in
more ways than one!), and you
might even say the easiest one, it
does pose problems for all those
people who don’t (yet) have the
facilities for programming these
types of IC. So we decided to
offer you now an approach that’s
very different, as it only uses a
simple, cheap, commonly-available analogue integrated circuit,
which of course doesn’t have to
be programmed. Our project in
fact uses as it’s ‘brain’ an LM3914,
ON
a familiar IC from National SemS1
iconductors, usually used for
driving LED VU (volume unit)
OFF
meters.
create a strip of light (bar) that is longer or
shorter according to the input voltage. This is
the mode selected for the LM3914 in the circuit described in some detail below.
+9V...+12V
RS1...RS4 = S216S02
D1
50
*
3
RS1
F1
2
*
S1A
1N4004
C2
R1
VDR
470µ
25V
4
3
1
RS2
MODE
5
L2
RHI
25V
560 Ω
100µ
R7
8
L3
L4
L5
SIG
LM3914
7
VDR
L1
IC1
C1
*
S2A
6
470k
F2
R2
3
9
R5
S1B
250V
2
R6
4
Before taking a look at the circuit for our project, let’s just
remind ourselves that the IC has
one analogue input and ten outputs intended for driving LEDs.
It can operate in ‘point’ mode,
where the LEDs light up in turn,
from first to last, depending on
the input voltage, but only one LED is lit at
any given time. Alternatively it can operate
in ‘bar’ mode (this is the mode normally used
for VU meters), and in this case, the LEDs light
up one after the other, in such a way as to
Resistor R7 connected to pin 7 of the LM3914
sets the current fed to the LEDs by the LM3914
outputs. Here, it’s been set to 20 mA, since
that is the value expected by the solid-state
relays chosen. The input voltage applied to
pin 5 of the LM3914 is none other than the
voltage present across capacitor C1 — and
this is where the circuit is ingenious. When
the switch is set to ‘on’, C1 charges slowly
through R5, and the LEDs of the solid-state
relays on the outputs light one after another
as this voltage increases; in this way, the units
being controlled are powered up in the order
So as to be able to control the AC powered
equipment our sequencer is intended to
manage, we are using solid-state relays —
four, in our example, though you can reduce
or increase this number, up to a maximum
of ten. Since the input devices in solid-state
relays are LEDs, they can be driven directly
by the LM3914 outputs, since that’s exactly
4k7
Christian Tavernier (France)
L6
L7
L8
REFOUT
RLO
L9
REFADJ
L10
1
4
1
S2B
250V
18
17
16
3
RS3
2
F3
*
15
S3A
14
R3
VDR
13
12
4
1
S3B
250V
11
10
3
RS4
2
F4
*
2
S4A
4
1
R4
VDR
250V
S4B
081180 - 11
what they’re designed for. As only four relays
are available, these are spread across outputs L2, L4, L6, and L8, but you can choose
any arrangement you like to suit the number
of relays you want to use.
you’ve chosen. To power-down, all you have
to do is flip the switch so that C1 discharges
through R5, and the LEDs go out in the
reverse order to that in which they were lit,
in turn powering down the units connected
elektor - 7-8/2009
to the solid-state relays. Easy, isn’t it?
If you’re not happy with the sequence speed,
all you need do is increase or reduce the
value of R5 in order to alter the speed one
way or the other.
The circuit needs to be powered from a voltage of around 9 to 12 V, which doesn’t even
need to be stabilized. A simple ‘plug-top’,
‘wall wart’ or ‘battery eliminator’ unit will be
perfect, just as long as it is capable of supplying enough current to power all the LEDs. As
the LED current is set by R7 to 20 mA per LED,
it’ll be easy for you to work out the current
required, according to the number of solidstate relays you’re using.
In our prototype the type S216S02 relays
from Sharp were used, mainly because they
proved readily available by mail order. They
also have the advantage of being compact,
and their switching capacity of 16 A means
you can dispense with a heatsink if you’re
using them for a computer or home cinema
system, where the current drawn by the various units can be expected to remain under
1 A. These solid-state relays must be protected by a fuse, the rating of which needs to
be selected according to the current drawn
by the devices being powered.
Also note the presence across the relay terminals of a VDR, also known as a GeMOV or
SiOV, intended to protect them from any spurious voltage spikes. You can use any type
that’s intended for operation on 250 VAC
without any problem. The values of fuses F1
to F4 are of course going to depend on the
load being protected.
Construction of the circuit shouldn’t present
any particular difficulty, but as the solidstate relays are connected directly to AC
power, it is essential to install it in a fullyinsulated case; the case can also be used to
mount the power outlet sockets controlled
by the circuit. Note that sockets are female
components.
Let’s just end this description with the sole
restriction imposed by our circuit — but it’s
very easy to comply with, given the intended
use. In order to remain triggered, the solidstate relays must carry a minimum holding
current, which is 50 mA in the case of the
devices we’ve selected. In practical terms,
this just means that each of the devices powered by our sequencer must draw at least
50 mA, or in other words roughly 12 VA at
230 VAC, or 25 VA at 120 VAC.
(081180-I)
Floating Message
Ludovic Voltz (France)
R8
BT1
1V5
12
11
4
2x AAA
R1
1
100k
This project lets you display a
message floating in the air using
just seven LEDs, a microcontroller, and the movement of your
arm. How can that be possible?
3
IC1
D1
560 Ω
RA0
RA1
RA2
RC5
RA3
RC4
13
5
6
7
R2
D2
560 Ω
R3
D3
560 Ω
R4
D4
use a very common 7 line × 5 column
character style. The columns are displayed sequentially by the seven LEDs
arranged in a column: first column 1,
then 2, and so on up to 5. If the LEDs
are moved on slightly before displaying the next column, the eye thinks
it is seeing the whole character. The
LEDs flash at a frequency of the order
of 200 Hz, and so all you have to do
is move the circuit around to see the
message appear as if it were floating
in mid air. Here’s a little gadget that
will amuse young and old alike on
summer evenings.
RA4
RC3
560 Ω
The human eye and brain can’t
2
8
RA5
RC2
R5
D5
BT2
9
resolve a moving object, and the
RC1
560 Ω
10
same applies to anything that
RC0
R6
D6
1V5
PIC16F616SL
560 Ω
changes rapidly. It is by exploitS1
R7
D7
ing this shortcoming (or capac14
560 Ω
ity, depending on which way you
look at it!) that we are able to see
videos and all types of footage,
080441 - 11
clips, visual effects and so on,
For simplicity and compactness, this
on the many screens around us.
project uses a PIC16F616 microconWhen the images on the screen
troller from Microchip, capable of
appear at a rate of at least 24 per second, that the author has exploited in creating this working off no more than 2 V. This allows
humans can no longer make them out as project.
the circuit to be powered from two AAA
individual images and perceive the result as a
rechargeable batteries (2 × 1.2 V), a good
moving object. It’s this ‘persistence of vision’ The characters of the message to be displayed compromise between battery life and the
7-8/2009 - elektor
51
space taken up. What’s more, this solution is
environmentally-friendly, as the batteries can
be recharged, unlike CR2035 button cells, for
example.
The messages are created with the help of
an Excel file, where all you have to do is fill
in the cells with 0’s or 1’s according to the
character you want to display. This file then
directly gives the hex code for the correspon-
ding constant. Naturally, this file is available in
the download accompanying this article [1].
Using the circuit is as simple as its operating
principle. A brief press of the button starts
the sequence for displaying the word. Then
all you have to do is synchronise your movements with pressing the button. In order to
be able to read the word properly, it’s best to
repeat the operation more than once. You can
store several words in the PIC’s Flash memory
(up to the limit of its capacity, of course). To
move on to the next word, you must press the
button for at least 0.6 s. The reproduction will
be clearer if the background lighting is low.
(080441-I)
Internet Link
[1] www.elektor.com/080441
Micropower Crystal Oscillator
Rainer Reusch (Germany)
ICC
Crystal oscillators for digital circuits are
normally built as Pierce oscillators with an
inverter. The inverter operates as a linear
amplifier and thus requires extra current. But
you can also build a crystal oscillator using an
operational amplifier (op amp for short)! If a
very low frequency is involved, for instance
32.768 kHz (commonly used for clocks), you
can get away with a comparatively ‘slow’
micro power op amp.
R1
VCC
+3V3...+5V
1M5
X1
R3 32768Hz
1M
IC1
C2
2
100p
8
6
3
5
1
In the sample circuit shown a widely available TLC271 is used. On pin 8 we have the
opportunity to set the ‘bias mode’, with three
choices ranging between fast operation with
higher current consumption and slower operation at low current. For our clock crystal the
4
TLC271
R2
1M
C1
7
middle setting will suit us fine. Pin 8 is therefore connected to the voltage divider R1/R2.
The current consumption of the entire circuit
is impressively modest and at 5 V this is just
56 µA! The oscillator also functions astoundingly well at 3.3 V. At the same time the current drops to a more battery-friendly 41 µA. A
prototype built in the Elektor Labs produced
the slightly higher values indicated in the circuit diagram.
100n
I CC = 85µA @ +3V3
I CC = 100µA @ +5V0
090320 - 11
The output signal delivered by this circuit has
admittedly scant similarity to a square wave.
Nevertheless some cosmetic surgery will tidy
this up, with treatment in the Schmitt trigger
following. To save current (naturally) we use
a CMOS device such as the 74HC14.
(090320-I)
Automatic TV Lighting Switch
Piet Germing (The Netherlands)
The author is the happy
owner of a television set
with built-in Ambilight lighting in the living room. UnforL
tunately, the television set in
the bedroom lacks this feature. To make up for this, the
230V
(110V )
author attached a small lamp
to the wall to provide backN
ground lighting, This makes
watching television a good
deal more enjoyable, but
it’s not the ideal solution.
Although the TV set can be
switched off with the remote
control, you still have to get
out of bed to switch off the
lamp.
Consequently, the author devised this auto-
52
R1
10 Ω
D1
D2
D3
D4
D5
5x 1N5408
TRI1
F1
2A
D6
R2
1N4007
100 Ω
C1
D7
220µ
16V
1N4007
S202TD1
matic lighting switch that switches the back-
ground light on and off along
with the TV set. The entire
TV
circuit is fitted in series with
230V
the mains cable of the TV set,
( 110V )
so there’s no need to tinker
with the set.
It works as follows: R1 senses
the current drawn by the TV
set. It has a maximum value
of 50 mA in standby mode,
230V
rising to around 500 mA
( 110V )
when the set is operating.
The voltage across R1 is limited by D5 during negative
half-cycles and by D1–D4
during positive half-cycles.
The voltage across these
090071 - 11
four diodes charges capacitor C1 via D6 during positive
half-cycles. This voltage drives the internal
elektor - 7-8/2009
LED of solid-state switch TRI1 via R2, which
causes the internal triac to conduct and pass
the mains voltage to the lamp.
Diode D7 is not absolutely necessary, but
it is recommended because the LED in the
solid-state switch is not especially robust
and cannot handle reverse polarisation. Fuse
F1 protects the solid-state switch against
overloads.
The value of used here (10 Ω) for resistor R1 works nicely with an 82-cm (32 inch)
LCD screen. With smaller sets having lower
power consumption, the value of R1 can be
increased to 22 or 33 Ω, in which case you
should use a 3-watt type. Avoid using an
excessively high resistance, as otherwise TRI1
will switch on when the TV set is in standby
mode.
Some TV sets have a half-wave rectifier in the
power supply, which places an unbalanced
load on the AC power outlet. If the set only
draws current on negative half-cycles, the circuit won’t work properly. In countries with
reversible AC power plugs you can correct
the problem by simply reversing the plug.
Compared with normal triacs, optically coupled solid-state relays have poor resistance
to high switch-on currents (inrush currents).
For this reason, you should be careful with
older-model TV sets with picture tubes (due
to demagnetisation circuits). If the relay fails,
it usually fails shorted, with the result that
the TV background light remains on all the
time.
If you build this circuit on a piece of perfboard, you must remove all the copper next
to conductors and components carrying
mains voltage. Use PCB terminal blocks with
a spacing of 7.5 mm. This way the separation between the connections on the solder
side will also be 3 mm. If you fit the entire
arrangement as a Class II device, all parts of
the circuit at mains potential must have a
separation of at least 6 mm from any metal
enclosure or electrically conductive exterior
parts that can be touched.
(090071-I)
Phone Ring Repeater
7-8/2009 - elektor
D2
R1
R2
R5
220 Ω
470 Ω
1k
1µ
250V
D1
6V8
0W4
R4
D3
1N4004
LA1
240V
(120V)
C2
1
IC1
6
C3
47µ
25V
2
4
R3
MOC3041
charges capacitor C2, which makes it possible to light LED D3 as well as the LED in the
optocoupler IC1. This is no ordinary optocoupler, but is in fact an AC power zero-crossing
detecting opto-triac, which allows us to control the chosen load while generating no, or
less, interference, which would not be the
case using a standard opto-triac.
The output triac it contains is not powerful
enough to drive a load directly connected
to the mains, so it is used to drive the trigger of triac TRI1, which is a totally standard
400 V device, rated at x amps, where x is cho-
X2 22n
250V
*
TRI1
400V
(200V)
C4
X2 10n
250V 230V
R6
(120V
)
47 Ω
C1
sen to suit the maximum power of the load
you want to control using this circuit.
Resistors and capacitors R5 and C3 on the one
hand, and R6 and C4 on the other help, serve
to suppress the switching transients, which
are already inherently low because of the AC
zero-crossing switching provided by IC1.
Construction is not at all difficult, but does
require a few precautions in choosing some
390 Ω
Even though cordless phones have invaded
our homes and offices, you don’t always have
them at hand, and as their ringtones are usually very much quieter than the old rotary-dialtype analogue phones, it can happen that you
miss a call you’ve been waiting for while you’ve
been going about your daily business.
Until quite recently, you could still find
remote ringers that could be plugged into
any standard phone socket in order to have
an additional ringer, but it seems as if these
accessories are currently being phased out as
everyone is ‘going cordless’. So we decided
to suggest something better, with this phone
ring repeater that makes it possible to control any device connected to the AC power
outlet using the ringtone available on any
subscriber line, and naturally, with all the
guarantees of safety and isolation that are
of course rightly expected. So it’s capable of
driving a ringer, or indeed even a high-powered sounder to alert you when you are in the
garden, for example; but it is equally able to
light a lamp for a ‘silent ring’ so as to avoid
waking a sleeping baby or elderly person.
This circuit has been designed to be compatible with all phone systems the author is
aware of and also to be totally stand-alone.
What’s more, the circuit can be connected
to the phone system without any danger —
though in some countries, it is forbidden to
connect non-approved devices to the public
switched telephone network (PSTN). Check
local regulations in this respect.
In order to understand the principle of it,
we just need to remember that the ringtone
present on a phone installation is an alternating voltage, whose amplitude and fre-
quency vary somewhat between countries,
but always with comparable orders of magnitude except in the case of exchange systems
used in large companies. However, when the
line is quiescent or a call is in progress, it carries only a direct voltage. Capacitor C1 makes
it possible to pick off just the AC ringing voltage, which is then rectified by D2 and amplitude-limited by D1. The resulting DC voltage
1k
Christian Tavernier (France)
081171 - 11
of the components. First of all, capacitor C1
must be an MKT type, mylar or equivalent,
with a 250 V operating voltage because of
the relatively high amplitude of the ringing
voltage. For safety reasons, it is essential that
capacitors C3 and C4 are self-healing types
intended for AC power use at 250 VAC. These
capacitors are generally known as Class X or
X2 capacitors.
As for the triac, it should have a 400 V operating voltage (but see below for users on 120
VAC power) and maximum current slightly
greater than the maximum current drawn by
53
the load being driven. As this will usually be
a sounder or a common lamp, a 2 A type will
usually be more than adequate in most situations. As the circuit can be expected to operate for short periods only, there is no need to
mount the triac on a heatsink.
One final important point: as the right-hand
part of the circuit is connected directly to AC
power, it is vital to fit this inside a fully-insu-
lated housing, for obvious safety reasons.
Make sure you cannot touch any part when
the circuit is in use.
rights is reduce the value of resistor R1.
The circuit as shown was dimensioned for
operation from 230 VAC power. Readers on
120 VAC power should modify the following
component values: R4 = 180 Ω; R5 = 220 Ω;
TRI = 200 V model; IC1 = MOC3031. Optionally, C3 and C4 may be rated at 120 VAC.
The circuit should work at once and without
any problems, but if you notice that D3 doesn’t
light up fully, and hence incorrect or erratic
triggering of the triac, because of too low a
ringing voltage, all you need to put things to
(081171-I)
Pulse Clock Driver with DCF Synchronisation
Hans Oostwal (The Netherlands)
LCD1
Figure 1 shows the schematic diagram of
the hardware. The circuit is built around a
54
1
3
4
5
6
7
8
9
K
A
D7
D6
D5
D4
D3
D2
D1
D0
E
R/W
RS
VO
2
10 11 12 13 14 15 16
R5
10R
S1
D1
D2
C3
ERR
SYNC
R3
R4
P1
10k
10n
330R
330R
R2
14
VDD
17
18
1
2
3
4
15
16
R1
When using a clock of this sort, note that
some models have jumpers that can be fitted
or removed to configure the clock for different working voltages. If you have this type of
clock, select the lowest voltage (usually 24 V).
Based on the author’s experience, clocks from
the Dutch PTT (former postal and telecommunication authority) also work OK at 12 V.
VDD
+5V
If you want to use a clock of this sort, you
naturally want it to keep good time. This is
handled by the circuit described here, which
offers the following features:
RA0
IC1
RB0
RA1
RB1
RA2
RB2
RA3
RB3
RA4
RB4
RA5
RB5
RA6
RB6
RA7
RB7
6
7
8
9
10
11
12
+5V
13
PIC16F648A
10k
• it is synchronised to the DCF77 time reference signal at 77.5 kHz (from Mainflingen,
Germany) so the time is always correct;
• it is inexpensive – by using a microcontroller (in this case a PIC16F648A), the circuit requires only a few components, and
it can easily be assembled on a piece of
perfboard;
• it generates pulses at one-minute intervals
with alternating polarity;
• it also shows the time and date on an alphanumeric LCD module;
• automatic switching between winter and
summer time;
• time data is backed up in case of power failure (stored in PIC EEPROM).
VSS
2 x16
10k
Sometimes you can pick up a nice office
clock or station clock at a bargain price. To
ensure that these clocks all show the same
time inside an organisation such as the railway system and avoid hassles with changing
between winter time and summer time or
replacing empty batteries, these clocks are
normally connected to a clock pulse network
that is driven by a master clock or radio signal. The master clock generates a pulse every
minute, with successive pulses having opposite polarity.
VSS
6
5
VDD
2
4
+5V
INA
IC3
7
OUTA
OUTB
INB
5
TC4427A
DCF77
Module
*
10n
3
IC2
7805
3
+9V...+18V DC
2
R6
100R
GND
R7
C4
+5V
C6
1
4u7
16V
C1
C2
C5
10n
10n
2200u
16V
0
090035 - 11
PIC16F648A clocked by its internal 4-MHz
oscillator. A standard two-row LCD (HD44780
compatible) is connected to the microcontroller to display operating instructions or
the date and time.
The circuit can be powered from an AC
mains adapter that supplies a DC voltage
in the range of 9 to 18 V. A voltage regulator (IC2) generates a stable 5-V supply
voltage for the electronics from this. The
supply voltage from the adapter is con-
nected directly to the TI4427A MOSFET
driver IC that drives the clock coil. This
driver IC has a operating voltage range of
4.5 to 18 V and a maximum rated output
current of 500 mA (1.5 A peak). This is adequate for most clocks. If you need more
current, you can add a transistor or relay to
the output stage. The clock coil has a fairly
high inductance, so the supply voltage has
extensive decoupling in the form of several
ceramic capacitors (C1–C4) and an electrolytic capacitor (C5).
elektor - 7-8/2009
Advertisement
The source code of the software is written in Flowcode 3 Pro
and is available free on the Elektor website for downloading
(item number 090035-11). It is based on the software for the EBlocks DCF clock published in the December 2007 issue (07509411). The original software has been adapted to this application and extended with code that generates a pulse signal on
ports B6 and B7 with a period of 1 minute and alternating pulse
polarity.
Pushbutton switch S1 is used for most of the operator functions.
This button is connected to port A1 and has several functions:
- if S1 is not pressed when the power is switched on, the microcontroller executes a warm start. This is the normal situation. In
the event of a power failure, the analogue time and the polarity are saved in EEPROM, and they are restored after the next
warm start;
- if S1 is pressed when the power is switched on, a cold start is
executed. This must be done the first time the circuit is used (see
below for more information);
- if S1 is pressed during normal operation, the variables ‘a_hrXX’
and ‘a_minuteXX’ are shown on the display, which enables the
user to set the analogue clock.
In order to synchronise the analogue clock to the digital clock,
the analogue clock must first be set to exactly 12 o’clock. If
you have a clock that can only be operated electrically, which
means it does not have any mechanism (such as a knob) to set
the time manually, you can hold S1 pressed after the cold start to
cause the circuit to generate a continuous series of clock pulses.
Release S1 when the clock reaches exactly 12 o’clock. If you have
a clock that can be set manually, first set it to 12 o’clock and then
switch on power to the circuit with S1 held pressed. Release S1
when the message ‘cold start… done’ appears on the LCD. If the
DCF signal is being received properly, the date and time will be
shown on the display after a few minutes and the analogue clock
will be set to the right time.;
If the time shown by the analogue clock differs from the time
shown on the LCD by one minute, the polarity of the pulses does
not match the state of the stepper motor in the clock. This can
be corrected by first setting the clock to the right time and then
swapping the two leads. This action must be completed within
one minute.
The new PicoScope 4000 Series
high-resolution oscilloscopes
PicoScope 4000 Series
A DCF77 receiver/decoder module from Conrad Electronics
(p/n 641138) provides the time reference signal. It is also powered by the 7805 voltage regulator. The non-inverted output
of this module is connected to port RA4 of the microcontroller.
As reception of the long-wave signal from the DCF transmitter
may not be good in some locations, especially if you fit the circuit in a metal enclosure, it is advisable to fit the DCF module
in a separate plastic box that can be placed a certain distance
away from the clock.
The PicoScope 4224 and 4424 High Resolution
Oscilloscopes have true 12-bit resolution inputs
with a vertical accuracy of 1%. This latest
generation of PicoScopes features a deep memory
of 32 M samples. When combined with rapid
trigger mode, this can capture up to 1000 trigger
events at a rate of thousands of waveforms per
second.
PC-based - capture, view and use the acquired
waveform on your PC, right where you need it
• Software updates - free software updates for the life of
the product
• USB powered and connected - perfect for use in the
field or the lab
• Programmable - supplied with drivers and example code
•
Resolution
12 bits (up to 16 bits with resolution enhancement)
Bandwidth
20 MHz (for oscillscope and spectrum modes)
Buffer Size
32 M samples shared between active channels
Sample Rate
80 MS/s maximum
Channels
PicoScope 4224: 2 channels
PicoScope 4424: 4 channels
(090035-I)
Connection
Internet Link
[1] www.elektor.com/090035
USB 2.0
Trigger Types Rising edge, falling edge, edge with hysteresis,
pulse width, runt pulse, drop out, windowed
Product
090035-41: Programmed PIC
Download
www.picotech.com/scope1019
01480 396395
090035-11: Flowcode (.fcf) and hex files, from [1]
7-8/2009 - elektor
55
Frequency and Time Reference
with ATtiny2313
Vladimir Mitrovic (Croatia)
frequency may be calculated from:
In this project an AVR microcontroller type
ATtiny2313 acts as a variable frequency
divider, giving a sequence of very stable reference frequencies with a 50% duty cycle and
covering a frequency range of 0.1 Hz – 4 MHz
in 1, 2, 4 or 8 steps. The circuit is very simple
because everything is done inside the microcontroller. In the program 31 different frequencies are predefined and may be selected
by switches S1–S5 according to Table 1.
f = 8,000,000 / [2 × system_clock_prescale ×
(1 + OCR1A_value)]
The ATtiny2313 has two timers/counters: 16bit Timer/Counter1 and 8-bit Timer/Counter0,
both offering various modes of operation.
The ‘Clear Timer on Compare Match’
(CTC) mode is the most appropriate for
generating a waveform output. In CTC
mode Timer/Counter1 counts the system clock or external pulses up to the
value given in the OCR1A (Compare1A)
register. When the counter value
matches the OCR1A value the counter is cleared to zero and the OC1A
pin (PB3) toggles. In CTC mode Timer/
Counter0 counts the system clock or
external pulses up to the value given
in the OCR0A register. When the counter value matches the OCR0A value,
the counter is cleared to zero and the
OC0A pin (PB2) toggles. Division factors up to 2 x 65536 (for Timer1) or 2
x 256 (for Timer0) can be obtained
by setting appropriate values in the
OCR1A and OCR0A registers. Besides
by the timer division factor, an output
frequency is also determined by the
system clock, the system clock prescaler (1-2-4-8-16-32-64-128-256) and
the timer prescaler (1-8-64-256-1024).
In this design, an 8 MHz or a 20 MHz
crystal may be used in position X1
(20 MHz shown in circuit diagram) but
not indiscriminately because matching
firmware should reside in the ATtiny.
There are obviously several appropriate settings for producing a given frequency. As the
system clock and the system clock prescaler
setting determine the overall current consumption as well (lower frequency = lower
consumption), we will always choose the lowest possible CPU clock. Assuming X1 = 8 MHz,
for the 1 Hz to 4 MHz frequency range, only
Timer/Counter1 is used. It counts the (prescaled) system clock pulses and the output
56
For the lower frequencies, 8-bit Timer/Coun-
The program, which was writ ten in
­B ascomAVR, constantly monitors switches
S1–S5. It is available as a free download [1].
If any change in the switch settings occurs,
the ‘Set_f’ subroutine is called to set a new
frequency. The subroutine will stop timers,
reconfigure them, set proper values in various registers to obtain the proper division
factor and restart the timers. The values for
the registers are written in three tables.
1. ‘Clock_prescale_table’ contains the values
in the range of 1 to 256 (only values 2n are
allowed) which will be used to calculate the
proper value for the Clock Prescale Register,
CLKPR.
+3V ... +5V
C4
C1
100n
100µ
16V
20
1
RST
11
8
7
6
3
2
19
PB7
S1...S5
IC1
PD6
18
PB6
17
PB5
PD4
PB4
PD3
PB3
PD2
PB2
PD1
PB1
PD0
16
15
14
13
12
PB0
ATTiny2313
9
PD5
XTAL2
10
4
C3
22p
fo
XTAL1
X1
5
*
20MHz
C2
47p
080754 - 11
ter0 is used as an additional prescaler (division factor: 10) between the prescaled system
clock and Timer/Counter1. The latter is set in
the counter mode and now counts pulses at
the Timer/Counter0 output pin OC0A (PB2);
hence, the OC0A pin (PB2) and the external
input pin T1 (PD5) are interconnected. The
output frequency can be calculated as:
f = 8,000,000 / [2 × system_clock_prescale ×
(1 + OCR1A_value × 2 × (1+OCR0A_value)]
2. ‘Ocr1a_table’ contains the values in
the range of 1 to 65535 which will be
used to calculate the proper value for
the Timer/Counter1 Output Compare
Register OCR1A. Only values 5n (1, 5,
25, 125, 625, 3125 and 15625) are used
in this design. A zero (0) entry denotes
that Timer/Counter1 is stopped for
this frequency. Note that the value in
the table is decremented by 1 before
being written into the OCR1A.
3. ‘Ocr0a_table’ contains the values in
the range of 1 to 255 that will be used
to calculate the proper value for the
Timer/Counter0 Output Compare Register OCR0A. Only values 0 and 5 are
used in this design: a ‘0’ entry denotes
that the Timer/Counter0 is stopped
for this frequency, while ‘5’ produces
division of the system clock by 10. If
even lower frequencies are needed,
other type-5n values (25 and 125) can
be used to produce division factors of
100 and 1000. Note that the value in
the table is decremented by 1 before
being written into the OCR0A.
The Fref_ATtiny2313_Elektor_8MHz.bas program should be compiled and the resulting
hex code programmed into the ATtiny2313
microcontroller before first use. Be sure to set
the Flash Fuse bits to the proper value for an
external crystal resonator (CKSEL3...0 = 1111)
because the internal RC Oscillator is selected
by default. The hex file for 8 MHz is also available straight away in the download at [1]. A
variable capacitor C2 is provided to tune a
crystal frequency to exactly 8.000 MHz, if
elektor - 7-8/2009
possible. If you are satisfied with the crystal’s
accuracy, replace C2 with a fixed capacitor.
Set the configuration switches according to
Table 1 to obtain the wanted frequency.
Powered at 3 V, the 8-MHz version of the
frequency reference may still be used with
most logical families running at 5 V: CMOS,
LSTTL, HC, HCT and so on. However, be careful and do not allow any current to flow from
5 V powered circuits back into the microcontroller through the PB3 pin. This could
cause battery charging through the microcontroller’s clamping diodes with unpredictable results for both the battery and the
microcontroller. If such a risk exists, connect
a 3 V zener diode between PB3 and GND to
effectively limit the voltage to a safe value.
Caution: ready-programmed device 08075441 from the Elektor Shop is programmed for
the 20-MHz configuration and does not work
down to 3 V.
Raising the supply voltage to 5 V will approximately double the supply current to 15 mA
(max.), but it will also allow you to raise the
clock frequency to 20 MHz and obtain some
higher frequencies from the circuit. If current
consumption is not an issue, you may contemplate the use of a precision quartz oscillator to drive the microcontroller.
The frequencies supplied by the 20 MHz
version are given in Table 2. The two lowest frequencies, marked by an asterisk (*)
in the table, could not be obtained exactly,
but the division error is well under the crystal tolerance and therefore may be totally
neglected.
The program Fref_ATtiny2313_Elektor_20MHz.
bas will produce reference frequencies in the
0.001 Hz – 10 MHz frequency range in steps
of 1, 2 or 5. The main difference with the
8 MHz program is that the timer prescaler
for Timer/Counter0 is used here in order to
produce frequencies under 0.01 Hz. A table
called “Timer0_prescale_table” is added to
the program. It contains values ‘0’ (if Timer/
Counter0 is not used), ‘1’ (if it is used but not
prescaled) or ‘8’ (if it is used and prescaled by
the factor of 8).
Internet Link
Table 1. DIP switch settings for X1 = 8 MHz
S5
S4
S3
S2
S1
PD4…PD0
on
on
on
on
on
on
on
on
00000
on
off
00001
on
on
on
off
on
00010
(080754-I)
[1] www.elektor.com/080754
Downloads & Products
Programmed Controller
080754-41 ATtiny2313, ready programmed, 20 MHz
configuration
Software
080754-11 Source and hex files for 8 MHz and 20 MHz
Location: www.elektor.com/080754
Table 2. DIP switch settings for X1 = 20 MHz
Output freq.
S5
S4
S3
S2
S1
PD4…PD0
4
MHz
on
on
on
2
MHz
on
on
on
1
MHz
on
on
Output freq.
on
on
00000
10
MHz
on
off
00001
5
MHz
on
off
on
00010
2
MHz
on
on
on
off
off
00011
800
kHz
on
on
on
off
off
00011
1
MHz
on
on
off
on
on
00100
400
kHz
on
on
off
on
on
00100
500
kHz
on
on
off
on
off
00101
200
kHz
on
on
off
on
off
00101
200
kHz
on
on
off
off
on
00110
100
kHz
on
on
off
off
on
00110
100
kHz
on
on
off
off
off
00111
80
kHz
on
on
off
off
off
00111
50
kHz
on
off
on
on
on
01000
40
kHz
on
off
on
on
on
01000
20
kHz
off
on
on
off
01001
10
kHz
off
01001
20
kHz
on
off
on
01010
10
kHz
on
off
on
off
on
01010
5
kHz
off
off
01011
8
kHz
on
off
on
off
off
01011
2
kHz
off
off
on
on
01100
1
kHz
on
off
on
on
on
off
on
on
off
on
on
on
01100
4
kHz
on
off
on
off
01101
2
kHz
on
off
off
on
off
01101
500
Hz
off
off
on
01110
1
kHz
on
off
off
off
on
01110
200
Hz
off
off
off
off
01111
800
Hz
on
off
off
off
off
01111
100
Hz
off
on
on
on
on
10000
400
Hz
off
on
on
on
on
10000
50
Hz
off
on
on
on
off
10001
200
Hz
off
on
on
on
off
10001
20
Hz
100
Hz
off
on
on
off
on
10010
10
Hz
on
off
off
on
off
on
off
on
off
on
on
off
on
off
off
10010
on
on
off
off
10011
80
Hz
off
on
on
off
off
10011
5
Hz
on
off
on
on
10100
40
Hz
off
on
off
on
on
10100
2
Hz
on
off
on
off
10101
1
Hz
off
10101
20
Hz
off
off
on
10110
10
Hz
off
on
off
off
on
10110
0.5
Hz
off
off
10111
8
Hz
off
on
off
off
off
10111
0.2
Hz
off
on
on
on
11000
0.1
Hz
off
on
off
on
off
on
off
off
on
off
on
on
11000
4
Hz
off
on
on
off
11001
2
Hz
off
off
on
on
off
11001
0.05
Hz
on
off
on
11010
1
Hz
off
off
on
off
on
11010
0.02
Hz
off
on
off
off
11011
0.8
Hz
off
off
on
off
off
11011
0.01
Hz
off
off
off
on
on
11100
0.4
Hz
off
off
off
on
on
11100
0.005
Hz
off
off
off
on
off
11101
0.2
Hz
off
off
off
on
off
11101
0.002
Hz*
off
off
off
off
on
11110
0.1
Hz
off
off
off
off
on
11110
0.001
Hz*
off
off
off
off
off
11111
off
off
on
off
off
off
off
off
7-8/2009 - elektor
standby
57
Frequency Divider with 50% Duty Cycle
Roland Heimann (Germany)
VCC
3
TE
12
13
IC3D
>_ 1
CLK
3
K
74HC73
CL
1
11 10
9
IC4A
IC3C
_> 1
>_ 1
8
1
1
3
Q
12
Q
13
Q
VCC
4
11
14
14
7
7
IC3 IC4
IC3 = 74HC86
IC4 = 74HC04
5
4
IC4C
IC4B
2
Q
IC2A
IC2
1
IC3B
6
f0
J
8
R1
8x 4k7
14
IC1
P0
14
P1
TC
P2
P3
74HC40103
P4
P5
P6
P7
2
4
5
6
7
10
11
12
13
16
15
14
13
12
11
10
9
VCC
GND
S1
1
2
3
4
5
6
7
8
VCC
2
MR
15
PE
9
PL
1
CP
VCC
2
3
4
5
6
7
8
9
The most complex chip in this design is IC1, an
8-bit down-counter which is ‘programmed’
by the binary value set up on the eight DIP
switches. An edge detector circuit made up
of IC3 and IC4 produces a pulse at every rising and falling edge of the input clock f0. Each
time the counter reaches zero a flip flop is
toggled to produce a 50:50 mark/space ratio
output signal.
It does not matter if the gates used in the
edge detector circuit are inverting or noninverting; the only important points are that
the correct number of gates are used and the
delay time produced by each gate. The total
propagation delay through seven HC type
gates will be enough to generate a pulse of
sufficient width to reliably clock the counter.
Propagation delay is the time taken for a signal at a gate’s input pin to affect the output,
and this is given in the data sheet. The edge
detector produces a pulse on both the positive and negative edges of the input clock
signal.
The down-counter decrements its value each
time it receives a clock impulse on CP. When-
16
In digital circuit design, especially in microprocessor or measuring applications, it is
often necessary to produce a clock signal
by dividing down a master clock. The 4-chip
solution suggested here is very versatile; it
takes a 50% duty cycle input clock and outputs a 50% duty cycle clock selectable (via
an 8-way DIP switch) for every divisor from
1 to 255.
1
4
5
1
IC4D
6
9
1
8
1
2
IC3A
>_ 1
3
080436 - 11
ever the counter reaches zero the terminal
count pin (TC) generates a negative pulse,
reloading the counter (via parallel load PL)
with the binary switch setting. The counter
continues counting down from this value.
The JK flip flop IC3 is configured as a toggle
type flip flop (both inputs J and K wired to a
‘1’) the outputs Q and Q change state (toggle)
on each rising edge of the TC output of IC1.
The DIP switches are used to set up the division ratio, to divide the clock by 23 for example, set the DIP switches to the binary value
of 23 i.e. 00010111 (setting P4, P2, P1 and P0
to high).
(080436-I)
PIC Detects Rotation Direction
Lionel Grassin (France)
58
In the field of robotics, along with many other
applications involving a motor (printers, for
example), it is often necessary to measure a
motor’s speed and acceleration or direction
of rotation. One simple technique is to fit a
quadrature encoder to the shaft of the motor
to be monitored. A quadrature encoder (see
photo) is a device that produces two squarewave signals 90° apart as it turns. The direction in which the encoder rotates determines
which of these two signals is in advance
(compared with the other), thereby making
it possible to detect the rotation direction.
An algorithm for detecting the rotation
direction doesn’t need to be complicated,
but it does need to be fast enough to be able
to follow high speeds and speed variations.
This can be achieved using programmable
elektor - 7-8/2009
logic (FPGA, GAL, PAL, etc.), but the author
wanted to use a small, cheap microcontroller. He opted for the PIC12C509A from Microchip, an 8-pin microcontroller with six I/Os.
Two inputs and one output are all the rotation direction sensor needs, so the little PIC
is able to handle two quadrature encoders at
the same time.
The algorithm developed by the author
operates asynchronously, which ensures a
very wide operating range, dependent on
the capabilities of the microcontroller. The
algorithm loop time is 20 µs for a PIC12C50X
using the internal 4 MHz clock, so it is theoretically possible to follow a pulse signal of
up to 50 kHz. This corresponds to a speed
of 3,000 rpm for a motor fitted with a quadrature encoder giving 1024 pulses per rota-
tion. And all this for two motors/encoders at
the same time! You can find all the details of
the algorithm — and more — on the (French)
website of the Fribotte team to which the
author belongs [1].
The program (source code and hexadecimal
file) is available on free download from the
web page for this article [2].
IC2
K1
+5V
7805
+UIN
C1
C2
C3
10u
10n
100n
+5V
(081164-I)
ENC1
1
CHA1 2
CHA
CHB1 3
CHB
CHA2 4
CHB2 5
GHM-01
(Lynxmotion)
IC1
GP5
GP4
GP0
GP1
SENS1
7
CPU
6
SENS2
GP3
GP2
[1] http://fribotte.free.fr/bdtech/detectsens/detectsens.html
[2] www.elektor.com/081164
PIC12C509A
optional
Internet Links
8
Download
081164 - 11
081164-11: source code and hex file, from [2]
Vocal Adaptor
for Bass Guitar Amp
Jérémie Hinterreiter (France)
response of the amp doesn’t need to be as
wide or as flat as in hi-fi (particularly at the
high end), and so this sort of amplifier won’t
permit faithful reproduction of the voice. If
you build an adaptor to compensate for the
amp’s limited frequency response by amplifying in advance the frequencies that are
then attenuated by the amp, it’s possible to
improve the quality of the vocal sound. That’s
just what this circuit attempts to do.
The adaptor is built around the TL072CN low-
These days, music is a major hobby for the
young — and not-so-young. Lots of people enjoy making music, and more and
more dream of showing off their talents on
stage. But one of the major problems often
encountered is the cost of musical equipment. How many amateur music groups sing
through an amp borrowed from a guitarist
or bass player?
7-8/2009 - elektor
P1
3n3
P2
K1
C1
R3
250k
R1
6k8
2
4k7
10µ
3
IC1.A
C2
C3
3n3
3n3
1
MIC
1M
6
5
IC1.B
1k
R2
IC1 = TL072
P3
4k7
S1
R6
R4
100k
8
BT1
7
The circuit can readily be
powered using a 9 V battery, thanks to the voltage
divider R4/R5 which converts it into a symmetrical
±4.5 V supply.
+4V5
C6
100µ
IC1
9V
4
D1
R5
100k
A guitar (or bass guitar)
amplifier is designed first
and foremost to reproduce the sound of the guitar or bass as faithfully as
possible. The frequency
C4
10k
This is where the technical
problems arise — not in
terms of the .25” (6.3 mm)
jack, but in terms of the
sound quality (the words
are barely understandable) and volume (the amp
seems to produce fewer
decibels than for a guitar).
What’s more, unpredictable feedback may cause
damage to the speakers
and is very unpleasant on
the ear. This cheap little
easy-to-build project can
help solve these technical
problems.
noise dual FET op-amp, which offers good
value for money. The NE5532 can be used
with almost the same sound quality, but
at (slightly) higher cost. The circuit breaks
down into two stages. The first stage is used
to match the input impedance and amplify
the microphone signal. For a small 15 W guitar or bass amplifier, the achievable gain is
about 100 (gain = P1/R1). For more powerful amplifiers, the gain can be reduced to
around 50 by adjusting P1. The second stage
amplifies the band of frequencies (adjustable using
P2 and P3) that are attenuated by the guitar amp, so
as to be able to reproduce
the (lead) singer’s voice
as clearly, distinctly, and
accurately as possible. To
K2
C5
refine the adaptor and tai10µ
lor it to your amplifier and
speaker, don’t be afraid to
AMP
experiment with the component values and the type
of capacitors.
(080188-I)
C7
100µ
–4V5
090188 - 11
59
Guitar Pick-up Tone Extender
David Clark (United Kingdom)
This design extends the basic sonic possibilities of an electric guitar without the use of
any electronic ‘effects’. The expanded number of tone possibilities is brought about by
mixing continuously-variable amounts of the
output from each of the guitar’s pick-ups,
along with switching the phase of each pickup. This effectively gives an infinite range of
tones as opposed to the five available for a
normally switched set-up. This is not a project for the faint-hearted, however; it involves
modifying the wiring to the guitar’s pick-up
coils and switches, and possibly the scratchplate itself, depending on the chosen location for the replacement for the standard
0.25-inch (6.3-mm) jack connector. Use of a
cheap ‘copy’-style guitar is recommended!
The standard ‘Stratocaster’-style guitar features three pick-ups and a five-way switch
that allows the player to select one of the following combinations:
This project allows up to four
pick-ups to be employed,
since the bridge pick-up on
a ‘Stratocaster’ is often a socalled ‘humbucker’ type,
which can be split into
two independent pick-ups,
shown here as Bridge 1 (L3)
and Bridge 2 (L4).
The really intrepid among
you may decide to build the
circuitry in SMD and incorporate a tiny board into the
guitar. However, having
four switches and four pots
on the guitar may be too
much of a good thing.
The alternative is to wire the
guitar pick-ups individually to
• neck pick-up
• neck and middle pick-up in parallel
• middle pick-up
• middle and bridge pick-up in parallel
• bridge pick-up
Guitarists keen to find new sounds from their
instrument sometimes alter the wiring and
add other switches to this arrangement, but
this is of course not a flexible arrangement,
and certainly not something that could be
altered mid-performance playing for a crowd,
no matter if a dozen or so in a pub or 20 k at
Glastonbury!
1N4001
10k
K1
3
IC1.A
1
NOR
INV
R1
10k
S1
R14
S5
6
5
IC1.B
7
P1
R9
10k
100k
lin
PHASE 1
C1
10k
L1
2
V+
D1
K6
R2
K9
470µ
16V
IC4
K7
9V DC
3
Neck
2
7
6
TS921
4
R4
L2
K2
12
IC1.D
14
NOR
INV
R3
10k
S2
9V
9
10
C2
10k
13
K8
BT1
10k
IC1.C
470µ
16V
R15
8
P2
R10
V-
10k
100k
lin
PHASE 2
V+
Middle
R13
10k
R6
IC3
10k
L3
K3
2
3
IC2.A
1
NOR
INV
R5
10k
S3
2
6
5
IC2.B
7
3
P3
R11
1
K5
7
TL071
5
6
AUDIO
4
10k
100k
lin
PHASE 3
Bridge 1
VR8
V+
10k
L4
K4
13
12
IC2.D
14
NOR
INV
R7
10k
S4
PHASE 4
9
10
IC2.C
8
P4
R12
10k
IC1, IC2 = TL074
4
4
IC1
IC2
11
11
100k
lin
Bridge 2
V-
60
080523 - 11
elektor - 7-8/2009
a 9-pin sub-D type connector that is
added either to the guitar body or its
scratchplate. The connector is linked
to the input sub-D connector on the
control unit via a long ‘straightthrough’ serial interface computer cable. The Tone Extender
circuitry may be built in a Vero
style box, of which an example is shown in the photograph. Connection from
the unit to an unmodified
guitar amplifier is via a
standard guitar lead.
E a ch p i ck- u p s e ction consists of two
opamps from a TL074
package, one inverter
(e.g. IC1.A) and one buffer (e.g. IC1.B). Each has a normal/invert switch (NOR/INV, e.g.
S1) to select the phase of the signal component, and a 100-kΩ linear law potentiometer at its output to set the desired level. The
output signals of all four opamp sections are
summed by IC3 (a TL071) which provides a
suitably low output impedance to drive the
guitar amplifier.
Opamp IC4 splits the supply voltage
obtained from 9 V (PP3) battery BT1 into
symmetrical rails V+ and V–. Alternatively,
a battery eliminator with a regulated output voltage of 9 V DC may be connected
to K9, when the battery is automatically
disconnected.
Whatever method of construction is chosen, the unit effectively provides the guitarist interested in experimenting with unusual
pick-up configurations a flexible way of
quickly setting up and trying probably all
possible variations, without having to get
out the soldering iron and hard-wire each
new idea. As such it should be an invaluable
aid to allowing all manner of sonic possibilities to be realised.
(080523-I)
Lithium Battery Charger using BQ24103
Steffen Graf (Germany)
With the component values given the precharge current is 67 mA, the charge current is 667 mA and the termination current
is also 67 mA. The IC of course ensures that
the charging process is carried out correctly
and in particular that the maximum permissible cell voltage is never exceeded: this is
extremely important for lithium chemistry
7-8/2009 - elektor
R8
D1
C1
10k
D2
10µ 16V
R3
JP1
2
*
19
5
13
7
8
9
16
C2
R1
R2
3
6
4
IN1
VCC
IN2
STAT1
OUT1
STAT2
OUT2
IC1
PG
CELLS
TTC
SNS
BQ24103A
ISET1
BAT
VTSB
ISET2
CE
TS
PGND1 VSS PGND2
17
10
18
100n
R5
L1
1
4µH7
20
A+
150m Ω
*
15
14
11
R6
1k
A-
12
R4
10k
1k
1k
R4
10k
A further benefit is that it is capable of charging battery packs consisting of either a single cell or of two cells wired in series. Two
LEDs indicate when the battery is being
charged (D1 lights) and when the battery is
fully charged (D2 lights). The charge current
is set by the choice of external resistors [1].
There are three currents to set: the initial (precharge) current, the charge current and the
charge termination current.
*
VCC
10k
The BQ24013 is a simple-to-use charge controller suitable for use with lithium-ion and
lithium-polymer batteries. A major advantage it has is that it includes integrated power
MOSFETs capable of working with charge currents of up to 2 A. Its switching frequency is
high, at 1.1 MHz, and so only a small external
coil is needed. In comparison to linear charging circuits the switching topology offers a
much higher degree of efficiency.
C3
10µ
25V
081147 - 11
cells. Even more important is to note that
jumper JP1 should be fitted only in the case
where two cells are being charged. When
charging a single cell the jumper must not be
fitted, or there is a risk of explosion or fire as
the charging voltage will be too high.
The minimum supply voltage for charging a
single cell is 5 V; for charging two cells it is 9 V.
According to its datasheet, the IC is specified
for supply voltages of up to 16 V.
Unfortunately the IC is only available in a
QFN20 package, which is rather tricky to
61
solder. In compensation, the tiny package
does make it possible to build a complete
2 A charging circuit on less than 2.5 cm2 of
printed circuit board.
For the prototype, with a charging current of
670 mA, we selected for L1 a 4.7 µH inductor
with a DC resistance (DCR) of 0.082 Ω (82 mΩ)
rated for a current (DCI) of 1.72 A. If a charge
current of up to 2 A is wanted, an inductor
with a DCR of less than 0.025 Ω (25 mΩ) and
a current rating of 4 A or more should be chosen. For R5 we used a Vishay 150 mΩ SMD
resistor in an 0805 package (available, for
example, from Farnell), and for C3 a ceramic
barrier-layer capacitor with a working voltage
of 25 V. If an electrolytic capacitor is used it
must have a very low ESR.
that are available can be found at [2]. For our
prototype we used a type BQ24103A.
(081147-I)
Internet Links
[1] www.ti.com/lit/gpn/bq24103a
[2] http://focus.ti.com/docs/prod/folders/print/
bq24103a.html
An overview of the various versions of the IC
12 V AC Dimmer
Peter Jansen (The Netherlands)
R1
470 Ω
10k
LA1
4V7
0W5
D1
T2
100W
max.
12k
T1
R3
T3
TIC225
MT1
T4
G
12V
A
MT2
D2
C1
1µ
The portion of the circuit between
points A and B acts like a diac with
a trigger voltage of approximately
5.5 V. The network formed by R1,
P1 and C1 generates a phase shift
relative to the supply voltage.
The ‘diac equivalent’ circuit outputs a phaseshifted trigger pulse to the triac on each positive and negative half-cycle of the sinusoidal
AC voltage.
This works as follows. First consider the posi-
TRI1
12k
The circuit described here is
derived from a conventional
design for a simple lamp dimmer,
as you can see if you imagine a
diac connected between points A
and B. The difference between this
circuit and a normal diac circuit is
that a diac circuit won’t work at
12 V. This is the fault of the diac.
Most diacs have a trigger voltage
in the range of 30 to 40V, so they
can’t work at 12 V, which means
the dimmer also can’t work.
P1
R2
4V7
0W5
T1, T4 = BC559
T2, T3 = BC550
R4
B
27 Ω
G
MT2
MT1
C2
100n
TIC225
090370 - 11
tive half of the sine wave. C1 charges when
the voltage starts to rise, with a time constant
determined by C1, R1 and P1. T1 does not
start conducting right away. It waits until the
voltage across D2 reaches 4.7 V and the Zener
diode starts to conduct. Then current starts to flow, driving T1 and
T3 into conduction. This produces
a pulse at point B. The same principle applies to the negative half
of the sine wave, in this case with
D1, T2 and T4 as the key players.
The trigger angle can be adjusted
with P1 over a range of approximately 15 degrees to 90 degrees.
C2 provides a certain amount of
noise decoupling. Depending
on the load, the triac may need a
heat sink. You can use practically
any desired transistors; the types
indicated here are only examples. If the circuit does not dim
far enough, you can change the
value of P1 to 25 kΩ. This allows
the trigger angle to be increased
to 135 degrees.
Note: this circuit works fine with normal
transformers, but not with ‘electronic’
transformers.
(090370-I)
Simple Temperature Measurement
and Control
Jochen Brüning (Germany)
The circuit described here and its accompanying BASCOM software arose from the
need to control the temperature in a laminator. The laminator does include its own
temperature controller, but it was not suitable for the author‘s purposes (making
printed circuit boards using a thermal transfer method [1]). The result (see circuit dia-
62
gram) is based around an ATmega48 microcontroller with a 2-by-16 LCD panel and a
rotary encoder. The base-emitter junction of
an ordinary NPN power transistor in a TO220
package is used as the temperature sensor.
Although this technique is not often seen,
it is far from new: decades ago Elektor published a digital thermometer design with an
NPN transistor pressed into service as the
sensor. The approach has the advantage of
a wide linear temperature range from –50 °C
to +150 °C and the TO220 package is particularly convenient because it has a handy fixing hole and heatsink to allow good thermal
contact. Note that the heatsink is electrically
connected to the collector of the transistor,
so it may be necessary to use an insulating
washer.
The BD243C is wired as a diode by connecting
elektor - 7-8/2009
LCD1
2
1
4
3
6
5
RST
8
7
SCK
10
9
C2
C3
100n
MISO
ISP
+5V
1
+5V
23
24
R1
25
4k7
26
27
28
K2
100n
7
20
VCC
AVCC
PC6(RESET)
PCO(ADC0)
PDO(RXD)
PD1(TXD)
IC1
PD2(INT0)
PC1(ADC1)
PD3(INT1/OC2B)
PC2(ADC2)
PD4(T0/XCK)
PC3(ADC3)
PD5(T1/OC0B)
PC4(ADC4/SDA) PD6(AIN0/OC0A)
PC5(ADC5/SCL)
PD7(AIN1)
*
T1
R3
PB1(OC1A/PCINT1)
R2
PB2(SS/OC1B)
330R
*
330R
330R
R4
PB3(MOSI/OC2A)
PB4(MISO)
21
*
D3
D2
D1
PB6(XTAL1/TOSC1)
PB7(XTAL2/TOSC2)
C4
100n
BD243C
TEMP. PROBE
PB5(SCK)
AREF
The display consists of the LCD panel and
two LEDs. The upper line of the LCD shows
the measured temperature and the lower
4
5
6
7
8
9
D7
D6
D5
D4
D3
D2
D1
D0
E
R/W
RS
VO
3
10 11 12 13 14
10k
2
3
4
5
DB5
6
E
11
R/W
12
13
DB7
GND
AGND
8
22
14
ROTARY
ENCODER
15
16
17
18
19
9
DB4
10
DB6
OPTPOCOUPLER LED
its collector and base together and powered
from the 5 V rail via a 4.7 kΩ resistor. A current of approximately 1 mA therefore flows
through the diode. The voltage across the
diode has a reasonably constant negative
temperature coefficient of around –2 mV/K,
and so the plot of voltage against temperature is reasonably straight. The voltage is
measured using the ATmega48’s internal
A/D converter using input ADC5 on pin 28.
A point to note is that we can use the 1.1 V
internal reference voltage to obtain good
precision when converting the diode voltage
drop, which is around 0.6 V. Not all AVR-series
microcontrollers have the 1.1 V internal reference for the A/D converter, which should be
borne in mind if modifying the design to use
a different microcontroller.
The set point for temperature control is
entered using the rotary encoder in one
degree steps. Turn the encoder to the right to
increase the set point, to the left to decrease
it. It is possible to set upper and lower thresholds for switching. If the rotary encoder has
a pushbutton function, this can be used to
select between setting the upper and lower
thresholds; if not, a separate button must be
fitted.
2
S1
DIL28
PB0(ICP1/CLKO/PCINT0)
47u
16V
1
P1
ATmega48
C1
7-8/2009 - elektor
+5V
10uH
MOSI
VDD
L1
K1
POWER
2 x 16
+5V
VSS
+5V
line shows the current set point (upper and
lower temperature switching thresholds). P1
adjusts the contrast of the LCD.
The two LEDs show the state of the controller
at a glance. If the blue LED (D2) is lit, the temperature is too low (below the lower switching threshold); if the red LED (D1) is lit, the
temperature is too high (above the upper
switching threshold); and if both LEDs are lit
the temperature is just right (between the
lower and upper switching thresholds).
Since at least one LED is always lit there is no
need for a power indicator LED.
The output of the controller is the logic level
on pin 27 (PC4). The author used this to drive
a solid state relay (SSR) in his application
which in turn controlled the heating element
in the laminator. The circuit diagram shows
this as LED D3, which is intended to represent
the LED in the optocoupler in the SSR.
ISP connector K1 is optional and can be dispensed with if a ready-programmed microcontroller is used (see ‘Downloads and products’). It will then not be possible to calibrate
the temperature reading, as this can only
be done in the software using the ISP interface. However, for many one-off applications
it will be sufficient to determine the upper
and lower switching thresholds experimentally, including compensation for any error in
the temperature measurement.
S1 = ALPS EC11E15244BY
090204 - 11
Details of the control process can be found
by inspecting the BASCOM source code. Calibration of the temperature measurement, as
mentioned above, is done by directly modifying the software. Remove the comment
characters (‘) from lines 105 to 107 of the
program, and comment out lines 108 to 110
by adding a single inverted comma at the
start of each. The display will now show the
conversion results from the A/D converter
in the ATmega48. Immerse the sensor in a
mixture of ice and water and wait until the
reading stabilises. Note down the conversion
result (or take a number of results and average them for better accuracy). Now immerse
the sensor in boiling water and repeat the
procedure. Replace the number 546 in line
86 of the source code with the conversion
result for the ice-water mixture. Now subtract the conversion result for boiling water
from the ice-water result and divide by 100:
substitute the answer for the value 2.460 in
line 87 of the source code.
As indicated at the start, we assume in this
calibration that the conversion result versus
temperature relationship is linear. We can
write this in the form y = mx + c, where c is
the A/D conversion result at 0 °C (the intercept of the A/D conversion result axis) and
m is the (negative) slope of the base-emit-
63
ter junction voltage-temperature characteristic, calculated by dividing the difference
between the conversion results at 0 °C and
100 °C by 100. These two numbers allow you
map any conversion result into a corresponding temperature.
Internet Links
Download
[1] http://thomaspfeifer.net/direct_toner_pcb.htm
090204-11: source code files, from [2]
[2] www.elektor.com/090204
Product
090204-41: ready-programmed ATmega48
microcontroller
(090204-I)
USB Switch
Rainer Reusch (Germany)
IRFD9024
IC1.B
PC
D+
3
5
2 D–
1 +5V
2
R3
C1
14
100n
7
IC1.D
IC1.C
6
8
S2
1
D–
2
D+
3
GND 4
USB -A
11
R1
10
C2
S1
64
13
12
1n
D
1
+5V
R2
R5
1M
4
GND
R4
K2
IC1.A
1M
USB-B
USB
device
4
1M
K1
3
IC1
S
(080848-I)
T1
9
IRFD9024
The IRFD9024 MOSFET can pass a current of
up to 500 mA to the peripheral device without any problem.
10k
The circuit uses a quad analogue switch type
74HC4066. Two of the switches in the package are used to isolate the data path. The
remaining two are used in a classic bistable
flip-flop configuration which is normally built
using transistors. A power MOSFET switches
the power supply current to the USB device.
Capacitor C2 ensures that the flip flop always
powers-up in a defined state when plugged
into the USB socket (‘B’ in the diagram). The
peripheral device connected to USB socket ‘A’
will therefore always be ‘not connected’ until
pushbutton S2 is pressed. This flips the bistable, turning on both analogue gates in the
data lines and switching the MOSFET on. The
PC now recognises the USB device. Pressing
S1 disconnects the device.
The circuit does not sequence the connections as a physical USB connector does; the
power supply connection strips are slightly
longer than the two inner data carrying strips
to ensure the peripheral receives power
10k
Anyone experimenting or
deve l o p in g USB p o r te d
peripheral hardware soon
becomes irritated by the
need to disconnec t and
connect the plug in order
to re-establish communication with the PC. This process is necessary for example each time the peripheral
equipment is reset or a new
version of the firmware is
installed. As well as tiresome
it eventually leads to excessive contact wear in the USB
connector. The answer is to
build this electronic isolator
which disconnects the peripheral device at
the touch of a button. This is guaranteed to
reduce any physical wear and tear and restore
calm once again to the workplace.
before the data signals are
connected. The electronic
switch does not suffer from
the same contact problems
as the physical connector
so these measures are not
required in the circuit. The
simple circuit can quite easily be constructed on a small
square of perforated stripboard. The design uses the
74HC(T)4066 type analogue
switch, these have better
characteristics compared to
the standard 4066 device.
The USB switch is suitable
for both low-speed (1.5 MBit/
s) and full-speed (12 MBit/s)
USB ports applications but
the properties of the analogue switches and perf-board construction
will not support hi-speed (480 MBit/s) USB
operation.
D1
IC1 = 74HC4066
G
080848 - 11
elektor - 7-8/2009
mikroElektronika
COMPILERS
OK. COMPILER
Now you need a...
DEVELOPMENT TOOLS | COMPILERS | BOOKS
mikroC
mikroBasic
mikroPascal
($$#%'"- "- !$%&&)- %"- #- !%##"'%# %&- - ("%&- #- %,.'#.(&
"-!",-"'%'-'## &-!&-%# '%#"-#!$ %&-#"-#-'-&'-#&-#"
'- !%'- '#,- &&- - !%# '%#"- #!$ %&- #%- - &!( '#%- #%-%$-&$ ,&-.&!"'-&$ ,-#")%&#"-'## -
-' #- +$#%'- #%- - '%"'- "- - -$%#%!!"-!#-!"!"'-'-( '."-"-%%,-#('"&-*'-+!$ &
433& ,,2
433& ,,23
433& ,,23
43*(+!.3'-%3& ,,23
433& ,,23
43.%#,)#.3
113& ,,23
433.%#,)#.3& ,,23
43'-%3#(*,23& ,,23
43,+%&!33& ,,23
433,+%&!33& ,,23
433& ,,2
43
3& ,,23
43)!%#-.#,3*"#3& ,,23
43/'.&3#"&3,"3& ,,23
43)#&,#3& ,,23
433& ,,23
433& ,,23
434
3& ,,23
43*$.0,#33& ,,2
43*/)"3& ,,23
433& ,,23
433& ,,23
43#2+"3& ,,23
433& ,,23
433/-.*(3& ,,23
43.&'3& ,,23
4333& ,,23
433
3& ,,23
433,+%&!33& ,,23
43*,.31+)"#,3& ,,23
43*$.0,#33& ,,23
4333,+%&!33& ,,23
)"3()23(*,#
h t t p : / / w w w . m i k r o e . c o m /
S O F T W A R E
A N D
H A R D W A R E
S O L U T I O N S
F O R
E M B E D D E D
W O R L D
projects
electric vehicle
ElektorWheelie
The electronics behind
a rather special kind
of vehicle
Chris Krohne (Germany)
In this first article describing our DIY self-balancing single-axle vehicle we look at the electronics
modules. An ATmega32 processes the controls and sensor data and drives the two electric motors via
power driver stages. It keeps the vehicle balanced and can drive it in any desired direction at any
desired speed from stationary to about 11 mph.
The electronics in the ElektorWheelie
processes input signals from a control
potentiometer, an acceleration sensor and an inclination sensor. It con-
trols the magnitude and direction of
the torque applied to the wheels via
two motors using PWM signals and
MOSFET drivers. The sensors provide
Characteristics
•
•
•
•
•
•
•
•
•
•
66
Two 500 W DC drive motors
Two 12 V lead-acid AGM batteries, 9 Ah
Two fourteen-inch wheels with pneumatic tyres
H-bridge PWM motor control up to 25 A
Automatic power off on dismount
Fail-safe emergency cutout
Battery charge status indicator
Maximum speed approx. 11 mph (18 km/h)
Range approximately 5 miles (8 km)
Weight approximately 35 kg
enough information to allow the vehicle to maintain its balance over its full
range of speeds, and it can even spin
on the spot.
Sensors:
• Invensense IDG300 (or IDG500) gyroscope
• Analog Devices ADXL320 accelerometer
• Allegro ACS755SCB-100 current sensor
Microcontrollers:
• ATmega16 (motor control)
• ATtiny25 (current monitoring)
Compiler:
• BASCOM-AVR Basic compiler
elektor - 7-8/2009
A delicate balance
For the vehicle to be able to balance successfully it is essential that the sensors provide reliable information about the inclination of the platform
and its angular velocity. This is in addition, of course, to ensuring that the control system, motor drivers and motors themselves are properly
designed.
Balancing itself is relatively straightforward. If the rider leans forwards the platform tilts and the motors are driven so as to bring the whole system (vehicle plus rider) back towards balance. That means that the rider’s feet are pushed forwards under the centre of gravity of the whole system, opposing the rider’s leaning and reducing the tilt angle.
The system therefore tilts as a whole, which requires both a strong mechanical construction and a carefully designed and experimentally tested
filter function. The damping characteristic of the filter is set just short of the point where the system starts to become unstable.
Steering is performed by applying differential acceleration or braking to the two motors. Note that at higher speeds the tightness of the turning
circle has to be limited. In the ElektorWheelie the limit is set so that the rider cannot overturn the vehicle by trying to change direction suddenly.
No motor has an infinite amount of power. In the case of the ElektorWheelie there is the potential for serious consequences for the rider if a motor does not have enough power headroom to allow for balance to be maintained. For this reason the motors are normally only driven up to
approximately 70 % of their maximum power. This keeps a little in reserve so that, when top speed is reached, the wheels can be given a small
extra acceleration. This throws the rider back slightly, which automatically leads to a reduction in speed. Leaning back slows the vehicle down,
leaning forwards speeds it up.
The drive train is based on two
500 watt DC electric motors, with
power being provided by two 12 V
AGM (absorbed glass mat) lead-acid
batteries. Most of the electronics is
located on a control board, with a sensor board mounted on it.
The control system uses dynamic stabilisation. The vehicle senses the attitude of its platform in an analogous
way to the human sense of balance. If
the platform starts to tilt forwards or
backwards, the vehicle makes a proportional acceleration to oppose the
tilt using both motors. By applying
different amounts of drive to the two
motors, the vehicle can turn.
In normal operation the ATtiny25 will
also notify the ATmega32 when the
motor current exceeds a preset value
of around 25 A, which will cause the
2x 12V 9 Ah
AGM-Lead battery
emergency
stop breaker
current sensor
Block diagram
Central in the block diagram of the
attitude control and motor drive
unit shown in Figure 1 is an Atmel
ATmega32 microcontroller. This has
two PWM outputs that are used to
drive the two 24 V DC motors via a
pair of MOSFET H-bridges. A second
microcontroller, an Atmel ATtiny25 this
time, monitors the motor current using
a Hall effect sensor. If an excessive current (over 80 A) should flow because
of a short circuit in the system, the
ATtiny25 interrupts the 15 V power
supply to the H-bridge driver circuitry
using the shutdown input of its regulator. In the event of a total failure of the
control electronics the battery current
can also be interrupted using a purely
electromechanical emergency stop
device, providing the ultimate protection against the vehicle running out of
control.
7-8/2009 - elektor
controller to attempt to reduce the current by limiting the range of the PWM
control signals.
The ATmega32 receives sensor inputs
voltage regulator
5V
footswitch
battery
indicator
voltage regulator
15V
with
‘enable pin’
PWM OC1A
power H-bridge
24V DC
Motor A
PWM OC1B
power H-bridge
24V DC
Motor B
ATmega32
ADC
Invensense
gyroscope
ATtiny25
ADXL320
accelerometer
pot / handlebar
090248 - 13
Figure 1. Block diagram of the motor controller.
67
projects
electric vehicle
nector K4 and to the
three LEDs, LED1 to
LED3, that show the
VCC
14
29
34
battery status.
K2
K1
The sensor board is
AREF (3V)
IC1
32
17
connected to K2 on
VREF
CPOUT
R3
the control board. The
28
23
Y-RATE OUT
YAGC
75R
GYRO-Y
IDG-300
X-axis and Y-axis outGYRO-X
R4
3
8
X-RATE OUT
XAGC
75R
ADXL-X
puts of the sensors
ADXL-Y
are connected to A/
D conver ter inputs
2 22 25 38 39 40
C11
C12
C9
C2
C10
ADC2 to ADC5 on
+5V
1u
1u
220n 220n 100n
the ATmega32, and
pin 32 (AREF) is fed
VCC
+5V
with 3 V from the voltage regulator on the
IC3
1
5
VIN
VOUT
sensor board. The 3 V
LP2980
3
supply is also taken
ON/OFF
2
to K3 where it pro14
15
VCC
VS
VS
vides power to the
10
IC2 YOUT
steering potentiomeADXL320
12
ter. The wiper of this
XOUT
C1
C14
C15
C16
COM
ST
C4
C3
potentiometer thus
2µ2
2
3 5 6 7
100n 100n 4u7
16V
2n2
2n2
6V
provides a voltage to
090248 - 12
analogue input ADC6
on the ATmega32
that depends on the
Figure 2. Circuit diagram of the sensor board with gyroscope and accelerometer.
position of the steering control. Analogue
input ADC0 measures the battery
is important to determine the attitude
voltage via the voltage divider comof the platform as accurately as posprising R10 and R11, and ADC7 monisible at each instant in time. The outSensors and stabilisation
tors the position of the footswitch via
put of the accelerometer is therefore
The attitude sensors are mounted on
K3. The fault detection signal (CURRintegrated over a relatively long time
their own small printed circuit board
period to obtain a smoothed signal. To
FLAG) is taken to pin 16 (INT0) of the
that plugs into the main control board.
ATmega32 from the ATtiny25 current
this smoothed result is added the outFigure 2 shows the circuit of the senmonitor IC10, which in turn is conput of the gyroscope, in proportions
sor board, which includes an Invennected to current sensor IC5. IC5 is an
that have been empirically optimised.
integrated Hall effect sensor from AlleThe acceleration signal delivered to
sense IDG300 [1] two-axis gyroscope
gro Microsystems offering linear operthe motor controller is calculated as a
and an Analog Devices ADXL320 [2]
two-axis accelerometer. Voltage regpreset linear combination of the attiation up to 100 A. CURRFLAG is set
if the current reaches approximately
tude error (the difference between the
ulator IC3 provides the required 3 V
supply for the sensors; this voltage
actual inclination angle and the tar25 A and causes the motor current to
also serves as the reference voltage
be limited by bounding the range of
get inclination angle) and the angular
for the ATmega32’s A/D converter on
velocity with which the platform is tipthe PWM drive signal.
the main board.
ping. In essence, the greater the attiWe now turn to the output signals of
The output of the gyroscope is a volttude error and the greater the angular
the ATmega32. The result of processage proportional to the rate at which
velocity, the greater the motor acceling the various inputs to the microconit is turning (its angular velocity). If
eration required for stabilisation.
troller appear as the signals on the four
the platform is tipping rapidly there
outputs PWM-L, PWM-R, CW/CCW-A
will be a large and rapid swing in the
and CW/CCW-B, on pins 18 to 21. CW/
Motor control
gyroscope’s output voltage. When staCCW-A and CW/CCW-B are logically
tionary the output voltage of the gyroThe circuit diagram of the main printed
combined with the PWM outputs PWMscope is approximately half its supply
circuit board in Figure 3 contains all
L and PWM-R in IC8 and IC9 is such
voltage.
of the control circuitry of the Elektora way that they determine the direcThe accelerometer measures the comWheelie, including the power driver
tion of rotation of the motors, while the
ponent of the acceleration due to
stages. Only the attitude sensors, as
PWM signals control the current delivgravity in its own plane. If the senmentioned above, are mounted on a
ered to the motors via the H-bridges.
sor is tilted this will affect the angle
separate board.
Each motor thus has two control sigat which gravity acts relative to the
It is fairly easy to identify the comnals and a complete H-bridge driver,
device, which therefore operates as an
ponents corresponding to the variinclination sensor, delivering an outous parts of the block diagram. In the
put depending on the attitude of the
centre is the ATmega32, clocked at
platform.
16 MHz. It is directly connected to 10Figure 3. Circuit diagram of the main board,
To obtain the best possible stability it
way in-system programming (ISP) conincluding control and power electronics.
68
VDD
VDD
GND
GND
GND
GND
GND
VDD
VCC
GND
using its ADC (analogue-todigital converter) from the
gyroscope and the accelerometer on the sensor board
and from the high-reliability potentiometer that is
mechanically connected to
the steering control of the
ElektorWheelie. The ADC
inputs are sampled around
100 times per second.
As a further safety feature a footswitch is connected to an input of the
ATmega32. If this switch
is not held down (because
the rider has dismounted)
the microcontroller will
interrupt the motor current
after two seconds. This
also helps to prevent the
vehicle from running away
on its own.
The batter y voltage is
also monitored by the
ATmega32 using its ADC,
and used to drive three
LEDs that indicate the
remaining available running time to the rider.
elektor - 7-8/2009
+15V
+24V-BATT
D1
IC8, IC9 = 4001N
1N4936
C26
IC8
14
C27
1
IC9
100n
100n
7
8
VB
IC3
IR2184
100n
T5
100n
D2
T7
2x
IRF1405
R26
C33
C8
100n
4u7
100V
R24
M
4R7
MA+
R25
K5
T6
4R7
MOTOR A–
MA–
5
VCC
IN
IC8.D
≥1
13
IR2184
LO
SD
≥1
13
2x
IRF1405
11
3
IC8.A 3
≥1
IC9.D
12
6
≥1
5
2
IC8.C
8
10
≥1
9
4k7
+15V
+24V-BATT
D3
1N4936
1
5
8
VCC
VB
IN
HO
2
1u 63V
IR2184
2x
IRF1405
USHUNT
1k
ACS755-SCB
-100
IP–
4R7
6
MB+
R29
K6
T2
4R7
+5V
IC6
VCC
PB5(RESET)
PB3(ADC3)
PB4(ADC2)
PB1(MISO)
PB0(MOSI)
PB2(SCK)
C12
C10
100n
100n
47u
63V
16
17
1
4u7
100V
GND
CW/CCW-B'
21
R15
1
2
3
4
2
1 MOSI
5
4
3
6
6
5 RST
7
8
7 SCK
8
9 MISO
ISP
6k8
R7
4k7
R8
AVCC
(SCL)PC0
PD1(TXD)
(SDA)PC1
PD2(INT0)
(TCK)PC2
PD3(INT1)
(TMS)PC3
PD4(OC1B)
(TDO)PC4
PD5(OC1A)
(TDI)PC5
PD6(ICP1)
(TOSC1)PC6
PD7(OC2)
(TOSC2)PC7
IC7
PB0(XCK/T0)
(ADC0)PA0
PB1(T1)
(ADC1)PA1
PB2(INT2/AIN0)
(ADC2)PA2
PB3(OC0/AIN1)
(ADC3)PA3
PB4(SS)
(ADC4)PA4
PB5(MOSI)
(ADC5)PA5
PB6(MISO)
(ADC6)PA6
PB7(SCK)
(ADC7)PA7
ATMEGA32-PDIP
AREF
RST
GND
R9
30
VCC
PD0(RXD)
XTAL1
11
13
XTAL2
GND
12
31
X1
22
23
24
25
26
27
+5V
28
29
40
K2
UBATT
K1
39
38
ADXL-Y
37
ADXL-X
36
GYRO-X
GYRO-Y
35
34
33
C14
C20
100n
100n
32
FOOTDETECT
K3
AREF
C21
4u7
63V
100n
20
9
R6
2k2
R4
CW/CCW-A'
K4
10
R5
3
19
10k
240R
ADJ
R2
100k
MIC2941
C25
18
PWM-R
+5V
IC11
5
PWM-L
+5V
+15V
10
14
15
240R
C11
7
C15
100n
6
4
150R
15R
C28
100n
2
GND
ATTINY25PDIP
+5V
CURRFLAG
8
240R
7805
1
+5V
4k7
10k
3
SHTDWN
IC9.A 3
R12
1
OUT
3
C22
IC10
IN
2
10
≥1
9
5
10k
SD
IC9.C
8
100n
(GND)
IR2184
LO
2
C13
R16
R20
≥1
100n
R11
1
VS
2x
IRF1405
UBATT
68k
BATT–
IN
IC2
4
4R7
5
VCC
HO
6
R27
T4
8
VB
COM
100n
R10
C30
7
MOTOR B–
MB–
1N4936
5
R1
K8
4u7
100V
4R7
MOTOR B+
C24
2
2
100n
R28
M
GND
4
C5
≥1
R17
3
VOUT
R3
C36
LED3 LED2 LED1 C17
100n
C18
27p
16MHz
C19
C16
27p
100n
R14
4k7
POT
R13
4k7
IC5
(Allegro)
5
100n
D4
T3
3
IC9.B 4
VCC
IP+
(+24V)
T1
R30
4u7
100V
COM
1
4
100n
4
LO
SD
4u7
100V
6
VS
4k7
C23
C31
7
IC1
R22
+5V
C9
C29
470n
470u 63V
C2
470u 63V
C37
C4
4k7
C1
BATT+
1
11
R18
K7
2
COM
3
IC8.B 4
R19
VS
COM
12
1
IC4
4
4R7
8
VB
HO
6
R23
T8
1N4936
7
4R7
MOTOR A+
4
LO
SD
4u7
100V
6
VS
2
C34
7
HO
R21
4k7
7
5
VCC
IN
C6
4u7
100V
470n
470u 63V
+5V
14
C35
C32
4k7
C3
C7
ENABLE
090248 - 11
7-8/2009 - elektor
69
projects
electric vehicle
the two lead-acid AGM batteries in
series via current sensor IC5.
The half-bridge driver ICs receive their
own 15 V supply from the MIC2941
voltage regulator IC11. This IC has
a shutdown input (pin 2) that is connected to the ‘enable’ output signal
from the current monitoring circuit
(pin 5 on IC10). When excess current
is detected this signal shuts down the
regulator and hence also the bridge
driver ICs. The MOSFETs then block
and the motor current is interrupted.
All the other ICs are powered with 5 V
from IC6, a standard regulator.
A compact module
Figure 4. The batteries and electronics module are mounted on the underside of the metal chassis.
and each H-bridge is composed of two
half-bridge driver ICs type IR2184 and
four IRF4105 MOSFETs. The left wheel
motor is driven by IC1, IC2 and T1
to T4, while the right wheel motor is
driven by IC3, IC4 and T5 to T8.
The MOSFET bridge circuits are powered from the 24 V supply derived from
Figure 4 shows the metal chassis of
the vehicle. The electronics module
(Figure 5), comprising the main board
(Figure 6) and the sensor daughter
board (Figure 7) is mounted on the
underside of the platform.
The eight MOSFETs are positioned
in a row on the reverse of the main
board and are cooled using a speciallydesigned common heatsink. The heatsink is bolted to the printed circuit
board and the MOSFETs are held on to
the heatsink using spring clips. A selfadhesive thermally conductive sheet
between the MOSFETs and the heatsink provides electrical isolation.
The main board contains only leaded
devices, in contrast to the SMD-populated sensor board. The printed circuit
board layouts are as usual available
for free download from the project web
pages [3] as PDFs, along with associated parts lists.
Software
The firmware for the two microcontrollers was written using BASCOM-AVR.
Figure 8 gives an overview of the main
functions involved in controlling the
motors, which will be described briefly
below.
Function Init:
This function initialises and configures
Timer0, Timer1 and the PWM outputs,
initialises variables and calibrates the
gyroscope, accelerometer and steering
potentiometer.
Figure 5. The compact electronics module comprises the main board with heatsink and sensor daughter board.
70
Function Get_Angle:
This function reads values from the
analogue inputs (gyroscope, ADXL320,
potentiometer, battery voltage and
footswitch). The gyroscope, ADXL320
and battery voltage readings are integrated over a period of fifty samples.
elektor - 7-8/2009
Then the angular velocity (Angle_Rate)
and absolute angle (Tilt_angle) are
calculated.
Function Filter:
This function calculates the change
in acceleration required of the motors
(Balance_Diff) and the overall motor
speed (Drive_Speed).
Function Process:
This function uses the current speed
and the position of the steering control
to calculate the necessary modification
to the speed of the motors to turn the
vehicle as requested. It checks to see if
the ATtiny25 has reported an overcurrent condition and reduces the motor
speed (Drive_speed) if needed. The
overcurrent condition and footswitch
alarm states are indicated by the LEDs
flashing.
The function calls Get_speed_batt.
Function Init
- variable initialization
- configure Timer0 for interrupt
- configure Timer1 as PWM
- read calibration values
- activate interrupt
Main routine
Idling… everything taking place
in the interrupt routine …
Function Get_Angle
Function Interrupt
- read A/D channels
- calculate angular rate and angle
- integrate gyro value
- integrate ADXL value
Function Get_speed_batt:
This function adds a value Angle_Correction in the case where the maximum speed is exceeded. It also sets
the state of the three LEDs according
to the battery voltage.
Function Filter
Function PWM_Out:
This function configures the PWM
outputs according to the acceleration
required for motors A and B, and sets
the other outputs to reflect the desired
rotation direction.
The function also imposes a limit on the
maximum drive power (PWM_MAX).
- calculate steering movement
- calculate motor speed
- check current flag
- gosub Get_speed_batt
Function interrupt:
This function is called 100 times per
second. In turn it calls Get_Angle, Filter, Process and PWM_Out.
deactivate interrupt
gosub Get_Angle
gosub Filter
gosub Process
gosub PWM_Out
activate interrupt
- calculate balance moment
- calculate Drive_Speed
Function Process
Function Get_speed_batt
speed >
max_speed?
yes
activate angle correction
no
deactivate angle correction
display battery status
090248 - 14
Mechanics
In the second and final part of this
series we will look at the mechanics of
the ElektorWheelie. We will describe
the construction of the vehicle and outline how it is assembled and wired.
Finally we will give a few tips on how
to drive the vehicle and some further
practical suggestions.
(090248-I)
Internet links
[1] http://www.invensense.com/shared/pdf/
DS_IDG300.pdf
[2] http://www.analog.com/static/imported-files/data_sheets/ADXL320.pdf
[3] http://www.elektor.com/090248
7-8/2009 - elektor
Figure 6. Control software functions.
DISCLAIMER & CAUTIONS
• The ElektorWheelie vehicle is an Open Development. The buyer is free
to make changes and modifications to the hardware or software of the
ElektorWheelie kit, at his/her own risk.
• The use of ElektorWheelie on public roads or in public spaces may be illegal
and/or subject to legislation and type approval. No type approval has been
applied for and owners are advised to check local or national legislation for
any use other than on private land, or with the land owner’s permission.
Elektor International media BV accepts no responsibility in this respect
whatsoever.
• Under the terms of an Open Development Elektor International Media
cannot be held liable for any damages, penalties or injuries caused by, or
arising from, the use, ownership or assembly of the ElektorWheelie vehicle.
71
Load Protection for Audio Amplifiers
1
In order to be effective, any protection device connected between
an audio amplifier output and the
speakers needs to connect the
load only after a few seconds’
delay, disconnect it immediately
the mains supply is turned off,
and prevent any high-level DC
component from being able to
damage the loudspeakers. As the
circuit suggested here can readily be ‘grafted’ onto any existing
circuit, it merits the title ‘universal’. The circuit diagrams in Figures 1 and 2 relate to a prototype
fitted to an amplifier producing
50 W into 8 Ω, with a ±35 V power
supply. This circuit can be readily
adapted to other supply voltages,
and hence to other audio power
outputs. The appropriate values
for R1, R2, R8, R15, and R19, along
with the operating voltages for C1
and C3 and the choice of semiconductors D9, D10, T1, T2, and T3 are
given in Table 1.
B1
A
D1
+10V
R1
2k2
1W
1N4007
D4
+5V
5V1
470u
63V
5V1
D6
C3
100u
63V
5V1
14
C2
C5
10u
25V
100n
IC1
7
R8
IC1 = 74HCT132
C4
3k3
D5
C1
10u
25V
1W
D7
R2
D8
5V1
1k2
1W
R3
–10V
R6
1M
C6
1M
4u7
1
IC1.A
2
&
3
B R5
63V
4
680k
IC1.B
5
&
6
10
IC1.C
9
&
12
IC1.D
8 13
&
11
T1
R7
10k
BC639
D2
D3
C8
2x
1N4148
470k
C7
R4
220n
220n
RE
V rail. This circuit works by determining voltage thresholds: this means that we need to
choose an SN74HCT132 quad Schmitt NAND
gate for IC1.
3k3
68k
82k
3k3
68k
680R
CHANNEL 1
Detection of any DC component is
performed by IC2, an LM339 quad
comparator. The networks C9/R12
and C10/R16 act as low-pass filters: they attenuate the audio signal very heavily, but if any
DC voltage is present on the amplifier output,
it will be fed to IC2’s comparator inputs. If it
exceeds ± 3.75 V, at least one of the comparators will output a ‘low’ signal, and thus turn
off the corresponding relay control transistor.
The load will remain isolated as long as the
fault condition continues. This signal will also
cause current to
flow in the LEDs
D11 or D12, indicating that the
protection has
been activated.
R19
Zener diodes D13
1W
to D16 provide
RE2
D10
over-voltage
protec tion for
1N4148
the comparator
T3
inputs. It’s wise
to make sure
BC639
that R12 and R16
are indeed correctly connected
to the amplifier
AMP
outputs and not
to the relay contacts feeding the
loudspeakers.
T h e ch o i ce o f
090236 - 12
relays is not
really critical: any
CHANNEL 2
090236 - 11
Circuit operation is simple: when the amplifier is turned on, the voltage at the junction
of bridge rectifier B1 and diode D1 quickly
charges capacitor C7 via resistor R3. Capacitor Gate IC1c inverts the relay control signal and
C7 avoids mains zero crossings causing spu- feeds it to one input of IC1d, which then operrious triggering. When the upper threshold ates as an oscillator, making LED D8 flash at
voltage of IC1a is reached, its output goes low. around 4 or 5 Hz during the delay period.
At this moment,
C6 is gradually
2 +VSS(RE)
charged via R5,
and once the
RE
voltage across
it reaches the
R15
+10V
required value,
1W
R9
IC1b output goes
RE1
R14
R18
D9
high and turns
5
9
relays RE1 and
2
14
IC2.A
IC2.C
1N4148
4
8
RE2 on via tranT2
R10
R13
R17
sistors T 2 and
1k5
1k5
T3. This process
D11
D12
7
11
BC639
produces a delay
1
13
IC2.B
IC2.D
6
10
of around 5 s. In
R11
order for us to be
R12
R16
470k
470k
certain that IC1b
D13
D15
AMP +10V
output starts off
C11
C9
C10
5V1
5V1
–10V
low, the initial
100n
3
D14
D16
2u2
2u2
voltage across
IC2 IC2 = LM339
12
C12
C6 must be zero.
5V1
5V1
So this capaci100n
tor is connected
–10V
directly to the +5
72
As soon as the relay control signal goes high and the relays turn
on, the IC1d oscillator is disabled
and LED remains constantly lit. The
LED is powered directly from the
HT rail across C1, and 3.3kΩ resistor R8 limits the current through it
to 10 mA. As shown in Table 1, the
value of R8 depends on the supply
voltage and hence on the power of
the amplifier to which the protection circuit is to be connected.
As soon as the mains is turned off,
IC1a output goes high and capacitor C6 discharges rapidly through
D2, which then causes IC1b output to go low and the relays RE1
and RE2 to turn off almost immediately. So the amplifier load is
isolated instantly and the circuit
re-armed so as to produce the
required delay next time mains
power is applied.
+VSS (RE)
680R
Joseph Kreutz (Germany)
elektor - 7-8/2009
Table 1. Stereo (2-channel) amplifier
Supply voltage [V]
27
35
47
56
64
70
76
Power into 4 Ω [W]
50
100
200
300
400
500
600
Power into 8 Ω [W]
25
50
100
150
200
250
300
Working voltage for C1 (470 μF) & C3 (100 μF) [V]
40
63
63
80
80
100
100
Value for R1
1k8, 0,25 W
2k2, 1 W
3k3, 1 W
4k7, 1 W
4k7, 1 W
5k6, 1 W
5k6, 1 W
Value for R2
820 Ω, 1 W
1k2, 1 W
1k8, 1 W
2k2, 2 W
2k7, 2 W
2k7, 2 W
3k3, 2 W
Value for R3
2k7, 0,25 W
3k3, 1 W
4k7, 1 W
5k6, 1 W
6k8, 1 W
8k2, 1 W
8k2, 1 W
Value for R15 & R19 (*)
-
680 Ω, 1 W
1k2, 1 W
1k8, 1 W
2k2, 1 W
2k7, 2 W
2k7, 2 W
D9 et D10
1N4148
1N4148
1N4148
1N4148
1N4148
BAV21
BAV21
T1, T2, T3
BC639
BC639
BC639
BC639
BC639
2N5551
2N5551
* for 24 V relays drawing a current in the region of 15 mA.
type that has a high enough breaking capacity, works from 24 V, and
only needs around 15–25 mA to
drive it will do. The relays fitted
to the prototype are RT 314024
ones made by the Austrian company Schrack [1]. They can switch
16 A, which is enough for amplifiers with pretty reasonable powers. The prototype is fitted to a
50 W per channel stereo amplifier, whose 35 V supply voltage is
higher than the relays’ rated operating voltage. So it was necessary
to fit series resistors R15 and R19 in
order to drop the excess 11 V. As
the relay coil resistance is 1,450 Ω,
these series resistors need to be
680 Ω and rated for a dissipation of
1 W. Naturally, the value of R15 and
R19 depends on the type of relay
chosen and the amplifier’s supply
voltage, as shown in Table 1. However, the value isn’t critical, as the
relays are pretty tolerant about
their operating voltage. Besides,
it’s easy enough to find out the
resistance of a relay coil: just measure it with an ohmmeter!
for the circuit directly from the
amplifier’s power transformer
terminals, before the rectifier and
smoothing capacitors, as shown
in the connection diagram in Figure 3. This voltage is rectified by
bridge rectifier B1 and applied via
D1 to the 470 µF smoothing capacitor C1. The power for the relays
and LED D8 is taken from directly
across this capacitor. Diode D1
allows capacitor C1 to be isolated as soon as the mains power
goes off: so when the amplifier is
turned off, there is zero voltage
at IC1a input , and the relays are
guaranteed to be off. The +10 V
and +5 V rails are regulated by
zeners D4 and D5, while D6 and
D7 stabilize the −10 V rail feeding
IC2. Using two zeners in series limits the power each of them has to
dissipate.
3
AMP
PROT
RE1
R12
RE2
R16
V-
0V
V+
0V
TR
B
230V
(120V
)
C
It is perfectly simple to extend the
circuit for 5+1 or 7+1 channel audio
systems, as used on an increasing
number of computers. And it’s
all the more advisable because
the sound cards often produce
erratic signals when the computer
F
C
090236 - 13
It’s essential to pick up the power
Table 2. System with 5+1 or 7+1 channels
Supply voltage [V]
27
35
47
56
64
70
76
Power into 4 Ω [W]
50
100
200
300
400
500
600
Power into 8 Ω [W]
25
50
100
150
200
250
300
Working voltage for C1 (2200 µF) & C3 (470 µF) [V]
40
63
63
80
80
100
100
Value for R1
820 Ω, 1 W
1k2, 1 W
1k8, 1 W
2k2, 2 W
2k7, 2 W
2k7, 2 W
3k3, 2 W
Value for R2
270 Ω, 2 W
390 Ω, 2 W
560 Ω, 5 W
680 Ω, 5 W
820 Ω, 5 W
820 Ω, 10 W
1k, 10 W
Value for R3
2k7, 1 W
3k3, 1 W
4k7, 1 W
5k6, 1 W
6k8, 1 W
8k2, 2 W
8k2, 2 W
Value for R15 et R19 (*)
-
680 Ω, 1 W
1k2, 1 W
1k8, 1 W
2k2, 1 W
2k7, 2 W
2k7, 2 W
D4 - D7
BZV85C5V1 or 5V1 device capable of dissipating 1 W
D9 & D10
1N4148
1N4148
1N4148
1N4148
1N4148
BAV21
BAV21
T1, T2, T3
BC639
BC639
BC639
BC639
BC639
2N5551
2N5551
* for 24 V relays drawing a current in the region of 15 mA.
7-8/2009 - elektor
73
is powered up or down, which when amplified can be at best unpleasant, and at worst,
damaging for the loudspeakers.
4
tem. Refer to Table 2 for the component values for a protection circuit for a 5+1 or 7+1
channel system. The modifications mainly
affect the following points:
- The values of R1 and R2 are reduced, but
their dissipation increased, as shown in Table
2;
- C1 and C3 are also increased to 2,200 µF and
470 µF respectively;
- Zener diodes D4 to D7 change to type
BZV85C5V1 or equivalent, capable of dissipating 1 W.
A
1M
R3
C7
R4
470k
As shown in Figure 4, the +5 V supply rail
present on the computer’s USB bus is applied
to one of the inputs of gate IC1a, the other
input being used to check the presence of the
amplifier supply voltage. So both the computer and the amplifier have to be running for
the speakers to be connected after a 5-second delay. The 100 nF capacitor C13 avoids
unwanted triggering. Turning off the computer or the amplifier disconnects the speakers
immediately.
220n
1
2
IC1.A
&
3
B
R20
1
+5V
2
D–
47k
C13
3
D+
4
GND
R21
(090236-I)
470k
K1
100n
USB
The Figure 1 delay circuit, modified as per
the circuit in Figure 4, is common to all channels, and provides the relay control signal for
them all. But the DC component switching
and protection unit shown in Figure 2 has
Internet Link
090236 - 14
[1] www.schrack.com
to be repeated 3 or 4 times, so as to be able
to control the number of channels in the sys-
Impact Clock
G. van Zeijts (The Netherlands)
The read/write heads of a hard-disk
drive are moved back and forth over
the magnetic platters by a linear
motor. This motor consists of a coil
that moves in a strong magnetic field,
combined with some sophisticated
electronics that drives it such that
the read/write heads are quickly positioned to the desired location.
1
+12V
L1
K1
*
*
2
2mA0
R1
As the head motor has a fairly long
stroke and can supply considerable
force, we used it in this project to build
a special sort of clock.
If you simply apply a DC voltage to
the coil, the arm jumps from one end
to the other one with a bang. If you
reverse the polarity of the voltage, the
arm moves in the opposite direction.
The voltage applied to the coil can be
controlled by a PC with the aid of a
Darlington circuit (Figure 1). We used
one of the pins of the Centronics port
on the computer (K1 in the schematic
drawing) to drive the circuit. Here the
control signal is provided by pin 2 of
the Centronics connector, which corresponds to bit 0 of port H378. Pin 19
74
E
T1
C
B
2k2
TIP47
TIP47
T2
2N3055
4k7
R2
By now enough hard-disk drives have
crashed that every hobbyist should
have no trouble getting his or her
hands on one and using it for other
purposes.
(ground) is tied to the ground line
of the control circuit. Use a hefty AC
mains adapter for the power supply; it
must be able to deliver at least 2 A.
2N3055
19 GND
090121 - 11
B
E
C
The mechanical design of the clock is
rather unusual. It consists of a length
of curtain rail arranged at an oblique
angle, along which a steel ball from a
ball bearing can be propelled upward
and roll back down under its own
weight. If the ball is struck by a blow
whose strength depends on the time
of day, it will travel for a certain distance along the curtain rail. By observing the motion of the ball, you can
read the time (approximately) from an
hours scale marked along the length
of the rail. The previously mentioned
head motor from a discarded hard disk
drive is used to generate the impact
on the ball. The ball rests against the
arm of the motor when it is at its lowest point on the rail. The computer
calculates the force of the impact and
drives the motor for a certain length
of time.
The program for the clock is written in Visual Basic and has a simple
design. The software is extensively
documented.
Now for some practical details on the
clock:
elektor - 7-8/2009
- Rail length approx. 160 cm
- Height difference (top/bottom) approx.
10 cm
- Ball diameter 17 mm
- Head motor coil resistance 5–15 Ω (depending on hard-disk model)
- Coil voltage 5–12 V (depending on coil
resistance)
The hours scale on the rail must be determined experimentally after first adjusting
the impact for 12 o’clock so the ball nearly
reaches the highest point of the rail.
(090121-I)
Download
090121-11: Visual Basic program, from www.elektor.
com/090121
Lead Acid Battery Protector
Jürgen Stannieder (Germany)
The relay used in the prototype is a 5 V bistable type made by Omron (G6AK-234P-ST-US
5 VDC). The two windings of the relay each
have a resistance of 139 Ω (for the RAL-D 5
W-K made by Fujitsu this is 167 Ω). When the
battery voltage starts to become too low and
the relay is being reset the current consumption of the circuit is about 45 mA. Shortly
after the load has been disconnected, when
R4
1N4148 R1
3k3
1
3
2k5
R2
5
P1
2
12V
D3
IC1
7
BT1
10k
100k
R3
CA3140
6
RE1
12V
4
The battery voltage is first reduced via D1, R1,
P1 and R2, and then continuously compared
with a reference voltage set up by diode D2.
When the battery discharges too much and
its terminal voltage drops below the level
set by P1, the output of the opamp becomes
High, which causes the relay to toggle. This
in turn isolates the load from the battery. The
battery can be reconnected via S1 once the
battery has been replaced or recharged.
S1
D1
100k
The circuit described here can be used to
ensure that a 12 V sealed lead acid (SLA)
gel battery isn’t discharged too deeply. The
principal part of the circuit is a bistable relay,
which is driven by the output of an op amp.
C1
D2
1u
63V
0W5
R
S
K1
5V6
080583 - 11
the battery voltage rises above the reference
voltage again, the reset coil will no longer be
powered and the current consumption drops
back to about 2.5 mA.
The range of P1 has intentionally been kept
small. With a reference voltage of 5.6 V (D2)
and a voltage drop of 0.64 V across D1, the circuit reacts within a voltage span of 11.5 V and
11.8 V. This range is obviously dependent on
the zener diode used and the tolerance.
For a greater span you can use a larger value
for P1 without any problems. With the potentiometer at its mid setting the circuit switches
at about 11.6 V.
(080583-I)
Automatic Curtain Opener
Ton Smits (The Netherlands)
This circuit can be used with a timer clock to
open and close curtains or (vertical) Venetian blinds. The curtain or blind is driven by
an electric motor with a reduction gearbox
fitted to the control mechanism of the curtain or blind. This circuit is ideal for giving
your home an occupied appearance while
you are away on holiday or for some other
reason. In the author’s house, this arrangement has provided several years of troublefree service on a number of windows fitted
with Venetian blinds.
The original design was a simple relay circuit
with pushbuttons for opening and closing
7-8/2009 - elektor
and reed switches acting as limit switches.
The mechanical drive is provided by a small
DC motor with a reduction gearbox and pulley (all from Conrad Electronics).
It was later modified to work automatically
with a timer clock. The timer operates a small
230-VAC (or 120-VAC) relay with a changeover contact. Thanks to the two timers, the
motor stops after a few seconds if one of the
reed switches is missed due to a mechanical
defect.
The circuit works as follows (see Figure 1).
In the quiescent state, relays RE1–RE3 are deenergised and the motor is stopped.
Open the blind:
When the timer clock applies power to the
230-V (120-V) relay RE3, the voltage at the
junction of C1 and R1 goes high. IC1 (a 555)
then receives a trigger pulse on pin 2, which
causes its output (pin 3) to go High and energise RE1, which in turn causes the motor to
start running. When the magnet reaches reed
switch S1 (‘Open’), the 555 is reset. If the reed
switch does not operate for some reason,
the relay is de-energised anyhow when the
monostable times out (time delay = 1.1 RC;
approximately 5 seconds).
Close the blind:
The timer clock removes power from RE3,
which causes a trigger pulse to be applied to
75
the other 555 timer (IC2) via R5 and C4. Now
the motor starts running in the other direction. The rest of the operation is the same as
described above for opening the blind.
Diodes D2 and D5 prevent the outputs of the
555 ICs from being pulled negative when the
relay is de-energised, which could otherwise
cause the timer ICs to malfunction.
D1
R3
1M
8
6
C1
2
THR
DIS
OUT
3
D2
555
TR
100n
D3
CV
OPEN
1
C2
4µ7
230V
RE1
5
C3
100n
RE3
+12V
R7
R8
10k
D4
1M
R6
4k7
R5
CLOSED
8
6
M1
C4
2
S2
CLOSED
4
THR
DIS
OUT
D5
555
CV
4µ7
3
TR
100n
C5
M
R
IC2
7
[1] www.elektor.com/090150
[2] www1.conrad-uk.com
S1
OPEN
4
R
IC1
7
(090150-I)
Internet Links
R4
10k
R2
4k7
10k
R1
10k
All components of the mechanical drive
come from Conrad Electronics [2]: a motor
with a reduction gearbox (type RB32, order
number 221936) and a pulley (V-belt pulley,
order number 238341) on the output shaft.
An O-ring is fitted to the pulley to provide
sufficient friction with the drive chain of the
Venetian blind. The magnet for actuating the
reed switches is a rod magnet with a hole in
the middle (order number 503659), and the
chain of the Venetian blind is fed through
this hole.
+12V
1
D6
RE2
5
C6
100n
090150 - 11
Stress-o-Meter
Markus Bindhammer (Germany)
The common meaning of the term ‘stress’
is distinctly different from what specialists
understand by the term, and even they disagree with each other. The Wikipedia entry for
this term [1] gives an impression of its complexity. Consequently, it’s a good question
whether it is even possible to measure stress.
However, it is certainly possible to measure
how our bodies respond to stress.
No matter whether something is especially
pleasant or instead triggers anxiety or aggression, if there is a strong stimulus, our bodies
are prepared to act accordingly. Jumping
for joy, fleeing, and attacking all cost a lot of
energy. One the many consequences is thus
an increase in the heart rate, which is probably the most easily measured response to
stress.
The resting heart rate of a healthy person is
around 50 to 100 beats per minute (bpm). A
person’s pulse can be measured either electrically with an ECG instrument or by sensing
the periodic variation in blood flow through
the body tissue. The first method requires
electrical contact between electrodes and
the skin, which is not especially advisable for
76
DIY electronics. By contrast, the variation in
blood flow can easily be sensed using light
transmission, since the absorption of the
transmitted light depends on the blood flow.
Ear lobes and fingertips are especially suitable for light transmission measurements.
The author converted an ordinary plastic clothespin into a finger or ear clip. To do
so, he first drilled a 5-mm hole in each arm
of the clip and then glued an IR LED (type
SFH487) in one hole and a phototransistor
(type SFH309FA) in the other hole (see draw-
ing). A bright red LED or even a white LED can
be used in place of the IR LED. It’s even possible to use an LDR as the photosensor. Readymade clips are also available commercially as
medical accessories (expensive) or accessories for ergometers and similar sports equipment (inexpensive).
With a 5-V supply, the current through the IR
LED is around 30 mA. The sensor signal (with
its small voltage variations) passes through a
high-pass filter (C1/R3), which removes slow
drift, to the non-inverting input of opamp
elektor - 7-8/2009
Internet Link
D1
SFH487
+5V
R2
39k
C2
R5
100n
R7
1M
3
IC1 = LM358N
1
IC1.A
T2
R9
7
2k2
BC547
R4
R6
P1
10k
R8
1k
68k
R3
68k
SFH487
5
IC1.B
1µ
8k2
T1
D2
6
C3
1µ
D1
100n
560k
2
C1
R10
C4
220 Ω
R1
SFH309FA
+5V
R12
8
D3
C5
8
4
D4
IC2
OUT
2k2
4
R
THR
3
IC1
100n
R11
250k
220 Ω
R13
DIS
NE555
TR
6
7
2
T3
CV
R14
220 Ω
(080831-I)
T1
SFH309FA
120 Ω
IC1a. The combination of C2 and R5 forms
a low-pass filter that decouples high-frequency noise. IC1a amplifies the signal in the
passband, which is centred at 100 bpm, by a
factor of 100. A similar combination of filter
and amplifier is built around IC1b, in this case
with a gain of 500. The LM348 dual opamp is
especially suitable for this circuit because it
can handle small-signal inputs close to 0 V,
even when powered from a single-ended
supply. The overall gain of the two stages can
be adjusted with P1. The output of IC1b drives
T2 and T3 in parallel, so D2 blinks at the same
rate as the variation in blood flow through
the ear or finger between D1 and T1.
The ‘excess rate’, or stress, is indicated by
IC2, a conventional 555 timer IC. Transistor
T3 shorts out capacitor C6 when D2 is on.
This resets the internal flip-flop of the 555
and causes pin 3 to go High, which in turn
causes D4 to light up. When D2 is off, C6 can
charge via R12. If the charging interval is long
enough for the voltage on C6 to rise to twothirds of the supply voltage, the output of
the 555 changes state, LED D4 goes dark, and
D3 flashes briefly. This means that the user’s
pulse rate is low as long as D3 blinks periodically. C6 and R12 are dimensioned such
that D3 remains dark at heart rates above
100 bpm.
For safety reasons, an AC mains adaptor
should not be used as the power source. The
circuit works properly with a supply voltage
of 4.5 to 7 V, so a set of four alkaline, NiCd or
NiMH cells forms a perfectly adequate power
source.
[1] http://en.wikipedia.org/wiki/Stress
1
5
C7
C6
10n
2µ2
BC547
080831 - 11
Powering a Second Hard Drive
Leo Szumylowycz (Germany)
Just about every hands-on computer builder
knows the problem: you’ve acquired an extra
hard drive or cooling fan but there are no
spare cables or connectors to power these
additional components inside the computer
case. In situations like this splitter cables, also
called Y-cables, can be a blessing. But what if
you don’t have one of these to hand and the
local computer shop is closed? There’s only
one thing for it — DIY! As tasks go, splicing
in an extra cable is not particularly difficult, as
long as you have sharp eyesight. All you need
is a second power cable and a choc block ter-
7-8/2009 - elektor
minal strip and the job’s done. It works adequately (for a while) but it doesn’t look particularly attractive, reliable or professional.
A more elegant solution would be to solder the new power cable direct to the corresponding connector of the existing device.
Elegant, yes, but not particularly straightforward, since the power supply rails are seldom
easy to get at, whilst the metal pins of individual power connectors are of course buried
inside their plastic shell.
A little trick involving the sleeves that go on
the ends of wires will enable you to extract
the pins as far out of the retaining mount as
needed to solder onto the rear of these pins
additional wires for the accessory device you
wish to install.
We need two types of sleeves, 4 mm (0.16”) for
the plugs and 6 mm (0.24”) for the sockets.
First of all the contact on the cable is pressed
hard into the plastic retainer to ensure the
restraint spring grips cleanly and fully.
Next we attach wire sleeves to the pin that
we are extracting and push it carefully and
slowly into the plastic retainer as far as the
latch and end stop. Just before this point is
reached you will feel some resistance, with
77
a click sound heard after you have overcome
the pressure. Exactly as this click is heard you
need to remove the wire in question, with its
pin, from behind out of the plastic housing.
If this doesn’t work exactly as desired, it can
help to twist the sleeve around while you are
pulling.
Normally you can release about four pins using
one sleeve. For assured reliability, however, it is
recommended to use several sleeves.
The free ends of the additional cable should
be soldered (using great care and as little solder as possible, as shown in the photo) to corresponding pins close up against the existing cable. Any unwanted solder blobs are
best removed with desoldering braid (sol-
der wick). Finally we need to bend the contact springs gently outwards and press each
pin back into its right position. You will find
the longer sizes of sleeve are easier to handle, also that the individual parts of the connectors move around more easily if you spray
them first with contact lubricant.
(090201-I)
Two-button Digital Lock
Francis Perrenoud (Thailand)
Now here’s a digital lock unlike any other, as
it has only two buttons instead of the usual
numeric keypad. The way it works is as simple
as its keypad. Button S1 is used to enter the
digits of the secret code in a pulsed fashion
— i.e. the number of times you press the button is determined by the digit to be entered.
A dial telephone uses the same type of coding (now maybe there’s an idea?). Press four
times for a 4, nine times for a 9, etc. Pressing button S2 indicates the end of a digit.
For example, to enter the code 4105, press
S1 four times, then press S2, then S1 once, S2
once, then without pressing S1 at all, press S2
again, then finally S1 five times and S2 once
to finish. If the code is correct, the green LED
D1 lights for 2 seconds and the relay is energised for 2 seconds. If the code is wrong, the
red LED D2 lights for 2 seconds, and the relay
is not energised.
To change the code, fit a jumper to J1 and
enter the current code. When the green LED
D1 has flashed twice, enter the new 4-digit
code. D1 will flash three times and you will
need to confirm the new code. If this confirmation is correct, D1 will flash four times.
If the red LED D2 flashes four times, something’s wrong and you’ll need to start all over
again. To finish the operation, remove the
jumper and turn the power off and on again
— the digital lock is now ready for use with
the new code.
The software can be found on the webpage
for the project [1]. Don’t forget to erase the
microcontroller’s EEPROM memory before
programming it, so you can be sure that
the default code is 1234 and not something unknown that was left behind in the
EEPROM.
A little exercise for our readers: convert this
project into a single-button digital lock — for
example, by using a long press on S1 instead
of pressing S2 to detect the end of a digit.
(090127-I)
Internet Link
[1] www.elektor.com/090127
Download
090127-11: Source codes and Hex file, from www.elektor.com/090127
470R
R1
20
5
4
1
K2
D1
PA0
PA1
IC1
PA2
PB7
PB6
19
18
ATTiny2313 PB5 17
2
PD0
/V
16
PB4
+5V
C1
C2
GND
10u
100n
3
6
7
8
9
S1
S2
J1
11
PD1
PD2
PD3
PB3
DIL20
PB2
PB1
PD4
PB0
PD5
PD6
D2
6
RE1
K1
7
8
1
14
15
14
13
12
2
READ DIL 5V/1A
10
090127 - 11
78
elektor - 7-8/2009
ElektorWheelie
Elektor’s DIY self-balancing vehicle
ember 2009
Order before 1 Sept
UNT!
and get £85 DISCO
50
(s 100 / US $1 )
Everyone agrees; the internal combustion engine is coming to the end of
its life cycle. However you don’t need
to go to the expense of a Prius or Tesla to experience
the future of transportation devices. If you would prefer
something more personal (and don’t mind turning
a few heads) why not build the astonishing ElektorWheelie?
First take two electric motors, two rechargeable batteries
and two sensors, now add two microcontrollers and the ElektorWheelie
is ready to transport you in style
to your destination.
Actual product may
differ from illustration.
Characteristics
• Two 500 W DC drive motors
• Two 12 V lead-acid AGM batteries, 9 Ah
• Two fourteen-inch wheels with pneumatic
tyres
• H-bridge PWM motor control up to 25 A
• Automatic power off on dismount
• Maximum speed approx. 11 mph (18 km/h)
• Range approximately 5 miles (8 km)
• Weight approximately 35 kg
The kit comprises two 500-watt DC drive
motors, two 12-V lead-acid AGM batteries,
two 14-inch ABS wheels, casing, control lever
and assembled and tested control board with
sensor board fitted on top.
Art.# 090248-71 • £1380 • € 1599 • US $2275*
(reduced price till 1 September 2009: £1295 • € 1499 • US $2125)*
* Incl. VAT, excl. shipping costs.
Elektor
Regus Brentford
1000 Great West Road
Brentford TW8 9HH
United Kingdom
Tel. +44 20 8261 4509
Further information and ordering at www.elektor.com/wheelie
7-8/2009 - elektor
79
Wireless Baby Monitor
Wolfgang Papke (Germany)
Ton Giesberts (Elektor Labs)
Walkie-talkies (also known as handheld or
PMR, Personal Mobile Radio) can be bought
at low prices even from department stores,
and they can be operated without a licence
in many countries. Considering the low cost,
such a set would be very suitable for use as
a wireless baby monitor, with the addition
of several external components. These are
connected to the jack sockets for an external
loudspeaker/microphone and an external PTT
(Push-To-Talk) switch, which are often found
on these devices.
80
that can be obtained from Conrad Electronics (PMR Pocket Comm Active Pair, order
number 930444). These walkie-talkies have
separate jack sockets for the LS/Mic and PTT
connections.
When there is a call a series of tones is produced that is used to turn on T1 via R3. T1
then activates the PTT function and the
microphone amplifier is turned on. However, it’s not just the audio signal that is
used, but also the DC offset produced when
the internal output stage is turned on. Both
the internal as well as external loudspeaker
are driven via an output capacitor of 100 µF.
When there is a call it charges up via R3 and
the base-emitter junction of T1. If the walkietalkie is called often there would be a danger that the output capacitor would remain
charged and the DC offset of the audio signal would no longer be sufficient to turn on
T1. To prevent this, D1 is connected in reverse
across the base-emitter junction of T1, providing a discharge path for the output capacitor. To keep the circuit active for a minimum
amount of time the microphone voltage is
used to provide an extra base current. This is
done by charging C1 via R1. When the transmitter is turned off the microphone and R2/
1
*
2.5mm
D1
R8
*
4k7
1N914
C2
10n
470µ
R4
*
ext.
MIC1
900 Ω
C3
91k
C1
1k
R3
150µ
R5
T2
43k
4k7
R1
2N3906
T1
R7
T3
56k
2N3904
R6
2N3904
56k
R2
82k
The walkie-talkie with the extra electronics
and microphone is placed in the baby’s room.
When the PTT switch on the other walkietalkie is actuated for about a second the ‘baby’
walkie-talkie produces a series of tones, which
the external electronics can detect. This then
activates its own PTT switch for about 5 seconds, so it switches over to transmit. During
this time the other device can hear what the
external microphone picks up.
Figure 1 shows the circuit that the author
designed for this. It has been designed specifically for a Tevion 3000 PMR sold some time
ago by Aldi. This type of PMR has a combined
jack socket that includes all the required
connections.
The voltage present on the PTT connector is
used to generate the supply voltage for the
circuit via R3, D1 and C1/C2. When the loudspeaker output presents a series of tones
(when the PTT switch on the other walkietalkie is held down), it causes T1 to conduct.
This also turns on T2 and T3, so that the external microphone is connected to ground. The
resulting current that flows through the
microphone should be sufficient to activate
the PTT circuit in the walkie-talkie, causing
it to transmit. If the external microphone
doesn’t draw sufficient current, a resistor
(R8) should be connected in parallel. Some
experimentation with the value of this resistor may be required. If you want to make use
of the internal microphone then R8 should be
replaced with a wire link.
When the walkie-talkie switches to transmit the built-in amplifier stops producing a
signal and T1 turns off. However, since electrolytic capacitor C3 has been charged up in
the mean time, transistors T2 and T3 will keep
conducting for several seconds until C3 has
been almost discharged via R4.
In the Elektor labs a simpler version with
the same functionality (Figure 2) has been
designed for use with a cheaper PMR set
080701 - 11
elektor - 7-8/2009
2
K1
K1'
MIC/LSP
C1
2.5mm
MIC2
100µ
25V
100k
R1
R3
10k
K2
When the circuit is used as a baby monitor
you should check that the microphone you’re
using can pick up all the sounds. In our case
the microphone didn’t appear to be very sensitive. The microphone amplifier has probably been designed for a voice that is near the
PMR unit. When used as a baby monitor the
microphone should therefore be positioned
as close to the baby as possible.
K2'
R4
1k
PTT
3.5mm
T1
R2
BC547B
1M
D1 provide a discharge path for the capacitor. C2 ensures that the circuit won’t react to
spikes caused by interference. As can be seen
from the second circuit diagram, use is made
of two connectors, a 2.5 mm jack plug for an
external headset and a 3.5 mm plug for the
PTT function. These connectors are particular to the walkie-talkies we used here. With
other types of walkie-talkie you should first
check the connection details of the connectors before you connect the circuit up.
C2
1n
D1
BAT85
080701 - 12
(080701-I)
Network RS232
Marcos Agra-Trillo (United Kingdom)
start and stop bits with no flow
control. When idle, all the modules are listening for commands
from the master and have their
transmitters disabled. Each module is configured with an identifier consisting of a number that
the master sends as a single line
(e.g. ‘2/n’ selects module 2). If a
module receives an identifier that
matches its own, it is selected and
can decode commands and drive
its transmitter for the duration of
the reply. Conversely, if the identifier does not match it must not
decode commands and ensure its
transmitter remains disabled.
+5V
22k
With an ever increasing number
of off the shelf electronic modC1
ules and boards available at low
prices, designers are inclined to
100n
use these instead of making all
15
VCC
their electronics from scratch.
12
10
FORCEON
INVALID
In many cases this makes sense
2
C1+
C2
3
as developing say, a PID motor
V+
IC1
4
C4
J1
100n
C1controller or a GPS receiver from
5
C2+
1
C3
scratch requires considerable skill,
100n
ICL3221
7
V6
time and effort. A surprising num6
100n
C22
SERIAL_TX
11
13
ber of modules still have an interT1IN
T1OUT
7
SERIAL_RX
9
8
R1OUT
R1IN
face based on RS232. No wonder,
3
1
16
EN
FORCEOFF
8
as RS232 is easy implemented on
GND
4
a microcontroller with two I/O
14
9
SERIAL_TX_ENABLE
pins and a line driver such as the
5
R1
MAX232. In the case where the
In addition to some firmware supmaster is a PC, the serial port is
port, the RS232 driver electronics
SUB D9
relatively easy to access on both
must be able to tri-state the transWindows and Linux. Usually modmitter while keeping the receiver
090326 - 11
ules implement a text terminal
operational. Sadly, the classic
interface that decodes single line
MAX232 driver is unsuitable but
commands with arguments and generate a ber of RS232 modules in a project, as each the ICL3321 and MAX242 are possible canrequires a serial interface at the master. A didates for our purpose. These have lowreply like this:
hardware solution in the form of an RS232 power shutdown modes that power-down
Tx: cmd arg0 arg1 ... argX/n
multiplexer would be a solution but wouldn’t the charge pump and transmitters but keep
Rx: cmd arg0 arg1 ... argX/n
it be nice to get this functionality for free!
the receivers enabled for monitoring RS232
replyline0/n
By deviating from the original aim of RS232 as activity.
replyline1/n
a point-to-point link, we can have an RS232 The number of modules in your RS232 net…
replylineY/n
network in which all the modules share both work is limited by the (nominal) 5 kΩ pulltransmit and receive lines to one master inter- down at the receiver input of the line driver
A complication occurs when there are a num- face. All modules operate at the same speed, device. Multiple modules increase the loading
7-8/2009 - elektor
81
on this signal, reducing the maximum operating speed and cable length. Using the circuit
shown here, running an application with five
modules at 9,600 bps located within 1 meter
of each other did not present any problem.
Modules need a means of enabling the network mode and setting the unique identifier.
This can be done via switches, jumpers or, if I/
O pins are scarce, by storing the configuration
in the user EEPROM/Flash provided by many
microcontrollers. If the latter is done, it is reasonable to assume the module will only be
configured with normal RS232. Special configuration commands can then be provided
that are always decoded irrespective of the
identifier match.
It is unlikely that commercially available mod-
ules can be tweaked to support ‘network’
RS232 unless the vendor has used a suitable
RS232 line driver and is prepared to provide
the firmware code. However, it is possible
to implement on DYI modules and perhaps
module designers can take note and enhance
the functionality of their future designs.
(090326-I)
Simple Wire Link Bender
Louter van der Kolk (The Netherlands)
When you want to mount components on a
PCB or a piece of prototyping board, you not
only want to do this quickly, but also tidily.
The bending of really tidy wire links with the
correct pitch is often a tedious chore. The following is a handy aid for doing this.
Using a small piece of 0.1 inch (2.54 mm) prototyping board, you can very easily make a
handy bending jig for wire links. With a jigsaw, cut the piece of prototyping board into
a staircase shape as shown in the drawing.
You can make it as big as you need. Make
sure that the horizontal cuts are slightly
towards the outside with respect to the
holes, so that clear indentations remain in
the horizontal sections.
Bending a wire link is now very easy: choose
the desired pitch on the jig (dashed line), take
0.1‫״‬
0.2‫״‬
0.3‫״‬
0.4‫״‬
090369 - 11
a piece of wire and fold it sharply around the
indentations corresponding to the selected
pitch. A neat wire link is the result, with
exactly the right pitch and ready for soldering tightly into the PCB or prototyping board.
With close-fitting wire links the board looks
much better and they are also mounted much
more quickly.
Tof course he bender is also suitable for resistors with leads.
(090369-I)
Single-cell Power Supply
Harald Broghammer (Germany)
Many modern electronic devices and microcontroller-based circuits need a 5 V or 3.3 V
power supply. It is important that these
voltages are constant and so a regulator of
some kind is essential, including in batterypowered devices. The simplest approach is
to select a (perhaps rechargeable) battery
whose voltage is rather higher than that
required by the circuit and use an ordinary
linear voltage regulator. Unfortunately this
solution is rather wasteful of precious energy
and space: for a 5 V circuit at least six NiCd or
NiMH cells would be required.
Both these disadvantages can be tackled
using a little modern electronics. A good way
to minimise energy losses is to use a switch-
82
Characteristics
• Input voltage from 0.7 V to 5 V
• Output voltage from 2.5 V to 5.5 V
• Maximum output current 2 A
• Can run from a single cell
ing regulator, and if we use a regulator with
a step-up topology then we can simultaneously reduce the number of cells needed to
power the circuit. Fortunately it is not too difficult to design a step-up converter suitable
for use in portable equipment as the semiconductor manufacturers make a wide range
of devices aimed at exactly this kind of application. The Maxim MAX1708 is one example. It is capable of accepting an input voltage anywhere in the range from 0.7 V to 5 V,
and with the help of just five external capacitors, one resistor, a diode and a coil, can generate a fixed output voltage of 3.3 V or 5 V.
With two extra resistors the output voltage
can be set to any desired value between 2.5 V
and 5.5 V.
The technical details of this integrated circuit can be found on the manufacturer’s
website [1], and the full datasheet is available for download. An important feature of
the device is that it includes an internal reference and integrated power switching MOSFET, capable of handling currents of up to 5 A.
It is, for example, possible to convert 2 V at
5 A at the input to the circuit into 5 V at 2 A at
the output, making it feasible to build a 5 V
regulated supply powered from just two NiCd
or NiMH cells. With a single cell the maximum
elektor - 7-8/2009
VIN
VOUT
D1
L1
2µH2
SS16
+5V
R2
2Ω
3
4
5
7
C1
8
150µ
25V
The coil and diode need to be
selected carefully, and depend
on the required current output. To minimise
losses D1 must be a Schottky type: for a 1 A
output current the SB140 is a suitable choice.
1
2
R1
60k
possible current at 5 V would
be reduced to around 1 A.
The example circuit shown
here is configured for an output voltage of 5 V. The capacitor connected to pin 7 of the IC
enables the ‘soft start’ feature.
R2 provides current limiting
at slightly more than 1 A. For
maximum output current R2
can be dispensed with. Pins 1
and 2 are control inputs that
allow the device to be shut
down. To configure the device
for 3.3 V output, simply connect pin 15 to ground.
C2
C3
LX
CLK
IC1
LX
LX
MAX1708
FB
REF
PGND
ONB
PGND
ONA
GND
16
15
10
OUT
SS/LIM
6
100n
3.3/5
PGND
GND
C5
11
12
150µ
25V
13
14
C4
9
220n
100n
is that the input voltage must
be lower than the output voltage. For example, it is not possible to use a 3.7 V lithiumpolymer cell (with a terminal
voltage of 4.1 V fully charged)
at the input and expect to be
able to generate a 3.3 V output, as diode D1 would be
permanently conducting. On
the other hand, there is no
difficulty in generating a 5 V
output from a lithium-polymer cell.
(090070-I)
090070 - 11
Internet Link
[1] www.maxim-ic.com/quick_
view2.cfm/qv_pk/3053
For L1 a fixed power inductor, for example
from the Fastron PISR series, is needed. A fundamental limitation of the step-up converter
Economy Timer
7-8/2009 - elektor
33k
150R
1M
This circuit detects when a window
is open (it can also be used with a
door), indicates that the window
is open by means of a red LED or
a blinking LED, and emits a loud
acoustic signal from an intermittent
electronic buzzer to remind you to
close the window.
The active components consist of
a pair of type 555 timer ICs. Switch
S1 is a reed switch that is attached
to the window frame, and when
the window is closed the switch is
closed by a magnet attached to the
window casement.
When the window is closed, the reed
switch connects resistor R1 to the
4.5-V supply voltage. If the window
is opened, S1 opens as well and the
voltage on R1 drops immediately to
0 V. As a result, the trigger input of
IC2 is briefly pulled to ground via C1.
IC2 is wired as a monostable flip-flop, and it is
triggered by this pulse. After C1 charges, the
supply voltage is again present at the trigger
input of the monostable flip-flop (via R2). This
100k
Windows should be opened only a
few minutes for ventilation, and due
to the risk of break-ins, you shouldn’t
leave windows open for hours on
end or when nobody is at home.
ingly) indicates that the timer is running (pin 3 is logic High). The output
of the second 555 IC, which configR4
ured as a Schmitt trigger, also goes
High when its trigger input is pulled
to ground. As a result, the DC buzzer
Schmitt-Trigger
4
8
connected between the outputs of
S1
R
the two 555 ICs is not energised
6
THR
N
S
because both outputs are High.
IC1
D1
7
3
If the window is closed within the
OUT
DIS
555
time interval determined by the
1N4148
2 TR
R3/C2 network, the output of the
CV
BT1
Schmitt trigger returns to the Low
5
1
BZ1
state. If the output of IC2 is still High,
diode D1 prevents any current from
R2
R3
flowing through the DC buzzer.
5V
Monoflop
4V5
After the monostable times out, the
4
8
outputs of both 555 ICs are Low and
R
6
THR
the buzzer remains silent.
IC2
Things are different if the window
7
3
OUT
DIS
is still open when the monostable
C1
555
R5
2
TR
times out. The Schmitt trigger out10n
CV
put remains High, but the monosR1
5
1
D2
table output goes Low. As a result,
C2
a positive voltage is applied to the
470u 16V
buzzer, and it generates an acoustic
090109 - 11
signal until the window is closed. As
befits an intermittent buzzer, it generates an intermittent signal.
The time-out interval of the monosprevents retriggering and allows the monos- table can be calculated reasonably accurately
table to time out normally.
with the formula
The red LED or blinking LED (user option;
select the value of the series resistor accord- t = 1.1 × C2 × R3
22k
Stefan Hoffmann (Germany)
83
With the indicated component values (1 MΩ
and 470 µF), the alarm sounds after approximately nine minutes if the window is still
open.
Instead of the reed switch, you can use a lightdependent resistor (LDR) to detect the light
from the refrigerator lamp. If you replace R1
with a trimpot and adjust it so that the monostable is triggered when the refrigerator
lamp goes on (when the refrigerator door is
opened), after the monostable times out the
buzzer will remind you to close the refrigerator door (which is often left open). A nice side
effect here is that you can use this circuit to
definitively answer the age-old question of
whether that refrigerator lamp actually goes
off when the fridge door is closed ;-) .
(090109-I)
Full-colour Night-flight Illumination
Steffen Schütte (Germany)
There are various types of night-time illumination available for model aircraft. The circuit described here is special in that it allows
the colour of the RGB LED that is used to be
controlled remotely. The circuit can be connected to a spare receiver output channel or
in parallel with a channel already in use for
other purposes. The colour of the RGB LED
changes according to the servo position for
the selected channel and according to the
selected mode of operation.
Mode 1
Mode 2
Mode 3
080060 - 11
Characteristics
• Supply voltage: 4.8 V (4.5 V to 5.5 V)
• Maximum current for each output: 150 mA
• Maximum current per LED module: 150 mA
(50 mA per colour)
LED2
K4
R11
• Operating modes: 3
R10
• Servo range: ±100 %
• Dimensions (prototype):
32 mm x 25 mm x 7 mm
A3
82R
180R
LED CON2
K5
A2
C3
C2
C1
A1
R8
A3
82R
180R
LED CON1
LRTB G6TG
120R
3x
A2
C3
R7
RGB
R9
• Controller weight: 5 g
LED1
3x
C2
C1
A1
RGB
LRTB G6TG
R6
120R
• LED module weight: 0.7 g
K1
RC CON
At the heart of the circuit is a PIC12F675
microcontroller (IC1), which is connected to
one output channel of the radio receiver:
this allows it to measure the corresponding
servo position. Depending on its operating
mode, the microcontroller generates pulsewidth modulated waveforms on three outputs, which in turn drive the connected RGB
LED (or LEDs) via transistors T1 to T3 to produce a range of colours. The other main components are the mode button S1 and a fourway connector (K2) used for in-system programming (ISP) of the microcontroller. D1 and
D2 are required to prevent a connected radio
receiver from interfering with the programming operation.
In contrast to the simplicity of the hardware,
the software running in the microcontroller is rather complex. Commented source
code is available for free download from
the project page at www.elektor.com. The
most important parts of the program are the
84
1k
R5
K2
D2
D1
1N4148
1N4148
4k7
R1
ISP
1
2
3
4
GP5/CLKIN
GP0
IC1
GP4/CLKOUT
GP1
PIC12F675SN
GP3
GP2
7
6
5
T1
R2
10k
K3
BC847C
8
T2
R3
1k
BC847C
S1
LEDS
T3
R4
1k
BC847C
080060 - 12
elektor - 7-8/2009
initialisation code, the interrupt routine and
the main loop.
operation modes (see also the accompanying figure). In mode 1 the colour changes
from blue (minimum servo position) to red
(maximum position). A press of S1 advances
to mode 2, where the colour changes similarly from green to red. A further press enters
mode 3, where the colour changes continuously, with the speed of the change depending on the servo position. Finally, pressing
the button once more returns to mode 1.
The most recently used mode is stored in
the microcontroller’s EEPROM while power
is not applied.
When power is applied to the receiver the
channel that has been selected for use
must be set to its minimum position. This is
because the circuit uses the initial value of
the pulse width to ‘learn’ the minimum position. If the channel is not set to its minimum
position, the device will never fully reach the
colour red (in modes 1 and 2) or the maximum possible colour-changing speed (in
mode 3).
The interrupt routine is triggered by a level
change on the input port pin connected to
the radio receiver. It tests whether the edge
is rising or falling: if rising, Timer1 is set to
zero to allow the time to the following falling
edge to be measured. The pulse width corresponds to the servo position and is output by
the receiver every 20 ms. The 20 ms timebase
derived from the receiver signal is also used
to orchestrate the polling of the mode button. When the mode button is pressed (the
input port pin going from High to Low) the
device changes mode.
If the device is not in continuously-changing
mode the new colour for the RGB LED is calculated in the interrupt routine by calling the
routine ‘calcResult’. If the device is in continuously-changing mode the relevant calculations are performed in the main loop.
Pressing S1 cycles through the following
The upper part of the circuit diagram shows
how the RGB LED can be connected to connector K3. It is possible to connect multiple
LED units in parallel. An extra pin on K3 is
taken to ground in order to allow permanently-lit LEDs to be connected alongside
the RGB LEDs. It is of course necessary to
keep within the maximum permissible current draw from the receiver or battery eliminator circuit (BEC).
(080060-I)
Download
080060-11: source code and hex files, from www.elektor.com/080060
Product
080060-41: ready-programmed PIC12F675
microcontroller
Smoggy
use your Walkman to
detect electrosmog
*
*
*
connection of the amplifier circuitry. As
we are dealing with a stereo amplifier,
we are listening into both channels and
thus both RF ranges at the same time.
*
ANT3 ANT2 ANT1
L3
Tony Ruepp (Germany)
The outputs of both detector-receivers
are connected to the cables disconnected
previously from the tape heads, feeding the
right and left channel inputs to the Walk-
7-8/2009 - elektor
C5
C3
4n7
1µ
R
D1
AA112
L1
R1
15k
Looking at the schematic, readers with RF
experience will have no difficulty in recognising the diodes and coils of the two
detector-receivers, which serve to capture and demodulate RF signals. With its
coil of four turns (L2) one receiver covers the higher frequency range of the
electromagnetic waves, whilst the second detector takes care of the lower frequency range. For this reason a coil with a
greater number of turns is required: L1 is
an RF choke of about 250 µH. The precise
value is not critical and it could equally be
220 µH or 330 µH.
K1
250µH
C1
1n
L
D2
AA112
C4
470p
L2
*
R2
15k
Even if your good old (Sony) Walkman
sees little use nowadays it would be a
shame to get rid of it altogether. The more
so when just removing the tape head
would allow the built-in audio amplifier
to become an outstanding electrosmog
detector for a variety of purposes.
C2
1n
A
090151 - 11
man’s audio amplifier. Please note here that
the screening of the tape head cable does not
have to be absolutely identical to the ground
One channel of the amplifier can also be
used to demodulate low-frequency magnetic alternating fields via a capacitor
(C3) bypassing diode D1 and connecting either a third coil (L3, for instance;
a telephone recording adapter) as the
pickup device or else a long piece of wire
for acquiring low frequency AC electrical fields. Sources like this are discernible mainly by a distinct 50 Hz (or 60 Hz)
humming in the earphones.
Predicting what you may hear down to
the very last detail is difficult, since every
locality has its own, individual interference sources. Nevertheless, with practice
users will succeed in identifying these
interference sources by their particular
audio characteristics.
To sum up, four different ‘sensors’ can be
connected to the inputs of this circuit:
ANT1 (approx. 50 cm long whip antenna),
ANT2 (3.5 cm short stub antenna), ANT3
(approx. 1 m long wire antenna for low frequency electrical fields) and a coil for magnetic fields. Finally, two more tips:
85
1. Use only ‘good old’ germanium diodes for
D1 and D2. Sensitivity will be much reduced if
silicon diodes are used, as these have a higher
threshold voltage.
2. Smoggy does not provide an absolute indication of field strength and even more so cannot provide any guidance whether anything
it detects might be harmful. Its function is to
detect electromagnetic signals and compare
their relative magnitude.
(090151-I)
Solar-driven Moisture Detector
Christian Tavernier (France)
The projec t, then, is
intended for detec ting moisture here on
Ear th using solar
power. It’s primarily aimed
it at those of
you who like to
brighten up their
house or f lat
with pot plants,
but are afraid of
inadvertently letting them die of
thirst.
Using it s t wo e le ctrodes, formed from two
stiff pieces of bare copper wire, it can be
stuck into the pot of any plant you want to
monitor. As long as the plant isn’t thirsty,
i.e. the soil in the pot is moist enough, it will
just sit there and do nothing at all. But when
the soil dries out below a certain threshold
(which you can adjust to suit the soil used
and the plant being monitored), it starts
‘squealing’ to tell you it is time to give the
poor plant a drink.
But so that your husband/wife/girlfriend/
boyfriend (as applicable!) won’t throw your
plant out of the window because the detector has started squealing in the middle of the
night, we obviously want it to work only during the day. This is where the solar cell comes
in handy: on the one hand, it is used to power
the circuit, making it totally stand-alone; and
on the other, the lack of power produced
when in darkness means the circuit is automatically silenced at night.
Once we’ve adopted this principle, the circuit
86
V+
R3
14
IC1 = 4093
47k
When we think of solar cells or panels, what
springs to mind immediately is producing
power — only natural, given the primary
purposes of such devices; but we don’t necessarily think of using them in applications
where the fact they don’t produce power
in the absence of light may actually be useful. Yet this is just the case in the project discussed here.
IC1
7
P1
S3
R1
100k
1
BT1
*
2
IC1.A
&
3
5
6
R2
1M
10k
lin
IC1.B
&
4
8
9
*
BZ1
*
V+ > 3V
IC1.C
&
S2
10
3V
BZ2
E1
C1
C2
22µ
25V
100n
*
12
13
*
V+ < 3V
IC1.D
&
11
S1
3V
E2
081174 - 11
is remarkably simple, using just a single 4093
CMOS logic chip, which contains four 2-input
Schmitt trigger NAND gates.
The first gate, IC1a, is wired as a very low frequency astable oscillator. When its output is
at logic high, which occurs at regular intervals, it enables IC1b, which is also wired as an
astable oscillator, but this time at an audible
frequency. The signal from IC1b then has to
pass through IC1c, which can only happen if
E1 and E2 are not connected, allowing the
corresponding input to be pulled up to logic
High. You will have realised that E1 and E2
are the electrodes stuck into the soil and so
will not be connected if the latter is not sufficiently conductive, i.e. when it starts to dry
out. The threshold at which gate IC1c turns on
is obviously adjustable using P1.
COMPONENT LIST
Resistors
R1 = 100kΩ
R2 = 10kΩ
R3 = 47kΩ
P1 = 1MΩ linear potentiometer
Capacitors
C1 = 22μF 25V
C2 = 100nF
Semiconductors
IC1 = 4093
Miscellaneous
Solar cell (see text)
Piezo buzzer
2 copper wire electrodes
PCB no. 081174-I
elektor - 7-8/2009
Depending on whether or not the circuit is
supplied from a voltage greater or less than
3 V — which depends on the solar cell used,
as we’ll be seeing in a moment — the piezo
sounder can be connected either directly
between IC1c output and the positive supply, or between the outputs of IC1c and IC1d,
which is wired as a simple inverter and so
enables you to double the output voltage.
The circuit is very simple to build, and you
can just as easily use the suggested board
design [1] or build it on a piece of prototyping board. The sounder used must of course
be one without built-in electronics, as here
it is just being used as a simple transducer. If
it’s a large-diameter flat type, you could, for
example, glue it onto the casing of IC1, while
if it’s a small-diameter type with rigid pins, it
can be soldered directly onto the end of the
PCB where its connection pads are located.
As for the solar cell, for the prototype Solems
devices were used, available for example
from Selectronic France [2]; these are marked
with a very simple 3-figure code in the form
NN/LL/WW, where NN is the number of elements in the cell (each element producing
around 0.5 V), LL is the length of the cell,
and WW the width, in mm. Equivalent cells
from other suppliers may work equally well
though.
Although in theory standard CMOS logic ICs
only work above 3 V, the majority of those
we tried in our circuit did actually work with
a lot less, which means that if you’re on a
tight budget (or have a lot of plants to monitor!), you can use the cheapest cells, part no.
05/048/016.
If your budget is a little higher, and you
don’t want to bother selecting the 4093
CMOS ICs, go for a 07/048/016, or better still
a 07/048/032, which will allow the circuit to
work under excellent conditions as soon as
the illumination reaches around 1,000 lux.
You can also cannibalize such cells from
solar-powered garden lights, which can often
be found at giveaway prices in the big DIY
stores.
Given the size of the suggested PCB, the
Solems cells can be soldered directly onto
the copper side of it. But when connecting
the cell up, do take care to be very quick soldering the leads to the two silvered pads at
each end of it. They are actually metallised
directly onto the glass of the cell and so are
pretty fragile.
As soon as the cell is connected, if the two
electrodes E1 and E2 are ‘in mid-air’, the circuit should start ‘squealing’, as long as it is
getting enough light. You can then solder
two stiff copper wires onto E1 and E2 (e.g.
stripped offcuts of 1.5 mm² / AWG16 domestic wiring cable) and spike the circuit into the
plant you want to monitor. Then all you have
to do is adjust P1 so that the circuit cries for
help when the soil has reached the level of
dryness you have chosen.
If the frequency of the sound produced
doesn’t suit you, you can change it by
increasing or reducing C2 and/or R2. Likewise, if you don’t like its repeat frequency,
you can change that by adjusting C1 and/
or R1.
(081174-I)
Internet Links
[1] www.elektor.com/081174
[2] www.selectronic.fr
Download
081174-1 PCB layout (.pdf), from [1]
Advertisement
7-8/2009 - elektor
87
I2C Display
R. Pretzenbacher (Austria)
Pretty graphical simulators are all very well
when developing circuits using microcontrollers, but sometimes there is no substitute for
a proper display connected to real hardware.
LCD panels based on the Hitachi HD44780
controller are popular as they are cheap and,
at least in principle, easy to use. Unfortunately they require a large number of control
signals, which in turn means bulky cables and
losing the use of many of the microcontroller’s I/O pins.
Here we present a solution to the problem in
just three characters: I2C!
Characteristics
• Universal LCD module for microcontrollers
• Requires just two I/O port pins
• Multiple displays on one I2C bus
• Simple to use with AVR firmware
With the addition of just one extra chip to
bridge the gap between the I2C bus and the
LCD panel’s parallel interface, we can make
a universal display module on a simple compact printed circuit board. Besides ground
and +5 V power, the module needs just two
control lines from the host microcontroller
system: SCL and SDA. This makes the job of
interfacing to a display much more straightforward. The Hitachi controller can be operated in its ‘four-bit mode’, where only four
data lines are connected along with three
control signals: ‘E’, ‘R/W’ and ‘RS’. And now
we come to the elegant part of this design:
rather than using a microcontroller to drive
these seven lines we use a simple I2C bus port
expander device offering eight I/O pins. This
even leaves us one spare output which we
can use to switch the LCD’s backlight (or any
other LED) on and off.
We selected the PCF8574, which is available in
LCD1
+5V
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SCL
SDA
+5V
+5V
K1
+5V
1
2
3
4
SCL
SDA
J2
14
SCL
15
SDA
INT
IC1
PCF8574
8
13
88
39R
16
1
A0
2
A1
3
A2
VCC
J1
R5
100n
R3
GND
1k8
R2
C1
1k8
SDA
SCL
5k
100n 10u
16V
+5V
1
2
3
4
5
6
P1
C3
C2
K2
VSS
VDD
VL
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
LED+A
LED-C
+5V
K3
P0
P1
P2
P3
P4
P5
P6
P7
4
5
6
7
9
10
11
12
T1
R4
1k8
BC807
+5V
080525 - 11
elektor - 7-8/2009
COMPONENT LIST
Resistors
P1 = 5kΩ, SMD (Murata)
R2,R3,R4 = 1kΩ8, SMD 0805
R5 = 39Ω, SMD 0805 (see text)
Capacitors
C1,C2 = 100nF, SMD 0805
C3 = 10µF 16V, SMD (Vishay), diam. 4mm
Semiconductors
IC1 = PCF8574 (PCF8574A) (see text)
T1 = BC807, SMD SOT23
two variants. The variants differ in the regions
of the I2C address space to which they can
be configured to respond: see [2]. As shown
the circuit is arranged so that the device
responds to he highest address in its range:
in the case of the PCF8574 this address is 0x4E
and in the case of the PCF8574A the address
is 0x7E. Using these two chips it is possible to
make two display modules that can be connected to the same I2C bus simultaneously
without address conflict and without any
modifications to the circuit. If it is desired to
use one of the other seven possible device
addresses (for example if there is a conflict
with another I2C device on the same bus) the
wiring of the address bits (pins 1 to 3) needs
to be changed appropriately.
The circuit itself is straightforward. The
signals from the port expander are taken
directly to the pins of the LCD panel, with
the exception of output P0 which controls
the backlight via PNP driver transistor T1. The
value of R5 must be chosen according to the
current rating of the backlight, which can be
determined from the LCD panel’s datasheet.
The value of 39 Ω shown is suitable for a typical one-line panel with a rated LED current
of 30 mA. Preset P1 is used to adjust the display contrast: frequently the display is only
visible over a narrow range of contrast settings. Jumpers J1 and J2 enable the standard
pull-up resistors on the SCL and SDA lines:
there should only be one pair of such pullup resistors over the whole bus. The printed
circuit board offers a range of possibilities for
connection to the bus: header K1, RJ11 socket
K2 and solder pads K3.
To simplify using the display the author has
written driver software in C, suitable for use
with AVR microcontrollers. As usual this is
available from the Elektor web page for this
article [1] and can of course be modified to
suit your own requirements. The software is
divided into three parts as follows.
• i2cCheck
test whether a slave is responding
• i2cSend
send data over the I2C bus
• i2cReceive
read data over the I2C bus
2) Low-level display functions
(not normally used in applications)
Miscellaneous
LCD with HD44780 compatible controller
K1 = 4-way SIL pinheader, lead pitch 0.1”
(2.54mm)
K2 = RJ11 socket, PCB mount
K3 = solder islands
J1,J2 = 2-way pinheader with jumper, 0.1”
lead pitch
20-way pinheader, 0.1” pitch, for LCD
connection
PCB # 080525-1
3) User-level display functions
(for use in applications)
• Ddisp
position
write character at current cursor
• DClear
clear display
• Dpos
set cursor position
• Dinit
initialise display
output a two-digit BCD value
• whNibb
send data nibble to display: call twice to
send a byte
• DBcd2
• rdsyB
read status byte from display (for
example, to determine if the display is
busy)
• DWord
output an unsigned 16-bit value
• DLong
output an unsigned 31-bit value
• DInt
output a signed 16-bit value
• cntrB
send control byte to display (for example,
to shift the display left or right)
• dataB
send data byte to display
• wBusy
test whether display is busy
• DHexByte output a byte in hexadecimal
The user-level functions can be changed as required
without needing to know the low-level details of how
the display is driven.
(080525-I)
Internet Links
Control byte constants
[1 www.elektor.com/080525
(for use with ‘cntrB’)
• dshr
0b00011100
// shift display one position
to the right
• dshl
0b00011000
// shift display one position
to the left
• curon
0b00001110
// cursor on
• curoff
0b00001100
// cursor off
• curblk 0b00001111
[2] www.nxp.
com/acrobat_download/datasheets/PCF8574_4.pdf
Downloads
080525-1: PCB layout (.pdf), from [1]
080525-11: source code files, from [1]
// cursor blinks
1) I2C functions
(may be modified to suit particular AVR
microcontrollers)
• i2cInit
7-8/2009 - elektor
initialise I2C master
89
FM Audio Transmitter
Design: Mathieu Coustans (France)
K2
• Easy to build thanks to the use of a MAX2606
• Can be powered from a USB port on a computer
• Current consumption of just 2 to 4 mA, supply
voltage of 2.7 to 5.5 V
• Can be expanded with a pre-emphasis circuit
The PCB designed in the Elektor Labs uses
resistors and capacitors with 0805 SMD
packaging. The size of the board is only 41.2
x 17.9 mm, which is practically dongle-sized.
For the aerial an almost straight copper track
C5
4u7
10V
P2
K1
100k
R1
22k
C4
+5V
R3
4k7
C3
4u7 10V
C6
R5
C1
4u7 10V
1
4
2
3
1
C8 2
3
100n 4
VCC
R6
270R
3
470n
10k
R4
L2
6
5
5
P1
K3
2n2
C2
100n
R2
22k
has been placed at the edge of the board.
In practice we achieved a range of about
6 metres (18 feet) with this. There is also
room for a 5-way SIL header on the board.
Here we find the inputs to the 3.5 mm jack
plug, the input to P1 and the supply voltage.
The latter permits the circuit to be powered
independently from the mains supply, via for
example three AA batteries or a Lithium button cell. Inductor L1 in the prototype is a type
made by Murata that has a fairly high Q factor: minimum 60 at 100 MHz.
Take care when you solder filter choke L2,
since the connections on both sides are very
close together. The supply voltage is connected to this, so make sure that you don’t
short out the USB supply! Use a resistance
meter to check that there is no short between
the two supply connectors before connecting the circuit to a USB port on a computer
or to the batteries.
P1 has the opposite effect to what you
would expect (clockwise reduces the volume), because this made the board layout
much easier. The deviation and audio bandwidth varies with the setting of P1. The maximum sensitivity of the audio input is fairly
1
C7
2n2
L1
390n
TUNE
IC1
OUT+
MAX2606
IND
OUT-
6
4
GND
2
+5V
Specifications
1k
To keep the circuit simple as well as compact,
it was decided to use a chip made by Maxim
Integrated Products, the MAX2606 [1]. This
IC from the MAX2605-MAX2609 series has
been specifically designed for low-noise RF
applications with a fixed frequency. The VCO
(Voltage Controlled Oscillator) in this IC uses a
Colpitts oscillator circuit. The variable-capacitance (varicap) diode and feedback capacitors for the tuning have also been integrated
on this chip, so that you only need an external inductor to fix the central oscillator frequency. It is possible to fine-tune the frequency by varying the voltage to the varicap. Not much is demanded of the inductor,
a type with a relatively low Q factor (35 to 40)
is sufficient according to Maxim. The supply
voltage to the IC should be between 2.7 and
5.5 V, the current consumption is between 2
and 4 mA. With values like these it seemed a
good idea to supply the circuit with power
from a USB port. A common-mode choke is
connected in series with the USB connections
in order to avoid interference between the
circuit and the PC supply. There is not much
else to the circuit. The stereo signal connected to K1 is combined via R1 and R2 and
is then passed via volume control P1 to the
Tune input of IC1, where it causes the carrier
wave to be frequency modulated. Filter R6/C7
is used to restrict the bandwidth of the audio
signal. The setting of the frequency (across
the whole VHF FM broadcast band) is done
with P2, which is connected to the 5 V supply voltage.
1k
When the author started thinking about this
project he had a simple VHF FM transmitter in mind that could be used to play audio
files from an MP3 player or computer on a
standard VHF FM radio. The circuit shouldn’t
use any coils that would have to be wound
at home, as is often the case with other FM
transmitter designs, because it would add an
unwanted level of complexity to the project.
Such an FM transmitter can be used to listen
to your own music throughout your home.
There is also an advantage when you use this
transmitter in the car, as there is no need for a
separate input to the car stereo to play back
the music files from your MP3 player.
080727 - 11
90
elektor - 7-8/2009
COMPONENT LIST
1206 type(DLW31SN222SQ2L Murata, Farnell #
1515599)
Resistors (all SMD 0805)
R1,R2 = 22kΩ
R3 = 4kΩ7
R4,R5 = 1kΩ
R6 = 270Ω
P1 = 10kΩ preset, SMD (TS53YJ103MR10 Vishay
Sfernice, Farnell # 1557933)
P2 = 100kΩ preset, SMD(TS53YJ104MR10 Vishay
Sfernice, Farnell # 1557934)
Capacitors (all SMD 0805)
C1,C2,C5 = 4µF7 10V
C3,C8 = 100nF
large. With P1 set to its maximum level, a
stereo input of 10 mVrms is sufficient for the
sound on the radio to remain clear. This also
depends on the setting of the VCO. With a
higher tuning voltage the input signal may
be almost twice as large (see VCO tuning
curve in the data sheet). Above that level
some audible distortion becomes apparent. If the attenuation can’t be easily set by
P1, you can increase the values of R1 and R2
without any problems.
Measurements with an RF analyzer showed
that the third harmonic had a strong presence in the transmitted spectrum (about
10 dB below the fundamental frequency).
Semiconductors
IC1 = MAX2606EUT+, SMD SOT23-6 (Maxim
Integrated Products)
Miscellaneous
K1 = 3.5mm stereo audio jack SMD (SJ1-3513-SMT
CUI Inc, DIGI-Key # CP1-3513SJCT-ND)
K2 = 5-pin header (only required in combination
wsith 090305-I pre-emphasis circuit)
K3 = USB connector type A, SMD (2410 07 Lumberg,
Farnell # 1308875)
C4,C7 = 2nF2
C6 = 470nF
Inductors
L1 = 390nF, SMD 1206 (LQH31HNR39K03L Murata,
Farnell # 1515418)
L2 = 2200Ω @ 100MHz, SMD, common-mode choke,
This should really have been much lower.
With a low-impedance source connected
to both inputs the bandwidth varies from
13.1 kHz (P1 at maximum) to 57 kHz (with the
wiper of P1 set to 1/10).
In this circuit the pre-emphasis of the input
is missing. Radios in Europe have a built-in
de-emphasis network of 50 µs (75 µs in the
US). The sound from the radio will therefore
sound noticeably muffled. To correct this, and
also to stop a stereo receiver from mistakenly
reacting to a 19 kHz component in the audio
signal, an enhancement circuit Is published
elsewhere in this issue (Pre-emphasis for FM
Transmitter, also with a PCB).
Notice. The use of a VHF FM transmitter, even a low power device like the one
described here, is subject to radio regulations and may not be legal in all countries.
(080727)
Internet Links
[1] http://datasheets.maxim-ic.com/en/ds/MAX2605MAX2609.pdf
[2] www.elektor.com/080727
Download
080727-1 PCB layout (.pdf), from
www.elektor.com/080727
Servo Driver
Gert Baars (The Netherlands)
+9V ... +20V
IC2
When the position of a servo can be controlled via a voltage, it can be implemented via
a potentiometer acting as a voltage divider.
However, you could also use the output of
a sensor such as a Hall sensor, an LDR or an
NTC. That way you could easily create a feedback loop that takes account of the position,
light intensity or the temperature, and use
this to control the servo. This can in turn be
used to open or close a gas or water valve, for
example. The circuit can therefore be said to
7-8/2009 - elektor
4
7806
C5
C6
C7
C8
100n
100n
220µ
10V
100n
IC1
11
220k
R1
Servo
IC1 = LM324N
R4
220k
9
10
IC1.C
8
R3
47k
3
12
13
IC1.D
14
R7
47k
2
IC1.A
1
6
5
IC1.B
7
1
K1
2
C3
3
R5
470k
R6
R2
220k
When it comes to driving a servo you typically have to send a PWM signal to the servo
input. The frequency of this signal is about
50 Hz and the duty cycle is variable. The duty
cycle is usually between about 5 and 10%,
corresponding with a pulse width of about 1
to 2 ms. The conversion of a resistance value
into a PWM signal is fairly straightforward
when a variable RC time constant circuit is
used. Converting a voltage into a PWM signal
is a bit more difficult, but it does offer some
useful advantages.
IC3
78L06
39k
C1
C2
100n
100n
D1
10n
1N4148
Uin
C4
220µ
10V
090046 - 11
91
be reasonably versatile.
is fixed and set to a value slightly higher than
the maximum 10%.
There are special purpose PWM modulator ICs available, but it’s just as easy to use
a quad op amp such as an LM324. In the circuit op amp C is configured to output a bias
signal of half the supply voltage. Op amp D
is set up as a square-wave oscillator, with its
frequency set to about 50 Hz, which is the frequency required by the servo. The duty cycle
This is followed by an integrator that changes
the waveform of the pulse into a triangular
form. Op amp B is configured as a comparator that compares this triangular wave with
the DC voltage Uin. The output of the comparator is a PWM signal that is suitable to drive
the servo directly. The frequency is about
50 Hz and the duty cycle can be varied from
just under 5% to a good 10% when Uin varies from 0.5 to 4 V. The servo, an RS-2 in our
prototype, reacts to this with an angular rotation of about 200 degrees. The transfer function in this case is therefore 200 / (4–0.5) = 57
degrees per volt.
(090046)
Chill Out Loud
Andrew Denham (United Kingdom)
92
100k
100k
100k
an ability to deliver power at low
temperatures.
An o bv i o us ch o i ce to make
Everyone knows that when the
a squawk is a piezo sounder,
refrigerator door is casually closed
again cheap and easily obtained.
it sometimes bounces open again
This can be driven from the PIC
just a little. Enough to put the
directly across two ports and will
fridge light on, but that’s often
un-noticeable even at night unless
withstand 3 Vp-p drive easily. After
some testing, a Kingstate KPEG827
one looks closely. After a day out,
[3] proved a worthy candidate.
you may come home to sour milk
and dodgy chicken. After several
It makes sufficient racket at 3 V
mornings with debatable milk,
drive from about 2.0 kHz to about
the author decided that some4.5 kHz.
The PIC program was developed
thing would have to be done, and
using MikroElektronika products
came up with this little gizmo. The
only: a fully paid up MikroBasic
light in his fridge always comes
+3V
compiler and the BigPIC 4 board.
on even with a 2 mm door openHowever the final program is
ing, so that’s a promising place to
so small that it can be compiled
start.
C1
C2
using the free version of MikroBaThe TEMT6000 phototransistor
10µ
100n
device from Vishay will ‘see’ vissic (free up to 2 K of code, download at [4]).
ible light, and is both cheap and
For the simple reason of ease, the
readily available. It has negligible
R1
R2
R3
PIC used is the 8-pin DIL version.
dark current and can sink a few
1
*
This can be re-programmed easily
µA happily. Since a battery pow2
5
GP5
GP2
using a simple DIL socket adapter.
ered device is required, the curIC1
BT1
BZ1
ICP is OK if you have to use SMD
rent for the entire circuit has to
3
6
GP4
GP1
but the socket takes up a lot of
be as low as possible. A PIC with
PIC12F629
4
7
room and negates the purpose
‘sleep’ mode is a good choice,
GP3
GP0
T1
of SMD in the first place on a very
and the 12F629 fits the bill nicely:
CR2032
C3
KPEG827
8
Lithium
small PCB. I used the PicFlash2
small, cheap, easily obtained, with
100n
programmer again from MikroE,
an internal RC oscillator on board,
but could have used the on-board
and up to five I/O pins as well.
TEMT6000
080700 - 11
EasyPIC4 programmer. The source
According to the PIC12F629 datacode used is available free from
sheet [1] all pins have to be set as
the Elektor website [5].
inputs and pulled high for best
The timer will work with anything
The type CR2032/1HF Lithium cell has a rated
low power operation, and every
peripheral in use will add some drain. Since capacity of 230 mAh and a nominal voltage that can pull the GPIO.3 input Low and hold
the unit is permanently powered from a bat- of 3 V [2]. On this basis with the typical cur- it Low, so could be used with bi-metallic temtery, there is no need for brown-out protec- rent in sleep mode the battery would last peratures sensor, or the software adapted to
tion. No A/D or comparators are required, over 250 years, or effectively for its shelf life, read a One-Wire temperature sensor. It could
and no watchdog timer either, allowing the so a CR2032 with tags is worth soldering in also be used to sense over- or under-voltage
lowest power settings in Sleep mode to be to a PCB. Even at the maximum Sleep cur- etc. with some adaptation. The delay before
exploited. Typical current here is shown as rent, it would last for over 30 years — cer- the alarm sounds is adjustable from about 1
1.2 nA with a guaranteed maximum of 770 nA tainly longer than the fridge! One advantage to 255 seconds in software.
of a Lithium battery is its long shelf life, and One word of warning: there are many PIC proat a 3 V supply, reducing to 700 nA at 2 V.
elektor - 7-8/2009
grammers out there. If you use other than the
MikroE programmer with the code from the
Elektor website, make certain that the PIC
oscillator configuration is correct. Not all
software reads the Configuration correctly;
it needs to be set for INT RC OSC, with GPIO.4
and GPIO.5 as I/O. Anything else will stop the
oscillator and may damage the PIC! Some
programmers need these parameters to be
set manually before blowing the chip. In case
of doubt, consult the source code listing.
After some tweaking with the port settings,
the sample chip consumed an estimated
0.02 µA in Sleep mode. Once triggered the
unit consumes about 500 µA for the timer
period of 1 minute, then about double that
once the sounder is operating. This is well
under the maximum current for the cell
used (10 mA max. pulsed) and would bleat
for about 10 days with a fresh battery, which
hopefully will never happen. With a fridge
opened say 20 times a day for less than a minute, the battery life expectancy reduces to
about 9 years, still a reasonable longevity.
The photograph shows a prototype built on a
small piece of perfboard by Elektor Labs. Here
the ambient light sensor is a type TEPT5600
(which looks like a UV LED). As opposed to
TEMT6000, the TEPT5600 has to be pointed
directly to the light source due to its narrower
‘viewing angle’. It also requires the value of
R1 to be doubled (approximately).
Even on perfboard the circuit is compact
enough to be fitted in a small ABS case, preferably one with a battery compartment
because that’s the ideal place for the sounder.
A small hole in the end should allow the sensor to ‘see’ the light. This hole was filled with
clear epoxy resin to act as a window without allowing too much moisture into the
case. The latter was achieved by fixing tape
over the inside then filling the hole flush. It
was then allowed to set whilst the box was
fixed upright. The circuit board may be fixed
in place with a little hot melt glue. The unit
could be mounted to the fridge wall using
double-sided adhesive foam strip or Velcro,
but space allowing it may equally sit on the
shelf.
To start the microcontroller for the first time,
or when the battery is replaced, the fridge
door should be closed or the sensor covered.
Once the sensor detects light, it takes 60 seconds before the alarm sounds. When in the
fridge with the door closed (or the sensor covered) the unit goes back to sleep…
peace!
Of course the fridge does have to have a
light that works or the unit will think it is in
the dark all the time.
(080700-I)
Internet Links
[1] http://ww1.microchip.com/downloads/en/
devicedoc/41190c.pdf
[2] www.panasonic.com/industrial/battery/oem/
images/pdf/Panasonic_Lithium_CR2032_CR2330.pdf
[3] www.farnell.com/datasheets/16396.pdf
[4] www.mikroe.com
[5] www.elektor.com/080700
Downloads & Products
Programmed Controller
080700-41: programmed PIC12F629
Software
080700-11.zip: MikroBasic source code and hex files.
Location: www.elektor.com/080700
Dimmable Aquarium Light
with Simulated Sunrise and Sunset
the interface has several features
that will be of particular interest to
Electronic ballasts (EBs) for fluaquarium owners.
RE1
orescent lamps, also known as
The circuit is connected across the
S1
electronic control gear (ECG), have
control input of the EB and thereP1
*
advantages over their convenfore the control voltage appears
Electronic
Ballast
tional cousins: higher efficiency,
across it. The brightness of the
100k
(EB)
log
R1
tube can be adjusted using P1. S1
flicker-free start-up, no 50 Hz
C1
allows electrolytic capacitor C1 to
(60 Hz) flicker and longer tube life.
10 000u
Moreover, they allow the light to
be connected across P1: the charge
16V
be dimmed. Suitable EBs with a 1–
current (0.6 mA) is very small and
090025 - 11
10 V analogue control interface are
the capacitor very large (10000 µF)
available from all the usual manand so it charges very slowly. This
ufacturers, including Osram and
means that the voltage across it,
Philips. An internet search for ‘dimmable EB’ is a constant current source with an open-cir- and hence the brightness of the fluorescent
will turn up a large number of on-line sales cuit voltage of 10 V. If a resistor is connected tube, will increase only slowly. The larger the
outlets for the devices. For the purposes of across the interface then the lower its value, value of C1, the slower the rate of brightness
this circuit EBs with a digital interface (known the lower will be the voltage across it, and increase; with the suggested value the simas DALI, for Digital Addressable Lighting Inter- this controls the dimming of the connected ulated sunrise takes around 12 minutes to
face) are not suitable.
lamp. When the control input is open circuit complete. As can be seen, the circuit does
and the voltage across it is 10 V, the lamp is not need its own power supply. When the EB
Osram provides an excellent technical driven at full brightness (100 % of nominal is switched off C1 discharges into P1 (assumdescription of the 1–10 V interface on their power). If the control input is shorted the ing S1 is closed); when it is next switched on
website at [1]. The interface provides an control gear dims the lamp to 3 % of nominal the brightness of the tube will rise slowly as
interference-proof DC voltage of up to 10 V, power. Between 3 % and 100 % the behav- before.
which, when loaded, delivers an essentially iour of the controller is logarithmic.
An optional extra is the circuit consisting of
constant current of 0.6 mA: in other words, it The very simple circuit described here to drive relay RE1 and resistor R1. If the contacts of
2k
Jürgen Ollig (Germany)
7-8/2009 - elektor
93
RE1 close C1 will be slowly discharged into
R1. The control voltage will fall gradually
and the tube will slowly dim. The larger the
value of R1, the slower the simulated sunset
will be. When the contacts of RE1 are closed
the value of R1 will also affect the maximum
brightness that can be achieved by adjusting
P1: the greater the value of R1, the higher the
maximum brightness.
One possible arrangement is to plug the
aquarium light into one timeswitch and drive
RE1 from a mains adaptor plugged into a second timeswitch. The relay contact is made to
close say 30 minutes before the first timeswitch turns the aquarium light off. When the
simulated sunset is complete the relay contact can be allowed to open again.
Internet Link
[1] http://www.osram.co.uk/_global/pdf/Professional/
ECG_%26_LMS/ECG_for_FL_and_CFL/QUICKTRONIC_
DIM_Technical_Guide130T003GB.pdf
(090025-I)
Audio Source Enhancer
Thorsten Steurich (Germany)
R1
R K1
R3
100R
10n
100k
2
C1
IC1A
3
C7
1
94
6
10k
7
IC1B
5
R11
100R
10n
100k
10u
63V
R5
100R
K2 R
R6
C13
8
IC1C
C11
22p
R12
10k
C14
9
10
C4
100k
R9
*
P2
13
10k
10u
63V
12
IC1D
14
C12
10u
63V
R10
R13
100R
K4 L
R14
100k
100k
P1
22p
10k
R2
1u
+10V...+30 V
R7
10k
Records and CDs use very different recording technologies. For records the signal
first undergoes pre-emphasis similar to
that used in FM radio, where the higher
frequency components of the signal are
amplified. The resulting signal is cut into
the lacquer master disc that will be used
for pressing. Unlike CD manufacture, this is
an entirely analogue process, and it introduces a phase shift into the signal. To compensate for the pre-emphasis the preamplifier in a record player includes a de-emphasis (or ‘RIAA’) filter which attenuates the
higher frequency components. The purpose of pre-emphasis is to improve the
overall signal-to-noise ratio of the signal as
played back, reducing hiss and crackle. Deemphasis introduces further phase shifts,
and as a result the final signal is rather different from that produced by a CD player.
The processing involved in CD manufacture
and playback can be entirely digital (in the
case of ‘DDD’ recordings) and phase errors
are reduced practically to zero.
The circuit shown here uses a quad opamp
(two opamps per channel) to produce ‘recordlike’ phase shifts. In the author’s experience
low- and mid-range CD players tend to have
*
C10
C9
R4
10u
63V
1u
L K3
C3
C8
C6
0
10u
63V
R8
10k
Sometimes, on first hearing a new low- to
mid-range CD player, the sound is not altogether convincing when compared to a
record player. It is worth looking at the
recording and replay processes as a whole
for both CDs and records to see why this
might be. Assuming that we start from the
same source, or master recording, of a given
piece of music, the differences are broadly as
follows.
C2
100k
Vinyl or CD: which has the better sound? It’s
a question still hotly debated among audiophiles everywhere. We will try to shed a little light on what lies behind the question and
look at a simple circuit that can significantly
enhance the sound from a CD player.
4
C5
11
10u
63V
IC1
IC1=TL084
081083 - 11
greatly attenuated output at higher frequencies, and the circuit therefore also offers the
facility to boost these components to taste.
The value of capacitors C8 and C14 may be
anywhere between 100 pF and 10 nF according to the frequency response desired.
output impedance of 1 kΩ or more the difference between cheap cables and more expensive low-capacitance cables can be noticeable. This circuit has an output impedance of
just 100 Ω and so cheaper cables should normally be more than adequate.
At the low-frequency end the response is
more than adequate, thanks to the large coupling capacitors used. The circuit also functions as a buffer or impedance converter,
which can help to reduce the effect of cable
capacitances. With CD players that have an
The circuit can of course also be used with
other digital audio sources such as minidisc
players, hard disk recorders, DAB tuners, digital terrestrial and satellite television receivers and so on. The supply voltage can be anywhere from 10 V to 30 V. It will often be possi-
elektor - 7-8/2009
Advertisement
ble to take power from the CD player’s own supply; if not, a separate
AC power adaptor can be used.
The output signal for each channel is inverted (i.e., is subjected to a
180 degree phase shift) by the second opamp (IC1.B and IC1.D). This
does not affect the operation of the circuit. By changing the value of
feedback resistors R4 (for IC1.B) and R12 (for IC1.D) the overall gain of
the circuit can be adjusted so that the output level matches that of
other components in the audio system.
Driving your loudspeakers
to a higher end
(081083-I)
Doubling Up with
the PR4401/02
Leo Szumylowycz (Germany)
Among the many interesting applications for the PR4401/02 devices
from Prema, some have already appeared in the 2008 edition of Elektor Summer Circuits. Over and above their unbeatable performance,
dependable operating range from 0.8 V upwards and minimal reliance
on peripheral components all we might ask for might be greater output current, in order to be able to fully exploit a 4-chip LED with 80 mA.
It would be handy too if one could replace the 9 V ‘block’ batteries used
in the more sophisticated LCD multimeters. With the fully tested circuit
presented here both problems can now be eliminated.
In the schematic shown two of these ICs are connected in parallel via
diodes to a single charge capacitor. If the need arises you can connect
even more of these ICs in parallel in the same way.
The value of inductance required is calculated in the same way as for
standard applications of the IC; 10 µH for the PR4401 with a current
of 20 mA and 4.7 µH for the PR4402 with a current of 40 mA.
To power an 80 mA LED with a single 1.5 V battery the circuit shown
needs to be equipped with PR4402s and 4.7 µH inductors. If you feel
like constructing the entire project with SMDs, you will need SMD
tantalum electrolytics (4.7 µF, 35 V) of style ‘A’ for C1 and C2 plus
Visit our website
for more details on
our new program
EUROPEAN DISTRIBUTOR
tel. +31 (0)595 49 17 48
fax +31 (0)595 49 19 46
info @ eltim.eu
advertentie En.indd 1
www.eltim.eu
28-05-09 16:18
SMD inductors such as Murata LQH3C-4.7µH for L1 and L2 (available
from RS Components, Farnell and Anglia Components).
(090129-I)
Internet Link
www.prema.com/pdf/
+0V8...+1V8
D1
1N4148
D2
L1
*
IC1
L2
*
IC2
PR4401/02
1
1N4148
*
*
PR4401/02
2
1
2
FF
FF
3
80mA
C2
C1
4u7
16V
4u7
16V
D3
3
PR4401/02
090129 - 11
1
3 GND
2
7-8/2009 - elektor
95
Pre-emphasis for FM Transmitter
Ton Giesberts (Elektor Labs)
Specifications
• Correction network for FM Transmitter 080727
• Also includes a 19-kHz filter
• Current consumption of 3 mA
as aerial and connected to the transmitter
board (it just so happens there is a via next
to C4).
To measure the effect of the pre-emphasis circuit we first measured the frequency
response of the output of a small radio. The
C3
+5V
R8
8
IC1
4
C8
100n
C6
47p
R3
10k
100k
Since the FM transmitter is a mono version, a
19 kHz filter has been included to prevent a
stereo FM receiver from mistakenly switching
to stereo mode due to the presence of 19 kHz
components in the received signal. Any signals around 19 kHz are blocked with the help
of a simple tuned circuit (L1/C4). R4 ensures
that the Q isn’t too large. Due to tolerances
you may find that the frequency can deviate
from 19 kHz (in our prototype the resonance
frequency was closer to 20 kHz). In view of the
value of the inductor, a through-hole version
has been used for this (see component list).
Without the parallel circuit the crossover
point of the correction network is about
16.7 kHz. This is more than enough for audio
via VHF FM. The addition of the parallel circuit causes the amplitude around 10 kHz to
increase a little, and the –3 dB point is then
reached at 13.5 kHz. In the prototype this cutoff point was about 1 kHz higher due to component tolerances.
The board designed for this circuit has been
kept as small as possible through the use of
SMDs for most components. The dimensions
of the FM transmitter board also played a part
here. To make it easier to connect this circuit
to the transmitter board, a connector was
included on this board. The supply voltage
and audio signals are carried via this connector. The board has been designed in such a
K1
R9
100k
This circuit was specially designed to be used
with the FM Audio Transmitter found elsewhere in this issue, but it can also be useful
as an addition to other transmitters.
The circuit uses a dual opamp. The first
opamp (IC1A) functions as a mixer and a
buffer for the following correction network. The input sensitivity can be adjusted
with the help of R3 (a lower value reduces
the sensitivity). The 50 µs correction for the
pre-emphasis is carried out by C5 and R6.
IC1B buffers the signal before it is fed to the
transmitter via K1.
R1
22k
C1
R2
22k
4u7
10V
L1
33mH
2
3
IC1A
C2
R4
100R
1
C4
47p
R7
15k
R5
15k
R6
3k3
2n2
C5
2n7
6
5
IC1B
7
C7
IC1=TLC082CD
4u7
10V
100n
090305 - 11
way that it can either be mounted behind the
FM transmitter or alongside it.
When the pre-emphasis board is used R1 and
R2 should be removed from the transmitter
board. When the circuit is mounted behind
the transmitter board it was found that the
FM signal strength was clearly reduced, so it
would be better if a length of wire was used
COMPONENT LIST
Resistors (all SMD 0805)
R1,R2 = 22kΩ
R3 = 10kΩ
R4 = 100Ω
R5,R7 = 15kΩ (24kΩ for 75 µs)
R6 = 3kΩ3 (3kΩ6 for 75 µs)
R8, R9 = 100kΩ
Capacitors
result of this can be seen in the graph (1 =
without pre-emphasis, 2 = with pre-emphasis). It can be clearly seen that the higher frequency components are attenuated by the
de-emphasis filter in the radio. When the preemphasis circuit is connected to the transmitter the result is an almost flat response above
1 kHz. The ‘bump’ around 100 Hz is caused by
a type of bass-boost in the radio to improve
C2,C8 = 100nF
C3,C6 = 47pF
C4 = 2nF2
C5 = 2nF7
Inductors
L1 = 33mH, e.g. 22R336C Murata Power Solutions
(Farnell # 1077046)
Semiconductors
IC1 = TLC082CD SO8 (Farnell # 8453713)
C1,C7 = 4µF7 10V
96
elektor - 7-8/2009
the quality of the sound. The low cut-off
point has risen slightly due to the inclusion
of two extra coupling capacitors in the preemphasis circuit, but in practice this will be
hardly noticeable. The current consumption
of the transmitter is increased by this circuit
from 2 to just over 5 mA.
The component values in the circuit diagram
are for 50 µs pre-emphasis. For adaptations
to 75 µs as used in the USA and other countries, please refer to the parts list.
(090305)
Download
090305-1: PCB layout (.pdf), from www.elektor.
com/090305
+9
+8
1
+6
+4
2
+2
+0
-2
d
B -4
r
A
-6
-8
-10
-12
-14
-16
-18
20
50
100
200
500
Hz
1k
2k
5k
10 k
20 k
090305 - 12
Sensitive Audio Power Meter
Michiel Ter Burg (The Netherlands)
C1
1k
10µ
R1
BC547B
T1
10k
R2
D1
D3
2k2
As a follow-up to the simple audio power
meter described in [1], the author has developed a more sensitive version. In practice,
you rarely use more than 1 watt of audio
power in a normal living-room environment.
The only time most people use more is at a
party when they want to show how loud their
stereo system is, in which case peaks of more
than 10 W are not uncommon.
With this circuit, the dual LED starts to light up
green at around 0.1 watt into 8 ohms (0.2 watt
into 4 ohms). Naturally, this depends on the
specific type of LED that is used. Here it is
essential to use a low-current type. The capacitor is first charged via D1 and then discharged
R3
2x
1N4148
D2
R4
level of 1 watt, the transistor limits the current
through the green LED and the red LED conducts enough to produce an orange hue. The
red colour predominates above 5 watts.
Of course, you can also use two separate,
‘normal’ LEDs. However, this arrangement
cannot generate an orange hue. For any testing that may be necessary, you should use a
generator with a DC-coupled output. If there
is a capacitor in the output path, it can cause
misleading results.
(090203-I)
DUO-LED
1k
090203 - 11
Reference
via the green LED. This voltage-doubler effect
increases the sensitivity of the circuit. Above a
[1] Simple Audio Power Meter, Elektor July & August
2008.
Bathroom Fan Controller
Heino Peters (The Netherlands)
Many bathrooms are fitted with a fan to vent
excess humidity while someone is showering. This fan can be connected to the light
switch, but then it runs even if you only want
to brush your teeth. A better solution is to
equip the fan with a humidity sensor. A disadvantage of this approach is that by the time
the humidity sensor switches on the fan, the
room is already too humid.
Consequently, we decided to build a circuit
that operates by sensing the temperature of
the hot water line to the shower. The fan runs
as soon as the water line becomes hot. It con-
7-8/2009 - elektor
tinues to run for a few minutes after the line
cools down, so that you have considerably
fewer problems with humidity in the bathroom without having the fan run for no reason. Naturally, this is only possible if you can
fit a temperature sensor somewhere on the
hot water line and the line does not become
warm if hot water is used somewhere else.
We use an LM335 as the temperature sensor.
It generates an output voltage of 10 mV per
Kelvin. The output voltage is 3.03 V at 30 °C,
3.13 V at 40 °C, 3.23 V at 50 °C, and so on.
We want to have the fan switch on at a temperature somewhere between 40 and 50 °C
(approx. 100–150 °F). To do this accurately,
we first use the opamps in IC2 to improve
the control range. Otherwise we would have
an unstable circuit because the voltage differences at the output of IC1 are relatively
small.
IC2a subtracts a voltage of exactly 3.0 V from
the output voltage of IC1. It uses Zener diode
D1 for this purpose, so this is not dependent on the value of the supply voltage. The
value of R2 must be selected according to
the actual supply voltage so that the current through D1 is approximately 5 mA. It is
600 Ω with a 6-V supply (560 Ω is also okay),
or 2400 Ω (2.2 kΩ) with a 15-V supply. If you
have to choose between two values, use the
lower value.
97
+6V...+15V
R6
R11
8
8
IC2
IC3
4
4
3
100k
100k
10k
2
100k
R3
1
IC2.A
5
1k
R7
LM335
RE1
3
2
1
IC3.A
T1
6
IC3.B
5
IC2 = LM358
IC3 = LM393
R8
R13
15k
R5
7
BC517
1k
D1
1k
IC1
D2
1N4001
15k
6
R9
7
IC2.B
R14
R10
P1
100k
R4
R12
3k3
*
1k
R2
10k
3k3
R1
3V0
0W5
090078 - 11
IC2b amplifies the output voltage of IC2a
by a factor of 16 ((R7 + R8) ÷ R8). As a result,
the voltage at the output of IC2b is 0.48 V at
30 °C, 2.08 V at 40 °C (104 °F), and 3.68 V at
50 °C (122 °F). Comparator IC3a compares this
voltage to a reference voltage set by P1. Due
to variations resulting from the tolerances of
the resistor values, the setting of P1 is best
determined experimentally. A voltage of 2.5 V
on the wiper should be a good starting point
(in theory, this corresponds to 42.6 °C). When
the water line is warm enough, the output of
IC3 goes Low.
R10 provides hysteresis at the output of
IC3a by pulling the voltage on the wiper of
the setting potentiometer down a bit when
the output of IC3a goes Low. IC3b acts as an
inverter so that relay Re1 is energised via T1,
which causes the fan to start running. After
the water line cools down, the relay is deenergised and the fan stops. If this happens
too quickly, you can reduce the value of R11
(to 33 kΩ, for example). This increases the
hysteresis.
The circuit does not draw much current, and
the supply voltage is non-critical. A charging
adapter from a discarded mobile phone can
thus be used to power the circuit. If the supply voltage drops slightly when the relay is
energised, this will not create any problem.
In this case the voltage on the wiper of P1 will
also drop slightly, which provides a bit more
hysteresis on IC3a.
(090078-I)
Backlight Delay
Clemens Valens (Elektor France)
98
VCC
*
R2
R5
*
D1
T1
R1
10k
D2
1N4148
R3
T2
C1
R4
2M7
*
D4
BC557
100R
1N4148
S1
Dn
10u
1N4148
090454 - 11
don’t have the source codes or tools needed
to modify the software. The circuit described
BACKLIGHT
R6
10k
Lots of devices are fitted with a
liquid crystal display (LCD). Now
LCD implies backlighting — that
rather useful option that enables
us to read the message being displayed! For devices where there’s
uC
no need to read the display continuously, the backlight doesn’t
need to stay lit up all the time —
several seconds is often all you
need to read the display. This
saves a little power and lengthens
the life of the backlight. Devices
fitted with an LCD also have a
processor, and so it’s possible to
employ a function to control the
backlight directly from within the
processor software. But sometimes it’s not possible to implement this sort of function within
the microcontroller, because all the controller’s pins are already in use, or because you
here has been designed for just
such cases.
BS170
A device using an LCD usually
has at least one button that,
in most cases, pulls one of the
microcontroller inputs down to
0 V when it is pressed. If no such
button exists, one can always
be added. We can use the signal
from this button to control the
backlight. As soon as the button
is pressed, the backlight is activated, then extinguished a few
seconds later by the timer. Using
an OR gate, it’s possible to use
several different buttons to trigger the timer.
It doesn’t take many components
to build a timer like this. The OR
gate consists of a pull-up resistor
R1+R2 and as many diodes as there are buttons. Thanks to these diodes, transistor T1
elektor - 7-8/2009
conducts while the button is pressed, and
hence capacitor C1 is charged, the MOSFET
T2 conducts, and the backlight comes on.
Because R3 has a very low value, capacitor
C1 charges very rapidly, so even a very brief
press of one of the buttons is enough to trigger the timer. Once the button is released,
T1 turns off, and C1 then discharges slowly
through R4 alone, since T2 has a very high
input impedance. When T2’s gate voltage
falls low enough, it turns off and the backlight goes out. The time the backlight stays
lit after all the buttons have been released is
roughly R4 (Ω) × C1 (F) seconds.
applications too, and can be used to switch
things other than an LED — for example, a
relay. The value of R5 depends on the load
being switched. For an LED running off a
5 V supply, a value of around 300 Ω will be
about right.
(090454-I)
Of course, this circuit can be used for other
Power On Indicator
Ton Giesberts (Elektor Labs)
Some types of electronic equipment do
not provide any indication that they are
actually on when they are switched on.
This situation can occur when the backlight of a display is switched off. In addition, the otherwise mandatory mains
power indicator is not required with
equipment that consumes less than
10 watts. As a result, you can easily forget
to switch off such equipment. If you want
to know whether equipment is still drawing power from the mains, or if you want
to have an indication that the equipment
is switched on without having to modify the equipment, this circuit provides
a solution.
7-8/2009 - elektor
D1...D6 = FR606/PR6006
K1
D1
D2
D3
D4
D5
D6
R1
22R
C1
D8
100u
10V
BAT85
K2
V+
D7
C2
BAT85
1000u
16V
D9
T1
100u
10V
BC550C
R5
C4
V+
R6
560R
R4
15k
C3
150k
R3
1M5
R2
15k
One way to detect AC power current and
generate a reasonably constant voltage
independent of the load is to connect a
string of diodes wired in reverse parallel in series with one of the AC supply
leads. Here we selected diodes rated
at 6 A that can handle a non-repetitive
peak current of 200 A. The peak current
rating is important in connection with
switch-on currents. An advantage of
the selected diodes is that their voltage
drop increases at high currents (to 1.2 V
at 6 A). This means that you can roughly
estimate the power consumption from
the brightness of the LED (at very low
power levels).
The voltage across the diodes serves as
the supply voltage for the LED driver. To
increase the sensitivity of the circuit, a
cascade circuit (voltage doubler) consisting of C1, D7, D8 and C2 is used to double
the voltage from D1–D6. Another benefit
of this arrangement is that both halvewaves of the AC current are used. We use
Schottky diodes in the cascade circuit to
minimise the voltage losses.
The LED driver is designed to operate the LED
in blinking mode. This increases the amount
of current that can flow though the LED when
it is on, so the brightness is adequate even
with small loads. We chose a duty cycle of
470n
T2
BC550C
090400 - 11
approximately 5 seconds off and 0.5 second
on. If we assume a current of 2 mA for good
brightness with a low-current LED and we can
tolerate a 1-V drop in the supply voltage, the
smoothing capacitor (C2) must have a value of
1000 µF. We use an astable multivibrator built
around two transistors to implement a
high-efficiency LED flasher. It is dimensioned to minimise the drive current of
the transistors. The average current consumption is approximately 0.5 mA with a
supply voltage of 3 V (2.7 mA when the
LED is on; 0.2 mA when it is off). C4 and
R4 determine the on time of the LED (0.5
to 0.6 s, depending on the supply voltage). The LED off time is determined by
C3 and R3 and is slightly less than 5 seconds. The theoretical value is R × C × ln2,
but the actual value differs slightly due to
the low supply voltage and the selected
component values.
Diodes D1-D6 do not have to be special
high-voltage diodes; the reverse voltage is only a couple of volts here due
the reverse-parallel arrangement. This
voltage drop is negligible compared to
the value of the mains voltage. The only
thing you have to pay attention to is the
maximum load. Diodes with a higher
current rating must be used above 1 kW.
In addition, the diodes may require cooling at such high power levels.
Measurements on D1–D6 indicate that
the voltage drop across each diode is
approximately 0.4 V at a current of 1 mA.
Our aim was to have the circuit give a
reasonable indication at current levels
of 1 mA and higher, and we succeeded
nicely. However, it is essential to use a
good low-current LED.
Caution: the entire circuit is at AC
power potential. Never work on the circuit with the mains cable plugged in. The
best enclosure for the circuit is a small,
translucent box with the same colour as
the LED. Use reliable strain reliefs for the
mains cables entering and leaving the
box (connected to a junction box, for
example). The LED insulation does not
meet the requirements of any defined insulation class, so it must be fitted such that it
cannot be touched, which means it cannot
protrude from the enclosure.
(090400-I)
99
Two TV Sets on a Single Receiver
Most digital receivers have two SCART connectors for connecting a television set and a
video recorder. The second SCART connector
can be used quite nicely for the signals to be
sent to the second TV set (see the connection diagram in Figure 3). If this connector is
100
3
090077 - 13
2 AUDIO R IN
The circuit necessary for converting the infrared signal received by the second TV set into
AUDIO R OUT 1
10k
You’ll need a length of
four-way shielded cable
(such as Conrad Electronics # 606502) for the connection between the digital receiver and the second TV set. Two shielded
conductors are used to
transmit the audio signals (L and R) from the
receiver to the second TV
set, another one is used to
transmit the video signal,
and the last one is used
to transmit the remote
control signal from the remote control for
the second TV set to the digital receiver
located next to the first TV set. The infrared
sensor of the second TV set receives the signal from the remote control unit for the digital receiver and sends it via a small circuit to
an IR LED aimed at the infrared sensor of the
digital receiver near the first TV set. With this
arrangement, it’s convenient to buy a second
(programmable) remote control unit so you
don’t have to carry the original remote control unit of the digital receiver back and forth
all the time.
4 AUDIO GND
R2
AUDIO L OUT 3
+5V
6 AUDIO L IN
2
10k
IR-LED
VIDEO GND 17
TV SCART
20 VIDEO IN
TV1
The infrared signal from
the remote control unit
consists of short pulse
trains of modulated infraTV2
red light. The modulation
frequency varies from
PCB
one brand to the next and
lies in the range of 30 to
VCR SCART
56 kHz (B&O, different as
AUDIO-L
AUDIO-R
always, uses 455 kHz). FreVIDEO
quencies in the 36–40 kHz
range are most often used
090077 - 12
IR
in practice. The modulation frequency of an
infrared sensor is usually indicated in its type
number. For example,
the TSOP1736 responds
to IR light modulated at
P1
T1
C2
36 kHz, the TSOP1738
1k
likes 38 kHz, and so on.
10u 16V
BC555
Figure 4 shows a few
IR receivers and their
4
8
pinouts. Infrared sensors
R
7
also have adequate senDIS
R1
D1
IC1
R4
sitivity to other frequen3
OUT
22R
cies close to their design
2
D2
TR
555
6
frequency. Consequently,
THR
1N4148
we assume a modulaCV
R3
5
1
C1
tion
frequency of 38 kHz
LD274
here,
which covers the full
10n
range from 36 to 40 kHz.
The IR receiver demodu090077 - 11
lates the infrared signal.
The demodulated signal
already in use, you can always take the audio forms the input to our circuit, which uses it
and video signals from the Cinch connectors to generate a new modulated signal for the IR
(if present).
LED located next to the digital receiver.
VIDEO OUT 19
With the advent of digital television, it’s often
necessary to use a separate receiver. If you have
several television sets
in your house, you have
to buy a digital receiver
(and accompanying subscription) for each set.
The solution described
here lets you watch television in two or more
places in your home using
a single digital receiver,
while allowing the digital
receiver to be controlled
from both locations. The
circuit needed for this is
powered from one of the
two television sets (see
Figure 1).
a new signal for driving
the infrared LED at the
digital receiver location is
shown in Figure 2).
1
10k
Heino Peters (The Netherlands)
The author opened up his second TV set
(watch out for possible sources of high voltage inside the set!) in order to use the set’s
built-in IR receiver and tap off power for the
modulator circuit. However, you can also fit
the circuit with its own IR receiver and use a
separate power supply (AC mains adapter).
The output signal of the IR receiver is used to
trigger an astable multivibrator built around
our old friend, a 555 timer IC. The data line of
the IR sensor is High in the quiescent state
and goes Low when it receives an modulated IR signal. As the Reset input of the 555
responds to an active-low signal, an inverter
is built around T1, R2 and R3. The modulation
elektor - 7-8/2009
frequency for IR LED D2 is set to approximately 38 kHz by P1, R1 and C1. Diode D1
allows the duty cycle of the output signal to be less than 50%, which cannot be
achieved otherwise. The rise time of the
oscillator signal on the Threshold input
of the 555 is set by P1 and C1, while the
fall time is set by R1 and C1.
4
The ratio of P1 to R1 determines the
duty cycle, which is approximately 30%
in this case. With a 5-V supply voltage,
P1 is set to 1 kΩ, but it must reduced to a
lower value (around 500 Ω) with a lower supply voltage. If possible, use an oscilloscope
to adjust the oscillator frequency to 38 kHz
TSOP1736
SFH506
TFMS5360
SFH505A
PIC12043S
TSOP1836 TSOP4836
IS1U60 NJL61H380 SFH5110
090077 - 14
(period: 26.3 μs). To generate a test signal at
the 555 output, temporarily connect the circuit input to ground.
Place IR LED D2 in front of the digital receiver so it shines on the receiver’s IR sensor. Use the screen of the
fourth shielded conductor of the cable
between the receiver and T V2 for
the negative lead of D2. Resistor R4 is
dimensioned for a current of around
100 mA through the IR LED. If you use
a 3.3-V supply voltage, R4 must be
reduced to 3.3 Ω.
You can also use this circuit for the
remote control of audio or video equipment located inside a closed cabinet.
(090077-I)
Tester for Inductive Sensors
Hugo Stiers (Belgium)
In order to judge the quality of the signal
from the sensor, you must turn the wheel
very slowly. If the red LED blinks, this means
that the sensor is generating a signal and the
distance between the sensor and the pole
wheel (gear wheel) is set correctly. If the distance (air gap) is too large, the sensor will not
generate a signal when the wheel is turned
+9V
R4
820k
R1
8
10k
R2
IC1
4
2
1k
3
IC1.A
1
5
IC1 = LM358
7
R6
R5
4k7
R3
IC1.B
2k2
6
1k
This tester uses a LED to indicate
whether an inductive sensor is generating a signal. It can be used to test
the inductive sensors used in ABS and
EBS systems in cars, with engine camshafts and flywheels, and so on.
The circuit is built around an LM358
dual opamp IC. The weak signal coming from the sensor (when the wheel
is turning slowly, for example) is an
AC voltage. The first opamp, which
is wired here as an inverting amplifier, amplifies the negative half-cycles
of this signal by a factor of 820. The
second opamp is wired as a comparator and causes the red LED to blink
regularly.
D1
090316 - 11
slowly, with the result that the LED will remain
dark, but it will generate a signal if the wheel
is turned faster and the LED will thus start
blinking. Irregularities in the blinking rate can
be caused by dirt on the sensor or damage to
the pole wheel (gear wheel).
If you connect an oscilloscope to the LED with
the engine running, you will see a square-
wave signal with a pattern matching
the teeth of the gear wheel, with a frequency equal to the frequency of the
AC signal generated by the sensor.
You can also use this tester to check
the polarity of the connecting leads.
To do this, first dismount the sensor
and then move it away from a metallic object. The LED will go on or off
while the sensor is moving. If you now
reverse the lead connections, the LED
should do exactly the opposite as
before when the sensor is moved the
same way.
The circuit has been tested extensively
in several workshops on various vehicles, and it works faultlessly.
The author has also connected the tester to
sensors on running engines, such as the camshaft and flywheel sensors of a Volvo truck
(D13 A engine). With the camshaft sensor, the
LED blinks when the engine is being cranked
for starting, but once the engine starts running you can’t see the LED blinking any more
due to the high blinking rate.
(090316I-I)
USB Radio Terminal
Rainer Schuster (Germany)
In the January 2009 issue of Elektor we saw
how straightforward it is to connect a lowcost RFM12 868 MHz ISM (licence-free) radio
module to an ATmega microcontroller. Sim-
7-8/2009 - elektor
ple example listings in BASCOM demonstrated how to communicate data using the
modules [1].
The ‘USB radio terminal’ circuit described
here connects an RFM12 radio module to the
R8C/13 microcontroller board used in the
‘Transistor Curve Tracer’ project described in
the February 2009 issue [2]. The populated
board, complete with USB interface connec-
101
P1.0
P1.2
P1.3
SEL
P1.1
SDI
SCK
+5V
GND
SDO
ANT
tor, is available from the Elektor shop.
The circuit can be used to transfer data (for
example from a PC terminal emulator program) wirelessly to another microcontroller
and vice versa. Of course, the remote microcontroller also needs to be equipped with a
radio module.
As ready-made and tested boards are available (even the radio module is available
from Elektor [3]) building the circuit does not
present any great difficulty. All that is necessary is to connect a total of six pins of K1 on
the R8C/13 microcontroller board to pins on
the radio module. The 5 V and ground pins
are connected directly to their namesakes so
that the radio module draws its power from
the microcontroller board. The SPI port on
the radio module is driven from port pins
P1.0 to P1.3 on the microcontroller: see the
‘circuit diagram’.
The microcontroller module will receive its
power over the USB cable when it is connected to a PC.
The author has written R8C firmware in C,
available for download in source or hex format from the Elektor website. The C source
can be edited and compiled using the ‘High
Performance Embedded Workshop’ IDE by
Renesas [2], and further information is available from the R8C pages of the Elektor website [4]. The Motorola hex file can be downloaded over the USB port using the Flash
Development Toolkit [2][4]. To enter programming mode jumper JP1 must be fitted
on the microcontroller board and the reset
button pressed briefly. After programming is
complete, don’t forget to remove the jumper
and press the reset button again.
The firmware mostly consists of the BASCOM
routines written by Burkhard Kainka [1], modified and converted into C. Extra functions
have been added to handle the UART1 interface, which is connected to the USB interface
chip.
On the transmit side, the program waits for
characters to arrive over the USB port and
stores them in an intermediate buffer. When
20
2
1
19
090372 - 11
the sequence <CR> <LF> is received the line
of characters is sent to the radio module
transmitter using a special protocol.
On the receive side, the program waits for
characters from the radio module receiver.
When the <STX> control code (‘start of text’,
0x02) is received, the subsequent characters
are buffered until the stop code <ETX> (‘end
of text’, 0x03) is received. The transmitted
message includes a trailing checksum, so the
complete sequence of characters is <STX>
<string> <checksum> <ETX>. If the checksum is correct, it, along with the <STX> and
<ETX> characters, is discarded, <CR> <LF> is
appended, and the resulting string sent out
over the USB port to the PC.
Of course, strings and commands can be
sent over the radio link to other applications.
In some cases the protocol will have to be
adapted. In particular, because of the limited
available RAM on the R8C/13 (1 kB) the intermediate buffer is only 200 bytes long. This
should be adequate for most uses.
As configured, the software uses a data transfer rate of 9600 baud with 8 data bits, 1 stop
bit, no parity and no handshake. The terminal
program (for example, Hyperterminal) must
be configured to match these settings.
their button, and so is allowed to answer the
question. The project described here shows
how to build a similar sort of refereeing
device yourself, using simple resources and
without needing a microcontroller, which is
pretty rare these days! The basic circuit is for
just two contestants, but the modular design
means it can easily be expanded.
The diagram shows three buttons: S2 and S3
are the buttons for the two contestants, S1 is
the button for the host, which allows them to
reset the circuit before each fresh question.
The ‘brains’ of the circuit is IC1, a 4013 dual Dtype flip-flop, of which only the Set and Reset
inputs are used here. This circuit can handle
quite a wide supply voltage range, from 3 to
15 V, and so the project can easily be run off
(090372-I)
Internet Links
[1] www.elektor.com/071125
[2] www.elektor.com/080068
[3] www.elektor.com/090372
[4] www.elektor.com/service/r8c---information.78378.
lynkx
Products
071125-71: 868 MHz radio module, populated and
tested, available via [3]
080068-91: R8C microcontroller board, populated and
tested, available via [3]
Download
090372-11: source code and hex files, from [3]
Going for Gold
Joseph Kopff (France)
The title refers to a popular TV game show
where the contestants each have a big button. The gameshow host asks a question
and the first contestant to press their button makes an illuminated indicator light up
on their desk. The other contestants’ buttons
are automatically inhibited, so that everyone
can see who was the first contestant to press
102
elektor - 7-8/2009
+VDD
+4V5
R5
IC1
330 Ω
10k
R8
14
330 Ω
R1
IC1 = 4013
7
D1
D3
A
T1
6
S1
5
RESET
3
S
D
2N
2222
8
D2
1
IC1.A
C
R4
T2
S3
9
2
11
1N4148
R
D
S
IC1.B
C
4
R7
2N
2222
D4
13
12
1N4148
R
B
10
R6
100k
R3
100k
R2
4k7
4k7
S2
10k
a 4.5 V battery pack (the power consumption
is minimal).
IC1 is armed by pressing S1 (reset). In this
state, the non-inverting outputs (pins 1 and
13) are at 0 and the inverting outputs (pins 12
and 12) are at 1. Hence line A is pulled high
by R1, since diodes D2 and D4 are not biased
on. If contestant 1 presses button S2, the
non-inverting output of flip-flop IC1a goes
to logic 1, and LED D1 lights via T1 to indicate that contestant 1 has pressed the button. At the same time, the flip-flop’s inverting output goes to logic 0, making diode
D2 conduct. Line A is now pulled down to 0,
and consequently contestant 2’s button S3
can no longer trigger the second flip-flop.
The reverse happens if it is contestant 2 who
presses their button S3 first.
081183 - 11
The circuit can be extended to 4 or 6 contestants (or even more) by adding a second or
third (or more) 4013 IC. All you have to do is
repeat the circuit (minus R1, R2, and S1) and
connect to the A, B, Vdd, and 0 V lines on the
right-hand side.
(081183-I)
Cut-rate Motorbike Alarm
7-8/2009 - elektor
*
B
*
S1
R1
R2
10k
T2
BT1
TR1
BC557
12V
BC547B
BZ1
D2
D1
R4
RE1
12V
1N4148
R3
1N4148
470Ω
T1
1M5
Motorbikes are often a target for thieves.
Here is an alarm that’s loud, cheap and simple
to build. Arming and disarming the alarm is
done with a hidden switch, S1. This tiny circuit
does not unduly load the battery, as it draws
very little current in the standby condition.
To activate the alarm, turn or press the hidden switch S1 to the ‘on’ position. If anyone
attempts to start the motorbike, +12 volts
from the ignition switch (connected to ‘B’)
causes transistor T1 to conduct and switch on
T2. The siren (LS1) then sounds for about 20
seconds, the period being determined by FET
T3 wired as a monostable timer. The siren is
a high-power ready-made piezo horn of the
self-oscillating type.
Another piezoelectric component in the circuit has a different purpose — Bz1 detects
attempts to tamper with the vehicle, or move
it without starting the engine. The piezo transducer element should be mounted in such a
way as to faithfully pick up vibration from the
motorbike frame due to tampering.
One set of contacts on relay RE1 is used to
effectively disconnect the ignition coil to prevent the bike from functioning when someone tries to steal it. Usually, there is a wire
running from the alternator (point A) to the
ignition coil (TR1), which has to be routed
through the N/C (normally closed) contact
of the relay. The hidden switch S1 is prefer-
A
10k
T.A. Babu (India)
LS1
C1
10µ
16V
T3
BS170
090338 - 11
ably a miniature type or its electrical equivalent. To deactivate the alarm, the hidden
switch should be flipped to the ‘off’ position
to disable the movement sensor and the siren
driver/timer circuit when the ignition key is
turned… by the lawful owner!
(090338-I)
103
Digital Sweep and Sinewave Generator
with
direct frequency entry
Wilfried Wätzig (Germany)
The Parallax SX28-based ‘Frequency Response Sweep Oscillator’ project published in the April
2008 issue of Elektor inspired the
author to develop a similar circuit
based on the ATmega48 microcontroller. As it turns out, the ATmegabased circuit is nearly as capable
as the original.
An important characteristic of the
design is the maximum direct digital synthesis (DDS) sample rate
that can be achieved when generating a sinewave. The specifications are comparable:
f DDS = 50 MHz /
28 cycles = 1.78 MHz
ATmega48 design:
f DDS = 25 MHz /
18 cycles = 1.39 MHz
SX28 design:
‘*12000#’. The usable frequency
range runs from around 10 Hz to
500 kHz.
In order to ensure that a clean output signal is produced the timer
interrupt is disabled during sinewave generation. If a button is
pressed a pin change interrupt is
triggered which enables the timer
so that a new frequency value can
be entered.
The sinewave frequency accuracy
and stability are determined by
the quality of the 25 MHz crystal.
There may also be a small error in
absolute frequency resulting from
rounding errors in the calculation
of the DDS phase accumulator
increment value.
The DDS phase accumulator increment value is derived from a set of
values stored in a look-up table:
increment = freq * 224 * cycles / fosc
for freq = 2k , k = 0 to 19. The total
increment value is calculated to 24
bits of precision.
The main features of the unit are
At 25 MHz, the ATmega48 is somewhat overclocked in this circuit.
listed in the text box, and the funcThe maximum specified clock fretions of switches S1 to S3 are given
quency according to the datasheet is 20 MHz. In sinewave generation mode the desired in Table 1.
In practice, however, this does not seem to frequency is entered directly on the keypad The digital outputs on Port B are protected
lead to problems.
in Hertz. For example, to enter 12 kHz, type from short circuits by series resistors. The
The other important part of the ciramplitude of the sinewave outcuit is the digital-to-analogue conput can be set between 0 VPP and
verter (DAC) connected to Port D
4.5 VPP using P1.
Characteristics
of the microcontroller. This takes
Digital sweep function:
the form of an R-2R network and
The ATmega48 chip can be pro• Frequency ranges: 100 Hz to 100 000 Hz or 50 Hz to 15 000 Hz,
can approximate a sinewave with
grammed using the 10-way ISP
• logarithmic scale with 256 steps
interface connector provided. The
a sample rate of 1.39 MHz. The dig• 2 sweep rates: 0.2 ms or 0.4 ms per frequency value
ital values are read from a look-up
firmware for this project was writ(phase accumulator increment value changed every 0.2 ms or 0.4 ms)
table.
ten in assembler using the Atmel
A passive six th- order But terAVR Studio 4 development sysOutputs in sweep mode:
worth low-pass filter with a cortem, version 4.14. The project files
• sine output
(source code and hex) are availner frequency of 500 kHz is used
• marker frequency (rectangular wave)
to smooth the DAC output. This
able for free download from the
• marker position pulse
is particularly necessary at higher
Elektor website [1]. The zip file also
• trigger pulse at start of each sweep
frequencies.
includes a screenshot showing
Digital sinewave operation:
the fuse settings required for the
• Direct frequency entry in Hertz via keypad
The user interface is principally
microcontroller in AVR Studio 4. As
• Format: ‘*’ = start of entry
provided via a twelve-button telan alternative to the program-it digit(s) 0 to 9
ephone-style keypad. In sweep
yourself route, ready-programmed
‘#’ = end of entry, start sinewave generator
mode the four rows of buttons
microcontrollers are available from
(1-2-3, 4-5-6, 7-8-9 and *-0-#) are
the Elektor Shop.
Outputs in sinewave mode:
used to adjust the marker fre(080577-I)
• sine output (0 VPP to 4.5 VPP)
quency up and down in coarse or
• frequency/marker pulse (rectangular wave)
Internet Link
fine steps.
104
elektor - 7-8/2009
[1] www.elektor.com/080577
Table 1. Function of switches S1 to S3
Downloads and products
S1 (frequency sweep range)
S2 (sweep rate)
S3 (sinewave/sweep output)
080577-41: ready-programmed ATmega48
microcontroller
080577-11: source code and hex files, from www.
elektor.com/080577
+5V
Open
Closed
50 Hz to 15 kHz
100 Hz to 100 kHz
0.2 ms
0.4 ms
sinewave output
sweep output
+5V
+5V
R27
15
4k7
16
4k7
17
K7
18
R22
R21
R20
K4
Keyboard
19
1
2
3
ROW3
27
4
5
6
ROW2
26
ROW1
25
24
8
9
COL3
*
0
#
COL1
28
R2
20
20k
AVCC
IC3
PB0(ICP)
20k
PB3(MOSI/OC2)
PB4(MISO)
PD7(AIN1)
PB5(SCK)
PD6(AIN0)
PD4(XCK/T0)
PC5(ADC5/SCL)
PD3(INT1)
PC4(ADC4/SDA)
PD2(INT0)
PC3(ADC3)
PD1(TXD)
PC2(ADC2)
PD0(RXD)
13
12
P1
C11
C12
C13
120p
75p
15p
20k
11
6
5
4
20k
2
20k
XTAL1 XTAL2 AGND
10
22
S2
S1
C9
R12
25MHz
20k
R13
5
IC4.B
C14
7
10µ
K5
R29
Output
IC1
K1
D1
+12V DC 1N4007
C1
C2
C3
C4
100µ
100n
47µ
100n
+8V
IC2
R15
Wobbulator/ Wobbulator Frequency
Sine wave gen.
rate
range
+8V
78L08
8
R16
20k
20p
+5V
7805
R14
R8
C8
20k
20p
6
10k
R7
X1
S3
R28
R26
R6
9
+5V
R11
R5
3
PC0(ADC0)
8
4k7
IC4 = CA3240
R4
PC1(ADC1)
GND
R10
R3
PB2(SS/OC1B)
ATmega48-20
R24
R23
1
PC6(RST)
PB1(OC1A)
10k
10k
D4
D3
23
D2
COL2
3x
1N4148
7
VCC
PD5(T1)
ROW4
7
L3
1mH
100k
R19
14
4k7
21
AREF
10k
R18
R9
470k
ISP
R17
K3
L2
2mH2
10k
9
L1
2mH2
1
IC4.A
10k
7
3
10k
8
10
2
10k
5
20k
10k
6
100n
R1
10k
3
10k
4
4k7
Marker
Display
1
4k7
Sweep
Trigger
C7
2
4k7
Marker
Frequency
K2
R25
220k
K6
C10
IC4
4
C5
C6
100n
47µ
100n
080577 - 11
Guitar Amplifier PSU
Malcolm Watts (New Zealand)
7-8/2009 - elektor
R1
+HT
D1
1
260V
Tubes (thermionic valves) have never
departed from the amplified instrument scene and the majority of guitarists, including very young ones,
wouldn’t use anything else. Some diehards think that the H.T. (high tension)
rectifier should also be a piece of glassware and some manufacturers are still
producing amplifiers incorporating
one. The nett effect is really that a rectifier tube acts as a relatively effective
heat-dissipating resistor, causing the
HT rail to sag as output signal loading
increases, generating a compressive
characteristic which is fundamentally
added distortion (‘crunch’).
The traditional arrangement uses a cen-
TR1
V1
3
4
5
D2
7
EZ81
6CA4
230V
110V
6V3
1A
6V3
081067 - 11
tre-tapped HT winding on the power
transformer but this has a number of
drawbacks for an adequately rated core
size including increased voltage stress,
small wire size and a poor utilisation of
the available winding window.
The example arrangement shown here
reduces both of these problems and for
a given core increases the current delivery capability of the winding by allowing the use of a heavier wire gauge. Normally some resistance is added in series
to each anode to limit peak cathode
current to minimise cathode-stripping
during the high current pulses delivered to the input filter capacitor at each
voltage peak. Even if one includes such
resistance (and a single resistor in series
with the cathode or winding achieves
105
the same end albeit with double the device
dissipation) the benefits to the transformer
of reduced voltage stress and increased wire
insulation thickness (which scales with wire
diameter) along with decreased heating in
the windings, are obvious.
Alternatively, a smaller winding window
(reduced core size) may be employed without diminishing power-handling capacity.
The circuit shown here should is typically
intended for the amplifier preamp and phase
splitter stages. Due to the use of the EZ81
(6CA4) tube its maximum output current is
about 100 mA. Higher currents call for a more
powerful rectifier tube and diodes to match.
(081067-I)
Acoustic Distress Beacon
Werner Ludwig (Germany)
R2
10M
An ELT (Emergency Locator Transmitter, also
known as a distress beacon) is an emergency
radio transmitter that is activated either manually or automatically by a crash sensor to aid
the detection and location of aircraft in distress. This acoustic ELT project is intended for
radio-control (RC) model aircraft, which every
now and then decide to go their own way and
disappear into the undergrowth.
C3
BZ1
IC1
4µ7
25V
7
5VDC
BT1
K1
1
2
IC1.A
&
3
D1
5
IC1.B
4
1N4148
R3
J1
68K
6
&
10
9
T1
IC1.C
&
R4
100k
R1
The audio locating device described here
enables model aircraft that have landed ‘off
limits’ to be found again and employs its own
independent power supply. The small camera battery shown in the circuit activates an
acoustic sounder when radio contact is lost
and produces a short signal tone (bleep)
every ten seconds for more than 25 hours.
Current consumption in standby and passive (with jumper J1 set) modes is negligible.
The timing generator for the alarm tone is
the Schmitt trigger AND-gate IC1.B; its asymmetric duty cycle drives a 5 V DC sounder via
14
IC1 = 74HCT132
8
BS170
10M
6V
GP11A
D2
C1
C2
10n
4µ7
25V
1N4148
090037 - 11
MOSFET transistor T1. All the time that the RC
receiver output is delivering positive pulses,
the oscillator is blocked by IC1.A and diode
D1. Setting jumper J1 parallel to C2 also disables the oscillator and serves to ‘disarm’ the
distress beacon.
Internet Link
http://en.wikipedia.org/wiki/Emergency_PositionIndicating_Radio_Beacon
(090037-I)
Measuring Milliohms with a Multimeter
Klaus Bertholdt (Germany)
R2
120R
K1
Measuring low values of resistance is not
easy. Low cost multimeters do not include a
milliohm measurement range and special-
106
S1
R4
1k2
The circuit supplies a fixed current output of 100 mA or 10 mA
selected by switch S1. This conM1
D1
C1
C2
nects either the 60 Ω or 600 Ω
Rx
resistor
into the constant current
1u
10u
1N4004
63V
63V
generator circuit. The resistor
values are produced by parallel080851 - 11
ing two identical resistors; 120 Ω
and 1.2 kΩ from the E12 standard resistor range. Two test leads
ist equipment is expensive. The simple cir- with probes are used to deliver current to the
cuit described here allows milliohm meas- test resistance. The resultant voltage drop is
urements to be made safely on a standard measured by the multimeter (M1). With the
1
9 VDC
300 mA
IC1
7806
R3
1k2
multimeter. The circuit consists
of little more than a 6 V voltage
regulator and a mains adapter
capable of supplying around
300 mA at 9 to 12 V.
3
2
Low values of resistance can be
troublesome especially when
large currents flow through
them. A current of, say, 10 A
passing through a terminal with
a contact resistance of 50 mΩ
will produce a voltage difference
of 0.5 V. This resulting power loss
of five watts is dissipated in the
termination and can give rise to
a dangerously high temperature
which may degrade insulation
around the wires.
R1
120R
elektor - 7-8/2009
test current set to100 mA a measurement
of 1 mV indicates a resistance of 10 mΩ. At
10 mA (with S1 in the position shown in the
diagram) a measurement of 1 mV indicates a
resistance of 100 mΩ while 0.1 mV is equal to
1 mΩ. Diode D1 protects the meter from too
high an input voltage.
With the voltmeter connected as shown in
the diagram it measures not only the voltage
drop across RX but also that produced by the
resistance of the test leads, and probes. To
make a true measurement, first touch the
probes close together on the same lead of
the test resistance and note the reading, now
place the probes across the test resistance
and note the reading again. The first reading measures just the test leads and probes
while the second includes the resistance R X.
Subtract the first measurement from the second to get the value of RX.
supply level and of course the accuracy of
the measuring voltmeter.
The accuracy of the measurements are influenced by the contact resistance of switch
S1, the precision of resistors R1 to R4, the 6 V
(080851)
For optimum decoupling C1 should be fitted
as close as possible to pin1 of IC1. An additional electrolytic capacitor of around 500 µF
can be used at the input to the circuit if the
input voltage from the AC power adapter
exhibits excessive ripple.
Snail Mail Detector
Philippe Temporelli (France)
LA
7-8/2009 - elektor
- Both half-cycles present: no
change in the status of the mail
detector.
- An interruption (even brief) of
one half-cycle: indicator lights
permanently.
- An interruption (even brief) of
the other half-cycle: the indicator goes out.
*
TR
B
230V
(120V
*
)
*
090481 - 11
The letter-box has two doors:
one on the street side for the
postman, and one on the garden side for collecting the post.
A microswitch is fitted to the
street-side door, to light an indicator in the house showing that
the postman has been. A second
microswitch is fitted to the door
on the garden side, to turn off
the indicator once the post has
been collected. The only difficulty then remains to connect
these detectors to a remote circuit in the house that remembers whether the postman’s
been or not.
The idea was to use the alternating half-cycles of the AC signal
on the cable going to the doorbell to transmit the informa-
S
S1
*
S2
D2
*
D1
*
R1
LA
S
180R
*
D8
D9
C3
100u
R5
IC1
R2
1k1
C5
D7
TR
B
230V
(120V
)
LF357
3
6
R4
4
100u
R3
*
100k
D3
*
7
2
100k
1k8
R6
100k
Since his letter-box is outdoors
and quite some way from the
house, the author was looking
for a simple means of knowing if
the postman had been without
having to go outside (contrary
to popular belief, the weather
isn’t always fine in the South of
France). Circuits for this kind of
‘remote detection’ come up regularly, but always involve running cables between the letterbox and the detection circuit in
the house. Seeking to avoid running any extra cables, the author
had the idea of using the existing cables going to the doorbell,
conveniently located adjacent to
his letter-box.
tion, according to the following
logic:
D4
C1
1u
P1
50k
ADJ
D5
D6
C2
100n
090481 - 12
Note that the signal is tapped off
across the doorbell coil via R6
and the pair of diodes connected
in inverse-parallel (to limit the
signal, particularly when the
bell is rung). The signal is then
filtered by R2/C1, before being
used by IC1, which is wired as a
comparator with hysteresis. The
trigger threshold is adjusted by
P1, using a pair of inverse-parallel diodes as a voltage reference
(positive or negative according
to the output state):
For the detection to work, there
has to be continuity in the bellpush circuit — this is generally
ensured by the little lamp illuminating the bell-push. Resistor R1
is added just in case the lamp is
blown or not present.
To keep things simple, the circuit is powered directly from the
doorbell transformer itself (230 V
/ 8 V). The author managed to fit
the little circuit within the doorbell unit, with the LED poking
through a hole in the casing so
it is readily visible in the hall of
his house.
(090481-I)
107
DMX Transmitter
Gerald Weis (Austria)
Lighting effects are always popular at special
events, whether large or small. For example,
a spotlight with a moving head can be used
to project a company logo or other image on
the wall or ceiling. These special-effect light
sources are controlled by the widely use
DMX protocol [1], for which many PC-based
programs are available. However, providing
some sort of PC and setting up the USB and
DMX hardware involves a certain amount of
extra effort and expense. Consequently, the
because the MSP430 has an internal oscillator.
If you use the internal oscillator, it’s important
to adjust the frequency precisely using resistor R6 = ROSC (also shown in the schematic
diagram). The microcontroller data sheet [3]
lists the appropriate values. To check the frequency of the internal oscillator, it should be
fed out to an I/O pin and measured.
As with every project, this one also has room
for improvement. If you use the internal oscillator of the MSP430, the DMX bus may not
operate at the right speed if the temperature
changes. However, this could be compensated by measuring the temperature with the
temperature diode in the MPS340 and making suitable adjustments. A display would
also be a nice addition. Anyone who is interested in expanding on the current design is
welcome to contact the author [7].
A LED that indicates that the transmitter is
operating is driven via port pin P2.0. Extensive information on the DMX driver (IC3) and
its circuitry is available on the Web [4].
(081158-I)
RESET
+3V3
IC2
LM317LB
TEST
+3V3
+3V3
+9VDC
100n
2
10n
1
3
5
X1
6
7
8
32.768kHz
9
+3V3
10
11
D1
12
13
T1
14
R4
2k7
100R
R3
K2
VCC
TEST
P1.7/TDO/TDI
P2.5/Rosc
P1.6/TDI/TCLK
XOUT/P2.7
XIN/P2.6
RST-NMI
P1.5/TMS
IC1
P1.4/TCK
P1.3
P2.0/ACLK
P1.2
P2.1/SMCLK
P1.1
P2.2/CAOUT
P1.0
P3.0/UCA0CLK
P2.4
P3.1/UCB0SDA
P2.3
P3.2/UCB0SCL
P3.7
P3.3/UCA0STE
P3.7
P3.5/UCA0RxD
P3.4/UCA0TxD
MSP430F2112TPW
28
TDO_TDI
27
26
25
C1
2
TDI_CLK
3
4
TMS
5
6
TCK
7
8
24
9
10
23
11
12
22
13
14
C2
R2
100n
0
1
220R
1%
C3
adj.
K1
C4
1u
330R
100k
R6
R1
+3V3
+3V3
C5
21
100n
JTAG
20
8
19
18
1
17
2
16
3
15
4
S3
S2
S1
VCC
R
R
DE
D
IC3
SN65HV
D10QD
B
A
7
6
2
R7
120R
47k
R5
K3
1
3
XLR
GND
5
VSS
4
BC337
081158 - 11
author built a small stand-alone DMX transmitter that can easily be configured using
three buttons.
The entire circuit is based on a Texas Instruments MSP430F2112 microcontroller, along
with an SN65HVD10QD RS485 transceiver IC
from the same manufacturer (note: both ICs
can be obtained from TI as samples).
In addition, it requires a small circuit board,
a female XLR connector, three pushbutton
switches, and a few resistors and capacitors.
The circuitry around the MSP430 (including
the JTAG port) is standard. More information
about the microcontroller is available on the
Web [2]. The schematic diagram shows a
quartz crystal, but it can be omitted if desired
The author wrote the firmware for the microcontroller, which must be adapted to the
actual DMX device that is used. The author’s
C source file for this project can be downloaded from the Elektor website [5]. IAR Kickstart Edition, which can also be downloaded
from the Elektor website [6], can be used as
the development environment.
Internet Links
[1] http://en.wikipedia.org/wiki/DMX512-A
[2] www.ti.com
[3] http://focus.ti.com/lit/ds/symlink/msp430f2112.pdf
[4] http://focus.ti.com/docs/prod/folders/print/
sn65hvd10.html
[5] www.elektor.com/081158
[6] www.elektor.com/081041
The code for initialising the serial interface is
also shown on the TI website. The program
transmits 25 DMX channels at once. Interrupts are used to handle pushbutton input
and transmit the DMX data. In the author’s
example software, one button is configured
for the tilt motion of the Futurelight MH-640
moving head unit, while the other two buttons are unused.
[7] [email protected]
Download
Software
081158-11: source code files, from [1]
elektor - 7-8/2009
"#$$$
"## %%# "!
"!!
7
"
-7-"--$-"")1.-"-
!
-1-$-"!"-
%-"-
!
-1
-*+-1-
--(!-
0
-!
--
-
-$-"
0-(
-"
-"!!-&"-
3
'-"2-"
-
38-""'!
-""-!
2-
-!
-6,245-#2-!
"
---!
-- --
"!--
-,44-/
/-&!
-"-'!"2---'!-"
2-
7)7! 7)7'77 7((7)
7
$7-
(77:7:7&()@()7
7-7)
7$7->77
'.77 ((7)7)
7
)(>7
7)7! 7)7'777((7)
7
))7) 7)
7(7 7'7)$>7
7'.77 ((7
)(>7 ).(7&7
7)((7 ?7
7
7&224789>=47
(1%%1:1&&%1#6
%&111!1
$7)74<04*
74:7577
;<()
7 ()77
-7)
7 7757->7
$
7
7)
7
<
7(>7)77)
<)(77<
((
7-
777 >77 77
,70C9=7
$7.)
77)7(7))(((7
>7)
7 (?7=*
>7?7;B,4B-->7
+7
7
?70C9=+"7<72</87/1
-.(
7
7
?70C9=7<72??87/1
1
(1%%16%&11
1!1
$7)74<4B*
:747-7
.<()77-7 <
7,)((7 (
74*7
($(77"7)
7#<
"#7(>7<
()
7 7-)%77
)(777)()<
7 7)77 7 ).(7')>7
)
7 (?7;<0B*
>7?794,;4-->7
+7
7
?70C4;+"7<72?+87/1
-.(
7
7
?70C4;7<72++87/1
7
6&%111%%1,!?.1
(77
77
-7--77
-71)
7 77
0D*
:7CB377.7
7')
7)
7<
$7
>7"7
)77(77-7 ((777 ((77
7.7
>7"7
7)
7
7
)7((
7 7)7(7->7
'7-)(7.(%77>7
+7
7
?70C55$D+"7<72??87/1
-.(
7
7
?70C55$D7<72+?87/7
1
111%%1,<;;':38/.1
(77
77
)(-7)7--7
7-7)
7 77
CBB*@9>4>7 (7'
7
-
()7 77
-),- -7-7 7
)7)((7
>7 (?74<C4*
>7,7 (
>7
-71--3?75B/,CBB,5B>7
+7
7
?70B59+"7<72<387/1
-.(
7
7
?70B597<72?-87/7
561&%1 %&1 :1%&1%1
- 7((
7;<
)(7()7.)
>747
-)7)
7()7 >727
()
7
)(7 >7& (7
7)7$)77(7)
7
7)()>7<
((
7$)7)(777)--71 7
7'7/
'7):7-)(7- ()<
77.)7(3>7#( 7()7)7
C0B,CBB,0B-->7'7 (?7
CD*
@4BB->7
+7
7
?70CB;+"7<720-87/1
-.(
7
7
?70CB;7<723787/1
1
(1(&1&&11
2<)(7-) 7(<
77)(7>7F77F>7
(7(7 7727
))77()
7
DBB-67-7.)
>7/
7
)777')7)()77<
@ 7
))>77! 724,24-->7'
7
.7>7#( 77C;DB7>7
+7
7
?70C24+"7<72<787/1
-.(
7
7
?70C247<72?087/1
)(7C;DB77<72+87/1&1
1
%%11-6&%1#1(1
)<<<>77 >7
27)(>7-)77
()7()7 >7)7
772B->7&77C47",E7)7
.7()7.77,71%7<
( 77",7. 7-7)$)(<
).(7))(3>727
)77E>7,?77
99,;4--:7CD*
@5-71)
.3>7
+7
7
?70C;B+"7<72-787/11
-.(
7
7
?70C;B7<72/787/1
1
1%1%&1$7
)((7 77 -<
.7 7)7"7
7-7)'7
77'(
7)
7<
-(7 [email protected])7
7727()7)7
<
>7&7).(7 7)'
:7<
")-:777':7 7)< 7)
7
% >7#( 7()7)>77"7)<
$
>7C0B,CCB,0B-->7'?7CD*
>7
+7
7
?70C2B+"7<723-87/1
-.(
7
7
?70C2B7<725787/1
&11%&1&11
#
$
)((7(7CD7<
.)
7()7'7( 7
)
7-7(7 >7
"(77--)>7C4-67
)>7CCD,CDD-->7 (?7CD*
@B>47
+7
7
?70C2D+"7<72/787/1
-.(
7
7
?70C2D7<720787/1
1
$41-6&%1&%11(&11
1=1%%1%&1&1
27)(7- 7
)(77-) 7
-7)
7()7<
((7'7 7 7
7)(()7C;DB77
C;DB7
)(7<
--77180>=47)3>7 747
)
7()7)(7$
7 7(>7
()7)7
777)(:7
)(('7(,.(77 77(%)77)7
')7 7>7--)
77)
7
-) 7)
7()7(77$)77
D0D7)7 7-(7,7>7
(7 7)7-(7-)([email protected]
)-71/
'7"-)(377 7
7/
'7)()7')>71
+7
7
?70C=B+"7<720787/1
1
/7)$7)7'
7)77('77#7)
7
"7)-->7-(7)7)
7
-)7)$)().(7-7 7'.7>7
-;61*1 1"1, -;*.12<-87/1
<5'1$1%1,#<?;.12<787/1
&91&%1,--<.12+87/1:1#1
,0--.12?87/1
1
#1=1&%11 1&((1
&@)(7>7)
7).(77
#>77/
'77')>7/
7
)77 7#7<77'.77
-(7(>7#7%@&77()
77
( >7 (?7C5<C;*
>7
+7
7
?70C2=+"7<72-787/1
-.(
7
7
?70C2=7<72/787/1
7
#1>%%6%&>1 1&((1
&7#7)--77)((7
A()E7
$>77,)(7
'7 (7-)%77 (7
).(>7 (
7'7.,7)
7
/
'7')>7#7%7
)
7&7()
77( >1
-.(
7
7
?70CD;7<72-787/1
1
1$)11%%1&11 1=11
&((1&1!%(1%81
7
1
Single Lithium Cell Charger
Individual cells are becoming available from
the main catalogue suppliers, but a much
cheaper option is to rescue cells from defunct
notebook batteries. In most cases only a
couple of cells are faulty and the others can
sense the temperature of the lithium cell and
which is wired in parallel with R3 via connector K2. Pin 12 (CR) carries a reference voltage
of 2.85 V; so that charging is possible under
normal conditions the thermistor and the
voltage divider of which it forms a part must
be dimensioned so that the voltage on pin 7
lies within the comparator’s voltage window
when the cell is running at a safe temperature. The values shown for R2 and R3 will
allow charging as long as the resistance of
R4
C2
100n
Characteristics
D1
D2
4
• Designed for a single Li-ion cell
VCC
8
2
3
5
1W
• Input voltage from 4.5 V to 10 V (depending on
charge current)
JP1
• Charge current up to 1.2 A
9
4V2
K1
4V1
• Charge current configurable via shunt resistor
C1
5VDC
10u
IC1
IN
OUT
IN
OUT
ISNS
VSENSE
VSEL
TMR SEL
1
6
20
NC
15
19
PACK+
18
17
3h
13
*
C5
CR
12
NC
NC
APG/THM
GND
10
AGND
16
JP2
It is important never to exceed the maximum
permissible cell voltage: if in doubt, consult
the manufacturer’s specifications for the
definitive value.
The charge current is determined and monitored by input shunt resistor R1. A value of
0.1 Ω gives a charge current IL of 1 A: the general formula is IL = 0.1 V / R1. In this example,
110
(the supply voltage) the time limit is four and
a half hours, and if pin 13 is pulled to ground
the time limit is six hours. If the final voltage
is reached early, charging will of course cease
before expiry of the time limit. The LEDs allow
the charge process to be monitored. Red LED
D1 lights during charging and flashes to indicate that a fault has been detected. When the
cell is more than 90 % charged the red LED is
extinguished and the green LED lights.
Pin 7 (APG/THM) is the input to a window
comparator with a lower threshold of 0.56 V
and an upper threshold of 1.5 V. If the voltage on this pin is over 1.5 V or below 0.56 V
the IC regards this as a fault and aborts the
charging process. Charging can only occur if
the voltage on the pin lies between the two
thresholds. The window comparator can be
used either to monitor the IC’s supply voltage or to monitor the temperature of the
lithium cell. In the circuit shown we have
used the input in a temperature monitoring
configuration: the voltage on pin 7 is determined by a voltage divider comprising R2, R3
and an NTC thermistor, which is arranged to
BT1
6h
K2
10p
C4
*
1u
TEMP
7
R3
*
*
-Θ
C3
NTC
220n
DC–
still look forward to a long and useful life.
A single cell is ideal for any equipment that
needs a 3.3 V power supply, and will generally give a good operating life. The charger
circuit requires a 5 V input, which can readily
be obtained from a USB port or from any 5 V
power supply.
The charge process begins with a trickle
charge current. When the cell terminal voltage is sufficiently high the charger switches
to a higher constant charge current. Charging
is terminated when the cell voltage reaches a
preset limit (the ‘final voltage’). The charger
described here is suitable for cells with a final
voltage of 4.1 V or 4.2 V, configured using
jumper JP1: pin 9 is taken to ground to select
4.1 V or to VCC to select 4.2 V.
BATTERY
4h5
R2
NC
• Charge status indicated by two LEDs
• Two package options: SSOP20 or QFN
14
bq24002PWP
11
• Precharge function for deeply-discharged cells
STAT2
18k7
R1
0R1
DC+
• Configurable 4.1 V or 4.2 V final voltage
STAT1
EN
95k3
• Suitable for all lithium chemistry cells with a
final voltage of 4.1 V or 4.2 V (lithium-cobalt,
lithium-manganese and lithium-polymer)
• Linear regulator topology
R5
500R
Using the BQ24002 from Texas Instruments it
is possible to build a simple and small charger
module for single lithium-ion (Li-ion) cells.
The device is available in a SSOP20 package
and so does not require heroic assembly and
soldering skills.
the input voltage should be no greater than
5.3 V to ensure that the maximum allowable
power dissipation of the IC is not exceeded.
With a charge current of 0.5 A (R1 = 0.2 Ω), the
maximum allowable input voltage is 7.6 V.
The circuit offers a charge time limit and cell
temperature monitoring. The charge time
limit is set using JP2. If the jumper is not fitted
charging will always stop within three hours,
even if the cell has not reached its final voltage. If the jumper is fitted to pull pin 13 to VCC
500R
Steffen Graf (Germany)
PACK–
080286 - 11
the thermistor lies between 4.8 kΩ (upper
temperature limit) and 26.6 kΩ (lower temperature limit). Using a typical 10 kΩ thermistor (such as the Vishay 2381 640 63103) this
means that charging will occur as long as the
cell temperature is between approximately
5 °C and approximately 43 °C. A 12 kΩ thermistor from the same series gives an upper
limit of 48 °C: this is the arrangement used in
Texas Instruments’ evaluation module [1].
Formulae are given in the datasheet [2] to
help with the calculation of component
values in the voltage divider. Alternatively,
the TempSense Designer software [3] can be
used: it offers a graphical user interface and
a number of other features.
(080286)
Internet Links
[1] http://focus.ti.com/lit/ug/sluu113/sluu113.pdf
[2] http://focus.ti.com/lit/ds/slus462e/slus462e.pdf
[3] http://focus.ti.com/docs/prod/folders/print/
bq24002.html
elektor - 7-8/2009
Long Duration Timer using ATtiny2313
Jürgen Stannieder (Germany)
module that uses an HD44780-compatible
controller. Note that P1 is used to adjust the
contrast of the LCD: if the display appears
blank it is worth checking the contrast setting before suspecting a more serious problem! If desired, the LCD can be dispensed
with, along with the corresponding parts of
the source code.
The upper line of the LCD shows the total
time period, in seconds, for which the software is configured, while the lower line
shows the time, in seconds, since the button
was pressed.
This timer circuit is designed to switch on
a 12 V load in a solar-powered installation
for a preset period at the press of a button.
When the period has expired a latching relay
disconnects both the load and the controller circuit from the 12 V supply. The length
of the period can be configured by making
suitable changes to the microcontroller’s
source code.
can also of course be configured by changing
the software.
When the full time interval has elapsed the
microcontroller sets an output (pin 7) high,
which triggers the CNY 17-3 optocoupler and
in turn drives relay coil L2. The relay returns to
its initial state, disconnecting the load as well
as the controller (which is also powered via
the relay contact) from the 12 V supply.
The author used a miniature 16-by-2 LCD
panel type HMC16223SG in his prototype,
measuring just 52 mm by 20 mm. It is of
course possible to use any standard LCD
[1] www.elektor.com/080584
Download
080584-11: source code, from www.elektor/080584
C2
100n
100n
2
4
6
7
9
D7
D6
D4
D5
D3
D1
8
D2
R/W
5
E
VO
3
RS
VSS
1
C1
D0
LCD1
2 x 16
78L05
S1
(080584)
Internet link
+5V
IC3
+12V
The screendump shows the LCD settings
under BASCOM-AVR. The source code for the
program is available for download at [1].
VDD
When button S1 is pressed a voltage appears
across relay coil L1, and the relay switches the
load on. Since the relay is a latching type, it
remains in this state when the button is
released. There is now a supply to the 78L05
voltage regulator (a low-dropout type such
as the LP2950CZ-5.0 may also be used) and
the microcontroller is powered up. In the
microcontroller the timer program runs until
the configured time interval has elapsed.
Around 90 % of the way through the time
period LED D2 lights as a warning that the
load will shortly be switched off, and this time
10 11 12 13 14
P1
RE1
25k
L1
L2
20
1
RESET
12V
2A
PD6
IC2
PB0
*
2
+12V
3
6
7
6
1
8
9
R2
330R
IC4
5
330R
R1
PB1
PD0
PB2
PD1
PB3
PD2
PB4
PD3
PB5
PD4
PB6
PD5
ATTiny2313
XO
PB7
11
12
13
14
15
16
17
18
19
XI
4
5
10
X1
4
D1
2
D2
C4
C3
33p
33p
1N4148
CNY17-3
7-8/2009 - elektor
TIMER 90%
X1 = 3.6864MHz
080584 - 11
111
Quartz Crystal Tester
Christian Tavernier (France)
+9V
we have suggested for you [1],
or on a piece of prototyping
board (perfboard, Veroboard
etc.). In either case, it is essential for the base material to
be fibreglass and not paxolin,
because of the high frequencies that may be involved.
To achieve the connection to
the crystal to be tested, two
HC6/U and HC18/U sockets
can be soldered in parallel to
accommodate crystals using
these pin-out formats. Crystals
that have wire leadouts can
easily be connected to one or
other of these two sockets.
1k
680 Ω
22k
Although most passive com+9V
R1
ponents are usually fairly easy
LED1
to test, the proper functioning of a quartz crystal cannot
T1
R3
CN1
be checked using any standard measuring instrument.
BF494
C1
A quartz crystal is actually a
T2
D1
C3
C5
very simple device in princiX1
1n
ple, since all it consists of is
100n
2n2
1N4148
a slice of quartz, accurately
BC547
R2
D2
C2
C4
cut, of course, held between
two metal electrodes, or with
100p
10n
CN2
M
metallic contacts deposited on
1N4148
it to serve the same purpose.
081178 - 11
But sadly, owing to its being
made like this, an ohmmeter
or capacitance meter will not
The power supply is provided
measure anything across a crystal, since it will it was made, or one of its harmonics (see by a source of 9 V. A simple 9 V PP3 battery is
have a resistance of several megohms (MΩ) below). If it’s important for you to measure ideal, given the circuit’s low power consumpand a stray capacitance of only a few picofar- this frequency, you can connect a frequency tion and above all the fact that it’s only ever
ads (pF) — regardless of whether it’s working
used for a relatively short time.
or not. So the only solution available to us is
to fit the crystal into a circuit, i.e. an oscillaAs previously explained, the circuit works
tor, and see if it oscillates or not. This is just
for any crystal with a frequency between 1
what our tester does — and at a ridiculously
and 50 MHz — i.e. virtually all the crystals on
1-871180
low cost.
the market. It’s important to appreciate that,
even though you do find crystals marked with
As the frequencies of the crystals we deal
frequencies higher than 50 MHz, they rarely
with may cover a very wide range — the vast
actually operate directly at this frequency,
majority of them will be typically between
which is in fact the harmonic frequency to
which the oscillator in which they are fit1 MHz and 50 MHz — we need to build an
oscillator that will be capable of working
ted needs to be tuned. So their fundamenover a very wide frequency range. This task
tal oscillating frequency is in fact normally
is given to transistor T1, which is arranged as meter or oscilloscope across resistor R2.
below 50 MHz, by a ratio of 2 or 3, dependan aperiodic oscillator — i.e. it is not tuned to The circuit itself is very simply and can be ing on which harmonic (or overtone) is to
any particular frequency. If you are familiar built on the little dedicated PCB whose design be used. The reason for this curious way of
with this type of oscillator circuit, you’ll note
going about things lies in the manufacturing
that the feedback capacitor C1 has an unusutechnology for these devices, which requires
COMPONENT LIST
ally high value, which enables this circuit to
the slice of quartz to be finer and finer as
cope with almost any type of crystal with a
the actual operating frequency (or ‘fundaResistors
mental frequency’) is increased. And so, if
frequency between 1 and 50 MHz.
R1 = 22kΩ
they try and go too high with direct oscillaR2 = 1 Ω
So if the crystal is good enough, a pseudotion at the fundamental frequency, the slice
R3 = 880Ω
sinewave signal at the crystal’s fundamental
becomes so fragile that it may break all of its
Capacitors
frequency will be present at the emitter of
own accord.
C1 = 1nF
T1. This signal is rectified by D2 and charges
(081178-I)
C2 = 100pF
capacitor C4 via D1. As soon as the voltage
C3 = 2nF2
across this reaches a high enough value, tranC4 = 10nF
Internet Link
C5 = 100nF
sistor T2 turns on and lights the LED in its col[1] www.elektor.com/081178
lector circuit, thereby indicating that the crysSemiconductors
tal is usable.
Clearly, because of its operating principle, this
circuit doesn’t let us check the actual operating frequency of the crystal, but experience
shows that, when a crystal is faulty, it will fail
to oscillate at all, but that when it does oscillate, it will do so at the frequency for which
D1, D2 = 1N4148
T1 = BF494
T2 = BC547
LED1 = LED
Download
PCB
081178-1: PCB layout (.pdf), from [1]
Miscellaneous
Socket for HC6/U and/or HC 18/U type xtal
elektor - 7-8/2009
Prototype & small series PCB specialists
rvice
pe se
y
t
o
t
pro
PCB
New
Instant online pricing and ordering
Low order-pooling prices - 1–8 layers
Full options service On demand - 1-16 layers
Deliveries from 2 days
Stencil service
- 2 boards in 2, 3 or 5 days
- No tooling charge
- Low PCB-Proto prices
E.g. 2 x 100 x 80 mm: 2 layers 38.12€ each*
4 layers 77.23€ each*
- Immediate online ordering
- No minimum order charge
*excluding transport and VAT
Call us: 020 8816 7005 Email: [email protected]
www.eurocircuits.com
Elektor SMT Oven
Multi-purpose and indispensable
to professional and enthusiast
cher
Kit and vou
SMT Starter
5
1
1
/g
worth £100
TOTALLY oFvReEnE!
with your
•
Selected, tested & certified by Elektor
•
Including Elektor-produced user manual
•
Fully menu controlled
•
SMT Expert Tip: Double-sided Soldering
•
Demovideos available on the Elektor website
Main technical specifications
•
Ideal for R&D laboratories, schools, small companies and…
electronics enthusiasts
Line frequency: 50-60 Hz
Product support from Elektor Customer Services
Size: 418 x 372 x 250 mm (16.5 x 14.6 x 10 inch)
•
Art. # 080663-91 • Price: £962.00 • € 1195.00 • US $1665.00 (Excl. VAT)
Line voltage: 230 VAC / 1650 W
Weight: 16.7 kg (net)
Effective PCB area: 280 x 280 mm (11 x 11 inch)
Further information
mation and ordering at www.elektor.com/smtoven
7-8/2009 - elektor
113
Improved Hybrid HeadPhone Amplifier
Tuck Choy, PhD (Singapore)
Jeff Macaulay’s excellent single valve ECC82/
12AU7 ‘Hybrid Headphone Amp’ (HHA) published in [1] spurred the author to implement
some modifications culminating mainly in
an additional input preamp. The resulting
project was then slightly reworked in the
Elektor Audio Labs and the result is shown
here, along with a PCB design to Elektor
standards.
Specifications
• Warm up time: min. 30 minutes
• Load impedance: 33 Ω
• Supply voltage: 12.1 VDC
• Current consumption: 235 mA
• Gain (33 Ω load): 4.5
• Max. output voltage: 730 mV
(THD = 3%, clipping audible)
• THD + N: 0.13 % (1 mW/1 kHz/B = 80 kHz)
• S/N: 87 dB (ref. 1 mW, B = 22 kHz)
• Bandwidth: 17 Hz – 3.5 MHz (at 1 mW)
• Output impedance: 2 Ω
• DC output voltage: 1 mV (33 Ω load)
3 mV (150 Ω load)
1
D2
R7
39k
1N4004
T5
12V
T4
C5
2x BC550C
R
R10
C8
25V 100u
560R
R22
R13
2x BC550C
R15
10k
2200u BC550C
R26
25V
8k06
R27
L
1k
T11
C9
10u
R23
1k
10k
R11
C12
560R
R3
100u
25V
BC550C
BC517
T7
C13
2u2
22R
100u 25V
R2
1k
6
4
9
5
D3
R9
T6
91k
R8
10k
T8
15k
R19
33k
C3
15k
22R
R5
560R
1k
R21
T12
7
8
V1
ECC82
12AU7
T1
2200u
25V
R20
8k06
114
T2
C4
R24
C6
R1
10k
T9
2
3
D1
BC517
BC550C
R17
T3
91k
1k
R16
100n
1
2u2
C10
R
100n
R14
R12
C7
C2
C1
BC550C
10u
1k
T10
R4
91k
100u
25V
R6
R18
560R
C11
BD139
1000u 25V
91k
BC517
R25
33k
L
080310 - 11
elektor - 7-8/2009
The original HHA was designed for line inputs
of the order of 1 Vrms and an output impedance of about 35 ohms. Unfortunately there
do not seem to be hard and fast international
standards for headphone output levels or
impedances. Higher end headphones such
as the AKG type K601 (impedance 125 ohms)
and K701 (impedance 62 ohms), coupled a hifi preamplifier system like the author’s Rega
Mira (which supplies only 600 mVrms out)
resulted in a compromised dynamic range
and low loudness performance especially
on older CD recordings.
Initial experiments with modifying the BC517
Darlington output of the HHA were rather
unsuccessful. The low anode current from
the valve requires this specialized gain stage
and any efforts to boost the output seems
to modify the system from a valve based
amplifier into a transistor one and the resulting audio performance was also not encouraging. The main problem with the original
HHA is both its strength and weakness, as
the unity-gain valve cathode follower does
not offer any voltage gain in the first place.
The low noise and distortion due to the
valve is no doubt offered by its low anode
voltage and hence low noise and distortion
characteristics.
the Specifications listed here were obtained
with feedback in place. Without feedback,
the outputs carry no direct voltage. The
negative feedback feature was found quite
useful such as with the AKG K701 to further
boost performance, but this is a rather subjective feature you might like to experiment
with for yourself. Capacitor C1 (C6) gives the
circuit a reasonable specification for its lowfrequency roll-off.
from the project webpage. You’ll notice that
the solder side of the board has large copper
fill areas to maximise the ground plane surface, which helps to keep noise and all sorts
of interference down to a minimum. The
valve socket has a rather spacious footprint
as well as large holes to allow sockets from
different suppliers to be used.
(080310-I)
In the prototype of the amplifier, the ECC82/
12AU7 required about 15 minutes of warming
2
Referring to the circuit diagram in Figure 1 a
Measurement data
Component List
Voltages measured w.r.t. circuit ground
T1/T6 base
0.7 V
T2/T7 base
1.4 V
T3/T8 base
3.8 V
T3/T8 Emitter
2.8 V
ECC82 grid
4V
T10/T12 Emitter
6.2 V
T9/T11Base
0.67 V
ECC82 anodes
10 V
ECC82 pin 5
9.4 V
D2 (across device)
0.8 V
T5 VCE
1.3 V
R6/R14 (across device)
6.85 V
stereo amp is shown, as opposed to a monoblock for the original HHA. The hunt for a
suitable input voltage amplifier to slightly
boost the voltage gain resulted in the use
of a dual BC550C inverting shunt feedback
amplifier with a voltage gain of about 8.
Being an inverting amplifier it conveniently
allows some negative feedback (about 3%) to
be introduced using 33 kΩ resistor R19 (R25).
The feedback causes a direct voltage of a
few millivolts at the amplifier outputs, and
7-8/2009 - elektor
Resistors
R1,R8,R9,R15 = 10kΩ
R2,R4,R10,R12 = 91kΩ (E96: 90kΩ9)
R3,R11 = 15kΩ
R5,R13 = 22Ω
R6,R14,R16,R17,R22,R23 = 1kΩ
R7 = 39kΩ
R18,R21,R24,R27 = 560Ω
R19,R25 = 33kΩ
R20,R26 = 8kΩ06
Capacitors
C1,C6 = 2µF2 100V, lead pitch 22.5mm (WxL = 10 x
26 mm abs. max.)
C10,C12 = 10µF 63V, lead pitch 22.5mm (WxL = 10 x
26 mm abs. max.)
C2,C7 = 100nF, MKT, lead pitch 5mm or 7.5mm
C3,C8,C11,C13 = 100µF 25V, lead pitch 2.5mm, diam.
up before normal operation was obtained.
This is due to the relatively low heater voltage of about 9.4 V from the BD139 series
pass element. The functions of T5/C5 and T4
are explained in some depth in the original
article.
The single-sided circuit board design shown
in Figure 2 allows a stereo amplifier to be
built. The copper track layout for making your
own PCB can be downloaded free of charge
8.5 mm max.
C4,C9 = 2200µF 25V, lead pitch 7.5mm, diam. 18mm
max.
C5 = 1000 µF 25V, lead pitch 5mm, diam. 10 mm
max.
Semiconductors
D1,D3 = red LED
D2 = 1N4004
T1,T2,T6,T7,T9,T10,T11,T12 = BC550C
T3,T5,T8 = BC517
T4 = BD139
Miscellaneous
V1 = ECC82 or 12AU7
9-pin (‘Noval’) PCB mount socket, e.g. Conrad
Electronics # 120529
PCB, # 080310-1 from www.thepcbshop.com
Reference
[1] Hybrid Headphone Amp, Elektor July & August
2006; www.elektor.com/050347
Downloads & Products
PCB design
No. 080310-1 (.pdf) at www.elektor.com/080310
115
Braitenberg Robot
Abraham Vreugdenhil (The
Netherlands)
In 1984 Valentino Braitenberg
published a nice demonstration to show the behaviour of
robots. The question is: what
IS behaviour or what do we
THINK behaviour is. This demonstration uses simple robotic
vehicles, each of which contains a very simple program.
Each robotic vehicle has two
driven wheels and two light
sensors at the front. These
sensors look towards the front and each drive
a motor. The robots also have a bumper to
sense whether they have hit anything. This
can be either a wall or another robot. Now, in
the simplest form of the robotic vehicle, the
left front light sensor is connected with the
right rear wheel. Likewise the right front light
sensor is connected to the left rear wheel. If
we now place the robotic vehicle in a space
with a light source, the robotic vehicle will
move towards the light source.
There are, however, also vehicles where the
left front sensor is connected to the left
rear wheel and the right front sensor to the
right rear wheel. Such a robotic vehicle will
avoid a light source instead. Now, suppose
you have multiple light sources which are
repeatedly turned on and off, as well as multiple robotic vehicles with different behaviours, what will happen? You will first see
that all the light seekers go towards the light
source and all the light avoiders move away.
When the light sources subsequently move,
all the robots will spring into action and this
results in new activity. If you’re an outsider
or you do not know in advance what sort of
program is contained in the robotic vehicles,
then it is nice to discuss what is happening
here. People have the tendency to attribute
various kinds of human behaviour to certain
devices and robots. This one is ‘aggressive’,
the other ‘evasive’ or passive. Whole discussions are started based on a few robotic vehicles driving around with each ultimately containing a very simple program. Perhaps this
says more about the method of thinking or
the behaviour of the spectators then it does
about the behaviour of the robotic vehicles
themselves.
How can this experiment be repeated in a
simple way? You need a number of small and
cheap robots that can easily be programmed
and changed to suit your needs. A few years
116
ago the company Arexx [2] introduced a trim
robot construction kit onto the market, the
Asuro. This robot is available from Conrad
Electronics [3], among others. The Asuro contains an Atmel ATmega processor with a builtin hex loader. You can write programs for the
Asuro in C or (simpler) in Bascom [4]. Using an
IR interface (with the supplied RS232 IR transceiver) the hex program can be sent to the
Asuro. A USB IR transceiver is also available.
The Asuro also has an experimenting board
available. Here the board is used for three
purposes. You connect two bumper supports, mount two light sensors and finally add
a piezo-element (according to Figure 1). For
the light sensors on the experimenting board
you use the two IR diodes normally mounted
underneath the Asuro (these are T9 and T10).
Fit these with a little plastic tube.
On the expansion board you use the connections for the red LED D11 to connect the
piezo element. To distinguish between the
different robotic vehicles you give each a different colour by wrapping the battery compartment in paper of different colours. You
can also give each robotic vehicle an unique
number internally. While driving around the
robots can continuously transmit their behav-
PD.6
R29
The program, written by the
author for this purpose, can
be downloaded from the Elektor website [1]. A general
overview of what the program does is given here. After
it starts up it first waits for a
second in the INIT routine. If a
bumper is pushed during this
time, the light seeking behaviour is activated. If the bumper
is not pushed then the behaviour will be light avoiding.
After a short beep it waits to
check whether the number
of the robot has be changed or not. This is
done by pushing the bumper a number of
times. If not, the EEPROM is checked to see if
it already contains a number. If a valid entry
is found then that number will be used, otherwise the number 10 is used. The main loop
consists of three parts: a bumper part (A), a
light avoiding/seeking part (B) and a random
component (C).
The program is written in Bascom AVR. For
more information refer to the program listing (download # 090348-11). The Bascom AVR
generated hex file is transferred to the Asuro
using the Flash.exe program supplied with
the Asuro. You can then start again, determine the behaviour by pushing the bumper,
followed by entering a number by pushing
the bumper a few times and the BraitenbergVehicle is on its way. Get ready for long discussions on what these robots are doing and
what behaviour is taking place.
To produce the random light changes on the
playing field, the author designed a circuit
with a 98C2051 and a few solid-state relays,
which ensures that four incandescent lamps
at the side of the playing field light up in different combinations every 25 seconds. This
effect ensures that the robotic vehicles will
continue to search and avoid.
(090348-I)
C12
47 Ω
10µ
16V
BZ1
Internet Links
[1] www.elektor.com/090348
[2] www.arexx.com
090348 - 11
[3] www.conrad-int.com
[4] www.mcselec.com
iour, i.e. decisions via the IR transceiver. If you
mount an IR transceiver above the ‘playing
field’ you can follow everything the robots
‘do’ on the computer.
Download
Software
090348-11: Bascom and hex file, from [1]
elektor - 7-8/2009
Profiler Pro
New processor board, increased software
capabilities and mechanical upgrades
Upgrade your Profiler to a PRO milling
machine with:
Demo video at
rofilerpro
www.elektor.com/p
Order now:
3D controller-board
(assembled and tested)
£339.00 / US $494.00 / e 380.00
incl. ColiDrive en ColiLiner update
New 3D controller
New Z-axis with floating head
(assembled)
£404.00 / US $590.00 / e 454.00
Requested by many and now
available!
Professional grade engraving head
£263.00 / US $384.00 / e 295.00
ColiDrive
Prices include VAT,
exclude postage and packing.
The control software has been
expanded with quite a few new
options.
Elektor
Regus Brentford
1000 Great West Road
Brentford TW8 9HH
United Kingdom
Tel. +44 20 8261 4509
New Z-axis with floating head
More stable and easier to mount and calibrate.
Professional engraving head
With this head the milling depth
can be set very accurately!
More information, demo video and ordering at www.elektor.com/profilerpro
Elektor’s Components
Database 5
More than
Completely updated
69,000 components
NEW
!
The program package consists of eight databanks covering ICs, transistors, diodes
and optocouplers. A further eleven applications cover the calculation of, for example,
zener diode series resistors, voltage regulators, voltage dividers and AMV’s. A colour band
decoder is included for determining resistor and inductor values. Each databank contains
the following on (almost) any component: enclosure drawing, pin connections, technical data (as far as known). Also included is a search engine acting on user supplied
parameters. The ECD gives you easy access to design data for over 5,400 ICs, more than
35,800 transistors, FETs, thyristors and triacs, just under 25,000 diodes and 1,800 optocouplers. All databank applications are fully interactive, allowing the user to add,
edit and complete component data. This CD-ROM is
a must-have for all electronics enthusiasts!
ISBN 978-90-5381-159-7
£24.90 • US $39.50
Elektor
Regus Brentford
1000 Great West Road
Brentford TW8 9HH
United Kingdom
Tel. +44 20 8261 4509
Further information and ordering at www.elektor.com/shop
7-8/2009 - elektor
117
An E-Blocks IR RC5 Decoder
1
1 x PICmicro USB Multiprogrammer EB006 with 4 MHz xtal;
1 x EB-007 (8 push to make switches) connected to PORTC;
1 x EB-005 imitation LCD board (16x4) connected to PORTA;
1 x EB-004 LED board or 8-Relay board
connected to PORTD;
1 x EB-004 LED board connected to
PORTE (or just one LED and a 470 Ω resistor on RE1).
The original EB-005 E-Block has a 16x2
LCD. For the purpose of this project, an
2
EB-005 was reverse-engineered and replicated on prototyping board and wired
to accommodate a 4x16 LCD. The home
made board has a SIL socket strip that also
accepts 16x1 and 16x2 LCDs, all of which
were found to be pin compatible. Photos
of the author’s DYI EB-005 are available
at [2]. The proposed IR decoder board is
connected to PORTB.
Once fully debugged and tested in terms
of hardware and software, an E-blocks
system may be ‘undressed’ and replicated
as a stand-alone circuit with just the basic
3
elements and running firmware. In most
cases, the circuit boils down to no more
than a (PIC) micro with some I/O devices
around it like switches, sensors, relays
and LEDs. If changes or extensions are
required, you build up the E-blocks constellation again, do whatever is necessary to get it all to work, save the new .fcf
and make the system blow a fresh PIC for
inserting into the stand-alone system.
Here the PIC16F877microcontroller runs
at 4 MHz to decode signals matching the
Philips RC5 protocol. The complete E-Blocks
layout can be used to test remote controls
with suspected faults, and to switch 8 devices
using a ‘known good’ control. The address
and command decimal values appear on a
16x4 LCD display. The decoder proper (Figure 1) is just a standard application circuit of
the TSOP1736 IR decoder IC with some components around it for connectivity with the Eblocks PORTA (based on sub-D connectors).
Keys 1 to 8 of the remote are used to control
118
R2
R6
100R
R1
100k
The infrared (IR) decoder described here
was designed to enable an E-Blocks
development system [1] to process commands from RC5 (compatible) remote
controls typically used for Philips audio/
video equipment. The E-blocks complement consists of
+5V
100k
José Basilio Carvalho (Portugal)
C1
47u
K1
1
6
2
7
3
8
4
R3
16V
2
IC1
3
22k
1
R4
TSOP1736
100R
R5
TSOP1736
100R
9
5
S2
S1
SUB-D9
1
080996 - 11
3
2
10 = SAT, 11 = Hi-Fi.
The program was designed with Flowcode, the graphical software design utility for E-blocks. A part of it is shown in
Figure 2. The resulting .fcf file is available free of charge from the Elektor website [2].
The main flowchart allocates the LC display to PORTA, initialises ports, reads the
state of bits 6 and 7 into variable ‘mode’,
enables RB0/INT interrupts and starts a
loop.
A 1 to 0 transition on the RB0/INT pin will
call the ‘start’ macro, which is only used to
set a variable and call the ‘ir_dec’ macro.
Inside the ‘ir_dec’ macro, some delays are
present to read RB0 near the end of the S1
bit, as well as during the start and second
half of the S2 bit. If they are ‘010’, the signal is recognised as coming from a valid
RC5 remote control. Some more delays
effectively skip the toggle bit (not used
here) and start to read the five address
bits and six command bits into the ‘adr’
and ‘cmd’ variables respectively. During the ‘ir_dec’ macro, 14 300-µs pulses
are generated on the RE0 pin to enable
an oscilloscope to show detailed timing
of the RC5 preamble and address/command bits.
After a successful IR decoding, the ‘ir_dec’
macro calls the ‘output’ macro. Inside the
‘output’ macro the display shows address
and command values in decimal notation,
compares ‘adr’ and ‘mode’ variables to
validate the device mode used, and sends
the value of the ‘cmd’ variable to PORTD,
displaying the output state in binary.
A blinking LED on the RE1 pin reveals
the activity of any non-RC5 remote controls (like Sony, Panasonic, etc.). The main
loop also calls the ‘sw_key’ macro to read
PORTC switches to control the PORTD
outputs manually.
(080996-I)
Internet Links
eight bits of PORTD individually, switching on
or off any AC or DC devices by way of an 8way relay board or similar. The Standby key
is used to switch all eight outputs on and off.
There are also eight push-to-make switches
to manually toggle the state of any output.
By pressing switch 1 and 2 at the same time
you switch all outputs on or off. The state of
the outputs is shown on the LC display. Bits 6
and 7 of PORTB are used to select the address
mode of the output control; 00 =TV, 01 = VCR,
[1] www.elektor.com/eblocks
[2] www.elektor.com/080996
Downloads
Software
080996-11.zip: Flowcode (.fcf) file, from www.elektor.
com/080996
Supplementary Information
080996-12.zip: Photos of DIY EB-005, from www.elektor.com/080996
elektor - 7-8/2009
Photo: Siegfried Springer / PIXELIO
Things of the past
Elektor is now & tomorrow
Secure a head start in electronics
with a subscription!
Advantages to subscribers
Cheaper than 11 issues from the newsstand
PLA-UK-1
+
e
lcom
1 we yer,
n
i
3
la
FREE B MP3 p
d
2G
n
:
a
t
f
i
k
g
Stic
B
S
d
U
r er
Reco
Voice
With every issue subscribers get up to 40% discount
on selected Elektor products
As a welcome gift you get a free 2GB MP3 player
worth £31.50
No queues, travelling, parking fees or ‘sold out’
Elektor is supplied to your doorstep every month
Always up to date – read your copy before
everyone else
www.elektor.com/subs · Tel. +44 (0) 20 8261 4509
Or use the subscription order form near the end of the magazine.
electronics worldwide
Remote Control for Network Devices
Werner Rabl (Germany)
33k
R4
R2
680 Ω
330 Ω
1
IC1
BC557
4
D1
RE1
60 Ω
2
PC817A
V1
5V
1N4148
3
R8
R6
T2
R7
100 Ω
R5
680 Ω
330 Ω
1
IC2
BC557
4
D2
RE2
60 Ω
2
PC817A
V2
5V
1N4148
3
R12
33k
The circuit diagram shows an example configuration where there are two controlling
host devices (a streaming media client and a
PC) and three network devices (a DSL router,
a networked hard drive and a networked
printer). We will assume that all the media
files are held on the networked hard drive.
The DSL router (to provide an internet connection) and the hard drive are to be powered up when either the PC or the media client is powered up; the printer only when the
PC is powered up.
T1
R3
100 Ω
R1
33k
Many devices connected to a local area network (LAN) are left on continuously, even
when they are not needed, including DSL
and cable modems, routers, wireless access
points, networked hard drives, printer servers and printers. The power consumption of
all these devices can add up to a considerable
fraction of one’s electricity bill. With the simple circuit described here we can ensure that
all these devices are only powered up when
at least one selected host device (such as a PC
or a streaming media client) is turned on.
We insert a relay in the mains supply to the
devices whose power is to be switched, along
with a driver circuit controlled from the host
device over a two-wire bus. Optocouplers
provide galvanic isolation. One way to implement the bus is to use the spare pair of conductors that is often available in the existing
LAN cable.
R10
100 Ω
R9
T3
R11
680 Ω
330 Ω
1
IC3
BC557
4
D3
RE3
60 Ω
2
PC817A
3
1N4148
090096 - 11
We can think of the devices as being in two
groups, the first group consisting of the DSL
router and the hard drive, the second just the
printer. An optocoupler is powered from each
of the controlling host devices: these ensure
that the devices are isolated from one another
and from the rest of the circuit. The relay circuit, located close to the networked devices,
is controlled from the outputs of the optocouplers. The relay circuits are powered from
(efficient) mains adaptors: modified mobile
phone chargers do an admirable job.
In the circuit shown a 5 V supply from the
controlling devices is used to drive each optocoupler. Host 1 (the streaming client) drives
optocoupler IC1, host 2 (the PC) drives optocouplers IC2 and IC3.
Optocouplers IC1 and IC2 both control the
networked devices in group 1: networked
device 1 is the DSL router, switched by relay
RE1, and networked device 2 is the hard drive,
switched by relay RE2.
120
Optocoupler IC3 controls the networked
device in group 2, namely the printer. This is
switched by relay RE3.
The connections between the optocouplers
and the relay stages can be thought of as a
kind of bus for each group of devices. The
devices in a given group can be switched on
by simply shorting its bus, and this gives an
easy way to test the set-up. Resistors R2, R6
and R10 at the collectors of the transistors in
the optocouplers protect them in case power
should accidentally be applied to the bus.
provide both voltages. Another possibility
would be to add a third wire to the bus to
carry power: this would allow all relays, wherever they were located, to be powered from
a single supply.
It is worth noting that network attached storage (NAS) devices such as networked hard
drives normally require an orderly shutdown
process before power is removed. Devices
that use Ximeta’s NDAS technology do not
suffer from this problem.
(090096-I)
The supply voltages V1 and V2 shown in the
example circuit diagram are derived from the
mains adaptors as mentioned above and are
used to power the relays. We have assumed
that the networked hard drive and the printer
are located near to one another, and so it is
possible to use a single mains adaptor to
elektor - 7-8/2009
Automatic Bicycle Light
Ludwig Libertin (Austria)
made of SMD components. Most
of them come in an 0805 package. C2 comes in a so-called
chip version. The board is single-sided with the top also acting as the solder side.
The print outline for the LDR (R5)
isn’t exactly the same as that of
the outline of the LDR mentioned in the component list.
The outline is more a general one
because there is quite a variety
of different LDR packages on the
market. It is therefore possible
to use another type of LDR, if for
example the light threshold isn’t
quite right. The LDR may also be
mounted on the other side of the
board, but that depends on how
the board is mounted inside the
light.
This automatic bicycle light
makes cycling in the dark much
easier (although you still need
to pedal of course). The circuit
takes the ambient light level
into account and only turns on
the light when it becomes dark.
The light is turned off when no
cycling has taken place for over
a minute or if it becomes light
again. The biggest advantage of
this circuit is that it has no manual controls. This way you can
never ‘forget’ to turn the light
on or off. This makes it ideal for
children and those of a forgetful
disposition.
7-8/2009 - elektor
100k
1M
To detect when the bicycle is
used (in other words, when the
wheels turn), the circuit uses a
reed switch (S1), mounted on
+3V
the frame close to the wheel.
A small magnet is fixed to the
R1
R2
spokes (similar to that used with
most bicycle speedometers),
C1
which closes the reed switch
R3
1k
BT1
once for every revolution of the
1u
wheel. Whilst the wheel turns,
16V
3V
S1
pulses are fed to the base of T1
via C1. This charges a small elecN
S
trolytic capacitor (C2). When it is
dark enough and the LDR therefore has a high resistance, T2
starts conducting and the lamp
is turned on. With every revolution of the wheel C2 is charged
up again. The charge in C2 ensures that T2
keeps conducting for about a minute after
the wheel stops turning. Almost any type of
light can be connected to the output of the
circuit.
With a supply voltage of 3V the quiescent
current when the reed switch is open is just
0.14 μA. When the magnet happens to be in
a position such that S1 is closed,
the current is 3 μA. In either case
COMPONENT LIST
there is no problem using batteries to supply the circuit. The
Resistors
supply voltage can be anywhere
R1 = 1MΩ (SMD 0805)
from 3 to 12 V, depending on the
R2,R4 = 100kΩ (SMD 0805)
type of lamp that is connected.
R3,R6 = 1kΩ (SMD 0805)
Since it is likely that the circuit
R5 = LDR e.g. FW150 Conrad
Electronics # 183547
will be mounted inside a bicycle light it is important to keep
Capacitors
an eye on its dimensions. The
C1 = 1µF 16V (SMD 0805)
board has therefore been kept
C2 = 10µF 16V (SMD chip type)
very compact and use has been
T1
BC807
R4
100k
C2
R6
R5
1k
10u
16V
For the MOSFET there are also
many alternatives available,
such as the FDS6064N3 made
by Fairchild, the SI4 86 4DY
C3
m a d e by V i s h ay Si l i co n i x ,
the IRF7404 made by IRF or
100n
the NTMS4N01R2G made by
ONSEMI. The reed switch also
T2
comes in many different shapes
and sizes; some of them are
even waterproof and come with
STS6NF20V
the wires already attached.
For the supply connection and
the connection to the lamp you
090102 - 11
can either use PCB pins or solder the wires directly onto the
board. The soldered ends of the
pins can be shortened slightly so that they
don’t stick out from the bottom of the board.
This reduces the chance of shorts with any
metal parts of the light.
Do take care when you use a dynamo to
power the circuit — the alternating voltage
must first be rectified! The same applies to
hub dynamos, which often also output an
alternating voltage.
C3 = 100nF (SMD 0805)
Semiconductors
T1 = BC807 (SMD SOT23)
T2 = STS6NF20V (SMD SO8)
Miscellaneous
S1 = reed switch (not on board) +
2-way right angle pinheader
BT1 = 3–12V (see text)
Please Note. Bicycle lighting
is subject to legal restrictions,
traffic laws and, additionally in
some countries, type approval.
(090102-I)
Download
090102-1 PCB layout (.pdf), from www.
elektor.com/090102
121
PC Power Saver
Wolfgang Gscheidle (Germany)
L
122
L
TR1
R1
*
B1
3k3
N
B50C800
230V/18V/0VA5
(120V/18V/0VA5)
C1
C2
33n
47u
50V
R2
D1
10k
S1
12V
0W5
C3
C4
33n
1u
16V
D2
*
RE1
24V
1N4148
*
D5
R4
D3
100k
P1
4
470k
R3
2
1N4148
10k
This circuit is designed to help minimise the
quiescent power consumption of PCs and
notebooks, using just our old friend the 555
timer and a relay as the main components. The
circuit itself dissipates around 0.5 W in operation (that is, when the connected PC is on);
when switched off (with the relay not energised) the total power draw is precisely zero.
A prerequisite for the circuit is a PC or note
book with a USB or PS/2 keyboard socket that
is powered only when the PC is on.
The power saver can be used to switch PCs
or even whole multi-way extension leads. The unit can be built
into an ordinary mains adaptor (which must have an earth
pin!) as the photograph of the
author‘s prototype shows. The
PC is plugged in to the socket
at the output of the power saver
unit, and an extra connection
is made to the control input of
the unit from a PS/2 (keyboard or
mouse) socket or USB port. Only
the 5 V supply line of the interface is
used.
When button S1 on the power saver
is pressed the unit turns on, and the
monostable formed by the 555 timer is
triggered via the network composed by
R4 and C7. This drives relay RE1, whose contacts close. The connected PC is now tentatively powered up via the relay for a period
determined by P1 (approximately in the
range from 5 s to 10 s).
If, during this interval, the PC fails to indicate
that it is alive by supplying 5 V from its USB or
PS/2 connector (that is, if you do not switch
it on), the monostable period will expire, the
relay will drop out and any connected device
will be powered down. No further current will
be drawn from the supply, and, of course, it
will not be possible to turn the PC on. Whenever you want to turn the PC on, you must
always press the button on the power saver
shortly beforehand.
If, however, 5 V is delivered by the PC to the
input of optocoupler IC2 before the monostable times out (which will be the case if the
PC is switched on during that period), the
transistor in the optocoupler will conduct
and discharge capacitor C6. The monostable
will now remain triggered and the relay will
remain energised until the PC is switched off
and power disappears from its USB or PS/2
interface. Then, after the monostable time
period expires, the relay will drop out and the
power saver will disconnect itself from the
+5V
R6
1
USB; PS/2
6
7
R7
IC2
470R
6
1k
5
TR
IC1
OUT
DIS
TLC555
1N4148
2
4
CNY17/3
T1
R5
22k
BC546B
THR
5
C5
D4
3
CV
C6
C7
C8
22u
16V
1u
16V
33n
10n
GND
8
R
1
080581 - 11
used to supply power to the device
itself, and the other contact carries
all the current for the connected
PC or for the extension lead to
which the PC and peripherals are
connected.
mains. There is no need to switch anything
else off: just shut down the system and the
power saver will take care of the rest. It is also
possible to leave the machine as it updates its
software, and the power saver will do its job
shortly after the machine shuts down.
Power for the unit itself is obtained using a
simple supply circuit based around a miniature transformer. Alternatively, a 12 V mains
adaptor can be used, as long as a relay with a
12 V coil voltage is used for RE1. In his prototype the author used a relay with a 24 V coil
connected as shown directly to the positive
side of reservoir capacitor C2, the 555 being
powered from 12 V regulated from that supply using R1 and D1. A fixed resistor can of
course be used in place of P1 if desired. If the
adjustment range of P1 is not sufficient (for
example if the PC powers up very slowly) the
monostable period can be increased by using
a larger capacitor at C6.
The relay must have at least two normallyopen (or changeover) contacts rated at at
least 8 A. The contact in parallel with S1 is
Pushbutton S1 must be rated for 230 VAC
(US: 120 VAC) operation: this is no place to
make economies. The coil current for the relay
flows through LED D5, which must therefore
be a 20 mA type. If a low-current LED is used,
a 120 Ω resistor can be connected in parallel with it to carry the remaining current.
The Fujitsu FTR-F1CL024R relay used in the
author’s prototype has a rated coil current of
16.7 mA.
Optocoupler IC2 provides isolation between
the circuit and the PC, and is protected from
reverse polarity connection by diode D4.
The power saver should be built into an insulated enclosure and great care should be
taken to ensure that there is proper isolation
between components and wires carrying the
mains voltage and the other parts of the circuit. In particular, the connection to the PC
and associated components (R6, C5, D4 and
IC2) should be carefully arranged with at least
a 6 mm gap between them and any part of
the circuit at mains potential.
(080581-I)
elektor - 7-8/2009
DVD LED Toolbox
More than 100 Elektor articles included!
This DVD-ROM contains carefully-sorted comprehensive technical documentation
NEW
(optical properties, electrical characteristics, mounting, life expectancy, etc.) about
!
and around LEDs. For standard models (through-hole, SMD), and for a selection of
LED modules (ribbons, light bars, bargraphs, and other LED clusters), this DVD
gathers together data sheets from all the manufacturers, application notes, design
guides, white papers and so on. It offers several hundred drivers for powering and
controlling LEDs in different configurations (buck, boost, charge pump, constant
current, and so on), along with ready-to-use modules (power supply units, DMX
controllers, dimmers, etc.). In addition to optical systems, light
detectors, hardware, etc., this DVD also addresses the main
ISBN 978-90-5381-245-7
£28.50 • US $54.00
Elektor
Regus Brentford
1000 Great West Road
Brentford TW8 9HH
United Kingdom
Tel. +44 20 8261 4509
shortcoming of power LEDs: heating.
Further information and ordering at www.elektor.com/shop
INDEX OF ADVERTISERS
Allendale Electronics . . . . . . . . . . . . . . . . . www.pcb-soldering.co.uk . . . . . . . . . . . . . . . . 79
London Electronics College, Showcase . . . www.lec.org.uk . . . . . . . . . . . . . . . . . . . . . . . 126
APD, Showcase . . . . . . . . . . . . . . . . . . . . . www.apdanglia.org.uk. . . . . . . . . . . . . . . . . . 127
MikroElektronika. . . . . . . . . . . . . . . . . . . . . www.mikroe.com . . . . . . . . . . . . . . . . . 3, 25, 65
Avit Research, Showcase. . . . . . . . . . . . . . www.avitresearch.co.uk . . . . . . . . . . . . . . . . 126
MQP Electronics, Showcase. . . . . . . . . . . . www.mqp.com . . . . . . . . . . . . . . . . . . . . . . . 127
Bitscope Designs . . . . . . . . . . . . . . . . . . . . www.bitscope.com . . . . . . . . . . . . . . . . . . . . . . 2
Netronics, Showcase . . . . . . . . . . . . . . . . . www.cananalyser.co.uk . . . . . . . . . . . . . . . . . 127
Black Robotics, Showcase . . . . . . . . . . . . . www.blackrobotics.com . . . . . . . . . . . . . . . . 126
Newbury Electronics . . . . . . . . . . . . . . . . . www.newburyelectronics.co.uk . . . . . . . . . . . 113
ByVac, Showcase . . . . . . . . . . . . . . . . . . . www.byvac.com . . . . . . . . . . . . . . . . . . . . . . 126
Nurve Networks . . . . . . . . . . . . . . . . . . . . . www.xgamestation.com . . . . . . . . . . . . . . . . 113
C S Technology Ltd, Showcase . . . . . . . . . www.cstechnology.co.uk. . . . . . . . . . . . . . . . 126
Paltronix. . . . . . . . . . . . . . . . . . . . . . . . . . . www.paltronix.com . . . . . . . . . . . . . . . . . . . . . . 9
Decibit Co. Ltd, Showcase . . . . . . . . . . . . . www.decibit.com . . . . . . . . . . . . . . . . . . . . . 126
Parallax . . . . . . . . . . . . . . . . . . . . . . . . . . . www.parallax.com. . . . . . . . . . . . . . . . . . . . . . 87
Designer Systems, Showcase . . . . . . . . . . www.designersystems.co.uk. . . . . . . . . . . . . 126
PCBCORE . . . . . . . . . . . . . . . . . . . . . . . . . www.pcbcore.com . . . . . . . . . . . . . . . . . . . . . 47
EasyDAQ, Showcase . . . . . . . . . . . . . . . . . www.easydaq.biz . . . . . . . . . . . . . . . . . . . . . 126
Peak Electronic Design. . . . . . . . . . . . . . . . www.peakelec.co.uk . . . . . . . . . . . . . . . . . . . 135
Easysync, Showcase . . . . . . . . . . . . . . . . . www.easysync.co.uk. . . . . . . . . . . . . . . . . . . 126
Pico. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . www.picotech.com/scope1019. . . . . . . . . . . . 55
Elnec, Showcase . . . . . . . . . . . . . . . . . . . . www.elnec.com . . . . . . . . . . . . . . . . . . . . . . 126
Quasar Electronics . . . . . . . . . . . . . . . . . . . www.quasarelectronics.com . . . . . . . . . . . . . 109
Eltim Audio . . . . . . . . . . . . . . . . . . . . . . . . www.eltim.eu . . . . . . . . . . . . . . . . . . . . . . . . . 95
Robot Electronics, Showcase . . . . . . . . . . . www.robot-electronics.co.uk. . . . . . . . . . . . . 127
Eurocircuits . . . . . . . . . . . . . . . . . . . . . . . . www.eurocircuits.com . . . . . . . . . . . . . . . . . 113
Robotiq, Showcase . . . . . . . . . . . . . . . . . . www.robotiq.co.uk . . . . . . . . . . . . . . . . . . . . 127
First Technology Transfer Ltd, Showcase . . www.ftt.co.uk . . . . . . . . . . . . . . . . . . . . . . . . 126
FlexiPanel Ltd, Showcase . . . . . . . . . . . . . . www.flexipanel.com . . . . . . . . . . . . . . . . . . . 126
Future Technology Devices, Showcase . . . . www.ftdichip.com . . . . . . . . . . . . . . . . . . 37 ,126
Showcase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126, 127
USB Instruments, Showcase . . . . . . . . . . . www.usb-instruments.com . . . . . . . . . . . . . . 127
Virtins Technology, Showcase . . . . . . . . . . www.virtins.com . . . . . . . . . . . . . . . . . . . . . . 127
Good Will Instruments . . . . . . . . . . . . . . . . www.gwinstek.com. . . . . . . . . . . . . . . . . . . . . . 8
Hameg, Showcase . . . . . . . . . . . . . . . . . . . www.hameg.com . . . . . . . . . . . . . . . . . . . . . 126
HexWax Ltd, Showcase . . . . . . . . . . . . . . . www.hexwax.com . . . . . . . . . . . . . . . . . . . . . 126
Labcenter. . . . . . . . . . . . . . . . . . . . . . . . . . www.labcenter.com. . . . . . . . . . . . . . . . . . . . 136
Lcdmod Kit, Showcase . . . . . . . . . . . . . . . www.lcdmodkit.com . . . . . . . . . . . . . . . . . . . 126
7-8/2009 - elektor
Advertising space for the issue of 24 September 2009
may be reserved not later than 25 August 2009
with Huson International Media - Cambridge House - Gogmore Lane Chertsey, Surrey KT16 9AP - England - Telephone 01932 564 999 Fax 01932 564 998 - e-mail: [email protected] to whom all
correspondence, copy instructions and artwork should be addressed.
123
infotainment
puzzle
Hexamurai –
Who’ll be the one to beat it?
Game designer: Claude Ghyselen (France)
Following our usual tradition, we’re offering you an outsize game
in this double issue. Hiding behind what looks like a pretty coloured flower lurks a fearsome Hexadoku Samurai, or Hexamurai for short. Those who enjoy Hexadoku (and modern art) are
bound to appreciate this grid that goes beyond tough. And in
the (unlikely) event you can’t manage to solve it, at least you’ll
always be able to hang it on the wall.
The Hexamurai is a Hexadoku grid based on the Samurai model, i.e.
4 standard Hexadoku grids linked to a fifth one in the middle. But
unlike a normal Samurai game, the Hexamurai doesn’t let you solve
D 2
B
8
D 9
9
A
1
F
5
A
3 4
D 1
F
A B
2
1
A
2
E
C 7
5
C
4
2
5 3
4 8 2 F
1
7 E B
0
A F 9 C
4 0
1
5
6
5
E
4 F 9
0
A
5
8
2
3
0
5
6 2
6
3
8
9
3
2
F
9
2
3
C
0
A
0
1
7
B 2
8
D 1
0 9 5
5
3
4
E
6 8
9
2
124
The instructions for solving this puzzle are the same as for a standard
Sudoku (with a few modifications!)
Like Hexadoku, Hexamurai uses the figures of the hexadecimal system, namely 0 to F.
Fill in the grid in such a way that all the hexadecimal figures from 0 to
F (0–9 and A–F) are used once and only once in each row, column,
and square of 4×4 boxes (identified by different colours) of a sub-Hexadoku (identified by a thicker line). Certain figures are already entered
8
0
4 B 3
D
7 8 D B
C
8
3 B A
4
6 D 1 F
0 1
4
F 7
1 B 5 F
7
8
E
6
0
7 1
8
6
3 4 B
F A D C
6
2
7
E
8 7
3
1
2 C B 4
9
0 8 F
8
3 C
9 3 E
2 B
1
7 9 A D
3
6
4
C
4 8
0 A
F
5 6
B 2 7 9
E
C
each of the grids separately — you have to solve them all together,
obeying the Hexadoku rules for each grid in turn.
9
F 5
8
1 A
5
6
8 C
E 6 3
7
C
9
1 A
3 4
F
D A 6
C 5
D A 4
B
B
F
5 E
E
E
6 D 1
C
D
2 7
F
0
9
D
D
1
7 6 9
4 3 C F 2
A 5
B
D
A
E
4
D
0
9
6 1
A
C
6
B
9
D
8
7
1
8
F A
5
8
7
4
3 B
5 B 2 F
7 4 E
6
1
E D
2
8 B 6 2
D A
2
8
0
A
6 E
0
B
8 4
C
E
9
A 7 C E
B
9 4 0 6
F A
0
7
1
3 6
2 F 4 9
B
C
9 D
2
1
F
8
A 2 7 C
9
5 A 4
0
9
E
D
5
A
4
C E 2 5
D
A
6
7
C 8
5
0
8
4
D
F 9 3
1
7
B
5
8
9
3 8 2
1
9
7 3 B
B
7
8
5
6
E
0
4 C
D F
E 5 3
B 8
F
3
1 9
9
6 D E
C 7 4 0
elektor - 7-8/2009
into the grid, defining the starting point for you.
If you can solve this puzzle, there
are some nice prizes to be won.
All you have to do is send us the
five figures in yellow, reading
from top to bottom.
The puzzle is also available as a
free download from the Elektor
website.
Alternatively, by fax or post to:
Elektor Hexadoku
c/o Regus Brentford
1000, Great West Road
Brentford TW8 9HH
United Kingdom.
Fax (+44) 208 2614447
The closing date is
1 September 2009.
The competition is not open to employees of
Elektor International Media, its business partners
and/or associated publishing houses.
Solve Hexamurai and win!
Correct solutions received from
the entire Elektor readership
automatically enter a prize draw
for an E-blocks Starter Kit Professional worth £ 300 / € 375 (rrp)
and three Elektor Electronics
SHOP Vouchers worth £ 40.00 /
€ 50.00. We believe these prizes
should encourage all our readers
to participate!
Participate!
Subject: hexamurai 07-2009 (please copy
exactly).
Please send your solution (the numbers in
the grey boxes) by email to
[email protected]
Include with your solution: full name and
street address.
Prize winners
The solution of the May 2009
Hexadoku is: 857C9.
The E-blocks Starter Kit
Professional goes to:
Marcel Delomenede (France).
An Elektor SHOP voucher
goes to: Adrian Bradshaw
(UK); Thomas Raith (Germany); HeinzDieter Richter (Germany).
Congratulations everybody!
(081169-I)
See your project in print!
Elektor magazine is looking for
Technical Authors/Design Engineers
If you have
a an innovative or original project you’d like to share with Elektor’s 140 k+
readership and the electronics community
a above average skills in designing electronic circuits
a experience in writing electronics-related software
a basic skills in complementing your hardware or software with explanatory text
a a PC, email and Internet access for efficient communications with Elektor’s
centrally located team of editors and technicians
then don’t hesitate to contact us for exciting opportunities to get your project or feature article published.
Our Author Guidelines are at: www.elektor.com/authors.
Elektor
Jan Buiting MA, Editor
Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, United Kingdom
Email: [email protected]
7-8/2009 - elektor
125
ELEKTORSHOWCASE
To book your showcase space contact Huson International Media
Tel. 0044 (0) 1932 564999 Fax 0044 (0) 1932 564998
AVIT RESEARCH
www.avitresearch.co.uk
USB has never been so simple...
with our USB to Microcontroller Interface cable.
Appears just like a serial port to both PC and
Microcontroller, for really easy USB connection to
your projects, or replacement of existing RS232
interfaces.
See our webpage for more
details. From £10.00.
BLACK ROBOTICS
www.blackrobotics.com
Robot platforms and brains for
research, hobby and education.
• Make your robot talk!
• TalkBotBrain is open-source
• Free robot speech software
• Robot humanisation technology
• Mandibot Gripper Robot
BYVAC
www.byvac.com
• USB to I2C
• Microcontrollers
• Forth
• Serial Devices
C S TECHNOLOGY LTD
www.cstechnology.co.uk
Low cost PIC prototyping kits, PCB's and
components, DTMF decoder kits, CTCSS, FFSK,
GPS/GSM, radio equipment and manuals.
PCB design and PIC program development.
DECIBIT CO.LTD.
www.decibit.com
• Development Kit 2.4 GHz
• Transceiver nRF24L01
• AVR MCU ATmega168
DESIGNER SYSTEMS
http://www.designersystems.co.uk
Professional product development services.
• Marine (Security, Tracking, Monitoring & control)
• Automotive (AV, Tracking,
Gadget, Monitoring & control)
• Industrial (Safety systems,
Monitoring over Ethernet)
• Telecoms (PSTN handsets, GSM/GPRS)
• AudioVisual ((HD)DVD accessories & controllers)
Tel: +44 (0)1872 223306
126
EASYDAQ
www.easydaq.biz
• USB powered, 4 relays + 4 DIO channels
• Will switch 240VAC @ 10 amps
• Screw terminal access
• LabVIEW, VB, VC
• Free shipping
• From £38
Design & supply of USB, USB Wireless,
Ethernet & Serial, DAQ, Relay & DIO card
products.
[email protected]
FUTURE TECHNOLOGY DEVICES
http://www.ftdichip.com
FTDI designs and sells
USB-UART and USB-FIFO
interface i.c.’s.
Complete with PC drivers,
these devices simplify the task of designing or
upgrading peripherals to USB
EASYSYNC
http://www.easysync.co.uk
EasySync Ltd sells a wide
range of single and multiport USB to RS232/RS422
and RS485 converters at competitive prices.
ELNEC
www.elnec.com
• device programmer
manufacturer
• selling through contracted
distributors all over the world
• universal and dedicated device programmers
• excellent support and after sale support
• free SW updates
• reliable HW
• once a months new SW release
• three years warranty for most programmers
FIRST TECHNOLOGY TRANSFER LTD.
http://www.ftt.co.uk
• Training and Consulting
for IT, Embedded and
Real Time Systems
• Assembler, C, C++ (all levels)
• 8, 16 and 32 bit microcontrollers
• Microchip, ARM, Renesas, TI, Freescale
• CMX, uCOSII, FreeRTOS, Linux operating
systems
• Ethernet, CAN, USB, TCP/IP, Zigbee, Bluetooth
programming
FLEXIPANEL LTD
www.flexipanel.com
TEAclippers - the smallest
PIC programmers in the world,
from £20 each:
• Per-copy firmware sales
• Firmware programming & archiving
• In-the-field firmware updates
• Protection from design theft by subcontractors
HEXWAX LTD
www.hexwax.com
World leaders in Driver-Free USB ICs:
• USB-UART/SPI/I2C bridges
• TEAleaf-USB authentication dongles
• expandIO-USB I/O USB expander
• USB-FileSys flash drive with SPI interface
• USB-DAQ data logging flash drive
LONDON ELECTRONICS COLLEGE
http://www.lec.org.uk
Vocational training and education
for national qualifications in
Electronics Engineering and
Information Technology (BTEC First National,
Higher National NVQs, GCSEs and GCEs). Also
Technical Management and Languages.
LCDMOD KIT
http://www.lcdmodkit.com
Worldwide On-line retailer
• Electronics components
• SMT chip components
• USB interface LCD
• Kits & Accessories
• PC modding parts
• LCD modules
elektor - 7-8/2009
products and services directory
www.elektor.com
MQP ELECTRONICS
www.mqp.com
• Low cost USB Bus Analysers
• High, Full or Low speed captures
• Graphical analysis and filtering
• Automatic speed detection
• Bus powered from high speed PC
• Capture buttons and feature connector
• Optional analysis classes
RFID COMPONENTS
http/www.apdanglia.org.uk
For DIY, OEM's & Experimenters
• EM4100 Cards .99 p (Prices inc vat)
• Keyfobs £1.09
• R/W Keyfobs £1.65
• RFID Coils £2.95
• RFID PCB
with RS232 port
• RFID IC’s EM4095 - U2270B
• microRFID module (similar to Core ID12)
• Free Reader download - Technical pages
Order online 24 hrs - Tel: 01244 520684
ROBOT ELECTRONICS
http://www.robot-electronics.co.uk
Advanced Sensors and Electronics for Robotics
• Ultrasonic Range Finders
• Compass modules
• Infra-Red Thermal sensors
• Motor Controllers
• Vision Systems
• Wireless Telemetry Links
• Embedded Controllers
ROBOTIQ
http://www.robotiq.co.uk
Build your own Robot!
Fun for the whole family!
• MeccanoTM Compatible
• Computer Control
• Radio Control
• Tank Treads
• Hydraulics
Internet Technical Bookshop,
1-3 Fairlands House, North Street, Carshalton,
Surrey SM5 2HW
email: [email protected] Tel: 020 8669 0769
www.elektor.com
USB INSTRUMENTS
http://www.usb-instruments.com
USB Instruments specialises
in PC based instrumentation
products and software such
as Oscilloscopes, Data
Loggers, Logic Analaysers
which interface to your PC via USB.
VIRTINS TECHNOLOGY
www.virtins.com
PC and Pocket PC based
virtual instrument such
as sound card real time
oscilloscope, spectrum
analyzer, signal generator,
multimeter, sound meter,
distortion analyzer, LCR meter.
Free to download and try.
CANDO – CAN BUS ANALYSER
http://www.cananalyser.co.uk
• USB to CAN bus interface
• USB powered
• FREE CAN bus analyser S/W
• Receive, transmit & log.
CAN messages
• ISO11898 & CAN
2.0a/2.0b compliant
• Rugged IP67 version available
SHOWCASE YOUR COMPANY HERE
Elektor Electronics has a feature to help
customers promote their business,
Showcase - a permanent feature of the
magazine where you will be able to showcase
your products and services.
• For just £242 + VAT (£22 per issue for
eleven issues) Elektor will publish your
company name, website address and a
30-word description
• For £363 + VAT for the year (£33 per
issue for eleven issues) we will publish
the above plus run a 3cm deep full colour
image - e.g. a product shot, a screen shot
from your site, a company logo - your
choice
Places are limited and spaces will go on
a strictly first come, first served basis.
So-please fax back your order today!
I wish to promote my company, please book my space:
• Text insertion only for £242 + VAT • Text and photo for £363 + VAT
NAME: ..................................................................................................... ORGANISATION: .......................................................................................
JOB TITLE: ......................................................................................................................................................................................................................
ADDRESS: .......................................................................................................................................................................................................................
...........................................................................................................................................................................................................................................
................................................................................................................... TEL: ..............................................................................................................
PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 00-44-(0)1932 564998
COMPANY NAME .........................................................................................................................................................................................................
WEB ADDRESS ..............................................................................................................................................................................................................
30-WORD DESCRIPTION .............................................................................................................................................................................................
...........................................................................................................................................................................................................................................
...........................................................................................................................................................................................................................................
...........................................................................................................................................................................................................................................
...........................................................................................................................................................................................................................................
7-8/2009 - elektor
127
SHOP
BOOKS, CD-ROMS, DVDS, KITS & MODULES
Going Strong
A world of electronics
from a single shop!
Bring your microcontroller to life
Artificial Intelligence
!
W
NE
This book contains 23 special and exciting artificial intelligence machine-learning projects, for microcontroller and PC.
Learn how to set up a neural network in a
microcontroller, and how to make the network self-learning. Or discover how you
can breed robots, and how changing
a fitness function results in a totally different behavior. Several artificial intelligence techniques are discussed: expert
system, neural network, subsumption,
emerging behavior, genetic algorithm,
cellular automata. roulette brains etc.
256 pages • ISBN 978-0-905705-77-4
£32.00 • US $46.00
er
Limited Period Off
for Subscribers!
£5 DISCOUNT
uly
www.elektor.com/j
Books
Creative solutions for all areas of electronics
310 Circuits
The 30x series of Summer Circuit compilation books have been bestsellers for many years. The 11th
volume is available now! 310 circuits, tips and design ideas in one book form a treasure trove for
every area of electronics: audio and video, hobby and modelling, RF techniques, home and garden,
test and measurement, microcontrollers, computer hardware and software, power supplies and
chargers – plus of course everything else that does not seem to belong in any of these categories.
310 Circuits for the first time has a section exclusively on robots and robotics. This book contains
many complete solutions as well as useful starting points for your own projects. Both categories and
anything in between represent a veritable fountain of inspiration for cultivating your own ideas and
learning about electronics. This is a must-have book for every creative electronics enthusiast, be it
professional, enthusiast or student.
544 pages • ISBN 978-0-905705-78-1 • £29.90 • US $45.00
Fully elaborated
electronics
Connect
your mouse
into newprojects
embedded applications
309 Circuits
Mouse
Interfacing
The present
tenth edition
of the
This
book describes
in-depth
howpopular
to con‘30xthe
Circuits’
of books
once again
nect
mouseseries
into new
embedded
applicontainsItadetails
comprehensive
variety
of circations.
the two main
interface
cuits, sub-circuits,
and
tricks
and
demethods,
PS/2 andtips
USB,
and
offers
applisign ideas
for electronics.
Among
cations
guidance
with hardware
andmany
softotherexamples
inspiring plus
topics,
following catware
tipsthe
on interfacing
the
egoriestoare
well microcontrollers.
presented in thisAbook:
mouse
typical
wide
test & of
measurement;
RF (radio);
range
topics is explored,
includingcomUSB
puters and aperipherals;
audio
& video;
descriptors,
four-channel,
millivolt-precihobby
and modelling;
microcontrollers;
sion
voltage
reference all
with fully docuhome &source-code.
garden; etcetera.
mented
432 pages
pages •
• ISBN
ISBN 978-0-905705-74-3
978-0-905705-69-9
256
£19.95
•
US
$39.95
£26.50 • US $53.00
Prices and item descriptions subject to change. E. & O.E
128
elektor - 7-8/2009
Bestseller!
New!
Learn by doing
Learn more about C# programming and .NET
C Programming
C# 2008 and
.NET programming
for Embedded Microcontrollers
If you would like to learn the C Programming language to program microcontrollers, then this book is for you. No programming experience is necessary! You’ll
start learning to program from the very
first chapter with simple programs and
slowly build from there. Initially, you program on the PC only, so no need for dedicated hardware. This book uses only free
or open source software and sample programs and exercises can be downloaded
from the Internet.
324 pages • ISBN 978-0-905705-80-4
£32.50 • US $52.00
for Electronic Engineers
This book is aimed at Engineers and
Scientists who want to learn about the
.NET environment and C# programming
or who have an interest in interfacing
hardware to a PC. The book covers the
Visual Studio 2008 development environment, the .NET framework and C# programming language from data types and
program flow to more advanced concepts
including object oriented programming. It
continues with program debugging, file
handling, databases, internet communication and plotting before moving to hardware interfacing using serial and parallel
ports and the USB port. It includes a hardware design for a simple oscilloscope using a parallel port and interfacing to
analogue and digital I/O using the USB
port. This book is complete with many program examples, self assessment exercises
and references to supporting videos.
240 pages • ISBN 978-0-905705-81-1
£29.50 • US $44.50
45 projects for PIC, AVR and ARM
Microcontroller
Systems Engineering
329 pages • ISBN 978-0-905705-75-0
£29.00 • US $52.00
www.elektor.com
Elektor
Regus Brentford
1000 Great West Road
Brentford
TW8 9HH
United Kingdom
Tel.: +44 20 8261 4509
Fax: +44 20 8261 4447
Email: [email protected]
DVD i-TRIXX
Freeware Collection 2009
This DVD contains 100 nifty freeware
applications, tools and utilities for the Windows PC. And as a free extra, it contains
the full and searchable (!) i-TRIXX archive,
with all the editions up until week 8 of
2009 from i-TRIXX, the e-magazine published by Elektor. Do you feel the need for
a decent and reliable antivirus program?
A bandwidth monitor which keeps track of
your current up and download rate? An
application for recording, editing and converting video to any conceivable format?
Anonymous surfing from any internet
access point from a USB stick? Checking,
optimizing and cleaning up your computer? Keeping track of your privacy? You
can expect that and much more in the
i-TRIXX Freeware Collection 2009.
ISBN 978-90-5381-244-0 • £27.50 • US $39.50
Bestseller!
Completely updated
Elektor’s Components
Database 5
The program package consists of eight
databanks covering ICs, germanium and
silicon transistors, FETs, diodes, thyristors,
triacs and optocouplers. A further eleven
applications cover the calculation of, for example, LED series droppers, zener diode
series resistors, voltage regulators and
AMVs. A colour band decoder is included
for determining resistor and inductor values. ECD 4 gives instant access to data on
more than 69,000 components. All databank applications are fully interactive, allowing the user to add, edit and complete
component data. This CD-ROM is a musthave for all electronics enthusiasts.
ISBN 978-90-5381-159-7 • £24.90 • US $39.50
CD/DVD-ROMs
This book covers 45 exciting and fun Flowcode projects for PIC, AVR and ARM
microcontrollers. Each project has a clear
description of both hardware and software
with pictures and diagrams, which explain
not just how things are done but also why.
As you go along the projects increase in
difficulty and the new concepts are explained. You can use it as a projects book,
and build the projects for your own use.
Or you can use it as a study guide.
More information on the
Elektor Website:
Incl. searchable i-TRIXX archive
Inc
7-8/2009 - elektor
129
CD/DVD-ROMs
SHOP
BOOKS, CD-ROMS, DVDS, KITS & MODULES
The 32-bit Machine
New!
Bestseller!
See the light on Solid State Lighting
DVD LED Toolbox
This DVD-ROM contains carefully-sorted
comprehensive technical documentation
about and around LEDs. For standard
models, and for a selection of LED modules, this Toolbox gathers together data
sheets from all the manufacturers, application notes, design guides, white papers
and so on. It offers several hundred drivers for powering and controlling LEDs in
different configurations, along with
ready-to-use modules (power supply
units, DMX controllers, dimmers, etc.). In
addition to optical systems, light detectors, hardware, etc., this DVD also addresses the main shortcoming of power
LEDs: heating. Of course, this DVD contains several Elektor articles (more than
100) on the subject of LEDs.
Experimenting
with the MSP430
(May 2009)
All the big electronics manufacturers supply microcontrollers offering a wide range of functions. Texas Instruments supplies
handy USB evaluation sticks with related
software for its low-cost MSP430 controllers. Unfortunately the I/O facilities are
somewhat limited. These can be substantially enhanced with the help of the Elektor
MSP430 board.
PCB, populated and tested
Art.# 080558-91 • £35.00 • US $55.00
(April 2009)
With this attractively priced starter kit you
get everything you need for your first handson experiments with the new R32C/
111 32-bit microcontroller. The power supply is drawn from your computer via the
USB connection, which simplifies things
rather nicely. The starter kit consists of an
R32C carrier board (a microcontroller
module equipped with the R32C/111 chip)
and a software CD-ROM containing
the necessary development tools. As with
the earlier R8C/13 ‘Tom Thumb’ project in
Elektor Electronics (November 2005
through March 2006), the R32C carrier
board is an in-house-development of Glyn,
an authorised distributor for Renesas in
Germany.
TI eZ430-F2013 Evaluation Kit
R32C/111 Starterkit (32-bit-Controllerboard & CD-ROM)
Art.# 080558-91 • £24.50 • US $35.00
Art.# 080928-91 • £27.00 • US $42.50
ISBN 978-90-5381-245-7 • £28.50 • US $54.00
All articles published in 2008
This DVD-ROM contains all editorial articles published in Volume 2008 of the
English, Spanish, Dutch, French and German editions of Elektor magazine. Using
Adobe Reader, articles are presented in
the same layout as originally found in
the magazine. The DVD is packed with
features including a powerful search engine and the possibility to edit PCB layouts
with a graphics program, or printing hard
copy at printer resolution.
ISBN 978-90-5381-235-8 • £17.50 • US $35.00
M16C TinyBrick
(April 2009)
(March 2009)
Since cars contain an ever increasing
amount of electronics, students learning
about motor vehicle technology also need
to know more about electronics and microcontrollers. In collaboration with the
Timloto o.s. Foundation in the Netherlands, Elektor designed a special controller PCB, which will be used in schools in
several countries for teaching students
about automotive technologies. But it can
also be used for other applications, of
course. The heart of this board is an Atmel
AT90CAN32 with a fast RISC core.
A TinyBrick is a small self-contained microcontroller module fitted with a powerful Renesas 16-bit M16C microcontroller.
A BASIC interpreter is installed in the
module to simplify software development. Beginners will find it an ideal starting out point while more experienced
users will appreciate its power and convenience. With this evaluation board (together with a TinyBrick) you can build an
intruder alarm that sends SMS texts.
Kit of parts, incl. PCB with SMDs prefitted
Kit of parts incl. TinyBrick-PCB with SMD
parts and microntroller premounted plus
all other parts
Art.# 080671-91 • £52.00 • US $79.00
Art.# 080719-91 • £54.00 • US $87.50
Kits & Modules
DVD Elektor 2008
Automotive CAN controller
Prices and item descriptions subject to change. E. & O.E
130
elektor - 7-8/2009
May 2009 (No. 389)
Experimenting with the MSP430
080558-91 ....PCB, populated and tested ...............................................35.00........55.00
080558-92 ....TI eZ430-F2013 Evaluation Kit .........................................24.50........35.00
RGB LED Driver
080178-41 ....Programmed controller ......................................................8.90........13.75
April 2009 (No. 388)
The 32-bit Machine
080928-91 ....R32C/111 Starterkit
(32-bit-Controllerboard & CD-ROM) ................................27.00........42.50
Automotive CAN Controller
080671-91 ....Kit of parts, incl. PCB with SMDs prefitted .........................52.00........79.00
Automatic Running-in Bench
080253-71 ....Kit of parts incl. PCB-1 with SMDs prefitted ....................185.00......270.00
090146-91 ....ARMee plug-in board mk. II .............................................50.00........74.00
March 2009 (No. 387)
M16C TinyBrick
080719-91 ....Kit of parts: TinyBrick-PCB with SMD parts and
microntroller premounted; plus all other parts ................54.00........87.50
February 2009 (No. 386)
Model Coach Lighting Decoder
080689-1 ......PCB, long (l = 230 mm) ....................................................7.30........10.95
080689-2 ......PCB, medium (l = 190mm) ...............................................7.30........10.95
080689-3 ......PCB, short (l = 110mm) ....................................................5.80..........8.95
080689-41 ....PIC12F683, programmed ...................................................6.20..........9.50
Transistor Curve Tracer
080068-1 ......Main PCB ..........................................................................26.50........42.00
080068-91 ....PCB, populated and tested ...............................................55.00........82.50
January 2009 (No. 385)
Radio for Microcontrollers
071125-71 ....868 MHz module ................................................................7.20..........9.95
ATM18 on the Air
071125-71 ....868 MHz module ................................................................7.20..........9.95
Meeting Cost Timer
080396-41 ....ATmega168, programmed .................................................8.50........12.50
Capacitive Sensing and the Water Cooler
080875-91 ....Touch Sensing Buttons Evaluation kit ...............................27.50........39.95
080875-92 ....Touch Sensing Slider Evaluation kit ..................................27.50........39.95
Three-Dimensional Light Source
080355-1 ......Printed circuit board ........................................................24.90........39.90
Moving up to 32 Bit
080632-91 ....ECRM40 module ...............................................................32.00........46.50
December 2008 (No. 384)
PLDM
071129-1 ......Printed circuit board ...........................................................5.80..........9.50
Hi-fi Wireless Headset
080647-1 ......Printed circuit board: Transmitter.......................................7.90........15.80
080647-2 ......Printed circuit board: Receiver............................................7.90........15.80
LED Top with Special Effects
080678-71 ....Kit of parts incl. SMD-stuffed PCB
and programmed controller .............................................42.00........59.00
7-8/2009 - elektor
CD-ROMs
Books Books
Campsite AC Monitor
060316-1 ......Printed circuit board .........................................................21.50........30.00
ATM18 = RFID Savvy
080910-91 ....PCB, partly populated PCB populated with all SMDs ........16.50........26.00
Bestsellers
CD/DVD-ROMs
Kits & Modules
June 2009 (No. 390)
Kits & Modules
Product Shortlist
£
US $
July/August 2009 (No. 391)
+ + + Product Shortlist July/August: See www.elektor.com + + +
1
C# 2008 and .NET programming
2
C Programming for Embedded Microcontrollers
3
Artificial Intelligence
4
Microcontroller Systems Engineering
5
Mouse Interfacing
1
ECD 5
2
DVD i-TRIXX Freeware Collection
3
DVD Elektor 2008
4
DVD LED Toolbox
5
DVD Elektor 1990 through 1999
1
MSP430: PCB, populated and tested
2
MSP430: TI eZ430-F2013 Evaluation Kit
3
The 32-bit Machine
4
Automotive CAN controller
5
LED Top with Special Effects
ISBN 978-0-905705-81-1 ............... £29.50 .....US $44.50
ISBN 978-0-905705-80-4 ............... £32.50 .....US $52.00
ISBN 978-0-905705-77-4 ............... £32.00 .....US $46.00
ISBN 978-0-905705-75-0 ............... £29.00 .....US $52.00
ISBN 978-0-905705-74-3 ............... £26.50 .....US $53.00
ISBN 978-90-5381-159-7 ............... £24.90 .....US $39.50
ISBN 978-90-5381-244-0 ............... £27.50 .....US $39.50
ISBN 978-90-5381-235-8 .............. £17.50 .....US $35.00
ISBN 978-90-5381-245-7 ............... £28.50 .....US $54.00
ISBN 978-0-905705-76-7 ............... £17.50 .....US $35.00
Art. # 080558-91 ........................... £35.00 .....US $55.00
Art. # 080558-91 ........................... £24.50 .....US $35.00
Art. # 080928-91 ........................... £27.00 .....US $42.50
Art. # 080671-91 ........................... £52.00 .....US $79.00
Art. # 080678-71 ..........................£42.00 .... US $59.00
Order quickly and securely through
www.elektor.com/shop
or use the Order Form near the end
of the magazine!
Elektor
Regus Brentford
1000 Great West Road
Brentford TW8 9HH • United Kingdom
Tel. +44 20 8261 4509
Fax +44 20 8261 4447
Email: [email protected]
131
info & market
coming attractions
next month in elektor
GPS Datalogger
There are plenty of projects that deal with GPS and microcontrollers, many of which covering navigation only. But what if you wanted to log the path of a bike or car trip? Sure, you could export
the data for processing into some other application that does this, but you could also make use of a
very popular application called Google™ Earth. This is made possible by the combination of a GPS
module, a BASIC Stamp® microcontroller module , a Parallax Memory Stick Datalogger and some
clever software enabling GPS coordinates to be stored as a KML file on an ordinary USB memory
stick — and read back on your PC.
New: E-Labs Inside
Starting this September Elektor Labs, the hub & foundry of all technical wizardry you can read about every month in Elektor will occupy the centre four pages of the magazine.
There we will cover all issues our laboratory workers first fuss about and then care to make public like equipment reviews, tips and tools of the trade and techno talk.
For the first instalment the intention is to report on practical experience with a new Yokogawa oscilloscope our lab guys got on loan for a month or was it a bit longer. What did
they like and dislike about the instrument? Read all about it in the next issue of Elektor.
ATM18 Mini Chess Computer
The Elektor ATM18 microcontroller system can be used to make a surprisingly simple and
effective chess computer. The only additional hardware required is a few low-cost pushbuttons. The software for the project is written in C, and it was far from an easy task to fit the
program in the 8 kB of program memory offered by the ATmega88.
Article titles and magazine contents subject to change, please check ‘Magazine’ on www.elektor.com The September 2009 issue comes on sale on Thursday 20 August 2009 (UK distribution only).
UK mainland subscribers will receive the issue between 15 and 18 August 2009.
w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor.
Elektor on the web
All magazine articles back to volume 2000 are available online in pdf format. The article summary and parts list (if applicable) can
be instantly viewed to help you positively identify an article. Article related items are also shown, including software downloads, circuit
boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded.
In the Elektor Shop you’ll find all other products sold by the
publishers, like CD-ROMs, kits and books. A powerful search
function allows you to search for items and references across
the entire website.
Also on the Elektor website:
• Electronics news and Elektor announcements
• Readers Forum
• PCB, software and e-magazine downloads
• Surveys and polls
• FAQ, Author Guidelines and Contact
132
elektor - 7-8/2009
07/08-2009
Order Form
Price each
Description
310 Circuits
C# 2008 and .NET programming
for Electronic Engineers
C Programming
for Embedded Microcontrollers
DVD LED Toolbox
CD-ROM ECD 5
NEW
£29.90
NEW
£29.50
NEW
NEW
NEW
£32.50
Qty.
Total
Giro transfer
£24.90
Verification code: _____________________
Prices and item descriptions subject to change.
The publishers reserve the right to change prices
without prior notification. Prices and item descriptions
shown here supersede those in previous issues. E. & O.E.
Sub-total
P&P
Total paid
Please send this order form to*
(see reverse for conditions)
Elektor
Regus Brentford
1000 Great West Road
Brentford TW8 9HH
United Kingdom
Tel.: +44 20 8261 4509
Fax: +44 20 8261 4447
www.elektor.com
[email protected]
Email
–
–
Signature
EL07/08
07/08-2009
Cheque
Free Elektor Catalogue 2009
Date
Order Form
Bank transfer
Expiry date: _________________________
Tel.
Subscription
(see reverse before ticking as appropriate)
£28.50
Address + Post code
✁
METHOD OF PAYMENT
(UK-resident customers ONLY)
Name
✁
Order Code
Yes, I am taking out an annual subscription
to Elektor and receive a free
2GB MP3 player*.
*USA and Canada residents should use $ prices,
and send the order form to:
Elektor US
PO Box 876
Peterborough NH 03458-0876
Phone: 603-924-9464
Fax: 603-924-9467
E-mail: [email protected]
✁
METHOD OF PAYMENT
(see reverse before ticking as appropriate)
Bank transfer
Cheque
I would like:
(UK-resident customers ONLY)
Standard Subscription (11 issues)
Giro transfer
Subscription-Plus
(11 issues plus the Elektor Volume 2009 CD-ROM)
* Offer available to Subscribers
cribers who have not held a subscription
to Elektor during the last 12 months. Offer subject to availability.
See reverse for rates and conditions.
Expiry date: _________________________
Verification code: _____________________
Name
Address + Post code
Please send this order form to
Elektor
Tel.
Email
Date
EL07/08
–
–
Signature
Regus Brentford
1000 Great West Road
Brentford TW8 9HH
United Kingdom
Tel.: +44 20 8261 4509
Fax: +44 20 8261 4447
www.elektor.com
[email protected]
ORDERING INSTRUCTIONS, P&P CHARGES
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 should send orders, except for subscriptions (for which see below), to the USA address given on the order
form. Please apply to Elektor US 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.
January 2009
SUBSCRIPTION CONDITIONS
SUBSCRIPTION RATES FOR ANNUAL
SUBSCRIPTION
United Kingdom
Standard
£49.00
Plus
£58.00
Surface Mail
Rest of the World
£63.00
£72.00
Airmail
Rest of the World
£79.00
£88.00
USA
Canada
£64.95 See www.elektor-usa.com
for special offers
£75.95
HOW TO PAY
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 SSLprotected for your security.
The standard subscription order period is twelve months. If a
permanent change of address during the subscription period means
that copies have to be despatched by a more expensive service,
no extra 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 service.
Student applications, which qualify for a 20% (twenty per cent)
reduction in current rates, must be supported by evidence of studentship signed by the head of the college, school or university
faculty.
A standard Student Subscription costs £39.20, a Student
Subscription-Plus costs £48.20 (UK only).
Please note that new subscriptions take about four weeks from
receipt of order to become effective.
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 higher, plus the cost of any issues already
dispatched. Subsciptions cannot be cancelled after they have
run for six months or more.
January 2009
/
/ /
/
%&5%+9
&!) &%
>0.17<=/',
+))((
)
+) .)))
1
+) (2.4%.4-%)
533%1
+(',).,)
1
().)') 1
)
,)$)(),(( '.
)
,(!)'( ),,1
%& 5%-)) &%
"3
$* %3
>0+.74:/',
>04+7<./',
") ")') 1
+))
))
() 1
))$+433 433+1
)
()
)45*.433+.$)
,)1
) )$()
1
()(%)(,) (
1
(
'+ +,1#
)( "553. "6)
$,((1
%&5%.9
&&&& &%
%$%%&3
+)') /''+ +,/
+)+
)1
+) ).(( '()
'/
()).
)(.".
.)
+1
) )).()%) ." )(
.+
! )))
+ +1
#
)(+) )(0'(
)
,)0+ 1
%&5%:99
&& &%
"3
$* %3
*
%
) ))))
1
( '3134+1
)()
)
)
433%1
)),(#0 1
().)') 1
))()
))1
)0 )1
)31,
%&&&"5 (<
& /&
>01-71+/',
& %%&8
>0:947.6/',
())$+ )(1
() +
+
)(1
,)( ),)1
+ +)
))1
& ( 1
#+%
#+% +%
+% +"+$+!2*(+!
+"+$+!2*(+!
/123.-*1123/
/123.-*1123/ "/123.-*11&(/%$0/
"/123.-*11&(/%$0/
//#
//# 0
0 '
'
//
//
%
#('2%&
&0<799$&
#(&$%7
% #('2%& &0<799$& #(&$%7
&
& !&
!& 2
2 %7
%7 &)7;7
&)7;7
GO FASTER WITH
PROTEUS PCB DESIGN
The latest version of the Proteus Design Suite harnesses the power of your computer’s
graphics card to provide lightning fast performance. Together with unique transparency
options it’s now easier than ever to navigate and understand large, multi-layer boards.
PROTEUS DESIGN SUITE
Features:
Hardware Accelerated Performance.
<
Unique Thru-View™ Board Transparency.
<
Over 35k Schematic & PCB library parts.
<
Integrated Shape Based Auto-router.
Flexible Design Rule Management.
<
Polygonal and Split Power Plane Support.
<
Board Autoplacement & Gateswap Optimiser.
<
Direct CADCAM, ODB++ & PDF Output.
<
Integrated 3D Viewer with 3DS and DXF export.
<
Mixed Mode SPICE Simulation Engine.
<
Co-Simulation of PIC, AVR, 8051 and ARM7.
<
Direct Technical Support at no additional cost.
<
<
All levels of the Proteus Design Suite include a world class, fully integrated shape-based
autorouter at no additional cost - prices start from just £150 exc. VAT & delivery
Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA.
Registered in England 4692454 Tel: +44 (0)1756 753440, Email: [email protected]
Visit our website or
phone 01756 753440
for more details
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement