DIYode Issue 1 July 2017
DIYode Issue 1 July 2017
DIYode Issue 1 July 2017
TECH
MEETS ART
Issue 001
Jul 2017
AUS: $9.95 inc. GST
ISSN: 2207-8045
01
Fast forward several years and that curiosity is stronger than ever;
I constantly get a thrill out of creating new things. Every day I am
blown away by the ingenuity and creativity in the electronics and
maker community. At the same time, were enabled and empowered
by constantly evolving technologies. When I was a boy programming
BASIC on an Amstrad 128 (thats 128kB of memory 1/1,000,000th
of the storage capacity of a new iPhone), I never could have
imagined the power we would have in the palm of our hand.
Build into your own cabinet Easy to use with Arduino library
Request
Page
10
86
66
14
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.
Just go to diyode.io/001digi
and use the access code.
26 72 What is Electricity? 50
EXPLORE 3D
3D Printing Basics 72
PROJECTS:
L EARNING REMOTE CONTROL
IR & Network Connected 26
SUPER SIZE ME!
LED VU Meter 66
ARDUINO WEB SERVER
Building Your Own 78
POWER OUTAGE DETECTOR
Know When the Power is Out 89
E DITOR'S LETTER
34
Welcome to DIYODE 04
NOTEWORTHY
Worth Reading 08
NEW & REVIEWED
Raspberry Pi, pcDuino3 and more... 10
MOONSHOTS
Storing Renewable Energy 24
GOING PRO
Elite Robotics 86
SUBMISSIONS
Community Contributions 96
THE ADVENTURES OF
CIRCUIT MODD 98
Youre never
too young
to explore DAVE - EEV BLOG GLENN - THE BACK SHED
science and Many of you are probably already familiar 100% Aussie-grown awesome! Thats
technology! with Dave from EEV Blog (Electronics about how wed sum up The Back Shed.
Engineering Video Blog). His famous It started in the 90s when the internet
K
YouTube channel has over 450,000 was barely a twinkle in a coders eye.
ids as young as six are learning subscribers, while hundreds of thousands Glenn was developing his own wind
how to program, create of people around the world watch Daves generators and published the articles to
robots, write code, and build videos and engage in the forums! He The Back Shed. Since then, the site has
electronics, thanks to TechScience also started an amazing podcast called become a popular resource for off-grid
Australia. This innovative organisation The Amp Hour, which he co-hosts and electronics knowledge, with loads of
gives Sydney-based kids the with Chris Gammell. Its a great listen community projects from building a CNC
opportunity to explore and actively covering a huge range of topics. Dave is a router, making a portable battery charger
engage with science and futuristic knowledgeable guy, and he creates loads using a petrol motor and car alternator,
technologies, as a way to prepare of great content. or just making circuit boards. It also
them for the future. includes a thriving community forum with
YOUTUBE: youtube.com/user/EEVblog thousands of active members too.
Find out more at: WEBSITE: www.eevblog.com
www.techscience.com.au PODCAST: www.theamphour.com WEBSITE: www.thebackshed.com
IBM Reveals
Worlds First 5nm Chip
I
BM, working with Samsung and GlobalFoundries, has
unveiled the worlds first 5nm silicon chip. Beyond the
usual power, performance, and density improvement
from moving to smaller transistors, the 5nm IBM chip is
notable for being one of the first to use horizontal gate-all-
around (GAA) transistors, and the first real use of extreme
IBMs Nic
ultraviolet (EUV) lithography. olas Loub
wafer of th et w
e new 5nm ith a
chips.
Find out more at:
https://arstechnica.com/gadgets/2017/06/ibm-5nm-chip/
Grab it now:
Raspberry Pi
Platform Starter Kit
A
ltronics call this a starter kit stress, which was often a result of thinking
but it should probably be called pin 30 was in fact pin 31 (or whatever the
the solution! We are constantly case may be).
prototyping, and theres a million ways to do
it. But the second you need to move your It also reduces the learning curve for those
prototype from one desk to another, take it of us who are just getting started. The clearly
somewhere, or do anything other than leave labelled pin-out, which directly connects the
it steady on the desk, it ultimately becomes Pi with the breadboard, drastically reduces
a much bigger challenge than it should ever the comprehension required to simply make
be. Once you complete the treacherous sure your components or jumpers are in
journey a few feet across a room and place the right places. This is especially beneficial
your prototype back down, you usually have when youre just starting out because the
Shopping List:
to then waste valuable time going through less you have to worry about, the more
the process of figuring out what wires have successful your early projects are likely to be.
been pulled out of their sockets, and whats
no longer working. The full starter kit is available from Raspberry Pi & Arduino
altronics.com.au for $125, which saves you available at Altronics:
Being the innovators that they are, the good around $15 compared to if you purchase www.altronics.com.au
folks over at Altronics came up with a neat everything separately.
solution. It gets you started with a Raspberry RASPBERRY PI 3 PLATFORM
Pi 3, a 500-hole breadboard, 40-pin GPIO Using Arduino? They have a similar kit, STARTER KIT
expansion kit, as well as a USB adaptor and which includes their Funduino Uno board, K9620 $125
power supply. Weve had a little play and breadboard, 65-piece jumper kit, power ARDUINO UNO R3 PLATFORM
it really makes Pi prototyping easier than supply, and more. STARTER KIT
ever, with stability and simplicity. Especially K9615 $70
since Raspberry Pi GPIO pins are not labelled Of course, if you already have all your ACRYLIC EXPERIMENTER BASE
individually, the expansion kit provides you hardware then you can just grab an acrylic FOR ARDUINO OR RASPBERRY PI
with a visual reference. Itll also save you time base, which includes standoffs and rubber K9610 $9.95
cross-referencing and debugging. Many of feet. Check it all out you can thank
us can remember the hair-pulling debugging us later.
Incoming Prototype!
P
iaggio Group have recently Michele Colaninno, Chairman of PFF
presented GITA and KILO, the first says, To deeply understand people
projects developed by Piaggio Fast and their habits to meet their needs,
Forward (PFF), a company established this is the course that led us to create
and controlled by the Piaggio Group to be GITA. We understood that we have to
an advanced American research centre create products in line with the needs
for future mobility. The Group explores of tomorrows humans, and we will do it
the evolution of mobility and does so through humanity. The success story is
thinking about the future, expanding its made up of PFF people and teams, who
vision to include a much broader range of confirm it. They are young, enthusiastic,
technological solutions compared to its with no fear of challenges, a melting pot
current core business. of cultures and professionalism that have
created a perfect merging of robotics,
GITA is an autonomous vehicle, designed engineering, and design.
to assist people. It carries up to 18kg
and has the ability to observe and Roberto Colaninno, Chairman and CEO
communicate. It can follow a person of the Piaggio Group adds, The Piaggio
reaching up to 35km/hr, and knows how Group, through the creation of PFF, looks
to move independently in a mapped again to the future, to young people, to
environment. The spherical shape and the future generations, and doesnt want
clean design characterise its personality. to merely be ready to face the challenges
of this increasingly complex mobility
KILO is the big brother of GITA, and scenario, but wants to be leading agent
thanks to a larger capacity it can of this change. Innovation, research and
transport up to 100kg in its 120L curiosity are the basis of this project and
compartment. It has extraordinary are its main drivers."
stability thanks to its three wheels.
Spotlight on:
pcDuino3
A Microcomputer
with Potential
W
e have known about the
pcDuino3 since 2015,
when Jaycar first started
carrying them. Back then, they were full-featured but LEFT
pcDuino3 connected
a little on the expensive side. However, theyve just had a massive
to the 7" touch screen.
price drop, which makes them far more accessible, so we wanted to
take a closer look at this comprehensive piece of hardware.
XBMC, to make an ultra lightweight (yet high definition / digital audio
A few things stand out about this board, which gets us excited. delivering) media centre. The onboard SATA controller definitely
Firstly, even though it uses the duino namesake, its far from provides useful access to larger storage options, which is good
a standard Arduino. Using a 1GHz ARM dual core processor and considering that even the largest MicroSD fills up rather quickly when
onboard video processor, its a lightweight computer with GPIO trying to watch movies!
hardware. It features onboard WiFi and gigabit ethernet to get
connected, onboard digital audio, and loads more. One thing we found with the pcDuino was part of the voltage
converter module covers the SATA port. If youre using the pcDuino
You can run the Arduino IDE directly on the pcDuino to develop, mostly for software, youll probably never encounter this issue.
compile, and run sketches all on the one machine. Although its Stackable headers may help, but increase the overall size required for
probably important to mention you cant load sketches onto everything. Many modules are compatible with 3.3V or 5V, so you may
a pcDuino the same way you would on something like an UNO not need the voltage translator and can ignore this point entirely.
(although it is possible to configure a sketch so it runs automatically
after booting, in a more traditional Arduino way). Its better to All in all, the pcDuino3 is a powerful unit and provides a solid platform
consider pcDuino as a small computer with the ability to code and to work from. Here at DIYODE HQ, well soon retire an old machine
deploy sketches right there on the hardware. Its fully compatible that basically just runs Spotify in our office, so perhaps well initiate a
with C and Python, so if youre used to Raspberry Pi or Arduino pcDuino with XBMC in its place. Well be sure to share our results.
development, youll most likely feel equally as comfortable.
In the meantime, you can take advantage of the huge price reduction
It certainly does share its GPIO pinout with an Arduino UNO, making on pcDuino products at Jaycar Electronics.
it great for using existing Arduino compatible shields; however, due
to pcDuinos 3.3V logic level, you may require the voltage converter
Shopping List:
module to translate the entire GPIO to 5V logic (more on this later).
www.bosch-ebike.com.au
Pi Booth
Capturing the
Moment with
Raspberry Pi
JACK BARKER
Business Analyst and Electronics Enthusiast.
www.jackbarker.com.au
@jackbarker
P
hoto booths are hugely popular, and
we here at DIYODE have been to our
fair share of events where weve
added bunny ears and chefs hats to create
a few minutes of laughs, but a lifetime of
memories. However, when Jack was quoted
$500+ to hire a photo booth for use at his
wedding reception, like all good hobbyists
facing a higher-than-expected cost for
something, Jacks creative wheels started
turning. He decided hed come up with a tidy
solution to make it happen for less.
GP10 - 21
GP10 - Ground Arcade Button LED LED Strip
(With Built-in Resistor) (With Built-in Resistor)
Raspberry Pi
Camera V2
LCD Display
I had nothing to lose really, since if it didnt work out I could just pay
to hire a photo booth! But it turned out to be quite easy to do, and
its definitely something I would recommend for others to attempt. I
started with a really simple Python script, which takes less than 100
lines of code (you can download it from the resources too). It is set up
to react to the go button and delay timing of the photo, so everyone
can get ready. Then it snaps the photo and saves the image to the SD
card. It gives people clear indications as to whats going on.
Even then, it still only comes in at around really. Its so simple that even kids basically
250 lines of code, and for using such minimal knew what to do, without even being able to
code Im very happy with the functionality. I read the screens. But the two work together
could have gone further with the code, but to make sure nobody needs any help.
in the midst of planning the wedding, work
commitments, and everything else, it was What was the most difficult part of the
working great for what it was designed for. hardware construction?
The instructional graphics [2] are definitely a Getting the screen mounted with a nice
nice touch. No wonder everyone responded rectangular cut was a challenge. But I
so well. Some photo booths provide a used the screen itself as a template, and
real-time print. Were you printing them? just carefully cut it out. The result was a
fairly neat fit. The box itself was reasonably
Actually, because the photos were being straight forward. You could really make it any
written to an SD card, after the wedding size and shape you like, paint it, whatever
I posted them to a live microsite that our you want. I just used some plywood, but you
guests could go and visit. This meant I didnt could make it out of anything, really. The Ready for action! The completed Pi Booth,
have to worry about a printer, and also our hardware inside is quite small, so you could set up and ready to snap the day away.
family and friends could see each others probably mount it into a large plastic case
funny photos, while they were looking for too but I think having a reasonably large
their own. box helps people notice that its there. When
you want people to use it, you dont want
"I had nothing to lose something that fades into the background.
... if it didnt work out Can you describe your guests reactions?
So everything went to plan, and youre now the proud owner of a POWER: I had to provide 5V power for the Raspberry Pi and the
homemade photo booth! What [if anything] would you change next screen, but 12V power for the LED pushbutton and the lighting in the
time around? top. To get it all working, I simply used a powerboard, but I had three
mains adaptors plugged in there. If I wanted to make it more robust,
TIMESTAMPS: Time was something of an issue. You need to boot the I would use a 5+12V dual rail power supply, then hardwire everything
Raspberry Pi either connected to the internet, or with a Real Time in. This isnt really a requirement, but its something that I thought
Clock (RTC) module installed. My timestamps were consistent (since about doing.
the Pi was on the entire time), but it wasnt accurate to real time. We
had two locations we used the booth at, and when we restarted it at These are definitely all minor points, and standard add-ons
the reception, the clock reset too. It didnt take me long to sort them identifiable only after a real-world trial. We can even envisage audio
out on the computer afterwards, but having RTC would solve this queues a few pre-recorded MP3 files and a loudspeaker to keep
problem entirely. them on-track could be a fun thing to experiment with too. It sounds
like it was a huge success overall! Is there anything else youd like to
LIGHTING: I also think the photos themselves would have benefited mention?
from more light. The light strip I put in was good, but more light, and
perhaps mounted externally would have been better; a little more like Overall I am still exceptionally happy (and importantly, my wife Pam
what the professional photo studios do, I suppose. We used the booth is too) with the results. The previous notes are just version two
at an outdoor location (after the ceremony) and an indoor location (at ideas for if I have to call upon the almighty booth again in the future.
the reception), and the photos that were taken with some daylight Raspberry Pi proved to be very versatile and a simple platform to get
are definitely clearer. The indoor photos were still great, after a little started with, and achieve a working prototype in very little time.
photoshop work fixed up the brightness, but some additional lighting
would definitely have made them even better. GOT SOMETHING TO SAY?
Discuss this feature, download the code, or leave your comments at:
MORE ELEGANT HARDWARE: The Raspberry Pi itself proved to be very https://diyode.io/001nzvr
well-suited to this project, but I would upgrade some of the hardware
so its not quite so crude. It works, and it works very well. However,
some things like power on/off switch, reset button for the Pi, and a
few other controls could develop this idea into a very elegant and fully
featured photo booth. At the moment without unscrewing the case,
its basically unplug/plug in to turn it all on and off.
RIGHT
The completed Pi Booth.
BELOW
Photo from Jack's Pi Booth
at his wedding to Pam.
T
he 555 timer IC is an essential tool in the resource kit of any ratio of 'on' time to 'off' time is referred to as the duty cycle, often
hobbyist, and indeed, of many designers and engineers. It is expressed as a percentage of 'on' time to the whole cycle time. For
versatile, stable, cheap, and has a reasonable operating voltage a duty cycle of 90%, the output is on, or high for 90% of the cycle,
range. As such, it is presented here as an astable multivibrator with a and off or low for 10%. At a frequency of 100Hz, the full cycle takes
Pulse Width Modulated (PWM) output. It is intended that this output around 0.01 seconds, with an on time of 0.009 seconds and an off
could be used to control the speed of a motor, or the brightness of a time of 0.001 seconds.
light; it could even control a heater element. This circuit will power a
load that only requires very low current, less than 200mA, such as an Integrated circuits (ICs) are often drawn as a rectangle with each pin
LED. Following this article, there is a page titled "Step it up" that will function labelled, and if you're lucky the pin numbers as well. Bread-
provide you with two circuits to increase the load capacity. boarding a circuit also requires the correct pins to be connected.
Therefore, a pin-out of any IC you will be using is important to have
THE 555 when experimenting with electronics. Our circuit diagram on the next
page shows the pinout in correct order. From the top left, moving
The 555 can be run in either monostable or astable modes. In anticlockwise, pin 1 is the ground pin, pin 2 is the trigger, pin 3 is
monostable, the device takes its trigger from an external source, the output, pin 4 is the reset, pin 5 the control voltage, pin 6 the
performs a timer operation, and then resets to await further input. threshold, pin 7 the discharge and pin 8 is the supply voltage. A more
In astable mode, the circuit around the IC provides the trigger, so detailed description of each pin and what it does will be provided in
that the device continually performs its timer operation. This circuit future articles. For now, a working, versatile circuit is the aim - we'll
is designed to do this around 100 times per second (100Hz). The cover some topics in greater depth another time.
+ - + -
+12V D1
1N4148
R2
1k 1 Gnd Vcc 8
VR1
100k 2 Trig Dis 7
IC1
555
D2
1N4148
3 Out Thr 6
R1
120 4 Rst Ctl 5
OUT
220
C1 C2 C3
100nF 100nF 100nF
+ - + -
OV
BUILDING THE CIRCUIT 100nF capacitor discharges through the 1k resistor, the other half
of the variable resistor and the other diode, until it reaches 1/3 supply
Building this circuit in its simplest form is quite straight forward. voltage (4V). Now the internal flip flop connected to the threshold pin
You only need a 555 timer, a few diodes (a DIYODE helps too), switches the ouput back to high, and the process repeats.
a potentiometer, as well as a few resistors and capacitors. We
have illustrated a very simple breadboard-based diagram that you The relationship between the portion of the variable resistor involved
can follow to build your own, or view our additional step-by-step in the charge current path and the portion in the discharge path, are
instructions online. what control the duty cycle of the output. The 1k resistor gives a
minimum value. If the potentiometer (the name for a variable resistor
PARTS REQUIRED: JAYCAR ALTRONICS connected with all three pins as a voltage divider) is set to 0, the
1 x 555 Timer IC ZL-3555 Z2755 charging current path is only the 1k resistor, while the discharge
2 x 1N4148 Diodes ZR-1100 Z0101 path has the 1k of the resistor plus 100k from the potentiometer.
3 x 100nF Capacitors RG-5125 R2736B This gives the longest off time, or the lowest duty cycle. As the
1 x 100k Potentiometer RP-7518 R2207 potentiometer is turned up, this ratio changes, and the duty cycle
1 x 120 Resistor RR-0550 R7035 with it. A maximum of 95% and a minimum of 5% is possible with this
1 x 1k Resistor RR-0572 R7046 circuit. Providing your circuit is working properly, you should be able
1 x 220 Resistor (for LED) RR-0556 R7542 to rotate the potentiometer and your LED will brighten and dim.
1 x 5mm LED ZD-0150 Z0800
DRIVING LOADS
THE CIRCUIT
As presented, the circuit has no substantial output device. The
The circuit here is set up to run from 12V. The 555 will work from 555 can source or sink (supply or pass to ground) around 200mA,
5 to 15 volts, and you can run this circuit from a 9V battery (your which is enough to drive some loads such as an LED; however, most
LED will not be as bright). When the circuit is first powered up, the loads will require an output circuit. With the prevalence of modules
output from pin 3 is high. Current flows from the output via a 120 designed for microcontroller interface, motor or light controllers
resistor to whatever device you are driving. It also flows via one of accepting a PWM signal are easy to access. Most work with an
the diodes, part of the variable resistor, a 1k resistor, and arrives independent load supply, eliminating contamination of the IC power
at the trigger pin. The trigger is linked to the threshold pin, and to supply with voltage spikes. Alternatively, an NPN transistor or
a 100nF capacitor tied to ground. As this capacitor charges via the N-channel MOSFET can be used for driving higher current loads which
variable resistor/resistor network from the output, the voltage at pin are described on the next page. These are very basic and additional
6 (threshold) rises. When it reaches 2/3 the supply voltage (8V in components would assist filtering, back-emf protection, or isolation,
this case), the internal flip flop switches the output to low. Now the however this is beyond the scope of this article.
TRANSISTOR
-
12V 220 resistor, then
1 x TIP31 NPN Transistor ZT-2285 Z1134 TIP31 insert the transistor,
DIMMABLE
LOAD link, and wire the
1 x 12V Dimmable Load
dimmable light as
(such as 12V Light Globe) SL-2675 S4047 +12V 0V shown.
MOSFET
8995
1024 x 600 resolution
$
167(L) x 107(W) x 10(D)mm 1024 X 600px
XC-4356 WAS $149 INTERACTIVE
For more details visit jaycar.com.au/pcduino
39% OFF! SCREEN
PERFECT FOR
ARDUINO NOOBIES
An all-in-one kit perfect for beginners!
Looking to get into Arduino but dont quite know where to start?
We have specially selected the components in this kit to allow an easy
entry into the world of Arduino. The kit is supplied with a UNO Arduino
WATCH THE VIDEO:
compatible board, breadboard and an extensive range of components
jaycar.com.au/arduino-learning
to make hundreds of projects. Includes user manual to get you started
and links to online resources and included examples. XC-3900
Visit jaycar.com.au/arduino-learning to find out more.
4
$ 50 $
12 95 $
19 95 5 ea
$ 95
STORING
RENEWABLE ENERGY
Were all well aware of the limitations of renewable energy,
especially at a home-installation level. Government initiatives and
persuasive marketing has seen Australia claim one of the highest
per household uptakes of solar panel installation. This means were
generating massive amounts of solar electricity through the day, but
relying on a traditional power grid at night. by Rob Bell
The one thing we dont really talk about Electrical energy doesnt have to remain as
is the way many installations have been electricity. Its all energy and we can convert
setup. Essentially, they feed excess power energy from one type to another. In any energy
into the electricity grid during the day (at a conversion there is always an overhead; that is,
continuously reducing rate) and draw energy energy is lost during the conversion. Even when
back from the grid at night (at standard retail electricity is stored in a battery, energy is lost in
rates). This is terribly inefficient and has the conversion to chemical energy and back to
a major Achilles heel because if the main electric energy.
electricity grid fails at night (or in extremely
poor weather), your renewable energy isnt There is a growing number of experiments
likely to help you. (and indeed, viable commercial installations)
testing different ways to store this energy.
With grid power prices ever-increasing and
the feed-in tariffs falling closer and closer GRAVITATIONAL POTENTIAL
to zero, it makes financial sense to look for AS STORAGE
alternatives. Beyond the issue of dollars
though, if we can create a localised power One idea that seems interesting at a DIY
storage method for our own solar power, level is converting excess energy into some
we could remain totally self-sufficient even sort of gravitational potential energy, energy
if the main grid goes offline. Of course, this contained in a mass at an altitude. By lifting
also means you could operate from your an object we add height and therefore GPE.
renewable energy anytime even when the When the object is allowed to fall, gravity
sun isnt shining and the wind isnt blowing. potential is converted into electricity. By
using electrical energy to raise the mass,
COMMERCIAL OPTIONS and then generating electricity using the
change in height of the mass, electricity can
Solutions such as a 14kWh Tesla Powerwall be stored for use when solar/wind generation
2 are making vast inroads to allowing us is offline. This provokes a very interesting
to store and use our captured solar power. idea. What if we could create a mechanism
Storing electricity in what is effectively a to utilise gravitational potential for our energy
giant battery makes a lot of logical sense. storage?
MOONSHOTS
Water Storage
Pumped hydro storage has been used in the power industry around The result? Were using gravity the same way a hydroelectric dam
the world (e.g. Wivenhoe Dam, QLD), but what if the householder does. The biggest difference here, however, is that were not using
could use renewable energy to pump water into a raised tank? You weather to send the water to the top tank were using a pump; of
have a large water tank down low and another up quite high. During course, the volume of water being moved is quite a bit less too! The
the day, the water is pumped from the lower tank to the higher tank. height between the two tanks and the volume of water being stored
At night, gravity forces the water in the high tank to flow back to the would determine generation capacity. To store 1kWh of electricity,
low tank. We can utilise that energy to drive a turbine (depending on the pump would need to raise 1000L of water 367m, or 100 tonnes
the pump, it could be used in reverse as a generator too). of water 3.67m... assuming perfect efficiency. With those numbers in
mind, we have to consider if it's even a real-world solution.
THE PRACTICALITY
1000
BUTTON
REMOTE
CONTROL
Heres how you can turn your smartphone into a
ASSUMED KNOWLEDGE: network-connected remote control, so you can
I
This project uses principles from the Arduino Web Server
project in this issue. You dont necessarily need to go through nfrared (IR) remote controls are taken for granted. They provide a
that project first, but it provides a more detailed understanding reasonably complex function, often to simply remove the need for
of how to create a web server with Arduino. If youre having us to get off the couch to change a channel! But IR remotes have
any difficulty with this project, or would simply like to learn limitations; they require line of sight between the remote and the
more about how it works, the web server article provides very receiver, and they tend to have a limited range, which is generally
insightful reading, in addition to creating a working web server. a 7m maximum. This project removes this limitation and expands
functionality to the coverage of local WiFi ethernet network, or
wherever you have internet access.
IR Repeater
Receiver IR
THE BROAD OVERVIEW The web server is configured to receive two types of requests (you
need to replace the IP address with the one used by your Arduino, see
Effectively there are two major parts to this project: the HTML our notes elsewhere in this article):
package, and the Arduino web server. With the web server running,
the HTML package forms the requests to send to the server. Its done LEARN A CODE:
using AJAX. We wont go into AJAX here as it will derail our focus to
a degree, but it allows us to send and receive data with a web server,
127.0.0.1/?learn=001
without having to refresh the web page itself.
THE BUILD This project requires a local network with WiFi and ethernet
connectivity, which we wouldn't assume is uncommon amongst
PARTS REQUIRED: JAYCAR ALTRONICS DIYODE readers. While the Arduino MEGA uses the ethernet shield to
1 x Arduino Mega XC-4420 Z6281 connect, your smartphone will connect via WiFi. You can still test the
1 x Ethernet / SD Shield XC-4412 Z6242 prototype using your computer (ethernet or WiFi), but you won't have
1 x IR Receiver XC-4427 Z6374 the same level of portability.
1 x IR Transmitter XC-4426 Z0880
1 x Red LED ZD-0150 Z0800 BUILDING THE CIRCUIT
1 x Green LED ZD-0170 Z0801
2 x 220 Resistors RR-0556 R7038 This project uses an Arduino Mega, an ethernet shield, an IR receiver
1 x MicroSD Card XC-4998 D0327 module, and an IR Transmitter module. We have also used two LEDs
to help provide feedback when not connected to a computer, but
Youll also need prototyping hardware such as a breadboard and these can be omitted if you prefer (youll just have no feedback
jumper wires. mechanism to tell you if it hasnt booted correctly, when not
connected to your computer). Assembly should only take you a few
minutes using a breadboard, following the illustration below.
IP Addresses
-
+
+
We are specifying an IP address in our code. If this doesnt
work on your network, or if youre happy to let the router take
care of address assignment, its quite easy to modify. Around
line 60 of the sketch, we initialise the ethernet module. Find
this code:
Ethernet.begin(mac, ip);
-
-
+
+
Modify by removing the IP specification. Youll end up with:
Ethernet.begin(mac);
2. DHCP assignments can change from time to time, and this Go to diyode.io/001mttc and load the HTML package on your phone
is called lease renewal. Therefore the IP address may (or open it up on your computer in your favourite web browser it will
change when this renewal occurs and youll have to find out work in any modern browser). It has been configured to allow offline
what its changed to, which is a bit of a pain. You can tell access, so you can Add to Home Screen on most phones, and you
your router to issue the same address all the time and still effectively have app-like access, without the hassle.
reliably use DHCP, but this process is beyond the scope of
this article.
THE CODE
writeIR (decode_results * results, int keyCode)
The code used for this project is reasonably simple. The heavy lifting
is done through built-in libraries in Arduino. SPI, ethernet, SD and
IRremote. The first three are included with the standard install of the writeIR takes the raw IR results object as well as an integer, which
IDE, whilst you will have to add the IRremote library (see resources). is the specific key received from the AJAX command in the learning
phase. This function builds a filename from the keyCode number, and
The setup code starts by loading these libraries. We then go on to set then writes the IR raw data sequence to the file.
up our LED constants, our SD file object, IR variables and the ethernet
settings. You should update the MAC address variable to whatever
getIRCode(int keyCode)
the MAC address is on your ethernet shield; however, not all units
have this printed on them. The MAC address given in the code should
suffice for the vast majority of users, but if you fail to get the server to
respond and give an IP in the serial monitor on boot this could be in This is the function called when you press a button in the learn
conflict. mode. It takes the keyCode argument, which is the number defined
on the button you pressed in the HTML code. The green LED will
Next is the IP address. We have included two addresses common switch on and if you have the serial monitor open you will see the
in home networks, but I would advise finding out what your local output Awaiting IR input. The unit will wait forever until it gets a
network is using (see our note on IP addresses on previous page). code or you restart it. Once it has a code it opens a file for writing. It
then writes the sequence of the raw IR data before closing the file.
The final part of initialisation is char linebuf[80]; and
int charcount = 0; these are used by the ethernet server, and will hold
sendIRCode(int keyCode)
a CHAR array received from the AJAX call from the HTML app.
SETUP
The sendIRCode takes the keyCode integer based upon the key press
The first few lines here are just to blink the LEDs, so theyll quickly in the playback mode. It uses this number to open the correct file
flash once and then turn on until the end of the setup sequence. from the SD card and builds a new array with this data. Once the array
Once they are no longer switched on, the unit is ready to go. Lines is complete the function uses the IRsend object to send the data by
51 through 63 are required to set up and prepare the ethernet creating a waveform using Pulse Width Modulation (PWM) on pin 9.
shield, while using the built-in SD card. This could be considered
supplementary and the unit will most likely work without it; however,
loop()
during the development we often had weird errors with reading and
writing to the SD card, which was resolved with the introduction of
this code.
In this case, the main loop really only serves one function: to listen
The final part of the setup sees the ethernet webserver started, the for the AJAX call. The first half of this code is to listen to the incoming
server IP address sent to the serial monitor, and the LEDs pulled low port, then once we have a connection and get the data received,
to indicate the unit is operating as normal. it is put into the linebuf CHAR array. Once we have the array, we
look for a couple of things. Firstly is the AJAX call for playback of
After this we have a series of functions used to interact with the IR a code or do we need to learn? If its playback, then we get the
transmitter (Tx) and IR Receiver (Rx). playback file number out of the array. This is extracted as a 3-byte
array. Once in place, it is converted to an integer before it is passed
to the sendIRcode() function as the keyCode. If the AJAX call is for
dumpRaw (decode_results * results)
the learning mode, then the process is the same, it just calls the
getIRCode function, which calls the writeIR, and finally the dumpRaw
to show you the content of the code.
This function is used during the learning phase of the program. Its
only argument is the results object produced when the IR input is Finally, the loop checks that all the data has been processed before
received. The function then reads this array of raw timing data, and closing off the connection and waiting for the next one. The code
displays the sequence as well as the buffer size. This is sent to the itself is quite quick to process, with the SD card read being the
serial monitor and it is used to make sure your signal being received slowest part. If you wanted to kill any lag in the system get a class 10
is consistent. or better SD card, and comment out all of the Serial.println() calls.
LEARNING CODES 3
For this stage youll need to have the working web server within reach
and connected to ethernet. Open the HTML package in your web
browser. This can be done on your phone or computer. The phone /
computer will have to be on your local network too (WiFi or ethernet
doesnt matter). You can do this simply by loading diyode.io/001mttc.
The code uses your local network to talk to the Arduino, even though
its loaded via our site.
3. Click / tap on the ON/OFF button. Youll be prompted by an on-
screen dialog [3]. Point your remote control at the Mega and push
the power button on the remote. Once the code has been received,
the dialog box will confirm and disappear.
1
5. If you click / tap on the power button now [5], it should turn on/
off whatever device that belongs to the remote you just used (of
course, that device needs to be within range of the Arduino too).
1. Enter the IP address [1] you saw in serial monitor when loading the If nothing happened, repeat steps 2 to 5 again. The range of the IR
sketch onto the hardware. transmitter is affected by sunlight and can effectively be "drowned
out". Make sure you're nice and close to the device you're trying to
learn, and this is best done indoors.
2
Now your system is ready for you to teach it all the infrared codes you
want it to store. Its simply a matter of entering learn mode again,
and looping through steps 2 to 5 with each button you want to train.
2. Toggle the playback button to learn [2]. Youre now ready to Note: You don't have to toggle the learn/playback button after each
start teaching IR codes to your Arduino, so get your favourite TV learning sequence, unless you want to test each code along the way.
remote control, or whatever IR remote you want to learn, ready. Once you have learnt all of your codes, toggle the "LEARN" button
back to "PLAYBACK" and you're ready to go.
EXPANDING THE HTML We have made it VERY easy to add new buttons, since our Arduino
sketch is designed to dynamically handle the requests, so you dont
We have made the web server code intelligent enough that you have to recompile the Arduino every time you want to add a button.
shouldnt have to modify it again, in order to further customise the There are only two parts to the virtual buttons.
remote control. You simply need to open up the HTML file and add
more buttons! You can simply open the HTML file in a text editor,
data-id=100
and also in your favourite web browser. You can then preview
your changes right in the web browser as you edit. However it is
recommended that you use a proper web server process (built in to
most operating systems now at a basic level) to ensure everything The first part is the data-id. This can be any three digit number, so
works as intented. It will also be required in order to get the web long as its unique. If you have duplicated a data-id between buttons,
app back onto your phone. then theyll both use the same code (whichever one you trained last),
despite possibly having different names. You shouldnt need to modify
Download the HTML package from diyode.io/001mttc. Once you the buttons data-id attribute unless you find you have duplicated one.
have unzipped the file provided, youll see an index.html file, as well
as css / js folders. If youre familiar with HTML coding, you probably
VOL +
dont need any explanation in order to modify and get the code
working. If youre not too familiar, well give you a breakdown below
to get started.
The second part is the display portion. We have just used text, but
Note: You shouldnt use rich text editors such as Microsoft Word to you could modify further to use images - the possibilities truly are
edit HTML. They use hidden code to retain styling information and endless. This part is for display only, and the Arduino isnt made
other data. Some suggestions are Notepad++ on Windows, Atom on aware of it, so you can call it literally whatever you want.
Mac, and if you're using Linux you're probably already sorted.
ADDING A BUTTON
MODIFYING A BUTTON
To add a button, simply duplicate a <button> code (grab the entire
We have provided what is essentially a demo set of buttons. Power line, copy + paste). Say you wanted to add a new button below the
on/off, volume up/down, and channel up/down. Chances are these VOL - button, locate it in the code (around line 40):
arent going to cover all of your needs, and theyre not really designed
to. So heres how you modify a button. Open up the index.html file in
<button data-id="102">VOL +</button>
a text editor.
<button data-id="103">VOL -</button>
</div>
There are 52-lines of code in the HTML file, but you really only need to
be concerned with around 10 of them.
Duplicate the VOL - line, then modify the new line with a uniqe data-
<div class="buttons">
id, and the name you want to give it.
<button data-id="101" class="power full">
ON/OFF</button>
<div class="pull-left"> <button data-id="102">VOL +</button>
<button data-id="102">VOL +</button> <button data-id="103">VOL -</button>
<button data-id="103">VOL -</button> <button data-id="106">NEW BUTTON</button>
</div> </div>
<div class="pull-right">
<button data-id="104">CH +</button>
<button data-id="105">CH -</button>
As you can see weve used data-id of 106, because data-id 104/105
</div>
were used already for the CH +/- buttons, and they must be unique
</div>
so the Arduino can appropriately store the data (otherwise it will
overwrite the code on the previous button when you try and learn the
new infrared code).
This is where the functional display portion of the web interface
happens. The code is styled and managed via CSS and JavaScript, If you refresh the HTML page on your phone or browser, you should
but you shouldnt need to look at those unless youre looking to make see your new button appear. You can then proceed to train the
significant modifications to the code. Arduino the infrared code for that button.
An Important Principle
about everything. It would even be feasible to stack codes together,
detect when a button is continually pressed, and other item's on our
"where to" list below.
As web technology keeps evolving, web pages can behave
GETTING UPDATED CODE BACK ON YOUR PHONE more and more like complex software. No longer do you need
to "refresh" to see updates or retrieve new content.
You really need to have a web server process running on your
computer (or access to an actual web server) to get the code back on This IoT remote demonstrates just the beginning of what's
your phone. This process isnt really covered here, as its somewhat possible when using a web browser to perform display
out of scope for this article, and is very dependent on your operating operations with a simple server. Using Arduino to provide
system or resources available. Once uploaded, you simply need to hardware expansion, the possibilities are endless.
visit the URL to access the new files (eg, 127.0.0.1/ircode/index.
html) and if you wish, bookmark / save to home screen to provide you We could output the HTML page and all its related content
with one-button access to your IoT remote control. directly from the Arduino web server. However the more
complicated the HTML, the slower the response will be.
WHERE TO FROM HERE?
Complex HTML could also quickly overload an Arduino. By
This project works very well but there are several improvements that utilising the power of the web browser on the display device
could be made to further increase functionality: (smartphone or computer etc), you keep the data flow between
devices smaller, the memory requirements for the Arduino
WiFi: Adapting the project for WiFi would (rather obviously) remove lower, and everything less prone to errors.
the need for wired ethernet. Our main reason for using ethernet in
this project was to use the included SD interface. This principle can be drastically expanded. Consider for a
moment, a virtual vehicle dashboard. You can update in almost
MULTI-CODE LEARNING: We could configure the system to allow real time, temperature sensors, motion sensors, and more.
learning of more than one IR command, assigned to a single button.
This would effectively create smart buttons which, with a single Feeding all this data and driving a display right on the Arduino
press, will transmit several codes. A single button for switch the is not going to be reliable. If you serve a JSON, XML, or other
receiver to Blu-ray, turn the volume up, and change to HDMI 2 on the "raw data" stream from the Arduino, you can let the web
flat screen. browser do the processing.
When Tech
Meets Art
High-Speed Water Valve
& Camera Controller
As youve been looking through this issue of DIYODE,
its probably no surprise were big fans of creative
photography. But we found something really unique,
and it was prototyped on Arduino!
I
nitially, we came across this amazing high speed timing system
through a local photographer, Craig Kenyon, who had been winning
awards for his stunning droplet photography. Craig built a great
system to develop his style and the resulting photos were what
caught our eye. When we contacted Craig, thinking he was the one
who built the controller, to our surprise he referred us to Peter Lin,
who developed the base controller and valve system that Craig was
using. We caught up with the two of them: with Peter, to chat about
the design and development of the controller itself and then Craig, to
explore the end-user experience.
ABOVE
A section of "The Rose" by Craig Kenyon.
ABOVE RIGHT
The 6-valve controller in it's final production state.
Developing
the System...
PETER LIN
Designer and manufacturer of the
High-Speed Water Valve & Camera Controller.
www.mjkzz.com
There were some groups on Flickr where a lot of people were playing
with water drop photography. I designed a simple circuit back in
2006, but it was just a simple circuit; a bit better than manual drop
operation, where you use an eye dropper to drop water and then
manually trigger the camera. It was hard to use, though better than
manual drop (as my current circuit detects a laser beam and has
timing delays).
There was another water drop machine, which I think is called Time
Machine, but it was out of my budget so I didnt buy it. After I moved
back to China, I found making PCBs really easy and cheap, so I
decided to design one for myself. I actually went on Kickstarter and
got that project funded. Later, I designed a better, more powerful one.
The best feature of my water drop machines is the use of a remote
control. With most other machines, the user has to physically touch
the controller and push buttons; however mine uses a small IR remote
control that acts like a keyboard, making it very easy.
ABOVE
An earlier version of the 6-valve controller.
LEFT
Ready for action!
ABOVE
Water doesn't just have to drop.
Here they're rigged for gravity-
defying operation.
What is it:
I/O Explained Very true - thats extremely fast for relatively simple functions.
I/O refers to input/output. Any Have you considered any other applications for your precision timing
data terminal on an Arduino board, circuit?
Raspberry Pi, or anything that can be
used to transmit or receive data (one No, but if there is a need, the code bases I have built will be handy.
way or another), is referred to as I/O.
I/O signals can be digital (on/off) or Whats the most fun or impressive thing you have seen someone do
analogue (anywhere in between), as with one of your kits?
well as advanced options such as
Pulse Width Modulation (PWM) and I am very happy to see a lot of users creating amazing photographs,
serial (loads of data streaming through winning awards and the like. Craig is one such user.
the one connection).
Yes! We were hugely impressed with how Craigs used your
These signals can be read by controller to create award-winning artwork (more on this later). The
the device (some other hardware remote control is a great feature, and presumably eliminates the
providing a value to be read), or set need for onboard controls. Were there any challenges developing an
to a desired output (with some other intuitive infrared-controlled interface?
device using the output to perform a
function of some sort). The remote control is not hard to decode. I didnt even use any tools
like a logic analyser or oscilliscope to decode it. I just used Arduino to
I/O is a little like railway tracks. There decode the time and that was it. Having the IR remote eliminates a lot
should only ever be as many trains, as of physical buttons and I can use less of an MCU (memory controller
there are different train lines. Trains unit). It greatly reduced circuitry and simplified the design. The MCU
can go either way, and you can have only needs one pin, compared to other designs that use an onboard
trains following each other down the hardware control interface, which may require up to 10 pins.
line, but you can't have two trains on
the same part of the track. I/O is definitely the limitation on many developments, so infrared
control was definitely the way to go! We can see theres some
Perhaps the most powerful solution to other creative products in your range. Is there anything currently in
this problem is serial communication. development that you can share with us?
It's like multiple trains following each
other on one track. You're using Yeah, I just finished some circuits that will use a speaker to move
one I/O port to transmit or receive a things at micro level.
sequence of data.
Wow! Even more interesting ways to create stunning images! We
cant wait to see what you do with it, Peter!
LEFT
"Mexican Clown" by Craig Kenyon.
The System
in Use...
CRAIG KENYON
Photographer.
www.craigkenyon.com.au
@craigkenyon.com.au
Thanks for chatting to us, Craig. How long have you been a
photographer?
I have been a serious photographer for four years, and I have really
loved the journey it has taken me on. I have always had a love for art.
I never tried water drops manually, but I did do other types of high-
speed photography, such as dropping fruit into an aquarium and
freezing the motion with a flash. I started photographing water drops
using a different brand, so I was very pleased with my purchase of the
MJKZZ and its ease of use.
You built your own framework for your setup are we seeing version
1, or did it go through different upgrades?
My original frame was given to me, but at one stage I did modify it
to improve stability. Currently, Im dreaming up a new frame, which
includes sliding acrylic walls that can easily be cleaned.
Thats great info for those wanting to have a go. Your water drop
photography is so eye-catching. What official attention has it
received?
My first experience was from a single valve kit that was loaned to me.
After I figured out how to get collisions, I just had to get myself a kit.
I did a lot of research and stumbled across the MJKZZ Flickr group.
I loved the sound of this kit and the fact that it used the most highly
recommended valves, so I sold my Canon 7D and purchased the kit
the Kickstarter campaign had finished by this time.
What other tips can you share, for anyone looking to create art using
this technology?
If you want to get started in this art form, search for Corrie Whites
eBook about liquid art. This book is great and I highly recommend
it to any newcomer. I also recommend watching slow motion videos
of water drop collisions on YouTube, as it helps unveil the mystery
behind the formations. Lastly, remember that patience is a virtue.
NEW!
T 2282
$ 13.95
$ 69.95 NEW!
The Pocket Hero is here!
79.95
T 2163 This nifty 12 in 1 pocket sized saviour helps you fix lifes
$ little problems then folds up to the size of a pack of
gum! Includes belt pouch.
Electronics Starter Tool Kit
Raspberry Pi 3 Model B Z 6302B A jam packed 20 piece starter kit including soldering iron,
The latest generation single board computer is here - and more powerful than ever multimeter, solder sucker, wire stripper, cutters, pliers and
before! Compared to the Pi 2 the Pi 3 has an improved 1.2GHz 64-bit quad-core more! Ideal for beginners & enthusiasts.
ARMv8 CPU, 802.11n Wireless LAN, Bluetooth 4.1 and Bluetooth Low Energy (BLE).
And to make things easy, the board layout is identical to the previous model! T 4015
$13.65 NEW!
$ 12
NEW!
$ 12 Z 6307
Never lose a tiny screw again!
This magnetic workmat keeps those tiny screws and washers ProtoHAT for Raspberry Pi
K 9620 A HAT board with soldermasked 0.1 holes and stack-
in place when servicing. 25x20cm. Includes marker.
able header so you dont lose access to the GPIO pins.
Slots included for display & camera cables.
Pi sold separately.
Raspberry Pi
Starter Platform Kit NEW!
A handy starter kit for educators or Pi newbies.
Includes a Raspberry Pi board, red acrylic base, 5V
3A power supply, GPIO breakout & breadboard.
$ 125 Z 6550
$48
$ 40 $ 23.75
Arduino Expansion Shield for R-Pi Z 6515
Mash the two worlds of Arduino and Raspberry Pi together
using this handy expansion shield with onboard atmega32u4
Raspberry Pi Prototyping HAT
Provides easy screw terminal connection for GPIO pins,
and X-bee slot.
plus a solder pad prototyping area.
T 1090 0.5mm
H 8190
T 1100 0.8mm NEW!
T 1110 1.0mm
T 1122 1.6mm $ 27.45
NEW! $ 15 .95 Z 6530
$19.95
bracket! VESA 75 & 100mm compatible. such as tablets, infotainment systems Quality Resin Core Solder
An ultra compact atmega32U4 FTDI USB Lead
Includes cable ties & holes to secure leads. board with USB on board for A simple way to connect
and embedded projects. 800x480 Premium grade for leaded soldering. 200gm
Case sold separately, H 8957 $11.75. easy direct programming. TTL serial devices to USB inputs.
resolution. 10 finger capacitive touch. reels. 60% tin, 40% lead.
74.95
R&D etc. Japanese long life ceramic element. 200-480C. 0.8mm tip. 2 year warranty.
$ T 2120
SAVE
$50
$ 16 Q 1074A
Q 0205
Iroda Butane $79
4 Pack
Stock up the workbench
NEW! $ 315 $ 60
with this value pack of
quality double scrubbed
Designed for Amazingly compact handheld Autoranging True RMS
butane. Doesnt clog T 2749
your tools like the cheap
electronics use 10Mhz oscilloscope! Multimeter
$58 Velleman HPS140MK2. Dont let the size fool you, A high accuracy model for those requiring
stuff! T 2451
4 for
$44 this oscilloscope packs alot of features into a tiny
device. A must have for the serious enthusiast of
true RMS ac waveform measurement. Huge
feature list - check online for more info.
SAVE Relative function, backlit LCD, USB datalog-
28
technician on the go! Up to 8hr operation from 4 x
12% $ Tungsten 5 Side Cutters AAA batteries (S 4904 lithium $4.95 2pk). ging. Cat III 600V.
Ideal for cutting solid core steel, copper
& piano wire. HRC72 hardened jaws. DeOXIT D5
$47.95
$ 18.95 Spray
30hr run time! The gold standard
$ 38 in electronic
servicing sprays.
Deoxidises, cleans,
preserves contacts
NEW!
T 4021
X 0218 7
$ .95 & joins. Increases
conductivity for the
The Amazing BlockliteTM best performance
Bare Conductive Paint Pen from your equip-
ESD Safe Workbench Matting
A piercing bright LED torch thats
amazingly small and runs from
Draw real circuits on almost any surface! Great for
repairs or experimenting. 10ml tube.
ment! 142g. $ 39.50
An workbench essential! 1m x 0.5m with anti-static wrist strap. standard 9V battery (included). T 3132 T 3063
NEW!
K 9615
SAVE $50
$ 175
$14.95 $24.95
$115
$ 11 ATMega32U4
$ 15
Screen & Keyboard Shield
Z 6345
A 16x2 black character screen with green The lilypad form factor allows easy Arduino Display & Sensor DIY Kit SAVE $20
backlight. Push buttons are provided for building of sewable electronics and Includes a UNO compatible dev board, 16x2 LCD
e-textile projects. Can be used with Z 6298
up, down, left, right and select. Ideal for module, breadboard & an array of sensors for
scrolling and selecting menu options. Z 6368 LED sequins ($4.95 5pk). experimenting!
SparkFun Inventors Kit 3.2
The SparkFun Inventors Kit is a great way to get started with
Build your own programming and hardware interaction with the Arduino
pulse monitor programming language. It includes everything you need for 16
Z 6352
circuits that will teach you how to read sensors, display info on an
$21.95 LCD, drive motors, and more. No experience required!
$19.95 $24.95
12
$ 17
$ Z 6340
ATMega328P
$15
Z 6349 Heart Rate Monitor Sensor
Gamepad Controller Shield Lilypad Board Great for DIY eHealth projects. Uses an IR LED & optical
A joystick and button controller which plugs Great for moving UNO based designs transistor to detect pulse on the surface of the skin.
directly onto an Arduino UNO. 3V3/5V input. & code into e-textile projects. Can be 3-5V input. 15mm.
used with LED sequins ($4.95 5pk).
$24.95
$ 15
$7.95
Z 6343 Z 6355
$ 6 Arduino UNO R3
Z 6280 $ 43.95
L298 H-Bridge Motor Shield Breadboard Power Board Official UNO R3 board featuring the immensely popular
Uses an L298 H-Bridge designed to drive Makes the most of your breadboard atmega328p chip. The board of choice for educators worldwide!
relays, solenoids, DC and stepping motors. It space. 3.3V/5V DC. Powers both busses.
can also drive two DC motors. 5V input. USB input or 6-12V input via 2.1mm jack.
Prototyping
Wire Packs $42.50 $47.95
Handy packs of pre cut and
$ 33 $ 38
59
trimmed solid core wire for
breadboarding your next big
design!
P 1012A 1660 Hole P 1015A 2309 Hole Z 6532 $
Serious Breadboards! Bluetooth Arduino Nano
NEW! $ 14.95 $26.95 Huge breadboards with aluminium bases for
those designs that are beyond the scope of your
The Bluno Nano offers a compact atmega328p platform with
in-built Bluetooth 4.0 low energy for easy connectivity. Just
53x19mm in size - great for portable designs.
P 1014A 140pc P 1018A 350pc average breadboard!
11.95
K 9640 bank). Car or mains use. Suits AAA/AA/C
SAVE 20% $ 3m Roll
NiMH & 10440 to 26650 lithium.
T 2971 8mm $10 .50 Conductive Copper Tape P 7400 0.5m $19.95 S 4736 Standard
A multitude of electronic uses - P 7401 1m $24.95 18650 Lithium Batteries
T 2973 12mm $12.95 create low-profile component traces, 3.7V 2600mAh. As used in many high
T 2974 16mm $14.25 RF-shielding, antennas etc. 0.07mm P 7402 2m $29.95 power LED flashlights etc. Unprotected.
thick. 15m length. P 7403 3m $44.95 5.2A discharge current. 18.6 x 65mmL.
T 2975 24mm $18.50
Prices valid until July 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
SECRET CODE
Structure &
Entry points HELLO
WORLD
All programs have to know where to
start and depending on the language,
this may be as simple as the first line
being marked with start or main.
From this point on, the program will
G
reetings programmers, and welcome to Secret Code! This is the question how do I initiate this software and output a result?
the first in a series of articles that will guide you through the Relativity speaking, this is a modern concept. First and second
niche aspects of programming, while giving the beginner to generation languages are direct coding, but procedural based
advanced user a peek inside the world of coding. Where possible, this languages (i.e. third generation languages (3GL) such as C, Basic,
article will use pseudo code and then give a real world example in C Python and Java) provide a way to gain insight into how a language is
for Arduino, and in Python as a high level guide. The idea is to discuss structured.
how programming works and the concepts behind it. How these
concepts are universal and how they translate across languages; WHY HELLO WORLD?
except PERL, nobody likes PERL.
The tradition of using Hello World as a test case comes from
WHAT IS PROGRAMMING? a code example in The C Programming by Brian Kernighan. This
book is considered to be the seminal work of modern C-based
Put simply, a program is a set of instructions that tells the computer programming. While the Arduino Compiler is based around C/C++
to do various things. At its simplest core, programming any processor I would recommend hunting down a copy for reference. However,
is about shifting bits from one part to another. Different bits to the tradition of Hello World has now propagated into virtually all
different addresses produce different functions, depending on what languages for test examples, regardless of how far from C they are.
the processor designer has envisioned. At a very low programming
level this would allow basic mathematics and functions, while in a
system such as the Arduino, pushing a certain byte to a particular A NOTE ABOUT DUMB LANGUAGES (HTML & CSS): Yes, I
address register will cause the hardware pins to go high or low. probably shouldnt refer to these as dumb, but the context
Fortunately for us the world of programming has become much more here is that these particular languages serve to perform a
user friendly, with English-like syntax becoming the norm. A compiler certain function. In this case, its the mark-up of text, and how
takes this code and converts it to the required byte code or similar, the pages are displayed in a web browser. On their own they
allowing us to focus on what we want to achieve. perform no computation process and are not considered a
programming language. The caveat here is the introduction of
If youve done any coding previously, then chances are you will have technologies such as JavaScript, which is the most common
undertaken a Hello World project. This is coding in its purest and client-side scripting language.
simplest form and often used as the ultimate introduction; it asks
I had to include this, as I learned it C is the cornerstone of most modern Java is a cross-platform, general
at university but have never used languages. It is fast, relativity purpose, high-level programming
assembly since! This is provided lightweight, easily modifiable and language developed by Sun
primarily to give you an understanding will compile on almost every type of Microsystems. It was originally
of what happens at a basic level. We processor. Arduino code is based intended to be an embedded language
need to move our instructions around on this syntax, and is a powerful and is written compiler independent,
to different registrars on the process, language to learn. It can be quite so you can write code and quickly port
then evaluate and move to the next verbose at times, so if you are coming it from one platform to another. The
one. from a modern high level language drawback with this however, is that
you may find you have to break your it tends to be slower then a natively
Running the following code on a ideas down into very small pieces, in complied language. But if you are
Motorola 68K processor will produce a order to get it to execute correctly. looking to build a tool that will work
Hello World on the screen. Objective-C (a slight variant) is used to across a wide space, it may well be
develop apps for iPhone / iPad etc, the answer. Another key feature of
so its a VERY useful language to be Java is that it is designed to be a pure
familiar with. object oriented language. We'll cover
this another time.
PHP is a server side scripting Python is an interpreted language VB.net is probably getting a little
language and interpreter that is freely with a focus on design and readability bit old now, but we have included
available and used to power most of of code. One of the most prominent it to give an idea of modern BASIC
the web. It stands for PHP: Hypertext features is its lack of curly braces (Beginners All-purpose Symbolic
Preprocessor, and yes that is a and line ends. In Python, whitespace Instruction Code). BASIC was often
recursive acronym. matters and it uses tabs and spaces considered the entry point for many
to delimit code blocks. The syntax programmers, and through this
is quite compact, often allowing the iteration it evolved to the modern .net
programmer to express concepts in variant by Microsoft. It was designed
fewer lines of code than is possible to allow the beginner a rich high-level
with Java or C++. experience that was readable and
easy to debug.
PSUEDO CODE 1 This is the basic output from the Python interface
Pseudo code is well, not real. Its a way to sequence a program and is
generally used to describe how a process will function. It ignores the
nuances of languages and sundry things like line ends and operator
syntax. It is often very similar in its content to BASIC or Python. Here
at DIYODE, we use it when mapping out a project flow as it allows
those of us with different programming skillsets to easily converse.
We have included it here as an example of things that may be
featured elsewhere in the magazine. The first time you open IDLE you will get the above prompt, which may
look like you've done something wrong! Just type at the cursor and
press enter.
Print Hello world
CONGRATULATIONS!
YOU CAN NOW COMMUNICATE WITH YOUR USERS.
COMMENTING IN CODE
Greetings, programs! (yes, Tron references are an inherit part of code
A quick note about comments: As a person who is hopeless at and are virtually mandatory). Let's dive into this simple statement. We
commenting their code, I urge you to please comment your code can break this down to three main sections:
you will thank me later. Comments are used to debug code, so if you
quickly comment out a section, it will help you find out if there is a print; the parentheses ( ) and the Hello World.
problem relating to that line, as well as provide a way of outputting
information. They also help you follow logic which another person has When we typed in print, we called the print function (which is a
created - an important consideration when sharing code! Following is built-in function). Python understands that from this, you will want
an example of basic commenting in popular languages. to output a command to the user and, as such, expects you to give it
more information to do so. The information required for the function
is placed between the parentheses. In many functions you will place
//C Comment
more than one item.
//Java Comment
#Python Comment
Finally there is the message you want it to deliver. In this case it is
VB Comment
the string Hello World. The denote that this should be handled
as a string of text. We could put anything in here, of any length, and
Python will simply output it to the user.
FUNDAMENTAL PYTHON FOR RASPBERRY PI
FUNDAMENTAL C FOR ARDUINO
One of the simplest languages that will help you learn the art
of programming is Python. Its commonly used in Raspberry Pi To put this into the real world we will walk through two quick
programming among other things. It has its roots as a scripting examples using Processing in Arduino. Processing is a C/C++
language, but it does away with a lot of the curly braces and line ends derivative and is used to program the Arduino. These programs
(often semicolons), thus making the code much more simple. On the are called sketches. Using processing, we have two Hello World
surface it is not heavily object orientated and provides a simple yet options. Im going to assume at this point you have the Arduino IDE
powerful tool. installed and a working UNO or similar attached.
There are two major Python versions: Python 2 and Python 3; and The basic sketch needs a bare minimum of two code sections (called
each of them are quite different. This tutorial uses Python 3, because methods): setup and loop. These are the entry point and setup of your
it is more semantically correct and supports newer features. variables, then a main loop that repeats whenever the unit is on.
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here,
// to run repeatedly:
}
LEFT
We can create the same
basic "blink" circuit with
a Raspberry Pi and a
WHAT IS
ELECTRICITY?
Without electricity, just about
everything in our modern lives wouldn't
exist. But what is this miraculous and
mysterious thing? by Daniel Koch
ABOUT THE CLASSROOM: Over time, this column will enhance If you have advanced knowledge, you may find some topics
your understanding of electricity and electronics at a foundation appear slightly incorrect or incomplete; however, this will
level. The aim of the Classroom is both to educate and empower usually be a result of the simplification process. Where possible,
educators. Topics will be explored with a broad audience in mind; educational terminology and jargon will be avoided; except in
however, links will be made where possible to curriculums those cases where a paragraph can be reduced to a sentence
for high school, primary, and even early childhood. The ACARA by using it. In this and all other instances, the point being made
curriculum will be used as a reference point, since all states will be most relevant to educators be they teachers, tutors, or
(except for New South Wales) have adopted it, and New South home-schooling parents. If others are inspired to learn more, there
Wales is in the process of syllabus review. Some topics will not be is a lot of reading available on modern teaching and schooling.
linked to syllabus at all, making it ideal for non-educators; while Commonly used terms, such as scaffolding, will feature
others will be directly linked, intended for educators. Regardless, prominently in any reading you may wish to do.
each article will provide value and interest for all readers.
1 ELECTRICITY EXPLAINED
A Helium atom, with The most fundamental concept to embrace when learning electronics
two Protons (pink), P N
is the operation of electricity itself. This starts at the atomic level;
two Neutrons (blue) and
two Electrons (green) N P however, only a basic understanding of atoms is required, so the
depth of learning can be age-adjusted.
Current flow from a power station, showing the path from a generator, through transmission lines, to two separate circuits in the house.
Power flows in what is essentially a loop. The earth stake provides a "backup" path for extra energy, a critical safety against faults.
Disclaimer: It is illegal in Australia to work on electricity over 50 volts AC or 120 volts DC unless licensed to do so.
A very large and complex circuit conveys electrical power from a the output of a power device, such as a battery or generator, is used
power station where it is generated, through many interconnected as electrical energy.
circuits, to your home, down to individual appliances, and inside to
individual components, the intended load. Even loads can be quite Work is another physics concept that is slightly beyond the scope
complex, with a computer being as complex as the circuit that of this article. This transfer of energy into work is why a battery goes
brought the electricity to it. Mains electrical power is a different form flat, and why a generator needs to be spun by the constant input of
of electricity, in that the electrons travel back and forth, changing energy such as steam. This chain is another example of the law of
directions 100 times a second, therefore being known as Alternating conservation of energy.
Current, or 'AC' for short. The study of AC electrical power is mostly
undertaken by licensed electricians and engineers. [4]. In many power stations in Australia, burning coal heats boilers. This
transfers energy from chemical potential energy to heat energy,
Newton stated that every mass will remain in its present state until stored as pressurised steam. This pressure is piped to turbines, which
acted upon by an external force. Even electrons need to be acted turn the potential energy of the pressurised steam into kinetic energy
on by a force to move. In physics, a fundamental rule is the law of by spinning. Turbines are connected to generators, which rotate a
conservation of energy, which states that energy cannot be made magnet around inside a wire coil [5].
or destroyed, only converted from one form to another. Electrons
acted on by a force transfer this energy, rather than being the energy Magnetic fields are one of the things that can cause electrons to
themselves. jump from one atom to the next, thus chemical potential energy from
coal has been transferred to electron flow in a wire.
This may be chemical potential energy stored in a battery, or kinetic
energy, such as the motion of a generator spinning. In either case, the Of course, there is an efficiency problem with mechanical systems
energy is transferred to the electrons, which flow along conductors due to friction and lost heat. Only a certain amount of the heat from
(these will be discussed later), before eventually returning to the a boiler will be transferred to steam pressure. Only a certain amount
source without this energy, having done work along the way. of that potential energy is transferred to kinetic energy in the turbine,
and through friction in materials, not all of that becomes electrical
Along the way, more energy is converted to heat, meaning not all of energy.
A. Coal stockpile
B. Transfer Conveyor
C. Boiler
D. Heating tubes convert water to steam
Energy cannot be
E. Waste gasses and heat exit through Chimney
F. Superheated, pressurised steam piped to Turbine made or destroyed,
G. Turbine
H. Generator only converted from
one form to another.
I. Transformer
J. Transmission Lines
K. Steam from the Turbine to Condensor
L. Condensor
M. Feed water from Condensor to Boiler
N. Reservoir
J
A
F
D
B G H
C I
M
K
L N
B
A
I
C
E
Hydroelectric power station
A. Reservoir D H
B. Dam
C. Penstock
D. Turbine
E. Generator F G
F. Outflow
G. River
H. Transformer
I. Transmission Lines
One alternative is hydroelectric electricity generation. In a Some materials carry the flow of electrons from one atom to the next
hydroelectric system, water is stored in a reservoir, usually a dam, and very well. Elements such as copper and aluminium do this effectively.
then allowed to flow downhill to spin a turbine [6]. Silver actually does it the best of all; however, it is expensive. Iron and
steel work fairly well too, as does tin and lead. In fact, most metals
This is still energy transfer. Gravitational potential energy when stored carry electron flow quite well. Any material that carries electron flow
becomes kinetic energy when the water is piped to the turbine. is called a conductor.
An interesting comparison can be made both to the efficiency All electrical wires and cables are made with conductors, usually
in energy conversion of a coal-fired power station, and to the from aluminium or copper. Copper is quite flexible, more so than
environmental impacts. aluminium; however, it does not have as much strength when carrying
its own weight. This is why power lines are usually aluminium, which
Hydroelectric power may appear environmentally friendly; however, it is is both lighter and stronger than copper.
not without its challenges. The most prominent issue in Australia is the
health of the Murray-Darling river system. Prior to the construction of Other substances can have conductivity too, such as salt water, or
the Snowy Hydro Scheme, snow melts caused flooding along the river water with impurities like dissolved iron. Carbon can be a conductor
system, which effectively washed the river clear of debris, and spread as well, although it does not carry current as well as metals. Carbon
fertile silt over the flood plain. Since the Snowy Hydro Schemes dams is used in some electrodes, motor brushes, and other situations for
were built, this has stopped. Further issues have been researched specific reasons.
regarding the limited water flow permitted along the river from the dams.
Other materials dont allow the electrons to move, without a great
deal of voltage to encourage it. These materials are called insulators.
Editors Note: Impacts of these and other issues on ecosystems Many plastics are insulators, as are wood, concrete, many rocks, and
from the dams all the way to the delta, would be a great study in fact many things that arent metal. This is why electrical cables
for a stage 3 unit of work combining HSIE and science Key are usually surrounded by a plastic jacket of some sort. The type and
Learning Areas. thickness of the materials are chosen according to electrical pressure
that is applied or expected. This pressure is known as the voltage.
7
+
Static electricity during a storm. -
A. Cloud to ground
B. Inter-cloud
C. Internal cloud
B
+ Positive energy
- Negative energy +
+
- - C
+
The most common material is silicon, with gallium and selenium also
"All insulating materials can used. These chemicals, which are all pure elements, have various
be forced to conduct under other elements added to them in controlled amounts in special
processes, known as doping. Doping alters the behaviour of a
sufficiently high pressure, i.e. semiconductor to give certain predictable results. Chemicals such as
voltage, with some labs testing boron, arsenic, phosphorus, and antimony are used.
at well over 100,000,000 volts." Not all electricity comes from a battery or generator. An atom that
has lost or gained an electron is called an Ion and is considered to
be ionised. Atoms will always attract a replacement for a missing
Air is an insulator in its normal form, as are most gasses; however, electron, or shed any extra electrons due to an imbalance in the
air under the right conditions can become ionised, at which point forces between electrons and the nuclei.
it can conduct electricity. This is how lightning travels through air.
Any material that is porous can also absorb conductive liquids such In a storm, the thermal energy separates electrons from atoms and
as salt water or water with conductors dissolved in it. That is why the relative motion between clouds and the ground cause polarisation
wooden ladders are now illegal for electricians to use in a workplace; of the clouds. That means that the top of the clouds becomes more
only fibreglass, which is an insulator that doesnt absorb anything, are positive and the bottom becomes more negative. The clouds now
now permitted. appear like a very big battery [7].
All insulating materials can be forced to conduct under sufficiently Nature always tends toward whatever requires the lowest energy, so
high pressure, i.e. voltage, with some labs testing at well over the clouds may transfer that charge between clouds, or between a
100,000,000 volts. However another class of materials can be cloud and the ground, with spectacular results we call lightning. The
made to conduct when required. These materials are called terrible damage caused by lightning is evidence that with enough
semiconductors. This principle is the foundation for all modern digital electric pressure, any insulator will conduct.
electronics, starting from simple transistors, ranging through to
integrated circuits, and the most complex computer processors.
History of Electricity:
water in a pipe. Water flow is measured in litres per minute, and a
way of measuring electrical current exists as well. Electrons are very
small, the smallest particle of matter that is not still debated. Because
Edison
they are so small, electrons are measured in huge units called
coulombs. One coulomb is 6,240,000,000,000,000,000 electrons.
Instead of that large number, it is typically written as 6.24x10^18
Vs.
electrons, or 6.24E18 electrons, for those who prefer scientific
notation! Coulombs are not talked about very much, because instead,
a unit called the ampere is used, which is one coulomb of electrons
Tesla
flowing past a point in one second. Ampere is usually pronounced
as amp, and is often written that way too. It is the standard unit to
measure and describe electrical current.
by Bob Harper
"When electrons flow anywhere,
they move in a current, just like Thomas Alva Edison and Nicola Tesla should have been great
friends, were it not for Edison being completely dedicated
water in a pipe." to DC electricity, and Tesla being completely dedicated to AC
electricity. One can only imagine the progress that would have
been made had the two gentlemen worked together.
When an electron is released from an atom, the electron gains
energy. When the electron is captured by another atom, that energy Commercially, both men were in competition in the 1880s with
is released as Infra-red light, or what we know as heat. Electrons world-wide electricity distribution rights at stake. New York City
travelling through a material do so by jumping from atom to atom. engaged Edison to begin lighting the city with his new electric
Therefore a material that requires more of those hops release more street lights (which according to some sources of the day
heat energy, and therefore become hotter. Some materials make would only work on a DC supply, which is completely false, of
electron flow very difficult. They are said to have high resistance. course. This comment has been attributed to Edison, but also
Joseph Swann).
Hopefully this brief overview has established the basics of how
electricity occurs and is used. In future editions, topics will progress Edison favoured local generation at a relatively low voltage,
to how electricity behaves in basic circuits you can build yourself, for one simple reason: DC wont transform into higher or lower
and how to do some of the basic maths around electronics. You voltages, at least not before the invention of switch mode
dont need to remember the fine details of what is presented here; power supplies. The only way Edison could step-up, or step-
however, being able to follow the process helps in understanding the down voltage was to run a DC generator off a DC motor. Low
rules that govern electricity, and why it behaves the way it does. voltages lost too much energy over long distribution lines,
due to low voltages to begin with, and high currents on the
GOT QUESTIONS? transmission lines.
For additional resources, or to discuss this topic, visit:
https://diyode.io/001zfpy Tesla, on the other hand, had the transformer on his side,
bypassing the mechanical machines for an efficiency of around
98% far better than Edison could wish for. Tesla and George
Westinghouse built the first hydro-electric power plant in
FOR EDUCATORS: 1895 at Niagara Falls. The voltage was stepped up to a higher
voltage (2500V, I believe) and therefore lower current, to
The quantity of energy transferred from coal to electricity provide power to nearby cities.
would make a great research project for school students. It
may suit a particularly engaged stage 3 class, with appropriate Edison was left to attempt to provide DC power only to large
scaffolding, and certainly any high school stage. In doing so, cities, locally. In order to persuade people of the time to use
cross-curriculum learning is achieved, as science is strongly DC, Edison promoted the use of ac electricity for executions,
linked to the sustainability aspect of the geography curriculum. even demonstrating the dangers of AC by electrocuting an
Higher order thinking is promoted by asking students to elephant. In reality, AC is far safer than DC for supply and
examine the impacts and alternatives, and propose solutions. distribution.
100W DIY
BLUETOOTH SPEAKER
Portable Sounds
Using a handful of cheap parts and some
nifty recycling, Daniel has created a powerful
Bluetooth speaker thats totally portable, DANIEL BISEGNA
extremely cost-effective, and outperforms many HSC Student and
Casual Crew Trainer at McDonald's
of the more expensive units.
www.dbisegna.com/make.html
W
eve all seen them in shiny boxes on the shelves of our Youve made great use of an off-the-shelf car speaker. Did you have
favourite stores. Unfortunately, the cheap ones are usually it already or were they purchased specifically for this project?
cheap in every sense of the word, with poor sound quality
and speakers that are often undersized. This one boasts a powerful The car speaker I used was the Audioline 4 2-way car speaker,
100W amplifier module, 100W 4 coaxial car speaker, in an ultra- which I bought as a pair from JB Hi-Fi, for $27. I did have recycled
compact package. speakers at home that would have done the job, but I wanted the
unit to look its best so I went with a brand new speaker to add to the
Thanks for taking the time to show us your project, Daniel. What overall aesthetics. I will potentially use the second speaker in another
made you want to develop your own Bluetooth speaker? Bluetooth speaker project.
I wanted to build a Bluetooth speaker because I enjoy creating small At $27 a pair, thats a bargain anyway, and youre right we always
electronic projects, but have not yet created something practical want our DIY projects to look great! What amplifier module are you
enough that I would use on a regular basis. After some thought, I using to help wind up the volume?
decided that a Bluetooth speaker would not only be something that I
would use regularly, but it would also challenge me and develop my The amplifier board is the TPA3116DA, which I purchased from eBay
DIY skills. After finishing this, I now want to take on a more advanced for $17. Its a 100W single channel amplifier that can be powered by
project in the future. a 12-24V supply (although 9V from a battery will work at a
reasonable volume). The board is small, has an adjustable gain on the speaker but it ran on an old 9V battery from a smoke alarm,
control and a big heatsink, making it perfect for this project. With for at least an hour at about half volume. I plan to conduct running
lower voltages, it will distort at high volumes, but my speaker can time tests in the future. One modification I am starting to make on the
be powered with either a battery or DC input, meaning it can reach speaker is a switch that will allow you to switch between a parallel
considerable volumes with a power supply. and series circuit, so you can choose between one battery for 9V or
two batteries for 18V to provide louder volume. I predict that with one
The distortion is understandable at low voltages; youre not trying to fresh 9V battery, the speaker will easily last a few hours at about half
match a 1000W Hi-Fi system with it, after all. volume with Bluetooth on.
The Bluetooth module I used was a simple USB-powered Bluetooth Interesting idea. I dont doubt youll be able to get more distortion-
audio receiver I found on eBay. It is powered by 5V USB and outputs free volume, even if its at the expense of some run-time. Can you
to a 3.5mm AUX. To power this, I used an old broken car Navman 5V take us through your custom back panel?
power supply. This allowed me to get a 5V supply from 12-24V and
I used the power light for the power indicator on the speaker itself. I The back panel is rather confusing, so I plan to add labels in the near
soldered the 5V output to the USB contacts of the audio receiver, and future. I need to figure out a way to make them look good without
stripped an old AUX cable to get the audio output. simply using white paper print outs. On the right is the DC input socket,
which is a standard DC plug, allowing me to use small DC packs or
Note: The original one I purchased is no longer available but its even laptop power supplies for really high volumes. Next to this is
similar to the one youll find at: the power indicator LED, and below it is the three-way power switch.
http://www.ebay.com.au/itm/262864860175 Switching it up uses the DC input power, switching it down uses battery
power, and in the middle turns it off. Next to this is the Bluetooth
Thats a great way to get a 5V supply. I think weve all got a few of switch, where the up position turns it off and the down position turns it
those unused in-car gadgets lying around. Running from 9V batteries on. On the left is the AUX in socket and the volume control.
is a great idea to keep it portable. What sort of run time does it
provide?
VR1
AUD OUT - + -
+ - + +
+ 5V + + AUD IN DC IN
Bluetooth
Car Power
Module
Supply
- - - - 100W
Amp
9V 9V - +
DC IN
The box construction is very neat. Battery Battery
Was it purpose built or reused from something else?
The box I used for the speaker was from an old broken
toy guitar amp, which was given to me by a friend after he This makes a project cost of just $49. In comparison, similar speakers
found it under the bed. The unit originally ran on two 9V on the market that can reach similar volumes can sell in upwards of
batteries, making it easy for me to power my project with $200, so I believe that this project was not only a really fun way to
the same power source. The original circuitry inside was improve and develop my DIY electronics skills, but Ive also saved
bad and did not work, but I could have reused the speaker inside. myself hundreds of dollars for the same (if not better) result.
Instead though, for the sake of aesthetics and sound quality, I opted
for the store-bought ones. The front cover and back control panel of Thats awesome! What a successful project, for so many reasons! If
the speaker have a carbon fibre texture. I bought this on the internet you were to build a second one, is there anything you would change?
for about $4 for a 30cm x 1m roll. This stuff feels very similar (and
probably is) to the contact you might use to cover a school book. I If I were to build a second speaker there would be a few things I
used a hair dryer and a lighter to soften the material on the back, would change. Firstly, I would make my own box for it. I got lucky that
enabling me to poke holes through it so as to put the switches and a standard four-inch car speaker fit perfectly into this one. But with
sockets in. The unit now weighs 1.4kg overall, including the batteries. a custom built box I would be able to make a speaker fit very well,
with adequate space allocation for the amplifier and batteries. The
Thats an amazing reuse of a suitable enclosure, which is sometimes configuration of this box almost forced me to use 9V batteries for
the most difficult part. It also explains the selection of 9V batteries, power, as the battery compartments were cut out of the back panel.
which arent an obvious choice right away. With all the parts They also took up space inside the unit, which prevented me from
recycling youve done for this project, was it a cost-effective project using different batteries. This leads me to the second change. I would
in the end? like to have had built-in SLA or 18650 batteries to power the speaker,
as this would enable me to make a completely portable speaker with
Absolutely! Once I had all the parts for the project, it took me about rechargeable, self-contained and more powerful batteries. I would
four or five hours of wiring, soldering, and re-soldering the innards also like to add a microphone system with a receiver to the speaker,
together until it was finally complete. The total cost of the project was so as to make it a portable PA system, and not just an audio player.
as follows: [editor's note: prices may have changed]
They sound like some great upgrades for version two! Thanks for
Box: $10 (Old,from a friend) taking us through your DIY Bluetooth speaker, Daniel. Were looking
Speaker: $27 (for a pair) forward to hearing about your next creation.
100W Amplifier Module: $17 (Now selling on eBay for $12)
Bluetooth Module: $5 GOT SOMETHING TO SAY?
I already had all the wiring and switches To discuss this feature, leave your comments at:
https://diyode.io/001kpfb
Meet
FRED
Free
*
*
Roaming
Experimental
Droid ABOVE
FRED's motor mount.
I
f youre into robots (and who isnt?) youve probably thought about What made you decide on the TReX Jr motor controller over other
building your own personal servant to fetch a cold one, fold your controllers?
laundry, or take out the garbage. While we might not be there
yet, heres a very cool project built from the ground up. Using a I started the project with a Pololu DRV8833 motor driver. This required
combination of open source Thingiverse files, some powerful yet four I/O lines to operate and two analogue inputs to read current from
simple hardware, and a little code, FRED will roam the house and each motor. I found I ran out of I/O [on the main board]. I also tried to
squirt water at whomever dares enter! Standing almost 30cm tall incorporate soft start into the coding but this became overly cum-
and now in its third generation, hes come a long way from the first bersome, so I decided to search for a serial or I2C controller.
version, with better sensors and motor control. We asked creator The TReX Jr could be serially controlled, had acceleration functional-
Royce, all about FRED. ity, and current limiting built in. It was also small enough to fit in the
space I had available. As a bonus, it has a high current third motor
driver (should I ever need one), and motor current draws are also
available via serial interface. All up, by using a TReX Jr, I increased the
available drive current from 1.2A (DRV8833) to 2.5A and saved four
I/O.
It certainly seems like serial simplified much of the I/O you were What's next?
having to manage manually. How much autonomy does FRED have,
and how has it evolved from the first time he came to life? There will be a further revision of the head board. Im currently using
the logic 5V supply to feed the pump motors. The motors
VERSION ONE: When he first began, he was fitted are designed to run on 3.3V, so inject a lot of noise
with a Devantech SRF08 ultrasonic sensor and into the power rails. Im going to try using PWM
a Devantech TPA81 thermopile array for heat to reduce the voltage but there may still be an
sensing. Motor control was with a DRV8833 issue. The new board will use an N-channel
as noted above. Track motors were simply MOSFET to drive pump motors, and
servos converted to continuous rotation. theyll be supplied from the servo supply
Pan/tilt servos were driven directly from through two diodes to drop the voltage
the PICAXE chip. No water pistols were to approximately 3.6V.
fitted. MP3 player was also fitted in this
version. These things are an evolution, and
theyre never complete! Your 3D printed
A Devantech CMP09 compass module tracks are amazing, but Im sure they
was used to keep him running straight were tedious to do. How important were
and to measure turn angles. Compass the tracks to your design, and how much
module and code worked, except when I 3D printed retractable work did it take to get it right?
water cannons!
installed it into the robot, the slight magnetic
field from the motors caused errors in the compass The tracks are awesome, but I didnt design them!
module. Full credit for the design of the tracks, sprockets and idlers
goes to Ktronics, Krux and DRH a heartfelt thank you for sharing
Feedback for motor currents and other values is via a small OLED them on Thingiverse!
screen from Digole. Front, rear and edge detection is performed by
Pololu IR proximity sensors (Pololu 1134). These little IR prox sensors I did modify the sprockets to suit the new motors, and the chassis to
are fantastic, but benefit greatly from a small capacitor soldered suit some of my other modifications. The tracks have been modified
across the power terminals on the board. so the 3mm bolts dont require a nut to hold them in. Ive also used
different idlers with bearings, all installed from Thingiverse.
VERSION TWO: The next revision used a new main board. Hall sensors
were added as rotation sensors for feedback during straight running Ive always liked tracked machines, so any robot I made needed to
and turns, rather than the compass module. The hall sensors were be tracked. I guess you could say that was important to me. The only
activated by magnets built into the tank drive sprocket. This meant other modification Id like to make is to the tracks themselves; they
resolution of rotation angle was very coarse. The head with attached need to have some rubber added, for extra grip.
water pistols was fitted to this version, and an eight-pin serial servo
driver was used to drive all the servos (pan/tilt, water pistols). Thats so impressive, and its the amazing world of creative
commons at work! What degree of pan/tilt did you achieve with
Unfortunately, the servo driver was a dismal failure. I burnt out two FRED?
servos due to the chip locking up and jamming the servos to full
swing, which caused them to overheat and burn out. The tilt probably wont go any further than about 60 degrees. The
ratio between pinion and main gear is 2.7:1 (from memory). Sixty
VERSION THREE (CURRENT): The current version uses TReX Jr for degrees assumes the servo can be driven to 162 degrees. The
motors, Pololu Micro Maestro for servo control, and motors are now rotation is directly driven by a servo, but Id suggest it would be hard
Pololu micro metal motors with hall speed feedback built onto the pressed to rotate more than 160 degrees.
rear of the motor (providing higher resolution). Temperature sensing
uses a Melexis MLX90614ESF-DCI non-contact temperature sensor Awesome. What conditions does the MP3 operate on? Does it play
thats mounted to a breakout board (purchased on ebay). I also specific tracks when it detects or is about to fire, or is it just playing
included a PICAXE ERF remote download device to this version. music to keep itself entertained?
I had been using a LIDAR-Lite v1 for proximity sensing, but have MP3 player is a DFplayer Mini. The device is serially addressable and
recently replaced this with a MaxBotix I2CXL-MaxSonar-EZ4 sensor, can play individual tracks on demand. This little device also has a 3W
because the LIDAR-Lite V1 was intermittently returning bad readings. audio amplifier built in, so is awesome for adding voice to projects.
The most recent additions are his eyes, made from two BlinkM I2C Currently, it plays tracks for detecting objects, detection of thermal
addressable RGB LEDs. signature, firing cannons (water pistols), initialisation of systems, low
battery, crazy Ivan turns, and more.
The rest of the frame was drawn up using Tinkercad, with the goal of
supporting the pan/tilt while leaving as much room as possible for
motors and electronics. I had a rough idea of what I wanted it to look
like, so just ran with that. The design has been modified a few times
to accommodate motor changes, water tanks and aesthetics.
Youll definitely gain some life out of the servo by using the bearings.
Do the water pistols operate autonomously too, or do they simply
expose?
The water pistols then pop out and the water pistol pumps are meant
to start. When firing the water pistols, FRED moves his head up and
down to spray water over the object. The proximity distance of 90cm
was chosen because the water pistols are so small they struggle to
shoot any further than this. It also means that the temperature sensor
is only seeing a small circular area about 9cm in diameter.
Once the pumps stop, FRED rechecks the temperature and if its still
high, he fires again. Once hes fired twice, he gives up and carries
on. I may change this behaviour and make him turn away 90 degrees
after firing, because if its a stationary heat source, he has another go
at it on the next scan.
Oh yeah thats probably not a good mix! How are you achieving the
scanning and heat signature detection functions?
jury is out on whether its better. The temperature sensor is a Melexis Oh how wed love to try that! If only they made adult-sized versions
MLX90614ESF-DCI non-contact temperature sensor, which has been the kids get all the fun! How long have you been dabbling in
mounted to a regulator/interface board, courtesy of ebay. This sensor electronics/maker space?
has a very narrow field of view and communicates via I2C. Both
sensors are mounted centrally on the head in the position of FREDs Ive been an electronics hobbyist for 34 years. Ive only jumped on the
nose. 3D printing / CAD design bandwagon about three years ago. Using
Tinkercad primarily, because its simple and I know it well. I have
While FRED is roaming, his head scans back and forth. He takes been playing around with Fusion360 on and off in the last 12 months,
a temperature and range reading at five distinct positions (sectors). mainly because its a much more versatile tool, and its free!
At each sector the firmware checks if the temperature is higher than
ambient, checks the range reading, and checks the IR proximity That always helps when youre not sure youll use it long-term. Any
sensors for a change in state. If the temperature is high enough and shout-outs, thank yous, or other mentions youd like to make?
the range is less than 90cm, FRED stops and enters the water pistol
routine described above. Id like to say a special thank you to my partner for her considerable
tolerance and understanding.
If the ranger detects an object closer than its minimum threshold
and/or a proxy sensor has changed state FRED stops, completes the Id also like to thank the following people:
scan (left to right or right to left), and then takes appropriate evasive
action based on the ranges collected in each sector. If an object is All contributors to Thingiverse and other resource/file sharing
detected directly in front of FRED, he uses the scan data to identify websites.
the sector that has the greatest range reading and turns that way The PICAXE forum members for asking and answering questions.
(clear path). At the end of each scan, if there is no detection event the DIYODE magazine for their interest in FRED.
motor speeds are checked, and their speed is adjusted to maintain a
set speed and straight course. Finally, Id like to congratulate DIYODE Magazine
on their inaugural issue and I hope you have a
If, after a time, FRED hasnt detected anything interesting (object successful future.
or thermal signature), hell do a couple of 360-degree turns (called
crazy Ivan), and search for a heat signature. Royce, thanks for introducing us to FRED.
We look forward to hearing about your
That sounds like a fairly solid routine simple, yet functional. Is there next project!
an achievement in this build that youre particularly proud of?
GOT SOMETHING TO SAY?
Id have to say Im particularly chuffed with the pan/tilt design. It To hear FRED's "voice", get code, or
came together quite nicely. leave your comments, visit:
https://diyode.io/001xvbp
It certainly looks great! Anything that was particularly challenging
RIGHT
that you overcame? Entirely 3D printed, and
constantly being improved.
The coding. Im a self-taught PICAXE basic programmer but not a
math wizz, so it took some thought. The coding for the scanning took
me a long time to get right and it was very satisfying to finally get it READING & RESOURCES:
working the way I wanted. The motor speed control code was also a
challenge. I dont know if I went about it the right way, but it works! DIGOLE www.digole.com
DRH www.thingiverse.com/thing:284242
In a non-production environment, code doesnt always have to be FUSION360 www.autodesk.com/products/fusion-360
elegant. Sometimes functional is all you need! Are you focused on JSIROGADO www.thingiverse.com/thing:507974
FRED at the moment, or do you have something else awesome in the KRUX www.thingiverse.com/thing:19170
works? KTRONICS www.thingiverse.com/thing:14599
MAXBOTIX www.maxbotix.com
I have a lot of projects on the go, so I dont devote all my time to MELEXIS www.melexis.com/en
FRED. To be honest, I dont know if he will ever reach the point where PICAXE www.picaxe.com
I can say thats it, hes done because I always seem to come up POLOLU www.pololu.com
with another cool feature to add. Ive been spending a bit of time T HINGIVERSE www.thingiverse.com
converting a drift trike to electric drive at the moment... TINKERCAD www.tinkercad.com
SUPER
SIZE
ME!
LED
VU Meter
At DIYODE, size matters so we've
turned a great project build into an
Size up a
even bigger (and better) one. In this 3" project by a mere
1600%
edition weve supersized an LED
VU meter. Brace yourself this is
gonna be fun! by Daniel Koch
T
his column started life as a conversation about
making things unnecessarily big, because who
doesn't love to make big things? Here in Australia we
have the Big Pineapple, the Big Banana, the Big Prawn -
everything is more fun when it's super sized. Head to the
USA, and EVERYTHING is bigger in Texas, apparently!
This Super Size Me project takes what is a fun and educational kit, THE BUILD
and provides you with a visually stunning example of what is a useful
tool for engineers, DJs, and anyone working with sound equipment. BUILDING MATERIALS REQUIRED:
Of course, with a bar of coloured lights dancing up and down to the 2 x 1200mm lengths 90 x 19mm DAR pine
music, this is as much suited to a backyard party as anything else! 1 x 1200mm length 140 x 19mm DAR pine
2 x 178mm lengths 90 x 19mm DAR pine*
Based on readily available LED light strips and materials from major 2 x 1200mm lengths 11 x 30mm DAR or primed pine
chain hardware stores, it is designed to be easy to build, even for 2 x 100mm lengths 11 x 30mm DAR or primed pine
those with minimal electronics knowledge. In keeping with that, the 2 x 1238mm lengths 11 x 30mm DAR or primed pine*
Volume Unit (VU) Meter provides an ideal subject, resulting in a party 2 x 178mm lengths 11 x 30mm DAR or primed pine*
lighting piece that stands at around 1.2m high, and which can be 1 x 1200 x 140 x 3mm length of clear or frosted acrylic sheet
built at home in around half a day. 38 x 15mm brad nails
36 x 35mm chipboard screws, Phillips or square drive
THE BROAD OVERVIEW 8 x No. 4 x 12mm Self-Tapping Wood Screws
8 framing staples or 12 regular staples
In audio systems, having an input that is too close to the maximum, Rigid cardboard, enough for 10 x 100 x 60mm pieces
results in flat spots at the top of what should be a clean, curved wave Silver spray paint & masking tape
of electrical signals that is amplified and fed to the speakers, which Spray paint of colour of choice for outside of unit
turn it into sound. These flat spots overwork the coil of the speaker, Red, green and yellow cellophane
resulting in rough, distorted sound, and also in overheating of the Double-sided adhesive tape
speaker coil. PVA wood glue
Unlike a spectrum analyser which looks at the volume level across *T
he sizes of cut pine are nominal, and may be +/- up to 8mm.
different frequencies, a VU meter looks at the sound signal as a
whole. VU meters provided a valuable indication of the signal level ELECTRONICS PARTS REQUIRED
feeding into an amplifier or other circuitry, so you effectively knew
when it was being overloaded (which would result in distortion and PARTS REQUIRED: JAYCAR ALTRONICS
poor audio quality). Short Circuits 2, Sound Level Meter Kit KJ-8212 -
5m Flexible, Self-Adhesive LED Strip Light ZD-0575 X3202A
HOW IT WORKS 6m Twin Core Speaker Wire WB-1702 W4050
1 x Prototyping Board HP-9558 H0711
The basis for this project is an education kit that comes from the 10 x BD650 PNP Darlington Transistors ZT-2119 -
Short Circuits kits from Jaycar Electronics. The kit itself demonstrates 10 x 1k0 1/2W Resistors RR-0572 R7046
the principle of a VU meter brilliantly. In its unaltered form, it produces 10 x 4k7 1/2W Resistors RR-0588 R7054
a display using 3mm LEDs, which light up in sequence to reflect the 1 x D25 Plug PP-0840 P3200
signal being received. 1 x D25 Socket PS-0844 P3210
2 x D25 Plastic Backshell PM-0848 P3290
We won't cover how the kit itself works, because you'll find that in 2 x M3 x 12mm Nylon Bolts HP-0140 H2922
the instruction set for the kit. But what we're doing is taking the LED 2 x M3 Nylon Washers HP-0148 -
outputs, and using transistors to scale up the available power. In turn, 2 x M3 Nylon Nuts HP-0146 H2900
we can feed large LED light strips, that switch on and off based on 2 x 6mm M3 Untapped Nylon Spacers HP-0930 H1320
the output to the original LEDs. Yep, that's - SUPER SIZED! 1 x LED Audio Level Meter Kit KJ-8212 K5412
1 x RCA Panel Mount Socket PS-0262 P1290
This project is presented in two parts; the hardware construction, 1 x Dual Binding Post PT-0457 P9257A
and the electronics construction. We have provided a design for a 1 x S
mall Plastic Box for Binding Post
large timber box, but you don't need to follow these plans - you can and RCA Plug HB-6016 H0205
use our electronics design to drive significant electrical output from 5m Red 7.5-Amp Hook-Up Wire WH-0340 W2270
the same tiny VU meter kit. You don't even have to shape it inline like 5m Black 7.5-Amp Hook-Up Wire WH-3041 W2272
a traditional VU meter, maybe you could make it circular, in a star 2m Light Duty Hook-Up Wire WH-3017 W2251
pattern, or whatever you like. The goal here is to show you how to 300mm Single Core Screened Audio Cable WB-1500 W3010
supersize the original project. Precisely how that materialises into a 12-Way, 10-Amp Terminal Block HM-3196 P2130A
massive version of its former self, is up to you! 100mm Cable Ties HP-1203 H4031A
Lead Free Solder NS-3092 T1075
mm
00
12 11mm 11mm
30mm 30mm
90mm Cross - Section
90mm
90mm
All planks
19mm thick
14
0m
m 140mm
90mm
17
8m 19mm 19mm
m
Start by measuring and marking a line at 1200mm on the 140mm Repeat for the small pieces of 30 x 11mm, attaching centred onto
wide panel, then use your saw of choice to make clean, straight the shorter 90 x 19mm pieces, 5mm down from the edge on one and
cuts at right angles to the length of the timber. Repeat with the 90 x level with the edge on the one that was cut or planed. This operation
19mm pine (even if it is bought in 1200mm lengths; these is usually forms the guide and support for the cover, which slides in from the
slightly longer than the nominal length, and this project requires all top, hence the 5mm reduction on one end-piece.
pieces to be the same size).
Mark a line at 9.5mm on the 19mm edge of the 140mm pine. Mark
Next, use clamps to hold the 90mm pieces to the sides of the points on this line 100mm from each end, then at 200mm intervals.
140mm piece, as per photos and diagrams, and measure the total Drill pilot holes for the chipboard screws, which on the prototype
width. Timber sizes are nominal, and having an accurate total width needed a 3mm hole. Measure 9.5mm from the edge of the 1200 x
determines the actual length of the pieces listed as 178mm* in the 90 x 19mm pieces, then measure and mark as above. These points,
parts list. The cut length for these pieces is the width of the U shape, however, are drilled as clearance holes. In the prototype, these were
formed by the three 1200mm pieces in the diagrams. Once these 5.5mm.
smaller pieces are cut, mark a line 5mm from the long edge of one,
and either plane or cut to the line. Assemble the sides to the base with PVA glue between, referring to
the diagrams, using the 35mm chipboard screws. Next, mark a line
Using the 11 x 30mm primed or DAR pine, cut two 1200mm lengths 9.5mm from the edge of both short and one long sides of the 178mm
and two 100mm lengths. Now cut two more to 1238mm*, however pieces, then choose measured points to place two screws on each
these will be cut with a mitre box and tenon saw, to be 45 degrees side in the same manner as above. Glue and fasten together. Then
inwards at each end. Again, this length is nominal, being 1200mm spray the entire inside with silver paint.
plus the wide of thickness of the two short pieces of 92 x 19mm pine.
These will form a mitred frame along with two pieces cut the same T o assemble the mitred frame, take the 45-degree cut pieces of 30
way to be the same width as the shorter pieces of 90 x 19mm pine x 11mm pine and lay them (face down, if primed) onto a flat surface.
above. Drive either framing staples or regular staples across the joins, then
follow with masking tape. Turn over, drive brads into the face at the
Mark a line along the length of the 1200 x 90 x 19mm sides, 5mm same intervals as the guide pieces inside the box except for the top
from the edge. Place brad nails 75mm from each end of the 1200 x piece, which remains nail-free.
30 x 11mm pieces, then at 150mm intervals, drive them in so theyre
almost through. Run a bead of glue along the underside of these, Cut 10 pieces of rigid cardboard 100 x 60mm. Cut the LED strip into
line them up with the lines on the 90 x 19mm, and drive the nails to 100mm lengths. The circuit board has pictures of scissors on it where
securely fasten them together. it can be cut, and these are in 50mm increments. There will now be
50 small lengths. Remove the backing and place five lengths on each
piece of card, matching the polarity of the PCB tracks to the diagram.
$
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
$
1992
SAVE $4.98
$
2876
SAVE $7.19
ea
5
$ 56
SAVE $1.39
$
1276
SAVE $3.19
THE ELECTRONICS CONSTRUCTION Mount the resistors and transistors in ten identical assemblies on the
prototype board. Pay attention to the diagram when populating this
Now the soldering can begin. Solder lengths of light duty hook-up wire, board. To create the wire-links, use cut-off component legs from the
to connect the lengths of LED strip as shown, ready for attaching the kit assembly, then fit and solder them. Now solder a 400mm piece of
supply wiring later. 7.5-amp red hook-up wire to the collector of each of the transistors.
Next, solder ten 400mm pieces of 7.5-amp black hook-up wire to the
+12V negative rail in the middle of the two rows of transistors.
e
Solder the LED strip arrays to the cable, as indicated in the diagrams.
BD
65
1k 0 b
BD650 c
4k7 + bc
e
Output LED e
Array
BD
From LED 65
0 b
Driver IC -
0V c Lengths of cable are cut to reflect the distance each will have to be
bc away from the base of the unit. Starting from the top of the cabinet,
The original kit is part of a learning series, so ethe instructions are measure ten increments of 100mm, marking a pencil line for each. This
included as part of the series book, or they can be purchased will yield ten equal 100mm divisions for the LED arrays, and a 200mm
separately. The circuit board is well marked, so experienced space at the bottom of the unit for circuitry.
constructors will not need the instructions.
Hot melt glue each array into its respective place, running the speaker
ssemble the kit following the instructions, but do not include the
A wire in the gap under the 30 x 11mm ribs. Solder all of the positive
LEDs. Instead, solder 15cm lengths of light hook-up wire to the wires to the first ten pins of the longer row of the D25 plug. Use pin
negative side of where the LEDs would have gone. This is the flat side one for the array that is mounted closest to the bottom of the unit, then
of the LED, marked on the circuit board overlay. If in doubt, turn the scale accordingly. Repeat in the same order, for the negative wires, on
board over. The positive side of all the LEDs are connected under the the other row of the connector. Cable-tie all of the wires into a bundle.
board. Use the other pin connected to the IC. Once happy, assemble a backshell around the bundle.
To construct the step-up circuit, following the diagram provided using Align the audio level meter circuit board next to the prototyping board,
the prototype board (or use the online resources for more details). then mark the mounting holes. Remove, drill a 3.5mm clearance hole
through the prototyping board, then mount with the nylon bolts, nuts,
and washers. Solder the wires from LED positions five and six to their
respective transistor base positions, having cut them to the shortest
practical length.
Follow on with the rest of the leads, setting the length so that a bundle
can be formed after. Tidy the whole assembly with cable ties (as per
the photo). Finally, add a 500mm length each of red and black 7.5-amp
hook-up wire, to their respective power rails on the prototype board.
This needs to be done by soldering the wire directly to the track-side
of the board. Lastly, use a spare length of speaker wire to make the
positive and negative power connections between the supply rails and
the kit circuit board. Note that the kit is designed for 9V but will run
from up to 15V (which is handy since it requires up to 4.5A).
This board features supply rails that run around and between rows of
three connected solder pads. The diagram shows the non-track side ake the ten red and ten black 7.5-amp 400mm wires into a straight
T
which you should follow, though we have included a "ghost" of the bundle. While loose, determine which red wire belongs to which
tracks on the opposite side so you can verify your positioning. transistor, and use a fine permanent marker to write the corresponding
1 2
number on the end of the wire (you can use lines instead of numbers HARDWARE FINISHING TOUCHES
- as long as you have a way to identify them). The black wires have no
order here. Starting with the shortest red wire, solder to its respective Measure the width of the cabinet above the 140mm pine. Subtract
pin number on the D25 socket. Continue for the other wires, trimming 3mm from this, and mark a length of acrylic sheet to this number,
and soldering one at a time to avoid mix-ups. Next, solder the ten black 1220mm long. Acrylic is not always readily available in long lengths
wires to the corresponding pins on the shorter row of the D25 socket. from hardware stores. The prototype used a diffuser meant for
Order does not matter. After this, the backshell can be assembled, and a double fluorescent light fitting, purchased from an electrical
the wires cable-tied into a neat bundle. wholesaler. Many plastics retailers and signmakers will supply suitable
acrylic (though you could potentially omit the diffuser in your build if
D
rill a 12mm hole through the 140mm pine, approximately 20mm from you wish). Cut acrylic with a jigsaw. Mark a point 200mm from one end,
the base of the unit, measured from the inside. Drill a corresponding and cover the back with black paper or spare cardboard. These steps
hole through the back of the plastic box, plus mounting holes for the form the cabinet cover [2].
binding posts and RCA socket. On the prototype, the RCA socket was
glued in; however, it can be mounted with nuts and bolts. Solder the Cut slices of cellophane to size to cover the LED arrays. Our prototype
screened audio cable to the RCA connector, then slide it through the used two layers, stuck together and to the base of the cabinet with
hole in the base of the box. double-sided tissue tape, not the foam cored variety; use seven green,
two yellow, and one red. Then, use the brad nails to attach the mitred
ount the prototype board into the upper part of the 200mm section
M frame to the top of the cabinet. The whole assemble should now be
that is left at the base of the unit. Use the 12mm self-tapping screws ready to go. Once the system is tested, slide in the cover. Should fault-
and some of the untapped nylon spacers for this. Now pass the supply finding be needed in the future, simply slide the cover up and out to
rail 7.5-amp wires through the hole, and draw the screened audio cable gain access to the circuitry inside.
through and into the cabinet from the other side. Outside the cabinet,
thread the red and black supply wires through the lid of the plastic Finally, remove the cabinet cover, mask it all over with tape and
box. Strip around 40 mm from the ends, and wrap tightly around the newspaper, then slide it back into place. The whole cabinet can now be
respective binding posts before clamping with the supplied nuts and painted in your colour of choice, without affecting the internals or silver
washers [1]. paint inside. Good practice might be followed by independently testing
each LED light before attaching the controller.
A ssemble the plastic box, then mount it to the outside of the cabinet
with the 12mm self-tapping screws. Inside the cabinet, take the Its worth noting that the kit instructions include modifications for
screened audio cable along a neat route to its connection point on the changing the sensitivity of the audio input.
audio level meter circuit board, then strip and solder it.
WANT MORE?
For more detailed instructions, or to discuss this project, visit:
https://diyode.io/001whzf
3D PRINTING
BASICS
In recent times, 3D printing has taken the maker world by
storm. With printers designed to replicate themselves, to
the epic industrial machines, from building your child a
toy, to printing houses, this new technology equates to a
really exciting future for makers. - by Oliver Higgins
M
any years ago I worked for a manufacturing company, WHAT 3D PRINTING IS AND IS NOT
building retail spaces such as shop fronts and food courts.
My job was to design and process the routing paths for 3D printing should really be termed Rapid Prototype Development
the industrial CNC (Computer Numerical Control) machines. With (RPD). If you were to view it in terms of the manufacturing world, you
some clever programming we were able to push this machine quite have a machine capable of producing any one-off design that you can
far, producing some amazing builds that I am still proud of today. construct in your head, and be able to produce in the real world. You
Since leaving that role, Ive missed the opportunity to use a machine can do this without expensive tooling or major production runs, but it
like that, which turns ideas into 3D realities. Of course, the cost comes at the cost of economies of scale and speed. Ultimately, 3D
involved with machines I used to work with is phenomenal; theyre printing is slow and since there is no economy of scale, it will cost
worth in excess of $500,000. However, the last few years has seen you the same amount of time and money to individually produce each
an influx in the market, of maker level versions of 3D printing and unit, regardless of whether you want to produce 1 or 1000 items.
milling machines, which has truly enhanced our ability to create and
engineer! Rapid Prototyping allows us to work with a shape or small detail, and
not be drawn down to trying to secure a jiffy box in the drill press, or
Believe it or not, 3D printing has been around since the 1980s, but trying to get a perfect 90 without cracking the enclosure. Instead,
until recently it was a patented idea. It was only 2007 when the we can simply put a 5mm hole in the design! Take that, you 10mm x
idea of a 3D printer for under $10,000, for rapid prototyping, was 5mm LED bar graph! Eat dirt you rectangular rocker switch!
unbelievable. This period saw the birth of the RepRap printer, an
open-source, self-replacing printer. By 2009 these printers were At DIYODE, we think that the greatest thing technology has created is
available for purchase, and ever since weve seen an increase in the the opportunity to share ideas and models with people from all over
number of different units, and lower cost options enter the market. the world. For example, to view some fantastic open sourced ideas
Ten years on and in 2017 you can buy a kit for under $200! and models, check out Thingiverse.
Most modern maker-based 3D printers are FDM (Fused Deposition To begin, you need a model. In simplest terms this is a 3D
Modelling) style. Very simply, these units work by heating up a representation of an object. It might simply be a cube or something
plastic filament and then pushing it through a small head called an way more complex like a Pokmon Chess Set. For the purpose of
extruder. The filament is laid down along an X-Y (left/right & back/ this article, I have simply created a rectangular prism with a hole in
forth) plane until everything at that level is complete. Depending the middle. Of course, there are large open-source libraries available
on your style of printer the Z (the up/down) will then move to allow on the internet, which caters to these very things. Doing an Arduino
the extruder to deposit the next layer on the XY plane. This project using the standard 16 x 2 LCD? There is a box for that! Simply
repeats and the model builds up until it is complete. download the file and youre halfway there.
Each of these can most simply be described as
slice. The model that you created gets sliced into But what if you need something that has not been
hundreds or even thousands of slices, and the designed yet? Most 3D Computer Aided Design
printer deposits material on each new layer. (CAD) programs will allow you to design your object;
however, they are often very expensive. So far the
WHAT CAN YOU BUILD? best no cost solution is Tinkercad. Not only is
Tinkercad free, but its made by AutoDesk, which is one of
The short answer is anything! But the worlds leading CAD specialists. The tool is available
the real limits are volume of the for free online you just need to register an AutoDesk
print bed, and the complexity of your account. It also has great options for kids, allowing
design. As your designs become more them to have their own accounts, which you
complex, you will be required can oversee. This software is very easy to
to build support structures use. It offers just the basics, but allows you
to support those to create some incredibly detailed models
elements (see note in a short period of time. The tutorial only
about this on the takes about an hour to complete, and a
next page). seven-year-old can become fluent
in the process.
WHAT DO
YOU NEED? LEFT
This 3D printer by Jaycar Electronics (TL-4076) is
a perfect entry-level model for those who want to
A printer, some filament (generally ABS or PLA, which are both types give 3D printing a go.
of plastic), CAD/3D design software, and builder software.
WHAT TYPES OF PRINTERS EXIST? Once you have your model completed you need to export it to .STL or
.OBJ format. We use the .STL format as it is one of the most common
There are a number of different printers available, but to focus on formats that works well with our chosen builder software.
the FDM style of printing, the most common would be the Cartesian
style printer. This is the style that the RepRap belongs to. Cartesian Slic3r is an example of a software tool you need, to convert your
printers move in a X-Y-Z space, so as to move in three dimensions. 3D model into CNC code to drive the printer for each layer of the
The extruder sits in the X-Y axis and the Z moves via the head of print. The code is called GCode, which is the generic name for a
lowering of the base plate. control language for CNC/3D printing machines. It is a way to tell the
machine to move to various points at a desired speed, control the
WHAT IS FILAMENT? extrusion speed, turn fans on and off, and all sorts of other things.
Filament is the plastic used to print your models. It is generally sold To generate this code, Slic3r imports your 3D model then slices it into
as a roll of a single colour. It is heated to make it malleable, and layers. Often you will not want to create solid pieces of plastic but,
then pushed through the extruder head to be laid down on your instead, create an internal rigid structure that is just as strong but
model. There are several different types of filament available but the much lighter. Slic3r will work all this out for you. It also provides you
most common is PLA and ABS, which most consumer devices use. with various options to change how the model is created, and how
Materials do exist, which are conductive, metal or even chocolate. your 3D printer is setup. At this point in the process, it is crucial that
Both PLA and ABS are available in filament form, and are readily you know things such as the extruder diameter, the bed size, the Z
available from stores like Jaycar Electronics. ABS tends to be more height, and the size of the filament you are using. Depending on your
expensive but is considered the more durable and of superior quality printer you can set a Z offset for a finer calibration of your device.
among the two.
FINALLY, LETS EXPLORE The print time alone can be several hours
A NOTE ON SUPPORTS: Supports are THE PRINTER! or even longer than a day. Those of us here
extra material that act as scaffolding at DIYODE that have been around for some
to hold up the parts of a design that Printing, itself, is quite straightforward but time, lament about the jiffy box. This
angle over 45. If your model has please consult the manual or setup guide for wonderful piece of plastic serves to house
overhangs, you will need to create your specific brand. A few key points: zero your labour of love, as you shoehorn it into
supports. Slic3r will construct these or calibrate your printer. If you dont know the rectangular brick that fits best! Whilst I
for you, but this is beyond the scope of how to do this, please find out from your say this as tongue-in-cheek, it is a difficult
this article. printer manufacturer. Most printers have a task and often does not have the form
calibration process but not all of them are that your project needs, to truly function
straightforward. We have one printer here in the environment in which it is designed.
Once you are happy with your setup, export in the DIYODE office that does not have a Personally, this is what we find most exciting
to .GCODE file. These days, most printers calibration function, even though it has the fact that we can finally produce the
will have an SD card or USB to transfer the offsets, and it is not a simple process to items we have in our head, we can dictate its
file to; alternatively, please see information correct. However, using the manual override function and form, and create some fantastic
on your printer if its driven directly from the on your printer, and moving the Z axis to and unique projects.
computer. The code file is text, so if youre where it is almost touching the extruder
interested please open it up in your favourite head will get you very, very close. Once you Now, if youll excuse me, I have a Pokmon
text editor and take a look. You can see from have the Z height number from this, then Chess Set to print...
our example below, that GCode is simply an you can use this offset in Slic3r. Personally,
instruction, then a point in space. I found this to be one of the most reliable GOT QUESTIONS?
and constant ways to get a good base layer, For additional resources,
which is important because a well-formed or to discuss this topic, visit:
G1 X8.691 Y-36.510
E107.59018
base will lead to a much better quality object, https://diyode.io/001tqsc
G1 X36.510
Y-8.691 E109.36664
in the end.
G1 X36.510
Y-8.252 E109.38646
G1 X8.252 Y-36.510
E111.19095
REALITY VERSUS EXPECTATIONS
READING &
G1 X7.813 Y-36.510
E111.21076
G1 X36.510
Y-7.813 E113.04327
There seems to be a public belief, that you
G1 X36.510
Y-7.375 E113.06309
simply click print and your Pokmon will RESOURCES:
G1 X7.375 Y-36.510
E114.92362
appear; kind of like the replicator in Star
G1 X6.936 Y-36.510
E114.94344
Trek. In reality, it would be better if you SLIC3R http://slic3r.org
G1 X36.510
Y-6.936 E116.83200
viewed the current 3D printer technology as a THINGIVERSE www.thingiverse.com
G1 X36.510
Y-6.497 E116.85181
Rapid Prototyping device, because as weve TINKERCAD www.tinkercad.com
G1 X6.497 Y-36.510
E118.76839
mentioned, with 3D printing it takes time to
create and produce a quality product.
1. You'll save
money.
Subscribing saves you
money - leaving more for
your next project!
2. Its convenient.
Once subscribed, every
month - without fail - a
brand new issue will
magically appear in your
inbox or letterbox.
SUBSCRIBE TODAY:
diyode.io/001subs
FEATURE
BELOW
The completed
Valve Amplifier.
CLASSIC
VALVE
AMPLIFIER
Hand Crafted
and Amazing
Valves (vacuum tubes, electron tubes, or whatever you
want to call them) may be a 100-year old invention,
but they still make for an amazing warm sound, which
is why theyre still a preference for many musicians TIM SHANNON
Handyman & Mechanic
around the world. from NSW, Australia.
T
im has been a hobbyist for many years, creating all manner of Your valve amplifier is visually stunning and I bet it sounds beautiful,
interesting projects. His fine woodwork in this original valve Tim. What made you decide to design your own valve amplifier? Was
amplifier demonstrates craftsmanship to the highest degree, it purely budget-focused or is it partly because you could?
something the name brands would be envious of. His one-
of-a-kind Shamrock 59-LUXE valve head and speaker This is my third attempt at building a valve amp from
box looks amazing. Its a stunning fusion of practical scratch. The first two were The Lamington and The
circuit design, with tremendous finesse in the Lamington Junior, which were inspired by Valve
artistry of woodwork and panelling. Heaven, but changed slightly to suit my needs.
After them, I became addicted. I decided to
Tim didnt stop just with the valve-head, however. blend some of The Lamington ideas with an
He build another stunning cabinet to house a 12- iconic Fender amp, using some modifications
inch Celestion Seventy 80 wide-range instrument I found online from Rob Robinette; and yes,
speaker, which is highly popular in guitar being budget conscious was also a factor.
amplifiers around the world, due to its performance
quality. Together, its a stunning example of what DIY
LEFT
electronics and woodworking can achieve. We caught up We love the finger joints detail
with Tim to find out more. on Tim's Valve Amplifier.
Its certainly no easy task. What unexpected challenges did you have
along the way, and was there much trial and error?
Editors Note: The Emblaser from Darkly Labs is a laser engraver I have already learned a lot from my builds. When
capable of cutting and engraving. It uses a 9mm 445nm laser diode I first started I couldnt read a schematic but now I
(class 4), with a 3W and 4W option. We havent used one ourselves, can draw my own! I love working with my hands, so I
but it looks like a very versatile unit! will definitely be building another one. The plans are
already in place!
Youve definitely made great use of the engraver, to create your
panels and add a touch of detail to everything. Did you start building Good on you, Tim. Keep that journey going we cant
right away, or did you draw up a schematic first? wait to see what you come up with next!
Yes, I created a schematic of the amp and power supply (see GOT SOMETHING TO SAY?
website), and as I mentioned, its based on a 5F6A Fender Bassman. For schematics or to discuss this feature, visit:
The output section uses two 6V6 valves, which delivers approximately https://diyode.io/001rkrw
15W, compared to the 35W to 50W from a Fender. Im only a lounge
room player these days, so I dont need too much power. RIGHT
One of Tim's past projects, a guitar.
"I bought the neck and hand-
Hey, wed take 15W of amazing sound over 1000W of scratchy crafted the two-piece hollow body."
average sound! Quality always wins over quantity, especially if
youre going to the trouble of building a valve amp. What was it
like switching on the unit for the first time, and playing a tune? Im RESOURCES:
assuming youre using it as a guitar amplifier?
DARKLY LABS
Yes its used as a guitar amp, and it is always nerve-racking switching www.darklylabs.com
something on for the very first time, but it fired up straight away and ROB ROBINETTE
sounded great! Better than I hoped actually, and to this day it still www.robrobinette.com/5F6A_Modifications.htm
surprises and excites me to use it. Of course, building it yourself VALVE HEAVEN
makes it even sweeter. www.valveheaven.com
Warning: Valve amplifiers operate at voltages above what is recommended for safe use by
non-qualified persons. Electric shock may result, leading to severe burns or even death. Issue 001 July 2017 77
PROJECT
Building
An Arduino
Web Server
Web server technology is behind much of the modern
world. However you don't need a whole lot of computing
power to achieve great things. by Oliver Higgins
A
web server is a program that delivers data to a client machine THE BROAD OVERVIEW
via the Hyper Text Transfer Protocol (HTTP). This program
serves data to users (most commonly referred to as a web We're creating a lightweight web server which can respond to your
page), in response to the request sent by their web browser (client requests for information, and provide General Purpose Input Output
machine). Dedicated devices exist to purely service this purpose. (GPIO) hardware information data to screen. We'll use a temperature/
humidity sensor in this demonstration, but you could use any sensing
If youre serving a lot of data from a web server, then an Arduino module, or even just a jumper-wire from 5V to one of the GPIO pins.
may not actually be the best choice. Web servers can be built from
something like a small computer (Raspberry Pi or small PC) or scale HOW IT WORKS
up to a fully-fledged multi-processor web server used in data centres
around the world. However for many simple hardware devices, web The web server is an example of the server/client process. Commonly
server technology allows us to send and receive all sorts of data used programs that deliver your content is Apache, Microsoft
using WiFi or ethernet connectivity, which is in just about every home Information exchange, and nginx. The web server forms part of a
and office (especially for the avid DIYODE reader!). larger internet suite, or collection of protocols. This includes but is
not limited to FTP, DNS, and IMAP, which you probably use every day
(perhaps without even realising it).
When you open your web browser and type a website address into
your address bar, the web browser takes this information and sends
the request to their server, which is serving the page that you wish
to view. Their server receives this request for information, along with
your return address. It then puts together the requested information,
Request as well as information on how to build and display the page. There are
Page visual and non-visual parts to this response. Firstly there is an amount
of header data that is required to build this page. Primarily this
information tells your web browser (client) what type of information
you are viewing, the language or encoding that the page may be
in, and even how to display the text or images on the page. While
HTML is the most common way to format a response for "human
consumption", many other solutions exist for content designed for
machine-handling. But we'll cover those another time.
With the IoT, a lot of things now have web servers built in, providing
a simple and low cost way of allowing the user to determine settings
and supply valuable data to the device. Some examples would be
your home router, televisions, set-top boxes, even some cars! What
this means is we can provide a powerful user experience with one
When dealing with HTML (or at least, a HTTP request), the format of simple shield.
this return data typically follows this pattern:
Using the Arduino ethernet shield, it is easy to make your web server.
HEADER: What the information is, and how is it encoded. This could be used for a simple way of viewing the temperature from
wherever your Arduino is located, to a full-blown home automation
METADATA: Important elements of the page, but are not displayed. setup. Need to switch on the front veranda light? Want to check the
ambient light at home? Do the plants need watering? Whatever sensor
CONTENT: The visible portion. In its most common form, this is Hyper you can read from, you can make a website direct from your Arduino
Text Markup Language (HTML) and is a sequence of tags that tells to reflect that. What about a simple robotics interface? Move forward,
the browser how to display the text or image. move left, move back dont trust the automated system!
This is a Heading
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title> This is Bold This is Italics
</head>
<body> This is a paragraph.
<h1>This is a Heading</h1>
<b>This is Bold</b>
<i>This is Italics</i>
<p>This is a paragraph.</p>
</body>
</html>
PARTS REQUIRED: JAYCAR ALTRONICS We start by importing the ethernet library, which includes the code
1 x Arduino UNO R3 XC-4410 Z6240 required to make the server work. We also include SPI.h, which is the
1 x Ethernet Shield XC-4412 Z6242 library for the SD card that is included with the ethernet shield.
1 x LED ZD-0100 Z0800
1 x 220 Resistor RR-0556 R7038 There are a few principles here which also apply to WiFi networks.
While the libraries required will be different, the network principles
ADVANCED MODEL PARTS (OPTIONAL): JAYCAR ALTRONICS shown here are the same. MAC address, IP address, and server ports
1 x DHT11 (3 Pin breakout) XC-4520 Z6320 are all still required, whether it's a WiFi or wired ethernet connection.
You'll also need prototyping hardware such as a breadboard and As a result, once you're familiar with the basic concepts we have
jumper wires, power supply, and other standard equipment. explained here, you could easily transfer the skills, expanding your
Web Server know-how to a WiFi-enabled web server, opening up even
BASIC SETUP more options.
Align the ethernet shield to the UNO board and connect them to HEADER CODE:
each other. Plug the Arduino to your computer via USB, and connect
an ethernet cable to the RJ45 port on the ethernet shield. You can
compile the code without an ethernet connection present, but the #include <SPI.h>
the same network at the same time, is very slim. So feel free to use 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
However they can change from time to time. If youre setting up for
permanent use, you should use one of several methods to ensure it
doesnt change - but well cover that another time. SET UP THE PORT FOR THE SERVER:
EthernetServer server(80);
A NOTE ABOUT THE SD SLOT: This example does not require an
SD card. If an SD card is inserted but not used, it is possible for
the sketch to hang, because pin 4 is used as SS (active low) of SETUP CODE:
the SD, and when not used it is configured as INPUT by default.
If this occurs, there are two possible solutions:
void setup() {
1. Remove the SD card Serial.begin(9600);
2. Add these lines of code in the setup function: Ethernet.begin(mac, ip); //This sets the MAC and
IP address of the Server
pinMode(4, OUTPUT); server.begin(); //Starts the server
digitalWrite(4, HIGH); }
From this point on, you only really need to change/add or subtract
void loop() {
some basic parts to output more information to the webpage that
EthernetClient client = server.available();
you have created. Just copy and paste the client.print(<p>Hello
if (client) {
World</p>); to add another line. However we want this to actually do
something. This code refreshes every five seconds, so lets make the
boolean currentLineIsBlank = true;
LED flash each time.
while (client.connected()) {
if (client.available()) {
Unfortunately the ethernet shield uses the inbuilt LED on pin 13. This
char c = client.read();
means that we need to hook up a basic LED with 220 resistor to pin
Serial.write(c);
7, to see this real world example. Add the following lines of code to
the sketch:
if (c == \n && currentLineIsBlank) {
client.println(HTTP/1.1 200 OK);
client.println(Content-Type: Init
text/html); const int outputLED = 7;
client.println(Connection: close);
client.println(Refresh: 5); Setup
client.println(); pinMode(outputLED, OUTPUT);
client.println(<!DOCTYPE HTML>); digitalWrite(outputLED, HIGH); // turns it on
client.println(<html>);
client.println(<title>Example</title>);
client.print(<p>Hello World</p>);
This does not really do much other the turn an LED on, when the
client.println(</html>);
server is on, but it has showed us how simple it is to use the Ethernet,
break;
and how to drive a basic output.
}
if (c == \n) {
While simple on the face of it, you now effectively have an ethernet-
currentLineIsBlank = true;
powered switch. You can use the output to drive a relay output, trigger
} else if (c != \r) {
other systems, and so much more. This is effectively a one-way action,
currentLineIsBlank = false;
with no feedback. But keep reading - we can do that too!
}
}
}
delay(1);
client.stop();
}
}
This will give you a complete test case to make sure everything is
working. Compile the code onto your Arduino, and you should see it
boot through serial monitor. Open up the IP address shown in your
favourite web browser and you should see something like:
Hello World
This may seem like a very simple output for a few dozen lines of code,
but there is quite alot happening here. Much of the content is also
"blind" to the user, which is hidden data sent in the form of header
data. This provides the web browser software useful information on
the type of content it's receiving.
The next example reads data from the DHT11 temperature and
humidity sensor, making it a bit more useful. For this example we're
using a basic three-pin sensor that will work with the simpleDHT
library. It is connected on pin 2.
Note that some of these modules are three-pin, others are four-pin.
It only uses three pins (5V, data, GND). If you have a four-pin version,
check the data sheet to find out which pin isn't used, and adjust from
our wiring diagram accordingly.
GET CODE:
#include <SimpleDHT.h> //DHT sesnor Lib Finally, what if we need to interact with our Arduino and turn a pin
int pinDHT11 = 2; on or off? While this is a little more complex and requires some URL
SimpleDHT11 dht11; processing by the Arduino, it can be done with relative ease.
This final sketch creates the basic Arduino loop and calls the
client.print((int)temperature); dashboard function to create the user interface. Upon clicking on
client.print( *C, ); the buttons the Ardunio reads the returning URL string to then run it
client.print((int)humidity); through a series of if statements to determine the course of action.
client.println( %); In this case, we are simply changing the state of one of the output
pins, based upon the input. This could easily be used to turn on relays
to active lights or watering systems - the possibilities for expansion
of this are endless. This idea also forms the basis of the learning
Current temp: 22c infrared remote project, elsewhere in this issue. It contains multiple
Current humidity: 21% ways to change the outcome and call functions based upon the
user's requests.
TESTING
To test this project we need to connect an LED to pin 7. Open Simple, Rich Content:
The HTML5
Webserver_LHD_ON_OFF.ino and change your IP and MAC as
required. Upload to your Arduino and check the serial monitor to
ensure you get the server is at 10.x.x.x. Once complete, go to your
Revolution
web browser and type the IP address that you have selected. You will
be greeted with the following:
The next iteration to this would be using the more expensive Wi-Fi SOME STANDOUT FEATURES:
shield to gain wireless access to you project. Other project ideas
include using SQL to insert data into a database live, rather than local CANVAS: Canvas is an unbelievably powerful rectangular area,
data logging. Or what about making your project tweet or provide live which allows pixel-level operations such as drawing a circle, box
interfaces through services such as Temboo? or line, enabling a web developer to render graphics on the fly.
The <canvas> element and its API are controlled with JavaScript.
WANT MORE?
For more detailed instructions, LOCAL STORAGE: This is used to store data from web
download files, or to discuss this project, visit: applications within a users browser. It allows you to save or
https://diyode.io/001dngx remember everything you type, even after you refresh or close
the browser. It works like cookies, but where cookies are small,
local storage allows for much larger data and files.
RESOURCES: OFFLINE WEB APPS: You can download the site while online,
CODE DOWNLOADS then continue to use it offline. This is possible by making use
of the application cache. A file called the application manifest
LED Code Webserver_LED.ino stores the list of files used in your application. Files will be
DHT Code Webserver_DHT.ino served from this cache and behind the scenes the app will
LED ON/OFF Code Webserver_LED_ON_OFF.ino check and automatically update these files when next online.
Boosting W
hile some modern cars have already figured this out, if
you have an older car, or a classic without all the bells and
whistles, then youve probably encountered this problem.
Its also a common issue on many boats. It didnt matter so much
Cars
when we were only tuned into the FM radio, but nowadays with
Bluetooth connections and the like, it can take up to a few minutes
for the stereo to figure out what its doing. Brian decided to tackle
this problem head-on, by developing a great system to stop his stereo
from restarting. So we caught up with him to learn more.
BRIAN R. SMITH Yeah, I was annoyed that my car stereo would power-off and take 20
Semi-Retired Software Engineer from NZ.
@tinkerbearnz
seconds to boot every time I started (or restarted) my cars engine.
Ive had a car stereo that didnt restart when the engine was cranking,
so I knew it wasnt an impossible task.
No... were not talking about stealing them! Once I knew that the ignition switch was intentionally cutting power
Brian developed a method for keeping to the ACC (accessory) circuit during cranking, I started with the
his stereo cranking, during those pesky obvious solution of a two-diode OR setup to provide the stereo with a
voltage drops when the engine starts up. power-on signal even during cranking which fixed nothing. Further
investigation showed the voltage sag (down to 7.5V, as recorded on
a digital scope) was also a problem, and one that was much more
difficult to solve.
Ive never built any kind of switching power supply before, so I ended
up reading three to four chapters of a book called Switching Power
Supplies: A to Z by Sanjaya Manikala (2006), a bunch of different
switching controller datasheets, and learning to use LTSpice while
trying to find or construct a suitably beefy voltage booster. The stereo
can draw 6 amps (@12V) at high volume, so the booster may be
pulling 10 amps (@7.5V) in the worst case. I also wanted it to shut
down, bypass itself, and consume minimal power when it was not
needed - which is 99.9999% of the time.
TOP
The trace showing the battery
voltage drop, and the resulting
stable output from the unit.
RIGHT
The completed circuit
- case included.
The datasheet for the LT1270A provided the basic booster circuit, Its always wise to keep the high-current routes as short as possible,
which I simulated in LTSpice to make sure it could turn on, and to with the less heat the better; on occasion, circuit tracks have been
make sure it could begin boosting fast enough that the stereo would known to make a surprise performance as a fuse! Did anything
never see an input less than ~10.5V. Its up and running in less than 3 unexpected happen while testing your design in the car?
milliseconds, which is good enough.
One of my tiny surface-mount logic-level MOSFETs released the
Definitely a solid foundation. You have gone to the effort of having a magical black smoke and shorted, leaving the stereo permanently on.
custom PCB made. Have you developed PCBs before and were there Fortunately, this was just before arriving home, so I could immediately
any challenges? pull the dash apart and disconnect it. I failed to put input protection
on any of the four MOSFETs which, in retrospect, was a naive mistake.
I've been ordering small boards from OSH Park for years. EAGLE has Just because it works in LTSpice doesnt mean its ready for the real
a free version for hobbyists, and OSH Park imports EAGLE board world, and automotive electronics have to resist some nasty surges
files directly, making it a great option for beginners like me. Having and spikes.
made half a dozen PCBs already, it wasnt difficult and the results
look surprisingly professional for a hobbyist. Id never made my own Oh no, the dreaded smoke release! Sometimes it provides the best
boards before that the equipment and chemicals were daunting. insight into circuit design (and its faults). If you were to make
another version, what would you change?
Outsourcing PCBs to those who are set up for it definitely provides
a more refined result. Im sure many of us have the skills, but in a After submitting to DIYODE Magazine, Ive switched it over entirely
DIY scenario the PCB manufacturers will often trump even the most to through-hole components (the board grew only slightly longer),
meticulous DIY efforts. What challenges did your PCB design face? and added input protection for all MOSFETs. It should survive longer,
and doesnt have any of my dodgy surface-mount soldering. I should
The booster needs to handle currents larger than Ive dealt with probably investigate automotive-grade components, but I wont...
before, so I attempted to keep the high-current components close until it breaks.
to each other, with short fat traces between them. The book I
read, Switching Power Supplies: A to Z, has an entire chapter on Well you know that old saying; if it aint broke.... What are you
the subject of PCB layout, which was helpful. The other concern working on currently?
is avoiding any induced currents in signal lines under the largish
inductor by keeping signal lines away from it. Toroidal inductors Right now Im trying to make my home alarm send SMS messages.
are supposed to have low leakage anyway, but I dont have the
experience to predict if it will matter or not. That sounds like a great project. Wed love to hear about it once its
complete!
The booster only needs to run for short intervals half a second,
typically but Ive tried to specify all the components, traces, and GOT SOMETHING TO SAY?
heatsink, so they could handle full load continuously. Its overkill, but I To check out the schematics or discuss this feature, visit:
dont know where I can safely trim the specifications. https://diyode.io/001wjbw
BELOW
Early prototyping of Elite
Robotic's automated lawnmower.
ELITE
ROBOTICS
Meet Elite Robotics, a start-up business based in
Newcastle in NSW (Australia), which strives to build the next
generation of robotics to enter your household. Their robots will use
machine learning to navigate inside and outside your house, to keep it
tidy so you dont have to worry about doing boring chores EVER again!
E
lite Robotics is a company that focuses on commercial Thats a great tale! Like-minded people can achieve
applications for Autonomous Vehicle Technology. Their vision such amazing things when they collaborate.
is to take the technology found in driverless cars, and bring it What excites you most about working with robotics?
to the humble quarter-acre block (or several-acre block) by creating
a line of household robotic solutions, starting with an autonomous Robotics and automation is the equivalent of what PCs were
lawnmower. We caught up with co-founder, Sahil Harriram, to get to back in the 80s. In the coming decades, this technology is going
know his business a little more. to shape the world and we are excited to be at the forefront of this
futuristic industry, which is only just getting started. We are currently
What inspired you to start the business? working on a robotic lawnmower. Basically imagine a lawnmower that
has a really smart brain and can avoid obstacles in your yard, like kids
Our engineering team mostly comprises of mechatronics engineers and pets, but is still capable of mowing the entire lawn.
who, throughout our studies, have developed skills in the area of
Autonomous Vehicles Control. Upon completing our degree we found it No more lawn mowing on a Sunday? I cant wait until a robot makes
difficult to find graduate jobs that used the skillsets we developed. So my dinner for me, gives me a foot rub and washes my car! I hadnt
instead of taking a traditional career path we decided to forge our own. even thought about mowing the lawns. What has been your greatest
business accomplishment so far?
Nathan, one of our co-founders, lives on a large two-acre property
and has to mow it using only a push mower. One day he came up Weve been fortunate to have some success in business pitching
with the idea to combine our desire to work in the autonomous competitions, which has helped us obtain the necessary funding to
vehicle industry, with his despise for having to spend three hours on get our business off the ground. Weve also managed to keep the
a Sunday mowing his lawn! So he got together with Luke and began funds flowing by obtaining a government grant. This has helped us
planning and developing the idea. Soon after, Nathan brought the attract the right talent, to assist us in carrying out our long-term vision.
idea to me. I was eager to get involved, and the rest is history!
Pitching is a common challenge for many business owners. Maybe Thats amazing, though it does start to raise questions about what
we need a robot to take care of that dastardly task too? Whats been we find interesting about racing - is it human skill were in awe
your biggest business challenge so far since you managed to take of, or is it just about machines, code, and how it can best utilise
care of funding? horsepower?! Either way, no driver risk is a bonus. It all sounds so
surreal, but were eagerly watching this space too. Whats your BHAG
One of the biggest challenges we face is the ongoing process (big hairy audacious goal) for Elite Robotics?
of building our business at a time in Newcastle (NSW, Australia),
where it is not common for people to establish start-up businesses. The over-arching vision of our company is to have an Elite Robotics
Compounding this with the fact that we are going into a really high- product in everyones home. The invention of personal computers
end industry, where a lot of capital and time is required to get a and the internet, combined with the extreme growth in the global
product to market, makes it extremely challenging for us. population has made the world we live in, more complex. As this
complexity increases, we need to find ways to free up our time so
Yes, you havent chosen an easy path, by any means! But the end we can spend it doing the things we love like being with family, and
reward will be worth it, when every household knows your name! pursuing our passions. We believe that robotics can help us achieve
Whats the most impressive robotic solution that youve ever heard of? this, and Elite Robotics is striving to make this a reality.
How is it different?
driverless car motorsport series; theyre aiming to launch in 2018.
Partnering with Formula E a current electric motorsport series and
the cars theyre developing are extremely impressive. The current
prototype is a single seat LPM-style race car, which can be controlled There are already a number of similar products on the market;
by either a driver, or just the computer system itself. The end-goal however, they use a very basic navigation "bump and go"
concept, which was announced earlier this year, has no seat and system to detect obstacles; meaning they bump into the
relies completely on its onboard guidance, navigation and control obstacle and then reverse to manoeuvre around them.
system. Imagine the limitless possibilities of these vehicles! They will
be lighter than current LMP (Le Mans Prototype) cars and there will
be no driver risk involved.
From a sketch to a system that detects obstacles and manoeuvres around them
before it touches them.
fully realised concept.
Listen, sign us up! Who wouldnt want to let someone or something We have another project in the pipeline with a potential customer,
else tick off the most annoying tasks, so that we can go and have but we are still in the negotiation process so we cannot disclose any
more fun? Whats your plan to take it to market? Crowdfunding, or detail yet. For now, we are focusing primarily on our first product,
something else? which is the lawn mower.
We are initially targeting golf courses, sporting venues and council- Sahil, what advice do you have for other people who are considering
owned property such as recreational parks. This will allow us to going pro with their electronics business idea?
develop a high-end, low-volume product using predominantly off-
the-shelf components. Once we have established a production line We stumbled across an article a while ago, which quoted a study that
we can streamline the manufacturing process, thereby reducing found 60 per cent of the jobs that will exist in the coming decade,
manufacturing costs. This will allow us to create a high-end, high- have not been invented yet. This is really exciting for us, because the
volume product that we can market to residential properties. We invention of open source electronics platforms such as Arduino
will initially sell our product within the Hunter region, expanding and Raspberry Pi have popularised electronics and programming.
nationally, and then worldwide. We are focusing primarily on the This has significantly driven down the cost of embedded computing
development of our minimum viable product, as we believe that by systems, whilst improving their performance. This is huge, because
successfully building this we can attract larger external business it means we now live in a time where there are more amazing and
investors. Furthermore, we are working towards establishing profitable combinations of this technology, than there are people
partnerships with golf courses and city councils in our region, to working this area. So if you have an idea and think it may be a way to
create a pipeline of business customers. support your lifestyle, then go for it! There are so many resources at
your fingertips, and so many people who are willing to help you, so
Whats your anticipated timeline to get your product to market? you really have nothing to lose and everything to gain!
Right now we are in the middle of product development. We are aiming So true Sahil. Were definitely excited to see your first prototype and
to get a proof of concept/demo product within the next six months, hope to do so soon!
which is a requirement of our grant. From there we envisage servicing
a business customer with our product by the end of next year. To find out more about Elite Robotics, visit:
http://elite-robotics.com.au
Are there any other projects youre working on at the moment (or in
the near future), or are you staying focused on the first product for GOT SOMETHING TO SAY?
now? To discuss this edition of Going Pro, leave your comments at:
https://diyode.io/001rncj
Power Outage
Detector &
Arduino UPS
A UPS system might keep things running for a short
time, but being able to monitor when the power
goes off is invaluable, especially when using
off-grid technology. by Tim Blythman
I
was having problems at my place with the power going off, and HOW IT WORKS
shutting down the fridge and freezer, so I set up this project to
notify me when it was happening. This project is self-powering, using a rechargeable Li-ion battery. By
monitoring input voltages and comparing them to the battery voltage,
Fortunately the router is on a UPS, so it wasnt too hard to get a we can determine whether there is external power available or not.
message out, even if the power was off. Ive got an Arduino Leonardo This was a simple solution that doesnt require monitoring of mains
attached to a WiFi shield and a custom UPS shield. I guess I could voltages, making it equally useful for monitoring mains power, or
have run the Arduino from the UPS as well, but I still needed to sense battery / solar power.
if the power was on or off, and when I thought about a UPS shield
for the Arduino, it was easy to add power sensing. In addition, the Youre probably wondering why were using the Leonardo for this
analogue pins on the Leonardo make it easy to monitor the battery project. I find that having the hardware serial ports (on D0 and D1)
voltage, so that I can use it as a power supply for the setup to run separate to the USB serial port makes it so much easier to debug and
untethered (away from power), and report battery voltage. upload. I can log status messages without interfering with the shield
communication. Its also got an extra 512 bytes of RAM, and this can
THE BROAD OVERVIEW be handy with web-related applications, because the amount of data
that gets pushed around can easily overwhelm an Arduino.
The final build monitors the mains power (via the USB power supply,
which powers the project) and also reports the battery voltage The WiFi shield used is based around the ESP8266 WiFi chip, so just
on the UPS shield. In the future, I might add a couple of inputs about any ESP8266 based shield or module should work, as long
to temperature sensors, so I can see how much the outages are as its running the AT-command firmware. The sketch is quite long,
affecting the fridge and freezer. so it is not included here, but it first sets up the module to connect
to an access point. It then monitors the two analogue inputs, and
The other half of the project is monitoring. We have created a small uploads a message if the input voltage changes (or about every ten
Android app that looks at the data approximately every 30 seconds, minutes even if there is no change). An update is reported if the
and gives a notification if something has changed. battery voltage drops while its not charging, or if it increases while
its charging. This helps to avoid unnecessary reports if there is a bit
The data can also be accessed from a browser, so you dont need to of jitter on the battery voltage. The flag is set so that an upload occurs
use the app to view the information. on the first time through loop.
I had a look at two IoT services, both of which could easily be PARTS REQUIRED: JAYCAR ALTRONICS
accessed with simple HTTP GET methods that an Arduino can handle. 1 x Leonardo XC-4430 -
The first was dweet.io, which is very easy to use; you dont even need 1 x WiFi Shield XC-4614 -
to set up an account to upload data. Unfortunately, the free version 1 x Battery Charge Module XC-4502 Z6388
is not very secure. There is no authentication on the messages, and 1 x 5V Boost Module XC-4512 Z6366
not only that, but the free messages are also posted to a page for all 1 x Single AA Battery Holder PH-9203 S5026
to see and with enough information that anyone could upload spam 1 x Rechargeable 14500 Battery SB-2300 S4979
messages. 2 x 10k0 Resistors RR-0596 R7782
I then looked at SparkFuns Phant based services. This is a bit more Youll also need prototyping hardware such as a breadboard and
complicated and requires a sign-up, but it also requires a private key jumper wires. Note: Were showing actual quantity required, part
to post data (though anyone can still view the data). This sounded numbers may relate to a pack.
good enough to me.
BUILDING THE CIRCUIT
Since we're using plain HTTP instead of HTTPS (the Arduino would
really struggle with processing HTTPS), there is a chance the private The WiFi shield plugs straight into the headers of the Leonardo, just
key could be discovered, as its not encrypted. Another advantage of align and fit firmly. Then we can start wiring the battery charging
Phant is that it timestamps every message, so we can go back over module, and the 5V DC-DC controller. You can theoretically build this
the data and see exactly when the power goes on and off, and what circuit without the resistors, but they provide some valuable current-
the battery status is. limiting should something go wrong.
TX RX G 5V
We just made sure that my stream was visible and it only had one
field. If there is more than one field, then all of them need to be
3V3 G EN AD D
5V
G
RST
Given that the fields can be strings, this gives enough flexibility in the
messages we can create.
-
-
+
+
When its successfully set up, there will be a public key, a private
key and a field name. We need all of these in the Arduino sketch to
upload. There should also be a link from the form:
http://data.sparkfun.com/input/[publicKey]?
private_key=[privateKey]&powerstatus=[value]
-
-
+
This link can be used to test data upload to the server, and retrieving The AA battery holder provides a convenient connection mechanism
the data can be tested with: for the rechargeable Li-ion battery.
It's important to note that the DC-DC converter module and battery
http://data.sparkfun.com/output/[publicKey].csv
charge modules have solder tabs rather than pins. You can create
pins by soldering cut-off component legs (or tinned copper wire) -
then they will work on the breadboard. Alternatively build this directly
You will understand that we dont want to put our private keys in the onto a prototype shield.
links above! I found it was necessary to test both the upload and
download links, to make sure they were working right. Note: Double check your wiring to ensure theres no errors. Li-ion
batteries under short circuit conditions can be very dangerous.
With the hardware all set up, I wrote some basic code to get a few
AT+CIPSEND=77
readings. When coding my own setup, I just output these into serial
GET /input/[publickey]?private_
monitor whilst I worked out what to do with them.
key=[privatekey]&powerstatus=
AT+CIPSEND=11
void setup() { POWER%20OFF
Serial.begin(115200); AT+CIPSEND=38
} HTTP/1.1
void loop() { Host: data.sparkfun.com
Serial.print(Input:);
Serial.println(analogRead(A1)*5.0/1023);
Serial.print(Battery:);
The AT+CIPSEND command says that we are sending data. The data
Serial.println(analogRead(A0)*5.0/1023);
follows, and then says we want to get the resource listed. Ive split
Serial.println();
it into three sends so that the actual content (the middle send) can
delay(300);
be a variable that can be changed. Note: the message is per cent
}
encoded, as spaces in the middle of URLs will confuse the server.
The server should respond with a HTTP header (which says thins
I discovered that an easy way to test if the power is on or off is to like whether the request was able to be processed or not), followed
compare battery voltage with input voltage. If input voltage is higher, by the data, which is the same as what goes to a web browser
then it is okay; if it is lower, then the battery isnt charging and there for display. In this case, we just look for 200 OK, which means
we can safely assume that theres no longer outside power. everything worked. If this is done in a browser, all wed see is the 1
success. The +IPD part comes from the WiFi shield and indicates
There are five things you might need to change to customise the incoming data.
sketch to your own setup, and they are all set as constants at the
start. They are the WiFi SSID and password, the private and public
+IPD,460:
keys of your stream, and the field name. The first two lines are
HTTP/1.1 200 OK
obviously your SSID name and password, and the rest are for the
Access-Control-Allow-Origin: *
Sparkfun Phant service configuration. See the sidebar for a quick
Access-Control-Allow-Methods: GET,POST,DELETE
guide on how to do this.
Access-Control-Allow-Headers: X-Requested-With,
Phant-Private-Key
#define SSIDNAME SSID Content-Type: text/plain
#define SSIDPWD SSIDPWD X-Rate-Limit-Limit: 300
#define HOSTNAME data.sparkfun.com X-Rate-Limit-Remaining: 298
#define HOSTPORT 80 X-Rate-Limit-Reset: 1494054685.047
#define PHANTPUBLICKEY [public key] Date: Sat, 06 May 2017 06:59:41 GMT
#define PHANTPRIVATEKEY [private key] Transfer-Encoding: chunked
#define PHANTNAME powerstatus Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970
00:00:01 GMT; path=/
Cache-control: private
a
The sketch effectively does the same as fetching a page in a
1 success
web browser (the same as http://data.sparkfun.com/input/
0
[publicKey]?private_key=[privateKey]&powerstatus=[value] above).
To do this at the Arduino level, open a TCP connection to the server
listening on port 80 (these are the commands the Arduino is sending
to the ESP8266 chip on the WiFi shield): After that, we mark that the upload was successful, and the server
will close the connection because we didnt send any more data.
Apart from that, the sketch just has a small timeout so that its not
AT+CIPSTART=TCP,data.sparkfun.com,80
trying to work constantly, and some debugging messages to the
serial monitor.
The feed is there for the taking, so we can easily integrate simple monitoring. We have
provided a simple Android solution, as well as a web-browser monitor. The code for the
Android app, and the HTML monitoring page are provided as part of the resources package.
It's important to mention that you can simply view the stream on the public Phant service,
by visiting the Phant website with your custom URL. This requires no additional coding,
monitoring, or anything else. It's not terribly convenient though.
Where it is more useful however, is in debugging. At least you can easily see if data is reaching
the Phant server. If not, your issue is probably in the Arduino. If it is, and your monitoring app
isn't picking it up, the issue likely rests with your monitoring system.
For those of you using an iPhone, you know that rolling a quick iOS app isnt usually feasible
unless youre a developer and relatively familiar with the process.
On Android however, its much easier. Ive tried a few tools for putting together Android apps,
but the easiest for me has been RFO Basic. The compiler is a completely separate tool, but
it works well enough for me. Most of the apps Ive created are simply linking an input to an
output in a handy interface (eg an on screen joystick controlling a robot via Bluetooth). In this
project, the app sits there and checks the feed on the Phant service repeatedly, and then
Power status is displayed, along with notifies me if there is a change.
manual refresh / hide options.
The app starts by reading a URL from a config file called phantmon.txt. If the file doesnt
exist, the user is prompted to enter a URL, which is saved. The main graphics routine draws
four rectangles scaled to the screen size a title, the retrieved status, a refresh button, and
a hide button. The colour coding of the status box uses green for latest update okay, yellow
for refreshing, and red for latest update not successful. A refresh occurs every 30 seconds or
when the refresh button is pressed.
http://data.sparkfun.com/output/[publicKey].csv?limit=1
The limit=1 parameter reduces the amount of data we need to process, and returns just
the most recent update. The CSV file is parsed by looking for the first LF (to skip the column
header), and then the first comma after that, and then it record everything in between. The
CSV data looks like this:
powerstatus,timestamp
POWER OFF,2017-05-06T07:09:55.040Z
In this particular case, POWER OFF is the string we are looking for. This is compared to the
last update received, and if it is different, a notification is displayed. If the Hide button is
pressed, the app runs in the background, still checking the status every 30 seconds, and if a
The app will display a notification if change occurs then it raises a notification, which can be seen in the status bar.
power status changes.
I also wanted to be able to keep an eye on the power status while Configuring A
Phant Stream
I was working on my computer, so I set up a small standalone html
page that has some JavaScript to do the same job as the app:
Update Status
Fill in the form (only title and fields need to be entered):
It uses the JSON output of the stream instead of the CSV output,
as JavaScript can handle JSON easily. As per the app, the data is
checked every 30 seconds, and if a change is detected, a pop up
message is triggered. The button can also trigger a manual refresh.
Even without the backup battery system, the Leonardo and WiFi
shield could be used for logging data to the Phant server. Looking Click save, and note values in the page that appears. If you
at the other streams that are available on the Public Streams page, have forgotten the field name, use the public URL to display
there are quite a few weather stations running on Phant. In my the stream, and the fields will be displayed. The important
case, Im going to add some temperature sensors to monitor the things you need to know to access the Phant stream from the
fridge and freezer that cause me trouble when the power goes off. Arduino are public key, private key and the field name. Anyone
This would be a great setup to have if you had a fridge (or any other with the public key can view the data, and anyone with public
critical equipment) running off a solar system you could know if and private keys can upload data.
the solar is working or not, even rig up the temperature sensors to
know if the fridge isnt working, or even record solar battery voltage
and charging, to know how its performing. Most of this information
doesnt need to be checked by the app, but just uploaded as a stream
for graphing.
WANT MORE? Youre done! Now youre ready to push updates to a PHANT
For more detailed instructions, download files, stream. Its a good idea to download the link the file will be
or to discuss this project, visit: JSON and can be edited. You need to keep these details safe. If
https://diyode.io/001ykxw theyre lost, you may lose access to the stream and youll have
to create it again.
AUTOMATED GARDEN
SPRINKLER SYSTEM
CONTRIBUTED BY THOMAS JACKSON
Electronics and Software Engineer from NSW, AU.
The water control solenoids have to put up with The under-house installation is relatively straight forward,
humidity and temperature fluctuations. with several multi-core cables running to the solenoid bank.
U
sing a Raspberry Pi, an OpenSprinkler breakout controller, Were definitely onboard for using technology to save time, and this
and a little ingenuity, Thomas has created an intelligent IoT- certainly reclaims some time that could otherwise be lost. What
connected watering system to keep the garden watered year- made you embark on your automatic garden watering project?
round. Although the garden may not need as much water in winter
(as compared to summer), in Australia we can certainly go weeks or Well Im rather busy, so spending 30 minutes watering the garden
months without significant rain, so letting technology handle this task with a hose isnt a great use of my time. A sprinkler system on a
makes a lot of sense. standard timer doesnt really account for the seasons either, so its
easy to over- or under-water everything. Over the years, Ive gained
This installation has been used for in-ground watering, and can easily some experience hardware interfacing with Raspberry Pi in a few
adapt above-ground sprinklers, drip-tube; just about any irrigation different projects, so I figured Id apply my IT knowledge to a little
method. The system is equally suited to planter-pot micro-spray and home automation. I understand Python well, so I thought Id give it a
other methods to keep your pots from drying out on a hot summer go. It ended up working so well that I set one up at my parents house
day, which can happen in just hours. too! They're both working really well.
You know its a success when someone else asks you for one too! It definitely sounds like the system is working well without the need
How have you setup the network topology? for sensors. Was there much homework done before deciding on
using an OpenSprinkler Pi (OSPi) hardware?
I setup a web server to do much of the thinking; the Pi basically
then polls the web server and does what its told. I wrote the Python Its a proven piece of hardware, and by using the pre-rolled OSPi
for the Pi from scratch. Theres some software with the OpenSprinkler hardware you can almost get away without coding if you want to.
that I could have made use of, but I really wanted to roll my own. It didnt quite do what I wanted, so I wrote my own code, but thats
I integrated it into an existing web server infrastructure that Ive not entirely necessary either. The major benefit is that the GPIO on
developed over time, so I cant really share the PHP code itself; but I the Raspberry Pi breakout to a whole lot of switched outputs; theyre
have included a sample XML response that the server produces, and capable of driving the water solenoids directly from the board, so the
the Python code that runs on the Pi. The web server also polls the hard work is done for you. It comes in a neat case, ready to roll with
BOM (Bureau of Meteorology) data feed (available in JSON format) your own Pi. Then wiring is simple, theres virtually no prototyping
for rain forecasts for my area. It doesnt really matter if the forecasts involved at a hardware level. The OSPi basically switches 24VAC,
arent 100% accurate the plants arent going to mind if we get which is common in watering solenoids; so the actual watering
10mm of rain instead of 20mm of rain! hardware you choose is relatively flexible.
This seemed like a logical choice for the network setup. The live Removing the hardware trial and error, and focusing on the code can
web server is data-centre connected, so its virtually guaranteed to definitely save time. Did it take long to get everything installed and
be online all the time. It also provides a high speed connection for working the way you wanted it to?
making requests to the BOM data feed. The Raspberry Pi can then sit
safely behind my home firewall, and connects to the web server for The bulk of my time really went into installing the sprinklers
updates (I setup private API authentication over HTTPS, so its secure themselves, digging trenches, and that sort of thing. Its back-
too). If, for some reason, my home internet connection goes down breaking work digging trenches sometimes! My Python code isnt
and the Pi cant connect to the server for an update, it just keeps going to win elegant code of the year or anything it was done
going with the previously stored programme. mostly after a day of digging but it works well and hasnt really been
modified since I first wrote it.
Thats a great idea, we love the BOM polling to check the probability
and amount of rainfall! It could also easily be adapted to incorporate Sometimes function is all you need. Your code is still commented and
any local water-restrictions if (or more accurately, when) we see is reasonably clean weve seen much worse! Thanks for taking us
another extended drought here in Australia too. If the Raspberry Pi through your project. Is there anything youre currently working on
can run autonomously, you must be storing data somehow. How did that you can briefly share?
you handle that?
My next project is probably whole house sound. I want to put
I used the SQLite library for data storage. It is lightweight but powerful speakers in the ceiling of most rooms and have multi-zone audio with
enough that it doesnt make sense to try and roll my own storage a phone controller app or the like; something like Sonos would make
system. The XML basically gets processed into SQLite database, then it easy, but its much more fun to try and roll my own!
even if the hardware restarts from a power outage or something, it
can pick up right where it left off. Definitely the journey is the fun part for sure. Good luck with the
project, we look forward to hearing more about it in the future.
Catering for a restart is a wise move you dont want a bug in the
system turning the sprinklers on for hours because it got a little GOT SOMETHING TO SAY?
confused! On the topic of over-watering, have you incorporated any To leave your comments or download the code visit:
moisture-sensing technology into the system, as a second measure https://diyode.io/001qyds
to help avoid that from occurring?
Direct from
the Community:
Some Amazing Creations!
Have you ever been using your Oculus Gear VR Headset and had
to pause to wipe the lenses? Shane has, and hes come up with a
clever solution to this real annoyance. Using a small fan, battery
power supply, and a 3D printed case, this nifty device clips onto
the headset to create a low pressure air flow into the top vent.
The air flow is even low enough that you wont feel it on your eyes.
Now the VR skies are clear for Shane!
grbl compatibility. Hes now cutting his own path, Y-Axis motor
Ribbon cable
using his own controller and code! X-Axis Motor + end stops
metal lips facing outwards
Theres no better way to learn about coding and DIY projects than doing one that relates directly with
your interests. Jeff loves archery, and decided to build a self-firing bow! An Arduino Uno controller
is used to sense position switches and control a servo and motor controller module. The motor
controller drives a 12V DC motor, on a seperate power supply, to draw the bow. This also operates
the stepper motor to open and close the trigger. Also thinking about safety, two keyed momentary
switches were added to the design. One must be held to operate the bow, and the other needs to be
pressed to make it fire. We hope Jeff hits his project target with this one!
PROGRAMMABLE
USB BUTTON Andrew from NSW, AUS
I CAN
HACK THIS!
I WONDER IF THIS
... A LITTLE WILL WORK.
EXTRA CODE...
HOORAY!!!
IT WORKS!!
CLICKED THE
LINK - DID IT
WORK?
CAN YOU
DELIVER MINE?
HAHA! I MADE
ONE, I THINK?
1,207,485 LIKES
- WOW! IT'S GONE VIRAL!
I WONDER WHAT
THE LIMIT OF THE
MACHINE IS? COULD BE WORSE...
Plug In USB
3
Install Free Software
2
Includes 48-page project guide, Arduino compatible board, LEDs,
buttons, servo, sensors, resistors, breadboard, jumpers, and more.
Works with Windows, Mac, and Linux! www.tron.cc/expkit
Check out our huge range of locally-designed boards, sensors, modules,
displays, and accessories for Arduino, Raspberry Pi, ESP8266, and ESP32