DIYODE Issue 004 October 2017 PDF
DIYODE Issue 004 October 2017 PDF
MOBILE
EMERGENCY
CHARGER
Issue 004
Oct 2017
AUS: $9.95 inc. GST
ISSN: 2207-8045
04
CHECK OUT AN AMAZING SENSORY LEARN HOW TO USE BUILD OUR FIRST DISCRETE
DEVELOPMENT DEVICE FOR KIDS CAPACITORS EFFECTIVELY PROJECT - A LOGIC PROBE
Using Arduino and some creative They're useful and powerful, and Convenient and fast diagnostics for
thinking for a great result. surprisingly easy to use! makers everywhere!
Reinvent your
energy
With clean, reliable solar energy and Tesla Powerwall 2,
Bradford Solar puts you in charge, day and night.
DIYODE Magazine’s
First Discrete Project
As a child, I grew up building Dick Smith FunWay kits, the Jaycar
Short Circuits Kits, kits from Electronics Australia, and also from
our friends over at Silicon Chip Magazine. They were a key piece of
the puzzle that ultimately formed my understanding of electronics.
They were also the cause of a few show-off moments to friends
and family, to say the least. The engineering hours that have gone
into developing those kits over the decades, fill many lifetimes. The
copper tracks laid out could stretch to the moon, and the solder
fumes could... well, at least we have lead-free solder now.
EDITOR Published by B.E. DIYODE Pty Ltd While they’re handy, board-level projects, they will focus highly on
Analee Gale
ACN 616 556 622
the education around what makes them work, while still providing
TECHNICAL EDITOR ABN 50 616 556 622 practical utilities for a maker. We want them to compliment or assist
Bob Harper
Level 1-2, 156 Mann St,
your microcontroller and maker projects, just as much as your
STAFF WRITERS Gosford NSW 2250 Australia computer does. Of course, we may publish something that’s purely
Oliver Higgins
Daniel Koch © 2017 No part of this publication may be
for fun too, because who doesn't like a fun project, regardless of
Tim Blythman reproduced without written authorisation. All whether it's microcontroller based or not?
contributed content is owned by the authors
PROOFREADER and reproduced with permission. All product
John Bourne names, logos, and brands are property of their Our Technical Editor Bob Harper has been putting his decades of
respective owners.
CREATIVE LEAD
experience to excellent use to help these new projects come to life.
Jennifer Holland Printed by PMP. Thanks to our retail partners Jaycar Electronics and Altronics, you’ll
CREATIVE &
be able to purchase a kit of parts complete with PCB. Naturally, the
Newsagent distribution within Australia
DIGITAL TEAM managed exclusively by Gordon & Gotch. entire design of each project will be made open-hardware, so you
Luke Parsonage
Kayla Gourlay
can modify and adapt the design to suit your own purposes if you
ISSN: 2207-8045
Melanie Heard wish to do so.
Mike Lewis Print subscriptions are available to Australian
Danielle Bell residents for $9.95 per issue including GST.
Jacqui Creasy See diyodemag.com for international We're also trying to use some off-the-shelf items in creative ways,
Mike Hansell subscription pricing.
which is demonstrated by our hacking of a 5V DC-DC converter to
CONTRIBUTORS All prices quoted in AUD including GST unless provide a convenient emergency phone charger. A handful of parts
Tom Biskupic noted otherwise. All prices are correct at time
Sascha Grant
and a 3D printed case - it's simple and effective.
of printing and subject to change without
Miles Hitchen notice.
David Such
You may also note that Alarmduino has taken a break this month.
Dawid Verwey ADVERTISE WITH US
[email protected] That's because we have some brilliant new features for it in the next
installment, so it'll be back in issue #5!
CONTACT US
[email protected]
+61 2 4326 0160
Please enjoy Issue #4, and thank you for your continued support.
FOLLOW US
@diyodemag
Rob Bell
Head over to
diyode.io/004comp
and tell us why you
want to win!
available at:
14 46
50
90
LOW HIGH
AI E
RP
RESSUR
84
EDUCATION:
32
■ F UNDAMENTALS
Keeping It More Regular 23
■ SECRET CODE
Functions & Arrays 36
■ THE CLASSROOM
Coping With Capacitors 50
■ WHAT THE TECH
Google Voice Assistant 96
PROJECTS:
■ 3 D PRINT SERVER
Easy As Pi! 26
■ EMERGENCY PHONE CHARGER
Lemons vs. Batteries 40
■ THE UBIQUITOUS LOGIC PROBE
Simplify Debugging & Testing 58
■ MQTT POWER POINT
Voice Controlled 76
■ PART 2: SAM V1.1
Upgraded Senses 90
36 40
■ E DITOR'S LETTER
DIYODE's First Discrete Project 04
■ NEW & REVIEWED
Airblock, Leading Edge, & IoD 08
■ MOONSHOTS
Autonomous Vehicle Conundrum 20
■ THE ADVENTURES OF
CIRCUIT MODD 98
Spotlight on:
Airblock
The Modular and
Programmable Drone
The Airblock first appeared in 2016 on Kickstarter, pitched by (all supplied) can be connected to the control module via the
Makeblock, the brains behind mBot and other cool robotics and electrical connections on each side. These modules have powerful
STEM products. This clever innovation uses modules to create a six- coreless motors and plastic rotor blades and there is a protective
axis drone or hovercraft, plus a handful of other weird and wonderful cover for each side to stop mischievous fingers from being hurt. A
configurations. The Airblock has just landed (pun intended) at 7.4VDC 700mAh Li-Po battery is included, along with a charger that
Jaycar Electronics, so we put one through its paces. plugs into any USB port, to provide the power for up to six minutes
of full flight.
FIRST IMPRESSIONS
BUILD IT
The packaging is very classy; solid construction, carry handle and a
lid that magnetically closes. Inside, you’re presented with a moulded Assembly is truly child’s play. Our six-year-old helper assembled the
cardboard insert securely holding six power modules (motors with hovercraft within minutes, just by looking at the photo on the box!
rotors), and a master controller module, all hex in shape, 75mm Each module has a strong polarised magnet that fixes it firmly in its
wide and made from durable but light EPP foam. Within the box correct place on the master control module – genius!
there is another moulded cardboard insert holding the hovercraft
base, battery, charger, USB cable and protective covers for the THE APP
power modules. There is also a colour user guide, a bag of spare
rotor blades, and three sets of stickers for the fuselage, power A tablet or smartphone is required to control the Airblock. The free
modules and hovercraft. Cool! ‘Makeblock’ app can be downloaded and suits all of the products in
the Makeblock range. Once you choose Airblock you’re asked if you
INSIDE THE BOX want to Play or Create. The Play option asks if you’re running in Air,
Land or Water mode and provides a controller interface accordingly.
The hex-shaped control module sports an ultrasonic sensor, The Create option enables you to customise and save your own
barometer, gyroscope, Bluetooth module, and microcontroller chip, controller interface depending on the mode selected. Pairing via
with a battery compartment underneath. Up to six power modules Bluetooth is very easy also - it doesn’t even require a pin code.
NEW & REVIEWED
button was impressive. The rotor protective covers did fall off from
time to time, which was annoying. It was easier to fly without them.
This is where the Airblock really sets itself apart from the everyday
drone. The app allows you to go code your own interface using
Scratch 2.0 inspired drag-and-drop coding (as taught in many pre-
schools now days). Brilliant! Set motor speeds, direction, and create
events based on temperature, gyro, battery level, and much more.
For those familiar with coding, it performs maths as well as the
humble “if, then, else” and “loop” statements. It appears it’s only
limited by your imagination.
CONCLUSION
On Location:
The Locals With
A Leading Edge...
When meeting these small business owners, what really stood out It’s an impressive model, and one we feel should be admired and
was the passion they have for what they do, and the life they bring supported. These business owners pour their heart and soul into
to the industry. With time-tested values and honest service, they delivering the best possible products they can to the marketplace.
drive hard every day to bring the products to their stores that their The Leading Edge Group was founded in 1986, and partners with
customers want. Sure, Leading Edge Electronics might be boasting world-leading brands to bring some of that muscle and might.
close to 100 stores, but walk into any individual store and you’ll be But it’s not all about business. Business can be a tough road, and
greeted by the local owners, most of whom know many customers the group provides comradery and a support network to keep the
by name, and who take the time to make sure those people walk out engines running at the heart of these businesses.
with the very best solution they can possibly muster for their unique
problem, whatever that may be.
One thing that we never fully appreciated about The Leading Edge
Electronics outlets was the vast range, and the quality of brands
you’ll find in each store. Walking through the trade exhibition, my
eyes were opened; it’s true, you’ll find many of your favourite parts
for hobby electronics. Arduino and Raspberry Pi products will be
abundant, as well as soldering irons, components, and a huge
range of the parts we use in many of our projects. But what was an
unexpected find, are all sorts of amazing things from some of the
biggest names in the industry. You’ll find quality solar and power
hardware, CB radios, surveillance equipment, high-powered WiFi
gear, and so much more. It’s a versatile and powerful range of
products.
Coming Soon:
The 4D
Systems
IoD-09TH
One of the limitations that currently
surround Arduino, is its limited display
capabilities. Absolutely, there are displays
available and we often integrate them, but
producing quality graphics can be a challenge.
Obviously, in an Arduino board there is no on-board
display processing, so an external display processor is really
required for advanced display hardware.
Pushing display boundaries is part of 4D Systems’ DNA, and their Now, anything you would normally task an ESP8266 to do, you
latest product is no different. The IoD-09TH integrates a 0.9” can add a quality display for user feedback, input monitoring, and
TFT LCD screen, on an ESP8266 WiFi chipset. This is a powerful more. The display itself is a 80 x 160 pixel full-colour TFT display,
combination, opening the door to an amazing array of applications. and there’s 6 x GPIO pins available too. Programming is also made
familiar with the optional 4D-UPA programming adaptor, which
One of the great features of this amazing device is programming provides USB communication, and power.
flexibility. In order to make use of some advanced display features,
you’ll need to use their custom programming software (it’s free), Weighing in at just 5g, these tiny but powerful devices are going to
which is specifically designed to enable amazing graphics and make their mark with makers. They’re expected to be available this
leverage the hardware to its maximum potential. However, this month and you can find all the details at:
device can still be programmed in the standard Arduino IDE, which http://www.4dsystems.com.au/product/IoD-09 ■
makes it even more flexible with a familiar environment. The unit
also integrates a MicroSD card slot for storage of images and icons
too, so you don’t have to worry about storage limitations either.
Shopping List:
IoD-09TH are available directly from 4D Systems, or you local
4D Systems distributor.
4dsystems.com.au
VAPOUR
CAPER
DAWID VERWEY
Technician and passionate PIC programmer.
http://UCSi.com.au
@UCSInnovation
When we learned that Dawid created a very simple How did you learn about vapour phase ovens?
vapour phase oven, for use with his non-contact
soldering work, we couldn’t wait to take a look. I first learned about vapour phase ovens (VPO) in 2010, when I came
to Australia and started working at Fine-Tech. One of my colleagues,
Peter, had made his own VPO based on a design he had seen on the
internet a really long time ago. When I started my little business, he
Vapour phase technology is a powerful way to solder surface mount loaned his oven to me and I was immediately smitten. Previously, I’d
devices. By heating solder just above its melting point, there is a used a little bake-oven for soldering PCBs at home, but it was really
greatly reduced risk of component damage from excess heat, which painful. Peter offered to help me make my own (he’s got the coolest
you may get from soldering. shed you’ve ever seen) and thus, my little oven was born. So this is
basically version 2 of the oven; the only upgrade made from Peter’s
WARNING: Dawid's oven uses electricity and liquids at very high one, is the use of a more sturdy, slightly bigger chamber. His oven is
temperatures. It has no brain, so please use your own. made from a rectangular olive oil tin, so mine can do slightly bigger
boards and would, hopefully, last longer. That said, his has been
going for more than a decade, so longevity is clearly not a problem!
Yes, there’s clearly no planned obsolescence there! Your oven lid, and wait for the solder-paste to turn shiny. Then I give it another
seems very functional - how are you heating the Galden? minute or so, just to be sure. Due to the nature of the process, you’ll
be hard-pressed to burn or damage a board unless you leave it in
The heat comes from a cheap 500W halogen lamp. The glass cover the oven for a very long time. Lately, I’ve been running a 10-minute
was removed and the light is bolted facing upwards, to direct as cycle by default, and that works fine, regardless of the other factors.
much heat as possible at the base of the chamber. The Galden is
only about 8mm deep, so it is very important to ensure that the 10 minutes - that’s less time than trying to solder by hand! Have you
chamber is sitting level to avoid hot spots. Note: If you do decide to considered automating the PCB lowering/removal process, or is it
build one of these, I suggest grabbing a handful of spare globes, as too much complexity for such a simple process?
these are a dying breed and I don’t know how long you’ll still be able
to get them. Considered – yes. Actually done something? It’s on the to-do
list! As you said, it’s a very simple process; however, I’m thinking
That’s about as simple as it gets! The Galden is expensive. Do you of automating it one day, just to make it a bit more convenient.
“use” much Galden in the process, or is it fully contained and re- Currently, the process is as follows:
used/re-cooled almost entirely?
• Load the boards on the tray and lower them into the chamber.
I’ve been using my oven for about eight months now. I started with
300g of Galden and I’ve lost about 10g. My losses would probably • Turn on the lamp and set your phone timer for 10 minutes.
have been less if I’d not been so slack and taken the Galden out
after use. • After 10 minutes, turn off the lamp, raise the boards to the top
of the chamber and wait two to three minutes for the Galden to
The chamber of my oven doesn’t seal perfectly, so the Galden does condense and for the boards to cool down. Due to the low mass of
evaporate over time. The best thing to do is to wait until everything the chamber, there is a huge temperature difference between the
has cooled down, and then move the Galden to a sealed container; I bottom and top of the chamber.
actually use a syringe to suck up every last drop! Just don’t do what
I’ve done and leave it sitting in the chamber for weeks at a time! Automating this should be really easy, but if it ain’t broke…
Even losing a few grams in that period would hurt! Did it require any That’s true... it could take many hours to finesse a basic automatic
trial and error, or did it work first-go? system, when it’s not really necessary. Any tips for someone who
would like to build their own?
I did have to experiment a bit to find what works best for my oven.
As the temperature is set by the Galden and the power is fixed, the Most of the parts I used, I picked up from my local Bunnings, so no
only variable under user control is time. The size of the chamber, the great challenges there. The acrylic lid was laser cut by my mate,
mass of the boards in the oven, and the ambient temperature will but you should come pretty close with a drill and some careful
determine how long it takes to bring the Galden to a boil. I use 230 measuring. The hard part is getting hold of a small quantity of
degree celsius Galden, as it is suitable for use with both lead and Galden – I need about 300g for my oven but I bought 500g, just to
lead-free solder paste. I just keep an eye on the board through the have a bit spare. The going rate for Galden is about $1500 for ››
Dawid is used to
vapour-phase technology as he uses it in his workplace
at Fine-tech Electronic Solutions: www.finetech.com.au
As boring as it may seem, the printing of the paste onto a The PCB tray is suspended about 15mm above the bottom
board during production is one of the most critical factors in of the chamber and 5mm to 7mm above the surface of the
determining the quality of your final product. Too much paste Galden. I use the screws (in the tray) as supports when
or bad alignment may result in short circuits; alternatively, loading double-sided boards.
not enough paste and you end up with dry joints. In the
production environment, stencil design is a fine art. I ordered
this small stainless steel stencil with my PCBs, and the PCB
manufacturer set up the array for me and designed the
stencil from my Gerbers. It didn’t cost much and it’s really
convenient. Some PCB manufacturers even offer a service
where you can have multiple PCB designs in one panel, so
if you order a stencil to suit, you can cover multiple designs
with the same stencil. Another option is to use a syringe to
dispense paste onto the board, which I do on my little LED
boards; but it does take time and practice to get it right.
The final product. You may see that the parts have drifted.
This is due to poor PCB layout on my side. The molten solder
tends to go towards the holes and pulls the components with
it. Lucky for me, the boards still work fine, so I don’t have to
discard my PCBs. Some of us need to make the mistakes for The PCB tray slides The complete oven
others to learn from! on two linear bearings. on its base.
Dawid's Ecto at Brickalaide 2017. 3 x PIC12F675s driving 44 LEDs in the Ecto and traffic light combined.
Watch the video on facebook: @UCSInnovation.
›› 5kg, and that’s the minimum quantity you can buy. You can either Sounds like it adds some valuable robustness to the process. If you
persuade your friends to share the costs with you, or, if you have were to start over and make a second one, would you change your
the means, buy a jar and sell the rest in small quantities online as a approach using the knowledge you have now?
service to the community.
As I said, this is already version two. I do plan on adding some
I’m sure there’s someone doing just that! What’s the coolest project latches to the lid to get a better seal. For version three, I may look at
you’ve used your VPO to solder? automating it, but that’s very far down on the list.
I used my VPO to build the controllers and LED boards that went into Awesome. Is there another cool project you’re working on right
my LEGO Ghostbusters Ecto for Brickalaide this year (Brickalaide is now?
Adelaide’s big LEGO show, held annually at Easter time). I watched
YouTube clips to get the flashing sequences exactly correct; and I’m preparing for the Adelaide Makerfaire in November, so the little
28 LEDs were driven from two 8-pin PIC12F675’s. I’ll have to work oven will be running hard, doing production on the first batch of my
really hard to think of something cooler for next year’s Lego show. new LED controller. It is 30mm x 20mm, runs off a single CR2032
and drives 6 LEDs. So far I have created flashing sequences for
We’ll be keeping an eye out to see what you come up with! Are there police cars and fire trucks, as well as a flickering flame effect. Each
any circumstances when you think a traditional iron would be better board comes with five different user-selectable programs, and I still
suited than the VPO when using SMD? Or is the VPO really the way have a few other ideas I want to try out; writing the software is my
to go? favourite part. Before the launch, I also need to design and build
a display, write an instruction manual (my least favourite bit), and
This little VPO uses exactly the same technology as what the big, design the packaging. I plan on having my little oven and some of
industrial ovens use, so this is not a toy. It is ideal for volume work my production equipment at the Makerfaire for a bit of show and
or for soldering fine pitch parts or parts with big ground pads. tell, for folks who are interested, so do pop in and say hi!
For Brickalaide I made 80 badge light boards. These have nine
0603 LEDs on the one side, and the PIC, battery holder, switches, We’re sure some of our readers will do just that! Thanks for talking
caps and resistors on the other side. Yes, it took me a few nights us through your vapour phase oven, and thanks for the very
and weekends to get them done, but it was still heaps faster than entertaining pics! ■
doing them one joint at a time; and the quality is superb. That said,
I still needed my irons (two is way better than one – trust me!) to WANT MORE?
do rework on the odd tombstone. I have also found that the LEDs For some info on Galden, or to discuss this feature, visit:
in particular, are very sensitive to overheating. None of them got https://diyode.io/004sxhy
damaged in the oven, but I did manage to melt a few with the irons,
simply because they are so tiny and you can struggle to make a
good thermal connection.
The Autonomous
Vehicle Conundrum
When I was younger, I watched Back To The Future; and it’s funny These days, the semi-successful footage that we see of car-sized
to think that back then we all believed it was somewhat realistic to drones taking to the skies, are far from uneventful. These test flights
have flying cars that were as stable and practical as the standard made by cutting-edge technologies, usually see a very prototype-style
four-wheeled variety. Likewise, many of our favourite Sci-Fi movies contraption, with a rather nervous looking pilot strapped to the top
featured spaceships that were held together with chewing gum of the device. They’re making the smoothest adjustments they can to
and duct-tape as they hurtled through space. And they’d wrangle keep things under control, utilising 100% of their attention and focus,
the steering of their million-tonne ship with the sweat and muscle yet they still struggle to keep things from crashing to the ground.
of a World War fighter pilot, as if it makes a difference, providing
sufficient distraction for us all to forget the obvious plot holes this Of course, it is fair to claim that this is a product of the technology
represents! One thing is for sure though, while we’re still struggling being in its infancy, and it’s to be expected while they figure out the
to take to the skies in daily life, humans are unlikely to seriously pilot systems and processes that will drive these things into the future;
these things once they exist. until they can reliably make them as simple to drive as a car.
But wait... driving a car is simple? Then why do over a million people THE HUMAN ELEMENT
all over the world, die on our roads, each and every year?
One aspect that challenges our thinking, is who’s making the
THE DANGER OF DISTRACTION decisions? As humans, we make all sorts of seemingly intelligent
decisions, which stem from a mix of biology and education. Our
It would be fairly safe to say that close to 100% of the fatalities due education tells us to drive on the correct side of the road, while
to vehicles worldwide were caused by humans. Perhaps the driver our biology would, if faced with the decision of hitting a person or
misread the road conditions, or the vehicle’s maintenance wasn’t a machine, create an almost involuntary and reactionary response,
kept up (such as bald tyres) causing increased stopping distance. steering us away from the person and into a machine.
Or perhaps the driver’s mobile phone rang. They know not to answer
the phone, but it distracted them for long enough to take their eyes So could a programmer ultimately have a say in who lives and who
off the road. Or maybe they simply left the parking brake off and it dies? When the machine is left with no alternative but to crash into
rolled away on its own, taking out an unsuspecting pedestrian. two people, how would it decide who lives and who dies? If it has
to decide between crashing into a wall or crashing into another
Every 25 seconds or so, somewhere in the world, someone dies in a car, how does it decide? Could the car ultimately sacrifice you, the
motor vehicle accident. occupant, rather than crashing through a crowded pathway?
It’s already said that the youngest generation will likely never learn I think the reality here is that, forgoing some sort of conspiracy,
to drive. As a parent myself, I take solace in the fact that this is likely it doesn’t matter. Consider that first and foremost, a self-driving
very true. The autonomy, convenience, and safety offered by a fleet car’s only task is to get you from A to B safely. Chances are it’s
of autonomous self-driving cars you can hail with an app on your not speeding, it’s driving to the weather conditions, and it’s not
phone, really is one of the best advances we can make, to ensuring distracted by constant phone alerts or the conversation inside the
our roads are less congested and safer for everyone in the future. car. The reality is, when faced with a challenging decision, the
It’s entirely possible that in a few generations’ time, we’ll look back outcome should yield the best result, but by design it should rarely
on this period of self-piloted vehicles on our roads, as one of the be faced with such decisions anyway.
most wild and crazy times in transportation history.
NEVER-ENDING IMPROVEMENT
Yet, as soon as a fatality happens involving a driverless car, the
world goes into a tailspin slamming the technology as unreliable and There are, of course, limitless scenarios we can conjure up
unsafe. Of course, it makes for attention-grabbing headlines in the regarding potential failure of the sensors: the computer could crash,
media, a chance for one company to advance ahead of another, but or the system could somehow turn against us. It’s easy when we
in reality it’s an almost insignificant blip in the statistics of human need to try and justify our superior driving skills, but the reality is
fatalities involving vehicles. It also plays to our thinking that perhaps, that machines are learning each and every day. Indeed machines
somehow, we’re not the bad driver that can cause these problems. can learn from each other’s mistakes too, something humans are
often reasonably poor at doing!
So why do many of us have a perception that a machine, specifically
built, with world-class sensors and more driving experience Personally, I can’t wait for machines to take over the driving. As
programmed into it than a veteran taxi driver, is somehow less safe much as I love to get behind the wheel, I’d much prefer to spend
than a human driver? We can easily paint a picture of an 18-year- the time doing something more interesting. A family road trip could
old, risk-taking, semi-distracted male driver, with a lead foot and an involve playing games with the kids in the backseat until we arrive
obsession with Facebook for comparison to see whether machine at our destination; to me that sounds much more fun than trying to
or human is more dangerous. But would that be fair? What about distribute snacks while keeping a steady eye on the road.
a 30-something mum taking her kids to school, obeying all the
road rules and driving at five-below the speed limit? The reality is, When it comes to autonomous vehicles, I believe the future is bright,
regardless of our default personality and vigilance behind the wheel, and personally I’ll be there ready and waiting to sign up for the first
we’re all easily distracted sometimes - be it by the news on the radio, autonomous option that will inevitably take to our roads soon. What
the kids arguing in the back seat, or daydreaming about the weekend about you? ■
while sitting in traffic on a Friday afternoon. Humans aren’t designed
to drive, we’re designed to walk. So why not leave it to the machines? GOT SOMETHING TO SAY?
To discuss this edition of Moonshots, visit:
https://diyode.io/004xjvq
Featured builds are also in the running for the $250 prize
for Editor's Favourite - we'll pick one each issue!
KEEPING IT
MORE REGULAR
MORE POWER! to the nominal value of 2.5V above output voltage for standard
regulators (the 7.4V is nominal and is usually slightly higher when
One of the challenges of both the 78XX series, and the low-dropout charged), leaving only the more expensive low-dropout types. In this
regulators presented above, is that they only have a current rating case, the answer comes from a more recent switch mode power
of 1A (over which, they will self-limit the current.) This is not a big supply (SMPS), or switching regulator. The SMPS device uses a
drama for a typical logic circuit, but is a challenge for anything tiny coil to store energy when turned on and release that energy to
driving light arrays, motors, actuators, and often much more. In increase the overall voltage out. SMPS devices switch on and off
such cases, there is a way to boost the current capacity of these very fast as high speed allows them to use a smaller coil. SMPS can
devices. The manufacturer’s datasheets from several suppliers run between 20,000 and 50,000 cycles per second depending on
list a similar circuit that has been commonly used for a long time. the design. At high frequency, smaller copper windings are required,
This involves the regulator being attached to the base of a power enabling tiny transformers to be used. SMPS can be designed to
transistor, which handles the high current as the series pass step-down the voltage (Buck mode) or step-up the voltage (Boost
element, while staying regulated by the regulator IC. mode). Switchmode circuits can also be designed to increase or
decrease voltage, Buck/Boost mode.
The circuit diagram [2] shows this (note: variations on this
circuit exist and work fairly well). The choice of power transistor One such device from Jaycar is the XC4512 5V DC-to-DC converter.
determines the current that can be passed and, in turn, this would This takes a voltage from 2.5V to 5V, and steps it up to a regulated
rely on appropriate heat sinking. 5V DC. The current rating is stated in the datasheet as 500mA. This
device is a small board, the size of many USB flash drives, and has
a USB socket for the output, being aimed directly at microcontroller
2
Vin MJE2955 boards.
+
1µF Another Jaycar product is the XC4609 DC-DC Boost module. This
is a larger module with voltage display that can take an input from
Vin Out Out 3.5V to 35V and give an output between 5V and 56V, at a current of
3R REGULATOR
+ + 2A. Altronics are also at the party, with the Z6334 DC-DC Converter
10µF 1µF 1µF Module being an adjustable switchmode supply, with input ranging
from 3.5V to 35V and output from 5V to 25V. Also in the line-up
0V is the Z6339 DFRobot Boost module, taking two AA batteries and
yielding 5V, and the Z6337 DC-DC Boost/Buck module, which can be
configured to increase or reduce voltage at currents up to 1A.
One limitation of a circuit such as this comes from the fact that
breadboards are not well suited to large component legs (even the Of course, there are many other products available from online
TO220 package can stretch some breadboard springs and result in retailers; however, examples of these were not obtained. If in doubt,
inadequate contact when used with fine resistor legs). Also, larger ask for datasheets, as these always contain the required information
packages such as the TO3P don’t fit at all. In addition, breadboards and more.
are not rated for very high currents, and 4A would be too much for
many. Hopefully this article has helped you understand that the supply
voltage does not have to be limited to 5V from a USB port, and that
Fortunately, there is a solution. Both Altronics and Jaycar supplying high power projects with a regulated supply rail does not
Electronics sell kits based on a low-voltage adjustable regulator, need to be difficult or expensive. Likewise, lightweight, portable
such as the LM317, which includes a circuit board, all required projects can be powered from single-cell battery supplies while still
components, and instructions. These kits will, with added heat powering logic circuits. ■
sinking, supply a voltage between 3V and 15V at a current of up
to 4A. The kit has provision for fitting with screw terminals instead NEXT MONTH:
of the supplied PC stakes, so you could use fine wire to supply RELAYS AND SOLENOIDS
the logic on your breadboard and thicker wire to supply the high- We will return to a circuit building block that works in its own right
current-driven load. but can be adapted or expanded. Remember, this is your space, so
please keep the suggestions coming regarding what you want to
GOING UP! read about.
All of this is well and good if you need to reduce a supply voltage, GOT SOMETHING TO SAY?
but what if you want to run your 5V device from a 3.7V lithium To discuss this edition of Fundamentals, visit:
polymer battery? Sure you could put two in series for 7.4V and use https://diyode.io/004gnzq
a linear regulator, but this is inefficient on battery and far too close
3D
Print
Server:
Easy As Pi!
Make 3D printing easy and autonomous
with this ultra small Raspberry Pi based
print server. - by Oliver Higgins
The next issue that we face is checking on the print. We must admit
that since we have been using the Lulzbot printers we have been
much less paranoid, but I think we all like to keep an eye on our
print; just to make sure it’s progressing as planned. But what do you
do if the printer is in a different room or part of the workshop, or if
you have a print that may take several hours?
THE SOLUTION
We have two issues, and we can solve them in many ways. The
first issue is that of the required resources to control the printing.
The actual printing process itself does not require any significant
overhead; instead, it is the slicing process that will bog down a
machine. However, you don’t want to tie up a machine. You could
easily shut down your printing software by accident, or overlay the
machine with another process that you or someone else may be
undertaking. Considering many printers can be run using an Arduino
Mega, we can easily delegate this task to a Raspberry Pi. As a
bonus, the Pi includes additional storage, network connectivity and
of course Linux, which means we can run web server software.
This assumes you have a working 3D printer too! You will also need
an LCD screen and a keyboard in order to complete this setup on the
Raspberry Pi. ››
›› THE CODE / SETUP / OTHER Download the latest version of Octopi: https://octopi.octoprint.org/
Most workflows in this space go model, slice, GCODE then print. If Prepare the SD and upload the Octopi image.
you are using Cura and your printer is connected to the server or PC
then the slice, GCODE, the print is done in one step. Both are then For Windows users: Win32 Disk Imager:
followed by walking and looking at the print, and then walking back https://sourceforge.net/projects/win32diskimager/
a few minutes later.
For Mac user’s we would recommend using Etcher:
To address the above problems, we plan to use the Raspberry Pi and https://etcher.io/
set up a print server, which will allow us to set and forget. Of course,
we are not the first to have these issues, and as such one group If you are using WiFi to connect, you will need to setup the SSID and
have already built a specific operating system for the RPi, and that passwords (skip this if you plan to use ethernet). Once you have
is Octopi. imaged your SD card, navigate to the card in your operating system
and locate the octopi-network.txt file located in the SD card’s root
Here at the DIYODE workshop, we use the Lulzbot TAZ 6 and Mini. directory.
As such this article uses some resources that are specific to these
printers; however, there are many cases for RPi use in Thingiverse
that may exactly fit your printer. ##WPA/WPA2 secured
#iface wlan0 inte manual
Octopi is an open source RPi-based implementation of the Octoprint # wpa-ssid “put said here”
3D print server environment. It offers full and remote monitoring # spa-psk “put password here”
of every aspect of 3D printing, and considerable extensibility well
beyond this article through its plugin system. Best of all though, it’s
100% open source, the degree of detail that it offers is unparalleled, and change this to:
and it is setup in just a matter of minutes.
##WPA/WPA2 secured
Setting up is quite straight forward, although, if you have not
installed or set up a RPi before we would recommend you explore iface wlan0 inte manual
and install NOOBS. To make the system run as efficiently as possible wpa-ssid “AWESOME_NETWORK”
to auto, with 1-13 being available for use. There are documented • Name
issues with the RPi not working with 12 and 13, so if you have • Model
manually changed the channel on your router, you will need to make • Bed shape (rectangular or circular)
sure it is not 12 or 13. • Origin point
• Volume (print bed dimensions)
BOOT IT. • Is the bed heated?
• Nozzle diameter
Eject the SD card from your computer and insert into the RPi. • Number of extruders
Connect a keyboard and screen, connect the power supply and
boot.
Once the system has booted, log into your RPI using the default
User: pi, Password: raspberry. Run the following command:
If you are using the Raspberry Pi camera, select option 5 and the
option P1, then enable. On a personal note, we also like to enable
SSH here (option P2), to enable remote access via the terminal.
When finished, select “Finish” then reboot. The RPi will reboot and
will display the RPi.
Finally, elect “auto” to connect at login, and you have a wireless
Connect to RPi via browser and connect to octopi.local or the IP print server for your 3D printer! If you have not connected your RPi
address that is listed on boot. camera module or USB webcam, connect and you will then have a
live stream on the control tab. The default RPi camera cable is quite
Once you are connected to the RPi you will be greeted by the short, so we would recommend getting a longer one (100, 200 and
“Configure Access Control” page. Enter a username and password 300mm are available).
and then select the “Keep Access Control Enabled” button on the
bottom right. NEW WORKFLOW
The upper left corner contains the printer control area. When logged
in you will be able to connect to your printer. It usually takes a few
moments to establish a connection and communicate with your ››
Finally the “time-lapse” tab – now this is fun! You can set up the
system to record your prints and create a video file, which can be
used to access your print process or show it off on YouTube.
From here you are done, but that is not where the fun ends! If you
have connected and enabled the RPi camera then click on the
“control” tab and you will get a live stream of your print.
Finally, you can see the current status at any time, on the left side.
This shows the current percentage printed, elapsed time and
remaining time to finish. We can now design, print and view the
entire process without ever leaving our desks, enabling us only to
have to get up when the job is done. For some of us, that means
saving precious time, every day!
Clicking on the GCODE tab will show you the current GCODE output
and a visual representation of where the print is. WHERE TO FROM HERE?
This has just given a taster of what the Octopi system is capable of.
Dive into the plugins, set up a live stream to the internet, install a
desktop environment and connect with VNC. There is a lot more fun
to be had! ■
WANT MORE?
For additional screenshots, 3D printer files and more,
or to discuss this project, visit:
https://diyode.io/004jrkn
The “terminal” tab will give the current GCODE code that is being
executed.
AIRBLOCK MODULAR
PROGRAMMABLE
DRONE KIT
A 7-piece modular drone that can be turned into a hovercraft,
car, spider and more! It is made of light but durable plastic foam
so you can bump into walls without making dents. Control it from
your Smartphone or iPad via Bluetooth using a freely available
iOS or Android app. Control and program your aerial stunts
$
299
through the Scratch 2.0 inspired mBlock app. Ages 8+.
• Watch the amazing videos on our website
KR-9220
Tablet not included
$ 4495 $ 9995
PC PROGRAMMABLE LINE TRACER KIT MEET EDISON ROBOT KIT
Assemble the kit and you are able to use it in line tracing mode A pre-assembled robot, pre-programmed with 6 robot activities set by
or program using the supplied software. Ages 12+. KJ-8906 barcodes. Can be programmed using simple drag-and-drop programming
blocks or a Python-like written language. Ages 5+. KR-9210
Sensory
Development
MILES HITCHEN
Software engineer, electronics hobbyist,
doting godfather and all round good egg!
Miles has a godson named Eiden who sound effects, and reward animations.
has a developmental delay, so he put his Eiden has very specific visual and auditory
software development skills to fantastic use issues; he is sensitive to certain sounds
by building a sensory game. We were blown that lead to changes in his behaviour, so
away by the creativity of the project, and for one requirement was to use sounds that
such a worthwhile cause; so we caught up excite and motivate him. Another was to
with Miles to learn all about it. ensure any buttons used did not have too
much resistance or require too much effort
Creating a sensory device for your godson to press, to cater to Eiden’s hyperflexible
sounds like an awesome project. Were joints.
you asked by his parents to assist, or did it
come about some other way? Do you have any specific skills relating to
special needs/developmental delays, and/ help enhance his developmental progress.
Sensory toys are very expensive and bulky, or did you undertake any research? The aim of this toy was for it to grow with
and many involve lights and sound but his mental development.
very few actually provide a game or require Other than being involved in Eiden’s
problem solving skills. Sasha - Eiden’s play for six years, and having a good How was the device received by Eiden?
mum - told me about visiting a sensory understanding of his individual preferences,
play area where Eiden had shown a lot of I don’t have any specific skills or training Right from the start, he was very interested
interest in a particular game. It was very related to special needs. I worked with in it due to its large colourful buttons. He
large (roughly 5ft high x 3ft wide) and had Sasha who helped provide me with some knows buttons can do exciting things when
a little bit of functionality. So I suggested specifications, based on knowledge of his they’re pressed so it captured his attention,
I could probably make something of a medical condition, research she had done even before it was switched on. It took him
more appropriate size, and add in lots of into what’s available on the market, and we a couple of minutes to find a comfortable
functionality, such as progressive levels, identified changes in the game that could position in which to play with it, but once
he did he loved it. He was giggling at the It sure does make prototyping easier. Can
sounds the buttons made, and the reward you explain how the game itself functions
animations, which he understood occur (i.e. input versus output)?
when he’s solved the puzzle. Sasha took
the lead in helping him initially, to play the The game has a 4x5 matrix of LEDs that are
game. We watched him evolve from just individually boxed and covered with opaque
randomly pushing the buttons, to eventually plastic to diffuse the light. Each LED can
making specific button presses based on be one of four colours: red, green, blue or
what was happening in the game. This was yellow. Under the LED matrix are four large
proof that he was learning to understand backlit buttons, with the same colours.
the association between action and reward. The game has five selectable levels and
progresses automatically as each level is
Working with Veroboard can be a challenge completed.
- did you encounter any?
The basic idea is that at the start of the
Yes, there was definitely a challenge during game, some or all of the LEDs will be lit and
circuit development. I was originally going depending on which colours are displayed,
to use perfboard (with individual solder the appropriate large button will also be lit.
pads) and just do point-to-point wiring, but As the player pushes one of the lit buttons,
after realising how many wires I’d need to a distinct sound effect (associated with that
solder I decided to go with stripboard, which button) is played and an LED of that same
I’d not used before. The main challenge colour is switched off in the matrix. When
was working out the layout of parts, and there are no more LEDs of a specific colour,
ensuring they could be connected either then the correspondingly coloured button’s
The completed sensory device. via the actual copper strips or by wiring on backlight is switched off, and that ››
▲ ABOVE
The original breadboard prototype.
◄ LEFT (INSET)
›› button no longer has any effect. When all the LEDs in the matrix The veroboard evolution of the
prototype, which also uses a DIP
have been switched off a short animation is displayed, which uses ATMEGA328P
the matrix of LEDs and a longer sound effect. The animation played
is randomly selected from four that have been programmed. The
matrix is then relit, and the player’s level is increased.
So, for Level 1 there are five random LEDs in the matrix and they
are lit in a single colour (randomly chosen from red, green, blue or
Eiden has very
yellow), and the large button of the same colour is also backlit. specific visual and
For Level 2, 10 LEDs are lit in two randomly chosen colours (five
auditory issues; he is
LEDs in each colour), and the associated buttons are backlit. sensitive to certain
For Levels 3 and 4, the number of LEDs is increased to 15 and 20
sounds that lead
respectively, and the number of colours used also increases to 3 to changes in his
and 4.
behaviour....
Level 5 is slightly different as all 20 LEDs are lit in randomly selected
numbers and colours (e.g. there could be 3 red LEDs, 6 blue LEDs,
10 green LEDs and 1 yellow LEDs; or there could be 14 yellow LEDs
and 6 red LEDs).
Planning out the construction. Bottom-up view. Mounted veroboard and power supply.
That’s awesome. We’ve uploaded the video you provided to the There are quite a few things I would change; mostly around the
online article too, so everyone can see exactly how this works. Has design of the case. I’d also change the circuit slightly, as I’m not
this inspired any other projects that provide a similar benefits or currently limiting the current on the input pins of the processor. I
outcomes for someone with developmental challenges? could also reduce the number of connections to ground for the level
switch. And I’d change the way I’ve connected the power switch
I’ve actually, literally, just finished this project, so I don’t think it has up to the circuit board - just to simplify things. I’d also change the
had chance to inspire anyone to build anything else yet. But there way I’ve wired up the big button switches as the current method
has been a lot of interest on special needs forums and Facebook, is complicated and makes swapping any of them out, almost
with over 400 likes already! I’ve also had many requests for the toy impossible.
by other parents of special needs children, and the special needs
school that Eiden attends also expressed an interest in using it. It sounds like it’s been a huge success the way it is though. What
other amazing creations might you be working on next?
We’re sure every parent with a child who has special needs would
be keen on something that may assist with their development Eiden’s school use object and picture exchange communication, so
and provide some fun along the way! Were there any unexpected to make something that could help reinforce this or even replace it,
challenges developing this project? is something I’m currently thinking about.
The first one I came across was how to wire up the five-way slide That’s fantastic, Miles. This project is such an exceptional use of
switch. As I’d not used one before, I initially thought that opposing your skills. Thanks for taking us through your project. ■
pairs of pins would be connected as the switch was moved; but
it was slightly more complicated than that, and so ended up WANT MORE?
taking a while to determine the correct way to the wire them. I For video and more images, or to discuss this feature, visit:
knew designing an accessible case (i.e. accessible to me so that https://diyode.io/004mdyq
I could access the circuitboard and wiring) would be a challenge,
and although I’ve made the circuitboard accessible, it’s still quite
tedious. As much thought needs to be put into the case design, as
the original circuit layout and programming. Luckily, I have a 3D
printer so that was put to good use making various fixings. I also
used it to make the boxes surrounding each of the LEDs. I work as a
software engineer, but I did find the programming of the game quite
challenging - though it was a challenge that I enjoyed! Reading & Resources:
There’s nothing quite like a challenge with a positive outcome! ► ARDUINO www.arduino.cc
If you started it again from scratch, is there anything you would
change for the new version?
FUNCTIONS AND
MULTI-DIMENSIONAL
ARRAYS
Repetitive tasks can be made more
efficient, and you can handle data in a
convenient way. - by Oliver Higgins
In the world of programming, functions are one of the most valuable PSEUDO CODE:
tools you can use. In our ultimate quest to do as much as we can
with as little code as possible, the function is probably only second
to the loop, for the sheer number of lines it can save. void myFunction()
do something;
WHAT IS IT?
When writing code, we will often be faced with repetitive tasks, and ARDUINO:
while loops can serve a purpose, they are not always the right tool
for the job. The function is another tool in the arsenal; it is a simple
but elegant way to do a single thing. In best practice, you should void myFunction(){
the program and output a message. We will modify this to create the Serial.println(x);
HOW TO USE IT
PYTHON 3:
ARDUINO/C:
def myFunction(x):
void printHelloWorld(){ print(x)
Serial.println(“hello, world!"); return
}
void setup() {
Serial.begin(9600); MULTIPLE PARAMETERS
printHelloWorld();
} ARDUINO:
void loop() {
//not used
} void myFunction(int x, int y, int z){
Serial.println(x+y+z);
}
PYTHON 3:
PYTHON 3:
def printHelloWorld():
print(“Hello World”)
return def myFunction(x,y,z):
printHelloWorld() print(x + y + z)
return
You can see in this example that we put the function in the code
before we call it. Now most modern languages will work no matter RETURNING A VALUE
where you put it, but we have had experience with code that
compiles fine, yet the execution is erratic simply because functions Functions are great at doing simple repetitive code and having it in a
were out of sequence. single location, but one of the most powerful elements of functions
is to return a value to the user. As I’ve said, functions can accept
PASSING A VALUE OR VALUES multiple inputs but can only ever return one item. In very simple
terms we can input several integers and return the result of our
This is good for calling a simple function, but what if you frequently math as a single integer.
need to calculate something complex? We can send variables to the
function via parameters, and we can get the function to output a To instruct the function that will be returning something, we need to
variable of the final result. replace the void at the start of the function with the type of variable
we will be returning. In the following example we are going to return
Functions can only ever return one thing (I want to say only one an integer by specifying “int” at the beginning.
variable here, but arguably you could return an object or even a
dataset. The important thing to understand is that you can only ever ARDUINO: ››
return one of them).
Here is an example of a function that will take a single parameter; in int myFunction(int x){
MULTI-DIMENSIONAL ARRAYS
WORKING EXAMPLE
In Issue 3 we discussed the role that arrays play in the world of
This is a working example of a function that takes a single argument programming. We can extend the array functionality to create a
and then returns a value. In this case, we need to regularly calculate richer and more dynamic structure. We do this by creating a multi-
the circumference of a circle. The function takes one argument, dimensional array.
an integer “d”, which is the diameter. The function then calculates
and returns a float, calculating the circumference by multiplying d While an array has 1 dimension, an object with 2 or more
(diameter) with pi to 100 decimal places. In the case of the python dimensions is called a matrix. For the rest of this article we'll work
example, the variable types are defined by the compiler. with 2 dimensions only.
ARDUINO: Please note: in this article, we will focus on ANSI-C style syntax,
because Python 3 uses a different interpretation of its lists, and
does not directly correlate with the general interpretation and
float myPiFunction(int d){ syntax.
return d*3.14159265358979323846264338327950
2884197169399375105820974944592307816406286 The declaration is similar to a single dimension array; we simply
2089986280348253421170679; add a second square bracket with the number of elements required
} in the second dimension. The simplest way of thinking about the
void setup() { multi-dimensional array (i.e. matrix) is that it is an array of arrays;
Serial.begin(9600); although, it may be better to think of them as a matrix or grid. When
} we declare an array, we give it the total number of elements in both
void loop() { the X and Y dimensions.
Serial.println(myPiFunction(3));
delay(2000); To declare a multi-dimensional array we using the following code,
} which has three rows with each row having four columns.
NOTES ON FUNCTIONS
or
Most languages will allow you to place functions at any point
outside the main script or loop. However, it is best practice, and I
would strongly encourage you to place your functions above and int myArray[3][4] = {
before you use it, in a final sense. While you will not get a compile {0, 1, 2, 3} , //row indexed by 0
error, we have seen this be the cause for some strange issues, {4, 5, 6, 7} , //row indexed by 1
void setup() { Functions can call functions, and those functions can call functions,
Serial.begin(9600); so do not be afraid to break your code into atomic structures (an
} atomic structure is one that does a single job).
void loop() {
int a[5][2] = { {0,0}, {1,2}, {2,4}, This simple change to your coding habits will make code supervision
{3,6},{4,8}}; and bug tracking much faster and simpler. ■
int i, j;
for ( i = 0; i < 5; i++ ) { NEXT MONTH:
for ( j = 0; j < 2; j++ ) { MODULES AND LIBRARIES
Serial.print(“a[“+String(i)+”]”+”
[“+String(j)+”] “); GOT SOMETHING TO SAY?
Serial.println(a[i][j]); To discuss this edition of Secret Code, visit:
} https://diyode.io/004ymhw
}
delay(10000);
}
Emergency
Mobile Phone
Charger
What started as a quest to debunk a "lemons charging
phones" video, turned into something far more
practical. - by Rob Bell & Daniel Koch
When life gives you lemons, you make a... phone charger? WAIT -
that’s not how that goes..
The theory here is fairly straight forward, but still warranted some
investigation. The great thing about this exploration is that it yields
some experiments that are easily undertaken at home, which are
suitable for just about any age. We’ll admit too, we got a little ahead
of ourselves; on the surface, using these lemons like batteries we
should be able to stack a few together to get something useful.
In reality, getting power from a piece of fruit isn’t all that difficult.
The old potato clock experiment continues to be a staple in
electronics theory and experimentation. However, just because you
can run a small LCD from a single potato for a substantial amount of
time, doesn’t mean you can power substantial electronics.
›› EXPERIMENT 2. 10 LEMONS ROLL-FIRST: Lemons aren’t just a bag of juice. They have internal
membranes between each segment. Rolling them with a firm
Now we’ll use series wiring to try and boost voltage. This is really no pressure helps disrupt these internal membranes and provides
different to wiring batteries in series. better consistency in the resulting voltage and current output.
When you test the voltage of the bank, you should see approximately TEMPERATURE: Temperature plays a role in all electrical circuits -
10 times the voltage you measured in Experiment 1. For our lemons, even fruit-based ones.
this meant just under 5V. The problem is, there is barely 0.5mA
of current available. No, not 0.5A, 0.5mA... that’s about 1% of the SEASON: The season and ripeness of a fruit will change the
current available on an old-school USB port (or 0.2% of a higher electrolyte potency, and therefore the power available.
current USB port). This presents a massive problem; we simply don’t
have the power available. The potential simply isn’t there. However... none of these variables are going to provide enough of a
change to give us usable power to charge a battery with.
With 10 lemons we can illuminate a single, standard 5mm LED.
That’s hardly mind-blowing, working out to around 0.00085W of IT’S JUST NOT THERE...
power.
We could mess about with different configurations, track down
ARE THERE ANY VARIABLES? better electrodes to improve performance, but ultimately this
solution really just doesn’t provide enough electrical power to be
As with all electronics and experiments, there are variables. useful for phone charging. Based on the results of this experiment,
it would take thousands of lemons to create 500mA at 5V, which is
ELECTRODES: As with a battery, the surface area of the electrodes around the power you would need to see sensible charging rates
does make a difference. We saw a marked improvement in current for your phone. The videos reportedly achieving this using only a
available when using our oversized electrodes, with an increase handful of lemons are obviously fake; and that’s all there is to it.
in voltage per lemon, as well as an improvement in short circuit
current.
PARTS REQUIRED: JAYCAR ALTRONICS It’s entirely possible to use this unit without a case, but we want to
1 x 5VDC Boost Module XC4512 Z6366 make it into a finished unit that’s easy to use, and could sit packed
1 x 2xAA Battery Holder PH9202 S5025A into your emergency kit, glove compartment, or anywhere else.
2 x AA Lithium Batteries SB2355 S4906 Therefore, we have designed a 3D printable case to house the entire
1 x 75kΩ 0.5W Resistors RR0617 R7603 project, and you can find the STL file in the downloadable resources.
2 x 51kΩ 0.5W Resistor RR0613 R7599 We basically build the circuit into the case, so it's prudent to print it
1 x 43kΩ 0.5W Resistor RR0611 R7597 first.
1 x Slide Switch ST0300 S2010
2 x M2 Screws HP0390 H3100
1 x PCB Mount USB A Socket (optional) PS0916 P1300
1 x 3D Printable Case (optional) - -
BUILDING A PROTOTYPE
GND
IMPORTANT NOTE: It’s critically important that you measure
GND
the voltages on all pins of the USB port. While the 5VDC D+
you’re charging.
If you have a USB A socket, you can connect each of the pins to the
pins on your breadboard, and connect a USB charging cable to your The prototype is great to test the theory, but isn’t terribly useful past
phone. It’s easy to flip the connector and get your wiring backwards that point. Now that we know it’ll charge the phone, let’s make a
so be sure to check that you have things around the correct way. If real unit! Since, at the heart of this unit there are only four resistors,
your phone doesn’t show charging, check your voltages again, to we decided it’s best to just solder them to the base of the DC-DC
ensure you have the voltages on their respective data pins, and that converter, where the USB socket legs come through the PCB. This
you haven’t wired the USB connector upside down. means we don’t need a PCB, don’t have wires everywhere, and it
will keep it all neat and tidy. There is limited space under the USB
socket, so we decided it’s best to spread the connection points,
as this allows us to reduce the risk of resistor legs accidentally
shorting each other out. Once it’s completed and tested, we’ll coat
it in some superglue, liquid electrical tape, or some other method Mounting is fairly self-explanatory. Mount the battery holder with
to encapsulate what we’ve done, to reduce the likelihood of any double-sided tape (though it’s not really going anywhere). In order
shorting or problems down the road. You can see the diagram of the to make use of the switch, wire the positive lead from the battery
connections, as well as a photo of our prototype. holder through the switch, to the DC-DC module. Because everything
is in such close proximity, we didn’t have to use any additional wire,
Once everything is soldered up, it’s a good time to test things. we just used the excess from the battery terminal’s flylead. Then
Provide 3V to your DC-DC module (alligator clips and your battery wire the negative wire from the battery hold, directly to the DC-DC
holder will usually work just fine). You should see the on-board LED module.
illuminate to indicate power. Now, grab your multimeter and check
your voltages read as previously noted. If your module features NOTE: We realised after some frustrations that the silkscreen on the
an LED but it doesn’t illuminate, it could be a sign of a shorted under-side of our DC-DC module is backwards to what is marked on
connection. the top-side. Do your own investigation (even just trial and error) to
ensure your silkscreen is the correct way around, as we’re confident
If your voltages check out to be reasonably accurate (we’d say, some of you will have the same module as we do.
within about 0.1V of what we’ve described), then you should be safe
to connect your phone and see if it charges. Grab your favourite USB WHERE TO FROM HERE?
charging cable. Connect it to your phone, and the USB socket. You
should see your phone’s charging icon appear. If so, IT WORKS! Really, this is a complete unit, which is extremely simple to create.
It would be possible to integrate some battery monitoring, a torch,
or any other number of other features. For this purpose of providing
IMPORTANT NOTE: You’re connecting power to an
emergency power however, we really wanted to keep the design as
expensive, sensitive device. Be sure to check things first.
robust as possible. You could add a lemon-interface, but that’s just
Most phones are intelligent enough to prevent any major
crazy...!
issues, but don’t risk it. Double check the voltages on the
USB socket twice, then check them again.
It’s also important to remember that this is designed as an
emergency device. It’s simply not practical to try and charge your
phone from AA batteries all the time. The battery in your phone
It’s important to mention that if you’re using an old phone will leave a trail of AA batteries in its wake if you constantly try and
(good idea if you have access to one) that has been sitting in an recharge from them. But it should be enough to get your phone
discharged state for some time, it can take some time for the going in an emergency situation. ■
battery to have sufficient charge that the phone will turn on. Many
phones such as an iPhone show you that it’s charging at least, even WANT MORE?
while it’s switched off. But just keep this in mind, to save yourself For 3D print files, additional media, or to discuss this project, visit:
from chasing a problem that doesn’t exist. https://diyode.io/004fczg
RETRO TEMP
SASCHA GRANT
Avid weekend tech-explorer.
President of local makerspace M.E.S.H.
@sascha.grant
◄ LEFT
Prototyping the I discovered Nixie tubes a little over a
system. decade ago, and thought they were very
cool (that’s a cold-cathode joke!).
RIGHT ►
Sascha made a fantastic laser-cut
case to mount everything into.
◄ LEFT
The stunning warm glow of Nixie
Tubes.
Where did you get the Nixie tubes and driver from?
The Nixies and drivers actually came from the Ukraine via eBay.
There’s always a good selection of tubes available, and so far I
haven’t had any problems with postage; you just have to be patient spot-on with the comparisons I’ve done.
as international post from Europe can take a month or so!
Yes we’re getting used to displays not putting out much heat - that’s
Did it take much experimentation to get the prototype running? an interesting point! How is the whole unit powered, and what’s the
power consumption overall?
There were a few steps I went through in putting the prototype
together - I’d never dealt with the DS18B20 1-wire temperature A 9V 500mA power supply provides power to the high voltage circuit
sensor. I started by installing the Arduino library and playing with and the Arduino. I’ve found that the Nixie power supply produced
the demo code. Once I had the temperature displaying correctly in by LEDSales.com.au is stable and reliable. In fact, this is the same
the console, I moved to driving the Nixies. power supply that runs my original Nixie clock from 2006 - providing
more than 11 years of service!
First step there, was to get a single digit running; just ticking over
numbers sequentially, making sure that I had the Soviet K155ID1 The Nixie tubes run at approx 180V and around 2mA. The Arduino
Nixie driver IC wired correctly. Pro Micro that I’m using is 9V tolerant.
The prototype only ever got two digits installed, but from memory, I Not really much at all for something that looks so amazing! Your
had the prototype running correctly over a few evenings after work. laser cut case is great - what laser cutter are you using?
Are you using a DHT sensor, or something else for temperature I bought my laser back at the end of 2009, to support my Model
measurement? Rocketry hobby. I purchased it from WKLaser in China and learned
more about importing, customs, quarantine, duties and paperwork
I’m using the DS18B20 1-wire sensor in the TO-93 package, than I ever thought I would! But by importing it myself (with the help
which looks just like your garden-variety transistor. The original of a freight agent), I saved a substantial amount of money in the
intention was to have the sensor sitting just proud of the housing, process. The laser has a 60W CO2 water-cooled tube and a cutting
but I discovered that the heat generated in the case runs at about area of 400mm x 600mm. You can see photos of this on my flickr
five degrees above ambient, which meant I was getting incorrect stream.
readings. So I ended up moving the sensor about 10cm from the
case, by using a short length of ribbon cable that was covered in At least you’re putting it to good use! Did this project inspire any
heat-shrink tubing. Temperature readings are now pretty much other Nixie-based projects? ››
›› I’ve built a few Nixie projects prior. I have a “people counter” I’m currently focused on a Bartop Arcade Machine using a Raspberry
that’s still a work in progress. I’m the president of a maker space Pi and 10” display. I’m a bit of a retro gamer and have seen some
called MESH (Melbourne Eastern Suburbs Hackers), and I started absolutely fantastic looking machines on the internet. I’ve got all the
building this to take along to maker fares and events like the parts now sitting there, just waiting for me to dedicate some time to
Stringybark Festival (in the Knox Council area), for people to interact start.
with. Like many projects though, I’m still tinkering away on it!
Sounds awesome - we can’t wait to hear about it in the future! ■
We often have as many projects on the go as we have completed!
If you had your time again, what would you differently for a V2.0 of GOT SOMETHING TO SAY?
this project? To discuss this feature, visit:
https://diyode.io/004cyww
Oh, that’s easy! Nixie tubes have a finite lifespan and
there are some techniques used to maximise their life.
So the first thing I’d do for version 2 would be to add
an ambient light sensor, which would automatically
dim the Nixies when the light in the room drops, and
I’d add a “slot machine” type effect to cycle through all
the digits every few minutes.
ABOVE RIGHT ►
The display is bold,
sure to capture attention.
BELOW RIGHT ►
The full harness before
it was mounted into the case.
$ 1895
$ 3995
$1995
$1995
HOLD IT! FROM
Sturdy PCB holder.
Holds PCBs up to 200(L)
x 140(W)mm. TH-1980
$1395
MEASURE UP
$ 59 95 Calipers with LCD and
etched vernier scale.
150mm range.
BUDGET TD-2081 $13.95
FOR THE HOBBYIST PROFESSIONAL
STAINLESS STEEL
$1395
40W Temperature Controlled Soldering TD-2082 $39.95
Station. Up to 450°C. TS-1620
ANTI-STATIC
Adjustable wrist
STARTER BUNDLE
DMM, 25W iron, solder,
$ 39 95 strap. 1.8m coiled
lead with banana
de-soldering tool, and much plug/alligator clip.
more. TS-1652 TH-1780
6
$ 95 $
16 95
ea 9
$ 95 $
12 95
Coping With
Capacitors
Storing electrical charge, a little like air in a
tyre. Capacitors are valuable components,
and easy to understand. - by Daniel Koch
LOW HIGH
AI E
RP
RESSUR
1 CAPACITORS
For now you can imagine a capacitor as two metal plates separated
by an air gap, and for some capacitors this is true. In fact, old valve
radios, and even transistor radios used a capacitor to tune the radio
stations that was made from one set of fixed metal plates, and
another set of moving metal plates, separated by nothing but air.
The two construction methods each have pros and cons, but for
average users, there is no difference in the effect. Do note however,
To understand capacitance, consider two metal plates separated by that some are better for high frequency, others for low leakage,
an air gap [1]. When the DC power source is applied, electrons flow some for higher voltage and others for higher capacitance.
from the negative side of the supply to the plate they are connected
to, causing that plate to have a negative charge. To the casual observer, they have a similar physical layout, being
somewhat flat and broad in one plane and quite narrow in another
The electrons at that plate repel the electrons on the other plate, [2]. Capacitor types use a variety of dielectrics, from ceramic, mica
which are drawn to the positive side of the battery. Therefore, (a mineral insulator), and of course, polyester. In most cases they
current flows for as long as electrons are on the move, from the are named after the dielectric they use. It should be noted that
positive plate to the negative plate of the battery. This is referred these types of capacitors are all non-polarised. That is, they can be
to as the “charging current”. Most makers typically encounter this connected with negative or positive connections either way around,
term and its associated maths when calculating timing circuits. and will work the same way. Additionally, these types are usually ››
USING CAPACITORS
Capacitors in common use range from less than ten milliFarads, still
referred to as 10,000µF, down to 1 picoFarad, or 1e-12 Farads [5]!
Yes, truly tiny numbers! For this reason, decimal dividers must be
used.
NUMBER OF DECIMAL
PLACES FOR SINGLE FRACTION
WRITTEN AS VALUE IN FARADS SIGNIFICANT FIGURE SCIENTIFIC NOTATION
WHEN EXPRESSED IN OF ONE FARAD
PICOFARADS
FARADS F 1 0 NA 1
**millifarads are not commonly used, they are included for the sake of completion and clarity of sequence.
Note: All references to pF, picofarad, nF, nanofarad, µF, microfarad, etc should use a capitol F in Farad.
Micro (u) should be represented by a ‘µ’ (Greek ‘mu’).
(pF)’. The value will generally consist of three numbers, a letter, and
a voltage rating in some cases. Some other capacitors only display
the three-number value. As with resistors, capacitors are made in a
First Significant
Figure 471J Tolerance
Voltage
set range of values, such as the e12, e24, e46 series. So, you could
Second Significant Multiplier
purchase a ceramic disc capacitor in 4.7pf, 47pf, 470pf, and so Figure (Number of
forth, but you are unlikely to find a 44.3pf capacitor. zeros following
significant figures)
To read the codes, the first two numbers are the significant figures,
while the third is the number of zeros used to give the value in
picofarads. Therefore, a 470pf capacitor would have a value
stamp reading “471”. This is significant figure “4”, significant
figure “7”, with the “1” corresponding to one multiple of ten, or
one zero, following. Unfortunately – and very confusingly – some
manufacturers use the “0” when there is no multiple; so 47pf can
be stamped as “470”. This does exist but is not common; in fact, in This is a tolerance designator. All components are manufactured
14 years of selling electronic components, I only saw this a handful to a tolerance, which means the value can be over or under the
of times. rated value by a percentage. The codes are generally the same as
for resistors. Additionally, some capacitors have a voltage rating
A hint: Whether Resistors, Capacitors or Inductors, the exponential stamped on them. This is usually directly stamped, with no coding
function of the calculator is a great tool for beginners. The 471 or multiple system. Some polyester capacitors, for example, have
above would be typed in as 47 [exp] 1 [enter]. Try it! Also for various “100V” on them, which literally means they are rated to 100 volts.
other notations such as 333, 684, or a common group, 102, 103,
104 etc. For resistors, once you can translate the colours into For larger capacitors, usually electrolytic capacitors, the value is
numbers, you can also enter them straight into the calculator directly stamped. In most cases the value is in microFarads (µF).
until you learn what each colour code means. Brown, Black, The “u” in this abbreviation is actually the Greek letter “mu”, which
Black,Orange? Go on try it.) has a longer tail on the left side extending down (μ), but many
standard printing fonts do not cope with this. So even though 4.7
Generally, a value of 47pF would be stamped as “47” and all millifarads is a real value, it will be written as 4700 microfarads,
higher values will be three digits. The codes work the same way on or 4700µF. This has led to the tendency for most users to talk in
ceramic, MKT, greencap, and polyester capacitors [5]. Greencaps microFarads instead of milliFarads. So, numbers of ten thousand
are a form of polyester capacitor; however, there are others. microFarads are heard commonly, despite this being more
mathematically correct when stated as ten milliFarads. ››
On some capacitors, particularly greencaps, a letter may be found.
›› As with resistors, some manufacturers prefer to avoid decimal capacitors across a power supply rail can help with stability and the
points, so you may see a value of 3.3µF stamped as 3u3, or even reduction of electronic noise.
3µF3 [6].
SOME QUICK MATHS
6 100
90
80
BR ND 100°C
BRAND BRAND 100°C BRAN
AND 10°
0°
0°C 70
470
00µF
0 4700µF 4700
0µF
60
Voltage
25V
25V 25V 25V
50
40
30
20
10
Negative Terminal Indicator
0
Time (No Units)
The second piece of information on an electrolytic capacitor is its Current
A curious property of electrolytics is that they only begin to show a When working in series, the total combined capacitance is actually
curve in their charging current when operating closer to their design lower than the smallest capacitor in the series [8]. The advantage
voltage. If used well below this, they may not respond as expected. to this is that the total potential difference that can exist across
This has implications in timing applications as discussed ahead. A the combined chain, is the sum the voltage ratings of the individual
10µF 63V electrolytic may give a different timing result than a 10µF capacitors. So three 100pF, 100V greencaps in series now yield
Resistor
16V example when used on a 12V circuit. a capacitance of 33.3pF, but can withstand 300V. The increase in
voltage is the main reason for adding capacitors in series.
Electrolytic Capacitors also have a temperature rating. Mostly for
higher power applications but essential knowledge if you are to
repair a circuit such as a power supply, particularly a SMPS. Often
such power supplies use a 105° component, and when it fails, it
should be replaced with a 105° component. A power supply or
7
amplifier that has used an 85° component to replace the original
105° value, will continue to fail, periodically, until the correct
temperature rating is used.
90%
That’s all for now. However, on the next few pages we have included
additional information, which may be of further interest, including a
80%
section specifically for educators. ■
70%
60%
To discuss this edition of The Classroom, visit:
50%
https://diyode.io/004ymwg
40%
30%
20%
10%
0 1 2 3 4 5
Time Constants
Charge
Discharge
For The
Educators:
For educators, metalanguage is a central part of learning in any For high school teachers, the challenge is greater. Older students
subject. These terms are all subject-specific, and important to find such activities childish (although it is amazing how much we
students learning the field, as the words all have defined, often- love them again at university), and often have no regular classroom
used meanings; understanding of which, is vital for success. for a given topic. In discussion with a high school teacher friend of
mine, we adapted some of my primary school ideas for his robotics
Science is no different, whether being taught at kindergarten level lessons in science class. This discussion eventually involved the
or senior high school. What sets science apart, however, is the sheer whole science faculty, along with myself – a ring-in primary teacher!
volume of metalanguage that may be encountered. This is because The result was a three-tier differentiated activity, which resulted in
of the almost limitless variety of topics that may be used to satisfy a cheat sheet that the students were able to access digitally at any
some outcomes. The question though, is how to teach it. time.
An example will, of course, be explained and defined at a point in For struggling students, words were provided that they had to
the lesson; however, research shows that most students need to find definitions for. Some equations were also provided, which
repeatedly engage with a technical word before its meaning is fully the students had to show worked examples of. The next tier was
understood. Even if the concept sinks in, spelling may be an issue a handful of words and equations, where students were required
for some words, affecting fluent written communication. to define and work examples. They also then had to find the same
number of examples themselves. The final tier was a blank sheet
In primary teaching, this is often overcome with a word wall, with a required number of words and equations that the students
mind map, or graffiti wall that students can constantly refer to. had to find, define, and work as examples.
These artefacts have the correctly spelled language, possibly with
definitions, in a visible place that can be referred to at will. Younger These three tiers were all marked against a rubric, constructed
students enjoy these brainstorming activities, and are usually in collaboratively by the teacher and students. They offered marks
the same space lesson after lesson for a given topic, even if they for thinking skills, processes, and creativity as much as for
change classes for subjects, as some primary schools do. correct results. The resulting cheat sheet is allowed as a resource
sheet during assessment which itself, aims to assess skills and
processes rather than knowledge. This is proving very popular
with the students at the moment; however, the unit of work had
not concluded at the time of writing this. I do feel that it may be
useful for other teachers who find that students do not absorb
metalanguage well during direct instruction.
Hands On:
Demonstrating Capacity
To get a feel for capacitors in general, and RC networks in particular, Using the smallest capacitor you have, insert it taking care of
this simple, hands-on activity uses just a few components and a polarity shown and connect the blue link. Watching the LED, notice
breadboard to demonstrate how the value of a capacitor affects the if it turns on instantly or slowly. Then keep watching when you
time it takes to charge and discharge; and the effects that a resistor remove the blue-coloured jumper wire. You should notice a nice
can have on this. gradation in the LED, turning on slowly, and off slowly.
For this experiment, we’ll work with electrolytics. They're cheap and Replace the capacitor with the next value up, and reconnect power.
have a fantastic range of available values. Many makers will have Continue until you have worked through all your chosen values.
an assortment of components on their workbench for testing or You can record the time the LED stays on, the plot the results on a
development, so the capacitors in the following parts list are a guide graph. You should notice a pattern!
only. If buying values for a class, decade values are the best as they
clearly show the effect of going up or down a decade. The capacitor values will have a predictable and reliable effect on
the power to the LED, inline with their capacitance value.
PARTS REQUIRED:
Electrolytic Capacitors in: EXPERIMENT TWO
10µF, 47µF, 100µF, 220µF, 330µF, 1000µF
1 x Diffused LED in any colour (low current draw)
1 x 220Ω Resistor (for LED)
Resistors in Various Values (we suggest 10Ωm, 10kΩ, and 1MΩ)
1 x Small Breadboard and Prototyping Jumpers
Resistor
EXPERIMENT ONE
EXPERIMENT THREE
Follow the diagram above with just one capacitor. Connect your
power supply to your breadboard, probably the 5V supply often used
with Arduino and Raspberry Pi experimentation.
Note: Because the power supply may have capacitors also, we are
using links to break the power to our test circuit. This ensures a
clean application / shut off of power. If we simply turned the power
supply on and off, it could skew our results by still ramping power
up and down with the internal capacitors.
Following the diagram below, wire up everything but the blue We'll simply replace one of the links with a resistor. Using the same
jumper wire. This will be our power-control wire. You could use a method as before to apply and remove power, notice how the use of
switch in-place of the wire. Both options will work fine and produce different resistor values between the capacitors and LED change the
the same result. rate and which it turns on and off.
The Ubiquitous
Logic Probe
This is the first of our discrete projects! A logic probe
is a powerful tool for any maker to have, since it
simplifies debugging and testing. - by Bob Harper
MAKER LOGIC The output voltages are another issue. TTL, either 5V or 3.3V
systems, expect the output voltage to be from 0V to 0.5V, while the
Robotics, 3D printers, CNC mills, routers, and so on are all CMOS system expects the output voltage to be less than 0.05V – the
applications of the inputs and outputs of computers, being used main reason for lower power requirement of CMOS.
to drive mechanical and opto-electric devices. The logic analyser
is a terrific instrument, but overkill; and usually over-priced for Logic “1” levels for TTL inputs (both 5V and 3.3V systems) need to
hobbyists. Multimeters often have a logic function, but they can be be greater than 2V; but for CMOS, on a 5V supply, the inputs need to
slow, insensitive, and inaccurate. They can also be inconvenient; for be above 3.5V to be a valid “1”.
example when you’re trying to hold a probe on a tiny pin, and you
need to avoid touching the many other tiny pins that sit around it, So a professional probe requires a different design for each
when looking back and forth at the meter. system, or a switch to select the system in use. For hobbyists,
unless chasing a glitch at the very edge of a system, or attempting
HOW IS A LOGIC PROBE BETTER THAN A MULTIMETER? maximum “fan-out” (loading), where noise can cause false logic,
a hobbyist can suffice with 0V to 0.8V as acceptable logic “0”, and
The logic probe has two or three coloured LED indicators near the above 2V as logic “1”. In fact, a technician would probably pull out
probe tip, so the user can see the result without looking away. It an expensive CRO or logic analyser by then anyway.
also clearly shows three conditions using two of those LEDs. Also,
multimeters read logic “0” or logic “1”, but not all meters can LOGIC SHIFTS
handle levels in between. Therefore, they may make mistakes in
interpreting an open circuit or dead gate. In a system where the logic is ‘state determined’ and the outputs
don’t change unless an input is changed, logic “0” and logic “1” are
WHAT DOES A GOOD LOGIC PROBE NEED TO DO? quite sufficient. On low speed systems, a flickering pair of red and
green LEDs might be enough to say the clock is ticking, but even
As we mentioned, typically logic probes read logic “0” and logic “1”. experienced technicians have difficulty on faster systems. The main
This may sound simple, but it’s not necessarily the case. issue is knowing whether the system is clocking, or held in a high
impedance state or centre voltage (i.e., between a logic “0” and
Firstly, it will help to know what type of system it will be used on. On a logic “1”). To identify this, a logic probe can have a ‘pulse’ LED,
some logic systems, the probe would read up to 48V for a logic “1” usually orange, that may simply light when oscillating, or flash at
on relay logic, and perhaps +/-12V on other systems. Many systems a fixed frequency when a pulsed signal or clock is running. Some
have existed, most are now gone, relay, DTL, ECL and so on. probes have a function to ‘catch’ a transition, meaning that the
orange LED turns on and latches on until reset.
So let us begin by defining our logic probe as intended for TTL. You
might say 0 volts for logic “0”, which although commonly agreed If the probe tip changes logic, or even if the logic momentarily
with, is not completely correct. In fact, most systems never actually changes then returns to the initial state, whether correctly following
reach exactly 0V. The truth is, TTL accepts from 0V to 0.8V as the logic, or due to a glitch, the latch will pick it up. This is useful
meaning a logic “0”, and CMOS accepts 0V to 1.5V as logic “0”, at for catching sporadic and unintentional pulses that may trigger
least on a system with 5V rail voltage (and up to 4V on a system logic circuits intermittently, and especially if the circuit is triggered
with 15V rail voltage). Then, we realise that the Arduino, along with unexpectedly and unpredictably. ››
many other computer systems, use either 5V or 3.3V rail voltage as
a modern option. Thankfully, a 3.3V system still uses TTL levels for
logic “0” (i.e., 0.8V).
5V 5V
5V 5V 5V 5V
5V 5V
5V 5V
5V 5V 5V 5V
5V 5V
High High
High High
4.95V 4.95V
4.95V 4.95V
Vcc = 5V Vcc==5V
Vcc 5V Vcc = 5V High High
High High= 5V
Vdd Vdd==5V
Vdd 5V Vdd = 5V
High High
High High
High
High High 3.5V 3.5V
3.5V 3.5V
2.7V 2.7V
2.7V 2.7V
2V 2V
2V 2V
1.5V 1.5V
1.5V 1.5V
0.8V 0.8V
0.8V 0.8V Low Low
Low Low
Low
Low Low 0.5V 0.5V
0.5V 0.5V 0.05V 0.05V
0.05V 0.05V
Low Low
Low Low
0V 0V
0V 0V 0V 0V
0V 0V
0V 0V
0V 0VLow Low
Low Low
0V 0V
0V 0V
While we would be proud to say we designed a new type of logic A comparator is a type of op-amp that compares the voltage on
probe, it would be very likely that somebody else had already the two input pins, and decides which voltage is the highest. Then
published or uploaded something very close to this design, even the output is changed to reflect that decision. Op-amps can do
if we have done all the hard work ourselves. Anyway, the first step this, but are designed as analog devices on both input and output.
most engineers would take is to research what has already been Comparators are required to switch the output.
done. This circuit uses the best method we know of, using a simple
IC, and for very little cost. Comparators have a “-“ input, and a “+” input, but either input can
have a voltage anywhere between the supply voltages applied to
WHAT DO I WANT? them. The “+” and “-“ do not refer to the voltage, but the effect the
inputs have on the output.
Honestly? I want something easy to make, which will last forever and
cost me nothing! Or as close to that as possible! With this in mind, I
researched many existing designs, some as early as 1975, to try to OC COMPARATOR
compare approaches. DEVICE INPUTS OP-AMP OUTPUT OUTPUT
+ input < - input -ve value Transistor Off
Hobbyists could easily get away with two LEDs and two resistors, + input = - input Analogue Switching
and that approach is good when you need something cheap and/ + input > - input +ve value Transistor On
or fast! So long as you realise that you will be getting very basic
results, and will be loading the circuit so much you might actually
cause logic faults in the process.
If the “+” is more positive than the “-”, the output turns on, but if the
So, as in all test instruments, we want the probe to take as little “-” is more positive than the “+” the output turns off.
from the circuit as practically possible, and try to be sure that the
voltages are within the limits shown in the diagram below – at least Note that the output itself is a transistor with an open collector (OC),
for TTL and perhaps 3.3V TTL. unlike most op-amps. OC simply means there is an NPN transistor
with the collector connected to that output pin, and the emitter
Another factor can be the speed of operation, but hobbyists are connected to ground via the power supply pins. Therefore, the
usually happy with basic technology, so although high speed quad output does not go high or low, simply on or off. You will need to
comparators were researched, we settled for an old friend that is connect the load between the OC output pin and a positive supply,
easy to find, cheap, and has good manners: the LM339, which is which can be a separate supply to the IC supply itself.
also used in many of the designs already available on the internet
and elsewhere. LM339 QUAD COMPARATOR
- Input 2 6 9 + Input 3 Switching speed is the least impressive of the specifications, but
- + only if you can see and think at almost 2MHz. In fact, the design
2 3
+ - doesn’t require that kind of speed even if the micro runs at 20MHz.
+ Input 2 7 8 - Input 3
The signals on the computer I/O lines will not normally be changing
that fast, and pulses can still be detected. I do recommend that
PWR-1
R10 +ve
D1
33R 3v3 to
R2 R5 R1 R12 R8 R22 R15 R16 R23 R19 15 Volts
18k D1
8k2 18k 1M0 1M0 33R 1M0 220k 330R 1k0
Q1
BC557
LED3
Orange
IC1B LED1 LED2
7
1
Red Green
6
LM339N
R3 LM339N LM339N
9
100k 3 D3 Q2
11 IC1D 1N4001 14
8
S1 PROBE
R6 10 R18 BC547
2P2T 13
8k2 C2 10M
CMOS R14
TTL 1nF 12
100k
R4
100k IC1A R9
5
2 68k
4
LM339N
R13 C1 R17
R21 R7 R2 R11 1µF
100k 100k
8k2 4k7 10k 1k0
-ve -GND
PWR-2
The circuit of the Logic Probe and it's LM339 Quad Comparator core.
when you use any device, you download the datasheet/s and some For a CMOS circuit, two resistors of the same value should be used
application notes off the internet, and read them. It is a good way to for R1 and R2, but the values used for TTL will also work on CMOS,
determine what it all means, and at minimum the datasheets will tell and no changes are necessary.
you what pins to use.
The second voltage divider chain using R3, R4 and R5, set the two
THE CIRCUIT reference values, 0.8V for “0” level TTL on comparator pin 4, and 2V
for “1” level TTL on comparator pin 7. The string is designed for 5V
Take a look at the schematic above. Note what the pins are and try TTL but works on 3v3 TTL with a little error in the absolute threshold
to remember them. Particularly note that pin 3 is the positive or VCC values. For standard 5V TTL, R5 = 18k, R6 = 8k2 and R7 = 4k7
connection, 5V in most cases, and pin 12 is ground. respectively giving reference values at pin 4 of 775mV, and 2.04V
on pin 7.
Each comparator has two inputs (+ and -) and one output. Note the
polarity of the inputs on either side of the IC. Comparator 1 has its The switch allows the user to swap between two references:
inputs on pins 6 (-) and 7 (+) and its output on pin 1. Then note that standard TTL in the forward position, and a second option in the
comparator 3 is the same on the other side of the IC, except for the back position. Assuming CMOS is the second option, the resistors
polarity of the pins. Once you become familiar with the symmetry of should be R20=R6=R21 = 8k2. If you want a more exact reference
the pin-out, you’ll find working with the device quick and easy! for working on 3v3 TTL, R6 remains as 8k2, as it is common to both
switch positions and both options of CMOS and 3v3 TTL. Use a
For simplicity, we are going to describe the logic probe in two parts, 10K for R20, and 5k6 for R21, only if you intend the second switch
and we’ll start with level detection first. position to be used for 3v3 TTL.
Beginning with the comparator inputs, there are two voltage CONSTANT CURRENT LED DRIVE
dividers at work. The first uses R1 = 18k, and R2 = 10k, to set
the logic probe voltage when not connected, to Vcc x (10k/(10k + The LEDs on the outputs of the comparators are on pin 1 (“1”) and
18k) volts. When the rail voltage is 5V, the probe will be ~1.78V, pin 2 (“0”). To keep the brightness of the LEDs about the same from
or between 0.8V and 2.0V, so neither LED should be lit. The probe 3V to 15V, a constant current source has been built using D1, D2,
voltage is connected to the comparator inputs on pins 5 and 6, via Q1, R10 and R11. R10 limits the current to 20mA, but the supply is
two 100k resistors, R3 and R4. You’ll note that another 100k, R14, shared between LED 1 and LED2 as they do not come on together.
takes the probe voltage to pin 10 for the pulse circuit. We’ll explain
that section later. REVERSE SUPPLY VOLTAGE PROTECTION
When the rail voltage is 3.3V, the probe will be ~1.2V, so as before In the dreaded situation where a technically-minded person
neither LED should be lit, and 3v3 TTL can be tested without issue. connects the red wire to ground and the black wire to 5V (as
happens from time to time), R22 and D3 limit the reverse voltage ››
›› across the LM339 to -0.6V, but R22 will start burning out and value, comparator 4 turns on, grounding the base of Q2. Everything
letting the smoke out; so consider it a sacrificial fused resistor! is back to starting position except that C1 will continue to charge
until it reaches rail voltage. The circuit is ready for another pulse.
THE PULSE CIRCUIT
ASSEMBLY
The pulse detector has a basic function in what it can do, as
we wanted to keep the logic probe simple. In reality, it did start While this object can be built from proto board or similar, it will
to collect more parts than originally intended. The basic circuit quickly end up as a rat’s nest, so we recommend using a PCB or
configuration is a monostable multi-vibrator (a name that takes up kit from one of the supporting suppliers. The PCB is shaped and
more space than the actual circuit!). Put simply, a brief trigger at the sized so it will be a natural size to hold for testing a circuit, and the
input, causes the output to turn on for a timed period. probe tip and LEDs are all at one end, while the power leads and
switch are at the other end. So doing it this way means not only will
We begin at the probe, where we are more interested in the change you have somewhere to put the components, but you won’t have to
in voltage than the actual voltage. Therefore R14, another 100k is guess where the connections go!
connected to pin 10 via C2, a 1 nanoFarad capacitor. The capacitor
will only pass a current when the voltage is changing. HOMEMADE PCB
R12, 1M0 and R13, 100k set up a reference voltage on pin 10 of The PCB was in fact designed as a single-sided board, and those
about 450mV. Comparator pin 11, due to the voltage divider using keen enough can download the PCB pattern from the website. Just
R8, 1M0, and R9, 68k, has a set value of about 290mV, for reasons be sure to use the “single-sided” pattern, which has wider tracks
we’ll get to later in the loop! and larger pads for easier hand-drilling. You will need only two links
of wire on the top-side of the PCB.
The output of comparator 3 remains off in normal conditions. When
the pulse of current presents at pin 10, it becomes temporarily For commercially available boards, double-sided PCBs are often
more negative than pin 11 and it’s output, pin 13 turns on which the same price as single-sided boards, so the links are integrated
discharges C1. This turns comparator 4 off, which lifts the voltage into the PCB already. There's not a whole lot of spare space on the
on R9, so pin 11 is again higher than pin 10, turning comparator 3 board, so it does make life a little easier.
off.
POWER
For comparator 4, R16, 220k and R17, 100k set pin 9 to about 1.6V,
with some feedback from R18, 10M pulling pin 9 a little lower in We did argue a little – but only between gentlemen – about options
normal times, but a little higher when the LED is on. This is positive for the power supply. While a 9V battery would power it and be
feedback and serves as a Schmidt trigger, to add hysteresis to the reasonably tidy, it also required voltage regulation and special
switch. consideration for CMOS above the supply voltage.
Pin 8 of comparator 4 has the RC timing circuit using R15, 1M0, and In the end any kind of battery was disqualified as unnecessary when
C1, 1uF. The timing constant of this pair is 1 second, for 63% of the the thing is used to test a powered circuit anyway. Using the supply
supply voltage. However, pin 8 is compared to the voltage on pin 9, from the “DUT” (device under test) is the norm for logic probes, as
~1.6V, so switches in about one-third of a second. A longer pulse they don’t require much current anyway.
would result if R16 were made 100k, for example.
Still there may be options. My own probe had the leads ripped
So what happens to comparator 4, is comparator 3 grounds pin 8, off it once, so I used a speaker cable with a pair of IC clips. When
turning the output transistor off. everything was TTL in DIP ICs, I simply clipped onto pins 7 and 14, or
whatever the supply pins for the ICs were. I still think that’s the way
Transistor Q2 is turned on by bias resistor R23, which has been for ICs with legs!
reduced to 330Ω as Q2 was not turning completely off. It sounds
wrong but comparator 4 output wasn’t pulling the base of Q2 low Those who work mainly on Arduino, Raspberry Pi and such, may
enough. prefer a pair of male pins or female sockets (PIN-header-style) to go
straight onto the supply pins/sockets. Alternatively, you might like
The orange LED, LED3, has a simple ballast resistor, R19, 1k0, to use alligator clips, or even solder the wires onto the DUT power
although it might have been powered by the constant current circuit, supply. Others may prefer having a USB plug and lead, and even
sharing current with the other LEDs. use a USB plug pack. All these options can have the wires soldered
directly into the PCB, or place a right-angle two-pin header into the
C1 charges with the current flowing in from R15, until the voltage power pads, and plug onto them with a two-way 0.1-inch socket. It
across C1 reaches the value on pin 9, and as soon as it exceeds that all really comes down to what you intend to work on.
The usual rule for manual assembly is “hardware, passive, active”, Active components are the most sensitive to heat and static
meaning that you fit sockets, switches, and pins first. If you do use electricity, so they should be left until last.
a two-pin header or whatever, or fit the power now, you can perform
tests as you go, to make sure you have it all in the right places and Place and solder the diodes and transistors, as well as the LEDs, but
soldered correctly. leave the IC until later. Be very careful with the active components –
make sure you have the polarity correct. Check all the connections
So with the switch, probe and power soldered in, connect it up and as above, and then check the voltages.
check that you have 5V as expected, and where expected. It is a
good practice to assemble in stages and test as you go, rather than Use a small piece of wire to short the pads of pins 1, 2 and 14, to
loading up every component and soldering everything in one go. the ground, pin 12. Each of the LEDs should light: LED 1 and LED
2 when the short is in place, and LED 3 when it is not in place. This
PASSIVE COMPONENTS has also tested the constant current transistor Q1, and transistor
Q2.
The resistors and capacitors come next, and a suggestion may be
useful. If you think you might like to replace components at some LM339 PLACEMENT
stage, solder the component leads and cut them off close to the
PCB. If you need to change one, it will be easier to get out. The LM339 quad comparator IC is fairly robust, and the PCB has
some basic protection against reverse voltage, but if you are unsure
The alternative, used in the industry and military, is to cut leads to about your soldering, you might like to use a low profile IC socket.
about 1mm, bend them over, either flat against the PCB or at about This way you can make sure your soldering is clean and tidy, no
45 degrees, depending on just how harsh the mechanical forces on shorts, whiskers, or dry joints, and then fit the 14-pin IC. The dimple
the PCB may be, and solder to cover the component pin as well as near pin 1 (i.e., the little curved bit taken out of one end), goes
making the joint. This is a devil to remove without dedicated rework where the little bite is taken out of the overlay print. Don’t laugh –
stations. even us old hands do it wrong sometimes!
Make sure each joint is clean and shiny, and there are no FINALLY!
“inclusions” (i.e., bits of nasty things unexpectedly stuck in the
solder). The big moment has arrived, and if you have passed all the tests
so far, you should be looking at success. Power up, and nothing
Out with the multimeter, and power up the circuit. There is a table should happen – especially, no smoke. With a piece of jumper wire
provided with all the voltages to expect on the IC pads, for when attached to the probe tip, touch pin 3 and the red LED should light.
the correct components are in the correct places, and are correctly The orange LED should also come on briefly, about one-third of a
soldered. second. Touch the ground, pin 12, and the green LED should come
on. Note: I could have told you to put the switch in the forward
Compare your values to those in the table shown below. position, but it doesn’t really matter if we’re looking for a good
ground or positive rail.
CONDITION NO IC PROBE FLOATING PROBE HI PROBE LOW PULSE LED OFF PULSE LED ON
LEVEL TESTING FIELD It could be perpetually fine tuned, but PCB manufacturers will vary,
and some of the “fit” depends on the 3D printer and how it is set up.
If you really want to, you can check your actual levels by putting a The original case was designed in OpenSCAD, and we've provided
potentiometer between ground and 5V, and the probe on the wiper the SCAD file to make any changes relatively easily too. For those of
pin, and adjust until the green “0” LED just goes out. Read, and you using Tinkercad or similar software, you can easily import the
record the voltage, and then adjust until it just turns on; then read STL file and add/remove shapes from the core design too, though
and record again, and see how much hysteresis there is. Note that some modifications are much easier to make in OpenSCAD as it can
no hysteresis is actually designed into the circuit, on the levels at re-render the shapes from scratch.
least.
USING YOUR NEW PROBE
Likewise, adjust until the red “1” LED just comes on, read the
voltage and record, and then adjust it until it just goes off; then Obviously one caveat we must make is to never use this logic probe
read and record again. The values should not be very different, and on voltages above 15V, or any device that runs on live ac current. IT
should be less than 0.8V for a logic “0”, and more than 2V for a logic IS NOT CatIII-rated, and isn’t meant to be. It's meant for TTL / logic
“1”; this is with the switch in the TTL position. levels only.
You can try it also in the CMOS position, and for different voltage Now that we’ve clarified that point, take a probe around a running
supplies up to 15V. Low should be about one-third supply voltage, Arduino or such. Using the DUT’s power supply avoids requiring a
and high should be about two-thirds supply voltage. ground wire, and the probe has enough input resistance to be kind
to your circuits.
3D PRINTED CASE
If you strike a test point that doesn’t light, or lights intermittently
We have designed a handy case for mounting the probe, so it can either high or low, but doesn’t hold at least one LED on, then it is
easily become part of your toolkit. probably spending a lot of time in between a logic high and a logic
low, or has a high impedance. Either way, you may have found your
The case has two snap-ins to hold the PCB in place, while the case fault!
halves snap together for a neat fit. The case may want to stay that
way, so make sure you’re ready to leave it together, or perhaps sand Logic probes take a little learning before you really know how to
the snap-ins so it goes together easily, and therefore comes apart use one well, but once you get your proficiency badge, you’ll always
easily. If the PCB is tight, it forces the sides of the case out, so make have that skill in your kit. ››
sure the PCB fits well before tackling the lid. Checking you have no
protrusions from your PCB will help ensure a neat fit too.
If this is the first time you've used a logic probe, some advanced
testing might be worthwhile to fully appreciate the relationship
between the logic levels in your code (or created by an integrated
circuit), and the actual levels and voltages presented in a circuit.
For this reason, we have created a basic Arduino Sketch, which you
can use as a powerful test tool. It will also put your probe through
its paces in an Arduino specific environment.
int lowPin = 5; LOW: Touch the probe tip to pin 5, which we have set with a
int highPin = 6; LOW output. You should see the green LED illuminate.
int pwmPin = 9;
void setup() { HIGH: Touch the probe tip to pin 6, which we have set with a
// set these pins as outputs HIGH output. You should see the red LED illuminate.
pinMode(highPin, OUTPUT);
pinMode(lowPin, OUTPUT); PULSE: Touch the probe tip to pin 9, which we have set with a
} PWM output.
void loop() {
digitalWrite(highPin, HIGH); You may also notice that the green LED is illuminated. This is
digitalWrite(lowPin, LOW); because we have set it to around 4% duty-cycle (more accurately,
analogWrite(pwmPin, 10); 10/255, or 0.3921... but who's counting). This is because the probe
} features some great functionality. When a pulse width output is
detected, the red and green LEDs act as a duty-cycle reference.
When the duty cycle is low (that is, off more often than on), the
What we have effectively done here is quite simply, set pin 5 to LOW, green LED will illuminate alongside the yellow pulse indicator.
pin 6 to HIGH, and pin 9 (which is a PWM-enabled hardware pin) to
a low value.
int ledPin = 9;
You may notice that in the setup function, we have specified our void setup() {
high and low logic pins as OUTPUT, but not our PWM pin. This is // nothing happens in setup
It's important to remember to use the pinMode function in setup for // fade in from min to max in increments of 5
any standard digital outputs. for (int fade = 0 ; fade <= 255; fade += 5) {
// sets the value (range from 0 to 255):
We have also included this sketch as probe_test.ino in the digital analogWrite(ledPin, fade);
resources too. Load the sketch onto your Arduino. // wait 300ms to see the dimming effect
delay(300);
Connect power for your probe to the 5V and GND pins on your }
Arduino. While you should have performed basic tests on your probe // fade out from max to min in increments of 5
already, if you want to be sure your probe is working, you can touch for (int fade = 255 ; fade >= 0; fade -= 5) {
the probe tip onto the 5V or GND. You should see the red or green // sets the value (range from 0 to 255):
LEDs illuminate respectively. As long as this occurs, move on to the analogWrite(ledPin, fade);
pins we have specified in the sketch. // wait 300ms to see the dimming effect
delay(300);
}
}
Likewise when the duty cycle is high (that is, on more often than
off), the red LED will illuminate alongside the yellow pulse indicator.
Of course, when the pulse width is somewhere in between, you will
see all three LEDs illuminated.
Component tolerances will affect the precise points where the high
and low LEDs switch on and off when the probe is in pulse mode.
However, to demonstrate this, we can utilise a modified version of
the FADING example sketch included with the Arduino IDE. Ours
is not too different from the example provided with the software,
however we have slowed the cycle down considerably so it's more
visible and you can watch it go through the full cycle from 0% to
100% duty cycle, and back again. This sketch is provided in the
resources as probe_pwm_cycle.ino. Load it onto your UNO and touch
the probe to pin 9, watching what happens!
through the cycle taking it from 0% duty cycle to 100% duty cycle,
WHAT ABOUT A RASPBERRY PI? and continue on forever (well, until you forcibly quit the programme).
The beauty of logic is that it's, well - logical. The process for coding The interesting thing about Raspberry Pi PWM is that there's only
a similar test on Raspberry Pi is fairly similar. But we've done it for two hardware PWM channels. Most PWM functionality is derived
you, providing the sample Python scripts in the resources. from software PWM via the GPIO library. For most purposes, it's
perfectly adequate and opens up far more functionality than would
Of course, you still need to tell the Raspberry Pi what you're doing, otherwise be provided for this purpose.
and set the various pins to have their respective outputs.
Here is a basic Python code to achieve something fairly similar to import RPi.GPIO as GPIO
Load probe_test.py in IDLE and run. Since Raspberry Pi pins are while 1:
unlabelled, it's easiest to use a GPIO breakout adaptor which for level in range(0, 101, 5):
Again, you can verify your probe is powered and working properly by for level in range(100, -1, -5):
touching the tip to any of the GND or 5V pins on the Pi, and looking p.ChangeDutyCycle(level)
import RPi.GPIO as GPIO So there you have it! Go forth and conquer logic with your new logic
GPIO.setmode(GPIO.BCM) probe, and newfound understanding of how it works! ■
lowPin = 5
highPin = 6 WANT MORE?
pwmPin = 13 For additonal code, or to discuss this project, visit:
GPIO.setup(lowPin, GPIO.OUT) # set up pin 17 https://diyode.io/004tdqg
GPIO.setup(highPin, GPIO.OUT) # set up pin 18
PWM1 = GPIO.PWM(13, 100) # enable software PWM
GPIO.output(lowPin, 0) # send pin 5 low
GPIO.output(highPin, 1)
PWM1.start(10)
# send pin 6 high
# start PWM at 10%
Buy The Logic Probe Kit:
► ALTRONICS www.altronics.com.au
K9800 $14.95 (Education Pricing $9.95)
► JAYCAR www.jaycar.com.au
As in the Arduino examples, we'll also provide an example for a KD6100 $14.95 (Bulk Pricing Available)
cycling PWM output so you can see the effect it has on the probe.
Load and run probe_pwm_cycle.py. Pin 13 should start looping
PLANE
SPOTTING
DAVID SUCH
Engineer, Honorary Associate at USyd.
www.reefwing.com.au
@reefwing
There's a fantastic community of enthusiastic plane-trackers out functionality with a Raspberry Pi (RPi) and Arduino. The price has
there. David is part of that community. He won one of our prelaunch recently come down but free swag is always a treat! I even had a
competitions, finding himself the proud owner of a pcDuino and useful project lined up that I thought would allow me to see how it
Touchscreen! He's put it to great use. performed.
Congratulations on being the lucky winner of our pcDuino We’re so happy it went to a good home and we see you’ve put it to
competition. How did you feel when you found out? good use! For those who haven’t heard, can you explain what you’re
doing with the pcDuino?
I was very excited! I think it is the first competition I have ever
won. I’d been tempted to give the pcDuino a try for a long time, but I am using the pcDuino and a cheap USB DVB-T TV Tuner to track
the cost had been a barrier, especially given you can get similar aircraft flying nearby, and then displaying their real time position
In Australia, CASA is moving towards most aircraft requiring a Mode The RTL2832U-based Software Defined Radio (SDR) receiver is
S transponder, which is ADS-B capable, but this will take years to designed and marketed for DVB-T reception. However, it’s possible
come into effect, particularly for Visual Flight Rules (VFR) aircraft. All to get raw samples from the device, rather than just a demodulated
of the big jets certainly have it. You may see references to S-mode DVB signal. This means that a wide-band receiver can then be
when reading about ADS-B plane tracking and sometimes S-mode is implemented in software. I used the USB DVB-T TV Tuner RTL2832U
used interchangeably with ADS-B (which is not strictly correct). + R820T (you can get them on eBay for around $13). ››
The kernel that comes with Ubuntu already contains a DVB driver,
which we don’t want to use. To stop the conflicting Linux DVB-T $ git clone https://github.com/CTassisF/
Then add the following line at the end of the file. You can either use
the existing blacklist.conf file or create a new file; just make sure it’s
in this directory and ends in .conf.
To test whether dump1090_mr is operational: Fantastic! Tell us a little about FlightAware and how the community
works.
$ dump1090 --interactive FlightAware is the world’s largest flight tracking data company. By
registering (for free), you can add your ADS-B base station results
to the worldwide collection of other operators, creating a real time
This should show you a list of detected planes along with their flight picture of aircraft movements globally. If you are picking someone
information. up from the airport you can track their flight in real time, and
minimise your parking fees! Connecting to FlightAware will also
That’s awesome! How is the flight data then overlaid to Google tabulate and graph statistics from your station.
Maps?
You mentioned it’s been done on RPi many times, were there any
This is very easy as Dump1090 does it for you, and it includes challenges getting it to work on the pcDuino?
an embedded HTTP server. If you are on the pcDuino, open the
Chromium browser and point it at http://127.0.0.1:8080 to see the Yes. FlightAware has made it very easy to get this system up and
display. running on a RPi, and have a guide available on their website.
You can also view this page from other computers on your LAN. To The difficulty is that the packages have been compiled for Raspbian
do this you will need the IP address of your pcDuino (type hostname (a Debian variant of Linux, which is most commonly used with
-I on the command line). On the other computer you can then the RPi), and the pcDuino uses Lubuntu (a light weight variant of
access the page via that IP address. So for example, my pcDuino Ubuntu). Fortunately, Debian and Ubuntu share a common ancestry
IP address was 192.168.0.7 to view the dump1090 page I enter: so it is possible to move packages between the two.
http://192.168.0.7:8080 into the browser address bar.
PiAware is a FlightAware client program that runs on a RPi (or
pcDuino!) to securely transmit dump1090 ADS-B and Mode S data to
FlightAware.
This will load some libraries you will need. You can then download
and build PiAware. ››
›› To install the PiAware package: It sounds like an amazing community collating data together! Is
there anything else you’d like to tell us about this system?
$ sudo dpkg -i ~/piaware_builder/ Just to note that if you do contribute your ADS-B data to the
piaware_3.5.1_armhf.deb worldwide network, then Flight Aware provides access to the
following:
Reboot, and then to check that everything is working as it should, • Live data on flightaware.com (subject to standard data processing
type: delay of up to two minutes).
•A ccess to up-to-the-second live data received by the local device
(accessible from the stats page with a local network connection).
$ sudo piaware-status • Data from local device highlighted on FlightAware track logs.
• Detailed statistics on site performance.
• A free Enterprise Account (USD89.95/mo value).
This should display something like the screenshot below. Note that
you no longer need to add your username and password to the Wow, it sounds like a great deal all-round! What are you working on
PiAware configuration file. now?
www.bosch-ebike.com.au
CREATE!
INCREDIBLE
PROJECT
$ 2995 9
$ 95 $ 2995
DISPLAY IT ADD STORAGE COMMUNICATE
A tiny monochrome 128x64 pixel display. Only SD Card interface. Works with the Arduino IDE’s Bluetooth® V4.0 BLE module. Configurable as
needs 2 pins for control. XC-4384 inbuilt SD library. 3.3V & 5V compatible. XC-4386 master or slave. XC-4382
9
$ 95 $ 3995 $ 3995
PROTOTYPE WITH POWER DESIGNED FOR BREADBOARDS WIRE IT UP! ARDUINO STACKABLE HEADER
Breadboard with removable power 70 stripped pieces of single core sturdy A pack of 40 jumper leads of various Build a stackable shield, or make your
supply. Power from USB. 3V & 5V wire. 5pc x 14 different lengths. PB-8850 colours for prototyping. current shield stackable. Alternatively,
switchable. PB-8819 PLUG TO PLUG WC-6024 shorten the pins to make female headers
SOCKET TO SOCKET WC-6026 just like the Duinotech main boards.
PLUG TO SOCKET WC-6028 HM-3208
$
19 95 13 50
$
5 ea
$ 95
4
$ 50
RPI VOICE
LOGIC RECOGNISER BUNDLE
VALUED AT OVER $150
$ 129
PROBE KIT RPI 3 XC-9000 $74.95 SAVE $25
You've read the DIYODE project on page USB TO AUDIO CONVERTER XC-4953 $24.95
58, now you can get the kit from Jaycar. Kit TIE CLASP MIC AM-4092 $19.95
supplied with PCB and all specified parts.
You'll need to print your own case though. 1495
$ USB SPEAKER XC-5191 $14.95
16GB MICROSD CARD XC-4989 $19.95
KD-6100
Available early Oct. POWER POINT
CONTROL BUNDLE
VALUED AT OVER $110
$ 7995
LEONARDO BOARD XC-4430 $29.95 SAVE $30
FOR OVER 40 EXCITING PROTOTYPING SHIELD XC-4482 $15.95
ARDUINO-BASED PROJECTS VISIT ESP-13 WI-FI SHIELD XC-4614 $34.95
www.jaycar.com.au/arduino 433MHZ TX MODULE ZW-3100 $13.95
WIRELESS OUTLET MS-6148 $19.95
GET PI AT JAYCAR
Raspberry Pi 3 Quad-Core 1.2GHz CPU. 1GB RAM.
Wi-Fi and Bluetooth. In stock at all stores - even
on the weekend when you need to finish your
project! XC-9000
$
34 95 4
$ 95
MQTT
Voice Controlled
Power Point
Turn on and off a mains appliance
using voice commands? Yes, you can
do that. - by Tim Blythman
You’ve probably seen the new Google Home® devices that are now THE BROAD OVERVIEW
available, but what you might not realise is that you can actually
build something very similar with a Raspberry Pi (RPi). And not only Just like the MQTT Light Switch, there are three parts to this project;
that, it’s very easy to interface it to your own hardware, such as a and not surprisingly, they are all fairly interchangeable with the
remote controlled power point. different parts of that project. One device (the publisher in the
MQTT system) issues commands, which are relayed by a broker to
The Google Voice Kit (see https://aiyprojects.withgoogle.com/voice) a subscriber, which acts upon the command. In this case, the RPi
is a popular item, but you can achieve the same results with a RPi running the Google Assistant voice recognition software creates
and a few other parts. This project however, is more than just a DIY messages, based on spoken commands which are transferred via
version of the Voice Kit. Building on September’s MQTT Light Switch the broker software to an Arduino. This then sends a radio signal
project, I’ve built this project which can take voice commands and via a 433MHz transmitter to a wireless power point to control an
then transmit them via MQTT to an Arduino. In turn, this operates a appliance.
remote controlled power point. While this sounds like an elaborate
solution to a problem, the MQTT interface means that we can While this is just one use of the RPi with voice recognition software,
incorporate other features (such as the app control from the MQTT the options are really interesting. When set up correctly, the
Light Switch) to expand the functionality even further. And of Google Assistant has many different skills. It won’t be as capable
course, it’s just plain cool to be able to speak a command and have as a Google Home® device due to hardware limitations, but it can
it happen! respond to simple queries such as “Where’s the nearest pub?”. It
can also be configured to do pretty much anything that can be done
via a terminal command (and more), so the possibilities are well
beyond what is mentioned in this article.
Of course, if you just want a really basic app-controlled power point, Of course, you will need other common RPi accessories, such as a
you can use an MQTT app for input to control a wireless power HDMI cable and monitor, keyboard, mouse and power supply. It’s
point, and it won’t even interfere with the normal remote control also recommended to have some plug-socket jumper cables to
operation. For more information on MQTT, revisit the article in Issue emulate the push button on the Google Voice HAT hardware; and an
3 of DIYODE Magazine. LED wired in series with an appropriate resistor, to give feedback on
the status of the voice recogniser program.
HOW IT WORKS
As noted above, the MQTT broker can run on the RPi, but there are
As you might imagine, a very big part of this project is setting up versions available for other operating systems such as Windows and
and configuring the RPi to do the voice recognition. There is an SD even OpenWRT. If you haven’t already got one set up, I would use the
card image, which is designed to work with the Google Voice HAT, RPi option, as it will need to be running for this project to work.
but the hat appears to be hard to obtain. Fortunately, it’s not hard to
replace the hardware with something equivalent; in this case, a USB The Arduino side of things doesn’t require much work. The
sound card connected to a microphone and speakers, as well as an prototyping shield is optional, but I found it meant that everything
LED for troubleshooting. There’s some account setup (you’ll need a slotted together in a compact way, and could easily be pulled apart
Google account to be able to access Google’s services), and finally later for use in other projects. The alternative is to solder some
some further configuring to get our specific commands working. plug-socket jumper leads onto the legs of the 433MHz Transmitter
There’s also an extra step to set up the “OK Google” hotword, if you Module, and plug these into the headers on the WiFi Shield.
wish to use it.
PARTS REQUIRED: JAYCAR ALTRONICS
The MQTT system requires a broker, and this is probably the easiest 1 x Arduino Leonardo Board XC4430 -
part to install. It can actually be installed in just two commands on 1 x ESP8266 WiFi Shield XC4614 -
a RPi, and this is the most obvious place to install it (although you 1 x 433MHz Transmitter Module ZW3100 Z6900
might want to wait until we’ve created our SD card image). 1 x Prototyping Shield (optional) XC4482 Z6260
1 x Wireless Power Point MS6148 -
As the WiFi Shield can plug directly onto the top of the main board,
the only connections that need to be made are soldering some
In addition to this, it is recommended to give the Pi a fixed IP jumper leads to the 433MHz Transmitter Module, or alternatively,
address under your router, so that any apps can easily find it. Look plug 433MHz Transmitter Module and the jumper leads into a
under DHCP setting for DHCP address reservation options. breadboard.
The RPi doesn’t need much in the way of mechanical build. The USB
Sound Card is plugged into the one of the RPi’s USB ports, and the
microphone and speakers are plugged into their respective locations
on the USB Sound Card. It will be assumed that you have a keyboard,
mouse and monitor set up to use with the RPi. Once the build is
complete, the keyboard, mouse and monitor can be disconnected
and the entire project can be run headless.
I found it easiest to solder the LED and resistor (I used a blue LED
in series with a 100Ω resistor) to the plug ends of the plug-socket
jumper leads; and instead of a switch, I left the ends exposed, so I
could briefly touch them together to emulate a button push.
Alternatively, this is what it would look like if the connections are The code for the Arduino is similar to that used in the MQTT Light
made directly to the WiFi Shield. Switch project, and setup is similar. The following lines will need to
be configured to match your WiFi network and MQTT broker.
ANT
TX RX G 5V
If you haven’t set up your broker yet, the easiest way is to use the
G
5V
RPi - just enter your RPi’s IP address for the broker. A good idea is
SCL SDA G 5V
ESP13 0 1 2 3
A
to get into your router settings and give it a reserved address under
3V3 G RXO TXO DHCP. This also makes it easier if you need to SSH in, to tweak a
setting while it’s running headless. The MQTTPORT shouldn’t need
3V3 G EN AD D
5V to change as 1883 is the default for most MQTT implementations.
KEY G
RST
You might also want to change the below if you want to use different
topic names and messages. The default topic names are the strings
The shields are then attached to the top of the Leonardo to in the first five “if” statements and the messages are “on” and “off”.
complete assembly of the Arduino side of the project. These correspond to the commands that are run on the RPi, so both
need to be changed to suit your specific customisation.
int cmd=-99;
//default fail
if(strmatch(topic,”lounge/lamp”)){cmd=0;}
//button A
if(strmatch(topic,”bedroom/lamp”)){cmd=2;}
//button B
if(strmatch(topic,”spare/lamp”)){cmd=4;}
//button C
if(strmatch(topic,”spare/spare”)){cmd=6;}
//button D
if(strmatch(topic,”all/all”)){cmd=8;}
//button ALL
(strmatch(message,”on”)||strmatch(message,”off”))
{
if(strmatch(message,”off”)){cmd++;}
if(cmd>=0){
DEBUG.println(“Action”);
sendrf(packet(address,rfcmds[cmd]));
}
}
Next, ensure that the wireless power point operates correctly with mosquitto_pub -h 192.168.0.223 -t
the remote control. The wireless power point is in pairing mode for lounge/lamp -m on
the first 30 seconds after it is turned on, so I found it easiest to plug mosquitto_pub -h 192.168.0.223 -t
the wireless power point into a switched power point and toggle the lounge/lamp -m off
Boot up the RPi with the new card installed, and connect to a WiFi
network with internet access. ››
I found that these instructions didn’t match the web pages I was
viewing, so I did the following:
This changes the software to use the USB sound card instead of the
non-existent Voice HAT, and also allows the hotword trigger to be
used; it is documented in this thread: https://www.raspberrypi.org/
forums/viewtopic.php?t=183932&p=1167683.
Reboot the RPi and then double-click the “Check audio” and “Check
WiFi” buttons to make sure everything is working so far.
If you haven’t got a Google account, now is a good time to get one
set up. The next step is to set up our Google account to allow the
RPi to access the Google Assistant API. There is some information
Click “Create client” and enter an arbitrary product name (I used If you get a message like “Actually, there’s some basic settings
“pivoice”), then click “Continue” and download credentials. The that need your permission first”, open Google account settings in a
downloaded file “client_id.json” in /home/pi/downloads should be browser, and click through “Personal Info and Privacy” to “Manage
renamed “assistant.json” and should be moved to the /home/pi your Google activity”. Go to “Activity controls” and turn on “Voice
folder. and Audio Activity” and “Device information”.
Click on “Start dev terminal” and run “src/main.py”, which will start
the voice recogniser. A browser window will open so that you can src/main.py –T hotword
leafpad /home/pi/.config/voice-recognizer.ini
Then change:
#trigger = clap
to:
›› To enable auto start, run: terminal; but because printed text gets read out by the RPi, it can
also be used for audio feedback. The IP address, topic names and
messages should of course, be changed to match your setup.
sudo systemctl enable voice-recognizer
1
actor.add_keyword(_(‘lounge light on’),SpeakShellCommandOutput(say,
“mosquitto_pub -h 192.168.0.223 -t lounge/lamp -m on && echo ok”,_(“fail”)))
actor.add_keyword(_(‘lounge light off’),SpeakShellCommandOutput(say,
“mosquitto_pub -h 192.168.0.223 -t lounge/lamp -m off && echo ok”,_(“fail”)))
actor.add_keyword(_(‘bedroom light on’),SpeakShellCommandOutput(say,
“mosquitto_pub -h 192.168.0.223 -t bedroom/lamp -m on && echo ok”,_(“fail”)))
actor.add_keyword(_(‘bedroom light off’),SpeakShellCommandOutput(say,
“mosquitto_pub -h 192.168.0.223 -t bedroom/lamp -m off && echo ok”,_(“fail”)))
actor.add_keyword(_(‘spare light on’),SpeakShellCommandOutput(say,
“mosquitto_pub -h 192.168.0.223 -t spare/lamp -m on && echo ok”,_(“fail”)))
actor.add_keyword(_(‘spare light off’),SpeakShellCommandOutput(say,
“mosquitto_pub -h 192.168.0.223 -t spare/lamp -m off && echo ok”,_(“fail”)))
Add the following line to rest of the imports at the start of the file:
How Accurate Is A
Voice Command?
import RPi.GPIO as GPIO
Just above the section marked “Makers! Implement your own One of the cool things about modern voice command
actions here”, put this code: technology is that it leverages deep learning and continuously
improves accuracy thanks to machine learning.
WANT MORE?
Hey Siri! CALL-JOHN-SMITH.
For additonal code, or to discuss this project, visit:
https://diyode.io/004swnw "Calling Jack Quiff Mobile"...
We've all been there... but this is just the beginning of what's
to come. Soon, we'll be able to have a conversation with a
virtual assistant as casually as we would with a mate in a bar.
Reading & Resources:
Background noise, slurred speech, random queries, will all be
► MQTT mqtt.org seamlessly handled by the virtual assistant, with the accuracy
► GOOGLE AIY aiyprojects.withgoogle.com (or probably better) of a human. That's exciting, and it's right
around the corner.
POWER
OF THREE
TOM BISKUPIC
Sydney-based maker and enthusiast, PKI Other than your need for a power supply (and who doesn’t need
software developer. a good power supply?), what led you to embark on this project -
@tom_biskupic instead of just buying one!
Tom was looking at expensive commercial power supplies, until he I’ve always enjoyed playing with electronics, having grown up
realised he could probably make his own, and learn a stack of new hacking on Commodore 64s and the Commodore Amiga. A few
information in the process! With a Raspberry Pi (RPi) at heart, and a years ago my son started playing with quadcopters and 3D printing,
touch-screen for an amazing user-experience, we wanted to know and I really wanted to learn more. I started watching Dave Jones on
more about Tom’s amazing creation. EEVBlog and things just took off again from there!
In addition to multiple channels, I also wanted a bit more current The downside of using the RPi is that it is a bit slow to boot, and you
than the 3A my Jaycar supply could provide. I also found that have to shut it down properly. The latter point led to the need for a
although the Jaycar supply is very dependable, it’s not very quick standby supply and a soft-power switch, but it worked out okay in
and takes quite some time to respond to load transients and the the end.
like. I looked at the Rigol DP832, but since the whole point was
to reboot my electronic knowledge, I thought I would have a go at Now there’s a valid point - we never really considered boot up/shut
making one! As it is a one-off I had a pretty free hand in terms of down when using Raspberry Pi for something like this. Nevertheless
budget and I didn’t care about physical size. Basically I wanted a it’s a great basis for control. A touchscreen is a great interface. Was
really quiet linear supply with very high accuracy. Being a smart and that an easy decision?
networked device seemed important too, because I had lots of ideas
where being able to control the supply and coordinate it with other I wanted to use an LCD user interface from the beginning, but to
devices would be useful. begin with I had other plans for input. My son told me about this
flexible 3D printing filament and so my plan was to experiment with
Making the project open source seemed important. I wasn’t sure printing my own keyboard membranes.
(probably am still not sure!) if it is something someone would want
to copy, but if anybody did want to use my design then I felt it was Using a touchscreen however, means the user interface is totally
important they could understand it fully. I love old Keysight and flexible. For example, halfway through the project I reoriented the
Tektronix equipment where you can get full schematics and even user interface from a vertical layout to a horizontal one, as I didn’t
detailed descriptions of the circuit operation. It means you can really have enough space below the screen for the binding posts.
understand the limitations of your equipment.
The cost of the display is a factor but I bought the parts over time
We love Dave and the EEVBlog channels too. There are many so it didn’t matter too much to me. Also compared with what a
choices when you have a combination of a microcontroller and comparable commercial supply would have cost, I felt it wasn’t that
analogue circuitry - what made you settle on the Raspberry Pi? much; but maybe I have more pocket money than some!
To be honest I didn’t consider other Linux-based SBCs too much, I probably should have implemented a dial to adjust voltages/
as I was familiar with the Raspberry Pi (RPi) and quite liked the RPi current; I still might. I also thought about adding a virtual dial on the
community. display - I’ve found a Kivy widget for doing this.
The RPi was attractive for a few reasons, but initially I was thinking I probably didn’t need a display quite so big. I had (have) plans for
I could easily get networking and the ability to store data on USB for more graphic capabilities, and so the big screen was chosen with
free. I also thought I could build a user-interface toolkit targeted at that in mind.
electronic instruments. I thought it might be an interesting platform
to build other test equipment. For example, I thought of building a A PSU with live voltage and current statistics on the display? We
home-brew arbitrary function generator or perhaps an electronic load. could get behind that! What made you decide on three independent
channels?
In the end I found the Kivy Pi toolkit (https://kivy.org), and it
provided loads of useful tools. I didn’t feel the need to build a toolkit I originally planned to have two channels only, but when I was
but it might still be worth it. I’d need to do another project I think to working though details of the box and heatsinks, I found I could do
really understand what could be generalised. three. Having the analogue circuitry on separate boards makes this
relatively easy.
Just being able to program the GUI logic in Python is very nice. You
can do anything in Python. I work in Java and C++ during my day Three channels gives me the ability to configure a bipolar supply
job, but for small things you can’t go past Python. (so for example +/- 15V for some analogue circuitry), and then I still
have an additional channel for a digital supply. Also I can connect
Using USB to connect between the channels and the front-end made them in series to generate higher voltages.
life really easy. Each channel has an Atmel ATMEGA328PU that runs
the show. I used a MCP2200 USB to serial chip to interconnect I do like repairing old equipment and having three (or four if I use
these, as it is well supported by the Pi. Also using USB meant that my old supply) independent channels, as it means I can bypass the
during development I could connect the channel control boards to power supply in a piece of broken equipment and run the unit from
my computer, and just type commands at them to make them go. the lab supply for troubleshooting.
The USB hardware on each channel however, is isolated from the
rest of the channel circuitry. The Pi powers the MCP chip, and then Having the 1mA/1mV resolution gives you some interesting
the serial signals from the MCP are passed through an isolator chip capabilities also. For example it’s a neat way to measure an LED
before they go to the MCU on the channel. voltage drop, as you can set the current limit to the current you ››
›› want the LED to consume, and then you can read off the voltage. switch off the current to the bulk capacitor once it reaches a target
So to enable a limit of 20mA, and then set the voltage to say 8V, you voltage. I initially tried using Jim William’s design from AN-32,
can just read off the forward voltage drop at 20mA from the supply. which uses an SCR to delay the turn-on time at each mains cycle.
This generated a current surge as it switches at the part of the cycle
Lately I’ve been thinking about upgrading the software to implement where the current is highest. By switching off when the capacitors
a sort of curve-tracer type feature (a poor man’s SMU), where I can reach the target voltage, it is switching at the lowest current flow.
use one channel to sweep the bias voltage on the gate of a MOSFET The pre-regulator is based on a design I saw on the EEVBlog (put
(for example), while using the other channel to provide and measure up by a guy who goes by “Black Dog” and hence it became known
current through the source/drain. I can imagine other configurations as the “BlackDog Pre-regulator” although I think he shared it from
where three channels would be useful also. some other place initially).
The RPi software is pretty rudimentary right now, and I plan to add I’ve tried to measure the output noise, and all I can say is that with
more features. my measuring equipment it appears to be less than 1mV RMS. The
supply can provide 0V to 15V at 4.6A and 15V to 30V at up to 3A.
As long as it’s stable and providing good functionality, the bells It’s pretty cool being able to set the output to 10mV to play with
and whistles can come later! Does each channel have the same some devices.
capabilities?
Towards the end of the development I splurged on a bench digital
Yes the channels are all symmetrical; they are built on identical multimeter (DMM), capable of being driven from Ethernet. The
boards. You could probably reduce the size/weight/cost by using supply has a feature where you can connect the outputs to the DMM
smaller transformers for one channel and adjusting the software and put it in a calibration mode where it talks to the DMM directly.
current limits, but for me it was easy enough to make them all the The supply reads back the voltage while it steps the DACs through a
same. series of voltages. The supply then saves this data to NVRAM on the
power supply channel as calibration data. Pretty neat!
Awesome - that definitely provides great versatility. Tell us about
any special features of this power supply that may not be evident? ◄ LEFT
Tom's custom PCB.
The first thing is that the supply is very high precision. It
uses an AD780 voltage reference, which is very stable. Self-calibration (in
It uses 16 bit analogue devices ADCs and DACs, so I effect) is a great thing
can set the voltage and current to within 1mV or 1mA, to have; we’re a little
or read back the output voltage and current flow to the jealous right now! Did
same accuracy. I spent some money and bought Vishay your analogue board
4 terminal shunt resistors to measure the output current, take much revision, or
and I use fancy low-offset voltage opamps (LT2050HV) in did you nail it first-go?
the current measurement circuit. Also there are four wires
from the analogue board to the terminals, and there is a I haven’t done much board design so this was
differential voltage amplifier to measure the voltage at the definitely a learning experience! I started in the free
terminals, which eliminates voltage drops in the internal wiring. Altium Circuit Maker when it was in Beta. I really wasn’t having
much fun there and so switched to KiCAD. I love that KiCAD runs on
The voltage control loop is pretty quick. Keysight usually specify a my Mac and on my Linux computer. Last time I used anything like
settling time of 60 microseconds from a 50% change in load. I have this it was called Protel. I quite enjoyed getting the hang of KiCAD
measured less than 20 microseconds of settling time when the load overall.
switches from zero to full load.
So in the layout I have a digital section where I use a ground plane
It is a linear supply so the design has to manage heat. The design pour to reduce noise. In the analogue section, the grounding is
uses a MOSFET as the pass element, to reduce the required voltage more important so I run ground traces more deliberately. I wasn’t
drop. It also uses a pre-regulator to manage the voltage on the sure what size traces to use for the current requirements and so
pass transistors and thus, to reduce heat losses. Transformer tap have probably overdone this. It does make layout pretty hard when
switching is used when switching voltage ranges, although this is they’re big. The power devices had to be at the back to get to the
more about increasing the current output at lower voltages. heatsink, and with the outputs at the front, I needed strong current
paths between the power devices and the outputs. The digital had
The supply is designed to be very low noise on the output. Rather to be separate from everything else.
than using a switching pre-regulator, the design uses MOSFETs to
I did two revisions of the channel board - so many things went The analogue circuitry runs off 44V in 30V mode, and 28V in 15V
wrong! I stuffed up the footprint of the MCP2200 chip; it was a wide mode (transformer taps). The relay runs off 24V so I had an LM317
SSOP where I used a standard. One of the small SOT-3 transistors that provided this. I underestimated the heat this would generate
had the wrong pin ordering, so I had to bodge in a through hole for and used a surface mount LM317 in the first revision. In the second
testing. And I forgot the diode across the relay, so it would reset revision I used a TO-220 on the heatsink.
the whole board when it switched transformer taps! Another rooky
mistake was my footprint for the MOVs (they ensure the output I was using Welwyn wire current shunt resistors to measure the
never goes above 250V) and the PTC (to limit the current in case of output current. But I found a problem in that they would significantly
failure) were backwards. They are asymmetric (point-symmetrical) drift as they warmed up. I was surprised by this, as their datasheet
but I misunderstood the datasheet, so the layout would actually says they have a low tempco. I figured out later it was the thermo-
have been correct if I’d soldered them onto the bottom of the board! electric effect and it was voltage drop on the solder joints. They
I also didn’t implement the reset circuit correctly either, so some would have been fine at higher currents, but 1mA equated to 10uV
of the SPI hardware didn’t get reset. In hindsight, I am amazed this at the shunt and I was seeing 25uV of drift. This totally blew my
worked! But the fault would cause programming of the micro to fail accuracy budget.
occasionally.
In the second revision I figured out the box layout more, and
The biggest problem however, was getting the grounding right. The changed the board from having a narrow edge on the heatsink to
current shunt really has to be the ground for everything to work having the long edge on the heatsink. This reduced the lengths of
correctly, and for the output to be accurate. Small resistances in high-current tracks, and kept things together more. I also got a bit
the ground traces cause significant errors. The second revision better at the layout process, so the board came out more densely
improved this, but I still don’t think I nailed it. The first version would laid out. ››
wander by a few mV as the load increased.
›› Some valuable lessons in there, but an amazing effort for I originally designed the supply to provide sense terminals as well
someone without much board design experience. If you had as output terminals. The problem was I just couldn’t make this
your time again, starting from version 1.0 - what would you do stable if the leads were even 30cm long. Getting this to work would
differently? be a great feature, especially when coupled with the supply’s high
accuracy.
The biggest issue is that the UI is far too slow. I use a text protocol
between the Pi and the channels and I think I need to slim this Some great upgrades to tackle in the future. At least with the Pi
down a bit. I will probably fix this soon. This is also why I’ve not yet your software upgrades can be trialled in-place. What is the next
implemented an encoder or virtual dial - it would be too confusing amazing project you’re working on?
right now.
Alas, work has me pretty occupied at the moment! But I’m slowly
I’m also having problems with the brown-out detection on the working through the restoration of a Phillips 115B valve radio from
micro-controllers inside the power supply channels, which randomly the 1940s for a friend. Valves are quite fascinating, although the
screws up the calibration. I think it would be better to have the Pi circuitry terrifies me! Tag strip construction with 300V! I think it is
store this data, and poke it into the channels at start-up. pretty amazing that they can make a superhetrodyne receiver with
just four or five valves.
I think if I were designing the channels again from scratch, I would
change the voltage regulator design. Using an N channel MOSFET I have a long list of things I’d like to learn about next, including some
as the pass element means the gate voltage must be a few volts RF circuit design.
above the output. This then means the analogue circuitry and the
gate needs to run at this higher voltage, and so the opamps are all Well it sounds like we’ll be seeing some great projects from you in
40V parts. This limited my choice of parts and made things more the future. Congratulations on your power supply, and thanks for
complicated. sharing it with us. ■
If I was doing this again I would also use a floating bipolar supply WANT MORE?
for the analogue control circuitry, and make the positive output For the circuit diagrams and code files,
the ground for the control. This way the control circuit rides on the or to discuss this feature, visit:
output voltage, and never needs to be more than a few volts above https://diyode.io/004xpbk
“ground”.
Featured builds are also in the running for the $250 prize
for Editor's Favourite - we'll pick one each issue!
Part 2:
SAM v1.1
Upgraded Senses
In Issue 3 we built a basic obstacle-avoidance robot named SAM (Somewhat
Autonomous Machine). This month we’ll continue this project to give him
some more intelligence and a lot more personality. - by Oliver Higgins
›› HOW IT WORKS a side-step arc around the object. If it does not detect anything, it
checks the right-hand sensor, repeating the while loop if required,
ULTRASONICS before looping back to the first statement. Each while loop is
governed by the distance to the object, so while ever the ultrasonic
One of the main issues we faced after SAM’s inception was that sensor in question finds an object too close, it will continue to make
while he worked very well at undertaking his mission, he was not adjustments.
particularly smart when it came to driving. The only input was a very
simple question: “is there something in front of me and how close
is it?” And his response was “if it’s close enough, then I’m going to while (pingLeftSonar() <=
The two issues SAM faces is that he does not always drive println(pingLeftSonar());
could implement a GPS unit that will provide a constant heading, while (pingRightSonar() <=
allowing SAM to use his ultrasonic sensor to avoid things in front objectDistanceRight) {
follow, but the magnetic interference from the motors can cause println(pingRightSonar());
allow him to move the ultrasonic scanner from side to side, although }
A simple and cost effective solution is to add two more ultrasonic The above code calls the pingLeftSonar() during each while loop.
sensors. We will set this up as a polled operation, and it will The function returns the current distance that the ultrasonic sensor
continue to scan the surrounding environment to see if there are any is reading. If it is less or equal to the defined distance variable, we
objects nearby. call the slowLeft function, which will slow the motors and cause
SAM to make a side-step or turn. The slowLeft function (below)
30° V 45° V 90° is identical to the forward function with the exception of the
analogWrite (ENA, motorSpeed) line. In this line, we have used a
This revision has placed two additional ultra sonic transducers on simple multiple to slow the motor down – 0.25 will reduce the motor
SAM’s sides, to enable him to see what is to each side of him, and to 25% of the motorSpeed variable.
to allow him to side-step objects rather than stop, back up and turn
around. We tested 30, 45 and 90-degree angles and found that the The other addition to all of these functions is the printByte function,
45 seemed to give the best compromise. Be mindful that to detect which we will discuss next. This is repeated for slowRight function,
an object it needs to be parallel to the ultra sonic sensor to reflect but the multiplier is added to the analogWrite (ENB), thus slowing
the sound waves back. We have included some variables that can be the alternate motor pair on the chassis.
changed to help refine this process.
SAM’s original logic tree was simple: if an object gets with 20cm printByte(hmmmL);
then stop, wait, back up, wait, turn, wait, then go forward. While Serial.println(“SL”);
this met the brief, it is fairly simple in its logic. The new brief we digitalWrite(IN1, HIGH); // Turn HIGH motor
them. The logic remains the same for the obstacle avoidance, with digitalWrite(IN2, LOW);
his front facing sensor, but we have the addition of the two extra analogWrite(ENA, motorSpeed * 0.25);
sensors. Using these we scan each side individually and react based digitalWrite(IN3, HIGH); // turn HIGH motor
sensor. We then use this information to slow one set of the motors digitalWrite(IN4, LOW);
on the chassis enabling the turn. This is achieved in a very simple analogWrite(ENB, motorSpeed);
way. The main loop now has three conditions: the first is a simple }
“if” statement for the object in front, which triggers the stop and
reverse. The next condition is a while loop. This loop checks the
left-hand sensor, and if anything is within the set range, then the
right-hand pair of wheels are slowed down to 25%, thus instigating
LED MATRIX
COLUMN
STOP SOMETHING SLOW RIGHT
1 2 3 4 5 6 7 8 LEFT?
YES
1
BACK UP
NO
2
3 STOP
SOMETHING SLOW LEFT
4 RIGHT?
ROW
TURN YES
5
NO
7
To send this to the matrix-encoding chip we send it one byte at a
time, and each time we index the row that we want it to be. To do
this, we use a simple for loop, and loop through it eight times, since
8
as we have eight rows.
5 = 0 x 81 = 10000001
6= 0x42 = 010000010
7= 0x32 = 00111100
void printByte(byte character [])
{
LEDs. We feed the data to the matrix one byte at a time. Each byte for (i = 0; i < 8; i++)
›› THE BUILD
ORIGINAL SAM PARTS LIST FROM ISSUE #3: Please extract and place in the libraries folder of your Arduino IDE
installation.
PARTS REQUIRED: JAYCAR ALTRONICS
1 x Arduino UNO XC4410 Z6240 In setting SAM up, you may need to fine tune the sensitivity settings.
1 x Ultrasonic Module XC4442 Z6322 You can do this by adjusting the three object distance variables.
1 x L298n Motor Control Module XC4492 Z6343 These are integers and are representative of centimetres. SAM
1 x Chassis & Motor Kit KR3162 K1092 V1 had the objectDistance variable set at 20cm. In testing we
1 x 8AA Battery Holder PH9209 S5034 found that the longer distance would prevent the side sensor from
8 x AA Batteries SB2333 S4955B triggering so, we have set the defaults at 15cm for the front and
30cm for the side pods. This should mean that any object off to
PARTS LIST FOR V1.1: the left or right should trigger the function to make him side-step
the object before the main sensor causes him to halt. This is very
ADDITIONAL PARTS REQUIRED: JAYCAR ALTRONICS dependent on the range and angle of the object itself.
2 x Ultrasonic Modules XC4442 Z6322
1 x 8x8 LED Matrix Module XC4499 Z6362
// defines variables
1 x Updated 3D Printed Caddy - -
long duration;
If you have already built the first version of SAM, then the hook up int objectDistanceLeft = 30; // distance in cm
is quite simple. We have two additional ultrasonic sensors to add to int motorSpeed = 128; // 0-255
As the unit is based on the UNO R3, we will be very close to having Note: make sure the batteries are fresh. Low batteries may result in
every GPIO pin used by the end of this project. As such we have false signals with the ultrasonic sensors.
run out of GND and 5V pinouts. A simple solution is to use a small
breadboard which has power rails to expand the connection points WHERE TO FROM HERE?
available.
We are starting to reach the physical limits of the Arduino Uno,
The chassis has been modified to allow the additional pair of with only three GPIO pins left to use. We will address this in the
Ultrasonic sensors and have them set off at a 45° angle relative to next iteration. However, the software provided with SAM is quite
the main sensor. We have also raised the main sensor up high to simple. Currently, the code is very block-driven; it checks a sensor
allow for the LED matrix underneath. Please note that due to the and immediately implements a function. This means that it will
addition of the extra ultrasonics and the angle they sit on, it is now always favour an object on the left before it evaluates an object to
very difficult to program the Arduino Uno while it is attached to the right. A more intelligent way to address this would be to get the
the chassis (the USB port is obscured). For this reason, make sure data from all three sensors and evaluate them based on values and
you have the jumper on the motherboard off, and program the UNO tests before implementing an action for avoidance. What if there is
before you attach it. The LED matrix is a very snug fit if you are using an object left and right? SAM could evaluate the distance and adjust
the module. Due to the encoder IC, you will find the unit just goes the speed multiplier on the fly, to create smaller movements and
past flush on the print. You may find bending the input pins will also keep on track. ■
help to ensure clearance. The two additional ultrasonic sensors are
much easier to work with if you place them upside down, and they WANT MORE?
will work just as effectively in either orientation. For additional media, code files and 3D modelling,
or to discuss this project, visit:
THE CODE / SETUP / OTHER https://diyode.io/004kmyy
GOOGLE VOICE
ASSISTANT
WITH RASPBERRY PI
It's no longer strange to talk to
your computer... - by Rob Bell
As a kid growing up, I was fascinated by the potential for voice exceptionally well. Whether it’s a Google, Apple, or Amazon product,
control. In fact, even VOX (voice operated relay) CB radios had me voice commanded technology is improving every day. With the
intrigued. Such a simple thing captivated my imagination from a inclusion of machine learning, we’re going to continue to see
young age. improvements at a rapid pace, while the voice command blooper
reel will continue to shrink.
In the 90s I was fortunate enough to get to experiment with what
was rather advanced software for its time. Not only could it translate HOW CAN YOU LEVERAGE VOICE CONTROL?
speech to text (which seemed amazing in itself), but it could
open and close applications, and control the operating system in Google has long provided API access to some of their greatest
some amazing ways. Of course, back in the day, it was shareware, technologies, which is fantastic. They develop ideas with billions of
probably on CD (I think we’d progressed past floppy drives, but not dollars of backing, that we could rarely dream of achieving on our
as far as CD burners). Out of curiosity I recently ran a Google search own; rather than making the system proprietary and hiding it behind
for INCUBE, and it returned a few parts of the internet that needed an expensive corporate fee,
dust blown off them! But I digress...
Sure, just as INCUBE did in the 90s, it is indeed possible to create
Back in those early days of the internet, multimedia was an a useful, voice recognition system that’s self-contained. Though if I
emerging buzzword. But there were a few serious limitations: recall correctly, INCUBE required configuration of voice files to get
RAM was counted in the kilobytes, soundcards had limited quality, things running, so it could learn your tone of voice. I don’t think it
computers had clock speeds in megahertz - the technology was required individual voice commands to be recorded for every single
really letting the concept down. It was ahead of its time, and for action, but there was a reasonable level of setup (it was cutting-
many years voice technology stayed on the fringe. edge at the time though, let’s not forget that).
Now, we know how clear and accurate voice commands can This is where the Google Assistant SDK comes in. You can leverage it
be. Sure, we could create a feature film around what Siri on just about any piece of hardware capable of running Python with
doesn’t understand, but the reality is that this technology works fantastic speed and accuracy.
GOOGLE ASSISTANT WITH RASPBERRY PI While it’s unlikely to yield anything substantial (it’s a computer,
remember), it’s fun to hear two machines talking to each other, even
Where hardware-interfacing computers gain a huge advantage, if for a brief period and about nothing in particular.
it’s clearly the GPIO. Raspberry pi is a logical choice for a Google
assistant project, but in reality you can use any board you like What would be more interesting to investigate however, is creating a
which can run Python. As long as you have WiFi access to your pi, set of environment sensors and conditions which create a platform
you could create a voice-commanded robot to follow your every of discussion for these two sensorless devices. Providing them with
command. real world input about the current temperature and humidity, could
we then spark a conversation about the weather?
If you’re really game though, all you need is internet access, so it is
possible to use a 3G module or similar if you need access outside Of course, we can add real questions and answers, and follow-up
of a WiFi network. The data demands are reasonably low so you’re questions as part of the Google SDK; coding a false-intelligence into
not going to blow through your data any faster than a few cat videos them is achieved rather easily. But this isn’t really the point, and
and LOLs will! represents no artificial intelligence outside of the precise speech
patterns themselves.
But let’s just consider what ramifications this has for hardware.
You can effectively voice control ANYTHING. Lights on? Sure. Door WHERE IT’S HEADED
open? Definitely. Turn on the TV? You bet. Of course, the applications
need to be ones that aren’t critical or where safeguards need to As the technology improves and continues to evolve, it’s likely
be employed. For example, if the voice assistant mishears you that we’ll see more comfort and social acceptance around voice-
and suddenly your robot is running away forever, it’s probably commanding computers. Even though it’s more commonplace now,
not running so fast that you can’t catch it. There are loads of talking to your phone when there’s not an actual human on the other
creative ways to use it, where failure of the system won’t have any side of the conversation can still feel a little awkward when there
catastrophic implications. are others around. Saying “hi mate, how are you?” is still far more
socially acceptable than “OK Google, what’s the weather like where
CREATING COOL STUFF I’m going?”.
We have our first project this month using the Google Assistant. This paradigm of machine-response to speech is becoming
It integrates MQTT protocol, so you can remotely control anything ubiquitous to machine interactions however. So commonplace, that
you could action with the MQTT system. However next month we’ll within a few years you can probably “tell” the parking meter that you
look at some more simple voice-command functionality that you need to pay for parking, and it’ll know who you are from your speech
can get started with, in order to play around with the functionality. patterns.
Even from an experimentation process, simple functionality such as
turning an LED on or off, playing music via the raspberry pi’s audio There’s no telling when the general social attitude to talking aloud
output, and many other simple projects take on a whole new life to your devices will be come as universally accepted as talking to
when voice commands are added. another human via your phone, but I’d suggest that we’re closer
than you think. Until then though, go ahead and create a raspberry
WHAT ABOUT THE MIC? pi virtual assistant, and have a play with the system. It’s easier than
you think, and loads of fun! ■
Those of you familiar with the Raspberry Pi will know it doesn’t have
a hardware-level native microphone input. This doesn’t present GOT SOMETHING TO SAY?
much of a problem however. USB sound cards are an easy go- To discuss this edition of What The Tech, visit:
to option. You can also use a USB webcam you might have lying https://diyode.io/004vscx
around, which often has an audio input. Google Assistant won’t
access the camera portion, but it provides a USB audio input for
your Raspberry Pi - problem solved.
HALLOWEEN?!
MODDD! YOU'RE
GETTING OLD ...
YOU'RE
OBSOLE
TE!
MODDD!
OBSOLETE?
SWEET
RETRO!
HEY OL'
TIMER!