Download as pdf or txt
Download as pdf or txt
You are on page 1of 125

YOUR ELECTRONICS MAGAZINE • BUMPER EDITION

124
PAGES!
SPECIAL BUMPER
AUGUST ISSUE

INTRUDER
ALERT!
BUILD YOUR
Issue 002
Aug 2017
AUS: $9.95 inc. GST

ISSN: 2207-8045
02

OWN ALARM
9 772207 804002

SYSTEM

CHECK OUT WHAT CREATE UNSW LEARN MORE EXPLORE GUI


MADE FOR VIVID WITH SECRET CODE WITH YOUR RASPBERRY PI
This 2,000 member maker Get decisive as we show you how Use interactive controls to make
group makes it happen. to use logic in your programming. intuitive hardware interfaces.
Reinvent your
energy
With clean, reliable solar energy and Tesla Powerwall 2,
Bradford Solar puts you in charge, day and night.

Call a Bradford Energy Concierge on 1800 332 332

Calculate your solar savings at bradfordsolar.com.au


DIYODE Magazine
Takes Flight
In barely the blink of an eye, DIYODE Magazine has gone from
concept to reality, and before I know it, I’m sitting here writing my
editor's letter for Issue #2.

We have received an astounding response to our new publication.


You, our readers, are exceptionally passionate and enthusiastic
in this space, and that enthusiasm has crossed over to DIYODE
Magazine now too. You’ve taken us in and embraced us as part of
your world. It’s something we hoped for, but could never accurately
predict. For this acceptance and embrace from you all, we’re
irrevocably grateful.

We have so much amazing content that Issue #2 has been bumped


from 100 to 124 pages, just for this month, so we didn’t have to
leave anything out.

We’ve listened to your feedback with great intent. After seeing


the first Issue fresh off the press, we’ve made some adjustments
to fonts and colours to help ensure all of you can read it. We will
continue to encourage feedback on everything we do, so we can
grow and improve. Ultimately we do the steering, but you all have
EDITOR-IN-CHIEF DIYODE MAGAZINE IS the proverbial foot on the accelerator. If you aren’t getting the
Rob Bell AN INDEPENDENT PUBLICATION.
magazine you want to see, we won’t go anywhere.
EDITOR Published by B.E. DIYODE Pty Ltd
Analee Gale
ACN 616 556 622
As we start to find our groove on this epic journey of publishing, one
TECHNICAL EDITOR ABN 50 616 556 622 thing impresses us above all else. That one thing is you, our readers.
Bob Harper
Yes, I know; sounds a little corny. But it's true. Your stories, projects,
Level 1-2, 156 Mann St,
STAFF WRITERS Gosford NSW 2250 Australia prototypes, business ideas, and electronic adventures are what
Oliver Higgins
Daniel Koch
inspire us to do this. We have 10 features showcasing what you
© 2017 No part of this publication may be
Tim Blythman reproduced without written authorisation. All have done, and it's an honour to share your stories.
contributed content is owned by the authors
PROOFREADER and reproduced with permission. All product
John Bourne names, logos, and brands are property of their While we're publishing from a small city north of Sydney, Australia,
respective owners.
CREATIVE LEAD
our humble efforts have been subscribed to by readers in over 30
Jennifer Holland Printed by PMP. countries, and not just for the digital version. We are sending print
CREATIVE &
editions of DIYODE Magazine to most of those countries too.
Newsagent distribution within Australia
DIGITAL TEAM managed exclusively by Gordon & Gotch.
Luke Parsonage
Kayla Gourlay
Locally where DIYODE Magazine can be purchased at over 2,000
ISSN: 2207-8045
Melanie Heard locations around the country, you've made your demand felt. While
Mike Lewis Print subscriptions are available to Australian
Danielle Bell
we don't have final sales figures for Issue #1, you have made it
residents for $9.95 per issue inc. GST. See
Jacqui Creasy diyodemag.com for international subscription clear you want it. You've stripped the shelves of DIYODE at dozens of
pricing.
CONTRIBUTORS
locations around the country, demanding more. As demand grows
Ray Abram All prices quoted in AUD including GST unless internationally, we have commenced discussions for retail options in
CREATE UNSW noted otherwise. All prices are correct at time
Paul De Groot
the USA and Canada, which we hope will come to fruition.
of printing and subject to change without
Tishampati Dhar notice.
Mike Field
Thanks for starting the journey with us. We hope you're enjoying it
Liam Lacey ADVERTISE WITH US
Arjen Lentz media@diyodemag.com as much as we are. If this is your first Issue of DIYODE Magazine,
Robert Rozée
remember to register on our website for all the additional resources
Graeme Rixon CONTACT US
Peter Mather help@diyodemag.com and discussion.
Geoff Graham +61 2 4326 0160
Ben Wang
FOLLOW US Rob Bell
@diyodemag

4 Issue 002 August 2017 diyodemag.com


FREE DIGITAL EDITION
WITH PRINT PURCHASE!
GET ADDITIONAL RESOURCES
Digital resources are available online, via the links we publish at the end
of each article. If you're a subscriber, you'll automatically gain access to
all articles via your online account. If you have purchased a print edition,
you can create a login and unlock these resources for free.

ACCESS YOUR CONTENT


Just go to diyode.io/002digi and use the access code below.

ACCESS CODE: 941671


66 78

58

86

91

24

6 Issue 002 August 2017 diyodemag.com


50 FEATURES:
■ R ETRO ELECTRO
Toy Piano turned Digital Synth 14
■ ENHANCED LASERS
Improving a Cheap Laser Cutter 30
■ DANCING IN THE (LED) LIGHT
Making Great Use of NeoPixel 43
■ VIVID IMAGINATION
Interactive Light Installation 50
■ MIGHTY MICROS
Prototype to Production 70
■ CREEPY CRAWLIES
A Robot Without Wheels 86
■ BUILDS BEFORE BEERS

104 3 Products Before Graduation 91


■ SAFE 3-PHASE GENERATOR
A Clever Solution 100
■ DIGGING FOR SATELLITES
Looking Hard at GPS Signals 108

EDUCATION:
■ FUNDAMENTALS
Securing Success with Soldering 24
■ SECRET CODE
Introducing Variables & Logic 46
■ THE CLASSROOM
AC/DC Rocks On 66
■ MICRO-EXPLORERS
Introducing the ESP8266 118

14 PROJECTS:
■ T WEET THE WORLD
Arduino-Powered Twitter Feed 34
■ SUPER SIZE ME
Van De Graaff Generator 58
■ PART 1: ALARMDUINO
Build a Powerful Alarm System 78
■ RPi GUI INTERFACE
Introducing Interactive Controls 94
■ MODEM RESTARTER
Automatic System with ESP8266 111
118 70
■ E DITOR'S LETTER
DIYODE Magazine Takes Flight 04
■ NEW & REVIEWED
Micro:bit, Arduino Box & more... 08
■ MOONSHOTS
Natural Server Cooling 22
■ GOING PRO
Obelisk Systems & the StarLAB 104
■ SUBMISSIONS
Community Contributions 120
■ THE ADVENTURES OF
CIRCUIT MODD 122
diyodemag.com Issue 002 August 2017 7
NEW & REVIEWED

Grab it Now:
BBC
micro:bit
The BBC micro is one of the quintessential parts of modern PC
history. It was devised as a learning program for schools in the UK
during the early 80s. The key premise of this was to teach students
the fundamentals of computers and how they worked. While the
BBC micro has well passed its useful time, the ARM processor core
that drove it, now forms the basis for modern systems such as the ABOVE ▲
Raspberry Pi, Microsoft Surface, iPads and your Nintendo DS. micro:bit board within the :MOVE mini buggy kit.

Fast forward 35 years and you have a world where everything is This was quite clever in my opinion; he was intrigued straight away.
connected to everything. The phone in your pocket is capable of With a functional unit we elected to plug it in via the USB cable and
millions of calculations per second, all to show you videos of funny start some code. 
cats on YouTube. While the original BBC never took off in Australia
the next generation has just landed. It's been in UK schools for one SOFTWARE
year, and we now have Australian distributors. 
The coding environment is block-driven and is very similar to
HARDWARE Scratch. We pottered for a few minutes and worked out how to
create the Hello World app. The unit is platform-independent and
On the surface, the micro:bit is quite small. We expected an creates a .hex file which is downloaded to your computer. We had
Arduino-sized unit, but it is even smaller at 43mm x 52mm there are to drag and drop the file from its download location to the micro:bit
no outward connectors or header pins, just a micro USB and battery which had shown up as a drive on the machine. The unit reboots
interface. The front of the unit has two small micro switches, a 25- itself and executes the program.
LED matrix, and a series of five large holes in the bottom that act
as interface pins. This forms part of a greater 23-pin interface. The The software is straightforward to navigate and offers one of the
holes are designed to easily accommodate banana plugs or alligator best board simulations I have ever used. You can program and
clips. test in real-time without the need for a unit to even be connected.
We gave the control over to Master 9 who undertook the paper,
The unit itself is based on the 16MHz ARM Cortex-M0 32-bit scissors, rock tutorial. It required us both to work through a couple
processor with 256k Flash and 16k RAM. The unit supports of small issues, but most were understanding what code blocks
Bluetooth LE, accelerometer, magnetometer (compass) and USB were, and where and how we needed to replace them. Code blocks
connectivity. Going beyond the basic 5-hole interface and using the are all represented in different colours, and it does not take long
23-pin connector gives the user access up to 3 PWM outputs, 6-17 to understand what belongs where. Within a few minutes, he had
GPIO, 6 analogue inputs, serial I/O, SPI, and I2C. All powered by 2 completed it and uploaded it to the unit, madly shaking it to play
AAA batteries. paper, scissors, rock.

OPENING THE BOX He was engaged now and feeling accomplished. We set him a few
tasks such as making the LEDs come on with the buttons. Within
The box is quite small and well packed. It contains the micro:bit, just 30 minutes he was able to create code that could read when
battery holder, 2 x AAA batteries, USB micro cable and a quick start the unit was tilted and to display varying icons based upon the
guide. Setup was quite fun. This was done with a 9-year-old and inputs. His 7-year-old sister also wanted in, so we handed the
involved shaking the unit and playing some mini games to set up. teaching duties over to the 9-year-old and in under 10 minutes

8 Issue 002 August 2017 diyodemag.com


NEW & REVIEWED

he was able to guide her through Hello World, button inputs and When we first saw this we thought it was cute but was not likely to
outputs, and how to upload to the unit. With further exploration she be as purposeful as the Arduino system. It's not, but it's also not the
discovered she was able to increment a variable based only when same thing. For the purpose it was designed for the micro:bit is one
the unit was tilted left, and then display the information by pressing of the best learning and teaching devices we have used. It doesn't
a particular button. take long to realise that even using the JavaScript block editor, you
have a very powerful tool at your disposal. Highly recommended
The software is based online but once loaded can be reloaded from the DIYODE team! Want to see more projects based on the
offline (according to their documentation). There are various micro:bit? Let us know. ■
versions of programming languages to use. We only used the
JavaScript block interface; it is easily switchable to a JavaScript Want it now? Grab it online from:
code interface. There is also a Python-based editor for those who https://tronixlabs.com.au/bbc-micro-bit-australia/
wish to dive even deeper into the abilities of the unit.

They also offer an iPad app that allows you to connect to the unit
via Bluetooth and upload/flash your micro:bit. It opens a version of
the JavaScript block editor in Safari. It uses a touch interface and
although effective, it can be a little frustrating at times.

TEACHING RESOURCES

The micro:bit website has one of the best teaching libraries we have
seen, with resources provided for both students and teachers.
The 9-year-old could easily follow the
instructions to create some of the games.

:MOVE MINI BUGGY KIT

The :MOVE mini buggy kit shown opposite


is great fun to build but it's not a project
for little hands. It took an adult about an
hour to get it together and tested with the
example codes provided. Once assembled it
does provide quite a lot of fun experiments,
using the onboard sensors and Bluetooth
interaction. It can also be controlled by a
second micro:bit so you can tilt to go left
and right. It includes the five RGB LEDs
which is NeoPixel compatible, and supplies
power to the two servos supplied to drive
the buggy. The board can also be used as a
base for other robotics projects.

CONCLUSION

Of all the microcontroller boards we have


used, this is the one that opens the gateway
to understanding the dynamics of the
microcontroller world. The kids involved in
this review were able to easily grasp the
concept of "if" statements, variables and
event-driven logic within a very short time
frame. 

diyodemag.com Issue 002 August 2017 9


NEW & REVIEWED

Prototype like a Boss:


Threadboard
We recently came across this great prototyping product, Made in Australia, it’s a quality product that’s likely going to last
and had to take a closer look. your entire life. There are a few different versions available, the
major differences being the hole count, and the base material.
We have all had those complicated projects. You know, the one Available in aluminium (needs no introduction) or HDPE (high
that starts with a humble few jumper wires. After a short time you density polyethylene), both are durable and very high quality.
end up with 1000 lines of code on an MCU, two breadboards, 14
modules and 184 jumper wires, and you wake up the next morning There are two hole patterns: the 50-hole and 130-hole patterns.
wondering what happened and how it got there. Both will mount your microcontroller, a breadboard, and some
accessories, but the 130-hole pattern provides additional flexibility
Moving the code is easy, but what happens if you want to move the in mounting. Each hole is drilled and tapped with an M3 tap for a
prototype? Usually it’s a ballet of holding things with both hands, precise thread, so you can use the included hardware or affix your
balancing, twisting, hopping, doing anything to successfully get it to own too.
its destination, which is often just a few feet away. Surely it doesn’t
have to be that difficult, right? They’re just entering the market now, and we’re confident they’ll
become a staple prototyping tool for us here at DIYODE. Rarely a day
That’s where Threadboard comes in. We spoke to Jason Tolley, the goes by when we’re not dealing with breadboards, and rarely a week
creator of Threadboard, who's excited to bring these great products goes by when we unintentionally destroy something trying to move it
to the maker community. from one desk to another!

Threadboard provides a universal mounting for your Arduino or At the time of writing, some packages are being put together, so you
Raspberry Pi, as well as a whole bunch of accessories. By firmly should be able to find them at some of your favourite retailers very
securing your hardware to the baseplate, you’re far less likely to soon. ■
unintentionally pull out a jumper, short out a power supply, or do any
number of soul-crushing, smoke-releasing, hair-pulling things that Want it now? Grab it online from:
can take your prototype from perfection to paperweight in the blink http://threadboard.com
of an eye.

10 Issue 002 August 2017 diyodemag.com


Win!
ENTER NOW
FOR YOUR
CHANCE TO

TO ENTER
Head to diyode.io/002nfgh and
tell us in 50-words or less what
you could make with a new Dremel
Maker Kit! Entries close
1st September 2017!

See diyodemag.com/terms for all T&Cs.


AVAILABLE
FROM TOTAL TOOLS 
FOR $199

DREMEL 3000 SERIES ROTARY TOOL 2


 90 ENGRAVER WITH ACCESSORIES 2000 VERSATIP

Sanding wood, polishing metals and cutting Thanks to the 290 Engraver and You’ll make all your projects a flaming
plastic is a breeze with the Dremel 3000 accessories, you can personalise all your success with this open flame torch. Ideal
Series Rotary Tool. Complete with a 130W future projects! This easy-to-hold appliance for joining wire and heating heat-sensitive
motor, integrated hang hook and EZ Twist can be used on a wide variety of materials, materials, the 2000 VersaTip’s large tank
nose cap for fast accessory changes, this and features a reciprocating action for capacity also ensures optimal and extended
DIY tool ensures your kit is ready to tackle optimal control, ensuring you can carve your use.
any project. initials onto almost anything and everything!
NEW & REVIEWED

Spotlight on:
ALTRONICS’
ARDUINO MEGABOX
Giving ‘Duinos a Home
The folks over at Altronics are doing some pretty amazing things LCD, as well as two 2A relays! With some clever insight, they haven’t
in the maker space. Their new Arduino Megabox takes DIY device taken any flexibility away from you though - everything is broken
building to a whole new level, providing a method to create a out to headers, so there’s no restriction on how they’re assigned to
finished product with your Arduino prototype. your Arduino (meaning you can omit them if you don’t need them).
Everything provides built-in resistors so you can connect straight
Just as many of us will remember when building DIY kits in years from 5V without worrying about current-limiting yourself. There’s a
gone by, the case was often the part that was most difficult to get handy 210-hole prototyping area for soldering various connections
looking good. With Arduino projects, this problem certainly hasn’t too, making this a VERY versatile box.
gone away. The team at Altronics have carefully considered what to
include in this case, to provide versatile and functional options. Like These cases are in the final stages of development at the time of
any product such as this, it won’t suit EVERY project perfectly, but writing this, so will vary slightly from the unit we had, but for the
it’ll certainly provide a solid option for many. better. The tactile switches will upgrade to DPDT, more terminal
access through the case, and some other improvements are
To start off, it will fit an Arduino UNO or Mega, which plugs straight coming as well. ■
into the custom-developed board. It cleverly provides breakouts
while still retaining header access, and additional access to connect Coming soon to Altronics:
a shield (Ethernet, WiFi, prototype, whatever you like). The case then http://altronics.com.au
includes four illuminated tactile switches, a rotary encoder, a 2 x 16 K9670 $75

12 Issue 002 August 2017 diyodemag.com


NEW & REVIEWED

Getting Testy:
Mooshimeter
It’s not every day something new comes along in test equipment. relationship of current draw to input voltage as a battery discharges,
OK, so maybe it almost is... but rarely does something stand out to test for output changes as a power supply heats up... do we need to
us like the Mooshimeter. Mooshimeter has actually been around for go on? You might be able to tell, Mooshimeter had us at hello!
a few years, and has now been tried and tested.
Dual-channel measurement is a powerful and useful feature! With
It’s a fairly unassuming piece of test equipment on its own, but CATIII 600V protection, it’s suitable for all sorts of environments.
pair it with your smartphone or tablet, and you unlock a world of Mooshimeter doesn’t just take care of the here and now though...
potential. Using a simple Bluetooth connection, Mooshimeter takes it can be used as a powerful data logger. Simply insert your
advantage of your iOS or Android device for data display. Having a favourite microSD card up to 32GB and you’re ready to go. The
huge touchscreen to control everything then makes things really accuracy is respectable and while it may not compare to some
easy! The addition of it being wireless (with a range of up to 45m) top-shelf equipment, it’s still going to provide accurate data in most
means you can safely leave it in your test environment, while applications. It does all that while still providing all the awesome
measuring from a safer location. This is especially useful in high flexibility we just noted. ■
voltage environments or confined spaces.
Want it now? Grab it online from:
It might look a little like a toy, but looks can be deceiving. It’s made https://core-electronics.com.au/mooshimeter.html
from high grade Polycarbonate plastic, and inside is a 24-bit ADC, CE04630 $215
which provides high resolution data. What’s more, it’s actually a
dual-channel multimeter. This means you can test, say, voltage and
resistance, or voltage and current, at the same time! Doesn’t get you
excited? Let’s think about what that actually means... monitor the

diyodemag.com Issue 002 August 2017 13


FEATURE

Retro
Electro ▲ From a basic vintage
toy piano to an electronic,
LIAM LACEY
polyphonic, super
Head of Development, Modal Electronics, UK awesome synthesiser. ►
http://liamtmlacey.com
@liamtmlacey

Liam took a kids toy piano and turned samples were eventually released as a commercial sample library,
it into a powerful music machine. One co-developed by Ali and Impact Soundworks.
thing’s for sure - this isn’t a toy anymore!
THEN... In 2015 I undertook a second toy piano project, this time at
a music technology hackathon in Berlin called MIDI HACK. Here, I
converted the piano into a simple USB-MIDI controller. From this 24-
Have you ever seen a used mechanical toy that’s been entirely hour project I was awarded a prize from one of the event sponsors,
gutted and redeveloped into a powerful synthesiser? With a sleek and this spurred me on to think about how I could extend the project
laser-cut top-panel, handmade velocity sensors, and a host of into something more advanced.
customisations, it looks truly amazing; and while the black keys
might just be paint, that’s where the pretending stops. In my day job I work for Modal Electronics (UK), who make hardware
synthesisers, so the work I do with them ultimately inspired me
We’ve seen plenty of retro computers, Game Boys and other vintage to see if I could incorporate the same kind of ideas, but within an
hardware converted into new things, but this is quite a unique existing vintage toy piano.
idea because you’ve taken a kids toy piano and converted it using
modern electronics. Did you find the toy or was it something you ULTIMATELY... The main thing that pushed me to physically start the
had growing up? project was the announcement of the Element14 Music Tech Design
Challenge. After submitting a project proposal I became 1 of 15
This particular toy piano was one I purchased off eBay a couple of sponsored challengers, which gave me the perfect opportunity and
years ago; however, I did have one when I was growing up, which platform for turning the project into a reality.
was probably the root of my fascination with vintage toy pianos.
Some of the old electric toys we’ve seen used basic electronics,
Ah, the old “childhood memory” throwback! As a kid, many of us many of which were monophonic. Was the original toy polyphonic or
dreamed of being superheros or rockstars while playing with toys, did you have to modify it to make it work that way?
but what made you look at this piano and ask yourself, “how could
this be more awesome?” The existing toy had a full polyphonic keyboard mechanism, but it
was purely mechanical. Each key had its own “hammer” and metal
The main inspiration for this project came from a couple of existing sound rod, so that when a key is pressed its hammer will strike
toy piano projects I worked on. its rod to create an independent sound/note. However, as I was
turning this acoustic musical instrument into a purely digital one, I
FIRST... In 2012 my brother Ali and I embarked on an experimental needed to remove the hammers and sound rods (as these were now
toy piano project, where we recorded and sampled a vintage toy redundant), and replace them with sensors for reading individual
piano in many conventional and unconventional ways. The audio key interaction data in the digital domain. ››

14 Issue 002 August 2017 diyodemag.com


FEATURE

diyodemag.com Issue 002 August 2017 15


FEATURE

Before moving to velostat,


Liam experimented with Piezo
to detect key strikes.

ensure velocity sensitivity. The way this works is that an initial key
press opens one switch and starts a timer. Then, when the key is
fully pressed, a second switch is closed, which stops the timer.
This creates a velocity value based on the time value. This solution,
however, didn’t work very well either, as the piano keys are light and
flimsy and I wasn’t able to find a switch or mechanism that would
stay “closed” just by the weight of an unpressed key.

The original piano worked with metal rods. Fortunately, in the process of trying to develop the above “dual-
switch” solution, I discovered Velostat, which turned out to be a
›› So it worked rather like a real piano (but with rods instead great sensor solution for the key mechanism. I used Velostat by
of strings) - that’s quite cool. But converting from mechanical attaching small squares of it to the underside of each key, which
to electronic is rarely as easy as it seems. You added velocity “hovered” above two contact points of a circuit, attached to an
sensitivity using velostat material. How difficult was it to create Arduino. This ensures that when a key is pressed, the Velostat
these sensors and integrate them into the project? completes/closes the circuit, sending a “press” reading for creating
note-on messages. Then, when the key is released, it breaks
Possibly the most challenging part of the whole project was the the circuit and sends a “release” reading for creating note-off
development of the key mechanism. Allowing the existing toy piano messages. However, as Velostat creates a variable analogue/
keys to generate note messages in the digital domain was difficult resistance value - depending on how much pressure is being
because there was next to no existing examples of it being done. applied to it - this allowed me to just use this reading to create a
velocity value for each key press, rather than having to use a second
For the key mechanism, I undertook a couple of design iterations switch and a timer. Using Velostat also allowed me to implement
before I settled on using Velostat-based sensors. For the previous polyphonic pressure sensitivity into the keyboard, meaning that
USB-MIDI toy piano project, I’d used piezo sensors, where a strip after a key is initially pressed, a varying amount of pressure can
of piezo sensors were placed inside the piano’s enclosure, so that be applied to it, to create an extra level of expression from the
the hammers of the keys would strike them and create a key press keyboard.
and velocity measurement. They were very easy to add to the piano;
however, in practice they didn’t create consistent results (due to Creating the Velostat sensors and integrating them into the project
the hammers not always striking the sensors properly), and they was fairly easy. Velostat can be cut into any shape or size, which
couldn’t detect key release interactions. was very handy for this project as there wasn’t much space under
each key to attach sensors. I had considered using FSRs (which
The second iteration involved designing a “dual-switch” mechanism are very similar to Velostat), but I couldn’t find any that were small
for each key, which is how most commercial keyboard mechanisms enough to fit under the keys. So instead, I simply attached the

16 Issue 002 August 2017 diyodemag.com


FEATURE

Key press and release sensors were also fitted.

sensors to the keys using double-sided


tape, and a small layer of foam inbetween.
▲ ABOVE
This gave each key a bit of physical
One of many boards during
“sponginess” which is desirable for when development.
varying amounts of pressure are applied,
◄ LEFT
and it also eliminated the sound of the Simple copper contacts provide

What’s
wooden keys striking the bottom of the key-release input functionality.
enclosure. I didn’t need to attach any wires

Polyphonic?
▼ BELOW
to the sensors because the pressing of the Each stage of prototyping took
keys caused the sensors to join contact on its own form.
points of the circuit. Therefore, I didn’t have
the struggle of trying to attach wires to this “Polyphonic” essentially means
flexible material, which was great. something can produce more than
one note at a time (such as a piano
That’s a pretty awesome conversion. or an electric guitar). In contrast,
Velostat is so versatile for this application, “monophonic” is something that
definitely a great choice. We are equally can only produce a single note at
impressed by your previous use of piezo a time (such as a human voice or a
for velocity sensing - that was some great frequency generator).
thinking outside the square (even if it
wasn’t 100% reliable, as you noted). Making In many ways even an orbital
the synth work as a standalone system sander can be considered a sort
is clearly a lot more work than simply of monophonic instrument. The
making a MIDI-integrated synth (where “tone” of the sander changes with
the external MIDI synth does all the heavy the speed of the sander, but it can’t
lifting). Was making it work as a standalone emit “two tones” at once. Of course
unit, an important aspect to you in terms a sander isn’t considered a musical
of functionality, or was is more of an instrument, but there are plenty of
exploratory drive (e.g. so you can say that bands out there using sanders, angle
you did it)? grinders, and other non-traditional
items to create amazing music!
I had already completed a MIDI toy piano
project in the past, so with this ››

diyodemag.com Issue 002 August 2017 17


FEATURE

RIGHT ►
Liam explored
different options to
replace the Piano lid.
Ultimately, laser-cut
acrylic was the best
choice to support this
detailed layout.
CAD panel design
co-developed by Anna
Blamire-Brown.

›› project I mainly just wanted to expand on what I had already random amounts of pitch offsets to each note. This said, I haven’t
done and develop something more complex and interesting. The seen many (if any) commercial synths provide a control for setting
main technical requirement of the Element14 Music Tech Design the amount of this kind of behaviour.
Challenge was to use a BeagleBone Black single-board computer.
While it could easily handle doing MIDI processing, I thought it The most unique thing about the Vintage Toy Synth is its form factor
would be good to use the full potential of the board and develop and design. Playing an instrument is about so much more than just
a more powerful system. I’m always keen to learn new skills, and the sound you create. The way you play it, the physical feedback,
developing a Linux-based audio synthesiser was something I had and the general feel and aesthetics of the instrument also play a
never done before so I thought it would be of great benefit to my big role in the overall experience. All these elements help to nurture
professional career. inspiration, and can even affect your perception of the sound
created. Vintage wooden toy pianos have such a uniquely enjoyable
So it was definitely part “so you can say you did” then! It’s so great feel and aesthetic, with their clunky wooden keys and their charming
that you took the bounds of the Element14 challenge and pushed miniature form, and I believe this can make a big difference as to
within them. How does this synth compare to commercial units? Is what a musician can get out of an instrument like this.
there something unique here (other than the fact that you built it,
and it’s amazing)? There’s definitely something about playing music with different
hardware. Playing drums with a mouse isn’t nearly the same as
The voice engine of the synth is very similar to most subtractive- beating cow-skin with sticks - so we hear what you’re saying!
synthesis-based commercial synths. It has multiple oscillators with Looking at the piano now, your acrylic panel is very slick. Did it take
standard analogue-style wave shapes; a filter with frequency cutoff any trial and error to get the laser-cutting / laser-engraving right?
and resonance controls; 2 ADSR envelopes (one for amplitude and Or were you happy with the first output?
one for the filter); an LFO for modulation; modulations routings;
digital distortion; and keyboard setup controls. It took two attempts to make a laser-cut panel that I was happy
with. For this project I wanted to retain as much of the original toy
However, there are a few uncommon features of the synth's voice piano’s enclosure and physical character as possible; in fact, I had
engine. It has a State Variable Filter, rather than a simple Lowpass originally planned to attach the controls to the piano’s existing
Filter which is more common on commercial synths; the scale of wooden panel. However, after realising that the panel was too thick
notes on the keyboard can be changed (e.g. major, minor, blues) and brittle to work with, I started thinking about creating a new
instead of just being statically chromatic; and the keyboard can custom panel for it.
send MIDI polyphonic aftertouch messages for applying per-note
expression. However, the most unique feature is the ‘Vintage My first custom panel was laser-cut out of 3mm birch plywood, and
Amount’ parameter, which allows the synth to model/emulate old the plan was to paint it and label all the controls myself. I chose to
or even broken analogue synthesiser voices. I implemented this use plywood due to it being a similar material to that of the rest of
by doing what most “virtual analogue” synths do, which is to add the piano’s enclosure. As this was the first time I’d built something

18 Issue 002 August 2017 diyodemag.com


FEATURE

Replacing the old timber lid with the new laser-cut panel. With this much wiring, it's always going
to end up resembling a snake pit.

with plywood I wasn’t aware of its susceptibility to warping. I Another big unexpected challenge was settling on a voice engine
soon found out though, because after applying paint, it ended up design, that would run on the BeagleBone Black without any
considerably warping, to the point that it was actually unusable. processing issues or overloads. I ended up having to scale back my
original voice engine design quite a lot, as it was too CPU-intensive
So, I got a second and final panel laser-cut, this time out of 3mm for the BBB. So I had to spend a lot of time testing different parts
black acrylic. Acrylic isn’t susceptible to warping, and by using of Maximilian - the C++ synthesis library I used - and redesigning
gloss-black acrylic I didn’t even need to paint it! Using acrylic the voice engine from the ground up, based on the performance of
also enabled me to get the control labels laser-engraved, which Maximilian and the BBB.
produced a professional-looking frosted white text, rather than
painting on labels by hand. Overall I was very happy with the final As I mentioned previously, the production of the synth’s panel was
panel - it looked a lot better than I imagined it would. also an unexpected challenge, due to issues with the first laser-
cut panel; however, I also originally planned to use second-hand
We’re huge fans of timber, any sort of timber, but that gloss acrylic “vintage” knob caps, but they proved to be difficult to find within my
is something amazing. It makes it look even less like a toy, and size and budget constraints.
more like a grand piano. Well... one with loads of knobs coming out
of it! Maybe a full-scale model is on the cards - we could put it in For someone claiming hobby-level electronics, you’ve done
our Super Size Me section of the mag? We’re joking of course. What extremely well to integrate the skills you have into physical
unexpected challenges did you face with this project? hardware. It’s certainly not the most elegant wiring job we’ve seen,
but it clearly works! You’ve received two awards via the Element14
The biggest unexpected challenge I faced was the development of Community Awards. Did you set out to enter these or was it
the panel electronics. The panel circuit required a lot of soldering, something you had been developing already?
but when it comes to electronics I’m very much at a hobbyist level,
so my soldering wasn’t always good enough. This resulted in me I had the idea for this project not long after completing my original
needing to replace quite a lot of the pots before I had a fully working USB-MIDI toy piano project in 2015; however, it wasn’t until the
panel. Also I wasn’t aware how much pot jitter and interference I Element14 Music Tech Design Challenge was announced that I
would get from having so many pots within a single circuit; so I had actually decided to attempt it. Therefore, I specifically started this
to play around a lot in software to help prevent this. project to attempt to win the Music Tech Design Challenge, but ››

diyodemag.com Issue 002 August 2017 19


FEATURE

›› the “Project of the Year” award from the Element14 Community They are particular useful for beginners as there are loads of official
Awards 2016 was just due to having the project documented on and unofficial tutorials, which help teach the fundamentals of audio
their website. synthesis in a practical way.

A bonus award - even better! If you had your time over, or if you On the other hand if you’re interested in building analogue
were creating a v2.0 of this project, what might you change? synthesisers, which obviously involve a lot more electronics, one of
the best resources is the “Music From Outer Space” website, from
There are a number of things I would change if I was to do this which the highly-recommended “Make: Analog Synthesisers” book
project again: was born.

• I’d try using a more powerful Linux- Thanks for the resources
based microprocessor than the Liam, we’re sure our
BBB, such as the Raspberry Pi 3, readers will appreciate
to create a more powerful and them. What are you
complex synthesis engine. The working on now, and is
main reason I used a BBB there anything else you’d like
was due to it being one of to share?
the Design Challenges
requirements; but it was Aside from my work at
also a really good option Modal Electronics, my
for what I needed to do. main project at the
moment is helping out
• I’d experiment with Moldover with one of
using other synthesis his projects. Moldover
libraries for developing is a San Fransisco-based
the synthesis engine. musician and musical
I chose to use Maximilian as it looked easy to use and provided instrument maker, also known as “The Godfather of Controllerism”.
me with all the synthesis components I needed. But as it is still I’m currently helping him develop the firmware for a new version
quite new compared to other synthesis libraries out there (e.g. of his augmented-microphone controller called the MC1. I’ve been
Pure Data, Csound, STK), I might have been able to get better following his work for many years now, so it’s a very exciting project
performance out of another library, allowing me to run a more to be working on. I’ve also been slowly working on some DIY guitar
complex synthesis engine on an embedded Linux platform. pedals, but I’ve got a long list of music-related projects that I’m
hoping to work on when I have the time or opportunity.
• I’d redesign the panel circuit to help prevent pot jitter and
interference, and I’d build it as a custom PCB, rather than as a Microphone controllers? Guitar pedals?
maze of hand-soldered wires! We can’t wait to see what you come up with! ■

• I’d implement built-in patch saving and load, rather than needing GOT SOMETHING TO SAY?
to use an external computer to do this. For more images or to discuss this feature, visit:
https://diyode.io/002ybqt
Sounds like v2.0 of the toy piano would be a sight to behold if you
ever do take it on. You clearly had significant knowledge about
synthesisers before tackling this project. For someone who doesn’t
have that background knowledge but would like to be able to put
their electronics interests to use in synthesisers and digital audio,
are there any resources or tips for where to start learning about Reading & Resources:
them?
► MUSIC FROM OUTER SPACE
The best resource is the “Computer Music Tutorial” book by Curtis http://musicfromouterspace.com
Roads, which is considered as a reference “bible” in the field of ► MAX
digital audio and related subjects. Another resource I thoroughly https://cycling74.com/products/max/
recommended, especially if you are not a coder, is Max, or its free ► PURE DATA
alternative Pure Data. These software applications are graphical https://puredata.info
programming languages and environments for developing audio
applications (as well as other multimedia applications) fairly easily.

20 Issue 002 August 2017 diyodemag.com


MOONSHOTS

Natural
Server
Cooling
Like many offices, at DIYODE we have a server room.
But like all server rooms, it requires cooling - and lots
of it! So... is there a better way? - by Rob Bell

HOT AND COLD

I walked into the office early one morning, and it was freezing cold.
It was about 5°C outside, so that’s not really surprising. If you live in
a location where you can ski on lakes in winter, this may be balmy
weather for you. But here in beach-loving, sun-baking asphelt-
melting Sydney, that’s pretty cold to us.

As I walked past the server room to make coffee, I noticed the inside
temperature was still sitting at 20°C (and yes, the air conditioner
still has to work constantly to keep it there). It got me thinking... why
are we using air conditioning to cool the room, when it’s near-arctic
outside? In the same morning routine, the air conditioner in the
main office gets switched on so everyone isn’t at their computers
dressed for the snow. So
why can’t we leverage
this heat by-product
into something useful?
Even if we’re using 100%
renewable energy to
power everything, it still
seems like something of
a waste.

22 Issue 002 August 2017 diyodemag.com


MOONSHOTS

GETTING HOT IN HERE

The primary issue with server hardware (and virtually all electronics) A quick look at ventilation fans for high volume air transfer, proves
is heat. As we know, all electronic circuits produce some amount how much this is true. We looked at a 400mm unit, which is capable
of heat (even if it’s imperceptible in a simple circuit). In most of moving 128m3 of air per minute. That might sound like a fair
circumstances, the heat is insignificant when considering the amount, but the second you add ducting (or even a simple pipe
room it’s inside, and it can easily dissipate. In an environment like bend for that matter), the volume capability drops rapidly. It also
a server room, however, we have an extremely high concentration requires a 1500W motor to begin with. If you need a larger fan than
of electronics in a relatively small space. For that matter, my “very this, you’re rapidly matching or surpassing the power consumption
standard” media centre at home (standard cheap graphics card, of a suitable air conditioner. We’ve also used a few of these large
single Intel i7 processor) quickly shuts down after a few hours of ventiation fans at times, and they are really noisy!
being placed inside an entertainment unit, yet we rarely think too
much about keeping a standard computer cool. The mathematics required to provide specific answers to this
question is a little beyond the scope of our thinking here.
Servers often have high velocity, noisy fans to keep the air moving Consideration needs to be given to the amount of heat being
through their critical parts. Facebook is one of the world’s largest generated by the servers, the size of the server room itself,
data centre operators (not surprising now that they boast over two the temperature differential between outdoors and the target
billion users). They’ve worked hard to keep all those cat videos temperature, the volume of air you can transfer (i.e. the size and
and photos of your lunch flowing through the internet; but more capacity of fans extracting the heat), humidity, barometric pressure,
importantly, have taken great steps to increase efficiency within friction/pressure incurred in the ducting, and the list goes on.
their data centres. For this reason, they don’t use front panels on But we’re confident an engineer familiar with air conditioning or
their servers, to increase the amount of air that can get through thermodynamics could tackle this with little issue.
them. Air flow through the server is critical, but if the room starts
heating up that air will extract less and less heat from the servers, Now, in experimental scenarios we’ve run our server rack in the
due to the lack of a temperature differential. main office, which is huge. The sheer volume of air in the office
allows the temperature to be maintained at a sensible level. But
So if it’s all about the air flow, all we need to do is pump the cold enterprise-grade server equipment is extremely noisy, so this isn’t a
air into the server room (or suck the hot air out), and all will be right feasible solution either. Sure, you can put noise-reducing insulation
with the world - yes? Sadly, it’s not quite that simple. around the server rack to reduce the noise, but then we’re back to
the original problem of air flow.
THE COLD HARD REALITY
This article isn’t designed to deliver a solution; it’s moreso a thought
In theory, with the ability to move an unlimited volume of air experiment, and will probably forever remain as one. Although,
rapidly through a server room, you could keep everything within as we know, sometimes brilliant ideas arise from seemingly
tolerance until the outside temperature is just 1°C below your target unresolvable problems... ■
temperature, only then requiring air conditioning to take over. But
fans use power too... and big fans especially, use a lot of power. GOT SOMETHING TO SAY?
There is, therefore, an efficiency point where moving huge volumes To discuss this topic, visit:
of air requires more energy than an airconditioner, which artificially https://diyode.io/002yvxj
improves the temperature differential.

diyodemag.com Issue 002 August 2017 23


FUNDAMENTALS

SECURING
SUCCESS WITH
SOLID SOLDERING
Quality soldering can make the difference
between a successful project, and hours of
frustrating fault-finding. This instalment of
FUNdamentals should help you ensure smooth
results for your next project. - by Daniel Koch

24 Issue 002 August 2017 diyodemag.com


FUNDAMENTALS

As someone who has been involved in electronics for many years, What this means is that not all solders are equal. Plumbers’ silver
I have had a great many kits and scratch projects presented to solder, for example, is meant for high-strength, high-pressure
me with a plea for help in finding out why it won’t work. Without situations, and so contains silver. This makes it very hard and makes
exaggeration, around 80 per cent of faulty circuits are due to poor the alloy’s melting point very high; high enough to need a hot gas
soldering. Most often, it’s a result of dry joints, but sometimes flame to melt it. Of course, both of these factors make it unsuitable
there’s debris inclusion or even attempts to solder incompatible for use in electronics. What is needed instead, is a solder with good
metals. While sometimes hard to spot, these issues are easily resistance to oxidisation that stays somewhat flexible, and has a low
avoided with a little extra knowledge. So, if you are just starting out melting point. Traditionally, this has been an alloy of 60% lead and
on your electronics journey, or if you’ve ever had a frustration with a 40% tin, referred to as 60/40 solder.
circuit, this information may be exactly what you need.
HOW IS SOLDER USED?
WHAT IS SOLDER?
Before you even turn on your soldering iron, there are several
factors to think about. Solder in electronics is not intended to be
1
an adhesive. Instead, it is there to reliably create a current path for
electricity to flow along.

The purpose of solder in electrical/electronic circuits is fourfold:

1. To provide an electrical connection.


2. To provide a chemical (metallic) connection.
3. To provide a mechanical connection to keep the
component/wire in place.
4. To avoid corrosion effects on the connection.

Occasionally there is a fifth reason. To soak away heat from heat


sensitive components.
To understand soldering you first need to understand solder, itself.
Solder is an alloy of certain metals – selected and blended – to With this in mind, the first step is to make sure all surfaces are
give certain properties. Traditional solder is an alloy (mix) of two clean and brightly finished, which means free of corrosion. Most
metals, Tin and Lead originally, mixed because together the melting electronic components have legs coated with a thin layer of tin.
temperature is reduced lower than the melting temperature of While solder bonds well to copper, copper rapidly oxidises on its
either metal. The 60/40 mix used in electronics has the least plastic surface when in contact with air. The tin applied by manufacturers,
stage. That is called the eutectic point, the point when liquid alloy bonds with the copper, and this protects it, while also providing a
converts most quickly into a solid metal. nice bond to solder. However, tin does eventually corrode, going
dull. If your components are old, they will need to be cleaned first.
While lead solder has been popular for many years, lead free solder
uses other metals that are less toxic than lead. It is slowly becoming You may have heard of flux when talking about soldering. Solder
more popular for hobbyists. [1] meant for electronics is also rosin-cored.

Elements in their natural, pure state, which are already balanced, Flux does two jobs:
are said to be inert. Atoms of materials that have too many electrons
are called negative ions, and too few electrons leading to a positive • It cleans the surfaces, which, by reacting with light oxidisation and
charge from the excess of unhappy protons, results in a positive cleaning away contaminants, results in a bright surface; and
ion. It is the opposite ions that seek each other out, so that they can • It excludes oxygen from the joint.
hold hands and be happy! However, this isn’t always easy. Many
pure metals don’t have anything around them to bond with, so they However, just as all solders are not equal, neither are all fluxes.
snatch ions from the air. Oxygen is great at taking up this offer, Many people have seen plumbers’ or metal workers’ flux, which is a
hence oxidisation, which is the term for corrosion from free oxygen thin liquid that is applied separately before soldering copper pipes
atoms. For this reason, metals are blended to become as neutral or galvanised metal. This should never be used near electronics.
as possible, and the result is an alloy. However, it is sometimes not
possible to produce an inert alloy, when other factors in the end use It is a corrosive product, unsuitable for use near components, and
of the alloy are considered. Other materials may be used too – such needs to be cleaned after soldering to prevent corrosion, which is
as carbon – which when alloyed to iron, produces steel. often impossible to do on a circuit board. ››

diyodemag.com Issue 002 August 2017 25


FUNDAMENTALS

2 4

Rosin Core

Extruded
Solder Wire

1mm

3 5

›› Electronics solder contains cores of something called rosin. Rosin The aim is to introduce enough heat to heat the joint quickly and
is a blend of chemicals specifically formulated for use as a flux melt the solder, while not putting in so much that things get cooked.
around electronics. It is important to always check that the solder
you are using is rosin-cored [2]. Here is another critical point: insufficient heat means that the
heat gets drawn away from the joint faster than it is put in. In
The next point to consider again relates to the fact that solder is not this scenario, the joint never reaches temperature or takes a long
glue. Always try to make a mechanical connection before soldering. time to do so; however, in the meantime the component is being
With wires, this may mean twisting them together [3]. heat-damaged. So ideally, you need to strike a balance between a
temperature and power that will heat the joint quickly and then be
With components on a circuit board, this means bending the legs at removed, yet without introducing too much heat. Unfortunately, this
a 45-degree angle once they’re inserted through the circuit board, is often a matter of experimentation. Remember, metals are good at
so they cannot move easily. [4] conducting heat as well as electricity

In the case of integrated circuits, it is often sufficient to bend one Adding the actual solder to the joint is the real art, and often another
leg at each end, diagonally opposite, to hold the chip in place. reason that people come unstuck. The correct procedure is to add a
little solder to your iron’s tip – just enough to allow a better surface
Once a mechanically sound, clean connection is ready, you can heat area to conduct heat. Wipe the soldering iron on the wet sponge,
up your soldering iron. The choice of equipment here is critical. then hold the solder against the two surfaces to be soldered (not
A 120W sheet metal worker’s soldering iron will dump so much against the iron tip), and allow the joint to heat up. When it reaches
heat that the circuit board will be destroyed. A 25W circuit board temperature, the joint will melt the solder, allowing it to flow into the
iron will never heat a 4-gauge car audio power cable. For reasons relevant places. [5]
such as these, one of the best pieces of equipment you can own
for electronics is a soldering station, which allows a variable Then, withdraw the iron and solder at the same time, and wipe the
temperature setting. iron clean. What you should see now is a smooth, shiny surface that
appears to be seamlessly joined to the circuit board surface and

26 Issue 002 August 2017 diyodemag.com


FUNDAMENTALS

component leg, or to both wires. If there are cracks, a dull surface, Whatever you choose, remember that most solder has lead in it
or a volcano-like crater at the top or a line around the bottom, the (note: the wisps of vapour you often see from a soldering operation
joint is likely not making a good connection [6]. In which case, is actually the rosin).
reheat, remove the solder, and try again.
All that remains now, is to trim the component legs off your board.
SOME HELPFUL TOOLS This is best done with a pair of small side cutters that have a flush
cutting surface (not a bevelled one). You should trim closely to the
There are some things that make soldering much easier. The first solder but not cut into the solder.
is a solder sucker. These are available in both spring plunger and
squeeze bulb form. Simply reheat the joint, position the desolder This information will hopefully help you succeed in your soldering. I
tool near the joint and trigger. The solder should largely be removed. could wax lyrical about it, but for now I’ll await your feedback, which
may well result in more information being provided down the track.
The second helpful tool is a set of helping hands. These are a metal I certainly intend to visit the topic of lead-free solder soon, as it is
frame with clips to hold the circuit board or pair of wires, allowing vastly different to work with. In the meantime however, the points
both your hands to be used for holding and carefully applying the here should get you well on your way. With a bit of practise, you’ll be
iron and solder. creating sound, solid, shiny solder joints in no time! ■

The final piece of equipment is a fan or fume extractor. This can be GOT SOMETHING TO SAY?
as simple as a fan directed so as to suck air away from your face, to To discuss your soldering techniques, visit:
help ensure you avoid breathing in the toxic lead soldering fumes, https://diyode.io/002xxkr
or it can be as complex as a carbon-filtered desktop fume extractor.

6
Component leg bent at 45°

Leg trimmed close to solder joint

Solder bonded to leg but not pad Solder bonded to pad but not leg Solder properly bonded

Solder Pad
Circuit Board

Resistor

diyodemag.com Issue 002 August 2017 27


CONSTRUCT,
LEARN, $
9995
SHARE.
MEET EDISON ROBOT KIT
Edison is your new robot buddy who will teach you about electronics,
programming and robotics in a fun and engaging way. He’s equipped with
all the sensors, outputs and motors needed to introduce you to the amazing
world of robotics. Once you’ve learned all about Edison’s abilities, sensors and
controls you can move on to programming him. You'll learn how to write your
own programs to get Edison to do exactly what you want!
Pre-assembled. Compatible with LEGO® Bricks. 80mm long. KR-9210
Learn much more at meetedison.com

MAKEBLOCK MBOT
BLUETOOTH® ROBOT KIT
mBot is an easy-to-assemble robot kit packed with sensors
to avoid obstacles, follow lines, play soccer, and more.
Control using the included remote or from your Smartphone
or Tablet using the MakeBlock app. The intermediate user
can program using simple drag-and-drop programming
$
199
blocks, and the advanced user can program with the
Arduino® IDE (Same processor as the Arduino® UNO).
There’s heaps of online resources for teaching and learning
about robotics, programming and electronics. Kit contains
38 parts, remote control and a detailed user manual. KR-9200

BUILD YOUR OWN ADD MOTION BRING IT TO LIFE MORE TORQUE


Kit includes motors, wheels, tyres Geared motor and wheel suitable for Micro servo motor small enough to High torque, high-speed digital servos
and two pre-drilled mounting plates. your Arduino® vehicle based/robotics connect directly to an Arduino Board. with durable metal gears. Dual ball
5-10VDC. 160mm wide. applications. 5-10VDC. 48:1 gear ratio. 3.5-6VDC. 1.6kg.cm @ 4.8V. Suitable pan bearings. 4.8-7.2V.
2WD KR-3160 $39.95 66(Dia.) x 28(W)mm. Rubber wheel. and tilt bracket (XC-4618 $4.95). YM-2758 13KG.CM @4.8V YM-2763
4WD KR-3162 $49.95 YG-2900 11KG.CM @4.8V YM-2765

FROM
$
39 95 9
$ 95
9
$ 95 $
34 95
ea

NERD PERKS CLUB MEMBERS RECEIVE:


REGISTER ONLINE TODAY:
$25 JAYCOINS CARD www.jaycar.com.au/nerdperks
WITH EVERY $500 SPENT*

jaycarelectronics @JaycarAU @jaycar_electronics Call Us 1800 022 888


*Terms and conditions apply.
LONG RANGE DATA
COMMUNICATIONS
Introducing LoRa™, a powerful new Arduino-compatible
technology enabling wireless data communications over long
distances (even several kilometres!!) without the need of a
mobile GSM network. LoRa™ can be used in many outdoor
or indoor applications, such as building automation, weather
monitoring, irrigation systems control, smart metering, smart
cities, and much more. LoRa™ has a low power consumption.
Learn much more at www.lora-alliance.org
Compatible with 3.3V or 5V I/O Arduino Board. LoRa™ frequency Band: 15MHz.
Low power consumption. Includes external Antenna (SMA connector). XC-4392
Radio transmitting devices must be used in accordance with Australian
Communications & Media Authority guidelines www.acma.gov.au
See our long distance remote relay project at www.jaycar.com.au/lora-remote
$
6995

$
29 95 9
$ 95

$79 95
DISPLAY IT ADD STORAGE

YUN WI-FI SHIELD


128 x 64 pixel OLED display. Blue text SD Card Interface. 3.3V & 5V power
on black. I2C interface. 22mm wide. input. Push-pull style. Works with inbuilt
XC-4384 Arduino Libraries. 52mm long. XC-4386
PROGRAM YOUR ARDUINO BOARD OVER WI-FI ®

Allows you to easily program and operate your Arduino project over Wi-Fi
and allow it to access the Internet. The on-board Linux computer is based
on the Open WRT firmware, giving you access to a multitude of built in 9
$ 95 $
29 95
functions and downloadable software packages. Connect a 3G dongle to
provide connectivity for your Arduino on-the-go, and use it as the basis LIGHT IT UP! COMMUNICATE
RGB LED strip. Daisy chain up to 1000 Bluetooth® V4.0 BLE Module.
for your next IoT project. Wi-Fi, Ethernet, USB and Serial interfaces. Web LEDs run from one pin. 256 brightness Configurable as master or slave.
configuration interface. 77 x 54 x 26mm. XC-4388 levels. 5V. 54mm long. XC-4380 Provides a serial communication
channel. XC-4382

WIRE IT UP! PROTOTYPE IT STOCK UP DESIGNED


16 core rainbow cable. Sold per metre or Breadboard with 400 tie points. Resistor pack includes five of virtually FOR BREADBOARDS
33m roll. WM-4516 $3.95/m or $99/roll 83mmx55mm. PB-8820 each value from 1 Ohm to 10 Meg. 60 Kit includes 70 stripped pieces of single
different values. 300pc. 0.25W carbon core sturdy wire. 5pc x 14 different
film. RR-1680 lengths. PB-8850

3
$ 95
/m 7
$ 95
8
$ 95 $
13 50

Over 150 Arduino-Compatible


Boards, Modules & Shields available.
www.jaycar.com.au
Prices shown in $AUD. Savings off original RRP. Valid to 31 Aug, 2017.
FEATURE

Paul's controller upgrades the performance


of cheap K40 laser cutters.

Enhanced
We all know that you tend to get what you pay for. So Paul wasn’t
terribly surprised when his cheap K40 laser cutter/engraver didn’t
quite perform to his liking. But rather than chalk it up to experience
and put up with low quality output, Paul decided to develop a

Lasers
solution.

How long did you have the K40 before you realised it wasn’t really
up to the tasks you were hoping to put it to use on?

Actually from day one when I got the machine. There were no
instructions, and the dongle I mistook for a USB stick with software
that I couldn't find. The eBay seller did give me some links with
Chinese software LaserDRW/Moshidraw. Unfortunately I could
PAUL DE GROOT not cut a decent frame for a project since I had to design it within
Business Architect, Sydney LaserDRW. Next to this I never managed to get the engraving to
www.awesome.tech work at all. First thing I did was to find the K40 community on
@PaulDeGroot Google+, who all said the controller was rubbish and suggested I
replace it with a decent DSP controller (i.e. expensive!).

What if you could take a cheap laser So it seems the community identified that the bones of the units are
cutter/engraver unit, then design a plug-in actually quite good; it’s the controller that’s letting it down. What
replacement so as to increase accuracy and were the problems you were having with the original unit?
improve performance? Paul did...
The software/operation of the machine was causing me grief. The
X-Y axis gantry hardware is pretty sound. The power supply is very
basic with no over-current protection, so you can easily damage it
when changing the stepper electronics. For example the 24V can
only deliver 1A, and anything above that will blow up the rectifier,
Hours of real-world testing was done.
which is simple to fix.

At least the hardware is sound; since that’s the bones of what


you’re putting your money into. How did you go about upgrading the
original controller hardware?

I did extensive research into existing solutions, but no one had a


complete E2E turn key solution, so I decided to use an Arduino
UNO as a starting point. I started with a Vero board using the
existing connectors from the original M2Nano controller. That
worked straight away so I used it for a few weeks and decided that
it was very much an ugly tarball that needed a clean up for future
reliability. PCBWays was offering PCBs for just USD45 including

30 Issue 002 August 2017 diyodemag.com


FEATURE

postage, and just for my own use, I wanted has three jumpers that allow you to select Gerbil - we love it! What specs have now
to get it nicely installed, so I decided to the appropriate PWM pins, so the shield is improved as a result of the changes?
design a new PCB shield, which worked very compatible with the standard UNO and my
well. Then other people started to ask for new controller. Standard Grbl allows AMASS (adaptive
one, so I gave the remainder away for free. smoothing algorithm), which means it runs
My next issue was engraving; 8 bits (256 The next hurdle was to find the right at big steps for straight lines, but increases
values over the full power range) did not combination of PWM settings: frequency its step resolution for arcs and curves.
allow many grey levels. So my next logical 50Hz to 50kHz, phase correct, phase and So basically the K40’s motion system has
step was to help people to achieve better frequency correct PWM or fast PWM. I improved just by using Grbl firmware. My
engraving quality. To do this, I created a new tested about 60 combinations, of which only added value to this is the laser resolution.
controller board to replace the Arduino UNO. four worked. The best frequency for the CO2 I allow 10bits engraving, which allows
tube was about 160Hz, and I made sure that precision engraving over a tiny range of
We hate ugly tarballs in our hardware too. the PWM has a base PWM train signal, so as the laser power (2mA range is divided in
Have you upgraded steppers and other to keep the gas excited and energised at all 256 grey levels while the laser range is 0 to
hardware, or simply the controller? times during the engraving. This prevents 20mA).
the latency in igniting the laser operation,
It’s a complete solution based on the and extends the lifespan of the tubes (not Wow - 256 grey levels is amazingly fine for
ATmega328PB (different AVR from the UNO), being switched fully on and off); all big a cheap laser cutter - that’s awesome! If
with a shield plus StepSticks stepper driver laser manufacturers use this this energising you had your time over, or were creating a
boards. The old Chinese M2Nano controller trick. Furthermore, the zero position of V2.0 of this project, is there anything you
is in the bin... the machine had to be changed from top/ would change?
left to bottom/left to be compatible with
Sounds like a good place for it. Did you have Inkscape and the G-code sender (CNCjs). I have used it for over a year now and it’s
any unexpected hurdles along the way? Additionally, I had to extend the resolution been extremely reliable. So I decided to
of the engraving Inkscape plug-in (from do a Kickstarter but ran into the cost of
The biggest hurdle was to design a new 250dpi to 381dpi) in order to match the the project. My new shield now uses only
controller that would run the open source engraving quality. I also had to rewrite the SMD components, which reduces the cost
Grbl with the laser features. I had to port G-code generation to make it compatible of assembly. That’s the only way to make
the Grbl code, modify it to allow 10bits with Gbrl’s G-code dialect. By the way, I call it economically viable. Also I would like
engraving, and then reassign the function the controller “Gerbil” after Grbl’s firmware. to incorporate the G-code sender into the
pins since the first USB/UART occupies the Americans at the Bay Area Maker Faire Inkscape plug-ins, so people don’t have
10bits PWM port. Fortunately, the 328PB suggested that name when I presented the to use two programs; instead they’ll have
has two USB/UART ports, so I moved the controller in May. You can read more about an integrated toolchain (requested at the
communication to the second USB port so this faire in my blog. Maker Faire by some makers). ››
as to get access to the PWM port. The shield

Testing prototypes. The prototypes saw several iterations. Cutting complex plastics is also possible.

diyodemag.com Issue 002 August 2017 31


FEATURE

The precision and grey detail now possible is stunning.


CREDIT: Original illustration by Thomas Bewick

›› THE TWO PROGRAMS ARE: My new batch is hand soldered boards just to test the BOM since
the first batch parts were ordered by PCBWay. Also the Arduino IDE
1. Inkscape to produce laser engraving and cutting G-code files. did not natively support the 328PB but that’s solved now with the
2. A G-code sender to send those files to the controller. latest IDE version.

If the Kickstarter is a huge success I might do this as a stretch goal. Sounds like you've overcome those issues for sure.
Tell us what you're working on now?
That’s great you’ve had feedback from real users at the Maker
Faire, and have actual information in which to base your Kickstarter At the moment I am working purely on the logistics of the
on. What unexpected challenges did you face designing Gerbil? Kickstarter. Creating and testing the BOM. Ordering the SMD
components and testing that it all works. Then I’ll start working with
Lots of people could not get the ATmega328PB to work properly a manufacturer to produce the end-stop conversion brackets, I’ll
because the original full swing on board oscillator of the AVR has flash the boards, test it again, and then pack it up for shipping. After
been replaced with a simpler circuit to make room on the chip die that I’ll shoot a video to explain the project. This has been a very
for the additional registers and functions. So simply replacing an old challenging element for me, as I don’t have any media experience;
AVR from an Arduino UNO with the new AVR does not work. I tried so it feels pretty clumsy.
that many times until I read the avrfreaks forum. The solution was
a better designed external xtal (oscillator) circuit close to the chip Well, at the time of writing your Kickstarter has just launched, and
according to the forum, so that’s what I did. Most of the remainder it’s already off to a cracking start. We wish you the best with it, and
circuits are identical to the UNO except for the USB chip from FTDI. look forward to hearing about all the K40 owners benefiting from
I want to make the USB driver install as easy as possible for my the integration of Gerbil to their units! ■
users who are mostly makers, hobbyists and mums/dads garage
businesses with few IT skills. GOT SOMETHING TO SAY?
To leave your comments or for more images
I ordered ten fully assembled controllers from PCBWay and and link to Kickstarter, visit:
amazingly they all worked on arrival. I sent them to beta testers. https://diyode.io/002fnkv

32 Issue 002 August 2017 diyodemag.com


3 REASONS
TO SUBSCRIBE!
NEVER MISS
AN ISSUE!
It's delivered straight to your door,
and you can grab your digital
edition the minute it launches!

IT’S CONVENIENT.
Each issue automatically
unlocks on our website, for
hassle-free access to resources,
commenting, and more.

CANCEL ANYTIME.
Unsure you want a full
12-months? Go monthly and
cancel any time!

SUBSCRIBE TODAY:
diyode.io/002subs

Secure shopping made faster. Now accepting


PROJECT

Tweet
The
World
Want an easy way to interact with
users, the world and your fans?
Tweet it! Using just an Arduino UNO
and an Ethernet shield, you can
easily add the ability to tweet any
piece of information or data.
- by Oliver Higgins

34 Issue 002 August 2017 diyodemag.com


PROJECT

One solution may be to set up a data server and write your


information to the database, read it back and display it on a
webpage. Fairly straight forward but there is a bit of work and
Who remembers the days before Twitter? Back when celebrities overhead when it comes to maintenance. The question may simply
had to go through public relations people or wait until the media be, “what do you want to do with the data?” Do you need to have
discovered that they did something stupid. Now we all know right longitudinal data or do you only want to inform the individuals that
away, thanks to the likes of Twitter, which provides us with a a specific event has occurred? Believe it or not using Twitter is one
way to get information out to the masses – fast and with minimal of the simplest ways to do this. Twitter has 317 million active users
overheads. So how do we harness this power to send our project’s per month, with over 500 million tweets being sent per day! There
data to those who want it? is an excellent chance that the people you want to reach are already
on it, allowing you to interact without them needing any additional
THE BROAD OVERVIEW knowledge.

One of the fundamental things we consider with the projects here Of course, let's consider things for a minute... Twitter may not be
at DIYODE, is how we deliver information to the user. Serial outputs the answer! If you're sending private information or any sort of
and LCDs have their place, but you are not always in a position to information that's potentially sensitive (such as, there's nobody
be looking at the physical unit. This is part of the appeal, and the home right now), it's probably not a good idea to use a public
drive behind the rapid uptake of the Internet of Things, which is the service to do the talking. If you're automating public information
tech buzzword of the decade. Not just in the maker space. So how specifically, or you're tweeting information that's not sensitive at all,
can we deliver information from a remote location, with minimal then it provides a great, reliable platform. Those 317 million active
overheads that the end user will be able to access and use, without users rely on Twitter to be live virtually 100% of the time. For that
requiring any additional knowledge or training? reason, you can rely on it too! ››

diyodemag.com Issue 002 August 2017 35


PROJECT

›› HOW IT WORKS decreases until it reaches 8, at which point it will send a tweet,
and when it returns to 3, it again tweets the drinks special.
Let’s back up for a minute and look at Twitter’s infrastructure. Finally, we have the third button, which when pushed, sends out
At its simplest Twitter is an XML feed. That’s all, remember RSS a preprogrammed tweet.
(Really Simple Syndication) – or am I just showing my age here?
THE BUILD
The developers at Twitter took this a step further, and opened
the world to microblogging. They took a small story of just 140 PARTS REQUIRED: JAYCAR ALTRONICS
characters, and gave us a way to pull the data we wanted to see 1 x Arduino UNO R3 XC4410 Z6240
out of the stream. Feedback from the users soon resulted in the 1 x Ethernet Shield XC4412 Z6242
introduction of hashtags. The famous # now creates a channel of 3 x Tactile Switches SP0608 S1112
ideas or content, which allows individuals to find the information 3 x 10kΩ Resistors RR0596 R7782
they are interested in, very quickly and consistently.
SOFTWARE REQUIREMENTS:
The Internet of Things (IoT) has sprung up in a huge way over Arduino IDE
the past few years; however, to create a positive community Twitter Library
user experience we need to have a front-end that will allow them
to interact with your device. This can be difficult and very time BUILDING THE CIRCUIT
consuming to build, but by using Twitter, you can easily output
information to anyone who wants it. The initial sketch requires no circuit. Simply connect the Ethernet
shield into the UNO, connect Ethernet and power cables. The
The crew here at DIYODE have felt that we should open a bar. system will attempt to send a single "Hello World!" tweet, then
This place will be pretty exclusive with a limited amount of sit idle until you restart it. It's the simplest way to test that your
room for patrons. Now we understand that you will all want to access via the Twitter API is successful.
come, but you may not want to wait in line to get in. To address
this, we will be instigating an Arduino-powered doorman. The The main sketch has three buttons. Place them one after another
role of this doorman will be to count how many people come in on your breadboard. Connect the 5V and GND rails to the
and out. Abiding by the legal building requirements, of course, Arduino. Connect up the three resistors, which will pull the pin
when the bar is full it will send a tweet to all our followers, to let to GND on the pins when the button are not pressed. Connect
them know. Once some people leave we will then tweet again, the GND and 5V connectors from the breadboard rail to the
to tell our followers that there is now some available space. switches. Finally, connect the switch to the Arduino, pin 2 is the
Almost full? There’s a tweet for that too! Drink specials, $2 Sonic “send tweet” button, while pins 5 and 6 are the count up/down
Screwdrivers! #youknowyouwantit switches.

THE BASICS OF HOW THIS CAN HAPPEN:

You’ll need the Arduino and Ethernet shield (you could also use
a WiFi shield with some modification). You’ll also need to have
three switches: the first will be the “in” counter; the second will
be the “out” counter, and the final switch will be used to deliver
a message to the followers, such as drinks specials or other
announcements

SO WHAT ARE THE RULES?

The maximum number of people in our bar is 10 (okay, it’s not


a big bar but you don’t want to be doing 200 clicks in testing,
right?) Each time we click the “in” button the counter increases.
When it gets to 3, it tweets a special drinks offer to entice more
customers to come in. When it gets to 8, it sends out a tweet
stating that there are limited spots available. Once it gets to
10, it tweets that the bar is full. As we click the “out” button it

36 Issue 002 August 2017 diyodemag.com


PROJECT

THE SETUP
#include <SPI.h>

The first requirement of this project is to setup a Twitter account. #include <Ethernet.h>

If you already have one then great, otherwise go to Twitter and #include <Twitter.h>

follow the prompts to sign up. It's probably worth noting that byte mac[] =

even if you do have an account already, it's often useful to sign { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

up for a new account dedicated to your IoT explorations. It will Twitter twitter(“YOUR CODE FROM STEP TWO”);

keep your twitter account clear of all the clutter you'll likely put char msg[] = “Hello, World!”;

out during testing. void setup()


{

Once complete, log into your Twitter account. We have delay(1000);

named the bar the “Mosfet Cantina”. Feel free to follow us @ Ethernet.begin(mac);

mosfetcantina (and of course, @diyodemag for real tweets!). Serial.begin(9600);


Serial.println(“connecting ...”);

Over the last few years, Twitter has increased its security and if (twitter.post(msg)) {

so it’s no longer quite as straight-forward to merely put in your int status = twitter.wait(&Serial);

username and password to tweet. We have to now go through a if (status == 200) {

developer program to get our OAUTH token. OAUTH is used to all Serial.println(“OK.”);

access to external applications, including the Twitter Application } else {

Programming Interface (API), without revealing your username Serial.print(“failed : code “);

and password to outside sources. Serial.println(status);


}

We will not go into depth here about creating an app from } else {

scratch; instead, we’ll use one already provided by the Arduino Serial.println(“connection failed.”);

community. }
}

CREATING AN ACCOUNT
void loop()

1. If you don’t already have a Twitter account then create one. {

The process includes uploading a photo and filling out a brief }

bio.

2. You need to be logged into your Twitter account then go to Hook up the breadboard and put the 5V and GND rails to the
http://arduino-tweet.appspot.com/ to create a secret key. Arduino. Connect the 3 buttons as per the diagram.

3. Connect the Arduino, Ethernet shield and RJ45 cable. Button 1 is our “send” button. This could be used to send a
random tweet to all our followers, but in this case, we’ll simply
4. Make sure the Twitter library is installed on your development be sending a predefined text message. This code is very similar
machine. We have provided it in our resources also. to the code example above, but adds into the loop a part so as to
check the button.
Now let’s test it out with a simple tweet. Make sure you insert
your secret code from step 2 into the “Twitter twitter” line. Button 2 increases the pplCounter Integer; button 3 decreases
it. It returns to the loop and checks the pplCounter button
You should get a tweet sent from your account saying “Hello against certain thresholds. If it is equal to them, then it sends
World!” Be mindful if you try to repeatedly tweet the same out a preprogrammed message: “Sonic Screwdrivers $2
message again, the API will give you an error. You must change #mosfetcantina #nightlife”. It then sets the “msgSent” integer to
the message or wait for a while before resending the same one. 1. As the loop comes back again, it checks to see if the msgSent
is 1 or not. This way we don’t resend the message over and over
Note: When using this, there are some limitations on how again. Once a button is clicked again, the msgSent variable is set
many tweets can be sent and how often. You can send as to 0, and the counter loops again to check if it is required to send
many as you want, but if you fire them off too quickly then another message at this level. ››
the Twitter API will begin to limit you. You may also overload
the Arduino.

diyodemag.com Issue 002 August 2017 37


PROJECT

Let's Do
Something Different:
›› What if you don't own a bar? What if you don't care how many BUILDING THE CIRCUIT
people are in your building? What if you just want to automate Only a few wires are required, as well as the DHT11 sensor. Load
the whole process? the Twitduino_DHT_0_0_4.ino sketch onto your Arduino (provided
in the resources).
Let's look at a different application, while still using the Twitter
platform. Every 2 minutes, your Arduino will tweet out the current
temperature and humidity. Easy! As noted previously, Twitter
In issue #001, we used the DHT11 Temperature / Humidity tends to automatically disregard duplicate messages that follow
sensor, displaying the output to screen in our Arduino Web too quickly. So if during testing your tweets don't seem to be
Server project (https://diyode.io/001dngx if you'd like to check getting through, this may be why. Of course, keeping an eye
it out). on your serial monitor while you test things out will provide
generous feedback on all that's happening.
What if you could get tweets for the temperature of your home
brew? Or when it gets REALLY cold? The DHT11 can do that. WHERE TO FROM HERE?

THE BUILD If you wanted to expand this project, you could easily add an IR
trip beam or laser sensor to button 2 and 3 on the real door at
ADDITIONAL PARTS REQUIRED: JAYCAR ALTRONICS your home or shop. You could then add in an extra variable to
1 x DHT11 Temp/Humidity Sensor XC4520 Z6320 count in the total traffic and tweet it at the end of the day.

ADDITIONAL SOFTWARE REQUIREMENTS: The current code presents a very hard line in the sand, so that
DHT11 Library when you hit 10, it tweets. Therefore, if you had 11 people and 1
left you return to 10, which automatically fires off another tweet.
The code could do with some fuzzy logic to decide if patron
numbers are on their way up or down, and to build in different
thresholds.

Doing this could open up an amazing world for you to


communicate with your users and fans. It would not take much
to turn this into a full blown weather station, or what about
live tweeting lap times on a race circuit? You could add in the
Arduino camera module and then also live tweet pictures, traffic
jam warnings, GPS location trackers, or a house alarm. Any piece
of data you want to communicate can easily be sent via Twitter,
provided the message is 140 characters or less of course. ■

WANT MORE?
To grab the code or leave your comments, head to:
https://diyode.io/002rpbv

38 Issue 002 August 2017 diyodemag.com


Make
August 2017

your Mark Build It Yourself Electronics Centre®

No More eye StraiN! X 3250 Warm White


X 3251 Natural White

$ 95 $ 19.95 NeW!

X 4201 5 Dioptre
X 4200 3 Dioptre
Modular
Aluminium
NeW! 3D Gesture Control
$ 49.95
Z 6308
12V LED Strips For Raspberry Pi®
SaVe $20 Perfect for lighting cabinets and workspaces in
caravans, 4WDs etc. Strips can be daisychained
FlickHAT is a 3D tracking and gesture HAT that lets you control
the Raspberry Pi with a swipe, tap or flick your wrist. Detects
together using an included joiner. Provide a crisp 975 your gestures up to 15cm away in 3D space. Also works as a
lumen output from 2835 size LEDs. 25Wx10Hx500Lmm. tap/touch sensor pad.

NeW! NeW! NeW!


Ultra Bright LED
Inspect-A-Gadget.
Ultra-bright long life LED for
fantastic clarity (plus no need to
change a globe - EVER!). $ 12 Z 6307
Let “gadget” be your eyes.
Identify those impossible to ProtoHAT for Raspberry Pi ®
K 9640

Tinker Part Pack


$ 30
read miniature parts A HAT board with soldermasked 0.1” holes and stack- A huge assortment of parts for experimenting
without straining your eyes. able header so you dont lose access to the GPIO pins. and building. Includes diodes, LEDs, switches,
Great for collectors, model Slots included for display & camera cables. resistors, caps, strip board, a motor & more.
makers, jewellers etc. Pi sold separately. Normal RRP value $55! T 2699A

With laser pointer!


NeW!
$ 16.95
Handy USB
$67 Soldering Iron
SaVe $23 $ 23.75 Rugged IP67 D 0508 $ 55
Powered by a USB port! Great
for occasional jobs like fixing
a dry joint in an audio cable.
Z 6515
Waterproof Battery Bank Built in switch in the handle
Raspberry Pi Prototyping HAT Must have for tradies, travellers and hikers. Water and auto sleep mode ensures
Provides easy screw terminal connection for GPIO and dust proof battery bank to recharge your safe operation at all times.
pins, plus a solder pad prototyping area.

89
phone on the go! 5V 1A output, 5600mAH. Includes stand & USB lead.
$ X 3216A
SaVe 20% NeW! Single Colour
LED Strip Lights
Now in blue and yellow! Sold in 5m rolls in
either indoor or IP65 rated waterproof. Great
for adding atmosphere to your entertaining
area. 12V DC input via 2.1mm DC jack.
Create amazing light effects! T 2173
$ 23 Model Part Normally NoW
Magic RGB strip lighting with a huge array of colours and
effects. Sold in 5m rolls. IP65 rated for outdoor use. Great for 30pc Precision Driver Kit Blue 5050 Indoor X 3209A $54.50 $44
adding atmosphere to your entertaining area. 12V DC input. An aluminium driver with rotating ferrule top for easy Blue 5050 Waterproof X 3205A $64.95 $52
Requires X 3219 controller and IR remote to suit $19.95. servicing of high tech devices. Includes 70mm exten-
X 3228 pack of 10 tubing clamps to suit $5.95. sion and 28 x 4mm hex bits. See web for contents.
Yellow 3528 Waterproof X 3207A $50.50 $40

official raspberry Pi reseller. Shop in store or online!


www.altronics.com.au | 1300 797 007 Serving makers since 1976.
Cut, Polish,
Grind, Sand NeW!
& Carve!
Micron® 172pc
Rotary Tool Kit NeW!
This workbench essential is just the
shot for electronics projects, crafts,
hobbies and odd jobs around the
house! Powerful 130W motor (this
is a real power tool!) with variable
speed between 8000 and 33000
‘Getting Started’
Electronics Tool Kit
$
Great for new enthusiasts, students and
34.95 T 2162
SaVe
$19.95
RPM. Included is a massive accessory
educators. This handy kit is supplied complete with
kit of grinding wheels, drills, cutters,
sanding discs, polishing pads and carry case and includes all you need to get soldering!
• 30W soldering iron with 1mm conical tip •Iron stand
$ 60
more! And it all stows safely away in Q 1067
a hard plastic carry case. • 2m lead free solder • Vacuum solder sucker • Long
nose pliers • Side cutters. Precision 28 Range DMM
$ 74 .95
T 2120
Includes temperature probe at no extra
cost! Excellent for the service technicians
or enthusiast. Massive 20A rating AC/DC
to 1000V.

Build the ultimate $259

electronics workbench! $ 230


Peak USB Component Analyser
®
Q 2115

An advanced component analyser for transistors,

350
FETs, IGBT, regulators, zeners and diodes. Provides
$ SaVe $45 a huge amount of technical data on each part and SaVe
25%
provides pin out info. 2 year warranty.
T 2052 Designed & made in the UK.

$13.65
$ 28
Q 1126
$ 12 Compact 19 Range DMM
Small enough to fit in your pocket, this 19
range meter offers plenty of features for the
enthusiast on the move. Backlit display with
T 4015 data hold & temperature measurement.
Never lose a tiny screw again!
This magnetic workmat keeps those tiny screws and wash-
ers in place when servicing. 25x20cm. Includes marker. Magnetic 3 in 1
LED Work Light
Features a mini flood
T 2169
Micron® Combo Soldering light, top mount spot
torch & SOS beacon.
& Vacuum Desoldering Station $24.50 Requires 3xAAA
Save space on your bench with this top performing 60W soldering iron and 90W vacuum batteries (S 4904 2pk).
desoldering station. Removes a 16 pin through hole IC in 30 seconds! Sucks molten solder
away from components & pads in no time and is easily cleaned. 160° to 480°C adjustable. 17pc Ratchet Driver Tool Kit
$ 20 NEW!
Includes 0.2mm soldering tip and three desoldering tips. This ultra compact ratchet kit is ideal for working in tight
spaces inside equipment. Supplied with phillips, pozi,
$ 19.95 X 0223
torx, flat blade and 1/4” drive sockets.

Sizes down to 4mm!


NEW! Q 1278A
$ 19.95
Handy Probe Thermometer
24.95
$ Stainless steel easy clean probe. Great for use in the lab or the kitchen. -50°C to +330°C
Do you have small nuts? T 2166
This 10pc spanner kit could be for you! Includes 4, 4.5, Rare Earth Magnets!
5, 5.5, 6, 7, 8, 9, 10mm ring & open end sizes. After massive customer
demand we’ve found
HaNDy! a source of quality
Tools not included.

$16.95 rare earth magnets.


NEW!
T 1464 has 4.5mm
$76 $13 NeW! countersunk hole.
9
$ .95
62
H 0230
$ T 5020A T 3022 12.5mm
Model Type rrP SMD Parts Case
Sturdy Lockable Tool Case $18.95
Hook & Loop Tape T 1464 25x5mm Countersunk $10.95 Great for storing your SMD parts, each
Aluminium panels, reinforced corners &
seams for serious protection! Includes
Back to back ‘velcro style’ tape (ie
sticks to itself). 10m rolls. Great for
$15 T 1465 25 x 5mm Solid $9.95
feature a spring loaded top. Includes 8
interlocking 18x18mm compartments
removeable tool pouch. 460x325x150 mm. securing cables. T 3024 20mm T 1466 10 x 3mm 4 pack $7.95 that can be easily expanded.

www.altronics.com.au | 1300 797 007 Serving makers since 1976.


Portable Gas
Also available in kits
with carry case &
extra tips.

Powered tools
T 2494

$ 59 $ 33 T 2492 SaVe
SaVe 15% 22%
Midi Blow
High Power Torch SaVe 20% T 2480

35
Blow Torch Perfect for hobbyist
THOUSANDS SOLD!
Super hot 1350°C
use (it shrinks
heatshrink, then gives $
flame! Handheld you a nice crust on
or self standing your creme brulee!). All heat & no flame!
design for tasks such Handheld or self Iroda® Pocket thermo-gun. Great
as heatshrinking, standing design. for removing adhesives & paint.
model making, Easy to refill using 650°C max. Refillable. SaVe 22% tHiS MoNtH
silver soldering! Iroda butane.
Easily refilled. All
aluminium design.
Iroda® Butane
4 Pack
Stock up the workbench
$39.95 $55 $79 $119
with this value pack of
SaVe 20% quality double scrubbed $ 30 $ 42 $ 60 $ 92
butane. Doesn’t clog your
tools like the cheap stuff! T 2595 70W T 2590 80W T 2598 100W T 2630 125W

Mini Jet Iroda® Portable Soldering Tools


Blowtorch 4 for An iron for every occasion! T 2595 & T 2590 are ideal for

28
T 2488 T 2451
Produces a powerful jet like flame - up

15
general purpose soldering and occasional repairs. T 2598 and
to 1300°C! • Great for hobbyists
• Adjustable flame • Refillable • One $ $ SaVe 12% T 2630 are great for field techs. Plenty of power and capacity
for bigger soldering tasks. All can be converted into a flameless
click ignition • Diecast case heat gun, hot knife or blow torch with additional tips.

$49.95

SaVe 15%
$ 39 NeW!

30
T 2186
$ Do-It-All Precision Screwdriver Set T 2282
T 2555 Featuring 56 precision tips made from tough molybdenum va-
Magnifier Head Goggles nadium steel. Huge variety of tips with extension bar and clear
storage case. See website for contents.
$ 13.95
- Get a close up view!
Offers 1.5, 2.6 and 5.8x magnification with The Pocket Hero is here!
in-build LED lamp. Requires 2xAAA’s (S 4904 This nifty 12 in 1 pocket sized saviour helps you fix lifes
$4.95 2pk). little problems then folds up to the size of a pack of
gum! Includes belt pouch.
T 2367
T 1090 0.5mm
T 1100 0.8mm $50
Ultra-Quick
39
T 1110 1.0mm
T 1122 1.6mm $ Strippers
These easy
Nifty Multi-Angle T 5036 $19.95 squeeze, spring
$29 $39.95 loaded, auto wire
any 2 for
Bench Vice
Made from diecast alloy.
Double Sided $ 22 $ 15 T 2355 strippers will re-
Parts Case
$ 25 Clamps to your work bench and
provides total 360° freedom Perfect for working in the field! The Nibbler
move insulation on
cable instantly. $22.95
Quality Resin Core Solder 15 compartments on one side, Cut holes in 1mm steel, plastic
Premium grade for leaded soldering. 200gm
when working. Jaws open to
55 mm. Includes soft jaws for plus 10 removable containers on
the other side.
and 1.6mm aluminium. Great for
making one off chassis panels etc.
1.0, 1.6, 2.0, 2.6,
3.2mm2.
$ 18
reels. 60% tin, 40% lead. holding delicate connectors. T 1526

No hassle 14 day money back guarantee on all purchases!


www.altronics.com.au | 1300 797 007 Serving makers since 1976.
young Makers! $ 49.95 ‘Learn To Solder’
Zoo Animals Kit
Contains everything you
need to create simple
K 1119
circuits & learn to solder.
Build yourself Play with LEDs, battery
& bring each of the six
an Aussie icon! animals to life! Age 6+
Robot Frilled Neck Lizard Kit. $33.95
Build it up and have it follow you like a pet. Or sneak
up and surprise it, making it spread its frill. 37cm
130 in 1 Electronics
K 2546
$ 25
long. Requires 4xAAA. Age 8+
Learning Lab
NEW! A comprehensive learning lab
Solar Powered with many hours of building
$ 26 .50
K 8128
Wild Boar Kit
an experimenting. Build a
radio, broadcast station,
A basic solar DIY toy, it
Solderless Educational Kit is ideal for a do-it-yourself
organ, kitchen timer,
This kit is the first step into the world of logic circuits &
science fair, after-school, more. Requires
modern electronics. Build your own circuits
or workshop project with 6xAA batteries
in a fun, safe and educative way. Contains a
SaVe $40
99
the bonus of learning NEW! (S 4906 lithium
breadboard and all necessary components to
mechanical transmission 2pk $4.95ea) $
start assembling your first circuit. 10 projects
to build.
and electrical motor theory. $ 19 .95
K 1138
K 2208

$59.95 Robot Escape Bug Kit $47.95


$ 45
Uses three IR diodes to navigate
around objects, through mazes
$ 35 SaVe 24%
etc. Includes all components and K 1103
K 1095
wheel or leg options. Requires
4xAAA batteries (S 4906 lithium
2pk $4.95ea).

Air Powered
Buggy Kit
45
Forklift

$
Rover
Requires no batteries, electric
motor or any conventional K 1136
Gripper fuel to make it drive. Use the
air pump to fill the bottle, Hydraulic Powered Robot Arm Kit
then let it go and watch it This lever controlled water powered robot arm uses hy-
3 In 1 All-Terrain Robot Kit fly! Travels up to 50m. No
Great fun for the kids to build and play with! This $32.50 draulic forces to twist, turn and grab! Lifts up to 100gm.
soldering or special tools Fun to assemble and use, this educational kit teaches
single kit can be built (and re-built) three ways!
Lifting capacity ≈100g. Wired remote control.
$ 25 K 1135
required. kids about physics principles and robotic motion.

NEW!
Builder Bitz.
Membrane NEW!
$27.95 Keypad
Great for access
$ 19.95
J 0902 Z 6393
control projects.
NeW! Standard
Adhesive backed.
P 1030
NEW! 69Wx77Hmm. NEW!
$ 13 .95 Z 6341
$7.95 5
$ .95

5
$ ea
J 0900 Ultra mini
Pull Type Solenoids High Torque MG995 Servo
Ideal for any project requiring a pulling actuator. A high speed metal geared servo with 7 Pack of Mini Coloured Breadboards
12V DC operating voltage. Full specs on website. 12kg/cm torque. Weighs 55 grams. 120 55 hole breadboards for instant solderless part connection.
degree rotation (±60°).
Prototyping
NEW! Strip Vero
9
$ .95
$69.95
Board
Easiest way to
build up quick
Z 6544
$27 Z 6394 $ 45 circuit prototypes or
DIY add on boards.
Run 5V circuits
from two AA
NEW! $20 Z 6392 Fingerprint Sensor 160x100mm.

batteries!
$ 12.95 Handy 30m W 2120
Lightweight SG90 Servo
Great for building your own
access control designs! Can store $24.75
Boosts the voltage output of two Figure 8 Reels A great micro servo for lightweight up to 20 prints via 360° recog- 5 for
AA batteries to 5V - suitable for powering
shields, sensors and controllers.
Red with black trace. 7.5A
rated. Great for DC wiring.
robotics applications. 180 degree
rotation (±90°). 3.5-6V operation.
nition. You can even download
prints from the device.
$ 20 H 0712

Prices valid until august 31st 2017 | 1300 797 007 | www.altronics.com.au
Find your nearest reseller at: www.altronics.com.au/resellers
© Altronics 2017. E&OE. Prices stated herein are only valid until date shown or until stocks run out. Prices include GST and exclude freight and insurance. See latest catalogue for freight rates. Please Note: Resellers have to pay the cost of freight and
insurance and therefore the range of stocked products & prices charged by individual resellers may vary from our catalogue. B 0088
FEATURE

DANCING
IN THE
(LED) LIGHT
Ray’s discovery of the Adafruit
NeoPixel light strip was almost by
accident, but a happy accident.

RAY ABRAM
Embedded Software Engineer
from West Auckland, NZ

NeoPixel by Adafruit is a range of addressable LED light strips, and ▲ ABOVE


The original hand-made sign that
with minimal wiring and code it can create some amazing dancing inspired the NeoPixel journey.
light displays. We caught up with Ray to talk about his discovery of
NeoPixel, and how he went about using them with a PIC micro. Addressable LEDs are definitely the way to go once there are more
than a few. Was your PIC code complex to get right?
The NeoPixel LED strips are great. Did you choose these straight-up
or were you playing with something else to begin with? The most complex part was making rainbow effects. I found some
Arduino code that did what I needed, so I then converted it to
I was originally playing with a microprocessor PWM-ing a bunch of work in my project. The second most complex part was getting the
Red LEDs to make an LED chaser. I created the effect of a bright LED timing on a port pin to correctly match the NeoPixel protocol. The
(no PWM) and a tail of lesser bright LEDs (more and more PWM). PIC needed to run at 48MHz to get the timing close enough for the
This LED chaser was inside the frame of a sign for the neighbour’s NeoPixel to accept the data. I used a PICkit to debug and program
kids bedroom. The girl for whom this sign was for asked if the the code with. The unit also runs from a USB plug pack, so there
LEDs could be other colours, and that is when I used Google and is no fancy power supply to make, just the PIC connected to the
discovered NeoPixel LEDs. NeoPixel’s “data in” pin. ››

diyodemag.com Issue 002 August 2017 43


FEATURE

›› That’s definitely a simple and elegant solution. How many Sounds like something work tackling. Perhaps some Li-ion
preprogrammed routines do you have stored in your PIC? batteries would do the trick, depending on your required runtime of
course. Have you programmed PIC micros before or did you learn
I have nine routines, each of which are selected by holding a button specifically for this project?
in (this skips to the next effect). The nine effects are:
I have done some contract software development for some
• Colour wheel companies over the years, so I have completed some very complex
• Just 1 red LED on moving forwards along the strip projects on PICs. This code was some of the easiest and more
• Just 1 red LED on moving backwards along the strip simple code I've written.
• Just 1 red LED on moving forwards then backwards along the strip
(like a Cylon’s eye from Battlestar Galactica) It’s so great when a plan comes together and all goes smoothly! You
• Crawling forward red LED effect mentioned some timing trickery to get the NeoPixel to accept your
• Crawling backward red LED effect code from the PIC. Can you elaborate on this?
• Crawling forward rainbow LED effect
• Crawling backward rainbow LED effect The protocol shown below is quite specific on its BIT timing. So to
• Fully random LED colour or LED sparkle effect get the PIC to control its port pin accurately, I used an oscilloscope
to show the pin. I just kept adjusting some timing loops in my
That’s quite a selection! We can see a tactile switch on the board - software until my software matched the protocol’s BIT timing. A PIC
is that to cycle through different sequences? running with a 48MHz oscillator is only just able to keep up with the
BIT timing requirements.
Yes, the tactile simply cycles through the routine currently in
operation. That’s fast! Did you face any unexpected challenges with this
project?
Your circuitry is amazingly simple, have you considered expansion
to sync to music from an audio source or microphone? For sure. Firstly, I wanted to calculate the colour for each LED just
before sending it out, but some of the effects took too long and
This could definitely be a future enhancement to the code. The resulted in only the first Neo Pixel working. It took a bit of thinking
original intention of the code was to create a unique LED light stick to determine the code was taking too long to calculate the effect,
for when I was at a Coca-Cola Christmas party in a park. I would so I needed to precalculate the LED colours into RAM and then send
need a large lead acid battery to run it, or a USB backup battery them.
pack outputting 5V.

Like many hobbyists, Ray has his own


CNC machine for making all sorts of
awesome things.

44 Issue 002 August 2017 diyodemag.com


FEATURE

A PIC18F45K22 and a handful of components. Minimal wiring is required to get NeoPixel running.

Secondly, the point where you connect the NeoPixel “data in” to the

Time Constraints:
PIC’s pin required a 100Ω resistor, which I did not fit at first, and this
resulted in the LEDs doing random things.

Thirdly, you need a large capacitor connected across the NeoPixel The NeoPixel strips require high precision timing. Many
to make them work reliably, which I did not have originally. This popular general purpose MCUs such as a Raspberry Pi or
resulted in more weird effects taking place. Arduino simply cannot handle the speed requirements.

All of these sound like relatively minor issues to overcome, but


0 Code T0H
sometimes the simplest things are the hardest to debug! If you T0L
had your time over, or were creating a V2.0 of this project, is there
anything you would change?
T1L
1 Code
I would use a more powerful CPU so I can add comms support, T1H
which will connect to a WiFi adapter and allow an Android or PC to
tell the LEDs what to do.
DATA TRANSFER TIME (TH+TL=1.25µs±300ns)
We would love to see that! What are you working on now?
T0H 0 code, high voltage time 0.4µs ±150ns

I want to connect a grid of 32x256 NeoPixel LEDs to a PIC (or maybe T1H 1 code, high voltage time 0.8µs ±150ns

a STM32 CPU), so I can scroll messages across the LEDs; but I have T0L 0 code, low voltage time 0.85µs ±150ns

not yet started on this project. It is only at the ideas stage at this T1L 1 code, low voltage time 0.45µs ±150ns

point in time. RES low voltage time Above 50µs ±150ns

That would be great to see. We hope to check it out once you have Ray used an oscilloscope to adjust timing loops until the
tackled it! Thanks for taking us through your NeoPixel project. ■ software matched the protocol's BIT timing. A PIC running
with a 48MHz oscillator is only JUST able to keep up with the
GOT SOMETHING TO SAY? BIT timing requirements!
For additional media, or to leave your comments, head to:
https://diyode.io/002swvt

diyodemag.com Issue 002 August 2017 45


SECRET CODE

VARIABLES
AND CONDITIONAL
STATEMENTS
Last month we introduced the overview of code
through the “Hello World” article. This month we A NOTE ABOUT SPELLING: You’ll notice that in Australia, we
will take a look and explain variables and conditional use British English, which spells “colour” with a “u”. Since
statements. Without these two things, our lives would code was developed with US-English spelling, all code
be boring and automated. They are 2 of the most languages (that we’re aware of) will drop the “u” and spell it
fundamental things in programming for they allow us “color”. This applies to web languages such as HTML / CSS
to do something. We struggled to come up with any / PHP which regularly deal with colour, as well as C, Python,
program that did not contain at least one of each of Java. We may use “colour” in the text, but if it’s in the code,
these. Okay, “Hello World” is one, kind of. we’ll always use “color” to avoid confusion. Unfortunately
- by Oliver Higgins code interpreters don’t yet have artificial intelligence, so will
rarely assume “colour” equals “color”.

Let’s start with variables. This is probably a poor descriptor if you We need to write a program that makes coffee cups. The users have
have not done any programming before. Simply put, a program informed us that in addition to yellow and blue they would like red
needs to do something. It needs to somehow get information from ones. So the program for this is pretty simple:
the outside world and look at it, manipulate it, and then give it back
to the user. It requires somewhere to hold this information. • Start program
• User enters coffee cup colour
If we are to step back a minute and look at the world around us, I • Coffee cup appears
have a coffee cup in front of me. It is canary yellow. (Actually it’s Big
Bird yellow). The only thing I am defining in the context of the coffee This program is quite simple and has one variable being the colour.
cup is its colour. At home, I have a blue one I bought from the same When we program, we need to have a place to define and hold this
shop. It is blue, (Cookie Monster blue, to be precise). Everything else information. We commonly refer to this as a “variable”. A variable is
about these coffee cups is the same. Now it may seem as though I something that we – the user or the program – can change during
am spelling this out, but hear me out. the program’s execution. In the example below, we define the
variable “color” and then ask the user to enter the colour that they
would like.

46 Issue 002 August 2017 diyodemag.com


SECRET CODE

PYTHON EXAMPLE (YOU CAN RUN IN IDLE): FLOAT AND DOUBLE

In simplest terms, a float is a number that is a fraction. Variables


color=input(“Enter the color you would like: “) declared of type float will have numbers on both sides of the
print(color) decimal point. The term “float” is short for “floating point”. Internally
floating point numbers are expressed as fractions of base 2 math,
and can represent values ranging from approximately 1.5 × 10−45
This code takes a “string” or a set of characters from the user, to 3.4 × 1038 with a precision of seven digits. This is defined
and stores it in the variable named “color”. We can then recall the as single precision and occupies 32 bits of the system memory.
contents of the variable at any time, by referencing the name that Modern systems will allow you to simply define a float, to store
we gave it – in this case, “color”. any number with that requires a decimal; however, if your function
requires more precision I would consult your languages guide. ››
DIFFERENT TYPES OF VARIABLES

Declarations:
Let’s take a moment to look at the common variables you will use.
Depending on your chosen language, the declaration and instantiation
will be different. Some languages will figure out what you want by
what data you put in it the first time, where in others you may have to Now depending on your language you will need to declare the
be explicit. variable. In C you must be explicit. That is you must tell.

STRING/CHAR
Arduino

“Hello World” This is the string that we discussed last month. Put int x;

simply it’s a string of characters. Depending on the system the


string variable itself is made up of a sequence of single characters.
These are referred to as a CHAR. Standard C is explicit in defining an
array of CHARs, as opposed to a string (although modern compilers Python

including Arduino’s Processing and Python allow a string). x=0

A string is one of the most common variables you will use. This is
how we will give real-world feedback to the users; for example, BEST PRACTICES FOR NAMING YOUR VARIABLES:
“Hello” in the example above. The only limitation on this array is the
available memory on your chosen processor. 1. Declare your variables with data if possible.

INTEGER, LONG AND BYTE 2. Use meaningful names such as Xpos or userName, not XX4
and y3e. A variable name should define its use.
1 or 73 or 42 or 7854 or -598. These are all integers. They are whole
numbers and are often referred to as counting numbers. They are 3. Avoid system keywords such as date, time, equals or data.
used for counters, loops and basic data elements. They occupy 16
bits and are used to store whole numbers from -32768 to 32767. If 4. Don’t reuse variables within the same functions or class.
your numbers exceed this range, then you will need to use a long.
5. Don’t use non-ASCII chars in variable names. It may work
A long is an integer that occupies 32 bits and, as such, can hold fine now, but may crash on other systems.
a much greater number range (please note: I am sticking with the
general rule of ANSI C. Most modern languages are a minimum of 6. Don’t use long names. Seriously you have to retype this...
twice this size for a long).
7. Stick to your naming conventions and case (i.e. don’t use
A byte stores an 8-bit unsigned number, from 0 to 255. This is often UserName, userName, username, USERNAME). Many
used for storing things like colour codes. If your memory is at a languages are case sensitive so this will lead to debugging
premium in your project, you should consider if your number will issues.
exceed this.
8. Declare it before you use it. This may seem simple, but you
would be surprised how often this error happens.

diyodemag.com Issue 002 August 2017 47


SECRET CODE

you use the variable. This will ensure that you do not get any stray
A NOTE ABOUT VARIABLES: Don’t waste space. One thing data. Not all compilers clean up after themselves, so they may
we repeatedly see in code is the programmer using strings just allocate a new piece of memory for you when you declare the
when they do not need to. It is much faster and uses less variable. If you read back, the variable before is used, so it is not
memory to use the correct variable type. The best example uncommon to find random numbers. Primarily this happens in C,
I have seen is where somebody declared a string to be and while it will probably not be an issue for you, best practice will
used for “yes” or “no”. While this may have meaning for the ensure it does not happen.
programmer or an end-user, they were using it to compare an
“IF” statement. A 3-letter string will increase the UNO’s global CONDITIONAL STATEMENTS
usage by 14 bytes, and its sketch memory by 4%. In addition
to this memory waste, it will make using the comparison We are all individuals. I’m not.
much slower, as the processes need to evaluate so much
more data. In many cases, a basic integer or even a BYTE will We need to make decisions, and even the simplest program will
suffice. need to evaluate some factors. The “IF” statement is the simplest
form of a conditional statement. Think of it as simply asking the
question; in our early example, we could ask the computer to do
›› Double is a very similar construct to float, but it occupies 64 bits something based on the colour of the cup.
so offers much greater decimal precision.
The English for this would be “if the colour is blue then tell the user,
VARIABLE SCOPE they are awesome.”

So does it matter where you declare a variable? Yeah, it sure does! PSEUDO CODE:
There are two important things you need to be mindful of. Firstly,
you must declare a variable before you use it (kind of). Secondly,
when you declare a variable makes a difference as to how it is If Color = blue then

accessible in the program. Take this example in C/Arduino: Print “You are awesome”

C/Processing/Arduino PYTHON:
int x = 0;
void setup() {
int y = 0; if Color == “Blue”:
x++; print(“You are awesome”)
}

void loop() { ARDUINO:


int z = 0;
x++;
} if(Color==”Blue"){
Serial.println(“You are awesome");
}

The first declaration is for an integer called X. This is a global


variable and can be accessed and modified from any point in the
program. Y is declared in the setup routine. It is only in existence So what if we need to do something, if it’s not blue? We have
while this is executing, we then increment the X variable by 1. Once a second part of the statement called “ELSE”. This allows the
complete, Y ceases to exist and is gone, along with its contents. Z is programmer to send the code direction elsewhere, based upon the
declared in the loop routine. At this stage, we can access X as it is conditions we have put in front of it.
global to the loop, but Y has since been dumped. If we were to print
X here, it would be 1. The X++ line increments the X variable, even The English for this would be, “if the colour is blue, then tell the user
though it was not declared in this scope. If we tried to call Z from they are awesome. Otherwise tell the user that they could be more
setup or Y from the loop, the program would crash, but we can use awesome had they chosen blue.”
X at any time.

As a general rule, variable declarations should be not null. If you


know what you are going to put in it (i.e. a number), put 0 in before

48 Issue 002 August 2017 diyodemag.com


SECRET CODE

PSEUDO CODE: ARDUINO:

If Color = blue then if(Color==”Blue"){


Print “You are awesome” Serial.println(“You are awesome");
Else }else{
Print “You could be more awesome had you chosen Serial.println(“You could be more awesome had
blue.” you chosen blue”);
}

PYTHON:
Note the double equals sign in the “IF” statement. This means, we
are comparing two things not assigning a value, as we did earlier
if Color == “Blue”: with the variables. ■
print(“You are awesome”)
else: NEXT MONTH: ARRAYS AND MORE
print(“You could be more awesome had you chosen
blue”) GOT SOMETHING TO SAY?
To discuss this edition of Secret Code, visit:
https://diyode.io/002brtm

Understanding Binary
To better understand how variables work, you need to The modern systems will use an 8-bit base 2 system, to store its
understand some basic binary function. Digital systems (Micros/ information. This 8-bit number is referred to as a byte.
PCs, etc.) store their information in a binary format. It is
expressed in 0s and 1s. This is base 2 math. As humans, we use 0 1 0 0 0 1 0 0
base 10 math, which is much easier for us to view but very hard 128 64 32 16 8 4 2 1
for a computer to store, express and process. A simple example
would be if we want to store the number 4. 4 in base 10 is simply This will allow you to store 256 numbers (0-255)
4 (base 10 counts to ten, then continues 9-10-11); however,
using base 2, 4 would be expressed as 100. Now you probably want to use numbers much bigger than this,
so you can continue it out to a 2-byte number or 16-bit number.
Each of these numbers presents a single bit. The first number on This will allow you to store a number as big as 65535. This is
the far right-hand side is 1. Now is the bit switched on or off? Is it referred to as an “integer”. It is a whole number (i.e. no decimal
1 or 0? In this case, it is off. We move on to the 2: is it 1 or 0? It’s points or fractions). To make it more useful, it uses a sign bit as a
0, so we move on. Next, we have 4: is it 1 or 0? It’s 1, so we have representation of positive or negative number. This results in the
a 4. Finally, we have 8, which is 0: so the only number is 4. number range of -32768 to 32767.

0 1 0 0 So why is all this relevant? On modern computers with GBs


8 4 2 1 of RAM, it problem doesn’t matter, but when you are working
with a micro, such as the UNO or the Nano, then any memory
A more complex number would be 7: saves will result in a major performance enhancement; be that
through available RAM or processing time. It is much faster for
0 1 1 1 the processor to process numbers than text because each text
8 4 2 1 character occupies more space.

How about 12:

1 1 0 0
8 4 2 1

diyodemag.com Issue 002 August 2017 49


FEATURE

VIVID
IMAGINATION
Interactive Light
Installation at
Vivid Sydney
Many minds and hands came
together from CREATE UNSW
to produce an interactive light
installation that responds to the
person standing in front of it.

50 Issue 002 August 2017 diyodemag.com


FEATURE

That’s awesome. We would have totally voted for Pac-Man! What


did you create for the 2017 festival?

This year’s project, Crystallise, is an LED mural comprising of


multi-coloured triangular and quadrilateral forms. The installation
appears to be a mosaic, but encourages viewers to come closer by
A few members displaying randomly generated colours and patterns. As they come
of CREATE UNSW with Crystallise. into close proximity with the mural, sections of the canvas fade,
CREDIT: Grant Turner leaving behind only a pair of wings.

Our main inspiration is Colette Miller’s “Angel Wings” murals, which


CREATE UNSW is a maker group based at the University of New were exhibited as street art in Sydney (Australia), Los Angeles
South Wales (UNSW), Australia. Based on the UNSW campus, in (United States) and many other locations. To Miller, the wings
just five years the club has grown to over 2,000 members. This represent our “inner angel” and remind individuals of the pure
passionate community brings students together, holds workshops and good part of the human condition that emerges, even when
for the general public, and is achieving some amazing things. Unlike individuals experience trauma and guilt in their lives. The wings’
your average neighbourhood maker club or hacker space, CREATE embodiment of the human spirit challenges individuals to consider
UNSW is sponsored by the UNSW Faculty of Engineering, and most their choices as humanity, and work towards a greater good.
recently they developed a stunning interactive light display as
part of the 2017 VIVID festival in Sydney. Their installation, titled We decided to extend Miller’s artwork to include different
“Crystallise”, reacts to the people moving in front of it by generating spectrums of humanity, and the idea that everyone has secrets or
a sensational interactive experience. We caught up with CREATE hidden truths. By having different lighting patterns on the artwork,
UNSW President Anthony Feizi-Sobbi, to hear all about it. and hiding the pair of wings until observers come close enough to
see them, the installation allows people to fulfil their desire to find
How did CREATE get involved with the VIVID Festival? truths within themselves, and recognise and cherish their individual
differences.
Since 2014 we’ve presented at the VIVID Ideas speaking forum.
There, we’ve talked about lots of things, from the use of drones How did you go about creating your installation?
to presenting an interactive Pac-Man installation. Our first official
appearance in the Vivid Light Walk program however, was in 2016, Last September, Destination NSW invited artists to tender ideas
when we presented the Mondrian Cube at Circular Quay. Mondrian for artworks, so we first selected a main idea and then drafted
Cube was inspired by the works of the 20th century Dutch artist, our submission. Before and during the submission process, we
Piet Mondrian. designed the basic structure, additional features and electronics.
Final acceptance into the festival required an interview with festival
Crystallise marks our fourth year of involvement with the festival, curators, back in November/December. Following our acceptance,
and our second year having presented a project as part of the we developed a prototype during Australia’s summer break
official light walk program. (December 2016 to February 2017), to gain experience in how to
best build the main artwork. ››

diyodemag.com Issue 002 August 2017 51


About CREATE:
VIVID CREATE is a student-run club at the University
PROJECT of NSW that runs, collaborates and supports
CREDITS: practical projects to help students learn
skills in engineering, invention, and design. They also run and
LEAD ARTISTS: provide workshops for beginners on electronics, programming,
Yunzhen Zhang, soldering, prototyping and 3D modelling, and they also sell
Christopher Ho, electronic components on campus.
Alison Zhang,
Randy Tjang, Projects run by the club include UAV development, UGV
Guoyu Chu, development, machine vision workshops, and competitions for
William Weng autonomous cars and various personal “gadgets”. CREATE was
involved in the 2016 UAV Challenge: Medical Express, and QUT
COLLABORATORS: Droid Racing Competition (they came first place in DRC 2016
Jabez Wilson, and 2017).
Junji Moey,
Alexander Lam, Most CREATE members are current UNSW students studying
Peiju Li, engineering, built environment, or art and design, but absolutely
Emily Chan, anyone can join; the club is open to students from all faculties,
Kevin Yu, and members of the wider community are welcome to partake in
Daniel Castillo, the activities as well.
Jason Phu,
Jonathan Hribar, One of the coolest things about CREATE is that it provides
Anthony Feizi- members the opportunity to become involved in different
Sobbi, aspects of the maker community, and it enables students to
Jonathan develop valuable technical and interpersonal skills. For students
Timmerman, it also gives them real-life opportunities to apply in practice,
Yuen Chan, what they might be learning about in class.
Daniel Wong
CREATE caters to university students and community members
The facilities of all skill levels, from absolute newbies to those with advanced
to build our knowledge. Their workshops provide fundamental programming
installation and electronics knowledge which is an ideal starting point for
were provided new makers who want to participate in their projects. If you can’t
by UNSW Art make it to the workshops, they are usually live-streamed on
and Design in YouTube.
Paddington.
For details about events, workshops and other information such
as Q&A and project sharing, visit: www.createunsw.com.au
FEATURE

›› We produced a detailed design of the final structure using


CAD and parametric modelling. We used Rhino 3D plus the
Grasshopper plug-in to produce graphics for mosaic and
wing patterns. LEDs are programmed serially and controlled
with a Teensy microcontroller. The procedure for physical
construction of the installation was as follows, with some
components being manufactured concurrently:

• The structural frame, which is divided into two halves, was


machined, painted and assembled by hand.

• Protective plywood covers for the side and back of the


installation, an elevated platform for maintenance, supports
for the installation, and wall anchors were cut and painted
by hand.

• Corflute spacer, structural plywood for the backing, and


front decorative panels were all machined by either a laser
cutter or CNC, and we used Grasshopper to generate the
patterns for the parts.

• The frame and backing plywood were attached. We drilled


holes to install spacers for the attachment of the diffuser/
front panel. Both halves of the frame were joined to the floor
with additional bracing.

• Corflute was installed to prevent spillover of light between


sections, and we used laser-cut mounts to hold the LEDs in
place.

• High impact polystyrene was used as a diffuser. Since it


cannot be laser-cut it was cut by hand, then attached to the
front plywood covers using liquid nails.

• Front plywood panels were progressively installed onto the


main structure, and secured with screws. We used black
silicone to seal any large gaps.

• Infrared sensors were inserted into extra large holes, which


were drilled into the panels in the middle of the structure.

• When transporting, the installation was taken apart into


halves, and reassembled onsite with the supporting
platform. It was then anchored to a ledge behind the wall.

• Protective covers were installed. ››

diyodemag.com Issue 002 August 2017 53


FEATURE

EXPLODED VIEW:

Front (Left) to Back (Right):

• 3mm plywood front cover


• 1mm high impact polystyrene for
diffusion
• 3mm black corflute to restrict
lighting within box
• 6mm plywood LED mount
• 12mm plywood with LED holes &
corflute support structure
• 18mm spacer
• Structural mounting frame to
connect to sandstone wall mount

›› Wow, that’s quite a lot to coordinate; but you clearly pulled it off. We installed an RFID card reader towards the final stages of
Tell us a bit about how the installation works? construction, so that team members could trigger custom patterns
for personal occasions. For example, one person even used the wall
The wings and custom lighting patterns are generated in to propose to his partner!
Grasshopper, and are programmed into the installation using
Arduino code, which was written by our software team for a Teensy We absolutely love how it’s customised to the visitor, so everyone
controller. The software indexes each region of LEDs, which has a slightly different experience! Obviously much of your design
represent the triangular and quadrilateral shapes on the mosaic, process would have focused on materials, given it’s a large
using graphs to determine a particular region’s distance from a physical installation. What factors were considered when selecting
selected centre region. It then turns regions on or off, according hardware?
to a supplied algorithm. Distance is provided for the programmer’s
reference, and can be used to design and implement patterns such We took into account the fact the installation will be outdoors
as light radiating from a centre point, or striated lines travelling in and near a wharf, so we needed to make the installation and its
several directions across the mosaic. interactive components robust and easy to maintain. We chose all of
our components to be rated for outdoor weather (IP64 and above),
Infrared sensors installed vertically in the middle of the installation, from power supplies to LED modules right down to the sensors that
detect if there is a person standing in front of it, at which point the were used.
remaining LEDs fade out and reveal the wing patterns. Depending
on the person’s height, different sensors will be triggered and The electronic hardware for light control was kept minimal as well
certain combinations of triggered sensors will result in the base - normally for LED displays of this scale, people would be looking at
of the wings appearing higher or lower. The installation returns breaking out a laptop or some mini-computer to do video processing
to normal programming once the person leaves the centre of the in order to control the lights; but due to the location we were in, we
installation. had to use something that could be replaced cheaply and easily. ››

54 Issue 002 August 2017 diyodemag.com


EXPAND
YOUR
FLOW
Introducing the world’s
first eMTB Mode

The new eMTB Mode for the


Bosch eBike Systems has launched the world’s first ‘eMTB
Performance Line CX
mode’; specially designed for eMountain Bike riders, to eMTB
provide a more natural riding experience on all terrain.

Take on more technical and narrow trails (uphill and


downhill!) with greater control, as Bosch’s eMTB
Mode instantly regulates the power assistance
to provide the ultimate riding experience.

www.bosch-ebike.com.au

Upgrade your Performance Line CX NOW at


your local bike dealer, to expand your flow
Brands epowered by Bosch:

More trails. More adventure. More enjoyment.


FEATURE

Wiring was no easy task. Testing a few of the 1550 LEDs installed.

›› The LED modules we used were IP68 UCS1903 lights, which can 3.3V to 5V nicely, and it comes with ethernet ports for the signal
be powered by common 12V power supplies and draw a maximum and ground pins of the LED modules, which helps reduce electrical
of around 0.9W per module. There are approximately 1550 LED noise. Its usability and robustness also makes it very easy to use
modules used for the whole installation, so its maximum power and replace.
consumption is around 1.6kW. To cater for the maximum power
consumption, we used four 400W outdoor power supplies. In terms of sensors, we tested a variety before settling on our final
choice, which was the E18-D80NK. We wanted something that can
The microcontroller we chose to use was a Teensy 3.5 - it had more give a binary reading, to save on additional processing times (as
I/O ports than we needed, a faster clock speed over the 3.2, and opposed to using a sensor that requires analog input, or a fancy
5V-tolerant digital pins, which we wanted for our application. We timing library). We also chose this sensor as it only uses three wires,
decided to manually map out all the locations of the LED modules, which makes the electronic installation easier.
and then group them into eight long strings. This enabled it to
be used in conjunction with the OctoWS2811 shield. While it is 1.6kW - wow! It helps give scale to this massive installation
technically possible to control the UCS1903 LED modules - using though! The PJRC Teensy sounds like it suited the installation well.
the 3.3V output from the Teensy I/O pins directly - it’s typically Obviously you didn’t tackle this whole thing by yourself; how many
recommended to use 5V logic for most of the addressable LEDs on people worked on the project?
the market, as this prevents issues such as signal deterioration.
The OctoWS2811 shield does the level shifting on the I/O pins from We had 18 team members, divided into three subgroups and
they were responsible for structural design, electrical design and
software programming. Construction was a whole team effort,
mostly led by the structural design group. Team members were
free to transfer between groups, or help others depending on their
expertise and prior experience.

That’s a great way to help people gain experience across different


parts of the build. What was the most challenging aspect of the
project?

For most team members, it was the balance of project work with
jobs, university assignments and other commitments. For the team
leader, it was managing the different schedules and logistics, as it
was her first time leading a huge team. The project was unusually
construction-heavy, and we had several design issues during the
Four 400W power supplies provide the 1.6kW required. build. While most of the issues were solved with improvisation,
much of the work was completed at the last minute.

56 Issue 002 August 2017 diyodemag.com


FEATURE

There’s nothing like a deadline to get things moving! What was the
best part of the overall installation?

Observing how people interacted with the installation. Usually, it


takes some experimentation for them to stand in the right position
to trigger the wings, but once the wings appeared, it was always
rewarding to see their amazement in the function and aesthetic of
the artwork.

There’s nothing like seeing people enjoying the interaction with


something you’ve worked hard on! The proverbial “version 2.0”
often conjures up new ideas and possibilities. Given the same brief
again, what would you change?

1. A
 dd sensors on each side, and program the wings to shift
laterally, in addition to upwards and downwards. We did not
consider this option due to the technical complexities involved,
but given more resources, it would be a great addition to It's not all serious at CREATE.
Crystallise’s functionality.

2. D
 esign a light source to illuminate the viewer’s face for
photography purposes. Currently, photography of people standing
in front of the installation requires diffused light that is pointed
away from the subject, so as to provide enough light to make
the subject’s face visible. However, we have found creative ways
of photographing people in front of the installation, such as
excluding background light and making the subject appear as a
silhouette in front of the artwork.

The addition of lateral shift would possibly make it behave almost


like a full-sized human heat map! That would be amazing to watch,
but would definitely require more processing. We'll be keenly
watching what you all get up to next! ■

WANT MORE?
To discuss this installation, view more images,
or check out detailed tech drawings, head to: Testing during final stages of construction.
https://diyode.io/002zqfc

◄ LEFT
Crystallise in use.

diyodemag.com Issue 002 August 2017 57


PROJECT

SUPER
SIZE ME!
VAN DE GRAAFF
GENERATOR
Ever wanted to get 40,000 volts to fly through the air?
We’ll show you how to build a Van de Graaff generator
that will do just that! - by Daniel Koch

58 Issue 002 August 2017 diyodemag.com


PROJECT

A Van de Graaff generator is a device recognisable to most of HOW IT WORKS


us - physically, if not by name - often from high school science.
Here, we take that desktop-sized concept and build a super- The basic construction of a Van de Graaff generator involves two
sized one. Why? A better question would be, WHY NOT! rollers, one of a material from the negative end of the triboelectric
scale, and one from the positive end, with a belt between them
The Van de Graaff generator has its origins in the early days of of a material from somewhere on the scale, in between the roller
nuclear research, having been developed by Robert Van de Graaff materials. This assembly is mounted in a frame of some sort of
as a particle accelerator. They are even still used today as high insulating material. There are “brushes” of pointed metal that are
voltage generators, in some specific research fields. Beyond close to, but not touching the rollers at each end. The brush of the
research and high school science education, Van de Graaff physically lower end is connected to ground, while the brush of the
generators can actually be a lot of fun! The distinctive metal upper end is connected to the metal sphere. One of the rollers is
sphere in the top is the fun zone, where you can cause foil pie driven by an electric motor, and as it rotates, something happens
tins to levitate and fly away from the top, watch piles of confetti that isn’t far from black magic. The roller made from the negative
scatter into the air, or see balloons lift off and stick to whatever material, which likes to “pull” electrons to itself, attracts electrons
they touch. You can even make your hair stand on end, zap from the brush and whatever the brush is connected to. However,
someone near you (although you will equally share the pain!), the belt is in the way, which stores the electrons. The belt moves,
and have bright blue electric arcs jump to the grounding rod. It and at the other end, it rolls around the roller made from the positive
can even form the basis of a lot of photographic fun. material. This material repels electrons, so they are pushed off the
belt and to the nearby brush. They will cross a small air gap in both
THE BROAD OVERVIEW cases.

The Van de Graaff generator is, in effect, an electron transfer


1
pump, based in the science of electrostatics. To explain this, we
have to talk about sub-atomic particles. All matter is made up of
protons, neutrons, and electrons. Protons and neutrons clump Positive charge
remains
together in the nucleus, and the electrons orbit them. In some Upper brush
Sphere connected to sphere
materials, the electrons are attracted less strongly than others,
and can be encouraged to move. This is different to materials Negative electrons
attracted by upper roller
that conduct an electric current, known as conductors, in which
the electrons jump from one atom to the next, to be replaced by
another. In electrostatic situations, electrons are stripped from Negative electrons
travel along belt
one material and transferred to another. [1]

Underpinning this is the triboelectric effect. Every material has a Belt


position on the triboelectric scale, although finding a complete
list is near impossible. Many versions can be found that have
Negative electrons
differing materials on them; however, all revolve around the repelled by lower roller
same concept. When these materials come into contact with
each other in a situation involving friction, the more positive one
on the scale gives its electrons - or some of them, anyway - to
the less positive one. This is because electrons have a negative
charge. In real terms, the position of a material as positive or
Lower brush
negative on the scale actually relates to the state it will be in connected to ground
after the transfer. So, after losing negatively charged electrons,
a material is positively charged. While the reality is more
complicated, this explanation satisfies an understanding of the
Van de Graaff. The process repeats, with the charge being stored on the sphere
attached to the upper brush. It is important to note that Van de
Graaff generators can work both ways – by arranging the rollers, the
sphere can be negatively or positively charged. If it is positive, the
electrons are drawn from it, leaving it depleted of negative electrons
and so positively charged. If it is negative, then electrons have built
up around the surface of the sphere until it can hold no more. In
either case, a charge will build up so strong that the air around it
will become “ionised”, or charged, and begin to conduct. ››

diyodemag.com Issue 002 August 2017 59


PROJECT

›› This is called “saturation” and no further charge can be built up. 2 x 160mm x 12mm x 3mm lengths of Aluminium Bar
This is the point where sparks will be at their biggest and brightest. 4 x 20mm Super Magnets
Most Van de Graff generators - ours included - have a smaller 1 x Polyester Cloth
metal sphere attached to the same ground as the lower brush. This (Big enough to cut, hem, and stitch a 120mm x 850mm belt)
allows the charge to flow back to where it came from, neutralising 1 x 100mm x 600mm Perforated Steel Bracket
the charge. This provides both a way or getting the charge to arc
reliably, and a way to discharge the sphere when needed. ELECTRONICS PARTS REQUIRED: JAYCAR ALTRONICS
1 x Arduino UNO R3 XC4410 Z6240
THE BUILD 1 x Electronic Speed Controller MP3209 K6008
1 x Electric Motor
Before we begin, I have massive thank you to send to my father, (Ideally with a 6.35mm shaft) YM2776 -
Lester, who is a fitter and machinist by trade. Like all builds, this 1 x Motor Coupling,
one had several iterations before the current design, and while (Ideally with 17mm outside dia.) YG2602 -
searching for off-the-shelf options, my dad manufactured - at 1 x 6m Black Medium Duty Hook-up Wire WH3041 W2261
short notice and under high pressure - several rollers, shafts, 1 x 1m Red Medium Duty Hook-up Wire WH3040 W2260
and housings so that I could, literally, get the belt rolling on the 6 x Red Eyelet Crimp Lugs PT4514 H2031A
initial prototype. Having said this, the project as it is presented,
is designed to use no specialist parts, so as to be well within THE HARDWARE CONSTRUCTION
reach of most makers. The DIYODE Magazine team are confident
that this would be suitable for an eager school team to build and, The parts list is to build the generator in the same configuration as
with appropriate guidance, within reach of upper primary school the prototype; however, there are other options. To start, search the
students. internet for a list of materials in the “triboelectric series”. These lists
vary, so search them until you come up with some materials that
MATERIALS REQUIRED: you can source. I found leather at a fabric and craft supply store,
2x1  500mm x 100mm x 50mm PVC Rectangular Downpipe polyester cloth from the same outlet, and silicon tape is readily
(For framing) available. However, the best belt material is surgical rubber, which
4 x Mounting Flanges for Downpipe can be hard to find in retail outlets. It can be found online, or your
2 x 125mm “Cotton Reel” Boat Trailer Rollers local brand-name rubber supply store may be able to order it for
2 x Shafts for the Rollers you. The rubber you use should be natural, but much of what’s on
2 x 20mm Electrical Conduit Joiners the market is synthetic. Be sure to avoid black rubber as it contains
1 x Glue-lined 20mm Heatshrink carbon, which will conduct at high voltages.
1 x Leather Sheet (to cover one roller)
1 x Roll Silicon Rescue Tape (Often called “self amalgamating tape”) We built a simple sturdy base to support the entire project. It’s just a
1 x White Plastic Chopping Board thick piece of MDF with pine glued and screwed to the outer edges,
1 x Metal Sheet Bracket to increase the strength of the platform. Your base can be adjusted
2 x Stainless Steel Mixing Bowls to suit your preferences. Once you have made your base you can
2 x Spherical Curtain Finials move on.
1 x 1.5m x 25mm PVC Electrical Conduit
30 x 20mm 6-gauge Chipboard Screws
8 x 35mm 6-gauge Chipboard Screws
Top view of our base board.
3 x 20mm 4-gauge Self-drilling Metal Screws, Button Headed
1 x 300mm x 90mm x 19mm Pine
2 x 100mm x 90mm x 19mm Pine
1 x Plywood or MDF, at least 300mm x 600mm x 19mm
1 x L-shaped Bracket (Suitable to drill and mount your chosen motor)
1 x Stainless Steel Mesh Frying Pan Splatter Guard
1 x 400mm Length of 40mm PVC Drain Pipe
8 x White 300mm Cable Ties
4 x 15mm M3 Screws
4 x M3 Nuts
8 x M3 Flat Washers
6 x M4 10mm Bolts
6 x M4 Flat Washers
6 x M4 Nuts
2 x 80mm x 12mm x 3mm lengths of Aluminium Bar

60 Issue 002 August 2017 diyodemag.com


PROJECT

What you should now have is two pipes laying in front of you on their
Clamping side supports.
wider sides, with four plates of soft plastic mounted in them [2].

Next, lay them level and side by side, and remark the 120mm line
across them. Now, on one of the pipes, find the horizontal centre of
this line - top and bottom. Drill a 3mm pilot hole dead centre. Turn
over the pipe that will have the drive shaft through it, and mark the
same 120mm lines, top and bottom. At the centre, drill a 30mm or so
clearance hole. At the top, this will allow drilling of the second pilot
hole while at the bottom it will allow the drive shaft to pass though.
Next stand the two pipes in a flat surface. Have someone hold them
securely together while you drill through the pilot hole into the
bearing plastic of the second side. This will ensure a level shaft [3].

The greater the separation between upper and lower rollers, and
3
between ground and sphere, the more effective the Van de Graaff
generator. However, there comes a point where any gains will be
purely academic. Our PVC downpipe was cut to 1350mm, which
was half the available length. This material can be cut with a hand
saw, taking care to keep the ends square. Next, prime and glue
the mounting flanges into the ends of the pipe. Then, measure and Bearing plate with
pilot hole
mark a line across the 100mm surface, 120mm from the top and
bottom of each pipe. This will be the centre point of each roller. Bearing plate to be
Pilot hole
drilled
Now measure and mark a square to be cut out around this centre Clearance hole
point to provide clearance for the roller. Using a sharp knife, cut the (30mm)

square out of the downpipe by scoring along the lines several times,
Then drill a starting hole in the centre. Use pliers to peel and pry the Non-drive side PVC Drive shaft side PVC
downpipe frame downpipe frame
plastic, which should break along the score lines.

Rollers and shafts need a bearing of some sort. We used the soft,
low-friction plastic of a chopping board from a department store for
this. Measure, mark, and cut a piece to go inside the downpipe, then Now you are ready to drill a clearance hole for the roller shafts.
mark and pilot drill the screw holes. Next, slide the bearing plate into The top roller free rolls, while the bottom one is driven. For this,
the downpipe from the end, and attach with 20mm 6g chipboard we used a 150mm roller spindle for the top, and a 235mm spindle
screws. Start all four screws until they grip, then drive them home. for the bottom, which we purchased from the same retailer as the
rollers. Both are glued with liquid nails - the top one centred, and
the bottom one with just enough on one side to engage the bearing,
2
so as to leave a long enough shaft to pass through the downpipe, to
engage the motor. Cut the conduit joiners in half and place one half
on each side of each roller [4]. ››

80mm
4 Conduit Joiner
Half-Used as
Downpipe
Wall
Bearing
Flute
Outline of piece of Spacer
cutting board

Cut-out line

Drive Shaft
Passing
Screw holes
Through

120mm

Roller Glued
to Shaft

diyodemag.com Issue 002 August 2017 61


PROJECT

Leather-coated top roller.

It will now be prudent to dry-fit the components on the base board,


Mark the PVC carefully for matching holes.
using the photos and diagrams as a guide. Mark a centre line on the
long axis of the base board, and mount the frame along this line.
Screw down the non-motor side using 20mm chipboard screws,
then adjust the position of the motor side so that the roller shafts
freely rotate. Screw this side down as well. You don’t need to get too
carried away with this, as one side will be removed later, to add the
belt.

To assemble the motor support frame, drill a hole to mount the


motor in the L-shaped bracket. Ours was a 12V DC motor, which had
a 17mm flange around the shaft, and M4 mounting holes. These
were marked and drilled, along with screw holes, in the base of the
Maker plates allow vertical adjustment. bracket to mount it. Measure the distance between the centre of
the motor shaft and the bottom of the bracket, and subtract this
from the distance between the centre of the lower roller shaft and
›› At this point, you can coat the rollers. This is critical to the the base board. This number is the height of your support frame.
operation of the generator, so do it carefully. The lower roller on the Subtract again, this time taking away the thickness of the 300mm x
prototype is covered in silicon tape, which should be applied using 90mm pine, which should be around 19mm. Mark the two 100mm
the package instructions. The ultimate roller shape for a belt is with x 90mm pieces of pine to this number, then drill and screw to the
a slightly convex crown, so we layered tape toward the centre. This 300mm piece using 35mm chipboard screws - see photos.
helps to keep the belt centred. The top roller is covered with leather,
rough side out. Mask off the shaft, then spray both the leather and Next, add the shaft coupling to the motor shaft. Our prototype had a
roller with contact glue. Allow the glue to become tacky, then stick 5mm shaft, which had to be bulked up to centre the coupling. This
the leather down. We used one rectangle for the centre of the shaft, was done with a strip of 0.5mm plastic, leaving a gap for the grub
and smaller, shaped pieces to cope with the curve at the ramped screw on the coupling to be firmly wound down against the shaft.
end of the roller. Align the coupling with the roller shaft, leaving 10mm between
them, and pencil around the support frame. Remove it, drill holes
along the centre line of each frame leg, and then screw into the
wood from underneath. Now the motor support frame should be
secure.

Glue-lined heatshrink connects these two


Silicon coated bottom roller and shaft rods, so a size mis-match isn't really an issue.

62 Issue 002 August 2017 diyodemag.com


PROJECT

Here comes the tricky part. Manufacturing the belt is challenging for Unscrew the non-driven side of the frame, remove it, and loop the
someone with no sewing skills so seek help if you’re unsure - even a belt over the rollers. Reassemble the frame, probably with help as
clothing tailor in a shopping centre could probably do this for you in the tensioned rollers will need to be guided into their bearing plates.
a few minutes [5]. Spin the lower roller’s drive shaft by hand, to make sure if rolls
freely. If it does, all is well. If it doesn’t, check nothing is impeding
the free movement of the rollers. If they don’t spin freely you risk
5
burning out your motor, or shredding the rollers.
SIDE VIEW CROSS SECTION

Glue the two mixing bowls together using a conductive glue


product. We used a product called ‘wire glue’ but other varieties
Stitched second, hems to
larger behind exist - check your local electronics or hardware stores. This glue
Folded hem Folded hem (stitched first) needs to cure overnight. While it is hardening, you can make the
brushes. They are made from mesh using a frying pan spatter guard,
Stitch
and 12 x 3mm aluminium strips. Cut two 80mm lengths and two
160mm lengths. Clamp one 80mm piece to one 160mm piece, and
drill 3.5mm clearance holes as per the diagram.
60mm
Mark a line at 110mm and bend at 90° so as to form an L-shape.
Then, cut an 80mm x 160mm long strip of mesh, and remove half of
the horizontal wires by gently unpicking them; you’ll be left with a
brush that looks a lot like a fine hair comb. Fold this in half length-
ways, clamp between the two aluminium strips, and drill clearance
holes. Assemble with two 15mm M3 bolts, four washers and two
nuts [6]. Make two of these. ››

Measure the flat section of the rollers between the ramps, and
6 1 1
double this number. Then measure the distance between the rollers. 2 2
Our total length was 1040mm from the outside of each roller. Fabric
6
does not come wide enough to go this entire distance, so two
halves of the belt will be made and sewn together. However, the 7
fabric stretches a lot, and our final belt was 800mm long, giving a 5

total length when opened out, of 1600mm. Our fabric was 1470mm
4
wide; however, if you purchase 2m, you can make a belt with just 2 2

one join. 8

3 3
Carefully mark a piece of fabric long enough to complete the
loop around the rollers, and wide enough to be doubled over and
1M  3 Nut
hemmed. For our prototype, this was 120mm. Start with a long 2F  lat M3 Washer
3M  3 x 15mm Bolt
length for the belt, and cut out bits until you have the right tension. 4 Eyelet
Ours went from 2080mm to 1600mm. Start by hemming each side 58  0 x 12 x 3mm Aluminium
61  60 x 12 x 3mm Aluminium
of your strip, then fold the edges in to the middle. Stitch them down 72  x Layers of Mesh
the length of the belt according to the diagram. Now stitch the ends 8M  ounting Screw

together to form a loop.

Our top sphere isn't permanently fixed,


making transport or storage easy.

The top brush and


roller assembly.

diyodemag.com Issue 002 August 2017 63


PROJECT

›› Now the bracket at the top of the mixing bowls can be added. This its grub screw. Pass the wire down the inside the 20mm conduit,
was made from a 100mm x 600mm length of perforated general and attach an eyelet to the other end. Now use the grub screw to
purpose mending bracket, from a major hardware store (in the same mount the finial to the end of the conduit, bulking up the diameter
section where you find corner and shelf brackets). Measure the with tape if required. This forms the grounding rod used to draw an
distance to the outside of the flanged mounting brackets at the top arc or to discharge the sphere.
of the downpipe frame, taking care to make sure the top roller spins
freely. We used six M4 mounting screws to mount ours through the The eyelets on the wires from the discharge rod, the grounding
existing holes in the bracket and flanges. This secures the top of the sphere, and the lower brush are now anchored together with a
frame and provides a magnetic mounting point for the bowls. 20mm chipboard screw on the base board. The grounding sphere
sits on the ground when the generator is in use, allowing electron
High quality stainless steel is not terribly magnetic. Even 20mm transfer to occur.
supermagnets did not stick well to our bowls, so we stuck ours
with strong double-sided tape, covered over with gaffer tape. This FINISHING TOUCHES
formed a strong but removable mounting for the bowl to sit on top
of the frame. The final step is to add spaces that keep the belt centred on the
rollers. These are 95mm lengths of 40mm PVC drain pipe, secured
Mount the brushes into the PVC downpipe, using a 20mm self- with cable ties near the rollers. These are critical for the belt to be
tapping screw in each straight. You may need to trim the brushes, held centre. In the “where to next” section, there are ideas for more
but this allows an amount of adjustment so that the brushes can be complicated but effective ways of belt centring.
made to sit just above the belt. Take a length of black hook-up wire,
making sure it’s long enough to go from the top brush to the bottom That completes your Van de Graaff generator! Check over the photos
of the sphere, and crimp an eyelet to each end; one is attached and diagrams provided, and get testing! You really don't need to
under one of the nuts and washers already on the brush assembly. follow our construction method too closely if you don't want to.
The other gets attached to the bowls with a self-drilling metal screw. The important aspects are using the right materials, and using
Cover this screw with gaffer or insulating tape. The top of your conductive or non-conductive materials - as appropriate.
generator should now be nearly complete.
WHERE TO NEXT?
At the base of the unit, the other brush is secured the same way. It
must be under the roller, and using an eyelet, a length of hook-up Those who possess or have access to machining equipment and
wire is attached and reaches all the way to the far end of the base source material, will benefit from custom-made parts. Rollers with
board. a convex crown could be custom made, as well as shafts and shaft
couplings. Motor connection could also be geared or belt-driven if
DRIVETRAIN / ELECTRONICS CONSTRUCTION you are familiar with such processes. This would be more reliable
and effective, but is out of reach of many makers.
The last step in generator construction is to mount the motor and
connect it to the belt drive shaft. Slide a 50mm piece of 20mm Further, a surgical rubber belt or tubing would possibly add
diameter glue-lined heatshrink over the drive shaft. Then screw effectiveness to the unit, although we were unable to source and
down the motor bracket in the position described in the construction test this in time (genuine rubber is quite expensive too).
paragraph above, and slide the heatshrink to cover the shaft
coupling and the shaft. Shrink it down, rotating to keep the fit even. Adjusting the position of the brushes may yield different results,
When cold, this creates a strong, yet flexible bond. You can now and it is worth noting that commercially-produced Van de Graaff
screw down the motor bracket. Solder connecting wires of red and generators have the sphere mounted over the top roller and brush
black hook-up wire from the motor to the speed controller, and from assembly. This is more effective, but harder to achieve unless you
the controller to the power supply. We used a 7.2Ah sealed lead acid possess the metal working skills required to cut the high-carbon
battery; however, a strong enough plug-in supply would work. The steel and clean the edges.
exact details here will depend on your motor choice.
Construction could also take the form of acrylic frame sides of
All that is left now, is the grounding rod and grounding connection. a single thickness, rather than the rectangular tube of the PVC
At a major hardware supply store, we found a pair of spherical downpipe; however, for structural integrity, front and back panels
steel curtain finials around 50mm in diameter. Remove the screw would need to be added.
from one, detach the tubular frame, and wrap the stripped end of a
500mm length of black hook-up wire around the screw; then firmly The ultimate way of achieving belt centring is with shafts mounted
screw it in. The other end of this wire gets an eyelet. Repeat this to ball bearings in adjustable housings. These are hard to source
procedure on the other finial; however, this time, use the remaining and use if you are not familiar with them, but anyone working
length of black hook-up wire, and retain the tubular connector and around machinery will know them. They are a housing that allows

64 Issue 002 August 2017 diyodemag.com


PROJECT

adjustment of the bearing in one or two


planes, creating a way to align the shafts
and stop the belt wandering. If you can
source and use these, you probably know
enough about them, as they are regularly
used on conveyor and flat belt systems.

Some final modifications could be a


reversing switch to experiment with the
direction of the belt and its effect on charge,
and changing roller materials. You could
even change the orientation, having the
negative material at the top and the positive
at the bottom.

At the end of the day, this is a fun piece of


equipment made from VERY easily sourced
materials, that viably demonstrates a useful
scientific concept in a way that everyone
can have fun with. Modify it, play with it,
change materials and see what differences
it can make!

A word of warning however: a generator this


size creates an electric shock much more
powerful than the small variety. Use it with
caution. Although it is unlikely to create
health effects, it can hurt and cause surface
skin burns. ■

WANT MORE?
To ask questions, leave comments,
and for plenty more images:
https://diyode.io/002vhvg
THE CLASSROOM

AC/DC
ROCKS ON
Not the band, but perhaps the band’s electric
style, is more than simply their name. Where does
the name come from? In their own words – “High
Voltage Rock and Roll – I like it both ways!”.
- by Daniel Koch and Bob Harper

Electricity, and especially the transmission of electricity, can only be


1
achieved by one or the other method. So, in this issue we compare
Current Flow Electron Flow
the virtues of each: ac and DC.

Last issue focused on current, and the means of conveying electric


charge from point to point, the meaning of the electric circuit,
and the measurement of electricity flow in coulombs per second,
and the Ampere. One more concept of current flow is necessary
to understand: the convention of current flow, and the direction of
current flow.

Before you can tackle ac/DC, you need to also understand another
measure of electricity; the concept of electrical pressure, or
electrical potential.

66 Issue 002 August 2017 diyodemag.com


THE CLASSROOM

CURRENT FLOW VS ELECTRON FLOW

Current flow and electron flow are actually the same physical effect. That means it had a PD of 9V. If I connect two 9V batteries together,
Originally, electricity was thought of as some kind of magic charge, so one negative terminal is connected to the other’s positive
and the charges were different, so one was called a positive charge, terminal, there will now be 18V across the outside terminals.
and the other a negative charge; it was true for so long that it However, there will still only be 9V PD across either battery. Now, PD
became the convention. is the difference between two points, but the term ‘voltage’ refers to
the value of that difference; naturally, the voltage of a 9V battery is
When physicists finally discovered electrons, and electron flow, 9V. However, voltage may also refer to the voltage above or below a
it was found that the electrons flowed opposite to the previous reference point, such as the voltage of the earth itself – also called
convention, so after some years of argument, physicists decided “ground (GND)”. Being the largest possible reference to us humans
to accept that there is conventional current flow, even today simply who live here, GND is always considered to be zero volts [3].
called “electric current”, and “electron flow”, which by convention,
flows opposite to the electric current [1].
3

9.0V
It is confusing, but as long as you remember that current flows DC
from the positive of a battery to the negative of a battery, and
electrons flow from the negative to the positive, you have it sorted.
Most of the time electricians do not think about electron flow, and
electronics people do not think about current flow; just remember,
both are the same in every way except the perceived direction of
flow. It is only when dealing with electrons themselves that a person
needs to be careful. In electronics, electrons are everything, and
in electrochemistry, ions are everything; but in the electrical trade,
current is everything. Earth

EMF AND POTENTIAL DIFFERENCE

While the number of electrons passing a point determines the This is fair enough, but remember it’s only a reference point. If I
current, and the coulombs of energy that is stored determines the connect the negative terminal of a 9V battery to GND, and measure
charge, there is one more parameter to be dealt with. Every physical the PD at the positive terminal, it will read 9V positive (+ve). However,
system has the same basic measures: the energy storage, the should I connect the positive of my other 9V battery to ground, the
energy flow, and the pressure that drives the energy flow. negative terminal will read as minus 9V, or 9V negative (-ve).

In electrical systems, that is called the “EMF” or “electro-motive Between the unattached terminals of the two batteries, there will
force”, or the “force that motivates electrons”. EMF is usually not be a PD of 18 volts, yet there is no more than 9V PD between any
known, except in electrical and science circles, but another name terminal and ground. This fact will prove very important, when we
for the same measure of electrical force is known. The “potential investigate three-phase electricity and the domestic electricity
difference” or “PD”, is the difference between the electrical force at distribution system [4]. ››
different locations, usually within a circuit.

4
No doubt you will probably have heard the term “voltage”, meaning
the number of volts (V), usually across a battery, which most of us

18.0V
are aware of by our teenage years. A 9V transistor battery – the little DC
rectangular one – had 9V between the positive and the negative
terminals [2].

9.0V 9.0V
DC DC
Earth

diyodemag.com Issue 002 August 2017 67


THE CLASSROOM

›› To summarise, voltage is a measure of the potential difference On the other hand, or in the other corner of the fight, ac could
between two points measured in volts, and the potential at any be generated at almost any voltage, fed into a transformer to be
given point depends upon the EMF of that point. converted into a much higher voltage, transmitted to the consumer,
where it was again fed into another transformer to be converted
AC/DC back down to the preferred voltage. Overall line losses have
improved over the years, but were always a small percentage of the
Okay, I almost forgot to mention ac/DC, right? Well no, we simply generated ac power.
needed these reference points first. Notice that despite the band
T-shirts always appearing as “AC/DC” or “ac/dc”, I have written WHY WAS THE POWER LOST?
“ac/DC”. This is because lower case is used when the parameter
is changing, and upper case refers to parameters that remain The final parameter that you need to understand regarding basic
essentially the same (ref: AS1104 - Electrical Nomenclature). electricity, is “resistance”. Every material known to man, at normal
operating temperatures at least, has resistance. According to some,
The voltage on the 9V batteries we have been referring to are DC resistance is the opposition to current flow. I prefer to think of it
values. That means “direct current”, or that the current will always as the toll paid by the current, for passing through the highways
flow in the same direction. Some think it means that the voltage will of electric circuits. In essence, electrons land on atoms giving off
not change but that is not correct. The battery will eventually go flat, their elevated energy as photons of light, or heat, and require more
but the voltage will always be DC, even when we charge the battery. energy from the battery or power supply for another electron to take
To charge the battery the current must flow the other way – in the that place. The resistor gets hot in the process, thus burning up
opposite direction – but it is still a direct current, even though it has energy [5].
changed direction. Additionally, the positive terminal of the battery
is the same polarity (i.e. still positive even though the current has
5 Photons are released when
changed direction). electrons crash into atoms.

SO WHY IS AC DIFFERENT TO DC?

Alternating current is a current that flows back and forth, due to


Electron
an alternating voltage – as a result of how the voltage is generated
Photon
(note: alternating current (ac) is generated in an alternator). In most
circumstances, ac and DC produce exactly the same results as each Atom

other: heating, lighting, and running motors and other devices. It is


only when a device is designed to take advantage of the power supply
being either ac or DC, that we notice the difference. For example, Georg Simon Ohm was a physicist who wanted to know what
some motors only run on ac, but some run on either. Some chemical materials were the best for conducting electricity. Ohm devised an
processes only run on DC, yet most welding applications only run on experiment to test various materials, and allocate a value to each
ac. Engineering involves using the best of what is available. one, so the best materials would be known. In the process, and
only because he understood mathematics very well – especially the
Batteries only generate DC, and alternators only generate ac, but formula for a straight line – he discovered what we now call Ohm’s
many DC generators exist, and almost all generate ac, which is Law: R = V/I, or put the other way around, V = IR. ■
then converted into DC by a method called ‘commutation’. Either
mechanical switching, or diode switching is used to cause a DC GOT SOMETHING TO SAY?
current to result from an ac method of generation. DC power To leave your comments, visit:
supplies, such as solar cells, also generate ac current using an https://diyode.io/002bcsv
inverter, which is the reverse of a commutator.

TRANSMISSION OF ELECTRICITY
EDUCATORS NOTE:
Electricity is only good if it is readily available when and where
you need it. The Edison vs. Tesla debate (Issue #001) ended when Here is a great experiment to prove Ohm’s Law and
Edison’s DC system was unable to convey power more than a few demonstrate the value of understanding the basic functions
miles from the power generation plant. The DC had to be generated (linear equation) in maths. Take a number of materials, and
at a voltage equal to the voltage required at the load end, where measure voltage required to push a range of currents through
the electricity was to be used plus the voltage that was lost in the those materials. Tabulate the results and graph them, then
transmission lines. As transmission lines grew longer, more energy prove Ohm’s Law is a Linear Relationship: Y=MX+C or V=IR+0.
was being lost in the lines than was being used by the consumer.

68 Issue 002 August 2017 diyodemag.com


THE CLASSROOM

History of Electricity:
How Much
Power Is Lost?
- by Bob Harper

Let’s assume that Edison’s system and Tesla’s system were


given fair comparison in the late 1880s. Both are given the
task of delivering power to a farmhouse 1km from town. The
voltage should be 100V and the current 10A. The load will be
R = V/I, 100/10 = 10 Ohms.

Tesla converts his voltage to 1000V, thus reducing the current


to 1A, and at the other end converts back to 100V, thus back
to 10A.

Accepting that the current must get there and back in a


closed circuit, the 1mm CSA copper wire will be 1km x 2 =
2km long. The resistance of that wire (trust me, or calculate it 100Vac - 10A

yourself) will be 0.0192 x 2000m = 38.4 Ohms.

Tesla’s 1A will cause V=IR=1x38.4V of the 1000V line, a


loss of 38.4/1000x100% = 3.84%.
10:1
Transformer
Therefore, to deliver 100 volts he must generate 103.84
volts in his alternator to cover the losses.

Edison has two options: use the same lines, in which case
he sends 10A over 2000m at 0.0192 Ohms/m and loses
10x2000x3.84 = 384V. He therefore must generate 484V
@ 10A or 4840W to deliver 1000W. Of course, the second
option is that he could start with a bigger wire. He needs
to use 2km of 100mm Cross Section Cable, just to equal 1:10
Transformer
Tesla’s efficiency. Do the maths!

CHALLENGE: 100VDC - 10A

Copper weighs 8.94 tonne per cubic metre. How much would
those cables weigh? What cost?

RESULTS:

1. Tesla has the best system – ac power distribution works.


2. DC is good and has its uses, but is not good enough over
long distances.
3. Electricians, engineers and physicists need their maths!
EDISON DC TESLA AC
GENERATOR ALTERNATOR
FEATURE

Prototype to
Production...
MIGHTY
MICROS
When it comes to electronics, collaboration
can generate some truly amazing results. The
Micromite Explore-28 is one such example.

INTERVIEW WITH
ROBERT ROZÉE Four people, spanning three different countries (Australia, New
Electronics Engineer from Christchurch, NZ. Zealand, and the United Kingdom), have come together to take a
simple PIC prototype into a full functioning, powerful production
board. We caught up with Robert Rozée from New Zealand, to take a
close look at the Explore-28.

GRAEME RIXON For those of us who aren’t familiar with using PIC micros, for
Electronics Engineer from Dunedin, NZ. practical purposes, what’s the difference between a PIC and, say,
www.rictech.nz an Arduino?

It mostly comes down to the memory resources and onboard


peripherals - almost everything out there running on single-chip
micros is written in C, and so details of the chip architecture are
PETER MATHER generally well hidden from the programmer’s view. Things have
Retired IT Director from Cambridge, UK. come a very long way from the days when you needed to code in
assembler, in order to gain sufficient speed and fit your program
into available memory space.

The main reasons Geoff Graham selected the Microchip PIC32MX


devices for creating the Micromite, were because of three key
GEOFF GRAHAM features that other chip manufacturers could not match in a
Electronics Engineer from WA, Australia. single device:
www.geoffg.net
1. A 32-bit processor;
2. It was housed in a hobbyist-friendly 28-pin DIP package; and
3. It had an extremely large onboard memory.

70 Issue 002 August 2017 diyodemag.com


FEATURE

Figuring out the


fundamentals.

The first Micromite used an MX150, containing 128k of flash Micromite helps take the pain out of PIC programming. Do you lose
memory and 32k of RAM. This was just enough space to squeeze a anything (such as speed or efficiency) when using MMBasic over
complete floating-point BASIC interpreter and full-screen editor into, Assembler or other compilers?
leaving around 20k of flash for holding the user’s program and 20k
of RAM for variables. There are always compromises. Certainly one can write far more
compact code in Assembler (or C), and it will run much faster.
Soon after Geoff created the Micromite, Microchip released the Remember, BASIC is an interpreted language and so will always
MX170 with double the flash and RAM (256k and 64k respectively), be 20 or more times slower than Assembler. But BASIC has some
enabling a good deal of “wiggle room”, which was quickly distinct advantages, which can more than make up for the slower
consumed by the addition of 64-bit integers and support to drive speed and larger memory requirements.
small colour touchscreen displays.
For a start, BASIC is much simpler to learn, and this can lead to a
The largest flash/RAM combination offered at the time by Atmel, considerably shortened development time for your project. For the
in a DIP package, was 128k of flash and 16k of RAM in the 40-pin hobbyist this is especially true where a project that might take six
ATmega1284. That was it. There was no roadmap leading beyond months of learning (in Assembler or C) may never even be started.
these constraints, and so any 1284-based Micromite would be Compare this to perhaps a few days of development if the same
pegged at just 4k of user RAM. The 1284 also has a maximum clock task was coded in BASIC. Sure, the BASIC program might be slower,
speed of 20MHz, while the MX170 goes up to 50MHz. and use more ‘computing resources’, but does this really matter?
From tinkering with Micromite BASIC over the last few years, I can
While other manufacturers offer single-chip devices with more say with some confidence that in the vast majority of hobbyist
flash and RAM, none of them (that I can think of) currently offer projects, speed and size of code are of no importance. Indeed, this
the same quantities of flash and RAM in a pinned package as does also holds true for many commercial projects - computers, from
the PIC32MX line from Microchip. For the hobbyist those little pins the biggest right down to the tiniest, have advanced to the point
that can plug into a solderless breadboard are pure gold, far more that computation resources are only ever an issue in quite rare and
important than any philosophical discussion over chip architecture. specialised cases. ››

diyodemag.com Issue 002 August 2017 71


FEATURE

An early prototype of the board. Mid-development prototype.

›› In cases where speed is absolutely essential, MMBasic does If we are talking about an MX170 running an MMBasic program
allow the user to embed within their BASIC code, and call C or MIPS that could also be rewritten in C for the 328P (the 328P has 32kB
Assembler routines that have been pre-compiled and converted of flash and only 2kB of RAM available, compared to 59k of flash
into hexadecimal format. These are called “C-functions”, and and 52k of RAM for MMBasic programs and variables respectively.),
the feature has been used to great effect by Peter Mather to add the C code will almost always be faster than the BASIC code. But
support for various colour LCD displays, additional software serial as I have said earlier, speed is not nearly as critical today as it was,
ports, and to directly manipulate on-chip peripherals. Some of these say, 10 or 20 years ago. MMBasic provides many non-speed related
C-functions are distributed with the language documentation, while advantages, such as ease of learning and speed of development, as
the most popular ones have ended up being incorporated directly well as inbuilt support for a number of different peripherals that the
into the MMBasic interpreter by Geoff. While creating C-functions is beginner may want to start out experimenting with. For instance, a
not for the faint-hearted, and there are some limitations to what a single statement can read a DS18B20 temperature sensor, another
C-function can do, the facility is there. can write to a two-line LCD display module.

Another plus for the Micromite is the ability to very quickly If we are talking about an MX170 running C code, then the MX170
experiment and directly see what happens. In the hobby sphere, will easily outperform the 328P. The 328P is an 8-bit core running
Arduino is often considered the benchmark. Now don’t get me at 20MHz tops, while the MX170 is a 32-bit core running at up to
wrong, I do believe the Arduino ecosystem is great, but because the 50MHz. The MX170 has 256kB flash and 64k RAM, while the 328P
code is compiled, there is always the compile-download-run cycle has 32kB flash and only 2kB of RAM. The MX170 is a far larger and
to go through. If your code compiles but doesn’t work correctly it more sophisticated bit of silicon, while costing only twice the price
can be extremely difficult to figure out why - the little computer your of a 328P (US$4 versus US$2 from Microchip direct).
code is running on is not very “accessible”; you cannot easily look
inside the 328P processor on an Arduino board and see what it is The reason for the two answers is that the Explore-28 board does
doing. So for the beginner, this limitation can be daunting. not have to run MMBasic. There are projects such as Pinguino and
chipKIT (with a PIC32 core extension) providing an Arduino-like
With the Micromite you, the programmer, are much more intimately experience. It is quite conceivable that either of these could be
connected with what is going on inside the chip. You can type in adapted to work with the Explore-28 with little effort.
code and instantly see what the results are, and if your code does
crash then the MMBasic interpreter ensures that it does so fairly THE EXPLORE-28
gracefully, and gives you a good measure of feedback as to where
things came unstuck. This has always been one of the big pluses for Running on MMBasic, with the form-factor of an Arduino Nano,
interpreted languages such as BASIC or Python. the Explore-28 provides the speed and efficiency of a PIC
microcontroller, but can be programmed directly from your USB port.
Instant feedback is definitely useful, especially when learning. In We continued the conversation with Rob Rozée to talk more about
terms of application speed and functionality, what’s the benefit of a the E-28 and how it came together. ››
MX170 over an ATmega328 (Arduino Nano)?

72 Issue 002 August 2017 diyodemag.com


FEATURE

›› Anyone with a keen eye looking at the pictures of the board will To be honest, it’s something I had in mind right from the very start
notice, the E-28 uses two PIC micros on the one board. Can you and so it was a process of continual and slow evolution. If I were
detail the role of the 16F1455 in the board? asked to provide an exact moment I’d have to say 20 April 2014
at 5:43pm, which was when I started a thread on The Backshed
The 1455 provides two specific functions that the MX170 cannot Forum, titled “Simplest 32MX150 ICSP” . This forum is talk-central
perform itself: for all things Micromite.

1. It works as a USB to serial bridge using the open-source M-Stack Geoff’s first release of Micromite BASIC for the (then) MX150 had
USB stack. The MX170 does not have onboard USB itself, so in amazed everyone. Previously there was his Maximite BASIC (running
most cases when working with a bare DIP MX170, you would on an MX695, VGA output, PS/2 keyboard and programs stored on
need to use something like an external CP2102 bridge module to an SD card), but the Micromite stripped back the hardware even
connect to a PC. further, to the bare minimum - one chip and one capacitor. However,
some folks were struggling to get the firmware into the chip, and
2. The 1455 also contains an implementation of ‘ASCII ICSP’. I could see that the existing solutions were beyond the abilities of
This is a protocol that allows the 1455 to be used to upgrade many MMBasic enthusiasts. So, I started the aforementioned thread.
the MX170’s firmware using a programme called pic32prog
(https://github.com/sergev/pic32prog) . I developed ‘ASCII ICSP’ I’d worked with Arduino before, and had been impressed by the all-
specifically to allow easy uploading of the Micromite firmware in-one nature of the whole Arduino system. It significantly reduced
to the MX170 after seeing the complexity of using the official the barriers to tinkering with tiny computers, but there were still
Microchip solution - the MPLAB X IDE (a 400MB download) and a some hurdles (and nasty hidden potholes). Some people managed
PICkit 3 that costs around $50 from Microchip. Micromite BASIC to brick their Arduinos due to a small design flaw that was finally
is always evolving with new enhancements and bug fixes, and rectified in the UNO rev3 but never publicly admitted to by the
from very early on users were having to deal with this expensive designers; and while the Arduino IDE does a great job at taking care
and complicated firmware update process. of much of the drudgery of programming in C, there are still barriers.
For example, C is simply not that easy to understand for the non-
As it happens, originally “ASCII ICSP” ran on an Arduino Nano. My programmer, and an Arduino sketch that fails is not very pleasant
code for the Nano was converted by Peter Mather to run on the to try and debug. While lots of people do great things with Arduino,
1455, and then integrated with M-Stack by Peter, through a long lots of people also walk away due to frustration.
chain of emails between us running back and forth around the
globe. So, I set about trying to bring together the advantages of the two.
This required following several threads, or “lines of enquiry”:
Thank goodness for the internet - imagine going through that
process via post! What is the biggest benefit of this setup, over • Software to upload PIC32 firmware
using the MX170 on its own? • Firmware to interface to the ICSP port on the MX170
• Hardware components to sit between the USB port and MX170.
The biggest benefit is having one simple-to-use package that
contains everything, much as an Arduino board “contains The forum thread kicked off several solutions, and proved that some
everything”. The MX170 runs Geoff’s Micromite BASIC; the 16F1455 quite hopeful approaches were simply not viable. The task of talking
provides the USB to serial bridge as well as a very simple means to an ICSP port was (just) beyond the ability of simple bit-banging
to perform firmware upgrades; and an onboard regulator provides solutions - alas, a USB to serial bridge on its own was not sufficient.
a regulated 3V3 supply (MMBasic assumes a 3V3 supply for the
onboard A/D converters to read right). The process followed through several stages, along with a few
breaks of several months at a time. Getting in touch with Serge
The MX170 in a DIP package is a marvellous solution for many Vakulenko was a major turning point, as he helped me get set
applications, and those pins are what I feel make the Micromite up to add ‘ASCII ICSP’ support to pic32prog. At the same time I
magic. The Explore-28 simply expands upon this, and helps open used a spare Micromite to act as a crude programming head - this
up MMBasic to those who perhaps aren’t so confident plugging the enabled me to get the software sorted without the final firmware
necessary parts together, or whose application fits with the all-in- and hardware. Once pic32prog was sorted I took a break of a few
one solution. months, then moved onto the firmware and hardware, in the form of
an Arduino Nano, five resistors, and a zener diode. The firmware was
So you’re using two chips to still gain that simple connectivity. an Arduino sketch (C code) to translate a stream of ASCII symbols
That’s great! When did you realise this was a winning combination (essentially eight letters: d,e,f,g,D,E,F,G) into clock and data pulses.
and wanted to move from prototype to hardware? This was then published as a Silicon Chip Magazine article, and after
that I stopped again for a few months.

74 Issue 002 August 2017 diyodemag.com


FEATURE

and I had an email discussion about converting it to something the


size of a Nano.

I believe it took a couple of months as we worked back and forth


over the board layout. We started out with the QFN-packaged
MX170 because we both believed that neither of the other two
SMD options (SOIC and SSOP) would fit onto the board. Right from
the start we used four layers; the two internal ones being ground
and 3v3, with signals on the two outer layers. It was only when
it came to assembling the QFN packages onto completed PCBs
that I realised how much of a pain they were to solder by hand
(not impossible, but really hard), so after the initial run we quickly
decided to revisit the other packaged options. Of the QFN boards
Identical footprint to
that went out, I am only aware of one single bad QFN solder
Arduino Nano.
joint, which is an absolute miracle, looking back on it now!

As it turned out, the largest SMD package - SOIC - could be


fitted. When it came to assembly, the SOIC boards were an
absolute pleasure to populate - not only in the soldering of the
MX170, but also because this time around we’d gone to the
trouble of lining up all the resistors and capacitors in the same
orientation, making it much quicker to place and solder them.

Apart from some boards that were accidentally ordered


without the internal layers filled in, all others were fully
functional and could be shipped to customers. I guess it does
Several iterations to get from prototype to finished product. help that, electrically-speaking, the design is very simple, so
there was not too much opportunity for things to go wrong.
As I said before, I’d always had in mind the “final product” being
all the bits on a single PCB, much like an Arduino board. This What hurdles did you experience going from prototype to
was already sort-of-there in that if the reset pin of the Nano was production board, in terms of circuit design, differences between
jumpered to ground, the RxD and TxD pins from the Nano’s onboard DIP to SMD, or anything else?
USB bridge could be used to communicate with an attached
Micromite, while the Nano’s 328P processor was held in reset. Well, the circuit was very simple, and had been worked out well
in advance. There is a little bit of non-standard wiring around
The use of a 1455 was kicked around a bit on the forum, and the 1455’s power pins, but it was determined that this was okay,
someone did come up with a solution based upon my Arduino through a few emails to Microchip’s engineers.
sketch and Microchip’s own USB stack. Unfortunately, however,
the licensing of Microchip’s code precluded the source code being The board layout was conducted via email between myself and
released, and the binary image that was created was tied to a VID/ Graeme. We both have backgrounds working with SMD parts - in my
PID pair owned by that one person. case, going back to several years at Trimble Navigation where I had to
deal with 14-layer designs; by comparison, the Explore-28 is a walk in
After some discussions with Peter Mather, I did a little research and the park! Graeme handled the CAD layout. He’d send me proofs and I
came upon the M-Stack USB stack. This was open source, and so would mark them up with required changes using Photoshop, before
Peter set about combining it with a reimplementation of ‘ASCII ICSP’. emailing them back. It worked really well and meant that we got to
We used a public VID/PID pair and were able to “release it into the review each other’s work. One cannot underestimate the importance
wild” after a short development period of just a few weeks. This of peer review during the design process.
was the last thread needed to bring together the final design for the
Explore-28. The PCBs were fabricated by PCBGOGO in China. Ten boards that
are 100mm x 100mm cost something like US$50 for four layers,
That’s quite a process. Did it take you long to get a working final while the same in two layers are a little over US$10; the prices are
board? ridiculously cheap.

While Peter and I got the 1455 code working, I built the prototype. I Those prices are definitely very accessible. Why would someone
posted photos of this on the forum, and not long afterwards Graeme choose an E-28 over something such as an Arduino Nano? ››

diyodemag.com Issue 002 August 2017 75


FEATURE

›› There will be some cases where an Arduino Nano is the best Sounds very robust to us. Are there any improvements still to come?
choice, there will be other situations when an Explore-28 is the
better option, and there will be scenarios where a bare MX170 is We are all still waiting for Microchip to release an MX190 with
ideal. There is no one solution for every situation. double the flash and double the RAM. Geoff Graham is actively
developing Micromite BASIC, and with the ability to easily upgrade
My first piece of advice would be that if you find the Arduino a little firmware, the Explore-28 is in a position to take advantage of this.
intimidating, or have tried using the Arduino system in the past and Apart from a few minor tweaks to the PCB layout, I am hoping that
struggled, then give the Explore-28 a go. The board is quite cheap, the Explore-28 will be able to remain stable and unchanged in
and the learning curve for Micromite BASIC is extremely shallow. design for quite a while. Really, it is a very simple device that would
be difficult to improve upon.
Micromite BASIC also has some very nice built-in features that may
require a bit more work to get going with an Arduino. There are The one thing I would like to see happen, is for someone in China
64-bit integers, a full set of floating-point maths routines, support to pick up on the design and make clones. The compiled Micromite
for a number of neat devices available as single commands and, of BASIC firmware is free to distribute, and everything else in the
course, an intimacy that only comes with an interpreted language. Explore-28 design is open source. If clones flooded the market at
All you need to talk to any Micromite is a terminal emulator such as US$5 each I’d be absolutely chuffed - the more the merrier!
Tera Term, so it is a very lightweight development environment.
Robert, we thoroughly enjoy (and appreciate) your open-source
That said, even if you are a seasoned engineer working in a approach with the Expore-28. We’re excited to see where it goes in
commercial environment, you may still favour an Explore-28 (or DIP the future! ■
MX170) for certain things. For example, if you want to quickly whip
up something in half an hour, then a Micromite solution may be WANT MORE?
ideal. Often speed of running code is not a big issue, whereas speed For additional code files, or to leave your comments, head to:
of development is. Even if you plan on moving to different hardware https://diyode.io/002vdns
later on, a Micromite is a good test platform on which to experiment
with ideas and create mock-ups. Bear in mind, I used a Micromite
to create the first ‘ASCII ICSP’ programmer before migrating it to an
Arduino Nano and then (coded by Peter Mather) to a 1455.
Want to get an Explore-28?
That’s a great point. So often as a hobbyist we’ll look at tech specs
without giving too much thought for development time itself. What Check out these retailers to see if they ship to your location:
are some practical uses for the E-28, out in the wild?
► RICTECH LTD
Like the Arduino Nano, the Explore-28 is tailored to applications https://rictech.nz/products/20/
where the device is going to be tethered to a USB port. This may be ► CIRCUIT GIZMOS
collecting data from peripherals, that is then processed and passed https://circuitgizmos.com/gizmo-store/#!/
on to an attached PC. Or it may be controlling attached devices - Micromite-Devices/c/14171441
Micromite BASIC supports controlling RC servos, has a couple of ► MICROMITE
spare serial ports, along with I2C and SPI busses accessible from https://micromite.org/shop/micromites/explore28/
BASIC. Whereas a PC running Windows, Linux, or OS X can not
sensibly run applications in real-time, a Micromite is simple enough
that it can. Millisecond timing is possible, which is often perfectly
adequate for interacting with the physical environment. Frequencies
up to 300kHz can be measured, as can the time between pulses.
Reading & Resources:
Another practical use is in a teaching environment. While it is all the
rage to talk about teaching kids object-orientated programming, ► PINGUINO
I see great value in taking a step back and concentrating on wiki.pinguino.cc
algorithms and interactions with the physical world. Initially, ► CHIPKIT
BASIC was developed as a teaching tool to open up computers to http://chipkit.net/tag/arduino-ide/
non-technical users, to enable them to process data; and this is http://chipkit.net/wiki/index.php?title=ChipKIT_core
a task that the Micromite is well suited to, extending to include ► THE BACKSHED MICROMITE TOPIC
the collection of data from sensors and controlling devices. The www.thebackshed.com/forum/forum_topics.asp?FID=16
Explore-28 provides this in a cheap and relatively robust package.

76 Issue 002 August 2017 diyodemag.com


Sink your teeth in.
Raspberry Pi 3 boards and accessories.

www.altronics.com.au | 1300 797 007


Raspberry Pi is a trademark of the Raspberry Pi Foundation.
PROJECT

Part 1:
Alarmduino
Ever wondered how alarms work? How do they know
that somebody is moving or how to detect a broken
window? Want to set up a custom alarm system that
can be tailored to your needs? How about we add
IoT capabilities to provide remote access to alarm/
disarm, or even open a door? - by Oliver Higgins

INTRODUCTION

A modern alarm system can very easily amount to thousands of we place our detectors. In its
dollars. On top of that, back to base monitoring and fees can be a simplest form, imagine we took
costly exercise. While DIY kits exist they are often not tailored to a wire out of pin 20 of the Arduino,
exactly what you need to suit your application. An alarm consists of looped it all around our house and
three basic parts, the inputs, outputs, and control unit. We will be then joined it to 5V on the Arduino. (I
using an Arduino Mega as our control unit, and add various inputs have omitted the real circuit for the sake
and outputs to make a custom alarm system that can work off as of explanation). We check to see if there is 5V
little as 5V. The system can handle multiple inputs and outputs and on pin 20. All good? Yes, the Arduino goes off and
is designed to be a starting point for any custom application you checks the other loops, then comes back to the loop
have in mind. We have broken up this project into two logical steps. on pin 20? Still 5V? Yes? Let’s continue. The closed
The first is circuit design and prototyping. Part 2 will enable remote loop will continue to be fine until it is broken. When the
access and enhance functionality, as well as put it into a tidy case Arduino detects that there is no longer 5V present on pin 20
for real-world application. the system trips the alarm and triggers the outputs. This way
we can have multiple “breaks” in one loop. The magnetic reed
THE BROAD OVERVIEW window/door switch is like this. We wire them into a daisy chain
with several linked via the normally closed (NC) option. If any of
The modern alarm is quite simple, however the logic is not always them get triggered, (i.e. opening the window moves the magnet
easy to follow. The alarm has a straightforward task, check to away from the switch) the entire loop is triggered. We can have
see if something has happened that should not be and if it is, do multiple loops, and these are referred to as zones.
something about it, Pretty simple? It is a little more complex, but
the premise is correct. An alarm system will have several different Once the system is triggered through these zones, we need to
types of triggers it can use to determine if there is a change in process this information and decide what to do about it. For the
the state. This includes reed switch, window break detectors, sake of simplicity, this system will detect a signal or break in
movement detectors and pressure sensors to name a few. any zone and trigger the outputs. The outputs, in this case, are a
small piezo sirens and a relay that could trigger a siren or strobe.
We will use the Arduino to check the various inputs and see if
anything has changed. We do this by creating wired loops on which

78 Issue 002 August 2017 diyodemag.com


PROJECT

HOW IT WORKS

The system starts out by importing the libraries then setting up the
input and output pins used in the project. Once the setup phase is
complete the system goes into an idle state [1].

On the bottom row of the screen, you will see three options: ARM,
TEST and SET. The Arduino will just sit here until we choose an
option. We have two choices to arm the system: press button one,
which is the “Arm” option or uses the RFID card or key fob. Either
of these will trigger the arming sequence. The unit will beep three
times before a long beep. On-screen you will see a countdown and
then “System Armed”. This triggers the “armed” flag.

The system now continues to loop, checking each zone, one after
each other. All of this occurs within the chkZones function. If any
of the zones (pins) are high, then the “alarmActive” flag will be
switched, and the system calls the soundAlarmOn function. This
function is what triggers the outputs, such as the piezo and the
relay. The alarm will sound until the disarm function is called when
the RFID is swiped.

If the unit is not tripped the chkZone loop continues until it is


disarmed. The main screen contains two other options. First, "Test"
simply triggers a testing function that calls the outputs for five
seconds so that you can test that works. You will hear the piezo and
any relays etc will trip. The second option is for checking the inputs.
BOOT SETUP SYSTEM DEFINE
Hold this down and you will see "Zones" and "Trip" [2].

2
IDLE

TEST

YES ARM ARMED?

SETTINGS
If the zone is active (i.e. it has been tripped) it will show a “+”. If it's
INPUTS in a normal state, then it will be “-“. It gives you a clear indication of
OK what's going on around the installation.
NO
The system works with active and passive sensors, so it's rather
ALARM DO UNTIL versatile. While we have seven distinct zones (you could easily
DISARMED expand to more), you can have multiple sensors on each zone for
virtually unlimited monitoring application. In addition to monitoring
DISARMED
▲ ABOVE zones, we also have assignable output triggers in the event of an
Block Diagram of the Logic. alarm, to drive sirens / strobes, or deploy the laser beam sharks.

diyodemag.com Issue 002 August 2017 79


PROJECT

Let’s take a moment to break down the technology that is being LET'S TALK INPUTS (AND OUTPUTS)
used in this project.
There are two types of inputs we're using here, passive and active.
RFID The system can use either, but they need to be treated a little
differently.
Radio Frequency Identification (RFID) uses electromagnetic fields
to identify and track tags attached to objects automatically. The A passive input such as our magnetic reed switch, literally opens
technology can be classed into active and passive IDs. Passive IDs and closes a connection. Because this is a mechanical connection,
are utilised in a situation such as door swipes or 'tap-and-go' credit it's possible for voltages to float on the wires, and provide false
cards. Passive tags use the nearby RFID reader's radio waves to readings to the Arduino. For this reason, we use a resistor on the
collect energy and use it to power the transmission of the encoded zone to ensure that unless power is being applied, the Arduino reads
data. Active tags need a source of energy to operate but have a the zone as low.
greater operating range. These are used in application such as race
timing and tracking. RFID tags can be attached to anything from For the PIR sensors we're using, they're active sensors which
parcels, to food to animals and even people. means they require power to operate, and feed a signal back to
our Arduino. For this reason, they provide a clear logic signal to our
The technology itself has been around for some time but has taken Arduino and no resistor is required on the zone.
considerable research and development to bring to market. The
inexpensive passive RFID “chip” needs to be exposed to 1000 times INPUT - REED SWITCH
the amount of energy it needs to retransmit its data, and this needs
to be done in a safe way. The ID tags can be used for more than just The magnetic reed switch is the go-to security device. They exist to
distinct user identification, but depending on the model, you can trigger the alarm system if a door or window gets opened when it
embed a significant amount of data. is not meant to be. They come in two parts and consist of a magnet
and reed switch. Inside they have two small pieces of the metal set
The RFID unit used in this project is the RFID-RC522. This is a very very close to each other. When a magnet comes close to the unit,
common unit designed for interfacing with micro controllers such the magnetic field draws the two pieces of metal together, closing
as the Arduino. The unit is capable of reading from a very close the circuit. Using this and the Arduino we can sense when the reed
distance, and the tags can hold a reasonable amount of data. If you switch’s magnet is moved (i.e. on the windowpane) and trigger the
wanted to, you could include a significant amount of data to ensure alarm.
that the keys are more robust to hacking. However, in this case, we
will just read the ID from the unit, and if it matches the ones listed INPUT - PIR
internally, the alarm will activate/deactivate.
The Passive Infrared sensor (PIR) is one of the most commonly used
In addition to RFID to provide arm/disarm, you could integrate a security devices after the reed switch. The PIR uses the infrared
keypad. However we’ll focus on remote accessability in Part 2, light spectrum to detect movement. This works by having two slots
which will provide a second arm/disarm method. in the lens that “sees” through. When the unit is idle, both slots
see the same amount of infrared light. When a person or an animal
LCD 16X2 passes through one of the beams, it detects the difference between
the two readings and triggers the output to go high.
For this project we will be using the 16x2 Liquid Crystal Display
(LCD). It is called the 16x2 LCD due to it being two rows of 16 OUTPUT - PIEZO
characters that we can use to display any information we feel
relevant back to the user. There are a number of different ways The piezo buzzer is used in this example as it is small and low
to work with the 16x2 LCD. From a hardware perspective you power. Having said that, it can still make substantial noise at
can use the standalone unit, which will have a variation of 16-pin close distances. In the case of the alarm, you would want a louder
interface or there are several iterations of an LCD shield. The shield siren, but the piezo works well to show how the system works. We
is great and includes buttons, but it does limit you in terms of size have also used it in the project to signal things such as the alarm
and the reduction of I/O pins. For this project we will be using the countdown and the reading of the RFID card.
standalone unit which means we only need to use six pins to drive
the display. OUTPUT - RELAY

The brilliant part about using the 16x2 is that Arduino has the LCD The alarm needs to do something once it has detected a break in
Library included and it is incredibly easy to use. We need to include one of the zones. To do this, we need an output. The most common
the library, initialise the object, then simply tell the LCD what we of these would be the flashing strobe and an alarm siren. The code
want to say and where to put it! itself easily allows modification to trigger alternatives, such as

80 Issue 002 August 2017 diyodemag.com


PROJECT

send a tweet or making it IoT aware, which we’ll go through in more


3
detail in Part 2. For now we have provided a relay output which you
can connect to anything you like, to sound/illuminate in an alarm
scenario. For this project, we have included two output wiring
examples, but several outputs are provided in pins 29-33 and 48.

THE BUILD

PARTS REQUIRED: JAYCAR ALTRONICS CONNECT THE RFID READER: The pin out for the unit [4] is as follows;
1 x Arduino Mega 2560 XC4420 Z6281
1 x LCD 16x2 QP5516 Z7013
1 x RFID Tag Reader (RFID-RC522) XC4506 Z6356 RFID PIN ARDUINO PIN
1 x RFID Tags XC4506 S5376 SDA 53
1 x Piezo AB3462 S6109 SCK 52
1 x PIR Input (optional) XC4444 Z6382 MOSI 51
1 x NC Reed Switch (optional) LA5072 S5153 MISO 50
1 x 3 Push Buttons SP0609 S1120 IRQ NC
4 x 10kΩ Resistors RR0596 R7782 GND GND
RST 49
BUILDING THE CIRCUIT 3.3V 3.3V

This circuit might look daunting at first, but it's really just a series
of smaller circuits. For this reason, we'll tackle it bit by bit, until
4
you have a full working circuit. Some connections will use the
breadboard, others such as the LCD will be made directly.

CONNECT THE LCD: Depending on your unit you may need to solder
a header on. To breadboard this we need to place the headers “up”
as it makes it easier to jump the headers over to the breadboard. A
10k variable resistor can be used between pin 3 and GND, however
we're simply connecting direct to GND for full contrast. Using the
following pinout to connect your LCD.
Please note this unit runs on 3.3V not 5V as the LCD is powered
from. Once it is hooked up, you will get a red LED (on this model)
LCD PIN ARDUINO PIN to indicate it has power. In the resources, you will find the RFID_
1 VCC 5V DUMPINFO sketch, run this code and you will get all the information
2 GND GND that is on your RFID tag displayed on the serial monitor.
3 V0 GND
4 V0 A8 CONNECT THE BUTTONS
5 R/W GND
6 E A9 This circuit uses three buttons [5] to interface with the system. They
7 DB0 NC provide you with various functionality when you don't specifically
8 DB1 NC want to arm or disarm, including functionality to test the zones. It's
9 DB2 NC important to note that, like the mechanical reed switch we need to
10 DB3 NC be very clear to the arduino about our intention. For this reason we
11 DB4 A10 use resistors when wiring our tactile switches. The Arduino then
12 DB5 A11 receives either a clear 5V signal, or a clear GND signal.
13 DB6 A12
14 DB7 A13
5

Test using the LCD_Hello_World.ino. This will display “HELLO


WORLD!” on line 1 and a count on line 2 [3]. If you don’t see any
output, go back and check your wiring.

diyodemag.com Issue 002 August 2017 81


PROJECT

CONNECT THE INPUTS SETTING UP THE CODE

PIR Connections: There are two libraries required for this build. LiquidCrystal.h for
the 16x2 LCD is built in, and MFRC522.h is required to run the RFID
reader. We have included it in the package. Please install it into your
RELAY PIN ARDUINO PIN libraries directory or the local directory of the project.
VCC 5V
OUT ZONE Pin The most significant thing you will need to understand is how the
GND GND LCD library works. Its probably simplest to think about it as a very
similar function as the Serial.println(). You have two lines in which
we can write too. We need to tell it which line and where to start
Reed Switch Connections: writing. Then we give it a string and it prints it to the screen. The
library and unit provides a built-in character set, so we just sent it a
normal string. A basic instantiation and usage of the LCD would be:
RELAY PIN ARDUINO PIN
NO NC
NC ZONE Pin lcd.begin(16, 2);

COM 5V

This starts the LCD object and tells it that it is has 16 columns and
Note: Remember to ground your zone when using reed switches. 2 rows.

CONNECT THE OUTPUTS


lcd.setCursor(0, 1);

Piezo Module (Alarm Feedback): lcd.print(“hello, world!”);

In our system, the small piezo provided feedback. Note: if you're not
using an active module, connect the + to pin 29 instead of 5V. This is the simplest way to output a message to the screen. It is
similar to the Serial.println() function and will write whatever your
message is to the LCD.
PIEZO PIN ARDUINO PIN
S 29 However we don’t always want to write to the very first section of
+ 5V the screen and we may need to specify. The alarm will sound until
- GND the disarm function is called when the RFID is swiped. The above
code will set the cursor to column 0, line 1. Line 1 is the second
row, since counting begins with 0.
Relay Module (For Siren / Strobe):
Note: the characters do not clear until you send a new character in
When the alarm is triggered, we switch the relay. This is to provide its place. In this project we have written the clearScreen function.
power to alert systems, such as a strobe, siren, or warbler. You will This just saves sending nulls or spaces at the end of any strings that
need to have a separate power source for these items as most run you send to the LCD.
on 12-24V.
CONFIGURING ZONES

RELAY PIN ARDUINO PIN You will need to setup the zones used by your project. How many
S 28 do you intend on monitoring? We have setup seven zones. If they're
+ 5V unused, they must be grounded to avoid false triggering.
- GND

int Zone01 = 34;

The relay contacts should be configured using the NC / Common int Zone02 = 35;

contacts. If your siren or strobe runs from 12V, you will need a int Zone03 = 36;

separate power supply for it. You do not need to connect anything to int Zone04 = 37;

the relay output for testing if you do not wish to do so. The light on // add a line for each new zone, and assign

the relay module illuminates to show you it has triggered.

82 Issue 002 August 2017 diyodemag.com


PROJECT

NO.
NC.
COM.

▲ ABOVE
This diagram shows
all major connections
required for prototyping
and testing, with each
of the 7-zones broken
out and grounded for
reliable operation.

diyodemag.com Issue 002 August 2017 83


PROJECT

CONFIGURING OUTPUTS BUTTON 3: SET - This will check all your alarm zones and check for
any zones currently in “alarmed state”.
The outputs are defined on the following pins. If you wish to add
more just continue with the pattern. You have more pins available up You really aren’t limited to the number of sensors you attach to each
to pin 44, then wire them in accordingly. zone, and the number of zones could be expanded with some minor
code adjustments too.

// outputs We have tested PIRs and reed switches using 30m of standard
int relayOut = 28; alarm cable, and everything seems to be stable over that distance.
int piezoOutput = 29; The current draw is small, keeping voltage drop to a minimum.
int Output01 = 30;
int Output02 = 31; BACKUP POWER
int Output03 = 32;
int Output04 = 33; We don't currently have a solution for backup power, which is a very
prudent measure in security systems. We described an Arduino
UPS system in Issue #1, which would be suitable for this project. It
LEARNING RFID CODES uses a rechargeable lithium battery and DC-DC converter to provide
power, while being automatically recharged via USB when mains
With the current version of the code, we need to manually add power is available. We can easily connect an off-the-shelf UPS
in the RFID Tag ID. Once you have all the components connected however, which may be useful if you're running 12V sirens/strobes
load the DumpInfo.ino file and run. Make sure you have the serial and have other power considerations.
monitor open. Once the unit has booted, swipe your RFID tag, and
the number will be displayed. Repeat, to get a copy of all the tags IMPROVING TAMPER RESISTANCE
you wish to use. Once you have these numbers (they will look like
this “48:93:163:124”) we need to add them into the code. Find the We're using active low method for our zone monitoring. This means
following line: that when everything is in a "safe" state, there is 0V being received
by the arduino on each zone. Only when a sensor is tripped, is 5V
present on the zone. We did this due to the way the arduino PIR
int keys = 2; // number of cards modules are designed. They provide GND when nothing is detected,
// tags saved, next line and 5V when it is activated. However, if you're using PIR modules
String results[2] = { “80:231:86:128”, that can be configured for low output in alarmed states, or you're
“48:93:163:124” }; using passive hardware such as reed switches, you can suitably
modify the sketch to handle this.

Decide how many tags you will be using and change “int keys = One potential pitfall of this setup is that it is theoretically possible
2;” to this number, you will also need to change “String results[2] for an intruder to cut the wiring to the sensors, preventing them
“ to the same number. Finally add your TAG ID “{ “80:231:86:128”, from triggering the alarm. Of course, it's a little bit "Mission
“48:93:163:124” };” as a string with a comma in between. There is Impossible" unless you have your wiring dangling in a convenient
no comma after the last value, i.e. { "x", "y", "z" }. place for them to reach, but it is possible. Additionally if a sensor
fails, there's a wiring fault, or other incident, it could fail to send
USING THE ALARM SYSTEM an alarm signal back to the unit. By using active high monitoring,
the alarm will trigger on a true activation, but also if wires between
Once you have coded your RFID tags to the system, there’s little zones are cut, or there's a fault with the zone wiring.
need to recompile the sketch unless you make substantial hardware
changes or need to enable zones you have disabled via code. It is possible to invert the logic response from the PIR also, but this
seemed like alot of work. Let's face it, if you have very high security
There are three simple functions with the on-board tactile switches; requirements, you're probably not installing a DIY alarm. Sharks with
These could be omitted, but they provide very useful functionality. lasers on their heads are far more appropriate. But i digress...

BUTTON 1: ARM - This is an instant-arm function, and activates the In order to reconfigure the system to handle an active high system,
same state as scanning a valid RFID tag. It’s useful to allow “exit it's rather straight forward. You can also mix and match high / low
arm” functionality for someone to lock up without providing a fob. zones depending on your sensors if you wish. The system will still
report zone faults the same way.
BUTTON 2: TEST - This will sound the piezo and trigger the relay for
two seconds, so you can check wiring and such.

84 Issue 002 August 2017 diyodemag.com


PROJECT

Here is an example to reconfigure Zone 1. The process is the same SETTING UP MULTIPLE SENSORS ON ONE ZONE
for all zones.
When installing an alarm system there are many instances where
Around line 52, locate the following code block: you'll want more than one sensor per zone. Perhaps you want
switches on each window or door, maybe even a PIR too. Whether
it’s a particular room or an entire floor of a house, whatever your
if (digitalRead(Zone01) == HIGH) { purpose, there are instances where you’ll want a zone to be a truly
strTrip.concat("+"); identifiable "breach zone".
}else{
strTrip.concat("-"); Our system will support multiple sensors without too much work
} being required. You simply need to wire your sensors in parallel.
That is, each one is provided power, and each returns to the same
zone pin for that sensor.
Now change HIGH to LOW. This tells the system that LOW should
show as a problem on the screen. For instance, we set up Zone 1 to listen on pin 34 of the Arduino. If
you have three PIR sensors, each "signal" output still points to the
same place, pin 34 on the Arduino.
if (digitalRead(Zone01) == LOW) {

One benefit of parallel configuration is that wiring becomes very


simple. You can have one line of 4-core alarm cable per zone. You
Around line 123, locate: simply splice each sensor into the cable as appropriate, connecting
the 5V and signal wires for passive sensors, or 5V, GND, and signal
wires for active sensors.
if (digitalRead(Zone01) == HIGH) {
alarmActive = 1; Note: if you have adjusted your zone to active high as described
} previously, then your wiring requirements will now be different.
Sensors must now be run in series with each other. If you use active
high configuration with parallel wiring, if one sensor is tripped,
Now change HIGH to LOW. another sensor on the same zone can still be providing voltage
feedback to the controller, and the unit will still assume everything
is fine.
if (digitalRead(Zone01) == LOW) {

NEXT MONTH: PART 2

This tells the system that is Zone 1 does fall low (i.e. doesn't have 5V We'll cover multiple sensors in greater detail, to create a full
present), then this is a problem. installable item. While this is a fully functioning prototype, to avoid
problems with loose wires and false alarms, it really needs to be
Now around line 215, locate: moved to a proper protoboard so connections can be soldered. We’ll
also add IoT functionality to allow remote arm/disarm, dynamic
learning of RFID tags, add some additional programme flexibility, as
pinMode(Zone01, INPUT); //Alarm Loop 1 well as a few other cool features. Don’t miss it!
digitalWrite(Zone01, LOW);
MORE RESOURCES ONLINE!
To grab the code or discuss this project, head to:
https://diyode.io/002tvrg
Next change LOW to HIGH.

digitalWrite(Zone01, HIGH);

This ensures the Arduino appropriately sets up the zone.

That's it! You have now improved the tamper resistance on Zone 1
and converted it to active high monitoring.

diyodemag.com Issue 002 August 2017 85


FEATURE

Arjen from OpenSTEM in Queensland (Australia) has created a series


of educational resources, but one that really stood out to us was
his autonomous robot caterpillar. There’s something really awe-
inspiring about machines that move without wheels or tracks, so we

CREEPY
caught up with Arjen to find out how it was all done.

Thanks for taking us through your robotic caterpillar, Arjen; it’s so


interesting. How did you first embark on this project?

CRAWLIES
We work with schools, and we were approached by the Parents and
Citizens Association (P&C) for a distance education school, to be
involved in their Enrichment Weekend for parents, where they would
learn about specific topics and share experiences. At a previous
event we’d explored 3D printers, which proved really popular. There,
we talked about the RepRap project, which made all the cheap,
modern 3D printing possible. We explained how it all works, from
the engineering to the maths, to the chemistry. At this upcoming
ARJEN LENTZ event, there was going to be a demonstration by the school using
Chief Explorer at OpenSTEM LEGO Robotics.
https://openstem.com.au
@AUOpenSTEM LEGO is great, but I remain unimpressed with its robotics. It’s
expensive and limited in a very restrictive environment. Some may
see those restrictions as an advantage, but the cost factor is a
Meet a cool open source, walking serious hindrance that prevents many schools from adopting it; and
caterpillar that uses 3D printing and then, I do question how much students can actually learn using
Arduino, to teach kids about robotics! these kits. Now, our caterpillar does not directly address all of this,
but it does reinforce the point that robotics does not have to be
expensive.

86 Issue 002 August 2017 diyodemag.com


FEATURE

So I promised the P&C person that I’d bring along a cheap robot - I used to do low-level C programming, so playing with Arduino
probably a caterpillar - that was, at the time, yet to be designed/ and directly talking to hardware is right up my alley. The robotic
built. It had been something I’d been meaning to get into for a while, caterpillar uses servos. I set them up to initialise to a position that
so this was the ideal opportunity to get it done. I chose a caterpillar seemed reasonable, and created functions to cycle them through
because they’re quite different; and its key feature would be that their motion. They were wrapped in a function that would initiate
it has no wheels - wheels are so “done”! Most common robots use “one full cycle” in one direction. This actually worked pretty well. I
wheels (or similar) for their locomotion, but what happens is that think that early on I had to adjust the starting positions once. I have
many just end up being glorified remote controlled toys! Consider to say, getting this part mostly right from the beginning was a really
“Sphero” - nifty mechanics, but in the end it’s essentially a remote pleasant surprise!
controlled ball!
Timing is also important, because we’re interacting with a physical
I wanted to try something different, and had noticed that caterpillars environment. If you move too fast, you won’t have any grip. So the
were rare - there was very little information to be found online. I did timing depends on what kind of feet the caterpillar has (mine are
locate one caterpillar online, from years ago, and it used polymorph rubber), the surface it moves on, and its weight. Another advantage
frame segments, a PICAXE for brain, and distributed AA batteries. I of building a caterpillar rather than something with wheels, is that
wanted to make our caterpillar autonomous so that it would most no one tends to ask “how fast can it go?” or suggest we race it! It’s
definitely not be “remote controlled”. Clearly, it would have a “little clear that caterpillars are not built for speed!
brain” and this, along with its locomotion, would make for some
excellent discussions with the kids. That’s so true! You’ve used ultrasonics for obstacle detection.
What’s the range and the physical response to obstacles, and how
We’re seeing so many great solutions for getting kids into robotics, fast does it work?
and yours is an excellent example. Creating something that moves,
which doesn’t have wheels is a fantastic challenge - how much trial The ultrasound ping operates at the point of the movement cycle
and error was involved? where the head is pretty much facing straight ahead. The code acts
when it detects an object within 10cm straight ahead.
Ah yes, the “no wheels” is precisely what makes it interesting!
Indeed, I had to figure out how a caterpillar moves. For lack of From experiments, I’ve found that the range of these sensors is
reliably trained caterpillars in my garden, I reverted to YouTube and quite fabulous. You can easily do pings across a room and get a
watched videos from people who had gone through the effort of fairly reasonable reading on distance. Given sufficient memory,
recording a decent stretch of caterpillar movement. It was great you could use it to create a rough map of an area, which is refined
and, as it turns out, caterpillars move by something called “reverse from different positions and angles - but for that, you’ll also need
peristaltic motion”; and this peristaltic motion is actually what a sufficiently accurate positioning system. This can be tricky to
moves food through our digestive system. achieve indoors. There are neat projects (like “SubPos” by Blair
Wyatt - an Australian), that achieve this by doing measurements
from cheap WiFi modules across the room; however, it still requires
more setup and cost, which I didn’t consider worthwhile for this
particular project. ››

There are an endless number


of things to discover about
robotics. A lot of it is just too
fantastic for people to believe.
- DANIEL H. WILSON

diyodemag.com Issue 002 August 2017 87


FEATURE

Arduino Nano works as the brain.

RIGHT (INSET) ►
Red and green lights on the head, a white one on the tail.

›› So the caterpillar doesn’t really know its position in space; it I used OpenSCAD to
merely tries to avoid bumping into things. When it gets close to an create the designs,
obstacle, it stops, reverses three cycles, and then turns its head to as its programmatic
the left and right to take another measurement. It will then move in spatial approach suits
the direction that has the most space (i.e. the farthest distance to an the way my brain
obstacle). The caterpillar turns by rearing its front legs into the air, works. I actually really
then turning the left/right servos (that are in between the up/down like OpenSCAD, it’s
servos along the body), then lowering the front, straightening out, a marvellous open
and returning to normal motion. It’s a bit rough, but it works. source tool. I also
downloaded the
Straight forward obstacle avoidance is a great start to autonomy. datasheet for the
The body is entirely 3D printed - is what we see the first design or microservos to find out the basic dimensions
did it take a few revisions to get right? and positioning of screws and the like. Initially I also
looked at some examples of what others had
It took a few iterations to get. I had a mental image of what I was done with similar servos (through Thingiverse and GitHub).
aiming for, but when translating that into the real world, things
always need adjusting. We’re fans of OpenSCAD too - there’s definitely little point in
repeating the same thing someone’s already done, if it satisfies
your purpose - this really is the true benefit of open source. You’ve
started to implement a Gyro/Accelerator module. What are your
plans for this?

Well, the system would be able to detect the slope, as well as the
sideways angle. The slope information could be used to adjust
the movement to to deal with steeper slopes up and down. It’s
currently untested territory, but the code can work out the sideways
angle, and thus figure out if the caterpillar has fallen over. Then,
in principle, it would be able to initiate a wriggly manoeuvre to get
The exoskeleton is a combination of
3D printed materials and servo motors. itself upright again. This should be doable; however, at the moment

88 Issue 002 August 2017 diyodemag.com


FEATURE

the caterpillar is somewhat top-heavy metal gears. They’re not much more expensive, and because I’d
because of the battery pack on its back. already proven the basic mechanism, it seemed worthwhile.

It would take some work to get an auto- Fundamentally, I think the construction with the servos is
righting feature for sure, but wouldn’t mechanically problematic. No matter how you construct it, a lot
that be amazing to see? No wheels usually of strain is placed on these tiny servos, which they’re not good
means more power required - using the with. The very expensive RobugTix T8X robotic spider also uses
current setup, how long will it run for? the microservos, and Adam Savage already reported burning out
three servos during his test. I don’t think it’s a proper way to design
One should never use, say, a 9V alkaline things, and it seems quite irresponsible to produce retail products
battery - they really are quite useless. like this. In that context, I think it could easily fail the basic “fit for
Distributing a number of AA batteries along purpose” test.
the body is possible and I considered this,
but it makes the engineering more complex The OpenSTEM Caterpillar was undertaken as an interesting
and doesn’t necessarily provide a lot of experiment and an exploration, but remains one of our mascots
runtime. After some “dry” tests (running poor who we take with us to schools and events. I think it’s great if
caterpillar in thin air), and briefly borrowing other people want to also build it and learn from it, but I would not
a high capacity (1500mAh) LiPo from a friend, consider turning it into a retail kit.
I opted for a LiPo battery pack. At the moment
it’s a 7.4V 850mAh 2S LiPo, which is probably still You’re right - direct drive servos may not be an optimal long-term
overkill - I had to choose something so I went for a solution, but they prove the movement pattern, and are very fun to
reasonable capacity with a fairly small size. play with. If you had your time over, or were creating a V2.0 of this
project, is there anything you would change?
It will last for many hours. I use the caterpillar for
demonstrations and robotics incursions at schools, and I I think the first design and implementation was very worthwhile,
always bring a charged spare with me but I rarely need it. and quite necessary for learning the various important lessons. It
I connect the LiPo via a UBEC (Universal Battery Elimination now also has a red and green LED at the front, as well as a white
Circuit), which again is overkill but it provides me with a “reversing” LED at its tail - just because we can. For our next
sane voltage (5V), plus a buzzer to warn me when the LiPo is generation of robotic caterpillar, I’m thinking about a structure that
running low. Arduino will run on 3.3V (so a 3.7V 1S LiPo would uses ligaments. I haven’t yet sketched this out... but I’ll try to explain
work for that), but the servos need a bit more, so that’s why I here.
went for a 2S that provides 7.4V and then regulated it downward.
I’ve played with booster circuits for other projects, but they often Imagine a tube, with rings at regular intervals. Some of the rings
tend to be inefficient. would have a servo attached, which controls two wires that are
threaded through adjacent rings. So basically, a servo could pull
A few LiPo cells are also much lower in on one wire, while releasing the other,
overall weight than many AA batteries - at thereby bending the structure. Two servos at
least when comparing capacity per gram or 90-degree offset should provide full control
similar! Of course, distributing 18650 cells in every direction. A few such constructs
(for instance) may prove useful if you need across the length of the caterpillar should
to extend battery life beyond what you have! provide a very functional structure.
What unexpected challenges did you face
with this project? ◄ LEFT
Robotics that resemble natural movements seem
to quickly take on human or animal characteristics.
I initially used TowerPro SG90 microservos -
the really small blue ones that weigh a mere
9g each. They are cheap as chips because It could also deliver other advantages: fewer
they get used a lot in model airplanes. servos required, lower power consumption,
But, the servo used for the caterpillar to less strain on the servos, smoother external
“raise its neck” when turning, got really hot; so much so it actually structure (could get a neat coat). It could contain the battery inside
softened and warped the PLA of the frame! I also noticed some of the tube, which would ensure the caterpillar is not top-heavy,
the other servos becoming erratic, so basically failing. After initially plus there could be options for snake-style and other locomotion;
just replacing one failing servo, I decided to give the caterpillar a perhaps even a waterproof version? ››
“caterpillaroptomy” - a complete spinal replacement from SG90
to the MG90 model, which is the same sized microservo, but with

diyodemag.com Issue 002 August 2017 89


FEATURE

›› My lack of “abundant spare time” has meant that I haven’t yet


created this new design!

I think we all have a lot of ideas that stay on the backburner due to
time! What are you working on now?

After the caterpillar, I also built a little hexapod using three servos
and paperclips. It was a very simple design by someone from the
Gold Coast in Queensland (Australia). Again, this is just to show that
robotics does not have to be complicated or expensive.

Kids have an excellent time working out that I’ve used paperclips!
The caterpillar costs about $40 including the battery and possibly
the UBEC(w/buzzer), the hexapod should be less than $20. Both
are built around an Arduino Pro Mini, although observant eyes will
notice that the caterpillar currently has an Arduino Nano brain.

Noting the low cost is really important - often robotics


is made to be too shiny, and very expensive. However,
using Arduino and other components, robotics really
can be very accessible both in terms of complexity as
well as pricing. The caterpillar has really proven that kids
(of all ages!) are interested, and it shows them robotics
doesn’t have to be all whiz-bang fancy!

At home, I have built a system that monitors the


collector and storage vat temperatures of our solar hot
water system, and controls the booster to only switch on
when necessary (e.g. near the end of the day or early in
the morning). Generally, a solar hot water system comes
with a simple switch for the booster, so to make optimal
use of the solar you have to keep it off, but remember to
turn it on when you think it might be necessary. A simple
Arduino setup (although mine uses an EtherTen from
Freetronics, with PoE) can sort this out nicely - perhaps
this is a good story for another time?

At OpenSTEM we’re busy with so many aspects of the Australian


school curriculum, that I honestly haven’t had much time for
R&D indulgences in recent months. Most materials we develop
for classroom use doesn’t require electronics, computers or a
facilitator to be in the classroom. They can be run independently by
the teacher, without relying on tech or having to be online. This is
because getting everybody online and having it all work and operate
at a decent speed is a serious struggle in many schools around the
country, including in cities (again, this is another story for another
time). It’s important that students learn and practice important
thinking skills, which do not require them to be online. Reading & Resources:
Awesome - thanks for taking us through everything Arjen. ► OPENSTEM
We can’t wait to see what you come up with next! ■ https://openstem.com.au/resources/openstem-caterpillar
► ARDUINO CODE AND FRAME DESIGN
GOT SOMETHING TO SAY? https://github.com/AUOpenSTEM/caterpillar
To discuss this creepy crawly caterpillar, visit:
https://diyode.io/002wbzd

90 Issue 002 August 2017 diyodemag.com


FEATURE

BUILDS
BEFORE
BEERS

Ben launched his first product when he was just 15 years of


BEN WANG age. That’s right, at an age where many of us are busy annoying
Full time high school student. Part time inventor. our siblings or catching up with mates, Ben was developing and
www.the-perf-shop.myshopify.com launching his first product! He developed a unique type of prototype
board. He then launched it onto the market with an oversubscribed
crowdsourcing campaign. Fast forward to 2017 and Ben has now
had three successfully crowdfunded campaigns. We caught up with
Many of us enjoyed playing with Ben to chat about making his mark on the world of electronics.
electronics as kids, but not many of
us successfully commercialised three Ben, you’re only 17 years of age. When did you first start working
products before we left high school! with electronics?

I’ve been designing circuits and PCBs since I was 13, but I first
started playing with electronics even younger. What initially got me
into technology was LEGO; it got me interested in building physical
things, and the Mindstorms programmable block got me interested
in programming.

I think we’re all fans of LEGO at one time or another. It’s quite a leap
from tinkering to designing your own products. How did you go from
playing with electronics to developing your first product, Perf+?

I was building a battery tester circuit on a perfboard for my science


project in year 9, when I realised the mess of wires was getting
more and more tangled, and the circuit was getting harder to
follow and change. I thought there must be a way of allowing you
to prototype without the mess of wires. Drawing inspiration from
traditional prototyping boards, but with a unique two-dimensional
▲ ABOVE
Ben's second product, RemoteBoot twist, Perf+ was born. ››

diyodemag.com Issue 002 August 2017 91


FEATURE

›› As they say, necessity is the mother of invention.


Can you briefly explain what Perf+ does, and how it works?

Perf+ is a new type of electronic prototyping board, which allows


you to create prototypes without using any wires. It works by using
busses that are built into the board, similar to a Vero board, except
that they are disconnected from the holes by default, allowing you
to join them with a solder bridge. There are also busses on the other
side, which run in the perpendicular direction. This allows you to join
any two points with a couple of solder blobs and no wires.

That sounds pretty cool! From the pictures we’ve seen,


you definitely end up with a much neater prototype
board than using a traditional Vero board. You have
since released an updated version called Perf+2. It had
its own crowdfunding campaign, which also surpassed
its goal. Can you briefly explain the difference between
Perf+ and Perf+2?

Perf+ was the initial version of my protoboard design,


and it had some room for improvement. For example, the
holes were enlarged, as in the original Perf+, they were
smaller than normal protoboards, which made it difficult
to use high power packages with large leads. The layout
is also optimised for SMT packages, allowing you to use
the majority of 2-pin and 3-pin SMT packages directly
on the board. A solder mask between the bridgeable
sections was also added to make soldering easier.

That sounds great. Surface mount packages can be RIGHT ►


A soil moisture sensor demonstrating
painful on regular Vero board. You partnered with
how Perf+2 can make a very clean
Crowd Supply for your Perf+2 crowdfunding campaign. prototype!
How did this collaboration change the process
CREDIT: Build by Myndale.
and/or the result?

I chose Crowd Supply for my second crowdfunding


project because they offered a more targeted audience,
and offered to provide marketing for my project. I think it
was the right decision, as it enabled me to reach a new
audience and also reduce the amount of work to launch
such a product. The campaign was a great success,
raising $11,820 from 288 backers.

That’s a fantastic result. Any successful crowdfunding campaign


is great, but finding the right platform definitely helps get you the Sounds great, we’re keen to see what comes next! What are you
right backers. After producing Perf+2, is there anything you would working on now?
change for a Perf+3?
I am currently completing year 12 - my last year of high school -
After seeing some of the very complex designs that current users and we are approaching our final examinations. But, even while I
of Perf+ have made, I think for Perf+ 3 I would like to add two focus on my studies, I have some more projects and crowdfunding
parallel busses per pad, which would allow even more compact and campaigns in mind. Although I’m not currently developing any
complex designs, which can approach the density of homemade new products, I am still selling both the Perf+ 2 and Remoteboot.
PCBs. However, it would make it more complex to use for beginners RemoteBoot is available on my online store, and Perf+ 2 is available
and for simple designs, so I might still need to keep Perf+ 2 around. in both my store and Amazon US. ■

92 Issue 002 August 2017 diyodemag.com


FEATURE

RIGHT ►

Ben's 3 Solutions:
Building this schematic
of a 6502 computer
using 2 interlocking
Perf+ boards. Very tidy!

PERF+: CREDIT:
Build by Myndale.
 aised $15,461 of its $1,500 goal (AU dollars) via Kickstarter
R
The original crowdfunding project. Gaining attention from
EEVBlog, Hackaday, and more. It’s definitely a clever approach to
prototyping.

REMOTEBOOT: 
I chose Crowd Supply for my
second crowdfunding project
Raised $17,589 of its $1,500 goal (AU dollars) via Kickstarter.
Remotely boot or restart your computer from anywhere in the
because they offered a more
world. WiFi connected and a great Wake On LAN alternative, targeted audience, and offered to
especially for low-cost motherboards that don’t support Wake On
LAN control.
provide marketing for my project.
PERF+ 2: 

Raised $11,820 of its $500 goal (US dollars) via Crowd Supply.
The next version of Perf+. Perf+ 2 includes larger holes, a solder GOT SOMETHING TO SAY?
mask between holes, and optimised to make the use of surface To leave your comments or see more images
mount components easier. https://diyode.io/002bbnz

diyodemag.com Issue 002 August 2017 93


PROJECT

RPi GUI
INTERFACE
So you have a Raspberry Pi and a cool idea, but how Once you have dealt with GUI more, referring to it as simply GUI
do you make it as easy as a smartphone for your user (often pronounced like "gooey") will make sense, and you can walk
to interact with? Add a nice intuitive interface! around talking like a code pro!
Building a Graphical User Interface is actually quite
easy, and with some patience you can produce Once you gain an understanding of GUI, your Raspberry Pi projects
amazing results. - by Oliver Higgins can start to take on a whole new life. To keep the code simple we're
using a standard screen and mouse. This keeps the theory simple
and with the least additional support required, however the same
principles will work on a touchscreen appropriately setup too.
You have probably seen "GUI" somewhere, no matter how new
to programming you are. GUI stands for Graphical User Interface. You may already own, or have at least looked at, the Raspberry Pi
That actually means our title should just be RPi GUI; since we've touchscreens. Once you have been through this article and learnt
effectively just wrote "Graphical User Interface Interface". But like how to create interactive elements, you'll no doubt want to move to
many acronyms in English, phrases such as "ATM Machine", "LCD touchscreen. This can serve as a springboard to home automation,
Display", and "PIN Number", it helps with identification of acronyms. digitisation of older hardware, and so much more. So let's dive in
While technically we're repeating ourselves, it's an odd quirk of the and take a look at the Raspberry Pi GUI!
English language (and human nature).

94 Issue 002 August 2017 diyodemag.com


PROJECT

THE BROAD OVERVIEW

One of the default programming languages on your Raspberry Pi What is it?:


UX vs UI design
(RPi) is Python. We assume you have had a good play with your RPi
and even hooked up some sensors, HATs or LEDs to the GPIO port.
One of the most powerful tools that RPi provides over other micros,
is the rapid rate and ease you can create a Graphical User Interface What’s the difference between User Interface (UI) design
(GUI) for your project. and User Experience (UX). Both elements are crucial to any
modern product and they both play a role in each other.
For the purpose of this article, we’ll be using Python 3, which However, despite the close relationship, they both differ in the
is quite different in style and syntax to Python 2. Some legacy roles they play; UX is analytical and technical, while UI is more
functions hold over from 2 to 3, but there are substantial new aligned with graphic design, but can be more complex to use.
functions available in 3. For the purpose of keeping up with current
technology, we will usually be using Python 3. When you journey UX is a way of designing products with the human element
beyond the ideas presented in this article, just remember to include at the forefront. It is the process used for enhancing user
“Python 3” in search terms if you’re hunting down code snippets on satisfaction, by improving the usability, ease of use, and
the internet. pleasure for the user when interacting with the project.
Essentially it answers the question “how does the project
HOW IT WORKS make you feel?” Modern research shows the brain releases
dopamine whenever we see a notification that someone has
Some time ago we interfaced with machines via knobs and liked a post on Facebook or Twitter, or the like. Therefore, if
dials. With the introduction of computers, we started to type such notifications distract users from the main task, you may
our commands. As technology developed, we saw the mouse, want to consider minimising the number of notifications they
voice recognition and the power glove. All these technologies receive.
have culminated into the fantastic interfaces in things such as
smartphones. UI, on the other hand, is the way in which the elements are
drawn and laid out for the user. It is used to determine how
Steve Jobs stated that interface should be so intuitive that the many clicks or touches required to make something happen.
person picking it up should just be able to use it. When we build What areas of your phone are easy to touch with your thumb?
our projects the final user experience can be lacking, but this is the Is your project going to be an environment where access
wonderful thing about the Raspberry Pi. We can quickly connect a may be difficult? Do you need to put large buttons or a big
touchscreen and straight from Python, design a user interface that readout? UI focuses on creating an optimised interface, which
will directly access and use the GPIO. primarily achieves your business objectives over the human
objectives.
Python has the option to use several different GUIs, each with unique
strengths and weaknesses. For this article, we will be using Tkinter, Wireframing and prototyping is a fast and efficient way to
which is Python’s de-facto standard GUI package; it’s a thin object- test your user interface. Screenshot Wireframing allows you
oriented layer on top of Tcl/Tk. Tkinter is probably the most commonly to create different unique interfaces and get immediate
used with Python, and plenty of resources exist on the internet. feedback from the user. Try wireframe.cc

At this stage, we are going to assume you have a fundamental In short, a good interface is one that makes it easy for the user
knowledge of Python. So open idle, complete code, and run it. to tell the computer what to do. It makes the task of getting
the processor to ask the user for information, and returning
We will start by producing the GUI equivalent of “Hello World”. Using equally simple and understandable information back to the
Tkinter is quite simple but you need to be aware of how the code user. Clear communication between the computer and the
structure works. We start by importing the Tkinter object. Please be user is the underlying goal when it comes to interface design.
mindful here of the case; we are using Python 3, and there is some
variation compared to Python 2. The general process of starting the For most of our projects in DIYODE Magazine, we'll focus
GUI is to create the Window object (also known as the form). Set purely on practical UI/IX layouts that are raw function. We
up the window as required, build any display parts such as grids or want to demonstate how something works with the shortest,
buttons, bind any functions if required then start the main loop. ›› most clear route possible. If you were trying to commercialise
a product however, it's probably worth paying further
attention to the user experience and interface.

diyodemag.com Issue 002 August 2017 95


PROJECT

›› HELLO WORLD IN TKINTER def btnClicked() has in “if” statement that checks the current state
of the GPIO pin 17. If it’s high then it sends it low; if it’s low then it
goes high. This is a Toggle function on pin 17.
#!/usr/bin/python
from tkinter import * defbtnExit() has a single line: root.destroy(). This terminates the
root = Tk() program and provides a clean way to "close" the programme
root.wm_title(“Hello World”) (especially useful if working fullscreen without a keyboard).
root.mainloop()

The final four lines of code are to create the buttons. Firstly we
create the button. In doing this we set a number of attributes.
TO BREAK THIS DOWN: Firstly, “root” is the window we are binding. Second is the text string
that will be displayed on the button; and third is the command or
function we want to bind it to. Finally, we will specify the height and
from Tkinter import * width of the button.

Imports the Tkinter library.


#!/usr/bin/python
from tkinter import *
root = Tk() import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)

This creates the root window object. GPIO.setwarnings(False)


GPIO.setup(17,GPIO.OUT)
root = Tk() # the tkinter is case sensitive.
root.wm_title(“Hello World”) root.wm_title(“PI Gui”)
root.mainloop() root.attributes(“-fullscreen”,True) #Makes the
window full screen

Sets title of the window, then starts the GUI loop. #root.geometry(‘800x480’)

CIRCUIT 1 - LED CONTROL def btnClicked():


if GPIO.input(17):

As we progress and add buttons into the form, we need to bind print (“LED off”)

them to the functions they will be performing. In this case, we are GPIO.output(17,GPIO.LOW)

going to create a form and add two buttons to it. One to turn the LED ledButton[“text”]=”LED OFF”

on/off, and the other to exit the program. else:


print (“LED on”)

We have included this code in the resources - PiGUI_CODE.py, so you GPIO.output(17,GPIO.HIGH)

can simply load and go. However we'll take you through the code to ledButton[“text”]=”LED ON “

explain it below.
def btnExit():

We start by importing the Tkinter and the GPIO libraries into the root.destroy()

program. Next we setup the GPIO port to be output on pin 17. As


with the Hello World example above, we set the root object, then the exitButton = Button(root, text=”Exit”,

window title. The next lines are to set up how the GUI will function command=btnExit, height=20, width=80)

on your Pi. exitButton.pack(side = BOTTOM)

root.attributes(“-fullscreen”,True) will make the GUI cover the entire ledButton = Button(root, text=”LED OFF”,

screen, which is ultimately what we want to do. If you wish to be command=btnClicked, height=20, width=80)

more specific, then comment this line out with a # then uncomment ledButton.pack()

the next line (remove the #), and make sure that the resolution is set
correctly. Our GUI/window is set. root.mainloop()

Next, we create any functions that we need to bind to our buttons.


This project is using two buttons: one to turn the LED on/off, and a
second button to exit the program.

96 Issue 002 August 2017 diyodemag.com


PROJECT

A NOTE ABOUT THE CODE: Make sure you have updated your
RPi before starting, and that you have the GPIO library install.
Open the command window and enter the following:

$ sudo apt-get update


$ sudo apt-get install python-rpi.gpio
python3-rpi.gpio

WHAT UI ELEMENTS ARE AVAILABLE?

Tkinter includes many different widgets to help you create the most
appropriate user interface. Widgets you can use include:

• message boxes • menu items • text box


• buttons • check button • spin box THE CODE & SETUP
• text labels • input box (entry) • slider.
• list box • radio button We have provided the code file PiGUI_LED.py in the online resources.

Please note the lines:

root.attributes("-fullscreen",True)
#root.geometry('800x480')

Use one or the other. If you elect to use the root.geometry


(‘800x480’), please replace the resolution as appropriate.
THE BUILD
Once you have made any changes, save and run. Provided you have
PARTS REQUIRED: JAYCAR ALTRONICS connected the circuit correctly your LED should switch on and off.
1 x Raspberry Pi 3 (NOOBS installed) - Z6302B
1 x GPIO Extension Board If you examine the partial code, you’ll see we do three things with
+ Ribbon Connector - Z6344 each button press. The print (“LED off”) will send the text output to
1 x Red or Green LED ZD0170 Z0801 the console, indicating that the function has taken place. Similarly,
1 x 330Ω Resistor RR0560 R7040 the ledButton[“text”]=”LED OFF” changes the text of the button that
the user is clicking on, so that it alternates.
BUILDING THE CIRCUIT
The line GPIO.output(17,GPIO.LOW) addresses the RPi’s GPIO port,
Follow the diagram as shown. This is a fairly rudimentary circuit and and tells pin 17 to go high or low, depending on the “if” statement. ››
doesn't require much instruction. Of course pay attention to the LED
orientation (flat side to negative).
GPIO Extension Board
GND

GPIO26

GPIO19

GPIO13

GPIO6

GPIO5

ID_SD

GND

SPICLK

SPIMISO

SPIMISO

3V3

GPIO22

GPIO27

GPIO17

GND

GPIO4

SCL1

SDA1

3V3
GPIO21

GPIO20

GPIO16

GPIO12

GPIO12
ID_SC
SPICE1

SPICEO

GPIO25

GPIO24

GPIO23

GPIO18

RXDO

TXDO
GND

GND

GND

GNL

GND

5VO

5VO

diyodemag.com Issue 002 August 2017 97


PROJECT

›› CIRCUIT 2 - SERVO MOTOR CONTROLLER

Moving along to something other than a button, we can also use


Mini Servo various inputs to control the PWM outputs from the Raspberry Pi.
The applications for this are vast, so we'll look at a very popular one
in robotics - servo motor control.

A servo motor is a great choice for robotics because it translates


a PWM signal into an angle, providing you with a predictable and
GPIO Extension Board
repeatable angle to control all sorts of things.

THE BUILD
3V3 5VO

SDA1 5VO

SCL1 GND

GPIO4 TXDO

GND

GPIO17
RXDO

GPIO18
ADDITIONAL PARTS REQUIRED: JAYCAR ALTRONICS
GPIO27

GPIO22
GNL

GPIO23
1 x Mini Servo Motor YM2758 Z6392
3V3 GPIO24

BUILDING THE CIRCUIT


SPIMISO GND

SPIMISO GPIO25

SPICLK SPICEO

GND SPICE1

Follow the diagram shown left. This is a fairly rudimentary circuit


ID_SC
ID_SD GPIO12

GPIO5 GND

GPIO6 GPIO12
and doesn't require much instruction. Of course pay attention to
the LED orientation (flat side to negative). For high current servos
GPIO13 GND

GPIO19 GPIO16

(and indeed most applications) it's advisable to power the servo


GPIO26 GPIO20

GND GPIO21

from a power supply without going through the microcontroller.


This removes the strain of handling supply currents through the
microcontroller itself. For our demonstration here it's rarely an issue,
but not best-practice for production.

THE CODE & SETUP

We have provided the code file PiGUI_Dimmer.py. This code is not


highly optimised, but is designed to demonstrate the use of multiple
elements within the one system.

We won't go through each line, but will explain some important


parts. You'll notice we have setup pin 18 as a PWM output, as well
as providing a starting value. You can change this between 0 and
100 (the range of our PWM output) to your preferred start position.

pwm = GPIO.PWM(18, 100)


pwm.start(5)

You will notice that we do some math on the 180° range of


the input slider, to convert it to within the bounds of our PWM
output. We could just use a 0-100 range on our slider, but 0-180,
corresponding with our servo angles, is much more user-friendly.

duty = float(angle) / 10.0 + 2.5


pwm.ChangeDutyCycle(duty)

The angle of the servo


corresponds with the slider. Move the slider on screen and watch the servo move!

98 Issue 002 August 2017 diyodemag.com


PROJECT

Extra Credit:
GOT SOMETHING TO SAY?
To get the code or discuss this project, head to:
https://diyode.io/002nscd

4-WAY LED DIMMER

With relative ease, we can expand on this principle and would be useful here also) to drive fans, motors, or much larger
effectively create a 4-way dimmer. Of course, 4 is an arbitrary lights.
number we're using since it's enough for a demonstration. You
can keep going until you run out of I/O, and even then there are You'll also notice we've started populating position coordinates
breakout solutions. on the Tk grid. This is a dynamic positioning grid. We effectively
assign elements to areas on the grid. If you don't do this, you risk
THE BUILD an unpredictable layout.

ADDITIONAL PARTS REQUIRED: JAYCAR ALTRONICS There you have it! Go forth and conquer some amazing UI ideas! ■
4 x Red or Green LEDs ZD0170 Z0801
4 x 330Ω Resistor RR0560 R7040

BUILDING THE CIRCUIT

GPIO Extension Board


Follow the diagram shown right. We are using GPIO pins

GND

GPIO26

GPIO19

GPIO13

GPIO6

GPIO5

ID_SD

GND

SPICLK

SPIMISO

SPIMISO

3V3

GPIO22

GPIO27

GPIO17

GND

GPIO4

SCL1

SDA1

3V3
12,16,20, and 21 for our circuit. These are selected for no
reason other than convenient breadboarding.
GPIO21

GPIO20

GPIO16

GPIO12

GPIO12
ID_SC
SPICE1

SPICEO

GPIO25

GPIO24

GPIO23

GPIO18

RXDO

TXDO
GND

GND

GND

GNL

GND

5VO

5VO
Insert the resistors and LEDs as shown, taking care to orient the
flat side of the LED to the resistor side. Then load the code from
the resources, PiGPIO_Dimmer.py.

THE CODE & SETUP

We have provided PiGUI_Dimmer.py code in the resources. For


the purposes of clarity and not introducing too many new code
principles at once, we are using rather rudimentary code here.
When you have multiple lines of code doing similar things, there
are numerous ways to enhance it, making it more efficient and
using less memory. But we'll cover that another time.

LED4.grid(row=0,column=3)

Effectively we have setup four PWM outputs, one for each LED.
We then create a corresponding slider for each output. This
effectively provides you with a slider for each LED's brightness.
This can easily become the foundation of some home automation
controls. You can also step-up the PWM outputs (we provided
PWM driver circuits in our 555 Timer article in Issue #001 which

diyodemag.com Issue 002 August 2017 99


FEATURE

Safe
3-Phase
Generator
Building a 3-phase power monitor isn’t your average
DIY project, but when Tisham discovered he didn’t TISHAMPATI DHAR
have a 3-phase power source to test it with... the Research Engineer, Aerial Photogrammetry.
low voltage 3-phase synthesiser was born! http://whatnicklife.blogspot.com.au/
@whatnick

Three-phase is something that many of us will never actually Before we get into the AC simulator itself, tell us what spawned the
deal with in our tinkering. It’s not in your average house or back need for this project?
shed and requires special precautions to safely work around.
All that aside, for those using 3-phase (industrial workshops, It started with a competition run by SeeedStudio, which involved
fast food restaurants, and much more), power monitoring is building something with the NodeMCU. I built an energy monitor
as necessary as for anyone else (perhaps even more so since with an I2C ADC (analogue to digital converter). It wasn’t very
their power usage may be much higher than average). It takes accurate though, so I started a project to make the ATM90E26,
some special skills and a different approach to single-phase which is a utility-grade metering IC. It’s easy to DIY, with devkits
AC. Tisham’s 3-phase AC simulator provides a safe, low-voltage costing around AUD800. After I published the Arduino code online
source for developing 3-phase testing equipment. for the single phase ATM90E26, I started receiving requests to

100 Issue 002 August 2017 diyodemag.com


FEATURE

support and debug ATM90E36 code, which other people were What voltage does your simulator output?
writing. The ATM90E36 is a 3-phase energy monitor chip, and in
order to test the code I made a devkit for this chip as well. The code The DAC outputs 0-3.3V, which gets AC-filtered then passed through
reads the values from the 3-phase chip fine, and I managed to test a TL084 JFET opamp. The opamp is powered from 23A 12V cells, so
each phase individually using my existing single phase test rig; without saturation output is +/- 12V rail-to-rail.
however, to test all at once I had to book the hackerspace in Tonsley
(in South Australia) for a variac and isolation transformer. This was Nice and safe compared to actual 3-phase - good one! How can you
helpful, but the test only lasted a couple of minutes since I foolishly load-test the low-voltage unit (since you can’t simply connect the
plugged in a low resistance (1-5ohm) load bank to the 12VAC actual load)?
without considering power ratings of the resistors. The load bank
went up in smoke and interrupted the test. So rather than waste The plan is to use small current-sensing transformers (CTs) at 5A
all the travel time and resources living dangerously at high max range (see resources) and high power load resistors, such
voltages, I decided to build a safe, low-voltage synthetic as 10W wire-wound (see resources). This stage is not built yet
3-phase rig. and the simulator only outputs 3-phase voltages at the moment.
Three-phase current inputs are being tested by passing the voltage
through a small divider.

Maybe you can use the old “pull apart the kettle” trick, if you get
stuck for a dummy load? It sounds like you’ll have PCBs produced,
◄ LEFT do you anticipate any challenges moving from prototype to PCB?
Tisham's prototype.

That’s right, the PCBs for the 3-phase synthesiser are not yet
produced. It is currently made of discrete components, and devkits
from manufacturers, plugged and taped onto breadboard. I have
produced PCBs for other prototypes - specifically, the ADS1115-
based single-phase energy monitor. For this I had to learn EAGLE,
scope out PCB manufacturers, and learn cost/capability matrices.
Then wait for weeks/months to get prototypes, since there is no
SeeedStudio or OSHPark equivalent here in Australia.

Sounds like “living down under” is the only major hurdle here. Other
Oh we’ve all let the smoke than the voltage, are there any notable differences between grid
out a few times. So the idea for a simulator 3-phase and your simulated 3-phase?
was born to allow you to test thoroughly and
consistently - what a great idea! Can you roughly My simulated 3-phase probably has higher harmonics due to
explain how you’re creating the 3-phase output? being generated from stepped DAC output, I have my scope ready
to perform harmonic analysis. I will have to go to the 3-phase lab
The 3-phase output is created by sending a digitised sine wave to do the same for the mains 3-phase. The timing is also critical
array to an I2C DAC at around 3.2MHz (the highest supported clock to maintain the angle between the phases; mine may vary a bit,
I could get out of an Adafruit Teensy 3.2). The sine wave array has whereas the grid is pretty stable.
165 points and each other phase is generated by circular shifting
the array by one-third of its length. I have made the code for the Timing is definitely a challenge with 3-phase simulation; single-
Teensy available via github (see resources). The output of the DAC phase AC is so simple by comparison. What unexpected challenges
has a DC component and is stepped (has harmonics). So I pass it did you face with this project?
through an RC low-pass filter and an opamp to bring it to +/- 12V
peak to peak AC, which my energy monitor devkit is designed to There are no breadboard-ready breakouts for 3-4 output DACs,
handle. which makes it difficult to prototype. The demo PCB for Microchip
MCP4728 that I’m using, is also unexpectedly large. The Arduino
Sounds like a reasonable approach, and it obviously works! Is library for it had fallen out of date as well, and so I had to update it
monitoring 3-phase more difficult than standard mains power? (see resources for a link to the updated version that I put on GitHub).
Of course, getting 3-phase to test my energy monitor was the initial
Monitoring 3-phase has to deal with higher voltages between challenge, which lead me down this rabbit hole in the first place! ››
phases. It also requires more ADCs (around 6 for 3-voltages,
3-currents), whereas single-phase can make do with 1, 2 if you
want to capture the power factor.

diyodemag.com Issue 002 August 2017 101


FEATURE

A mix of development boards make it work. Tisham's workbench complete with working prototype.

›› Those boards do appear rather large, but not the most difficult my tools of choice). I would be interested in hearing from anyone
thing to overcome (even if your prototype ends up three times the who is interested in collaborating or contributing to this project.
size it needs to be). If you had your time over, or were creating a
v2.0 of this project, is there anything you would change? Sounds amazing. With a little luck, one of our DIYODE readers will
see this and get in touch! Thanks for taking us through your Three-
One of the suggestions from hackerspace for building a 3-phase Phase Synthesiser Tisham, we look forward to seeing what’s next! ■
50Hz simulator was a constant speed drive, which spins one of the
BLDC motors commonly used in quadcopters. I would like to build GOT SOMETHING TO SAY?
an electro-mechanical rig to do this. It might end up being simpler, For more photos or to discuss this feature, visit:
with less harmonics than the DAC-based approach that I’m currently https://diyode.io/002chcd
using.

That’s definitely an interesting idea. Constant motor speed isn’t


terribly difficult to achieve, and it could produce better grid-like
consistency; perhaps they’re onto something! How much testing
have you done so far, with the 3-phase monitor itself? Reading & Resources:
When connected to the simulated input, the ATM90E36 successfully ► TEENSY SINEWAVE GENERATOR CODE
detected the 3-phases with correct angles. The load testing needs https://github.com/whatnick/mcp4728/tree/master/
to be finalised still, as well as power-factor/phase-shift testing. examples/SineWavei2cDAC
► UPDATED ARDUINO LIBRARY
It sounds like you’re well prepared for that stage. Since we all love https://github.com/whatnick/mcp4728
having multiple projects on the go, what else are you working on ► CURRENT SENSING TRANSFORMERS
now? https://au.element14.com/triad-magnetics/cst-1005/
transformer-100-1-5a-40ohm/dp/1615369
I am currently working on building a 3-phase 6-CT energy monitor in ► WIRE-WOUND RESISTORS
M2 DIN Rail format to monitor grid and solar systems - very similar https:/www.jaycar.com.au/10-ohm-10-watt-wire-wound-
to WattWatchers - but running on the ESP8266/ESP32. It is going to resistor/p/RR3352
be fully open-source. It is a multi-board design, so requires a fair bit
of to-ing and fro-ing from MCAD to ECAD (FreeCAD and KiCAD are

102 Issue 002 August 2017 diyodemag.com


Order online from tronixlabs.com.au!

BBC micro:bit Go! :MOVE Buggy Kit for


• Learn coding, hardware and more BBC micro:bit
• Bluetooth, sensors, online IDE • Fun and educational robot buggy for your
• Includes USB cable, batteries BBC micro:bit (not included).
• Includes all parts - ready for assembly
• Accessories and kits also in stock
• Easy to control via code or smartphone!
#TM0001 $24.95
#MOVE $46.95

Spy Camera for


Unicorn HAT HD
• Awesome 256 RGB LED matrix for Raspberry Pi Zero
your Raspberry Pi 3/2 model B • Tiny 5 megapixel fixed-focus camera for
your Pi Zero v1.3 or Zero W v1,1
• Kit includes HAT and required
mounting hardware • Includes 50mm cable
• python library and fun examples • Camera measures 8.6x8.6x5.2mm. Tiny!
#PIM273 $49.95 #3508 $39.95

CCS811 Air Quality


Sensor Board Velleman Voice Changer Kit
• Detect total volatile organic compounds, • Have fun and sound like a robot or other character
such as equivalent Carbon Dioxide and • All through-hole components and full instructions
Metal Oxide levels • Easy-to-assemble soldering kit, ideal for the beginner
• Ideal for indoor air quality monitoring
• Need a soldering iron? Search our site for TS1651
• Full Arduino library and tutorial support
#K8126 $16.95
#TZ4193 $29.95

Wide range of WeMos ESP8266 & ESP32 modules in stock

11% off storewide for August! Use promo


code "DIYODE" during checkout*

Stop looking for Adafruit LiPo batteries... Tronixlabs


has you covered with the entire range in Australia!
• 105 mAh #1570 $11.95
• 150 mAh #1317 $12.95
• 350 mAh #2750 $13.95 Australia's #1 micro:bit Reseller
• 500 mAh #1378 $14.95
• 1200 mAh #258 $19.95
• 2000 mAh #2011 $22.95 Questions? Email them to
• 2200 mAh #1781 $18.95 • 4400 mAh #354 $36.95
• 2500 mAh #328 $27.95 • 6600 mAh #353 $54.95 support@tronixlabs.com

Visit tronixlabs.com.au • $5 delivery Australia-wide


Order by 3pm EST for same-day shipping if all items in stock. All prices include GST and valid until 31/8/17. Specfications subject to change
without notice. All items in stock at time of publication. E&OE. *Payment via American Express, MasterCard, Visa, PayPal or direct deposit.
GOING PRO

OBELISK SYSTEMS
Introducing
the StarLAB
Based in the Hunter Valley in
New South Wales (Australia), the
StarLAB is the flagship product
of Obelisk Systems, which is an
education and embedded systems
company founded in 2016.

104 Issue 002 August 2017 diyodemag.com


GOING PRO

The StarLAB is a complete STEM teaching solution for Year 9 and What a fantastic idea. It’s so exciting to think about kids learning
10 students in Australia, and includes all the hardware, software actual skills they can use in real life! How long has StarLAB been
and online resources required to engage students with robotics, up and running?
coding and computer programming. The StarLAB’s online
lessons, professional development resources, and the annual The StarLAB program has been running for around seven months
Rover Challenge are all built around its sensors and expansion (a year if you include the beta testing school phase), but for a
boards. We caught up with Obelisk Systems’ electrical and young system it’s growing really fast. In fact, since our product
marketing engineer, Clinton McKinnon, to find out more about launch in February 2017, more than 50 schools and in excess of
this clever company. 1,000 students across Australia have been having fun with the
StarLAB program.
The StarLAB is such an innovative idea. How did it all begin?
That’s a great achievement in such a short period of time. Run us
The StarLAB is the product of four friends who set out to make through who’s behind this success.
a 'cool piece of tech' and along the way it developed into a full
STEM education platform for students of all ages. So I, Clinton, am the head of marketing, and the company’s chief
enthusiast about STEM and the StarLAB – if given the chance, I
The StarLAB is a coding and sensor platform that lets students will talk your ears off about anything STEM-related! Occasionally,
explore the world through a wide variety of sensors. Students I also put my recently obtained electrical engineering degree to
are taught to code the StarLABs sensors, and as they learn to use by writing apps.
code, they can observe physics in real time, and eventually,
with the rover expansion, use those observations to design an Luke is the architect of the StarLAB platform. He has an uncanny
autonomous vehicle. This may sound very complicated, but ability to predict a request and have it completed two weeks ago!
the support materials were designed with teachers in schools, Luke is most famous at the StarLAB for adapting the platform to
so anyone can teach STEM with StarLAB right out of the box – scratch in a weekend (because someone asked if he could), and
we even mapped out materials to the NESA-approved iSTEM designing the amazing MK2 Rover in just over a week.
curriculum!
Lewis is the official voice of the StarLAB, so when you play one of
As we further developed the API, we came up with a few the videos in our lessons, you’ll hear his dulcit tones! Not just a
unique tools that used the wireless networking available in our smooth set of vocal cords, Lewis also writes the firmware for the
hardware. This included a feature we’ve dubbed “multiplayer StarLAB, and has appointed himself the master of quality control
programming”, which allows multiple students to code on the for the online lessons. ››
same hardware at the same time, from their own computers.

Meet the Team:


Obelisk Systems
► ANDREAS ANTONIADES
Founder, Business Manager
► LUKE HACKWORTH
Founder, Systems Engineer
► LEWIS QUILL
Founder, Electrical Engineer
► LEVI WEITENBERG
Founder, Physicist / Computer Engineer
► CLINTON MCKINNON
Marketing Manager

diyodemag.com Issue 002 August 2017 105


GOING PRO

Rapid prototyping at Obelisk Systems.

›› Andreas is the official mouthpiece for Obelisk Systems. He talks


Safety first!
to the very important folks like government, business leaders, and
teachers about the benefits of STEM and how they can help the
StarLAB provide Australian students the 21st-century skills they’ll
need to thrive when they leave school and enter the workforce.

Levi is our resident physicist, computer engineer and master of


online lessons. He spends his days creating lessons that use coding,
to teach students STEM skills by creating examples that challenge
them to explore the world, and intuit the physics and maths behind
what they are doing.

As a passionate team of engineers and massive nerds, we’ve all


had a long time a love of STEM. Obelisk Systems began with dreams
of space and robotic arms, but the market was still in its infancy.
In his honours project, Andreas had proposed an educational
satellite that a student could code on. After some initial market
research it was found that the educational robotics industry was not
short on gimmicks, but it lacked products that actually taught the
fundamental skills needed in the STEM workforce. So they teamed
up with RDA Hunter’s ME Program to make a sensor and robotics
platform that would not only inspire students to code, but teach
them the STEM skills that we love and use everyday in our roles as
engineers.

You guys are a living example of a small team achieving big things.
What are the core principles behind your program?

The core principal of the StarLAB is that STEM is not four (or five in
the case of STEAM) subjects, but one integrated subject. The truth
of STEM is that without all of the elements you can’t understand
how any one of them work. StarLAB teaches STEM as a single

106 Issue 002 August 2017 diyodemag.com


GOING PRO

the NSW Department of Industry – the latter even sponsored us to


attend CeBIT this year, which was so much fun.

That’s really impressive.


What’s your ultimate goal for the StarLAB program?

We want to give students the skills they need to excel in their own
professional lives, and to develop the confidence to try and make
the world a better place. We want to help teach them that if they
don’t succeed the first time then they can dust themselves off, get
up, adjust their plan, and try again.

It sounds like the youth of today are in good hands when they
become involved with the StarLAB. What else do you guys have up
Testing interfaces in the StarLAB system. your innovative sleeves?

We’re always working to improve and expand our platforms, but lots
subject, meaning at no point will you find yourself asking “why am I of those plans are far too secret to talk about yet! The biggest new
doing this?”, because you can see and interact with it in a real and thing we’re currently working hard to develop are training courses
physical way. for teachers, and a coding club that will give students a chance
to come and code with the engineers from our team. We’re also
Sounds like a surefire recipe for success for StarLAB students. What working on two hardware expansion products: the first of which
milestones has the program achieved so far? will allow students to design their own electronic circuits, and the
second will give the StarLAB an interface with the Arduino platform.
Our biggest milestone so far was the launch of the StarLAB platform
in February. At that point in time, we had around 20 teachers attend Some people see STEM and robotics as “skills for tomorrow”, but
our launch party, which was held at a small room at The Stadium we don’t really like that perspective because people are often
in Newcastle (we weren’t in the actual stadium – maybe one day). doubtful of things that try to predict the future. The reality is, there
Then in May, we had the rover launch, at which point students are STEM and robotics jobs available right now, and so our goal is
could start driving the StarLAB around. Our next big milestone will to help ensure that today’s kids don’t miss out on these current
be in November at the ME Program Mars Rover Challenge, which opportunities to enjoy the fun of the already changed world. ■
will see students from around Australia compete to code the best
autonomous rover. You can connect with StarLAB and Obelisk Systems at:
https://www.starlab.education
In terms of official recognition, we took out top honours in the @obelisksystems
NBNco grant, and have also received grants from Beyond Bank and @obelisksys

GOT SOMETHING TO SAY?


To discuss this edition of Going Pro,
◄ LEFT leave your comments at:
The StarLAB rover.
https://diyode.io/002nvwc
RIGHT ►
StarLAB hardware built
on Raspberry Pi.

diyodemag.com Issue 002 August 2017 107


FEATURE

DIGGING
FOR SATELLITES
When I was younger I spent a lot of time hiking and biking in the
MIKE FIELD hills, using just a map and compass for navigation. When affordable
IT Systems Engineer and Bike Enthusiast. hand-held GPS units first became available they were the most
www.hamsterworks.co.nz amazing of tools. Although they are now ubiquitous, I’ve always
@field_hamster wondered just exactly how do they calculate where we are? In 2013
I saw an article on the Hackaday blog, about a homemade GPS
receiver by Andrew Holmes. I put this on my project “to do” list, and
No, that’s not a typo. Mike wanted to set about slowly acquiring the hardware and knowledge required to
go deep; really deep, and figure out make it happen.
what’s actually behind a GPS signal.
That thirst for knowledge often sparks some interesting questions.
What hardware did you need to receive the raw GPS data?

Probably every single one of us has used GPS (Global Positioning I used an inexpensive active GPS antenna from Ali Express, coupled
System), perhaps without even realising. Whether it’s on your phone, to a KiwiSDR board from SeeedStudio.com. The Kiwi SDR board
your Fitbit, your in-car navigation, or on a boat. The GPS really came is actually aimed at being a Software Defined Radio that can be
into use in the mid 90s, but the last decade has seen exponential accessed over the internet, but also includes a GPS front-end. I
growth of GPS-enabled devices, and ready-access to tiny GPS then patched wires onto the test points, and used a Digilent Nexys
receivers with unbelievable accuracy. Mike from New Zealand was 2 FPGA development board to capture the raw signal samples
curious about what’s actually behind GPS; and not just the satellites, that are being received by the front-end of the GPS. They are then
but what data is being received and decoded in a split second, sent to a laptop to be recorded for offline analysis. Although the
which tells us where on earth we are? We caught up with him to find Nexys2 board is an old design and no longer available, it was a good
out what he learned. solution for this project, as it has an interface that acts much like an
Enhanced Parallel Port, allowing it to transfer the 2MB/s of raw data
Many of us would have played with GPS receivers to obtain location without missing any samples.
coordinates, but rarely do we think beyond that output data. What
made you take on the journey of understanding how the GPS works That’s a reasonable amount of bandwidth! How did you get started
at a fundamental level? receiving and decoding?

108 Issue 002 August 2017 diyodemag.com


FEATURE

Here is the ‘user interface’


showing the internals of the
GPS receiver, it is currently
tracking nine Space Vehicles,
and searching for four others.
Of the nine it is following, it has received enough reliable
data to calculate the position for seven Space Vehicles. The
position fix is first calculated in ECEF (Earth Centered, Earth
Fixed) units, and then converted to the more familiar LLA
(Latitude, Longitude, and Altitude) units.

RIGHT (INSET) ►
Mike plotting his current location
(about a gazillion times, give or take a few...).

The initial reference point was the “Global One thing that I didn’t realise is just how high the
Positioning System Standard Positioning Service GPS Space Vehicles’ orbits are, and how weak
Signal Specification, which describes how the the GPS signals are. They are approximately
signal is transmitted, what data is encoded, how it 20,000km away, they transmit with about 25W of
is encoded, and how you can use the information power, and the signals need to be received with
to find your location. a non-directional antenna (because you need to
receive more than one at a time). They are in a “semi-
Before I had the ability to record my own data, I synchronous orbit” - they orbit the earth every 12 hours.
scoured the internet and found a single set of raw GPS data;
however, the only information available was the recording sample Also, the data rates are also really, really slow - only 50 bits per
rate and the intermediate frequency of the GPS signal. With a lot of second. This slow rate is why it takes 30 seconds to get a GPS
experimenting I was able to detect the signatures of the GPS Space position fix from a receiver “cold start” - at the slow rate, it takes
Vehicles (satellites), and eventually decode that the signal was this long for the Space Vehicles to transmit their orbital parameters
recorded in Nottingham in the UK, and even identify the corner of and clock correction factors. It’s pretty amazing how the orbits of
the building where it was recorded. The company in that building the Space Vehicles are known to such high precision - although they
made navigation systems, and from this information, as well as are orbiting at thousands of kilometres per hour, the orbit is known
LinkedIn, I was able to track down the person who recorded the to within a few centimetres.
data - who now works for the European Space Agency!
It’s a good thing that orbital precision is there when you have
The initial version of my software was small (about 700 lines of hundreds of millions (or billions) of dollars worth of satellite up
C) and very simple (built for tinkering with the algorithms rather there! Was there anything you can take away from the experience,
than speed). It took all night to process three minutes of data. The other than a greater understanding of GPS?
processing of GPS signals is amazingly simple - just XOR-ing three
bits together, and counting how many are set, and once I had a It is amazing that the most advanced technology like GPS can be
working implementation I was able to speed it up by over 200 times! explored on a hobbyist’s budget. Things that would require a very
As the code currently is, it uses about half an Intel CPU core to expensive research lab and an equally expensive budget can now be
receive data from eight different satellites. Now on my to-do list is built in a garage or on a workbench in the spare room! Another thing
to have the software process data in real time! I discovered was that Digital Signal Processing (DSP) and Software
Defined Radio (SDR) isn’t that hard, and can actually be quite
Wow - when you consider the amount of data crunching that interesting code to write. The range of inexpensive SDR hardware
equates to, it really does make commercial GPS receivers seem that has recently come onto the market has really created a whole
even more impressive! What unexpected surprises did you find new hobby, at the intersection of Ham Radio and Home Computing.
amongst all that data? If you want to get started in DSP, they have an excellent introduction
is a book that is available for free. ››

diyodemag.com Issue 002 August 2017 109


FEATURE

›› That sounds like a great resource to get started with. We’re


definitely in a world where “anything is possible” - imagine if iode = 4B

Einstein lived in an iPhone era! What unexpected challenges did you M0 = -1.96696360836378514314048970846

face with this project? delta_n = 5.28236288876009244797414042094e-09


e = 0.00913695234339684247970581054688

It is really hard to make something this complex work correctly, sqrt_A = 5153.7914524078369140625

without a proven implementation to compare against; all it takes omega_0 = -0.248065636243747916767077299482

is having one wrong value (e.g. the time of week is out by six i_0 = 0.929460680202385813863941166346

seconds) and the position will be unable to be found. Also, I know w = 0.581836914791512338496204392868

virtually nothing about control loop theory, so I should probably read omega_dot = -8.26677291570257726900144621112e-09

more about this and actually do a decent design, rather than just idot = -2.81440294546514755206673727254e-10

empirical testing. Cuc = -2.682209014892578125e-07


Cus = 6.78189098834991455078125e-06

It’s true that proof of concept and a working product can often look Crc = 232.3125

quite different. What knowledge have you now gained regarding Crs = -4.875

GPS that would save you time if you tackled this from scratch again? Cic = 4.470348358154296875e-08
Cis = -1.0430812835693359375e-07

There are lots of hidden, elegant ideas that have been used to Toe = 180000

make GPS work. The simplicity of how the special “Gold Codes” are
generated, the way that the data is transmitted so as to make it This is an example of the Orbital Parameters for Space Vehicle 15.
simple to receive, the way you can minimise the CPU time required They allow the GPS receiver to calculate exactly where a Space
to acquire the Space Vehicle signals. Even what seems to be trivial, Vehicle was when it transmitted the signal. ‘sqrt_A' is the square
like the selection of the intermediate signal frequency, has hidden root of the orbit’s average distance from the centre of the earth -
depths. Being aware of these subtleties and taking advantage of 26,561,561.671 metres.
them could make a repeat of this project much simpler.

Awesome. The GPS system as a whole is definitely genius, and it


seems there are some layers well beyond what most of us think 1111111111000111000100111011001010111011110101000

about. What is in the pipeline for you next? 1111010010101000001011111111010101010111101000011


1010010001100101101011001111010110001100111111001

I’ve got a few projects on the go, I am working on some audio 0101010011001100101001111101001110000100011011001

processing using a Raspberry Pi “plate” and an FPGA board, I am 0001010011011110111010101110011001110111011100111

also playing around with ESP8266 WiFi modules and the MQTT 0101001110100000111101101110000110001001010010110

protocol, in an attempt to make an environmental monitoring 0110100010001011010010111010011000101100000010100

platform and security system for home. I’m also trying to reinvent/ 1001011111011110001100011011101100001111001001110

rewrite my FPGA website. We are just about to move to a new house, 0101100010000110111111100111000110101001010000100

so I am also looking forward to setting up my new workbench. 0010010110111110101110001011100100001111101101010


1000101111011001110011111000001110010010101100101

Sounds fantastic. Thanks for taking us through your 1110010111000001010110110011000011010110111010001

exploration of GPS signals! ■ 0101111110100011100110111001010001101000000110010


0100010000010011011010011110011010101100001011101

GOT SOMETHING TO SAY? 1010001100001001111111011100011110000001110110110

To leave your comments, visit: 0010100010011001000001101001001111011111000101010

https://diyode.io/002xqdn 1101000010100000001011011011110011110001000111111
0110001110101101010000110011011000001100000000110
110110101110101111000010101001000010110010011000

Reading & Resources: 0010001001000000100000000010010010011010011010111


11001100011111001000111011111100001110000000

► DSP GUIDE
www.dspguide.com/pdfbook.htm This 1023-bit string is one of the two special Gold codes that
► HACKADAY BLOG allow all the GPS satellites to transmit on the same frequency.
www.aholme.co.uk/GPS/Main.htm When repeated It contains every sequence of 10 bits other than
► GPS STANDARD POSITIONING SERVICE “0000000000”. Two different Gold codes are combined with the
www.navcen.uscg.gov/pubs/gps/sigspec/gpssps1.pdf GPS data signal, making it like noise, but still allowing a receiver find
the signal.

110 Issue 002 August 2017 diyodemag.com


PROJECT

MODEM
RESTARTER
Automatic Here’s a problem that I’m sure we’ve all experienced
- a router that for whatever reason, simply stops

System Using
supplying the internet we need, and nothing fixes it
better than a simple “turn it off and on again”. With
Arduino and an ESP8266-compatible board, this can

The ESP8266
be done automatically. - by Tim Blythman

It’s the solution repeated by seasoned IT professionals everywhere: Because we’re using WiFi, the sketch first needs to connect to
the hard reset. A power cycle, AKA “turn it off and on again” that the WiFi network, and then try to connect to a website. I’m using
simply does what it says. Resetting a malfunctioning piece of Google, because if Google’s down, that’s pretty much as good as
hardware to a known good state. What we’re trying to detect and the internet being down. Of course, not being able to connect to the
correct here is the situation that can drive anyone mad - that the WiFi network is a good reason to ring the alarm bells too, so this
internet isn’t working. I wanted a system that will check if the router needs to be detected as well.
is connecting to the internet OK, and if not, apply the hard reset that
will make it all work again. This project also uploads reports to a The next step is to reset the router. If you’ve got a router that runs
phant stream, so that the status can be checked remotely. off low voltage, even via a transformer or PSU, then that’s quite
easy, but if you’ve got a router (or some other device) that runs off
THE BROAD OVERVIEW 240V directly, then more hardware is needed to do this safely. Of
course, the power can’t just blindly toggle either - it needs to turn
There’s two main parts to this problem: detecting that the router the power off for long enough for the router to reset, but also give it
isn’t doing what it should, and then making the reset happen. long enough after power on to get into a normal operating state. ››

diyodemag.com Issue 002 August 2017 111


PROJECT

›› Because everything should always have more features, I’ve also the router to restart. There’s a timeout to let the router go through
added some code to upload the status to a phant stream (see article its boot process before the checking starts again.
on p89 of the July 2017 issue). Of course, if the internet is down,
an update can’t be done, so the status is either OK, or a reset has On startup and at regular intervals, a message is also sent to
recently occurred. If there hasn’t been an OK for a while, there’s the phant server by a separate function. If a reset occurs, then a
something wrong. different message is sent.

HOW IT WORKS Under the Arduino IDE, connecting to a WiFi network is as simple as
issuing the command:
We originally set out to use an Arduino plus WiFi Shield for this
project, but the project seemed simple enough that I should be able
to program the WiFi Shield directly. The main parts of the hardware WiFi.begin(SSIDNAME,SSIDPWD);
are the WiFi Shield (operating as an Arduino board) and a 5V relay //connect to WiFi network
module. The router power is fed via the relay’s normally closed (NC)
contacts, so that to effect a reset, the relay module is energized for
a few seconds. Using the NC contacts also means that the default The code that checks if the board can connect to the internet is
state is “power on”, and things will generally keep running if there is below. We're using a counter to detect the number of “fails”, and
an issue with the Router Restarter. only tripping the reset if the count gets to three. This gives a bit
of robustness in case of occasional glitches that might occur in
The other necessary piece of hardware is a USB-Serial converter to the internet. In essence, we’re assuming that if the ESP8266 can
do the initial programming. If you don’t have an immediate need to connect to Google, then everything is fine.
use the USB-Serial converter for another job, then it’s an easy way
to power the built project as well. But you may as well keep it for
another project, and power the device directly once complete. WiFiClient client;
if(client.connect(“www.google.com.au”,80) {
// connect to google on port 80-
// could be any website
A closeup of the shield. Most of Serial.print(“connection ok:”);
the “pins” on the WiFi module are cnt=0; //reset fail count
broken out to headers }else{
on the WiFi Shield. Serial.print(“connection failed:”);
//count the fails
cnt++;
}

These constants (anything shown as a #define) set up what is


needed to connect to the phant service (to use this, you would
have to fill in the key and stream names with ones you’ve created
yourself). I’ve set up the HOSTNAME as a #define for two reasons
- firstly, it’s easier to change if it does change in the future; and
secondly, it’s actually possible to run your own phant server, and
this would have a different address.

◄ LEFT
Any 5VDC relay module #define PHANTPUBLICKEY “_your_public_key_”
with Normally Closed (NC)
#define PHANTPRIVATEKEY “_your_private_key_”
contacts will work.
#define PHANTNAME “powerstatus”
#define HOSTNAME “data.sparkfun.com”
#define HOSTPORT (80)
THE HARDWARE

The code is actually quite basic. The module tries to connect to a


WiFi network, and then tries to connect to google.com.au. If it takes This function is what uploads data to the phant server. The code is
too long to do either, the relay module activates, shutting off power identical to what you would use to load a webpage, and it dumps the
to the router for a few seconds, before reapplying power, allowing server’s response back to the serial port for debugging purposes.

112 Issue 002 August 2017 diyodemag.com


PROJECT

void dophant(char* txt){ The DC cable after


//upload txt to phant being cut.
Serial.print(“Phant:”);
Serial.println(txt);
if(client.connect(HOSTNAME,HOSTPORT)){
//connect to phant
client.print(“GET /input/”
PHANTPUBLICKEY “?private_key=”
PHANTPRIVATEKEY “&” PHANTNAME Then screw the bare ends of the wire into the terminals on the
“=”); //upload via get request relay module. You need to use the normally closed and common
client.print(txt); connections- the normally closed is usually marked NC and the
client.print(“ HTTP/1.1\r\nHost: “ common will be the middle. On the module we used, they are the
HOSTNAME “\r\n\r\n”); two right-most terminals.
delay(5000);
//wait for response
while(client.available()){ Relay module with wires
Serial.write(client.read()); screwed into place.
//and dump to serial port
}
}
Serial.println(“Phant done”);
client.stop();
//disconnect
}

THE BUILD

PARTS REQUIRED: JAYCAR ALTRONICS


1 x ESP8266 WiFi Shield XC4614 Z6360
1 x USB to Serial Converter XC4834 D2340B
1 x 5V Relay Module XC4419 Z6325
You can easily test that this is correct by plugging the power supply
You’ll also need standard prototyping hardware. back into the router. If the normally closed contacts have been
correctly wired, the router should turn on and operate as normal.

DON'T WANT TO CUT YOUR POWER CABLE? You can easily I cut my relay module in close to the DC plug end of the cable, but in
make up an inline joiner for this project using a DC plug, DC retrospect, I should have put it closer to the mains plug pack, given
socket, and a short length of cable. Connect the DC plug that I’m plugging the USB power supply for the Router Restarter into
from your power supply into the socket, and the new plug the same power board. ››
into your router and you're set. That way your power supply
is still in-tact which may be useful for any warranty etc.

BUILDING THE CIRCUIT

I found it easier to make the connection between router and relay


module first. If your router has a low voltage transformer with a lead
and DC plug, you should be able to use this method. On the lead
between the plug pack and DC plug, cut and separate one of the
wires and bare back the ends about 5mm.
Made up programming lead.
Note the addition of a lead offcut as a spacer.

diyodemag.com Issue 002 August 2017 113


PROJECT

›› The rest of the mechanical build is to hook


everything up with jumper wires - there are four
from the USB-serial converter and three from
the relay module, all going back to the WiFi
Shield.

Because I figured I might be connecting the 1 3 12 11 10 9 8 7 6 5 4 3 2


ON ON
USB-serial converter more than once, I made a D
ESP13 Shield
5V
plug-in harness out of the jumper leads. After G
SW1
plugging the ends into the respective boards
TX RX G 5V
and making sure they worked and were wired G
correctly, I used a little superglue (sparingly 5V
SCL SDA G 5V A
and carefully) to set each end into a permanent ESP13 0 1 2 3
arrangement that could still be plugged and 3V3 G RXO TXO

unplugged when needed.


3V3 G EN AD D
5V
KEY G

RST

RIGHT ►
Connection diagram for
the Modem Restarter.

Note that the Relay Module needs 5V to its power input to operate The other #defines are more for finetuning, so can be left for now.
correctly, even though it will activate on a 3.3V signal to a control If you do not have a phant stream set up, you can just leave the
input it may produce unreliable results. default values - it will just try to upload to a non-existent stream. If
you don’t intend to set up a phant stream at all, you can replace the
CODE AND CONFIGURATION dophant() function with an empty function by removing the code
inside the function (so it does nothing):
As noted earlier, the code won’t simply work out ‘out of the box’, as
there are some parameters that will need to be set to work with your
WiFi network and phant stream: void dophant(char* txt){
//do nothing instead of upload txt phant
}
#define SSIDNAME “SSID”
#define SSIDPWD “PASSWORD”
#define PHANTPUBLICKEY “PUBLICKEY”
#define PHANTPRIVATEKEY “PRIVATEKEY” ASSUMED KNOWLEDGE:

Phant Stream
#define PHANTNAME “FIELDNAME”

At a minimum, replace the text inside the quotes with your own SEE ISSUE #001 PAGE 93
versions. If you are not using the phant server at data.sparkfun.
com, you will need to change HOSTNAME and HOSTPORT although If you haven't setup your own PHANT stream yet, check out
HOSTPORT will probably still be 80. the article in Issue #001 https://diyode.io/001ykxw for a
step-by-step guide.

PHANT is a free IoT service provided by SparkFun.

114 Issue 002 August 2017 diyodemag.com


PROJECT

1 Selecting the host board in Arduino IDE. 2 Serial Monitor Debug Data.

Assuming that you’ve set up the Arduino IDE for your ESP8266
board (see our setup article elsewhere in this issue), plug it in and
choose the correct serial port.

There are a lot of board profiles available. For the XC4614 WiFi
Shield, I chose the ‘ESPDuino’ option as it is based on an ESP-
13 module like the shield, and this worked fine. If you have TESTING THE SYSTEM
trouble, you can manually change the options - I would start by
trying a different Upload Speed. The CPU Frequency and Flash Providing everything is working properly, you can now test that it
Size should not matter too much, as the sketch is quite small does indeed cut power when there's no internet connection. The
and will operate fine at the slower 80MHz. You might find your simplest way, depending on what type of internet connection you
module or board has a documented Flash Size that you can input, have, is to pull out the hard-wire lead (Cat5 or telephone lead).
and if not there is a test sketch that can check the flash size at
File>Examples>ESP8266>CheckFlashConfig [1]. If you're in Australia and have an NBN connection with FTTP
(Fibre to the Premises) it's not a good idea to remove the fibre optic
The next step is to put the board into bootloader mode. On the lead and may require a technician to visit if you do. If you cannot
Duinotech board we used, hold down the “KEY” button, press "disrupt the internet", the best option is to simply use the off switch
and release the “RST” button, then release the “KEY” button. on the router. After a short time, you should hear the mechanical
If you have one of the all-in-one boards with a USB-serial "click" of the relay module trying to restart the router. Under the
converter built in, then this might be done automatically. If not, default settings, it will take about 30 seconds to activate, and
there is more information about how this happens here: will toggle the relay for five seconds. If it doesn’t seem to do this,
check the wiring and Serial Monitor to see that the fault condition is
https://github.com/esp8266/esp8266-wiki/wiki/Boot-Process detected.

Now you can press upload from the Arduino IDE. To me a least, it The first thing I did after getting it all working was to make up a
appears that this process takes much longer than for other boards. permanent power lead that would not require me to plug in the USB-
Open the Serial Monitor, and observe the debug data [2]. serial converter to run the Router Restarter.

If you get a 0.0.0.0 IP address, then the WiFi settings might not be I found an old USB plug with a lead that, I think, came from a hub
correct. A HTTP 404 message in the response from the phant server that stopped working. I found the red and black wires and soldered
might indicate that the phant stream keys or field are incorrect. a small piece of 0.1” header strip to them.

NOTE: It may be habit to set an IP address when using WiFi or This then plugs into the header where the USB-serial converter is
Ethernet modules. However it's not a good idea for this project. You plugged, being sure not to get the polarity incorrect. The pins on the
actually want the DHCP protocol to assign a valid address. If that board should be labelled anyway, and you can always check with a
doesn't happen then it indicates an issue too. If the IP address isn't multimeter. A few seconds of work can save you a broken module. ››
assigned correctly, it will also then restart the router. This is also
useful for resolving other system bugs that a restart can fix.

diyodemag.com Issue 002 August 2017 115


PROJECT

13 12 11 10 9 8 7 6 5 4 3 2
ON ON
D
ESP13 Shield
5V
G
SW1

TX RX G 5V
G

A USB donor cable modified for 5V


SCL SDA G 5V A
5V supply to the duinotech board. ESP13 0 1 2 3
3V3 G RXO TXO

WARNING: Don’t assume that black and red are power, 3V3 G EN AD D

or even the right way around. Use a multimeter to double


5V
KEY G
check. In some cases, colour codes have been incorrectly
identified, which may lead you to fry your board. RST

RIGHT ►
The finished project using a modified USB
cable for power, meaning you can save your
USB to Serial module for another project.

WHERE TO FROM HERE?

Apart from the settings mentioned above that definitely need to be Of course, your server probably doesn’t run off a small plug
changed, there are one or two that might need to be tweaked to pack, and to get this project working will probably need a way of
make the Router Restarter work with your setup. The relay is pulsed controlling 240V. The relay in this project is rated for 10A at 240V,
for five seconds in the reset routine - this should be enough for most but I wouldn’t recommend modifying any 240V wiring unless you’re
devices, but if you are finding it isn’t working reliably, the duration qualified and know what you’re doing.
can be increased. There is also the BOOTTIME constant at the start
of the sketch - this is the time that the sketch waits for the router If the server has a low voltage power button (e.g. like an ATX power
to restart before testing the internet connection. If it is too short, supply), then the relay could be used to toggle that. In this case,
the Router Restarter might get stuck in a loop, as the router doesn’t you would probably have to use the normally open contacts, and
have enough time to get up and running before it is reset. If you are program the relay to activate for five seconds to do a hard “power
having trouble, this can be extended. off”, then pause and give a brief pulse to turn it back on.

In the article from the July 2017 issue, I also created a small If this doesn’t work and you are not legally qualified to work with
Android app, which monitors a phant stream for changes; this app 240V, then it might be possible to use a remote controlled wireless
would work equally well monitoring the stream for this project. power point to do the switching. For example, a pair of relays could
Check out the article at https://diyode.io/001ykxw. be connected to “press” the off and on buttons on the remote to
initiate a power cycle.
With the phant capability of the Router Restarter, it can easily be
extended to feed more data to the phant stream, or even a second There are a few projects descibed online to solve this pointy issue of
phant stream; for example, you could add a temperature sensor mains power switching, and it's something we'll probably tackle in
output. Just add a “dophant()” function call with the required value. greater depth too. ■
Perhaps, if your router has a habit of overheating, you could use that
to trigger a reset as well. GOT SOMETHING TO SAY?
Get the code for this project or leave a comment, visit:
Another way you could use this project is if you run a server, and https://diyode.io/002zsgp
you want to check if the server is “up”, and running correctly. In
this case, you would use the web address of your server instead of
Google. You could also separately test the IP address and URL of the
server to discriminate between server outages and DNS issues.

116 Issue 002 August 2017 diyodemag.com


to support the launch of Diyode magazine
20% off SToREWIDE
USE coDE ‘DIyoDE’
this code expires 31 August 2017

delivery so fast you may hear a sonic boom

$
1596
SAVE $3.99

$
2796 $
1596
SAVE $3.99
$
3196 $
1600
SAVE $4.00
SAVE $6.99 SAVE $7.99

$
1276 $
2396
SAVE $3.19
$
7 97 $
1196
SAVE $2.99
$
7 56
SAVE $5.99

SAVE $1.99 SAVE $1.89

$
1992
SAVE $4.98
$
2876
SAVE $7.19
ea

5
$ 56
SAVE $1.39
$
1276
SAVE $3.19

Sonic Boom is an electrical store offering a


wide range of products. We are dedicated to
sonicboom.com.au providing our customers excellent service, fast
delivery and great value for money.
MICRO-EXPLORERS

Introducing
The ESP8266
This tiny WiFi chip packs a massive punch. Easily
programmed and barely the size of a USB plug.
Let's take a closer look. - by Tim Blythman

If you’ve been working with microcontrollers, especially Arduinos, devices. In fact, many modules are fitted with 0.1” spaced headers,
or have ever been interested in adding WiFi to a project, you might allowing for use on breadboards, even though they are typically not
have heard of the ESP8266 IC and its various modules. It’s a product much bigger than a coin.
of the Espressif company, and was not widely known until it was
noticed by the maker community. Through the community’s efforts They do come in a few different shapes and sizes though, the image
and Espressif’s release of their SDK, the ESP8266 has turned on this page showing two different styles of ESP8266 commonly
into one of the go-to choices for makers who wish to add a WiFi available.
microcontroller to their projects.
FEATURES
WHAT IS IT?
The ESP8266 is not just about the WiFi, and its specs look like they
The ESP8266 is a microcontroller with b/g/n WiFi and a full put an Arduino UNO to shame. But, that’s not to say that you should
TCP/IP stack, meaning that most of the hard work in making throw the UNO out - because the ESP8266 needs to spend time
and communicating over a WiFi connection is done by the handling WiFi connections, and it is less suited to timing critical
microcontroller. The ESP8266 needs external flash (for applications including PWM. There are a few restrictions on use of
program storage) to operate, and to fit this bill, the ESP8285 (a the I/O pins – for example, some are shared with the SPI bus that
microcontroller with in-built flash) and a vast range of modules accessed the program flash storage, so cannot be used without
have been developed. It’s these modules that most makers will be great care.
familiar with, as they also remove the need to solder surface mount

118 Issue 002 August 2017 diyodemag.com


MICRO-EXPLORERS

HOW CAN I USE IT? there’s a few bumps on the way to using these boards. For a start,
some boards do not use an obvious pin numbering scheme. There
I first started out using ESP8266 modules with an ESP-01 module, seems to be a mismatch between the Arduino IDE pin numbers
and connected it to my computer via a USB-serial converter. A lot and the ESP8266 pin numbers. For some of the boards, there
of modules will come loaded with a variant of the “AT Command” are defines, such that “D4” is actually mapped to the logical pin
firmware, meaning you can issue commands directly to the reference in the Arduino sketch. In other words, if the pin number
microcontroller - with functions such as “scan for WiFi networks” and doesn’t seem to be working, try prefixing a “D” to the number.
“connect to server”. You can perform the microcontroller equivalent Fortunately, everything seems to be mapped correctly on the
of opening a web page in about half a dozen commands. This setup XC4614 WiFi Shield from Jaycar that we tested.
is a great way to test and get to know how the ESP8266 works.
Generally, you may find compiling and uploading takes longer than
The next step will be to program a microcontroller to run these other boards, and the sketches always compiled to at least 200kB,
commands and autonomously access the WiFi network. An presumably incorporating some base libraries.
understanding of how network protocols work is really handy for this;
for example, for emulating the function of a webserver or web client. If you are using the bare modules or some of the boards, you
might also find that you need to use some tricks to correctly put it
Another step beyond using the AT commands is to program the into “bootloader” mode to accept sketch uploads. To program the
ESP8266 as a microcontroller in its own right. In this project, XC4614 WiFi Shield from Jaycar (as a standalone board) with an
I’m using the Arduino-ESP8266 add-on, which offers a WiFi USB-Serial converter, I had to hold down the “KEY” button, press
library with similar features to the Ethernet library. There are also and release the “RST” button, then release the “KEY” button. On
implementations of languages such as NodeMCU, Lua and even boards that don’t have buttons (such as the ESP-01), it’s necessary
BASIC. to use two jumper wires to provide the correct sequence of inputs to
activate the “bootloader” mode.
To program the ESP8266 on its own, you’ll need a Serial-USB
converter, or preferably, one of the many boards that incorporate the I also found that I was getting "function not defined in this scope"
ESP8266, a USB-Serial converter, and usually a breadboard friendly errors where the same sketch would compile successfully for other
pinout including breakouts for IO pins. As with many ICs these days, boards, but not for ESP8266 based boards. In this case, it appears
the ESP8266 is rated at 3.3V, so these boards should also include a to be a bug in the ESP8266 board profile, which is referenced here:
5V-3.3V converter as well.
https://github.com/esp8266/Arduino/issues/1669
INSTALLING THE ESP8266 ADD-ON FOR ARDUINO
The quick fix for this is to add function prototypes to the top (before
You will have to have Arduino IDE version 1.6.4 or later, so that the function is used) of the sketch, and an example of this is given
you can use the Boards Manager feature to install the add-on. It’s in the Modem Restarter project article on page 111.
as simple as opening the Boards Manager (Tools>Board>Boards
Manager…) and searching for ‘esp8266’, and installing the entry SUMMARY
by ESP8266 Community. If your search doesn’t show this entry, you
might need to go into File>Preferences, and add this URL: If you feel like you know your regular Arduino boards quite well,
then you should have no trouble getting the ESP8266 up and going.
arduino.esp8266.com/stable/package_esp8266com_index.json The Arduino implementation isn’t quite as polished, but as with the
other boards, there is a community of people on the forums who are
to the Additional Boards Manager URLs near the bottom of the always working to make it better.
Settings tab.
We also use the ESP8266 in our WiFi modem restarter project
After this, you should see a group of boards appear under ESP8266 elsewhere in this issue! For this project, we use Jaycar’s XC4464
in the Tools>Board menu. I found the “Generic ESP8266 Module” USB-serial converter and XC4614 WiFi Shield. This shield breaks
seemed to work for most cases where I wasn’t sure which board out all the IOs, has convenient RST and KEY buttons and includes
to use. You’ll also find a heap of example sketches under the 5V-3.3V converters for power and the serial port, providing some
File>Examples>ESP8266 menu. The CheckFlashConfig sketch can handly methods to get it all going. ■
help you fine-tune these settings.
GOT SOMETHING TO SAY?
USING THE ESP8266 ADD-ON To leave your comments
https://diyode.io/002txkh
Earlier, I mentioned you shouldn’t throw away your UNO yet, and
after being comfortable with official Arduino boards, you might find

diyodemag.com Issue 002 August 2017 119


SUBMISSIONS

Direct from
the Community:
Some Amazing Creations!

COSMIC RAY DETECTOR Robert from SA, Australia

Robert has built a few cosmic ray detectors in his time, but his latest is a 9 x 9 pixel
hodoscope (cosmic ray detector). For those interested in space science and cosmic
rays, you should definitely check out Robert’s website for his open-source projects at
http://cosmicray.com.au ■

QR CODE FORTUNE TELLER


Alastair from NSW, Australia
VOICE CHANGING
Using an 128x64 OLED screen, ALBUM PACKAGING
Alastair has developed a random QR Moldover, musician from the USA
fortune clock. Running on an Arduino
Mega with an SD card, you can This landed in our inbox and we had
“preload” a stack of text files with to share it. Moldover is an electronic
fortunes, motivational phrases, or future-retro musician who has developed
reminders - whatever you like. Every his new album with playable packaging!
second it will display your fortune That’s right, the USB thumb drive that
as a QR code. Use your favourite includes the music also has a voice-
QR-code reader to display your text! changer circuit called The Voice Crusher.
Looks like a fun project to us! It’s very cool, and we enjoyed watching
the video at:
Alastair talks about his project at https://www.youtube.com/
http://blog.ambor.com/2016/06/ watch?v=bxhZDmq9tm8 ■
the-qr-fortune-clock-concept.html
so you can check it out! ■

120 Issue 002 August 2017 diyodemag.com


SUBMISSIONS

TEMPERATURE DIFFERENTIAL
SWITCHING CIRCUIT
John from New Zealand

John developed a clever circuit,


designed to help with switching devices
based on a temperature differential. He
has put it to work to bring hot air from
the roof cavity into colder areas of the
house, to help reduce heating costs! It
is compatible for use with thermistors
and light dependent resistors, so can
also be used for solar tracking with
your solar panels, to control solar
heating systems, and so much more.
Setup is simple, and simple component
value changes provide scope to change
the duty cycle too. ■

AMAZING AUDIO HARDWARE


Peter from SA, Australia

Peter has created a selection of audio


appliances. Utilising some kits and building
some things from scratch, he’s got an
impressive list of items.

The first is an awesome 20W Class-A amplifier.


The amplifier itself was built from scratch. He
did make use of some great kits however, for
the input module, speaker protection module,
and the preamp stages. Peter said it was
cheaper to do it that way, and we would tend to
agree. Finished into a beautiful case, it’s a very
tidy system indeed.

The second build is a stunning 10W Currawong


amplifier, which was a valve amplifier project
described in Silicon Chip magazine. Using
a selection of parts from Jaycar and other
suppliers to build the electronics, with an
impressive hand made enclosure to show off
that amazing glow from the valves.

The last project is a stereo amplifier switch box.


It allows connection of two different stereo
amplifiers to one set of speakers. Peter’s
unique design prevents the in-use amplifier
from feeding the signal back into the unused
amplifier. Awesome! ■

diyodemag.com Issue 002 August 2017 121


THE ADVENTURES OF CIRCUIT MODD
WHY CAN'T THIS
PRINTER WORK ITSELF?

HELLO MASTER!
WHAT CAN I PRINT
FOR YOU?

WAIT!
WHERE ARE YOU GOING?

YOU'RE INTELLIGENT -
YOU CAN FIGURE IT OUT!

WHOA... CHEERS!
*CLINK*

122 Issue 002 August 2017 diyodemag.com


AVAILABLE NOW AT

https://www.facebook.com/DremelAustralia/
3 Tools
27 Pieces
Dream like a child.
Build like a machine.

www.altronics.com.au | 1300 797 007

You might also like