Read more

#MicroPython: Home Automation using Blynk connected to a WiPy 3.0 / 2.0

This time a quick tutorial to control your WiPy 3.0 / 2.0 or an ESP32 using Blynk.

Blynk is the most popular mobile app for the IOT. Works with anything: ESP8266, Arduino, Raspberry Pi, SparkFun and others.

I found a library to connect MicroPython to Blynk but it is only compatible with the WiPy 1.0. Thus, I modified it and made it compatible with the WiPy 3.0 / 2.0 and with the ESP32 running MicroPython. If you do not have any idea about MicroPython, I recommend you to read this tutorial.

This is what I will try to accomplish in this tutorial:

  1. Install MicroPython (if you are using an ESP32, otherwise it is already installed on your WiPy)
  2. Connect the WiPy or the ESP32 to Blynk

Let's start! but first the code:

Python Code:

Micropython Jupyter

Read more

#MicroPython: Programming an ESP using Jupyter Notebook

I was looking at my last articles about MicroPython and my new articles about Jupyter and Docker, and I thought if it is possible to make a mix between Jupyter and the ESP boards. I use usually Visual Studio Code to program the ESP but for analytics I use Jupyter. I looked if it was possible to connect the Jupyter kernel to the ESP using the serial port and: Yes!, it is possible. This can be a great tool to teach kids to access data from connected sensors and analyze it using a browser with Jupyter.

This is what I will try to accomplish in this tutorial:

  1. Install MicroPython
  2. Install the Jupyter Kernel:
    • on a host PC
    • inside a Docker Container
  3. Connect the Jupyter kernel to an ESP32
  4. Use a ST7735 display using Jupyter
  5. Get data from sensors

Let's start! but first a video example:

Happy new year 2019 min

Read more

Happy New Year!

Out with the old, in with the new! Happy 2019!

It's been a two years now since I started this blog. It's a hard job to maintain it up-to-date but I still have fun writing and coding for this purpose! I hope the next year will be better than this one! :)

This post includes a new video for happy new year! The video combines some of the MicroPython code, that I've published this year. I'll be uploading the repo to GitHub in the next days. But, in the meantime enjoy the video, and check the MicroPython projects here!

Docker Portainer

Read more

#Analytics: Portainer for Docker Management

Portainer is a management UI which allows you to easily manage your different Docker environments.

This is what I will try to accomplish in this tutorial. You will be able to:

  • Run Portainer for Docker management on Windows, Linux and on a Cloud platform
  • Start container with a pre-defined admin password, in case you are on a public network

Micropython vscode min

Read more

#MicroPython: Visual Studio Code as IDE

Quoting the official MicroPython's website:

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.

Besides C++ and C, I use MicroPython to program microcontrollers, especially the ESP32/ESP8266 types. These two microcontrollers are compatible with MicroPython and it is easy to integrate sensors and actors programming using this language. I wrote a tutorial about installing MicroPython on the ESPs, as well a lot of articles about these microcontrollers and MicroPython. This is an update to the "Getting started with MicroPython": I am changing from Atom to Visual Studio Code (VSCode), and using the PyMakr extension, it is possible to program and debug MicroPython on VSCode.

Marry christmas banner min

Read more

Merry XMAS and Happy 2019!

LeMaRiva|tech wishes you a Merry Christmas and a Happy New Year! To celebrate I made a video using the Xmas-lights from last year, but this time I connected the ESP32 to a Jupyter kernel to control the lights. A new Jupyter-ESP32 tutorial is coming soon. In the meantime, you can track Santa and spend time with your family!

Python Code:

Inkdrop tech

Read more


Hi there! the guys at InkDrop need some stars on GitHub! Follow the project and stayed tune! What? You don't know about! Ok, no problem: Here you got a description!

Docker Repository:


InkDrop is an open, easy-to-use and uncensorable social network. It is an open source project and can be considered the blockchain community’s answer to the major, privacy invading platforms we depend on today.

Today’s social networks are centrally controlled & moderated and they don’t pass back the proceeds to the creators. They rely on business models that are irreconcilable with user privacy and network access is blocked in many countries.

What makes it unique is that it runs fully decentralized on the Ethereum Blockchain and IPFS, which means that no data or content is being stored on any private servers. This is the promise of the new Web (Web3), where the network belongs to its users.

The integration of the native cryptocurrency Ether, is being used to incentivize fruitful user behavior and enable self-regulation of the network. Ultimately, the ones who advance the network as a whole are the ones that profit from it.

The social network is accessible via a user-friendly web app on and you can fork the open source code on GitHub.

Jupyter Docker

Read more

#Analytics: Docker for Data Science Environment

Today, I am opening a new section on my blog, and this time it is about analytics. As you may know, I've been working in research on IIoT and analytics for the last years, but up to now my blog has only shown my hobbyist projects. I want to change the focus of my website a little bit and add something about data analytics, machine learning, Docker technology etc. Everything that I will publishing in this section is not new. There are many tutorials and great YouTube videos that explain these topics too, but I am going to focus on building an end-to-end data science project using some of the projects that I made using MicroPython and Android Things as sensors, using Docker and the Google Cloud Platform.

This post is a short guide for using Docker as an environment for data science. Docker allows you to almost say goodbye to OS troubles and welcome to portability!

Docker logo
Fig. 1: Docker

One of the most time consuming and annoying part that you have when you try to share your work with your co-worker is to install and setup all libraries and packages of your environment, ie. if you've developed some cool algorithm or pipeline to process data and you want that your co-worker does the evaluation process, he or she needs to install all the libraries that you've locally (or in an environment) installed. You can also add as a problem, that your co-worker needs an specific version of a library that is not compatible with your code because it is an old version. Or, he/she is working on Windows and you are on Linux and you cannot find the right libraries to install on Windows. Then, your new friend should be Docker! and as I said before, say goodbye to OS troubles and welcome to portability!

seed fusion studio

Read more

#Reviews: Fusion

On August I was contacted by Ben from Seeed Studio to review the Fusion service. I received a coupon, which could be used only to order PCB.

To define the Fusion service, I take this text from its website:

Seeed Fusion Service offers one-stop prototyping services for PCB manufacture,PCB assembly and other electronic and mechanical customized services such as CNC Milling, 3D printing and PCB layout services.

I didn't have at that time a design but I had something in mind that uses communication technology. I was experimenting using LoRa technology and I thought, I could managed to design a board that includes an ESP32, GPS, IMU, air quality sensors and datalogger together. The results is the BikeTracker board. I sent to Seed Fusion the board revision v1.0 (the actual revision is v1.4).

Note: Revision v1.0 was a quick and easy test. I took the board modules that I had (GPS module, IMU module and etc.) and I put them together on a PCB. It was only a test to see, if that was possible. If you plan to make the BikeTracker, you should download the latest revision. All the sensors are now on a single PCB, but it is difficult to solder ;). I already ordered the new boards on other PCB supplier, and I am in testing phase now. Stay tuned to see the latest design working.

I use Eagle to design the boards. Eagle is now part of Autodesk, but it has still a free limited software version for hobbyists and makers, which includes 2 schematic sheets, 2 signal layers, and an 80cm2 board area. That is enough for my design.

Teckin ESP32

Read more

#Zerynth: ESP32 & Google IoT Core - Part 2: Getting data from Smart Power Outlets

This part 2 of the tutorial will allow you to get data from the smart power outlets and send it to the Google Cloud Platform (GCP) throught the Google IoT Core and using an ESP32 programmed with Zerynth (Python). This data is not usually available to the user (directly, you need to use the power outlet application), and it is sent to the company servers.

If you want to check, if your power outlets are compatible for this tutorial, they should have the port 6668 opened. To check that:

>>> nmap <<ip-address>> -p 6668
Host is up (0.13s latency).

6668/tcp open  irc

If the answer is as shown above, the port is opened. If you don't have the nmap application and you are on Windows, look at the Nmap Network Scanning tool. On Ubuntu type on a terminal sudo apt-get install nmap.

Teckin ESP32

Read more

#MicroPython: Controlling Smart Power Outlets using an ESP32

Today there is a wide range of offer for home automation devices. A lot of sensors, actors etc. can be connected to the cloud and be controlled using Google Home, Amazon Alexa, your smartphone, etc. There are a lot of companies offering low cost devices, e.g. Sonoff, Tuya, Teckin etc. Most of these solutions are based on ESP32 or ESP8266, and all of them send data to cloud solutions usually deployed on Amazon services, and the data is only accessible using the Android/iOS applications. They can be also controlled using voice commands over Google Home or Amazon Alexa devices.

Nice, but... my aim was to control these devices locally (using LAN and not Wi-Fi) and send the data to the Google Cloud Platform (GCP) to make some analytics later. To be clear, when you use the Android/iOS application (or Google Home/Amazon Alexa) and you switch on/off e.g. a smart power outlet, the application connects with the company server in which the smart power outlet is registered and it sends the command. Then, the server sends back the action to your smart outlet. An exception is Amazon Alexa that sometimes connects directly to the devices (e.g. Belkin switches / Philips Hue), when you are at home on the same network (Wi-Fi). That's why you can re-program the Sonoff devices using Sonoff-Tasmota and then, you don't need a cloud connection anymore. However, if you use Google Home, this is not possible.

To sum up the aim of this post: Using this tutorial, you'll be able to control locally (LAN) most of the low-cost smart power outlets using an ESP32 programmed in MicroPython. Additionally, you can use the available data to do some analytics.

Note: Application like home assistant allows you to make this too, but you need at least a Raspberry Pi to run it, and that means power consumption. That's why, I like to do this with an ESP32 and of course, using MicroPython!

ESP32 LoRa

Read more

#MicroPython: ESP32 sending data using LoRa

LoRa (Long Range) is a patented digital wireless data communication technology. It was developed by Cycleo of Grenoble in France and then acquired by Semtech in 2012. Semtech defines the Lora Technology "as the DNA of IoT, which connects sensors to the Cloud and enables real-time communication of data and analytics that can be utilized to enhance efficiency and productivity".

To sum up, LoRa is a wireless data communication technology that enables very-long-range transmissions (more than 10 km in rural areas) with low power consumption. It uses license-free sub-gigahertz radio frequency bands as the 169 MHz, 433 MHz, 868 MHz for Europe and 915 MHz for North America. The technology can be divided in two parts:

  • LoRa: the physical layer,
  • LoRaWAN (Long Range Wide Area Network): the upper layers.

Here the code:

Python Code:

Raspad post banner min

Read more

#Reviews: RasPad - a tablet for open-source platforms like Raspberry Pi

This is my first review on a product that I bought. I hope you enjoy it! Advices and tips are welcome! Please leave me them in the comment section!

Update: I changed the title of the article from "#Reviews: RasPad - an open source tablet for Raspberry Pi" to "#Reviews: RasPad - a tablet for open-source platforms like Raspberry Pi". The table is a close-source solution for open-source platforms like Raspberry Pi, Beaglebone, etc.


At the beginning of March I supported the Kickstarter campaign called RasPad. I pledged for the Super Early Bird - RasPad which includes:

  • Power Adapter
  • RasPad Without Raspberry Pi

I didn't want the RasPad Kit because I had a Raspberry Pi B+ that I wasn't using.

The estimated delivery was May 2018, but as it usually happens with the Kickstarter campaign, it was delayed and arrived last week (12.09.2018).

RasPad kit!
Fig. 1: RasPad

Rpi zero rt performance min

Read more

#Zerynth: ESP32 & Google IoT Core - Part 1: Sending data to the Cloud

There are lot of tutorials about connecting the ESP32 to a cloud service, but I planned to connect these boards using MicroPython directly to the cloud. That means, I didn't want to use a hardware or software bridge. I wanted to use the Google IoT Core, but MicroPython doesn't support JSON Web Token (JWT), which is needed for the device authentication. I tried to write the library myself, but it didn't work, because of the needed dependencies and the small memory available on the ESP modules. But, I found Zerynth. Zerynth supports JWT and using it, it is possible to connect the ESP32 directly to the Google IoT Core. The company Zerynth defined its product as "the middleware for IoT and Industry 4.0" and the ecosystem was stable as far as I tested it. The IDE (Zerynth Studio) can be a little bit improved, but it works well enough.

Zerynth is neither free nor open-source but every new user gets a welcome pack with 10 Zerynth VM licenses with FreeRTOS (5 Starter and 5 Premium) for free (more info here). If you need to register more sensors, you can use the store to purchase the additional licenses.

Important NOTE: I didn't get any money to promote Zerynth, I just wanted to use Python to connect the ESP32 directly to the Google IoT Core and this was the only option that I've found. If you know another one, please comment this post or send me a message. Thanks!

RPI Xenomai Patched Kernel

Read more

#Raspberry Pi: Real Time System - Xenomai Patching Tutorial for Kernel 4.14.y

The website of Xenomai says the following about it Xenomai:

Xenomai brings POSIX and traditional RTOS APIs for porting time-critical applications to Linux-based platforms. When the native Linux kernel cannot meet the response time requirements of the application, Xenomai supplements it with Cobalt, a small real-time infrastructure which schedules time-critical activities independently from the main kernel logic.

Checking the list of supported hardware, the Raspberry Pi 2, 3 B(+) ARM micro (BCM2835) is included.

This tutorial is almost the same as the tutorial for Preempt-RT patching, but in this case, we need to patch the kernel. The patched Preempt-RT sources are included in the official Raspberry Pi repository. If you need a tutorial for patching the kernel click on the link above.