Taking time to build a triangle-grid clock

I like what's possible with triangles.

Playing with rectangular blinky grids is super fun, and I've made a weather monitor and a pulse-oximeter with those.

But there's something additionally awesome about the pattern possibilities with triangle pixels.

So when I saw a Hackaday post about building a clock display with LED triangles, I was hooked.

The short story is that I made it! It now lights up my living room with dazzling animations and a funky time display.

The longer story involves perseverance made possible by my coronavirus lockdown.

Is it Monday? My Pi has the answer

Keeping track of the days has been harder lately, it seems.

So I was excited to see a nifty blog post by Dave Gershgorn, where he described how he built a slick dashboard by attaching a screen to a Raspberry Pi computer. In fact, the Pi actually attaches to the back of the screen, out of sight.

I happen to be the kind of nerd who has a couple of Raspberry Pis around (in my case, some older Pi 3 model B's), so I ordered the recommended screen and followed Dave's great directions along with this ETA Prime video. If you're similarly inspired, just follow those guides.

If you're new to setting up a Pi, you might not realize that it doesn't come with an operating system. You need to install one on a micro SD card, and slide it into the Pi. I like to download the latest, recommended system from the Pi site, unzip it, and use the balena Etcher to flash the SD card.

One of the build steps that was unclear from the video was exactly how to attach the power lines to the Pi. For my Pi, the pins were these three:

Another tricky step was folding the ribbon cable so it fit nicely. Here's how I did it:

Then it was just a treat to see the tiny Pi desktop appear before my eyes:

I launched the Terminal application with the little cursor icon in the upper left corner, and in order to run the installation commands I increased the Terminal text size using Ctrl-Shift-+.

Once I got everything running, I installed MagicMirror, added a monthly calendar module, and played with the configuration settings to suit my needs. (I also toyed with the Javascript and the CSS because I couldn't help myself, but you certainly don't have to.)

Works like a charm.

Drawing arcs of circles

Maybe you've seen them: Rainbows of circles representing members of the U.S. Senate, House of Representatives, or all of Congress.

I wanted to make such a visualization to show the number of members of Congress who've tested positive for coronavirus and the positive tests among each party.

If not for the serious nature of the topic, it was a fun puzzle to solve.

The steps I took were:

  1. Figure out how many circles fit in each ring
  2. Calculate the positions for every circle
  3. Sort the positions to suit my needs
  4. Marry the positions to data

It turns out that once I established a) the number of circles in each ring and b) the size of those circles, I could figure out the rest with code.

You can play with the final results, or take a look at the code yourself. But here's the explanation:

Printing a pumpkin

There's something exciting about holding an object you previously only imagined — whether it's a freshly baked loaf, a tomato off a garden vine, or a printed plastic pumpkin.

I've had that feeling a lot lately, with a pandemic purchase of a 3D printer.

Rolling an object in your fingers that was previously just a digital file on the internet is ridiculously fun. It's even more rewarding if the thing conjured was something you — or your kid — dreamed up.

That's what happened with this 3D pumpkin. My daughter drew it late one night for an animation class assignment using the program she was learning, Cinema 4D.

And then we made it real.

Modeling the 2020 vote with Observable

I've been interested in how voter turnout might affect the 2020 US election and I've wanted to play with Observable notebooks.

So I blended the two projects, and you can play with my live Observable notebook that does those calculations.

The result is an admittedly super-simplistic model of how things might turn out. But you can increase the percentage of Republican and Democratic voters nationwide and see what happens!

Notably, even if Democrats were able to boost turnout more than Republicans — say 107% vs 106% — Trump still wins.

As written, it doesn't consider nuances such as regional differences in voting turnouts, swing voters, or faithless electors. (It does, however, account for the unique ways Maine and Nebraska divide their electoral votes). But I learned a lot in the process ... and there's more to come.

All my calculations are visible in the Observable notebook itself, and the initial data prep is documented in a Github repository. For good measure, I put all the raw data in my Datasette library.

Minneapolis race and ethnicity data by neighborhood, served with Datasette

Minneapolis police report stops and other incidents by neighborhood, so I decided to calculate the racial makeup of those neighborhoods to make some comparisons — along the lines of what I've already done for New York, Chicago, and Washington, DC.

This time, though, I'm using Datasette.

I've seen creator Simon Willison tweet about Datasette, and with some extra time on my hands I took a look. It's so impressive!

With Datasette, one can publish data online easily, efficiently (even free!) and in a way that allows others to explore the data themselves using SQL and feed data visualizations and apps. At scale.

How is this not in every newsroom?

(Simon, by the way, has offered to help any newsroom interested in using Datasette — an offer I hope to take him up on someday.)

Minneapolis neighborhoods

Once again, I've married US Census blocks with other municipal zones, this time the official neighborhood map of Minneapolis.

That data is now online, served up with Datasette.

And with some nifty SQL queries, bookmarked as simple links, I can list the race and ethnic makeup of every neighborhood by raw number.

Or by percentage.

Race and ethnicity data by Washington DC police zones

If you've got arrest or incident data from the Metropolitan Police in Washington DC, and that data is broken out by police district or public service area, you may want to compare it with the racial and ethnic makeup of the people living in those zones.

If so, this post is for you.

The US Census doesn't break out populations by police districts. But in DC and other large cities, census blocks serve as atomic units that usually do fall within police precinct boundaries. So by knowing which blocks are within which districts, you can calculate the populations. Unfortunately, block-level data is only available from the decennial count, so the latest data is from 2010.

This is my third spin at such data — I've also done New York City and Chicago

Chicago race and ethnicity data by police district

If you're trying to match Chicago police district data with the racial and ethnic makeup of those police districts, this post is for you.

The boundaries for police districts and precincts don't usually line up nicely with US census boundaries like census tracts or block groups. That makes it tough to compare incident and arrest data reported by precinct with the population of those precincts. 

But in bigger cities, census blocks are small enough to serve as atomic units that usually do fall within police precinct boundaries. So by knowing which blocks are within which districts, you can calculate the populations. Block-level data is only available from the decennial census count, so the latest data is from 2010. But it still should serve as a good measure — and a reason to fill out your 2020 census form online!

After doing these calculations for New York City, I put together Chicago's by request!

Sharing NYC Police Precinct Data

Note: This post was originally published April 29, 2011. I've updated it completely with fresh info. Also just did the same type of calculation for Chicago.

Anyone doing population analysis by NYC police precinct might find this post helpful. 

Back in 2011, I wanted to compare the racial and ethnic breakdown of low-level marijuana arrests — reported by police precinct — with that of the general population. The population data, of course, is available from the US Census, but police precincts don't follow any nice, relatively large census boundary like a census tract. Instead, they generally follow streets and shorelines. Fortunately, census blocks (which in New York, are often just city blocks) also follow streets. But there are almost 40,000 census blocks in the city.

So I used precinct maps from the city and US Census block maps to figure out which blocks are in which precincts. With that, the population data is just math.

The original stories, and the Google Fusion Tables where the data lived, are all gone to digital internet history. But I've recreated them here, and also updated the calculations — some precinct boundaries changed slightly, and those on Staten Island changed significantly with the addition of a fourth precinct on the island in 2013.

So here are the updated tables. The population data is from the 2010 census, the precincts are as they exist as I write this in June 2020.

Have at it.

2010pop_2020precincts.csv is the 2010 population breakdown within each precinct as they are drawn in June 2020. The column headings are cryptic, but follow the codes starting on this page, which is from this rather large Census Bureau PDF.  

• precinct_block_key_2020.csv is the Rosetta Stone for this project. It has two columns: each block's identifier, which the census calls "geoid10," and the precinct in which that block sits. Note that some blocks aren't in any precinct, usually because they're actually in the water. 

• nyc_2010censusblocks_2020policeprecincts.csv contains base-level 2010 Census data for each block, married to the precinct for that block. For descriptions of the population columns, follow the codes starting on this page or see pages 6-21 in the Census Bureau PDF

• NYC_Police_Precincts_2020.zip is the official police precinct map shapefile, downloaded from the city's open data portal.


I did my best to be accurate in computing the intersection of blocks and precincts, even generating precinct maps and inspecting them visually. But errors may exist. You can check my math in the Jupyter notebooks I used.

Census blocks generally fall nicely within precinct outlines, but they don't always. In particular, three blocks significantly straddle two precincts. If you're doing very precise analysis, you'll want to account for them:

• Block 360470071002003: An area near the north end of the Gowanus Canal in Brooklyn. About half is in Precinct 76 and half in Precinct78. Total people: 51

• Block 360050096002000: Mainly industrial. Half in Precinct 76, half in Precinct 78. Total people: 5.

• Block 360610265003001: This block consists of five similar-sized apartment buildings near the George Washington Bridge. The northern set of buildings are in the 34th Precinct, with part of one building in the 33rd. I put the entire block, and the 687 people living there, in the 34th Precinct. Looks like roughly an 80/20 split.


I originally did this work while at WNYC, using PostgreSQLPostGIS and QGIS. I was helped by the generosity and insights of Jeff Larson, Al Shaw, and Jonathan Soma.

If you find this information useful, drop me a note or post a comment below. I'd love to know about it.

Lockdown loaves

It's become a coronavirus cliché, but for this week's #MakeEveryWeek I made sourdough bread. 

The twist: I made one loaf in the oven and one in a slow cooker.

It all started with sourdough starter, specifically this guide from Quartz colleague Tim McDonnell. This was a great project for my teens, incorporating chemistry, biology, and excellent smells.

Next was this incredibly fun and detailed sourdough recipe from Kitchn, which makes two loaves and relies on two oven-safe pots. Alas, our family has but one.

We do have a slow cooker, though. Could I make one of the loaves in that? The answer is yes!