0 ratings0% found this document useful (0 votes) 215 views84 pagesNuts and Volts 2014-02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
- Improved Efficiency 13.8V Power Supply
- An Easy Two-Wire LCD
- An Arduino Controlled Digital FM Radio
- This is Radio Disaster Calling
- MakerPlot – The DIY Software Kit Part 5
- DSL and Cable TV Broadband Internet Access: How Do They Work?
- The Arduino Classroom Arduino 101 – Chapter 2: Digital Output – LEDs
> wl
The goal: The method: ‘The result:
Control configure, or monitor Connect serial portto ‘Access device from the Intemet or 2
a serial device using Ethernet 2 serial to Ethernet device server local area network (LAN) using SSH or SSL.
NetBurners Secure Serial to Ethernet Servers network enable
serial devices out of the box -no programming or developments
required, The hardware is pre-programmed to convert your serial
data to Ethernet, enabling secure communication with the serial NetBurner Development Kits are available
device over a network or the Internet. to customize any aspect of operation
including web pages, data filtering, or
custom network applications.
Information and sales | sales@netburnercom
= Web | wewnetburnercom
Telephone | 1-800-695-6828Fun starts behind a 5” screen
ee
price: $249°
ikromedia 5 for Tiva”
ARM Cortex"™-M4F on-board Size does matter Communicate wireless'y Beyond expectations
Powerful Workhorse 5" Touch Screen C3000 WiFi module Debugger on board
Mighty TsiscL29xNCZAD Huge touchscreen n B00x480px Internet of things - check! For the fist time, we'e
racks: 120 MHz operation, 1MB_—_resolution brings awesome Insanely popula’ [Link]—_embedéng programmer and
of Flash 256 KB of SRAM sraphics and vivid colos. Youve module's right here for you debugger on mikcomedia board.
OMA controller, on-chip LED never seen suchabig display It features easy touse Just plugin the USB cable and
cont
id alot more di ven just by 2 microcontrole SimpeLink Pua TCPAP stack there yougo!
[[-] MikroElektronika GET IT NOW
SEWOPMENT TOOLS COMPEERS OOS [Link]February 2014
22 Improved Efficiency 13.80 46
Power Supply
Many hobbyists use or repair equipment intended
for automotive use, so require 3 power source.
The linear design presented here is modernized with
MOSFET pass elements that improve efficiency with
no switching noise,
By Robert Atkinson
An Easy Two-Wire LCD
Inexpensive LCDs show up all the time on the
surplus market, but they usually require either four
or eight data lines in addition to several control
lines. Of course, you could always dip into your
wallet and spring for more advanced displays.
However, with just a pittance of external parts, itis
easy to reconfigure even the humblest LCD to run
well on only two port lines of a microcontroller.
This article describes just such a technique.
By Thomas Henry
An Arduino Controlled Digital FM Radio
While you can always listen to the radio from some
newfangled device, why not do it the old-fashioned
way — over the air from a desktop unit
(Plus, you get to control it with a remotel)
By Craig A. Lindley
Page 20
This is Radio Disaster Calling
When natural disasters occur and phone service
goes out, its ham radio operators who keep
communications open
1m By Dave Prachnow
MakerPlot — The DIY Software Kit
Part’
‘An important function of MakerPlot is its
bi-directional capabilities. What this means is that
your microcontroller can control or be controlled
with this unique software. Find out how this is.
accomplished.
1m By John Gaviik and Martin Hebel
Page 22
08 PICAXE Primer
Sharpening Your Tools of Creativity
PICAXE-Pi Communications — Part 1.
Get answers to questions about the behavior of the
[Link] program from last time, and begin an
‘exploration of PICAXE-Pi communications.
Reader Questions Answered Here
Inquiries about trickle chargers, ham mobile radio
setups, and electronic player pianos are asked and
answered this time.
Open Communication
The Latest in Networking and
Wireless Technologies
DSL and Cable TV Broadband Internet
“4
Access: How Do They Work? 7
Chances are you're already using at least one of 18
these technologies, but recent upgrades have made 24
NMBA Hcp enero
4 NITSIVONS February 2014
them faster. Read about the technical details of each
system and the most recent new features and
specifications.
Smiley's Workshop
Programming ° Hardware * Projects
The Arduino Classroom.
Arduino 101/Chapter 2: Digital Output - LEDs.
‘As we continue our curriculum on computing and
electronics basics, learn how to design circuits
Using light emitting diodes, and then how to use
these LEDs with Arduino software to indicate events
to people using your system.
DEVELOPING 64 NVWEBSTORE
PERSPECTIVES
Wight Mecting 67 ELECTRO-NET
READER FEEDBACK 77 CLASSIFIEDS
NEw PRoDUcTs 78 TECH FORUM.
SHOWCASE 81 ADINDEX
Teaser a
Is POSTThe only USB Oscilloscope
built for advanced users,
priced for students.
TUS. student rice) ei@$ —€ XILINX
I
ST ea ORCC oa ee ee oe
En eC Ene ce eee ct CR tg
Pee ee seat une cee ea C ne nce a mone ec aera eo
Analog Discovery lets you build and test analog and digital circuits in virtually any environment, in or out of the lab
* 2-Channel Oscilloscope NUL
Spe R Mt Re aac g ATER DIGHTS)
Peed
ty iene
deless breadboard
Be yee Ste
De Cmenrunrsl Rei Ure
* 16-Channel Digital Pattern Generator
Deel tees a4
Bese
* Network Analyzer Dee aed
* Digital /O “eeitta
gital / SOE
IMT onc aes en
WAVJANALOG
DISCOVERY
Pe eer ee Greta USB OSCILLOSCOPE+So aceon
a
Night Meeting
When Google announced that it had purchased
Boston Dynamics, | couldn't help but think of Ray
Bradbury's tale of Night Meeting, from his Martian
Chronicles. The story begins when a man from Earth and
@ Martian encounter each other on a desolate road one
right on Mars. The man is driving an old pickup truck,
while the Martian is driving a mult-legged vehicle. They
look out on the landscape and realize that they come
from different times, but they can't determine which of
them is from the future and which is from the past.
There's a lot more to the story, of course, but the
metaphor of legged and wheeled vehicles passing in the
night seems relevant to the Google-Boston Dynamics
deal. Of course, Google is the company behind the
driverless car that promises to make the steering wheel
as useful as your appendix. Then, there's Boston
Dynamics, the creator of the Army Mule, Big Dog,
Cheetah, and other fourlegged robots that can manage
rough terrain that would stop a wheeled vehicle in its
tracks. if you check out the Army Mule on YouTube,
youll hear that the gas;powered engine needs a bit of
muffling before it can be used in a stealth operation, but
otherwise, it seems up to the task of hauling gear.
| don't see multilegged vehicles replacing the four
Feedback Motion Control
The Old Way
Wendie The Kangaroo
ctor ae
Ba Express disappointment 2) Press Autotune
16) Read tok, mod PID cient 3538
5) Decide perormance gs enough
3 Reahie
2
adds self-tuning
SNES IEM, Since tthe, feedback to SyRen
Seite cy Aero wo and Sabertooth motor
drivers,
i
© WISIVONS Febmuary 2014
He
$2499 <—D
_wrw.[Link] kangaroo
‘OPN
RSPECTIVE
wheeled car any time soon, but cars aren't the only
vehicles in use today. More and more ‘personal* vehicles
are making theit way onto sidewalks, in stores, and in
the malls. These motorized carts and wheel chairs often
require the user to detour onto ramps because they can't
navigate steps or escalators. Perhaps there's something.
in a multilegged vehicle that would provide value over
and above the transportation provided by an ordinary
motorized buggy.
For military purposes, there's the obvious advantage
of a pack mule that can carry heavy loads and,
eventually, serve as a vehicle for soldiers. For the soldiers
who lose one or both legs in battle, riding a weaponized
robotic mule into battle might be one way to contribute
to the fight. For civilian purposes, imagine the spinofts of
the legged technology — from chairs that gently raise or
lower an elderly or injured person, to walking assistants
that either carry or guide the person to their destination.
(One thing's for certain — we'te bound to see spinoffs
of the technology appear at our favorite online suppliers.
| can't wait to get my hands on what I can only imagine
is the sensor technology used by the Mule to maintain
balance. Then, there's the camera system used to track
the terrain. | dont know what sort of gasoline-powered
generator is used in the Mule, but I'm sure that | can
think of ways to repurpose the technology for other
projects.
For now, | have no desire to
be transformed into a bionic
Centaur, but in another 30 years
or so when my joints are arthritic
from all those marathons, | may
have a difierent opinion. It's good
to have options, and that's certain
to come from the GoogleBoston
Dynamics venture. MW
| pid you know that if you're
a paid subscriber to
Nuts & Volts,
you can get the online version
for FREE?
Get details at
[Link]NUTS VOLTS
Published Monthly 8y
T&L Publications, Inc
430 Princeland Ct.
Corona, CA 92879-1300
(951) 371-8497
AX (951) 971-9052
store orders only 1-800-783-4624
[Link]
Subscriptions
“ol Free 1-877-525-2539
Outside US 1-818-487-4545,
PO. Box 18277
North Holywood, CA 91615
FOUNDER
Jack Lemieux
PUBLISHER.
Lary Lemieux
pubkisher@[Link]
ASSOCIATE PUBLISHER/
ADVERTISING SALES
Robin Lemiaux
robin@[Link]
EDITOR
Bryan Bergercr
‘techeditnutsvelts@yahoo com
CONTRIBUTING EDITORS
Fon Hackett Russ Kincaid
Joe Pardue slohn Gavik
Martin Habel Thomas Heney
Lou Frenzel Dave Procinaw
Robert Atkinson Craig Linsey
CIRCULATION DEPARTMENT
subseribe@[Link]
‘SHOW COORDINATOR
Adie Lemeus
MARKETING COORDINATOR
WEBSTORE
Bran Krkoatnice
sales@[Link]
WEB CONTENT
Micnael Keudze
webste@[Link]
ADMINISTRATIVE ASSISTANT
Deedee Staultecher
PRODUCTION.
‘Sean Lemieux
Copyright © 2014 by & | Publcators, Ine
Al Rights Reserved
[ML advertising 5 subject 1 pubiste’s approval We
et ronporse for_metaces, meprni ot
‘ypowapiel eros. Nts & sts apsonesasoee
no response for the aaiabin
send ars of foe honesty ol
ha publsher makes no. dens ft
ay tem advised i Nuts & ots.
‘espana of tha [Link] and th
‘sgerces are 1 inderety and rca the pusher
ftom ay anda clams, stn, or expense aig ame
tsetang plced nue & ots. Plese send a
dona conespondence, UPS, ovemght mal. and
work 16 480 Pecland Cou, Corona, CA 92879.
rien sh S436 10 QE Yd
Pleased With Project
Referring to the “Quick and Easy
USB Keyboard Input” project by
William Pippin in the November
2013 issue: This is a very useful and
absolutely GREAT project idea! | put
it together and it operates exactly as
authoradvertised. There’s immediate
response for use when it’s plugged in
and it works without a flaw on any
preinstalled or user program that
accepts a keyboard or keypad input. |
Use it to accept touch tone’ decoded
digital outputs using my own phone
line project that was published in
N&V in 2010 to activate a monitoring
program for my phone calls — even
from cell phone use. Great project!
Send in more useful projects like this.
John Mastromoro
(UN)Saturated
In the January 2014 article,
READER FEEDBACK
Build a PIC-Based Remote
Temperature Sensor” there is a
sidebar discussing saturation of a
bipolar transistor. The definition in
the sidebar is not correct. The correct
definition of saturation is the state
where an increase in base current
does not cause an increase in
collector current. The formula at the
bottom of the sidebar yields this for
the value of Rb: Rb = (Vin -
VBEsat)/Ib. All this formula will yield
is a value for Rb based on the
desired tb and Vin. It has nothing to
do with saturation.
In order to calculate the
minimum tb required for saturation,
you need to know the load voltage
and the load resistance. This allows
you to calculate the maximum
current (ICmax = Vec/Rload) that is
‘Continued on page 59
EARN MORE MONEY
Get your dream job!
Be an FCC Licensed
Wireless Technician!
Make up to $100,000 a year and
more with NO college degree
Defense ete aes
ue ee lirry
+ No need to quit your job or go to school.
Paro cs
s easy, fast and low cost.
Sateen gener
Searaneubiriae ick nts}
Move to the front of the employment line in Radio-TV,
Communications, Avionics, Radar, Maritime and more.
even start your own business!
Call now for FREE info: 800-877-8433
[Link]
COMMAND PRODUCTIONS, Warren Weagant's FCC License Training
Industral Center, 480 Gate Five Rd, PO Box 2000, Sausalte, CA 949663000
ext, 109
ory 2010 WUTSAOUS 7PICAXE PRIMER
____ PICA)
BY RON HACKETT
[Link]
PICAXE-Pi Communications —
Part 1
At the end of the previous
Primer installment, | posed
three questions about the
behavior of the [Link]
program which we're going
to address this month:
*Why does one of the LEDs
remain lit when you press
ctel-c to terminate the
program?
* After terminating the
program, why does the
LED turn off when you
type [Link]() at
IDLE's interactive prompt?
* Finally, why didn't we see
something similar in our
earlier experiments last
time?
We're also going to begin
our exploration of PICAXE-
i communications.
However, before we tackle
either of those topics, there
are a couple of items that I
want to discuss. So, let's
get started!
Unzipping Archived Files
on the Pi
If you have read earlier PICAXE-
Pi articles here, you know that | have
been posting the individual program
files on my website because | hadn't
been able to find a way to unzip the
downloaded N&V zipped file.
However, | recently received an email
from a helpful reader (Margaret L.).
The solution that she suggested is
8 WOBWVOTS February 2014
printed in the Reader Feedback
section of last month's issue of Nuts &
Volts — you may want to check it out
Now that we're beginning our
exploration of PICAXEPi
‘communications, we're going to be
working with both PICAXE BASIC
programs and Python programs at
the same time. As a result, we're
going to need to download files to
‘our PCs anyway, so I've decided to
stop posting the individual program
files on my website.
I think the simplest approach is
to download the zipped file to a PC,
unzip it, and transfer the Python
programs to the Pi via a USB Flash
drive, or by setting up the Pi as a
server on the local network. (On the
Pi, also save all my Python programs
directly on the Flash drive as a
backup, in case my Pi crashes at
some point.)
PICAXE Editor Beta
is Now Available
The second topic that I want to
‘mention is not in any way related to
the Pi, but may be of interest to
many Primer readers. Revolution
Education recently announced the
availabilty of a Beta version of the
new Programming Editor software
which has been renamed to “PICAXE
Editor, version 6,” or just PE6. RevEd
‘emphasizes the fact that this is a Beta
release so there may be minor bugs
involved, and there will certainly be
many changes before the final
version of PE6 is released.
PE6 is a major re-write of the
PICAXE IDE (Integrated Development
Environment); it includes many
powerful changes — some of which
may be confusing at first.
Conveniently, PE6 can be installed
alongside version 5 of the
Programming Editor, so we can easily
experiment with it but still use our
older (more familiar) software for our
current projects.
‘When the final version of PEG is
released, we'll definitely discuss it in
some detail. Until then, I just want to
whet your appetite by mentioning
one new feature that's been on my
‘wish list for a long time: include files
This new capability in PE6 means
that we will be able to simplify our
PICAXE software in the same manner
that we are now doing with our
Python programs.
For example, we'll be able to
write a PICAXE “module” that
implements a aitly complex task
(eg, interfacing with an LCD display)
and then simply write something like
include [Link] in any program
that requires an LCD display
(basinc” is the extension that needs
to be used for any include file in
PE6). If you're interested in
experimenting with the Beta version
of PE6, you can download it at
wwrw,[Link]/Software/
PICAXE/PICAXE-Editor-6/.
On the same page, there's a link
for downloading the “PE6 beta
release notes’ — a 24 page pd file
that describes the major features of
the new software.
Now, let’ turn our attention to
the three questions from last time.
The first two are relatively easy to
answer. As you may remember, we
used an infinite wile loop to
implement our scanning Cylon Eye.
(if you need to refresh your memory,
take another look at the cylon10,py
program.)
‘Also, in the blink/LED) function.
that we used, we paused briefly to
light each LED but we didn’t pause atSHARPENING YOUR TOOLS OF CREATIVITY
all after turning off each LED.
‘As a result — forall practical
purposes — one of the LEDs is always
lit whenever the program is running,
‘Whenever we press ctrl, the
program immediately exits which
‘means that the [Link](
statement isn’t executed and one of
the LEDs remains lit. Of course, when
‘we manually execute the
GP![Link]’) command at IDLE’s
interactive prompt, the GPIO pins are
reset to their default input state, and
the lit LED is turned off
The third question (Why didn’t
‘we see something similar in our
earlier experiments last time?) is a
little trickier In each of the earlier
programs last time, we pressed a
pushbutton to light an LED; when we
released the button, the LED
immediately turned off, So, unless
‘you held the pushbutton down with a
finger on one hand and at the same
time pressed cithe on the keyboard
‘with two fingers on the other hand,
the LED was never lit when the
Keyboard Interrupt was executed
‘As a result, is easy to forget that
the GPIO pins we were using in the
program remain configured as
outputs.
‘At this point, you're probably
wondering why I'm spending so
much time on what seems to be a
trivial point. The reason is that | want
to use our [Link] program to
illustrate an important feature in
Python. It’s called “exception
handling.” and it’s so important that
most Python textbooks devote an
entire chapter to it.
We certainly don’t have enough
space in the Primer to thoroughly
discuss the techniques of exception
handling, but | do want to cover the
basics so that we can use this to our
advantage in the Python programs
‘we will be writing,
In Python, an exception refers to
any set of circumstances that can
result in a program being
automatically terminated. Many
exceptions are what we would call
“errors.” For example, if a Python
program is in the process of writing a
file to a disk and the disk becomes
full an error occurs and the program
ll automatically terminate (a.k.a,
“crash’),
‘On the other hand, our ctri-c
Keyboard Interrupt is also an
exception; when the interrupt occurs,
the program immediately terminates.
However, the Keyboard Interrupt is
definitely not an error; i's a Python
feature that allows us to exit an
infinite while loop.
In either case (an error or a
feature), the point is that we want to
bbe able to handle the exception
‘gracefully. For example, we could
allow the user to switch to another
disk to save the file; or — in the case
of the Keyboard Interrupt — we could
terminate the program “gracefully” by
executing a GP![Link]\
statement before exiting the program
Handling Exceptions
in Python
The two main statements that
Python uses to handle exceptions are
try and except. Let’s examine a
simple code snippet that uses those
two statements to execute a
GPO. cleanup’) statement before
exiting our cyion 10,py program when
circ is pressed:
while 1
uy,
for S9 im LEDs [0
‘blink (LED)
for LED in LEDs {[Link]-1)+
(LED)
([Link]()
B 6Pr0 »
Beint (*Progr:
terninated.*)
break
The code in the try block above
is the same as it was in our original
infinite while loop. As long as we
don't press circ, that’s the only code
that gets executed. In other words,
the infinite while loop executes
exactly as it did last time, However,
as soon as we press ctrkc, an
exception occurs and the code in the
except block is executed.
‘As a result, the GPIO pins are
reset, we tell the user what
happened, and the break statement is
‘executed. | don’t think we've used a
break statement before, but its
function is simple: It “breaks out” of
the infinite wiile loop. Since there is
no other code in our program, it
terminates.
Because an exception occurred,
you might think that the break
statement isn’t necessary, but it is.
‘When we include try and except
blocks in a program, Python no
longer automaticaly exits the
program when an exception occurs;
it “assumes” we will handle the
‘exception, including exiting the
program if that's what we want to do.
As a result, if we accidentally
omit the break statement, we create
another error! The program does not
exit, and the while loop executes
again. However, we just reset the
GPIO pins, so when Python tries to
blink another LED, the program
automatically exits with an error
message stating that the LED has not
been defined as an output!
Finally, there’s a potential
problem with the way | wrote the
above code snippet. The except
block will be executed whenever any
exception occurs — not just the
Keyboard Interrupt exception. Python
includes dozens of difierent types of
builtin exceptions, and many
extemal modules include additional
exceptions, as well
In addition, we can even write
our own exceptions if we want to. If
any one of those exceptions occurs,
the program will terminate
unexpectedly, providing no clue as to
‘what happened. The solution to this
problem is to write the except
statement so that it only applies to
the exception that we want to
“catch.” (In Python jargon, the except
statement “catches” the exception.)
In the above snippet, if we
replace except: with except
Keyboardintervupt: we will only catch
the interrupt; all other possible
exceptions will cause the program to
terminate normally with a (hopefully)
helpful error message.
February 2014 NITSHNOYS. 9Before reading further, you may
‘want to experiment with adding try
and except blocks to the [Link]
program until you feel comfortable
with the technique. When you're
ready, we'll tum our attention to
serial communications where we will
encounter additional uses for try and
except blocks.
Communication Options
With the Raspberry Pi
The P's internal hardware
implements three major
communication protocols: IC, SPI,
and serial. The question is: Which of
these protocols do we want to use to
communicate with our PICAXE
processors? The answer, of course, is
it depends!
Primarily, it depends on which
PICAXE processor we're using in any
given project. For example, if a fairly
complex project requires the
advanced capabilities of the PICAXE-
20X2 processor, the IC protocol is,
the obvious choice for implementing
PICAXE-Pi communication. The
reason is when using
communications, the Pi must be the
master processor, and the XT and X2
processors are the only PICAXE chips
that can be configured as an PC
slave. Therefore, C communication
with a Pi is not an option with
PICAXE M2-class processors.
In my experience, however, the
majority of PICAXE projects do not
require the power (or expense) of a
20X2 processor. As a result, our
Primer articles are going to focus on
communication strategies that can be
implemented with any PICAXE
processor (M2, X2, or X1). If you're
interested in PC communications
between the Pi and a PICAXE X2- or
X1-class processor, you may want to
take a look at [Link].
com/id/PICAXE-Raspberry-PI-ADC/.
When using its builtin hardware
for SPI communications, the Pi is also
limited to functioning as a master
processor, again, only the PICAXE
X2- and X1-class processors are
10 NUSHVONS February 2014
capable of implementing hardware-
based SPI communications.
In addition, those PICAXE
processors are also limited to master
mode only for hardware-based SPI
‘communications. (See the PICAXE
documentation for hspisetup, hspiin,
and hspiout in Section 2 of the
manual)
PICAXE BASIC also includes the
shittin ([Link]., spin) and shiltout
(aka, spiout) commands which
implement software “bi-bang”
versions of the hardware SPI
‘commands mentioned above, but the
software-based commands are also
limited to the X2- and X1-class
processors.
However, on M2-class
processors, it’s also possible to write
‘our own bitbang code to implement
SPI functions. The documentation for
the PICAXE shitin and shiftout
‘commands include sample code for
implementing a SPI interface on any
M2 processor, but the sample code
also configures the PICAXE as the
master processor so we still can’t use
that code to communicate with the
Pi because it aso insists on being the
master processor!
‘One possible solution to this
dilemma would be to write our own
bitbang routines that configure an
‘M2-class processor as an SPI slave so
we could communicate with the Pi
the master processor. I do intend to
try that approach in the future, but
for our first experiments | think that 2
serial communications link between
the PICAXE and Pi will be easier to
establish, so let's get started!
Configuring the
Pi Serial Port
By default, the Pi's serial port is.
configured so that it can be used for
debugging purposes. In other words,
\when you first boot the Pi, the long
list of output that you see on the
monitor is transmitted via the serial
port. Since we want to configure the
serial port so that we can use GPIO
pins 14 and 15 to communicate with
Post comments on this article and find any associates files and/or downloads at
[Link]/[Link]?/magazine/article/february2014_PICAXEPrimer.
our PICAXE projects, the first thing
we need to do is to disable the serial
login connection. In order to do so,
there are two files on the Pi that we
need to edit: /etc/initiab and
(/boot/[Link] — we'll use the
rnano editor for this purpose.
‘To edit the first file, open the
terminal and type the following:
sudo nano /ete/inittab
Press return and move to the end
of the file. You should see something
similar to:
Comment out that line by adding
a “#* character in front of it; then
save the edited file.
To edit the second file, type this
in the terminal:
sudo nano /boot /[Link]
Press return — the file will
contain the following (all on one
line};
awc_ota.1pm_enable=0
‘CEYAMAO 115200
RMD, 415200
y
Sev /mncbLkOp2
root Estype=ext4
elevator-deadline
Edit the file by removing both
references to the serial port
(ttyAMA0). When you have finished,
the file should contain the following
{all on one line):
awc_otg.1pm_enable=0
console=tey’
root=/Sev/macblk0p2
root fstype-ext4
elevator deadline
Footwait
Save the edited file, and reboot
the Pi by typing this in the terminal
(and then pressing return):
sudo nano shutdown - nowWhen your Pi has
finished rebooting, the
serial port (ttyAMAO) will
now be available on GPIO
pins 14 (TxD) and 15
(RxD), but we stil need to
install the pySerial package
before we can begin
exploring serial
communication between
the PICAXE and Pi. Before
installing any new packages
on the Pi, it’s a good idea
to first execute these two
commands in the terminal
sudo apt-get update
sudo apt-get upgrade
The upgrade process
may take quite a while to
complete. When it’s
finished, you need to
execute one of the
following commands in the
terminal:
For Python3: sudo apt-get
install python3-serias
For Python2: eudo api-oe
At this point, we'te finally ready
to begin our exploration of PICAXE-Pi
serial communication
Experiment 1: Serial
Output from PICAXE
to Pi
In our first experiment, the Pi will
receive serial data irom a PICAXE-
08M2 processor. (Actually, you can
use any X2-, X1-, or M2-class
processor — I just wanted to be sure
the 08M2 is able to do the job.) The
hardware setup is simple: Pin C.2 of
the 08M2 is connected to GPIO 14
(TxD) on the Pi, and pin C.1 of the
08M2 is connected to GPIO 15
(RxD) on the Pi. My hardware setup
is shown in Figure 1.
As you can see, I’m using the
stripboard interface circuit that we
constructed in an earlier Primer.
However, you can use any hardware
setup you prefer — just make sure
that the 08M2 is powered at 3.3V to
match the levels on the Pi’s GPIO
pins, and that there is a series resistor
in the two I/O connections that we
are using. (The stripboard interface
circuit includes 470 @ resistors on
each GPIO line.)
‘Of course, we need two
programs for this experiment: one for
the Pi and one for the 08M2. As
usual, go to the article link and
download the zipped file that
contains all the necessary programs
for this month's Primer.
‘One approach is to unzip the file
directly on your Pi if you have been
able to get that working. If not, you
can download the file to your PC,
unzip it there, and transfer the
Python files to your Pi either by using
a USB thumb drive or by setting up
the Pi as a server on your network
‘One way or another, you need to
have the Python files on the Pi, and
the PICAXE BASIC files on your PC.
For this experiment, the 08M2
program is [Link] and the Pi
program is serinfromAxpy. Let's start
with the 08M2 program which simply
sends the ASCII values for characters
FIGURE 1, Breadboard setup for Experiments 1 and 2.
A through Z to the Pi in an
infinite cio/ loop. The serial
transmission is “True” (Le.,
the line idles high) because
that's the format required by
the Pi. We don't need to
discuss the details of the
[Link] program;
when you read through the
listing, you will see how
simple itis.
The Pi program
([Link]) is even
shorter than the 08M2
program, but we do need to
discuss a few details. In
order to facilitate our
discussion, the complete
program follows
Aye
ialinero
Python:
B) import serial
©)# aezine & open
Foc
G) print ([Link]
H) except xeybooramterup
1) print (*Progran
vorminated.‘)
ND [Link])
K) break
In the above code, the letters
along the left edge are not part of
the program; they are just there to
facilitate our discussion. The
following comments reier to the
corresponding program lines above:
AA) As the comment in this line
indicates, the program is written for
Python3 which makes it a litle more
complicated than it would be if it
‘were written for Python2. We will
discuss the main difierences shortly.
B) This statement imports the
pySerial package that we installed
earlier. If you want to read more
about this package, just search for
‘pySerial documentation” (without
February 2014 MOSHVOUS. 44the quotes). Also, note that we did
not import [Link]; all we need is
the pySevial package.
D) This is one way of declaring
and opening a serial port in the
pySerial package. Any name can be
assigned to the port; I chose to use
ser for brevity. In Python, all
devices (including serial ports) are
treated the same as files, so the
‘jev/ttyAMAO parameter indicates
that the port we are opening
(ttyAMA) is located in the dev folder,
which is where all device files are
located in Linux. The second
parameter (9600) indicates that we're
opening the serial port at 9600 baud.
‘Two additional points are worth
mentioning:
+ Whenever a serial port is
defined, it’s also automatically
opened; a separate statement isn’t
needed to do that.
+ All serial communication in
Python is “True” (Le, the line idles
high), and it defaults to eight data
bits, no parity, and one stop bit.
These defaults work fine for
communications with PICAXE
processors, but if you're interested in
changing any of them refer to the
pySerial documentation,
F) The basic structure of the try
12 NUTSIVOZS February 2014
FIGURE 2. Screenshot of output for Experiment 1.
and except blocks follows the same
pattern we discussed earlier.
G) The real) function in the
pySerial package reads a single byte
‘Also, by default, the read) function
has no timeout. in other words, it’s a
blocking function — the program will
wait at this point until a byte is
received. This behavior can be
modified by declaring a specific
timeout when we initially configure
and open the serial port. At some
point, we will probably need to do
that.
J) In the except block, we need
to close the serial port before
terminating the program. Leaving a
serial port open when we terminate a
program can cause problems for
another program that attempts to
open the same port.
When you've completed your
hardware setup ‘or this experiment
(Figure 1), run the 08M2 program
first and then run the Pi program.
Figure 2 is a screenshot of both
programs running on my Mac. 'm
using SSH to connect to my Pi, so
the contents of its GUI appear on my
‘Mac's desktop. If you have a monitor
and keyboard attached to your Pi,
you should see essentially the same
results on two different monitors.
‘As you can see, the Pi's output
is a lite strange. For example,
instead of displaying A, ‘A’, or 65,
the Pi displays b’A' That's
Python3’s way of saying that it’s
displaying a byte, which is one of
several data types supported in
Pythons.
It took me a while to figure
‘out how to convert the output to
something more “normal.” If you
‘want to display the received bytes
as their ASCII values, try replacing
line G in the program with
print(ord(se:.read))) and run the Pi
program again. (You can just leave
the 08M2 program running as you
‘experiment with this,) You should
see the appropriate sequence of
numbers (65 through 90) on the
screen.
(On the other hand, if you would
prefer to see the actual ASCII
characters on your screen, replace
line G with print(chr([Link]\))
and run the program again. There
may well be a way to accomplish the
same thing with fewer parentheses,
but | haven't found it yet. if you find
‘one, please let me know!
Experiment 2: Serial
Output from Pi to
PICAXE
For our second experiment,
‘we're going to reverse the direction
of the serial link. This time, the Pi will
send serial strings to the 08M2
processor using the same hardware
setup we did in Experiment 1 (again
refer to Figure 1).
‘As you probably know, PICAXE
processors are not able to receive
serial strings directly; i’s necessary to
store each received byte of the string
ina separate variable. As a result, the
PICAXE file for this experiment
([Link]) is more complicated
than the Pi’s Python file. However,
‘we aren’t going to discuss it in detail
because it’s almost identical to the
approach we took back in theOctober 2011 Primer. (See the
discussion of the [Link]
program in that article)
Before we move on to discussing
the Pi’s Python program for this
experiment, | do want to point out a
couple of difierences between the
2011 PICAXE program and the one
that we're using in this experiment.
First, back in 2011 there was a
bug in the PICAXE compiler that has.
since been resolved, s0 we no longer
need to include the workaround that
‘we used back then. Also, in the
earlier article, we were using the
serrxd command; this time, we're
Using the serin command but the
technique involved is essentially the
same. In addition, back then we used
a 14M2 processor, and this time
‘we'te using an 08M2 processor. As |
mentioned earlier, any current
PICAXE processor can be used for
our Pi experiments, so that difference
isn’t significant either.
‘When you have downloaded the
[Link] program, read
through it to make sure you
understand how it functions. f
anything isn’t clear, you may want to
reread the 2011 article | just
mentioned.
‘When you're ready, let's move
con to the discussion of the Pi
program for this experiment
(serialOutToAxpy). In order to
facilitate our discussion, the
complete program iollows:
# [Link] (for
Python3)
import serial
from time import sleep
4 define & open serial port
9600 baud
ser = [Link]
(C/aev/ttyawio” , 9600)
4 Allow 082 time to discard
garbage chr
sleep (.1)
vinste Bove
ver wetteto'tetio
reaver}
Heep)
Sertetltedwrr eata ni’)
sleep (1)
Ser-write(b‘Where are
you?")
Sleep (2)
except KeyboardInterrupt,
Ser .write(b’ Keyboard
Interrupt’)
[Link]()
break
There are two points in the
above program that I want to clarify
First, in previous programs, we have
written import time which imports all
the functions included in the time
library. The alternate version that
\we'te using in this program has two
advantages: only the sleep function is,
imported (which i all we currently
need), so this version of the import
‘command reduces the size of our
program; and we can use a sleep)
statement without needing to write
timesleep)).
In this program, we're sending
three different strings to the 08M2. In
Python2, that was a simple matter
(eg. serwrite(‘Hello PICAXE’)
However, in Python3 there’s a
‘complication similar to what we
discussed in our first experiment. We
need to send the string as a series of
bytes. Including a lowercase b in
front of each string accomplishes that
goal.
There are more complicated
FIGURE 3
ways of doing the same thing, but
the above approach seems to work
well. Figure 3 is a screenshot of both
programs running on my Mac; your
results should be similar.
‘Once again, we're out of space
this month! Next time, we'll continue
‘our serial communication
‘experiments and use an 08M2
processor to help the Pi accomplish
something that it can’t do on its own.
‘As you know, the Pi doesn’t have any
analog inputs but PICAXE processors
have plenty of them (three on the
08M2, seven on the 14M2, and 11
‘on the 20M2).
‘Asa demonstration of how
PICAXE can help the Pi, we'll
interface an MCP9700A analog
‘temperature sensor with an 08M2
processor and serially send the
temperature reading on to the Pi for
display. As you may remember, we
have already accomplished the
PICAXE portion of this task (the
December 2012 Primer), so you may
want to re-read that article to get a
jump on things. In fact, you might
even try to implement your own
working system before the next
installment.
‘Whatever you do, have fun! NW
Screenshot of output for Experiment 2.
February 2014 WISIVOS 13.QOGA
In this column, Russ answers questions about
all aspects of electronics, including computer
hardware, software, circuits, electronic theory,
troubleshooting, and anything else of interest to
the hobbyist. Feel free to participate with your
questions, comments, or suggestions. Send all
‘questions and comments to: QEA@[Link]
Trickle Charger |
Could you provide a circuit to make a 12 VDC
trickle charger for my home generator? The
battery is gel type. | want to build it using a 12.5
VAC x 4.5 amp transiormer. Thank you for your
past help.
—Ken Bartone
‘A12 amphr battery should tolerate a constant
trickle current of 100 mA, but battery |
manufacturers recommend float
charge for long term storage. The
difference is that a float charger limits the
voltage to 13.8 volts (or leactacid batteries of
six cells
‘A bridge rectifier will give a peak voltage of
WITH RUSSELL KINCAID
* Trickle Charger
¢ Ham Mobile Radio Setup
* Electronic Player Piano
Post comments on this article and find any associated files
and/or downloads at [Link]?/
magazinelarticle/february2014_OA,
handbook — will be 0.135 amps.
‘When the battery is fully charged, all the current flows
through QI and its power dissipation is: 14.3%.135 = 1.9
watts. Q1 is rated at two watts with no heatsink, but ior
reliability I would use a heatsink of 30 deg C/watt at least
The power in R2 is: 2*R = 0.07 watts, so a 1/4 watt
resistor will be fine. A bridge rectifier rated at one amp is
available in a four-pin DIP package to complete the design.
D3 is necessary to protect Q1 in case the generator
charging circuit tres to charge the battery to more than
13.8 volts
FIGURE 1
13.80
peak. Referring to Figure 1, if the battery s to
be float charged at 13.8 volts, the voltage at the
QI collector will be 14.3V which means the
zener (D2) must be 13.8V. R1 shunts any zener
leakage to ground to prevent Q1 from tuning
on prematurely. R2 limits the peak current to
less than one amp: (16-143)/4 = 0.425 amp
and the average current — according to my
Rt
Ham Mobile Radio Setup |
9) | had to move and disconnect all my radios and
antennas from my car. | am now in the process
of rebuilding the VHF and HF power system. |
‘want to make sure that when the car is shut off,
the radios will shut off within 10 minutes to save my car
battery. Do you know of a schematic that will do the job?
— Jim Houser WABJIM |
14 NUTSIVONS February 2014
' ot
afm ge LY
about 17.5 volts; with a full wave bridge ima
rectifier, the DC voltage will be about 16 volts Lo
PARTS LIST MOUSER PART NUNBERS
‘pace
DescetprioN SartrNUNBER
Ey e
SP REAe Bion enti Slolomiet”
& Teint deal! OP Bie 38
Bont 6 ag ai
B BeeS BEIM BS
& aie Fe
einuoate-covrs $88
Bor ae Ba SBE Oo? 8
| know the problem, but 10 minutes is a long
time for a 555 timer. A PIC12F675 will do the
job with fewer parts. In Figure 2, the 12 volts
from the ignition switch going down starts the
time. Five volts for the PIC will be supplied by a
programmable zener diode because its current
requirement is low. | don’t know the current drain of the
radios, but 30 amps should be adequate.
What is needed is a 30 amp 60 volt switch that can
be controlled with a five volt signal. That in itself is pretty
simple, but the design is complicated by the need to
protect the circuit from the 60+ transient volts that are
expected in an automotive system,QUESTIONS and ANSWERS
In Figure 2, the components
R2, C1, R4, C2, R10, R12, and
D1 are for transient protection
D1 is necessary because pin 4
does not have a diode to VDD;
only one to VSS. R4 and RS
provide a safe +5V to pin 2
(GPIO.5) when the ignition is on
‘When the ignition is turned
off, IC1 is reset immediately
FIGURE 2
through C5 and R12, and the
a
2rase4) weoasenaen%e
program starts looking for alow >
in pin 2 —which happens aftera © Xo °
short delay caused by C2. Then, 5
the 10 minute delay starts, at the
end of which pin 7 (GPIO.0) PARTS LIST
Sy etldwhen the gmton se SY PRE es GS See BF
Q2 off. When the ignition is ei Peog, SHUNT RESUCATOR TO-s2 Saz-tnasanczx aad
tured on, IC1 is reset through Gs, 03 GP NN 2909 To-s2 542 2NgBesTAR Petd
FB Bie, wom Wake BER Taan | Be
R10, C4, and Q3 which starts the enn s SINC, 3.5, Ce C7 See-ra zee 186
Program runing again looking SE, Pee IU come | BCEREUCAE 2
for the ignition to be tumed off. Ba’ °°” “rte Sieh BOE 0-98 SE-ENHLAB-E 3
Figure 3 shows the power-off
delay program. A file is available at the
article link. (if you want to build this, !can 17 Mame
supply a programmed PIC12F675 for $5.)
Electronic Player Piano
MH, | have an old player piano
| mechanism that | want to convert
to electronic. When a note is to
x 'be played, a hole in a paper roll
passes over the corresponding “hole” in a
metal bar. | have thought about light
TRIstO =
erro 9
cucon = 7
OPFTON_REG = 11010000
a van BYRE
2 13/20/2013 :
1 TURM OFF OF 1oNrrsoM PowER sz=ARTS DELAY :
Daan oN aATTERY 76 ABOUT 2 an
REM DEVICE = 12°675
210.9 SET AS DIGI
"oet0.3 Watch TS MASTER CLEAR.
‘ALL OUTPUTS. SET LOW. LINE 27
detectors or even pressure detectors to DEFINE OSCAL_1_IK 3 “TO sav OSCILLATOR CuuIBRATION
detect the paper hole but | need
something simple, small, and reasonably °
Pause 2000 ‘PAUSE 2 SEC 70 ALLOW VOLTAGES 70 sTARELIZE
cheap. | was also thinking about using srare
either @ hacked electronic keyboard or a 35 PIO. = 0 MBN co
microprocessor to generate the music.
Any ideas to get me going? ee yamoi DER FIGURE 3
— Phil Fitzjarrell PAUSE 60000 *RAIT 60 SECONDS
| have a player piano, so | know
something about how it works.
Your project is very interesting to
| \me. One solution is a small
rotating wheel (88 of them) that falls through the hole in
the paper and completes a circuit. Ths is electrically simple
but mechanically complex. Not being mechanically
inclined, | will opt for a photosensor solution. The piano
paper roll s normally white but some of mine have
HIGH GPr0.0
REN RADIO PONER ZS PERNANEW:
|, yellowed with age. The paper is slightly more than 11
inches wide and has up to 88 slots (.050 inches wide)
which correspond to the 88 keys, plus another slot which |
think is for automatic pedal operation. | measured the holes
in the metal bar (see Figure 4) which tured out to be .075
February 2014 NUTSIVOUS. 48MAILBAG
Re: Bandpass Filter, page 20, December 2013:
#11 was looking over your calculations for the filter
in the December issue, and it struck me that there was a
resistor missing from the design we use in class. lf you add
3, the calculations go as indicated in Figure A. | ran the
bode plotter in Multisim, and got results very close to your
design goals. | haven't built the circuit in the lab yet, but
maybe soon. | really enjoy reading your solutions and
explanations. Please keep up the good work.
Ron Tinckham, Professor
Biomedical Engineering Technology
Santa Fe College
Thanks for your interest: this
circuit (Figure A) is the one t usually
Use for an RC bandpass. | was
intrigued by the circuit sent by Bob
Wojcik because I had not seen it
before. The calculations got so
complicated that | made C1 = C2 to
simplify, but forgot there were now
only two variables. So, gain, frequency, ss ai ues” sn
and bandwidth could not ail be Pits
specified. That is why my results were ="
off Heave the calculations to
interested parties!
Bisqiete
#2 Lenjoyed working through
your equations regarding the bandpass
filter problem. The circuit is called an +
Infinite-Gain Multiple Feedback
Bandpass Filter; Figure A is actually
taken from Rapid Practical Designs of Active fiters,
D. Johnson & J. Hilburn, Wiley 1975, page 139. The
‘equations from the book are:
Gain ~ R2/R1/2
B ~ 2/R2/C
2 = (1/R3/C2\( 1/81 + 1/R3)
Referring to Figure A, 8 is the bandwidth about the
center frequency FO, being equal to F2 ~ FI
Q = y/B and C = C1 = C2. R3 is missing from the
problem circuit, so the tetm 1/R3 disappears from the
equation for @,?
Using your numbers
RI = 1,589 ohms
R2 = 317,844 ohms
C= 10? farads.
Then
G ~ 100.01 (40 dB voltage gain)
B= 1,001 kHz
‘@) * 44,500 radians/second = 7.082 kHiz
Q™= w/B = 7.07
Peter A. Goodwin
Thanks for the feedback. The equations that you
juppled made me ealze that by making C1 C2, [had
lost control of one of the variables and that is why my
results were not as expected. It is necessary to keep the
ratio C1/C2, but that is too complicated to bother with
16 NUTSIONS Febsuary 2018
The three resistor circuit is tunable via R3 without affecting
gain or bandwidth. The two-resistor circurt 1s not tunable.
Re: More on the Jacob’s Ladder, page 20,
November 2013:
Looking at the article on Jacob's ladder; 'm confused
on coils/HV being directly connected to the QI drain.
Shouldn't it go to output? | want to use this as a fence
Zapper, but it looks like max smoke to me. So, does the
July issue seem right? :
Fre
Figure 1 in the November issue was intended to be
like the figures in the July issue, the HV at the top of the
ignition coil near terminal 4 is where the arc forms. | want
to caution you that if used as a fence contioller, it could
be lethal depending on the
frequency. Fence controllers usually
produce a pulse every second or so.
Ifyou reduce the frequency of the
oscillator, it could be a real attention
getter but not lethal. Ideally, the
secondary should be isolated from
the primary, but ignition coils are not
built that way. The spark current
coming back through ground could
ouerstress C3. To avoid that, connect
QI drain to earth ground and
Operate the circuit from a battery.
Re: NiCad Battery Chargers, page
22, December 2013:
Just received the December 2013
issue of Nuts & Volts. Had to
comment on Don's question on
age 22, Figure 4. Don specified a battery charger rated
2.9/8.7 VOC at 105/12 mA with humming. No burnt
resistors and LEDs light up. | redrew half of the circuit; the
24 ohm resistor is the current limite.
The LED turns on with sufficient current across the
24 ohm resistor and the (120/260 or 120/350 chm)
resistor and diode divider network, 110 volts applied
across the 24 ohm resistor at 50 percent duty cycle from
D5 or D6 would require about 126 watts.
Battery connections are not shown. As drawn in the
diagram, D1 through D4 are shorted by jumpers (brown,
black, green, gold, and silver),
Hi siver is replaced by two cell in series or green is
replaced by a 7.2 volt battery, numbers work out.
Source is 8.7 VAC for twocell and one diode with a
24 ohm resistor gives (8.7-2.4-1)/24 = 220 mA => at 50%
duty cycle = 110 mA
The NiCad nine volt battery gives 7.2 volts.
(8.77.2-1)/24-20.8 => 20.8/2=10.4 mA which is close
to the original specication.
The only element that could hum in this circuit is the
transformer at the bottom of the diagram. D1 and 03
appear to be reverse-charge protection for cells
‘My conclusion: The batteries were inserted in reverse
and will nt charge.
FIGURE A.
Edward Wade
Thanks, Ed, for your thoughtful analysis of the battery
charger circuitinches; | calculated the hole-to-hole spacing to be .075.
‘That is plenty of room for an 0805 IR emitter and sensor.
‘Mouser has an emitter and sensor in one package
that is .067 wide (part number 852-GP2S60B; 42 cents
each per hundred). This is a teflective system; the IR
bounces off the paper to a phototransistor. The optimum
spacing is .020, so a sheet of 020 plastic that is
transparent to IR will be optimum, and will protect the
paper from the sensors. The phototransistor will be turned
‘on when the paper is present and off when there is a
hole. That is probably the opposite of what is wanted, but
an inverter will solve that problem,
‘Another solution is an IR emitter on one side of the
paper and a phototransistor on the other. Mouser has
these in the 0805 package also ( part number 638-
PT1721BL41TRE for the phototransistor and 638-
1R1721C TRS for the matching IR emitter). The paper is
somewhat translucent, so some intensity adjustment may
be needed. A variable speed stepper motor to turn the
rolls would be the easiest, but an analog speed servo
‘would also work.
The metal bar has holes at the edges of the paper to
operate a servo that keeps the paper in the center; you
will want to implement that. | would do an analog servo; |
don’t know how to do a digital servo. | suppose a bang-
bang servo (where the paper is moved .025 or less) would
‘work. Ifthe left sensor is covered, the paper moves right
Until the right sensor is covered, then it moves back. |
think the servo in my piano is two speed because there
are two holes on each side of the paper, slightly offset
(see Figure 5). | don’t see the paper moving back and
forth; it stays in the middle.
‘Your idea of hacking a keyboard is great; it opens up
all kinds of innovative possibilities. NV
“Put the Spark back into your electronics”
Pesce
Pere ee ee
@25 best quess>| fe
RIGHT SIDE SERVO HOLES
EFT SIDE IS MIRROR IMAGE
February 2014 WUS!VOUS. 17NEW PRODUCTS
@ HARDWARE
@ SOFTWARE
GADGETS
TOOLS
AUTORANGING
FAULT LOCATOR
DS — maker of the CapAnalyzer 8A — announces
the new LeakSeeker 89 Autoranging Fault Locator
model EDS-89, which replaces the original LeakSeeker
82B short and leaky fault locator manufactured from 1995
to 2012
The American-made LeakSeeker 89 locates the exact
spot on a printed circuit board (to within a fraction of an
inch) where a shorted or leaky component is bringing a
power supply bus or data line to ground. It is able to
locate defects from zero to 300 ohms with no loss of
resolution. It can even find active shorts that a DVM won't
show. The high GAIN mode can locate shorted
components on mult-layer boards with ground planes and
a power layer. Three fully automatic range settings allow
easy finding of iaults along thin, normal, or wide, ground
plane copper PCB runs. A video at [Link]/
watch?ieature=player_embedded&v-BUyEe8G50D4 is
available. A 60 day satisfaction or money-back guarantee
is included. A copy of the operation manual is available
er era
For more information, contact:
EDS
[Link]
SOLAR PANEL
CONTROLLER
the SCLED-12VSA-T Solar Panel
Controller from J2 LED Lighting,
uses microcontroller
ircuitry with user
selectable nighttime on
functions for LED lighting.
The dusk to dawn
function works by sensing
the voltage of the solar
panel. The controller is in
dawn mode when the
ambient light load on the
solar panel produces a
voltage over 4.5 volts
(ref.) In this mode, the
controller’s output is off.
The dusk mode is
activated when the panel
voltage drops to below
4.5 volts (ref.) due to a
lack of ambient light. In
this mode, the controller
18 NUTSLVOUS. February 2014
turns the output on to the LED
lighting load. A switching delay
reduces false triggering with
fluctuations in cloud cover.
‘An internal user selectable DIP
switch provides the option to limit
the amount of time the light is on to
two, four, six, or eight hours. The
controller also provides standard
dusk to dawn control with no time
limiting, The time limiting
function is useful for
various applications in
BB which battery size and/or
panel size may need to be
reduced by limiting
operating time of the LED
lighting load at night. The
controller also functions
to protect the battery
(SLA, Sealed Lead Acid)
from over-charge and
under-charge.
The controller has
internal voltage sensing
that monitors the battery
voltage. The controller will
disconnect the LED
‘output load ifthe battery
voltage falls below 11.6
Solar Controllervolts (ref). The controller will allow
operation again when the battery
voltage recovers to 12.5 volts (ret).
The charge power to the battery is a
PWM (Pulse Width Modulation),
‘An internal TVS (Transient
Voltage Suppressor) protects the unit
from voltage transients that may
occur from nearby lightning strikes to
the solar panel. An internal auto
resetting polymer fuse on the battery
connection provides protection from
current and thermal overload.
The solar panel and LED lighting
load connections of the controller are
recommended to be fused at five
amps maximum. Any additional
fusing guidelines from the solar panel
and battery manufacturer should be
followed. A solar panel tor a 12 volt
system should be used. A 12 volt
solar panel rated at 60 watts is the
maximum size (or the SCLED-12V5A-
T controller. The largest size of
battery recommended is 40 amp-
hours. Smaller amp-hour batteries
may be used if sized accordingly to
the solar panel and load.
The SCLED12VSA-T is minimally
“weather resistant” and needs to be
mounted so as to be protected from
direct exposure to water/moisture. To
ensure an extended lite of the
controller, mount it in a semi-covered
place out of the elements. A standard
NEMA electrical enclosure rated for
the operating environment may be
used for protection of the controler.
Electrical characteristics include:
Module rating is 60 watts max at 12
volts DC, five amps max. Max idle
current in off state is 7.0 mA max.
Electrical specifications are as
follows:
+ Working Temperature: -20°C-60°C.
+ Dimension: L72 x W38 x H28 mm.
+ Rated voltage: 12V DC.
+ Rated charging current: five amp
max.
+ Float charge/tapid charge:
13.6-146 volts DC (PWM).
+ Overdischarge low voltage
disconnect: 11.6 volts.
+ Over-discharge recover
voltage: 12.5 volts.
+ Ambient Light Sense (ALS) dusk to
dawn switching at 4.0-4.5 panel volts
(ref. 10 Lux panel light), >10 seconds
switching delay.
+ Intended to control LED lighting
loads only and ‘or use with SLA
battery only. Maximum
recommended battery size is 40
amp-hours; maximum 12 volt solar
panel size is 60 watts.
+ Wiring polarity is defined by case
‘marking; use no smaller than 18
AWG wire UL1007 or equivalent;
fuse with no larger rating than five
amps.
Pricing is as follows (in USD): 1-4
nits $22.50 ea; 5-99 units $19.99
a; and 100-250 units $16.99 ea
For more information, contact:
J2 LED Lighting
hitp://[Link]
CLASS D BLUETOOTH
AMPLIFIER
PBs pees announces hee
‘new, highly capable Lepai audio
product. The compact and efficient
Lepai LP7498E stereo amplifier
delivers a pristine 100 watts into
eight ohms per channel, thanks to its
Class D output circuit design.
Features include:
+ Ample, clean Class D amp output
for music and multimedia.
+ Advanced STMicroelectronics
TDA7498E audio amplifier chip.
+ Wireless music streaming via
Bluetooth connection.
+ Extreme efficiency (90%) delivers
high headroom, reduced current
draw.
+ Compact size: 4-1/2" W x 1-1/4" H
x7.
+ Power supply inclided.
Because of its useful powerto-
size ratio, this stereo amplifier is
periect for desktop systems,
bookshelf speakers, and most home
(or office) audio applications. The
black chassis and laser engraved
silver faceplate provide a modern
cosmetic touch.
The LP7498E employs the highly
efficient STMicroelectronics
‘TDA7498E audio amplifier chip,
which is capable of 160 + 160W
output into four ohm loads, or 1 x
220 watts bridged mono. Internal
components are sourced from brands
such as NEC and Alps. Integrated
thermal protection ensures long life
and troublesree operation.
High quality binding posts (5/8"
on center) accept bare wire, 3/8"
spade terminals, or standard banana
plugs for problem-free speaker
Connections. RCA L/R inputs are
incorporated or analog connection
(cable not included). Each LP7498E is
shipped with its own 36 VDC 4.54
Power supply.
The LP7498E also enables
Bluetooth connectivity to wirelessly
stream audio from an iPhone,
‘Android smartphone, tablet, or
laptop. The Lepai LP7498E amplifiers
low price and accurate neutral sound
character make it an ideal partner for
‘workbenches and test stations
For a limited time, special pricing
February 2014 MUNDUS. 19of US$109 is available.
For more information, contact:
Parts Express
[Link]
UNIQUE MODULAR
PROJECT
SYSTEM
‘ake what you need, leave out
‘what you don't! This is the
slogan for the new Tibbo Project
System (TPS) featuring Tibbit™ /O
modules available new from Tibbo
Technology. Tibbits (as in "Tibbo
Bits?) are blocks of prepackaged YO
functionality housed in color-coded
plastic shells. Want an ADC? There is,
a Tibbit for this. A SV power supply?
Got that. RS232/422/485 port? PoE?
PWM? These, and many other Tibbits
are available, as well
Tibbits are divided into Tibbit
modules and Tibbit connectors.
Each TPP (Tibbo Project PCB)
can accommodate multiple Tibbit
modules and connectors. Only bare
essentials are provided on each
board. There is a CPU, an Ethemet
port, and a very simple power supply.
2 ly 2 8 ay
20. WISWOUS February 2014
The rest of the board's functionality is
defined by what Tibbits are plugged
in, There are several TPP "sizes" that
differ in the number of Tibbits they
can accommodate.
‘As with most Tibbo products,
TPPs are programmable in a
language called Tibbo BASIC. This
easy to learn programming language
is particularly suited for control,
automation, and networking
applications. Tibbo BASIC is
compiemented by a rich set of
programming objects. There are
“objects tor socket (TCP, UDP, HTTP)
and serial communications, WiFi,
GPRS, file data storage, LCD and
keypad control, and many other
functions.
Tibbo BASIC applications are
created using the free Tibbo IDE
(integrated Development
Environment) software (TIDE). This
software features a builtin debugger
allowing users to upload their Tibbo
BASIC application onto the TPP
board, and cross-debug it through the
Ethemet LAN without the aid of any
special debugging hardware (such as
a JAG board or an ICE machine)
More than just an enclosure for
TPP and Tibbits, a Tibbo Project Box
adds an aesthetic touch to
‘automation projects.
The top and bottom walls of
an assembled project box
are formed by two rows of
connector Tibbits installed
ona TPP.
The front cover of the box is
made of translucent plastic that
allows users to see the status
LEDs of Tibbit modules installed
inside, The front panel also
accommodates paper inserts
similar to those ‘ound on office
telephones,
The inserts are meant for
marking wires and ports of a TPS-
based automation device.
To aid users in the evaluation
and creation of TPS-based
automation products, Tibbo has
designed an online configurator.
Name the project, select the TPP
board, place required Tibbits,
and the configurator will notify
builders of potential problems and
even calculate the projected power
consumption.
Pricing for barebone systems
range from US$89-$106; Tibbits
range from US$2-$100. All parts can
be purchased separately. Check out
the website for specific costs
For more information, contact:
Tibbo Technology
[Link]
LOW POWER RADIO
TRANSCEIVER
Govt compas in, as
introduced the STD-502-R 2.4
GHz transceiver which uses direct
sequence spread spectrum (DSSS)
modulation and a true diversity
circuit, enabling reliable
communications even in the
congested 2.4 GHz band.
The STD-502-R complies with the
European ETS EN300440, US FCC
Part 15.247 standards and Japanese
ARIB STD-T66 standard, making it
ready for the global market.
Low power consumption and
battery operation give the STD-502.R
the periormance demanded for in
applications where long range and
reliability are required
The transceiver uses a
transparent data interface to enable
users to communicate using their
own protocols, with 77 available
channels at a lineofsite range of up
10 300m,
Designed to be embedded in
equipment, the STD-502-R wasjoy
WE BUY/SEL EXCESS & ORSOLETE INVENTORIES
FREE COWPITER AND ELECTRONIC RECYCLING
384 W. Caribbean Dr.
TERE Cr ent)
Oe ees
Perna
Oretera)
Cae Cerne ee kcal
Bie aw hcl y7
BONN s/n
ea
eae
Peet
per)
eer)
ikon *
es
err es
ye eer
developed as a radio module for
industrial applications that require
reliable operation. Besides using
highly noise-esistant DSSS
modulation, the module has a true
diversity receiver function for
preventing signal dropout due to
‘multi-path fading,
The modules can be easily set
Via the RS-232 UART interface using
dedicated commands. Spread
spectrum correlation is done in a
custom onboard ASIC instead of
relying on conventional RFICs.
The STD-502R module itself has
no builtin communication protocol
Instead, it has a transparent RS-232
data input/output interface, enabling
Users to employ their own protocols
‘without modification,
In addition, it can continuously
transmit a low of high signal without
restriction.
‘An evaluation board (the TB-
$TD502) allows testing of the STD-
502-R module to perform range, data
packet, and switching signal
transmission tests
‘Onboard LEDs, CH switch, ID
ww. Primed -com|
Dead Battertes ? Dorit tas them,
Sena tam to creer are
Better than snl speteons
rons Gy Pasion
sacooe GM) SE:
fone, Suet et
she rey Soe
ERE later cy
SX move, eres ae
24 We Geoure resorts tot (844) 623 7000
Quality Kits for All
Your Electronic Needs!
Explore the World of
Electronic Project Kits
and Devices.
We offer a wide selection of
electronic kits for beginners,
{8 well as more advanced
Projects ‘or students and
experts! 1. a-KIT:
[Link]
Seat Mechanical Compo
ROSOTIES
cileles pie -i2]
switch, and pushbuttons can exercise
switching signal tests and packet tests
with packet error indication
The STD-502R is designed for an
operating temperature range of -20
vto +65 °C with an RF power of 10
mW (3.3V 65 mA), and is intended
for the remote control of industrial
‘equipment or for industrial
‘measurement systems.
Retail price ts around US$105
For more information, contact:
Saelig
IDE8051 Trainer
“by Digilent
C
[Link]/MDE8
"SLIDE MOONT for MOBNE RADIOS
UNIVERSAL Fits Most 2 WA'S
(ak stout our maximum raccty
techig ace age Moea)
reed
ies
February 2014 MUTSIVOUTS. 21By Robert Atkinson
Post comments on this article and
find any associated files and/or
downloads at [Link]
x. php?/magazine/article/
february2014 Atkinson.
any radio enthusiasts and other hobbyists use or repair equipment intended for
Miri use. This requires a source of power, nominally 13.8V DC. Many
designs have been published using the ubiquitous 2N3055 as the linear pass element.
These can be inefficient. More recent are switching regulator designs. Unfortunately
while efficient, these can generate unacceptable levels of electrical noise. Here is a
linear design modernized with MOSFET pass elements that improve efficiency with
no switching noise.
22 NUTSIONS February 2014With older bipolar (BJT) designs, you have the low
current gain and large voltage drop of the pass transistor
(read the sidebar Overhead in Bipolar). This requires
higher unregulated voltage and consequently a larger
transiormer and heatsink.
In contrast to the BJT, Metal Oxide Semiconductor
Field Effect Transistors (MOSFETs) require no steady state
drive current and have a low ‘ont resistance. The
downside is that they require about seven volts on the
gate to pass high currents. As this is with respect to the
output voltage, the gate will be at around 21V. Using the
high current unregulated supply to provide this would be
‘worse than the BJT design. An additional transiormer and
rectifier could be used, but adds to the cost.
This design uses a voltage doubler to provide the
supply ‘or the regulator and gate drive. I's rated at 144
Continuous or 20A peak duty but can be scaled up or
down as required. Its equivalent to a commercial "20
amp* supply costing around $100.
Circuit Description
Refer to Figure 1. The incoming mains is fused and.
switched before being applied to the primary of TI — a
300VA toroidal transformer with two 15V secondaries
connected in parallel. The AC is fullwave rectified by
bridge rectifier BRT. The rectified output is smoothed by
C1 and C2, which are 10,000 pF electrolytics. The voltage
at this point is approximately 19V under load.
The higher voltage required by the regulator is
provided by a voltage doubler comprising C3, D2, D3,
and C4. This does not look like a voltage doubler unless
the main rectifier and filter capacitor are considered. Note
MOSFET 13.8V POWER oy
‘SUPPLY a
that one side of C3 is connected to the AC output of the
transformer. On the negative cycle of the AC, C3 charges
to the peak of the AC via D1 and the upper righthand
diode of BRI.
‘On the positive half cycle, the charge on C3 is
transferred to C4 via D2. As C1/2 and C4 are each
charged to around 20V and are in series, the voltage at
the junction of D2 and C4 is 40V. As this exceeds the
M723 rating, a simple shunt regulator — R1 and zener
diode D4 — provides 36V to LM723. This also improves
the line regulation.
The LM723 is an older IC that is simple to use and
low cost. Internally, it has a voltage reierence (7.15V),
error amplifier, and a currentiimiter circuit. The reference
voltage (pin 6) is connected to the non-inverting input of
the error amplifier (pin 5). The output voltage is sensed
and reduced to 7.15V by divider R5, RVI, and R4, The
output of the divider (wiper of RV1) is connected to the
inverting input of the error amplifier (pin 4).
When the output voltage is low, the error amplifier
output (pin 10) goes more positive. The error amplifier
output is connected to the gates of the MOSFETs via
resistors R2, R3, and R4. These low value resistors
suppress oscillation of the MOSFETs and are located close
to them. The output of the LM723 is emitter ‘ollower and
can't sink current to turn the MOSFETs off. R7 provides a
load to discharge the gate capacitance of the MOSFETs
and turn them off. C5 provides feedback compensation.
iF itis too small, the circuit may become unstable. If it
is too large, the output may over — or under-shoot with
load changes. The LM723 currentimiting circuit reduces
the output when the voltage between pins 2 (current limit)
and 3 (current sense) exceeds 0.6V. This is normally
sensed by a resistor in the output current path.
The value for a 20A limit is 0.6V/20A = 0.03 ohms.
ve FIGURE |.
+38v
February 2014 NITSIVONS 23Voltage Overhead in Bipolar Design
traditional near regulator circuit utlizes bipolar
transistors. This results in a significant voltage overhead
for correct operation. Overhead or dropout voltage is the
additional input voltage above the regulated output
‘voltage that is required for correct circuit operation. For
higher current designs, this is composed of the regulator
overhead and the pass element overhead, The LM723
overhead is a fairly substantial 3V (typical three-terminal
78xx regulators are 2V and some low dropout types are
less than 0.2V).
The popular choice for pass transistors is the 2N3055
bipolar. For 20 amps output, at least two in parallel
(probably four, but the number does not afiect this
analysis) with a third as a driver in a Darlington
configuration is appropriate. The 2N3055 has a base-o-
emitter voltage of 1.5V at higher currents. Adding 1V for
the driver gives 2.5V. Additionally, the bipolar design
needs emitter current balancing resistors. These are
normally sized to drop 0.5V or more. Therefore, our total
overhead is
3 + 2.5 + 0.5 = 6V. So, the minimum voltage at the input
to the regulator is six volts higher than the desired output
voltage,
This is all wasted energy converted to heat. For our 20
amp reference design, this s 6V x 20A = 120W. Some
reduction could be made by having a separate supply for
the regulator and driver. This could lower the overhead on
the high current supply to 3.5V (3V output transistor
collector emitter saturation voltage plus 0.5V balancing
resistors). However, the regulator supply would itself have
to be rated at two amps to drive the pass transistors.
For our 13.8V reference design, we need a minimum
unregulated voltage of 19.8 volts to ensure correct
operation. This equates to a 15.2V AC transformer without
any allowance for line voltage drops or other losses.
Typically, these designs use a 18V AC transformer. With
18V AC, this is our worst case power dissipation. This
increases the power dissipation to around 228 watts for
276 waits of output power. Ths is less than 55%
efficiency. The MOSFET design with a 15V transformer
achieves 66% with a smaller transformer. Both these
figures inchide the same bridge rectifier loss of 24W.
‘This is low for readily available resistors. In this design, the
inherent resistance of the cable between the MOSFET
source connection and the output terminal is used. This
gives a poorly defined short-circuit current, but protects
the MOSFETs, Any sustained overload will cause the mains
fuse to fail. an ammeter is fitted, itis included in the
short-circuit sensing path
Component Selection
A toroidal mains transiormer was chosen as they are
compact, cool running, and have low magnetic and
audible hum levels. This example was based on a
common stock size with a 15V output — 300V/. This will
24 NUMSIVOUS. February 2014
provide 20 amps AC (300V/A divided by 15V), however,
as we are using a full~vave bridge rectifier and capacitor
filter we cannot take 20 amps DC.
The simple explanation is that the OC voltage is equal
to the peak of the AC or 1.4 x 15V = 21V. To maintain the
same power in the transformer, we must divide the current
by the same factor; 20A / 1.4 = 14A. This is slightly
optimistic but is usable tor most applications where full
load is not drawn 24/7.
For 24/7 applications, a factor of 1.75 should be used.
This will give an output current of 11.44 jor a 300VA\
transformer. The specified transformer is made by Antek
([Link]).
The bridge rectifier is a 35A 200V PIV rated unit.
While a 254 bridge will work, there are advantages using
the 35A. The main advantage is lower voltage drop due to
lower internal resistance. The specifications indicate 40%
more current for the same 1.1V drop for the 35 bridge
over the 25A, of a voltage drop of 200 mV less at 20A.
That's four watts! The cost difference is minimal.
The main filter capacitor is an important component,
particularly if there is a small difference between regulated
and unregulated voltages. If the capacitor is too small or
low quality, the smoothing will be inadequate. This causes
a ‘ripple* at twice the mains frequency on the power
supply output. Conversely, if itis excessively large, high
peak currents will flow in the transiormer and bridge
rectifier causing overheating. So, how do we choose?
There are “rules of thumb" such as "1000 uF per amp
of load, but there is a more calculated approach. In 1943,
©. H. Schade published a paper “Analysis of Rectifier
Operation’ in the Proceedings of the IRE, Schade worked
for RCA and the paper was about tube rectifiers.
However, it contains formulas and charts for calculating
filter capacitor values. These are based on the source
(transiormer and rectifier) and load resistance ratio, and
the relationship of capacitor impedance at the ripple
frequency to the load resistance. This is expressed as
2nfCR (C in farads, R in ohms). For 50 Hz mains (UK,
worst case) the ripple is 100 Hz, so for 20,000 uF and a
0.8 ohm load (17A) 2n{CR = 5. I chose 17A as its
between the continuous and intermittent loads.
The source resistance is not normally quoted for
transformers but can be inierted from the change in
output voltage from minimum load to full load
(regulation). The 300VA toroidal has a measured
regulation of 9%; 0.09 x15V= 1.3V at 20. Ohms Law
sives us an equivalent resistance of 1.3/20 = 0.065 ohms.
Hl round up to 0.0722 to allow for lead resistance. This
sives a source/load resistance ratio of 07 / 0.8 = 0.09.
Schade's graphs give a ripple of 15% or about 3V
with a 20,000 1F capacitor. This gives a minimum
Unregulated voltage of 16V, so we have a couple of volts
in hand before ripple appears at the output at 17 amps.
The voltage rating should be at least the peak ofoad