Internet of beautiful things

So why buy an expensive 3D printer and not use it for good?

6 months have passed and I still haven’t learned any proper 3D modelling software. Too bad but working on it.

But hey, Ultimaker 3D printer offers API to control built-in LED lighting as I found on their forum, python script included. It took some experimentation but I managed to convert the relevant code to my favorite environment node.js by using request-digest npm package:

const digestRequest = require('request-digest')(config.ultimaker.id, config.ultimaker.key);
digestRequest.request(
{
host: `http://${ip}`,
path: '/api/v1/printer/led',
port: 80,
method: 'PUT',
json: true,
body: {
brightness: 30.0,
saturation: 90.0,
hue: 270.0
}
},
(error, response, body) => {
if (error) {
throw error;
}
    console.log(body);
}
);

I also just happen to have some hardware from the next European Unicorn Netatmo, looks like Apple products and works great as well:

This is more or less the code to read the outside temperature in my case:

const Netatmo = require('netatmo');
const config = require('../config/default.json');
const api = new Netatmo(config.netatmo);
module.exports = {
outsideTemperature() {
return new Promise((success, reject) => {
api.getStationsData((err, devices) => {
success(devices[0].modules.find(d => d.module_name == 'Outdoor').dashboard_data.Temperature);
});
});
}
};

These are the hardest parts besides the original idea which is to map (outside) temperature to HSV color space:

I map -50°C to +50°C range to the HSV circle counter-clockwise (just to be a little bit contrarian where it makes sense :)

So -50°C (= arctic cold) is red, 0°C (= freezing water) is 180° (cyan) and +50°C (= desert summer) is again red.

function mapTempToHUE(temp) {
const percent = 50 - temp;
return Math.round(360 * percent / 100.0);
}
setInterval(() => {
netatmo.outsideTemperature().then(temp => {
ultimaker.setLEDColor({
brightness: 30.0,
saturation: 90.0,
hue: mapTempToHUE(temp)
});
});
}, 60000);

This code runs on a local server with free software (thanx Richard, Linus, Ry and many others). It can be as simple as Raspberry Pi 3 or a bit more hardcore.

The result:

Next few lines of code will read CO2 concentration from the inside Netatmo module and blink the printer LEDs to make me open the window so that people feel better when they visit my lab. I do fine without too much oxygen anyway. Not sure why but never had problems with that :)

Of course the next iteration is to drill a hole to outside and then turn on a little pump when needed so that opening the window can be avoided. That’s manual work and should be prevented at all costs.

Computing is a bit magical indeed! 🚀

I’m thinking all the time if it’s possible to bring such experiences to more people. I think it is and that something else should be the first step in this direction. Stay tuned! There will be very slow and very steady updates.