10 SERVO 03.2016
QI have an Arduino Uno and a joystick shield that fits above it. Would it be possible for you to design a circuit whereby the shield could stand alone and
the joystick be wired to act as an on/off switch? Also,
could you point out how to use the setup with a sketch to
do the same thing (act as a switch)?
S. Browman
Montreal, Canada
AAs many of you know, “the devil is in the details,” so I asked a few more questions to find what would be needed for a workable solution. Our questioner
would really be happy with a digital output rather
than a dry contact relay or something opto-isolated,
etc. So, with that in mind, an LED driver circuit and a
sketch able to interpret the analog joystick values
from an ITEAD joystick shield is what I need to
create.
Hardware
Because part of this solution will be to light
some LEDs, the hardware needs to come first so that
the sketch knows where it is writing to. It is also
handy to have the outputs there to test the code.
This is the point where the designer needs to know
exactly what is going on.
I know that this is an ITEAD joystick shield, so
looking up that particular device tells me that I can’t
use just any digital output; the shield has seven
button outputs and two analog outputs. Digital I/O
lines 0-2 and 10-13 are available. Also available are
analog A2-A5, but to keep things simple, I will use
only the default digital lines rather than turning
analog ones into digital.
This design wants five digital outputs for the LEDs that
will correspond to the four “compass” extremes and the
center. I chose D0 through D2, and D10 and D11. Figure 1
is the schematic.
You should make a small printed circuit board (PCB) to
connect your Arduino to get LED outputs. I assumed that
you were using a standard Arduino, which uses 5V for its
circuitry. A 1K ohm resistor will allow about 3. 3 mA of
current to each LED, which won’t load your board down
much.
I calculated that current knowing three things. First
thing is Ohm’s Law, which states that I = V/R, or current
by Dennis Clark
Our resident expert on all things robotic is merely an email away.
roboto@servomagazine.com
Tap into the sum of allhumanknowledge and get your questions
answered here! From software algorithms to material selection,
Mr. Roboto strives to meet you where you are — and what more
would you expect from a complex service droid?
Ask Mr. Roboto
hile March is supposed to “Come in like a lion,” robot activities are being a bit
more “lamb-like.” I have not heard a lot from folks this month and I have to
admit, I have not been doing much either. Since it’s around my birthday, I tend
to be selfish about my time and do my own thing. Regardless, I did get a
question and I like to be of help to those in need, so here it is!
W
Figure 1.