‘Thsstheperfctbookforpeoplewho antto
leamCandwhovanttouseanmbad ARM
‘oocentolerinanesyandfunwa. herbed
NAPURCI76usesceudtaemdiogy Ths means
youd pot nedtoinstallsotwareonyour PC
inorder to proram there The ony thing
younsedieabrevearandalSBporton ou.
Nopraousemparnceornoledaeeqied,
Youcangetacessto your proectfrom any PC
aysiesthewerdandeantinoeworkingn
IRhenyouamdoneatewmosecistrrie:
‘theprogeamtoyeurmbedhardare.
250pages + BN87E-0-905705 9841+ $87.60
ecetar
beac
Pues
Solutions for conto system appcations
Introduction to
Control Engineering
‘Thsbooksinierdedssascurcecfrleencsfoc
arduareandsoftvarassocstedvthineri
‘mentation andcortrolencnesring amples
represented fom arengeandusesandap
platens. Throughout the bok, cut -
‘rans an sotvate stings ar describe,
‘typical many measirement and conta 3p-
lations. The hdvareandsotvaredesigns
‘maybeused as a bass for aplication by he
readeThebookcotans examples oI PLG
PACandPcprogrmmn.
‘etpages + AN 378-0905705504 «Se.a0
SCOP SE
Unucbased aplations
Linux - PC-based
Measurement Electronics
IFyouwanttarhow tocichy bul Lina
based applications able to colet, process
and display data on aPC rom various aaiog
and digital sensors, how t contlcrcltey
attached a cmputer.then eveniow 025s
ata vianetuorkor contolyourembedded
system wtelessy and more = then his the
book for you! doth hareware and software
specs of desgingtyplembeddedystins
ae covered in etal wath schematics, code
Istingsandflcesrstions.
254 pages am 5781.907520025 «$47.60
Cer ata
than just your favorite
aetna scr
SR ts ey
Ss lL ce
Ds, DVDs,
Doerner
SUT Tumut
www.elektor.com|shop
(a}ektor
Elektor US
POBox 180
Vernon, CT 06066
USA
Phone: 860-875-2199
Fax 860-871-0411
Email: order@elektor.com
[eltor's Components Database
cDECD6
ThisCD-ROM gives you easy acest design
data for ove 70,000 components! The pro
‘ram package consists of eight databanks
covering Is, uransistrs, iodes and opto
‘couplers. further even applications cover
the clealation of for example zener diode
series resistors, voltage regulators, voltage
Givers and atts. A colour band decoder
'indudedtor deteminingresstorandinduc
torvalues. Al databank applications are fly
Interacove,alowing the userto dd, dt and
‘complete component cata
Issus7es05ss1.2567 «$40.20
‘Alartdesinlelea Volume 2010,
pvp Elektor 2010
‘hs Dvo-ROKEcontainealestral aries
published in Volume 2010 ofthe Enlsh,
Spanish Dutch. FenchandGrmaneations
coftektor Using the supple Adobe Reader
progam atcesarepresenedinthesame
layout as oriinaly found in the magazine
‘Aventensive search machine aaabl to
locate keywords in any aril. With this
[DvD youcan ao produc ard copy of PCB
layoutsatprintreslution. adapt PCB ay
ususng your favourite grashes program,
200m in/out on selected PCE areas and
‘export cuit lagrams andilstrations to
other programs.
sen 9789053812679+ $57.90=
RIICLE
a
my
rn
by Indranil Majumdar (India)
MCU-Based GSM Connection
A Fixed Cell Phone with Emergency Auto-Dial
A little embedded intelligence (El) goes a long way. This microcontroller-based
design features a GSM platform, a controller, a keypad, and a handset for easy
dialing and wireless calling,
con't eall me crazy for trying to design things
that are already on the market, There's a
method to my madness. I'm interested in making exist-
ing technologies better. Most electronics—from satel-
lites to dishwashers—have some form of low-level artifi-
cial intelligence or embedded intelligence (El). But engi-
neers are never complacent. We're always trying to build
in additional
intelligence. And
so [assure you
that we aren’t far
froma day when
ubiquitous con-
sumer gadgets
(eg, cellular
phones, MP3
players, and home
appliances) will
have high-level
EL. (Get ready for
the “gadgetoids."|
Our produets will
‘work in unison to
protect the inter.
cats and the wel:
fare of their users.
Photo 1—Dont let
the retza casing foo!
you (2) Inside is 2
crochip Technology
PIC24FJ64cA0de
microcontroller, 2
(OSM board with an
antenna, and a con.
nected keypad (b)
‘The aforementioned ideas ate the guiding principles
for my global system for mobile communications (GSM)
wireless phone design. The low-cost system has the look,
of a “retro” phone with a hook switch and cradle jsee
Photo La}. But that’s where its old-fashioned characteris-
ties end. The phone's MCU-driven EI—along with i
GSM platform, touchpad, and concealed antenna—
proves it is truly a 21"-century design (see Photo 1b).
‘The system also features emergency autodialing func-
tionality and a fire alarm that can transmit precanned SMS
‘messages to preprogrammed telephone and mobile phone
‘numbers, For instance, consider an elderly person who
needs to call a pharmacist, a physician, or a family mem-
ber. Memorizing all of the numbers or looking for the fre-
quently called numbers before dialing is a common prob:
Jem. My wireless phone design uses FI to address the prob-
Jem. A user can simply press the “A” key for 911 alerts or
press the "B” key for a medical emergency. Table 1 shows
the phone's various functions,
DESIGN ESSENTIALS
‘The phone is built around a Microchip Technology
PIC24FJ64GA002 16-bit microcontroller that performs
the GSM module initialization, dials, and sends the
commands for GSM module dial-up. The phone's
Microchip Technology MCP9700 thermistor can send a fire
‘Sumber Keypad baton Functional eescipion
1 Namoickays(018) Diana eephove namber
2 D ater Make cal
3 c Caroait cal
4 a 11 Emergerey alot SS
5 5 Mecca SUS
\s Tempera sree Fe alot SMS
i sods Unused
Table Keypad functionsFigure 1—An WOW cSt evaluation board with
2 TR-800 Trband GSM/GPRS medule and a Sih
‘cahcer wath an Sit8 antenna pore
anterna, The board features a crochp Teer.
‘ology FC247I640002 16-b¢ microconzoller
and Microchip MCP9700 thermistor a 16% 16
membrane ype heyped, ae miscelaneous
components bought ata lac market.
alert to a preprogrammed number (see
Bigure I}
1002 Debugger roam prs, PC, and PD, respectey
Cutt = GSM mode rest ine (ven)
(GPO Pepi ‘Alea fncionmeppng
PO-rBORE:
GPOREORES LUARTOTXDRXD prs, espctvely
PII Hook sth state sensor acne ew)
Pires
P!0-AN0 ‘2810- ADC np ote temperate sneer
| cPio-paerart
GPv-rBaNatals
Kaypad 44 matic ined ih)
Keypad 4 4 matic colu ive curt ow)
Table 2—The GPIO port pinslaitemate function mapping
‘You can power the portable phone
with ether a back-up battery or
through an AC mains wall outlet
adapter.
The phone’s anatomy is simple.
Flashy LCDs, speakerphone features,
and voicemail aren't included. Ie’ just 2
16-bit digital engine driving a GSM
‘module with a preloaded SIM card. No
special activation is necessary, You can
‘choose any SIM module from a service
provider to run this phone. The design
accommodates the use of the typical
GSM module working with standard
attention (AT} commands and such a
‘module having the GSM foram cert
cation and homologated to the GSM
cartier network
The antenna is a high-gain con-
cealed antenna that does not stick
out of the telephone. A distinct
advantage of this design is that it
looks like a key telephone, so you
could have a dummy RJ11 socket for
an intruder to think it’s a phone
that’s not plugged into the wall
socket, and at the same time i
wouldn't give the slightest hint that
it's wireless,
Although it's not incorporated
here, you could include a small secu-
rity system that detects when doors
and windows are opened, and then
sends an SMS alert about a possible
252
Figure 2—The complete crculty
2011 — |
Jol
w
9B Jay 2011 — bane 252
intrusion. You could activate this a antenna is used. The AT command
alarm from your GSM mobile . interface to this module with the
through SMS or DTME signaling PICDAFI64GAOO2 is through
over a voice channel. To build a “| UARTO pins, as mapped on the
security system, such as an intrud- Ee | microcontroller.
eralere system, you'd need P> JP | The 4x4 keypad has rows as
door] window sensors that aren't = * | inputs (pulled high! on port pins
featured in this design. Acaivation BE pe | B6j7/10/11 and columns aa drive
of the alarm system over SMS is #235 Je | ourputs on port pins RBI2/13/14/15.
aerial raneiteareatenc ee fas F=7]m | The keypad subroutine loops on
ters that could be passed by the H=S2 9 FF | making each column low and sean
GSM to the MCU UART. Such =a ning the rows fora switch press that
characters would be parsed to ae a dhves that particular pin low. The
obtain the control code. DTME = state is read witha delay subroutine
would require an additional = to debounce the key press and the
decoder (e,, Mitel MT8870} over | = dialed digit information is sent as an
the voice channel. {already men- . ‘ASCI character over the UART t0
tioned that this feature is not ee the GSM module. The keypad scan
incorporated in the design, and it’s fee routine is a standard routine that’s
a design that would include an [met explained in the source code with
intruder alert system fone that comments. Refer tothe code posted
would dial 911 during an inera- om the Circuit Cellar FIP sie
sion). The idea is to have your if The MCP9700 voltage output
phone perform functions ranging pgye 5 jhe GSM baad breakout header prauk temperature sensor s used to
from autodialing to building moni- Geyem determine fie alert conditions
toring to appliance eontzo. ft cam from a presct temperature value of
be a communication gateway with 60°C and higher. Te supports a
auded security features. Now, here's how to design this wide temperature range of ~40° to 125°C with an operat
‘ gadgetotd” with EL ing voltage of 2. to 5.5 V with a 10-mV/°C output. The
sensor is biased from the VDD of 3.3 V, which serves as
CONTROL, POWER, & MONITOR the maximum voltage value and is interfaced to ANO
Refer back to Figure 1. The first module is the GSM __input on the PIC24FJ64GA002. The firmware scans for
radio, interfaced to the PIC24FJ64GA002 microcontroller the ADC value, compares it with a preset hex value cor-
swith a keypad and a temperature sensor interfaced to the responding to 60°C, and sends an SMS alert for all values
microcontroller. That’ all ‘of 60°C and above.
assembled the board with a Microchip Technology PIC The PIC24B/64GA002, the GSM module, and the SIM
starter board reference design (see Figure 2}. The ‘operate from a 3.3-VDC source (see Figure 4}. The GSM
PIC24F|64GA002 uses a 28-pin base and the GPIOs are _ module board accepts a 5-VDC input and generates 3.3 VDC,
available on the I/O header (see Table 2), The 7.3728-MHz which is used for the GSM module, the SIM, and is rout-
crystal is intended to achieve a 0% error on the UART at ed to the PIC board to power the PIC24F|64GA002 [see
the data rate of 115.2 kbps required for this application. Figure 5
‘The programming port is available on the default
PGC/PGD pins on pins 4 and 5, and MCLR is available CODE & PROGRAMMING
‘on pin 1, The six-pin RJ12 port for programming the PIC _Tused the MPLAB ICD 2 debugger and programmer to
hhas the PGC, PGD, MCLR, and GND terminated at this flash/dcbug the PIC board |see Photo 2), The PIC board has
port that interfaces with a Microchip Technology MPLAB PGC/PGD pins available for the same thing, Programming
ICD 2 debugger. The power supply to the PIC board,
is 3.3 VDC through the DC connector onboard. The
3.3 VDC is generated from the LDOs on the GSM
‘module board.
‘The GSM module board runs from a 5-V eonres
swith the LDO onboard generating 3.3 VDC for the
‘module and the SIM card (see Figure 3). The same
supply of 3.3 VDC is routed to the PIC24F]64GA002,
section, The RBS port pin from the PIC24F]64GA002, ee faeces
microcontroller is used to reset (active low] the GSM Tea!
module after power-up. The GSM audio I/O port is
interfaced to the handset and an internal 3-dBi whip Figure 4—Board power supplyReco meena
ek eee
break onsen, the GSM module followed by a Goto
SIM Card terface [= tines. The subroutine scans the key-
coe ies agai fa
woes galt—aer rr Diercheeks enmncok wicket
ES apie se us and Soicarsla all, EnceaY1
ae ee Meare gaat eis elena
Tin ot iy ee the call. Check checks the hook
F -gHt Beale eee a
we oe keyed. Transmit sends data to
= Jew UITXREG.
E ne paar,
nee
is an example:
Figure 5—The SIN card and handset connection dagram 2
AT#CMGS="cNumber to be
is straightforward and simple. Plug and performs call receive or state dialed”
the debugger into a PC’s USB port, _alerts by sending a precanned SMS.
plug the RJI2 into the RJI2 porton To dial any number, the AT com-CTRL¥Z
the application power, and apply mandis are used (sent over the UART
power through the $-VDC adapter toto the GSM module]. The subroutine INTEGRATION & TESTING
the PIC board. Next, open the is called while dialing a number or _—_I built the phone system on an
MPLAB IDE v7.62, select ICD 2 sending an SMS. ‘existing TR-800 GSM evaluation
under the Debug option, and the ‘SCANL23A 1s the keypad scan sub- board with a SIM cardholder and the
application board is instantly detect- routine preceded by the Initiate power supply circuitry, antenna port,
cd, Write the code, build flash, and
run the same.
‘The Assembly language code for
this application was written with
the MPLAB IDE v7.62 (all higher
versions are backward-compatible),
Lower versions have a bug for the
PIC24FJ64GA002 part and only ver-
sions v7.62 or higher are recom-
mended to build the code. (Refer to
the PIC24F{64GA002 instruction set
and the code listing in the project
software file on the Circuit Cellar
FIP site.)
The code is relatively simple (sce
Figure 6). The main loop initializes
the microcontroller, sets up UART
and input/output port pins on port
‘RAx and RBx, and initializes the
‘ADC function for fire alert sensing
through ANO [temperature sensor}
GSM_RESET initializes an iWOW
‘Technology TR-800 GSM/GPRS
‘module. This block is optional and
‘may be deleted for GSM modules
that don’t need a start-up reset.
SMS has the subroutines SMS and
Receive. It scans RAI (GSM ring ere)
ISiceojsolton osetia DSS |
se ts nen ee
eae er crc ceca
2011 — lane 252,
“A” and “B”| for an incoming call
eee eats Aly 2011 — lame 259
5
HUMANDATA
FPGA Boards from Japan
+ Basicand simple features
+ Single ower suply operation
+ Sare Stseonnectrlyout-ACMACM series
Fie dwricad cic comets ere putting
High quality an igh reiable board ram Japan
+ Stocked tems ate ro shi immediately
Feel fee to contact us to customize
eae
IW ALTERA FPGA boards il
cases Galan yaa enc
SR
ce
Fos ompiot
eos res ieee
Se ae
Fekeqnbr ier
| sine
XCM018 Spartan-6 PGG484 FPGA board
Spartan MRAM | BDR2
ierstivesrecusc
Graton xe
rossinion D
DK.006 Viriex-5 USB-FPGA board
5) Sh con) [US8Covm. (MRAM)
xesuLaesF0e76>
Foe tie
iste D
Raters [aes eens
yee)
Beery
Photo 2a—This is @ Microchip Technology
PIceary84Gx002 microcontroller board
b—This Is the Microchip Technology MPLAB
1@ 2 aedugger and programmer that |
used for the project
and other peripherals required to
operate the GSM module. However,
any standard GSM module (it must
have an IMEI number and have a
homologation approval from the
GSM service providers in the coun.
try of use) may be used with minor
changes if required. AT commands
for dialing/SMS are the same and the
‘modules are compatible with this
design to operate in voice call/SMS
mode.
Photo 1b shows the system rigged
up in the simple push button tele-
phone mold. The results of my dial-
ing and emergency SMS tests were
satisfactory, The eall/receive fune-
tion worked well. There was no
appreciable difference in GSM signal
quality with the onboard stealth
=
este
|
Foros oF) sug e
|
Figure 6—The program flow chart developed
using INOW Technology's "AT Commands
‘Guide ” (Refer to the Resources section at
the end ofthe arte)
antenna used, and it worked error-
free like a fixed cell phone terminal
‘The handset had standard voice
quality and I didn’t have to inerease
audio volume, although it may be
achieved by using the standard AT
commands,
1 built the emergency SMS num-
bers into the program. In this design,
didn’t keep the provision to input
numbers dynamically from a key
board. Many features can be added
by integrating a I x 16 or 2x 16
LCD. The current system is fairly
basic because it’s intended to be
affordable yet effective.
HANGING UP
1 was motivated to design my
phone primatily for geriatric use
where elderly people are left to fend
for themselves. The idea was to cre-
ate a simple, cost-effective wireless
phone that has the added features of
‘emergency dialing, a fire alert, and
other such services. And now I have
a platiosma for variows El companion
sadgets.
‘The possibilities for this platform
are endless. Y'm confident you could
casily add building surveillance and
‘monitoring features. Pethaps I'l read
about your design in a future issue
of Circuit Cella.Indrani Malumaar (majumder@ieee.org) Is an electronic communications engineer
uno has been working on RF and wireless systems for the last 20 years. He has
worked on embedded designs since 1998 and fas been extensively Involved in the
design of wireless embedded systems for vehicle tracking (GPS-OSVOPRS), 05M
POS terminals, smart eneray meters using GM and 2.4-Giie LPR, and 2.4-Oh Zig-
Bee wireless systems for Industrial and home automation. Indranil is an amateur
astronomer and an avid ham radio operator (VL2KFR, licensed since 1984), He ts
also a member ofthe American Radio Relay League and IEEE (both U.5.)
PROJECT FILES
‘To download the code, go to ftp//ftpcixcuitcellar/pub/Cireuit_Cellar/
201/252.
RESOURCES
Y. Garg and J. Wilkes, Principles and Applications of GSM, Prentice Fall,
1999,
iWOW Technology, “TR800 AT Commands Guide," 2006, www.iwow.com sg
images/TR-800% 20GSMGPRS%20Moxtule(081007)-paf-
Microchip Technology, Inc., “MPLAB, Integrated Development Environment
User's Guide,” wwl microchip com/downloadsjenjdevicedoe/51519a pat
Zighice Alliance, ZigHce Specifications, www.zigbec.org.
SOURCES
‘TR-800 GSM/GPRS Module
iWOW Technology | weww.iwow.com
PIC24F]64GA002 Microcontroller, MCP9700 Thermistor IC, and MPLAB.
ICD 2 Debugger
Microchip Technology, Inc. | www:microchip.com
-MT8870 DTME Receiver
Mitel Networks Comp. | www.mitel.com
NEED-TO-KNOW INFO
‘Knowledge is power. In the computer applications industry, informed
engineers and programmers don’t just survive, they thrive and excel.
For more need:to-know information about some of the topics covered
in this article, the Circuit Cellar editorial staff recommends the fol:
lowing content:
GPS-GSM Mobile Navigator
by Ma Chao & Lin Ming
Circuit Cellar 151, 2003
What's the more laudable engineering feat, designing a navigation
system capable of tracking ships in Shanghai Port or placing at the
top of a competitive design contest? With the award-winning GPS-
GSM Mobile Navigator, Ma and Lin accomplished both. Topics:
GSM, Cellular, Mobile, GPS, Navigation, Communications, Trans-
mission, SMS
Go to Circuit Cellar's webshop to find these articles and more:
www.ce-webshop.com
onselect 59 equipment
fora United time only!
D61022-20mne
Funetion/Arbirary
Waveform Generator
De1052D- som
* Mixod-xignal Seopa 2ch
+ 16 Digital Channels
seg 0€11020 - room
Hy Mist sntsiee 20h
sre Dta Chet
1022 + De1052E
‘Base Signal Arai Package
20s Fenetion AWE +
50 Mie 2-Ch Digital Osefloscope
(Wes 91.094" Now only $799)
Tr
D1102CA + DG2041A
‘Standalone Sigal Anaieie Package
OMe Faetion/ AWE +
100 Miz 2-Channel a
Pern ag ra
ered
re ete
fal) Multi-Funetion Too!
with your order
of $50 or moral
WSaeli§iis
B ely 2011 — ewe 2=
rw
by Marty McLeod (USA)
Li-ion Battery System Solution
Implement a BCU and Safety-Certified RTOS
Current lithium-ion (li-ion) systems can be problematic. Here you learn how to
implement a battery control unit (BCU) with a safety-certified RTOS. The design
enables battery monitoring, data reporting, and circuit protection.
Ky
V hile working for a provider of large-capacity
systems, I became familiar with the major requirements for
the maintenance, charging, and circuit protection used in
the design of such energy systems. Along the way, I discov-
cred several arcas in the designs that needed improvement.
In this article Il describe some of my findings, as well as
a useful battery module project that you can build at your
‘own workbench.
‘My motivation for this project was ¢o find solutions
to several design issues found in typical li-ion battery
systems. I designed an eight-ccll, 32-V nominal voltage
Photo 1—This fs @ working Ion battery cell module with simulated
battery cells, proudly powered by the SafeRTOS system, thanks to
the Texas Instruments Stellars LM359696 microcontroller evaluation,
kit
li-ion battery pack prototype complete with battery
management electronics (see Photo!)
STORAGE SYSTEMS
Large capacity energy storage systems are finding,
increased usage in applications such as electric/hybrid
vchicles, solar and off-peak energy storage, and lab and
development testing for replacing older energy sources and,
lower energy-density batteries. Most, if not all, li-ion bat-
tery systems share some common features including cir
cuit protection {typically a circuit contactor, real-time cell
voltage monitoring and cell balancing, and operational sta-
tus data transmission to the user/ourside world,
Some systems can be quite expensive. Some are also
based on proprictary hardware or Iess-popular microcon-
twollers, and upgrades can be extremely difficult, if at all
possible, Some systems have moderate software perform-
ance, at best, and may suffer from software response
latency. They do not typically operate with a safety-guar-
antee or high-reliability real time operating system
{RTOS}, and they may not provide a fail-safe condition in
the loss of external power. Some of the systems are
inflexible and short on general-purpose input/outputs
[GPIO}. Others rely heavily on external integrated cir-
cuits {ICs} on the battery control unit (BCU) board, some:
times for basie functionality rather dian implementing
those in software.
‘To clarify a potential safety scenario, lev consider one of
the weaknesses just mentioned, Fixure | shows a compari
son of an actual battery management system in use and my
proposed alternative design. Figure la is a system powered
by an external supply, consuming energy 100% of the time
due to the contactor design {using a normally closed con-