Introduction

Most of the data journalism done throughout the world uses data collected by the government. The problem with that is twofold: That means data journalists are reliant upon the government to do their journalism, and what happens when the government doesn’t collect the data.

There are ways for journalists to create their own data – surveys, keying in data from documents or, for well funded organizations, hiring workers to collect it. Another way, which is lightly explored but potentially powerful, is using off-the-shelf sensors to collect that data.

Some major milestone projects for sensors in journalism:

  • Cicada Tracker: A WNYC project that made ground temperature sensors and a means for people to report that temperature to track the emergence of 17-year cicadas. Hundreds of volunteers built sensors and reported data to the project in 2013.
  • What’s in the Air?: The School of Journalism and Media Studies at San Diego State University used air quality sensors to report on air pollution in their city in 2014-2015.
  • Code Red: The University of Maryland’s Philip Merrill College of Journalism partnered with NPR to report on inequality in climate change, specifically measuring differences in temperatures inside people’s houses. They built temperature and humidity sensors to show what it’s like to live in Baltimore’s rowhouses during a hot summer.

What all three projects combine is some simple electronics, inexpensive sensors, basic programming and a giant bucket of creativity. The electronics and the programming are within reach of anyone willing to take the time to learn.

The creativity is the hard part.

What follows is an introduction to the electronics and programming parts of that equation. The creativity part is entirely up to you. The more you can think about how to apply these ideas, the better chance you have of finding that creative spark.

0.1 What to buy

The truth is this is an impossible question to ask because of several factors. 1. You will have your own ideas of what you’re going to want to do, and that will drive your decisions. 2. The technology available changes constantly and at a breathtaking pace. 3. The programming languages that glue this all together also change, albeit less quickly.

So what follows is an attempt to suggest things that could cover a wide variety of applications, but have been specifically chosen for this book and the project described in later chapters.

If you are planning an introductory classroom based course: The first half of this book uses the Circuit Playground Express. It’s an excellent, all-in-one beginner board that has a ton of features on it: lights, sensors, and can be programmed multiple ways. In a single board, you can program it with a visual, web-based interface from Microsoft called MakeCode that’s largely aimed at kids and you can program it with Circuit Python. This is great for students who have no experience with code: You can use MakeCode to do drag-and-drop programming to show what you can do and then switch to code to make the transition from the real to the abstract a smoother ride. There is a Circuit Playground Express Educator’s Pack that gets you 15 boards, 15 USB cables and some fun extras for, at the time of this writing, $350.

If you are planning a project: For project work, you are going to want more flexibility in a smaller form factor. For this book, we’re going to use the Adafruit Feather series, specifically the Adafruit Feather Sense, which packs a sensor array similar to the Circuit Playground Express, and we’re going to add the Adalogger FeatherWing, an add on to give us a real time clock and an microSD card reader for data logging. For that we get sensors, clock, data logging and external power management for $38 a board. Could you do this cheaper by buying separate sensors and building this yourself? Without question. But it would be difficult and time consuming for beginners. Time is money.

0.2 Why circuit python?

This is largely personal opinion, but there’s a solid argument here.

  1. Arduino has been the most visible small electronics platform for years and years. The one knock on it? It’s based in C, which is an especially difficult language for beginners to learn.
  2. Python is one of, if not the fastest growing programming language in the world right now. There’s reasons beyond this project for students to learn Python.
  3. Python is one of the more beginner friendly languages to learn. The syntax is largely straightforward and the fiddly parts are manageable with practice.
  4. It is much easier to see what your code is doing in Python versus the old Arduino code.

The downsides to using Circuit Python, in the interest of fairness:

  • Micro Python, and the Circuit Python variant, are relatively new.
  • The main consequences of that newness are that there’s years and years of code, message board and tutorial support for Arduino out there and there just isn’t that for Circuit Python … yet.
  • There’s fewer options for boards that support Circuit/Micro Python.

On balance, I believe the benefit of students learning some Python outweighs the downsides. Especially if this is the only chance they’ll have to learn a programming language. Connecting code to the physical world is a powerful way to learn it.