In Assignment 1, you learned how to get data from
the Internet and visualize it. In this assignment, you’ll use your
also learn a bit of microcontroller programming in C.
The main goal for this assignment is to get comfortable with the idea
and process of sending data back and forth from a physical object (the
Photon) to a computer. You’ll do this via USB and/or the Particle cloud.
The learning goals for this assignment are as follows:
- Learn how to connect external components to your Photon;
- connect your Photon to your computer for two-way communication over
USB or the cloud;
What to do
You’re going to connect some extra electronics to your Photon. Have a
look at the list of parts that are available to see what
you can choose from. In addition, you can order extra parts if you
want from Sparkfun,
Adafruit or other places; note that “my parts
didn’t arrive” is not a valid excuse for unfinished work, though.
Look at the Resources section below. There are a lot of useful links
to help you there. Also be sure to check out the Resources on the
Start now! This is a more complex assignment than the first one.
I’m here to help but have limited time, so it’s in your best interest
to run into problem earlier rather than later!
- Attach a simple sensor to your Photon (for example, the light sensor).
- Print data out over the serial port.
- Visualize the data using either your visualization tool from the
first assignment (adapted and possibly improved) or another method.
In order to complete this assignment, you will need the
supplementary files linked to in the Resources section!
You’ll be graded, in part, on the quality of your visualization; so if
you were unhappy with how your first assignment came out, this is your
chance to improve it.
- Do the C-level work. Add a second sensor, visualize it too, and
improve the visualization to be more interesting/creative than a
simple line graph.
- Adapt it to work additionally with the cloud
Spark.publish()). This means:
- your B-level code should send data over the serial port and use
the cloud-based mechanism;
- and you should have two kinds of visualizations, one which visualizes
the serial port data and one which visualizes the cloud data.
(Note that the visualizations can be identical, just pulling from
different data sources. They can be two separate files or you can
have one file which displays both or allows the user to switch
between the data sources.)
- Do the C-level work and the B-level work.
- Add an output to your Photon. This could be as simple as an LED
(note the LED lesson in Resources) or as complex as the Serial
- Have your output react to your computer, via the USB serial port
or via the cloud (e.g. via
It can react independently to some computer- or online-based event
or to the sensors attached to the Photon. In the latter case,
however, the data must leave the Photon to the computer or cloud
before it returns to cause a reaction.
You’ll turn in your code via your Github repository. Along with your
code, upload a Readme.md file, which Github will then display with
your repository. Include:
- A description of your circuit: what sensor you used, how you are
reading the data from the circuit on the Photon.
- A description of your visualization: what libraries or techniques
you used, and what differences (if any) there are from your code in
the first assignment.
- A photograph of your completed circuit, clearly showing all of the
elements and their connections. Annotations would be nice but are
You will also demo your work in class.
If you can’t get your Photon connected to the network, you can skip
that part and use it unconnected. There’s more information
but the short version is to add the line
SYSTEM_MODE(SEMI_AUTOMATIC); at the top of your
.ino file. This
will allow your code to run right away without trying to connect to
the Internet. (Obviously any cloud functions such as
Spark.publish() won’t work if you use this solution!)
Learning about electronics
- Sparkfun is a great electronics supplier. They have some very nice
resources for getting started with understanding hardware:
- Sparkfun also has a nice-look set of Photon
- Adafruit also has many useful tutorials, especially under the
- Including a nice lesson about
- Bildr is a fantastic resource for doing lots of
things with electronics and Arduinos. For example, they have a great
tutorial on hooking up a light