This blog now features Twenty Nineteen theme for WordPress. ❤️
Out of Office
For the first time in my life I set an Out of Office for my email accounts.
All my social accounts have been disconnected, I removed most of the social apps from my phone, my email is deactivated too.
See you in April 2019!
Take care, bye!
3-2-1: my 2018 in Review
I’m not a fan of new year’s resolutions but I took some time to reflect on the year that had just passed.
Three things I did well in 2018
I got married
In September Letizia and I got married. It was the very best day of my life and I had the chance to experience something unique. For the first time ever, all of my friends and family gathered under the same roof to enjoy a day together.
The preparation for the wedding kept us busy for the previous 7 months, but it was totally worth it. We’ll always cherish this memory together.
I got a coach
In august I started a professional development path with a coach, and it was really great. I realised how important it find someone who can help move up to the next level. The same way it happens in sports, a coach is not going to do the work for you, and it’s not giving you a magic potion. A coach helps finding new directions, opportunities, and answers, simply asking questions, exploring arguments, and focusing the conversation on what matters. A good coach does not leave any stone unturned and forces you face fundamental questions about yourselves. It was empowering and somehow liberating.
I picked up free-diving
In March I signed up for a free-diving course that ended in June. It was an amazing experience that opened up a new world of opportunities. I am fascinated by my aspects of this discipline and I definitely got hooked to it. I’m just at the very beginning of this adventure, and I can’t wait to developing it further.
Two things I did not well in 2018
I gained weight
I’ve struggled with my weight since I can remember. I’ve had these 10kg of extra weight on me for my entire adult life, but now getting closer to my 40s things won’t get any easier in trying to get rid of them. This year, on the contrary, I gained a few kilos more, and it’s not good.
I neglected photography
This year I did not take as many pictures as I wanted, and definitely not as good ones as I wished. For many months my camera collected dust on a shelf, while I was busy at something else. Photography has given me great opportunities in life, and amazing joy in the past. This year was definitely bad, on that aspect.
One thing I’ll focus in the next three months
In just 9 days I’ll take a sabbatical leave from work. Letizia and I will leave for three months, exploring New Zealand and the pacific islands. The plan is the hike and dive for the entire time, not bothering with anything else. I already deleted Instagram, Twitter, and Facebook from my phone. I’ll delete more apps as soon as the sabbatical kicks in.
I won’t post regular updates of the sabbatical, and until mid April 2019, this blog will fly in autopilot, with a few scheduled posts. I will probably read email once a week or so, or even less frequently.
I’ll have my camera with me, but I’ll select and publish photos only at the end of the trip.
Until then, take care, and be well!
Home Alone, Again
Chocolate Box – Arduino
The less complicated part of the whole project is the one that brings the WOW factor!
We are all so used to the wonders of the Internet, interconnected devices, screens, and even voice-activated assistants like Alexa that as soon as things move, we all stare in awe.
To achieve such an effect, with the box that self-opens and closes, only three pieces of hardware are strictly required: a microcontroller, and two servos.
Hardware List
- Arduino MKR1000.
- 2# Servo.
- Wires.
- Breadboard.
- Micro-USB Cable.
I went for an MKR1000 because it has integrated WiFi capabilities, and it was sitting in a drawer in my studio. Any WiFi-powered Arduino would actually do the job.
The servos are super basic too. I used two SG90 I had spare, but anything similar would do.
Wires and breadboard made the circuit easy to build and easy to tear down without any soldering or permanent connection.
The whole circuit is powered via a Micro-USB cable connected to a phone charger. This gives a handy 5V power supply for the servos without a dedicated power circuit.
Schematics
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-11-at-12-06-11.png?w=640)
Sketch
The sketch for the MKR1000 is available on GitHub, with all the other resources.
The code initializes the Wi-Fi connection and subscribes a topic on the MQTT Broker. It then moves the servos according to the message it receives.
Important to notice, in the code, how the two servos are mounted facing each other, so they move in opposite angles. Not a big deal, but it might look cryptic in the code.
In the next posts, I’ll show how the cardboard box is built and how to make the Alexa interface to sound nice when it receives the command. Stay tuned!
Previous posts: Intro, Overview, Infrastructure/Logic.
Chocolate Box – Infrastructure / Logic
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-06-at-10-45-29.png?w=809)
As mentioned previously, the central part of the project is represented by the Infrastructure and Logic, both performed on a Raspberry Pi 3, powered by Raspbian.
The two pieces of software that I’m using are Node-RED for the automation and Mosquitto for the signaling.
Let’s see them in details:
Node-RED
Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.
It allows representing every piece of your automation system with a node, configuring its behavior, and connecting it with all the other elements of your system. It also allows to program functions, manipulate the messages, set delays, and so on.
There are a ton of libraries to operate with many different devices and services. For this project I used just a handful of them:
Let’s see how they are interconnected and configured:
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-16-57-50.png?w=640)
Alexa-local node
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-17-01-54.png?w=182&h=72)
The configuration of this block is trivial. It’s just enough to give a name to the node, and it will be the name that Alexa will list in the discovered devices. After this node is deployed it’s necessary to give an “Alexa, discover devices” command to make it appear in the smart home section of your Alexa as a new device.
You can find the Alexa-local
node on GitHub or in the install palette on Node-RED.
Function “Open” node
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-17-02-01.png?w=140&h=64)
This function takes the message coming from Alexa and manipulates the payload to control the opening of the box.
The function is extremely simple:
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-17-29-42.png?w=366&h=112)
Delay node and Close Template node
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-17-02-04.png?w=347&h=86)
The first node introduces a 20-second delay before triggering the close template.
The close template is defined as follows:
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-17-32-18.png?w=294&h=154)
Once again, this is nothing fancy.
MQTT-out node
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-17-02-08.png?w=207&h=99)
As you might have understood, the only two messages that this node receives are true
, when it’s time to open the box, and false
, 20 seconds later, when it’s time to close it.
These messages are sent to an MQTT broker with the topic box_open
as follows:
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-17-36-05.png?w=371&h=172)
And that’s all it’s needed on Node-RED to make it work. Let’s now see how to tell the Arduino board to open and close the box.
Mosquitto
To interface Arduino to Node-RED I went for the most appropriate protocol: MQTT. This protocol requires a broker, a piece of software that receives signals from the many different agents, and dispatches them to the appropriate recepients.
And this is all you need to know to make it work on our Raspberry Pi. You simply install Mosquitto and make sure it’s configured as your MQTT broker on Node-RED and on the Arduino sketch. Voila!
Downloads and resources
You can find the Node-Red Flow, and all the rest of the resources on this GitHub repository.
It’s all released under GPL!
That’s all for today, in the next posts I’ll show you how to configure Alexa, how to build the box, the circuit board, and configure Arduino.
Stay tuned, and feel free to contribute!
Living Coral
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-07-at-16-02-35.png?w=640)
Pantone just announced the Color of the Year 2019: Living Coral.
Following my personal tradition, this blog immediately featured Living Coral in its palette.
Chocolate Box – Overview
The Chocolate Box project is made of many different parts, which are summarised by this diagram:
![](http://web.archive.org./web/20190119231540im_/https://lucasartoniblog.files.wordpress.com/2018/12/screenshot-2018-12-06-at-10-45-29.png?w=640)
Human Interaction
The interaction happens though Alexa, Amazon’s virtual assistant. In my case, any of the many Echo devices in my house can pick up the request and activate the whole flow.
Infrastructure / Logic
This part connects the signal coming from Alexa to the actuator device inside the box. The hardware for this part is a Raspberry Pi 3, and it’s powered by Node-Red for the automation system and Mosquitto as MQTT Broker.
Actuator
The actuator device is based on Arduino MKR1000, and two servos. All embedded into a cardboard box, disquised as a Christmas present.
In the upcoming posts of this series I’ll break down in details every block, and all the configs will be made available too.
Stay tuned!
Chocolate Box – intro
I built an automated chocolate box that sits nicely under my Christmas tree, and it’s operated by Alexa. It took me a few hours to figure out all the bits and pieces, but instead of working on a massive post with all the details, I’m breaking down this project in several pieces and several posts.
Stay tuned and enjoy the ride!
Oh, by the way, this is the final product:
I started this blog back in 2006 as a tech blog, so I feel this project a little bit as a return to the origins.
Turning a Bug into a Feature
I recently had a chat with my physiotherapist to fix the neck pain I have experienced more and more in the past few months.
He advised me to stretch my shoulders and neck. Better than a single 30-minute stretching session at the end of the day, he advised taking frequent 5-minute breaks during the day.
I recently discovered that the PIR sensors into Philips Hue devices require active movement, and not actual presence to be activated. This means that when I sit at my desk for an extended period of time, the sensor feels like nobody is in the room.
It was just enough to turn the timeout time for the sensor in my studio to 25 minutes, and I now have a perfect system that fixes both of m problems during the day: stretching my neck and shoulders and fully automate the lighting of my studio.
When I walk into the room, the lights turn on, and after 25 minutes after I leave the room, the lights turn off. When I’m working, if the lights turn off, it’s about time to stand up, stretch a little bit, drink a glass of water, and get back to work.
I also have a complicated node-red config that allows me to trigger on and off the sensor, so to avoid the awkward darkness during extended video meetings. But this is another story, so I’ll save it for another post.