SCIENCE
Programming the MAKE Controller
Programming the MAKE Controller is easiest if
you’ve already worked in C. For a jump-start on the
C language, check out Practical C Programming,
Third Edition by Steve Oualline. After that, I recommend Peter van der Linden’s Expert C Programming:
Deep C Secrets.
To start programming the MAKE Controller,
download and install the source code and tools
from the Making Things SourceForge project page:
sourceforge.net/projects/makingthings.
You’ll need 3 things:
• The source code for the firmware
• The GNU ARM tools
• mchelper
Installing the tools can be a little complicated.
For help, check out the tutorial “Programming the
MAKE Controller” at makingthings.com/resources/
tutorials.
Once you’ve installed everything, try building the
“heavy” project that comes with the firmware. To do
this, open up a terminal (on Mac OS X or Linux) or
Command Prompt (on Windows), change directory
to the heavy subdirectory of the firmware source,
and type the command make. The code should
compile and create the file heavy.bin in the output
subdirectory. Upload this file to your MAKE Controller
using the mchelper program as follows:
• Open up mchelper, click Browse, and select the
heavy.bin that you just created.
• With the MAKE Controller plugged into your
computer’s USB port, short out the ERASE pins
on the MAKE Controller application board.
• Unplug the MAKE Controller and plug it back into
your computer.
• Quickly (don’t wait too long or the existing program may start running) click the Upload button
in the mchelper application.
• Following mchelper’s “Upload complete — reset
the power” prompt, unplug and plug in the MAKE
Controller again.
For more help, check out the resources at the
makingthings.com website, especially the discussion forum. If you’re into Internet Relay Chat (IRC),
be sure to check out #makingthings on irc.freenode.
net. You’ll find many of the folks from Making Things
there, and I lurk there from time to time myself.
140 Make: Volume 11
If you’ve made it this far, you’re ready to start
hacking your own code on the MAKE Controller.
Making the Weather Reader
I won’t make you look at (or type in) the entire RSS
Weather Reader program, but you can download it
at makingthings.com/projects/rss-weather-reader.
The Weather Reader code is based on the heavy
program that you just compiled. Make a copy of the
heavy source code directory and rename it Weather
Reader. Once you’ve done this, swap in my version
of the file make.c and modify it to suit your needs.
In the definitions and declarations at the top,
change the MY_IP and GATEWAY definitions to match
your network’s IP and gateway (router) addresses.
(Yes, those are commas in between the byte numbers instead of periods — that’s because these
values are passed as 4 separate parameters to one
of the functions.)
The weather fetching and display action happens
in the Serial Task() function. First, it turns on the
serial port at 9600 baud so it can talk to the LCD.
Next, it connects to the Weather Underground at
64.243.174.104, which is the numeric address for
rss.wunderground.com. It requests the weather
forecast using a GET request of this form: /auto/rss_
full/RI/Kingston.xml?units=both. Change this
call in your code to match your location. You can type
the string into a browser to see the raw RSS feed and
make sure you have the correct resource location.
Serial Task chews on the RSS feed, stores the
weather forecast into a message buffer, then
displays it on the LCD screen. After it’s displayed
it 10 times, it downloads and displays the weather
forecast again. Lather. Rinse. Repeat.
Once you’ve replaced make.c with your modified
version of my code, you’re ready to compile it and
upload it to your MAKE Controller, just like you did
earlier. The filename will still be heavy.bin, but it will
be in the WeatherReader subdirectory. Make sure
you’ve got the power connections in place, plug the
MAKE Controller into your network using its Ethernet port, and power it up. If all goes well, you’ll see
your weather forecast. Otherwise, look for me in
the IRC channel and I’ll do my best to help!
Brian Jepson is a contributing editor for MAKE, and the
co-founder of Providence Geeks, which holds monthly
geek dinners at AS220 in downtown Providence, R.I.