Easter weekend fun

3D Designs


Posted in Uncategorized | Leave a comment

BIPES loading optimizations

BIPES optimizations for faster loading. From 30 to 6 seconds 🙂



BIPES offline version for Franzininho – just load the HTML file and use it offline. Thanks Fabio Souza for the partnership (https://fabiosouza.org/) 🙂


Posted in Uncategorized | Leave a comment

Wired Android Internet access without Wifi or 4G connections

My wife Silvia has been doing a systematic study about biological effects of wireless technologies on human health for some time now. Some publications are controversial, but we like to take the precautionary principle. More information about her studies is available at the website http://celularesaude.org/.

She is also collaborating with the SlowPhone moviment, and they are gathering really interesting information and promoting live events with prominent scientists in this area, such as Dr. Magda Havas and MSc. Sheena Symington.

More information about SlowPhone can be found at their YouTube channel:


In that context, she asked me for some way to use our smartphones at home in “Airplane mode”, but still with Internet access, which means, a wired connection. First, note that there are some proprietary / commercial solutions on the market, such as Ethernet Adapters for Android and Apple devices. However, it is possible to build your own solution using low cost hardware, or simply using your PC, so no hardware purchases are needed.

One of the best solutions I found is based on the Open Source Software gnirehtet (https://github.com/Genymobile/gnirehtet). You can download and use it to share your computer Internet connection with your phone over a USB cable, or you can build a “little box” that acts as a wired router for Android devices.

For this “little box” project, we decided to integrate such a tool on a Raspberry Pi low cost single board computer (https://www.raspberrypi.org/products/raspberry-pi-4-model-b/), which costs about 35 US dollars or less and is easily available in many parts of the world.

Uniting these tools, we can create a small box that can be connected to the Internet using Ethernet cable and providing reliable and high speed Internet access to one (or several) Android device(s) simultaneously. You just have to plug the phone, and it will have Internet access on Airplane mode. We have also tested it with 3 simultaneous phones accessing Internet through the same “little box”.

By the way, you may remember the tethering technology, which allows you to share your mobile phone Internet connection (4G/GSM) with your computer. What we do here is reverse tethering, where the mobile phone uses another wired connection instead of sharing its connection.

Finally, using Voice Over Wifi (VoWi-Fi) technology, it is possible to make and receive phone calls with your operator mobile phone number without any wireless connection active! But there is a trick for that, at the end of this text….

If you are interested, here is how to prepare build such “little box” for you:


1. Get a Raspberry Pi and a SD Card

We have tested the system with Raspberry Pi models 1, 2, 3 and 4 (must be model B). Any will serve. You will also need a SD Card of at least 8GB that will be erased / formatted to load the embedded Linux that we will prepare for this application. You can also buy a case for the Raspberry Pi, or build a case with a 3D Printer.

Raspberry Pi options:


Raspberry Pi Pico and Raspberry Pi Zero cannot be used for this project.

2. Download the Operating System (OS) for the Raspberry Pi Computer

Using a computer with a SD Card reader, go to the website:


Download Raspberry Pi OS. We have used:

Raspberry Pi OS Lite
Release 4th March 2021

3. Write Operating System (OS) image to the SD Card

Detailed instructions here:


For Linux users, just insert the SD Card on your PC and run these commands (after the download):

unzip 2021-03-04-raspios-buster-armhf-lite.zip
sudo dd if=2021-03-04-raspios-buster-armhf-lite.img of=/dev/mmcblk0

Be careful and verify that /dev/mmcblk0 is really your SD Card device, otherwise you might lose important information!

4. Turn on the Raspberry Pi with a network cable connected and login

Remove the written card from your PC and insert it on a Rapberry Pi computer module. To set up the system, you will need a monitor and keyboard. Later these accessories won’t be necessary anymore.

Power on the Raspberry Pi with the written card and wait for the login prompt. If the Raspberry Pi is powered with an Ethernet cable, it will automatically connect to the Internet using DHCP (automatic network configuration). Use the keyboard to access the Raspberry Pi terminal with this login and password:

Login: raspberry
Password: pi

If the login is successful, you will see a command prompt like this:


After logging in, let’s start installing the required software.

5. Install RUST Language

The main component of this project is gnirehtet, which uses RUST Programming Language. So, we will install this language on the Raspberry Pi. Detailed explanation to install RUST is available here:


One quick and direct way to install RUST, is by issuing this command:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then, press 1 – Proceed with installation.

After some minutes, you will see:

“Rust is installed now. Great!”

6. Download required packages

Now we have to install some required software for our system. Still using the keyboard and the terminal (dark screen), run the following commands:

sudo su -

apt-get update

apt install adb

apt install git

Now, download gnirehtet source code with the following command:

git clone https://github.com/Genymobile/gnirehtet.git

7. Build the program

Before building the program, it is necessary to logout (exit) the current terminal session and login again. This will allow the environment to be prepared for the building process, specially due to RUST language installation. To logout, you can type exit and ENTER, or simply press Ctrl+D. Do it twice, until you see the login prompt again asking for login and password. After that, type the username and password again, and be sure to be logged in before issuing the following commands.

sudo su -

source /root/.cargo/env

cd /home/pi/gnirehtet/relay-rust

cargo build

After several “Downloaded” and “Compiling” messages, a “Finished” message will appear. If you got to here, congratulations, you have gnirehtet compiled and ready to use.

Now let’s test it!

8. Copy files to a common place

For easier testing, copy the built gnirehtet to a directory.

cd /home/pi/gnirehtet

cp relay-rust/target/debug/gnirehtet .

You also need to download the Android application that is automatically installed on the device to allow the reverse tethering to be setup automatically. You can build this App yourself, but for easier setup, you can use this prebuilt application by downloading it with wget download tool.

wget http://bipes.net.br/aroca/gnirehtet.apk

You can use the ls command to check if this file is present in the directory (folder).

9. Test gnirehtet

Enable Developer Options on the Android device

A few minutes ago we installed the program adb (Android Debug Bridge). Such tool is used to debug Android devices, and the process of reverse tethering need to issue commands using adb. In that way, USB debugging must be enabled on your Android device so we can proceed. This is done by going on the Android configuration menu, then clicking several times until you “become a developer” (More instructions here: https://developer.android.com/studio/debug/dev-options).

Enable USB debugging on the Android device

After enabling developer options, then we need to enable USB debugging. You will see this option on the new menu “Developer Options” that will appear on the configurations meno of your Android device.

After that, go back to the Raspberry Pi terminal and run:

./gnirehtet autorun

Turn on airplane mode of your Android device, and connect it to the the Raspberry Pi using a USB cable. Note that a data transfer USB cable must be used (cables for charging only will not work).

A message will appear on the phone asking to authorize USB debug. Permit it. You should now have full Internet access on your Android device using the USB cable, where data is routed by the USB cable and then by the Ethernet cable via the Raspberry Pi board.

And the magic is done!

Note that all these steps just need to be done once, as we were preparing our system. From now on, each time you want to use it, simply plug the cables (Ethernet to Raspberry, Power to Raspberry and USB between Raspberry and Android device and use!

Moreover, the system supports several phones / Android devices simultaneously using Internet shared by the Raspberry Pi!

10. Configure the system for automatic initialization on reboot

One last thing we have to do is configure the Raspberry Pi to automatically run gnirehtet when powered on. To configure automatic execution on initialization, edit the file /etc/rc.local, locate the last line, which will have the text exit 0, and before the last line add 2 lies as follows:

#(rc.local file will have several instructions - keep all of them)

cd /home/pi/gnirehtet

./gnirehtet autorun &

exit 0 #(this is the last line of rc.local - keep untouched)

If you never edited a file on Linux, use the nano file editor, by simply typing:

sudo nano /etc/rc.local

After doing the modifications and saving the file, turn off the Raspberry Pi, by uplugging the power adapter, and power it again. Finally, check if the system will work automatically after power on.

After these steps, you can move the device around your house and use where you prefer. No more keyboard or monitor needed!

10. Making and receiving phone calls on airplane mode

As mentioned, Voice Over Wifi (more details here: VoWi-Fi and here: Wi-Fi Calling (VoWi-Fi) ) technology allows Android Smartphones to make and receive phone calls using your operator mobile phone number over Wifi Network. Obviously, Wifi network relies on the TCP/IP protocol stack, so we can use our rever tethering system described here!

Unfortunately, there is a trick for that to work. VoWi-Fi check if you are connect to a WiFi network, a verification that is unnecessary, but implemented on the devices. The trick is to “lie” to your phone, telling that it is connected to a WiFi network, while the true is that it is connected to a wired connection!

In order to do that trick, one possible solution is to run FakeWifi application (https://repo.xposed.info/module/com.lemonsqueeze.fakewificonnection), which will simulate a WiFi connection, while, in fact, we are using a wired connection.

Final remarks

Everything we have done here, can be done on your computer also (Windows, Linux or MAC), so you can share your computer Internet connection with your Android device using a free USB port on your computer.

We have built three devices as described here and we are using this technology for about 4 months now (since December/2020). The system has been working reliably since then!

Finally, our many thanks and congratulations to the guys of GenyMobile (https://github.com/Genymobile/) for developing and sharing this awesome open source software: gnirehtet.

Posted in Uncategorized | Leave a comment

A Remote Microcontroller Laboratory

Even having several interesting and powerful electronics simulators, such as TinkerCad for Arduino, it is interesting to test and debug microcontroller applications on real hardware. With that in mind we have built a remote microcontroller laboratory, based on a set of PHP files that allow users to edit programas, compile and upload to a remote board, on a remote laboratory, and access the serial port of this board for debugging purposes and testing embedded systems. Basically, it runs a makefile. It is compatible with Arduino boards ESP32 / 8266 and also it would be easy to be used with mBed and other boards using the UF2 bootloader.

Functional demo:

Source code:

On 2021, it is being used to help a microcontroller course (in Portuguese):

Posted in Uncategorized | Leave a comment

Happy anniversary BIPES Project with 2000 users!

BIPES project started about one year ago. Its website (https://www.bipes.net.br) was made available on March 15th 2020 and the first github commit happened in April (https://github.com/rafaelaroca/BIPES_ui_testing/).

Since then, many interesting things have happened to the BIPES Project. Here are some curiosities – thanks to Google Analytics BIPES usage report:

– Today, BIPES is already used in more than 65 countries
– More than 2000 unique users have used / are using BIPES
– Average session time / time to build a program is 5 minutes
– Germany is the country with most users (1200), followed by Brazil (330)
– Qatar, Brazil, Panama and Czechia are the countries with higher average session time (48, 13, 12 and 11 minutes respectively)

These informations were obtained anonymously by Google Analytics by monitoring BIPES page hits. Note that BIPES does not require you to create a user account and does not store / analyse created programs. However, if you want, you can share the program you created using the share button.

Also note that BIPES stands for Block Based Integrated Platform for Embedded Systems, allowing block based programming for Raspberry Pi Pico, ESP32, ESP8266, mBed / STM32, Micro:bit, and any Linux based system, such as BeagleBone and Raspberry Pi 1, 2, 3 and 4. For the other boards, BIPES generates Python code for the MicroPython or CircuitPython firmware installed on the board.

BIPES is fully open source under GPL licence and does not require any software installation on the developer machine. Simply access BIPES website, build the blocks, connect to the board, transfer the program and run it! Moreover, as BIPES is based on standard HTML + JavaScript, it works offline! Load BIPES once, and it will run without Internet connection!

The figures show BIPES usage around the world by cities and countries.

bipes contries

bipes cities

Posted in Uncategorized | Leave a comment

The Fantastic Mr. Feynman

The Fantastic Mr. Feynman and one of the phrases I most like:

“We make no apologies for making these excursions into other fields, because the separation of fields, as we have emphasized, is merely a human convenience, and an unnatural thing. Nature is not interested in our separations, and many of the interesting phenomena bridge the gaps between fields.”

I also strongly recommend his book: Surely You’re Joking, Mr.
Feynman!: Adventures of a Curious Character.


PS.: Thanks Debora Milori for recommending this great documentary.


Posted in Uncategorized | Leave a comment

Web Serial now available in stable Google Chrome

As always, Gustavo Tamanaka (http://github.com/gtamanaka) brings great news.

Latest stable version of Google Chrome highlights:

“WebHID, WebNFC, and Web Serial have graduated from their origin trials and are now available in stable”



BIPES uses Web Serial since its very first / early implementation on Google Chrome, allowing direct access to USB devices such as Raspberry Pi Pico, ESP8266, etc, without the need of any plugin / additional software.

As Web Serial goes stable, there is no need to enable web experimental features anymore. Just open https://bipes.net.br/beta2serial/ui/, connect and create IoT / embedded applications from blocks using BIPES!

Posted in Uncategorized | Leave a comment

Timer and Threads on Raspberry Pi Pico with BIPES

Some days ago, Rudolf Schenke sent a message suggesting a block for threads on Raspberry Pi Pico. This site has a good explanation about threads on RPI Pico + MicroPython:

We implemented 2 simple blocks: one for timer and one for threads.

They can be used together, so we can get 3 tasks at once! Take a look at these 2 examples:

Example 1
Timer blinks LED with 222 milliseconds interval while main prints messages to serial console at each 1 second.

pico timer

pico timer

Example 2
Timer prints “Pico Timer” to serial console at each 500 milliseconds. Thread 1 prints “Thread 1” to console at each 222 milliseconds and finally, main prints “Main: xxx” each 2 seconds, where xxx is the number of milliseconds since the Pi Pico booted.

pico timer thread

pico timer thread

Example 2 Result

pico timer thread result

pico timer thread result

Posted in Uncategorized | Leave a comment

EasyMQTT with BIPES and ESP8266 – Quick demonstration


BIPES can send data to any MQTT server! However, if you do not have a MQTT server ready to use, just start with BIPES own MQTT server, called EasyMQTT, without the need of creating an account or
configuring anything more. Simply add the EasyMQTT block and use it!

EasyMQTT is a BIPES feature created by Caio Augusto Silva as a final paper of his Computer Engineering course at DC-UFSCar. Implementation details are available here:

http://www.bipes.net.br/papers.html (only in Portuguese, sorry)

Here are the steps to test it from from scratch:

1. Download latest MicroPython:

In this test, I used esp8266-20210202-v1.14.bin

Available here:

2. Get a board with ESP8266
For this test, I used NodeMCU from Amica (ESP8266) – the one shown at the beggining of this post

3. Check your device serial port address
Use device file manager if you use Windows or dmesg / lsusb / ls /dev/tty* if you use Linux

On my Linux machine, dmesg shows:

[263285.144051] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[263285.144052] usb 1-4: Product: CP2102 USB to UART Bridge Controller [263285.144054] usb 1-4: Manufacturer: Silicon Labs
[263285.144055] usb 1-4: SerialNumber: 0001
[263285.152678] cp210x 1-4:1.0: cp210x converter detected
[263285.154297] usb 1-4: cp210x converter now attached to ttyUSB0

So, in my case, my device is using /dev/ttyUSB0

4. Install esptool.py
If you still don’t have esptool.py, install it to upload the firmware to ESP8266. This needs to be done only once. You can download it here.

5. Erase anything in your board’s flash

esptool.py --port /dev/ttyUSB0 erase_flash

6. Write MicroPython firmware

esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash
--flash_size=detect 0 esp8266-20210202-v1.14.bin

Note: steps 4, 5 and 6 can be done using a graphical tool, such as uPyCraft

7. Create your MQTT program

Access https://bipes.net.br/beta2serial/ui/ and build the program as follows:

amica 1

In this example, the wifi network SSID is Termometro and password is Termometro too. The example updates the MQTT server with 3 variables each second. First a counter, from 1 to 100, second the milliseconds counter from the moment the board was powered on and third the ADC reading of ESP8266 builtin Analog to Digital Converter.

Direct access to program:

8. Test it!

Go to the console tab, select connect and choose your board serial port address. Remember that this feature only works on Google Chrome and you should first enable experimental web features as said on our last post (https://rafaelaroca.wordpress.com/2021/03/03/block-based-programming-on-raspberry-pi-pico-with-bipes/).

Click on the Run button or on the button “Run block based program” and monitor the results on console screen. You can also view real time updates on the EasyMQTT tab.

9. Access the data sent to the cloud (MQTT Server)

In addition to the EasyMQTT tab, you can also directly access the data received by the server, allowing integrations with other programs and platforms:

Direct access to data sent by the program:

bipes easymqtt

Direct access to JSON data sent by the program for integrations:
http://bipes.net.br/easymqtt/gettopic.php?session=9too6u8&topic=ADC http://bipes.net.br/easymqtt/gettopic.php?session=9too6u8&topic=millis http://bipes.net.br/easymqtt/gettopic.php?session=9too6u8&topic=test-value

Demonstration video:

Video URL: https://youtu.be/5NQubtBMDy4

Please note, that the “EasyMQTT Start” block creates a random session ID each time it is inserted. In this case, the session is 9too6u8. You can manually set a session ID or just use the one created by the block.

Posted in Uncategorized | Leave a comment

Block based programming on Raspberry Pi Pico with BIPES

Create block based programs for Raspberry Pi Pico in minutes!

About one year ago, we created BIPES Project – Block Based Integrated Platform for Embedded Systems (http://www.bipes.net.br), specially focused on integrating Blockly and MicroPython with a direct connection from the web browser to the development boards – initially for ESP8266 and ESP32.

With more than 500 different users currently using BIPES (according with Google Analytics), it has several interesting features, such as the possibility of programming embedded devices without the need of installing absolutely no software or plugin. Simply access BIPES website, connect the blocks, connect to the board and get the program running. A USB/Serial/WebREPL console/terminal is integrated in the webpage, allowing direct access to serial devices.

We have now created some blocks on BIPES specifically for Raspberry Pi Pico.

It’s simple and easy to use:
(Tested / working on Google Chrome)

0. Get a Raspberry Pi Pico board with MicroPython loaded. If you still did not load MicroPython on your RPI Pico, it is as easy as copying a file to a thumb drive. Details here:

1. On Google Chrome, enable the option “Experimental Web Platform features ” (see figure). To enable the option, go to the URL: chrome://flags and activate the web platform features. This option will allow Google Chrome to directly access the USB devices connected to the serial port, without the need of additional softwares. This action must be done only once.

bipes chrome experimental features

2. Go to https://bipes.net.br/beta2serial/ui/

3. On the target device box, select “Raspberry Pi Pico”

4. Go to the Console tab and click “Connect”.
type Enter one or twice, to check if the board is responding. If everything is ok, you should get a MicroPython prompt (>>>). Now you can interact directly with the board from the web browser!

5. Go to the blocks tab and build your program. Then simply click on the “Run” button, and your program blocks program will be translated into Python and executed!

That’s all!

If you want, you can directly share the programs you created by sending a link to your program, by clicking on the link button. Here are some working block based examples:
(just click on the link and you will open the working program)

1. Blink built in LED

bipes rpi pico example1

2. Blink built in LED with different approach

bipes rpi pico example2

3. Fading built in LED with PWM

bipes rpi pico example3

4. Read GPIO Input

bipes rpi pico example4

5. Read ADC Input (raw values)

bipes rpi pico example5

6. Temperature sensor

bipes rpi pico example6

Demonstration video (english):

Demonstration video (portuguese):

Note: BIPES also supports creating, editing, running and managing text files on MicroPython based boards, such as Python scripts. This feature is fully functional for WebSocket / Wifi connections with ESP32 and ESP8266. However, such feature is still incomplete for USB based connection, but will be working soon.

BIPES Source code is available on github:

Main (WebSockets / Wifi)

USB Version

Posted in Uncategorized | 19 Comments