11

(Marcin) #1
FORGE

Alexa-controlled wheel of fortune


YOU’LL NEED
ESP8266
microcontroller
Continuous
rotation 360
micro servo
(I used the SG90
from Olimex)
Wheel frame,
pointer, and stand
You could make
these out of wood
or cardboard if you
don’t have access to
a 3D printer
Micro USB power
supply
Like the one you get
with a Raspberry
Pi, although most
phone chargers will
probably work
Glue, double-
sided tape, or
Velcro, and some
small screws

There are quite
a few variations
of ESP8266, I
used the ESP8266
NodeMCU LUA
CP2102 WiFi wireless
development
board, this version
works fine with the
Arduino IDE

QUICK TIP


WHEELY GOOD
Print off a wheel design. You can either use the one
we’ve provided, or design your own.
Ours has twelve segments, but you can really
have any number you like. We picked twelve as it
meant it was divisible by three and four, so we could
get extra features on it like the ‘A–D’ and ‘Y/N/?’ in
even measure. Stick the segments to the 3D-printed
wheel or onto a piece of card, 10 cm in diameter. Our
segments were printed onto adhesive paper and cut
out individually, but you could just as easily use a single
design if using card.
Stick a servo horn (our servo came with a large round
one) onto the back, making sure it is central. There’s a
small hole in the 3D print to help align this.

SPIN ME AROUND
Push the wheel onto the servo shaft and check it spins
without interfering with the frame. You can glue it in
place for a more permanent finish.
Connect the servo to the ESP8266 so that the signal
wire (orange) of the servo goes to digital pin four,
and the positive (red) and ground (brown) go to the
corresponding 3.3 V and GRN pins next to D4.
We used Velcro to fix the board to the servo, making
it easy to remove for programming. Wind the servo
cable out of the way, round the servo itself, and you are
ready to program your wheel.

IN DISGUISE
We can configure the ESP8266 to pretend to be a
WeMo device. WeMo are a series of commercially
available lights and switches etc. that can be used for
home automation and can be controlled by Alexa The
real magic in this project is the FauxmoESP library. The
library, written by Xose Pérez (hsmag.cc/wIgBEG)


  • based in turn on a Python library written by
    MakerMusings: hsmag.cc/lzVBWu – allows us to fool
    Alexa into seeing the ESP8266 as a WeMo device that
    we can control using voice. The code on the following
    pages is based on Xose’s example code.


Firstly, we have to configure our Arduino IDE
to recognise and work with the ESP board. (If you
don’t have the Arduino IDE you can find it here:
hsmag.cc/cbJELY).
You’ll need to access the board manager from
Tools/Board options in the IDE (the board manager
appears at the top of the list of boards) and add
the library. Full instructions can be found here:
hsmag.cc/IgTabu.
You can select the version you install in the
board manager. At the time of writing, the current
version is 2.4.2; however, we had some issues with
Alexa finding the device with the current version,
and after some hunting around we found that if
you install version 2.3.0 it seems to work fine.
At this point, you can upload the blink example
code (examples are under the File menu in the
IDE) to the ESP8266 to test if everything is correct.
If the code compiles and uploads, then all should
be fine.

THE WHEEL OF FORTUNE
When you say the phrase “Alexa, spin the wheel,” the
wheel spins for a random amount of time, and when it
stops, the pointer will give you your fortune. We can also
use the wheel to give us a random number between 1
and 12 (so it can be used as dice for games), or letter
A–D (there are four in the author’s family, so this is a
good way to resolve disputes or to see who goes first in
a game). It also has a series of Y/N/? symbols, so you can
ask it questions, e.g. “should I go to the shops now?”

Figure 3
Fully assembled
3D-printed frame
and all the other
parts required

NO PRINTER, NO PROBLEM


If you don’t have a 3D printer, this could be made using
thin plywood or cardboard. Cut a piece of thick card
about 3 cm wide and 14 cm long. Fold over the card
90 degrees, 1 cm from each end, to make the back
plate, and cut holes in the back to take the micro
servo. Care will need to be given to make sure the
servo shaft lines up in the middle. Cut a circle about
12 cm in diameter, and cut out the middle, leaving an
empty circle about 10.5 cm. Stick this to the back plate.
Free download pdf