In honour of Citizen Science Day tomorrow, I’ve spent the last week or so tinkering with some of the functions of the Raspberry Pi Sense Hat, having discovered these scripts from the AstroPi project. I’d already played around a bit with building bar charts in Minecraft Pi, passing in an array of numbers to be visualised, but this is a more sophisticated take on measuring a set of readings and dynamically playing them back in visual form.
The Sense Hat is equipped with sensors for temperature, barometric pressure, magnetic field, humidity and orientation; the original SpaceCRAFT code has a data logger script to store a set of sample readings in a cvs file, and then a playback script creates a model of the International Space Station (ISS) to visualise changes in direction and orientation, with a cluster of thermometer-style tubes to show ambient temperature, CPU temperature, humidity and pressure.
What I’ve done here is heavily based on the astropidataplayback.py code; I’ve removed the models of the ISS, rocket, launchpad and stairs and built a plain snow-block baseplate and backdrop instead. Then I’ve used what were the thermometer-style tubes to display my bars; cutting out the glass block surrounds, placing the bars in a straight line rather than a cluster and making the bars wider. This took a bit of fiddling with formatting and location to get it all to line up neatly – the positions aren’t absolute but rather are set to initialise relative to the player’s position in Minecraft.
It took longer than I’d care to admit to figure out whether I was looking at the x or z axis … but I got there in the end!
Unfortunately Minecraft Pi doesn’t seem to let you play with day/night or weather cycles, as it’s permanently daytime and bright sunshine – that’s a shame because the other thing I discovered this week is this helpful tutorial on using the Open Weather Map API with Scratch to make a ‘weather window’, which led to me playing with some of the additional objects in the pyowm Python library to pull in weather status reports and forecasts. Now I’ve got a few basic API calls running it would be nice to have a Minecraft Weather Window…