1. Introduction
Block programming tools are one of the most powerful tools that educators have in their hands to teach programming skills to pupils. Based on their simplicity for connecting blocks together, they can cope with complex code generation. Blockly [1] is, probably, the most widely used tool to develop block programming software. It is basically divided into two aspects, the block shape generator and the code generator. In this sense, Facilino is a software that uses Blockly to generate code for low-cost electronics such as Arduino, Raspberry Pi and ESP32.
Facilino [2], was originally developed by Leopoldo Armesto (UPV) in a collaboration with a local SME, Robotica Fácil [3], to provide solutions for schools so the can integrate different kind of STEAM activities within their curricula. From the beginning, Facilino has shown interest in their community. Originally, the software was planned as a free-ware software, as part of the agreement for development. Therefore, many blocks were free to use, but others, require a license.
Taking Facilino as a basis and considering that the old version of Facilino was not maintained anymore (last published release is dated on end of 2019), we consider that EcoThings project brings a great opportunity to retake the development under a completely different approach. For obvious reasons, we have kept the original software name, trademark and logo, but now it’s development is fully maintained by the UPV. Indeed, this approach has shown to have an impact on the community because some people already use Facilino and thus the new version sound familiar to them and thus showed interest in learning more about this new version of Facilino. Due to the previous collaboration with Robótica Facil, we could reach a sector that was precisely of interest of this project. When presenting the new version we referred to EcoThings project.
b. Highlights
During the project execution, we have made a big effort in readapting many aspects:
- Hosting: The new version is hosted at the UPV servers, and it will be maintained by the UPV.
- Totally free software: All blocks can be now used for free.
- Front-end & back-end development: Facilino works now with a front-end based on HTML and Javascript (in the client side), while it runs PHP and MySQL in the server side.
- User’s account: We have included a simple account log in, registration, password recovery and user’s profile.
- Project’s dashboard: Users can manage their own projects, once logged in.
- Facilino OTA Server: This tool allows Facilino to compile code and upload it to the electronics. The main advantage, compare to the previous version is that now, all dependencies of the code generated by Facilino are now integrated in a single tool.
- Block simplification and feature extension: Some original blocks of Facilino have been simplified and in some cases. Also, we have developed new blocks that have considered relevant to boost code development those related with EcoThings project. Blockly includes the possibility to generate shadow blocks, which is a great utility to generate default inputs for a specific block instruction, so that users can quickly find out how to use a instruction without the need of reading documentation about it.
- Block filters: The set of block instructions of Facilino has become large, which might be confusing for non-experienced users. For that reason, we have included block filters that will show blocks that can be typically used for a specific project type. In particular, EcoThings project has its own block filter, which means that most of the blocks that one can expect to use within EcoThings proposals, will be shown by default and the rest will be hidden.
- Tutorial and Project-related exercises: Based on previous Tutorial exercises, the new version of Facilino includes a set of tutorials to start coding. In the majority of these tutorials and exercises, we propose connection diagrams and alternative approaches that can be used too. We provide a problem description, hints, Facilino code and a ThinkerCAD project embedded in the tutorial so that the proposed exercise can be executed in a simulated environment, without need of physical electronics. Similarly, we have just started documenting some specific exercises that are related with some projects such a LED race or low-cost robotics platforms. We have also started documenting the kind of exercises that can be used within the EcoThings project.
- Translation tool: The new version of Facilino includes an easy-to-use translation tool that aims to translate Facilino into multiple languages. So far, we have translated Facilino into Spanish and other languages such as Catalonian, German, Italian, French and Portuguese have been Google translated and are currently under review.
- Over-the-Air (OTA): The new version of Facilino, includes a feature that allows to program micro controller such as ESP8266 or ESP32 using an over-the-air feature. In combination of Facilino OTA Server, a user can compile and upload code to a specific device via WiFi, without need of physical USB cable. This represents a great advantage for schools using tables or iPADs in their lab sessions.
- Documentation: This is a working progress feature, and it will be implemented in a mid-term period (by the end of the project, if possible). The idea is to show specific examples of how to use instructions. In PR4, we will particularly generate graphic documentation on how to code with Facilino within EcoThings project.
2. Main results
a. Old Facilino version versus Facilino OTA
Facilino is hosted at:
https://facilino.webs.upv.es/ This host will be maintained by the UPV even when the project is finished, with the purpose of providing access to anyone who wants to use this tool.
b. Open source and free software
Facilino, also known as Facilino OTA, has been published as an open source software under Apache 2.0 license. The new version of facilino is totally free, which means that we have reimplemented the underlying code for those blocks so that now all of them generated code at no cost.
The code has been published on GitHub (using the original account, but on a new repository):
https://github.com/roboticafacil/facilino_ota
Together with Facilino OTA, users must install Facilino OTA Server, another open source tool that is hosted at:
https://github.com/roboticafacil/facilino_ota_server
We have created a first release, with binary files for Windows and Ubuntu (also works in LliureX).
Facilino uses a frontend/backend architecture, which means that when the user loads Facilino web page, this page is served by a server running PHP. The server generated HTML and javascript code that the client (frontend) renders into a web page. The server make queries to a database using MySQL.
In addition to this, it is interesting to understand how Facilino generates code to be uploaded on electronics.
In order to use Facilino, users must create an account. When not logged in, a red box informs the user that needs to login in order to code. Login can be done by clicking on the top right icon at the menu bar.
If a user has an account, it can simply log in to start coding, otherwise, the user will need to create an account to as indicated in the login page.
Registration page, ask for few personal data and language preference (currently only english and Spanish):
Users can recover their password if they do not remember and they will receive an email with a link to reset their password:
Once clicking on the link, they just need to set a new password and the user’s account password will be updated.
Once logged in, they can access to their user profile to update their name of language preferences. User’s can also apply for an account upgrade in which the can participate in the Translation program or Academy program. These two programs are described below so that users can contribute to the development of Facilino.
User’s can create projects that will be included in their project’s dashboard. So far, this is a simple dashboard where all users’ projects are listed and they can duplicate a project, delete, edit, download code, etc… We are considering to include a search/filtering tool so that when users start have a big amount of projects, can be easily found.
To create a project, users must click on “New Project” link and a form with all possible options will be shown.
Users must provide a project’s name, select the board they plan to use, Facilino’s version, the block instruction set as well as the language. All these options can be modified later once the project is created. They can also select the Server IP and the Device IP for Facilino OTA settings.
Facilino generates Arduino code for multiple type of boards. It works with several Arduino processors such as Arduino Uno; Espressif boards such as ESP8266 and ESP32 and Raspberry Pi. Facilino blocks instructions are identical in most cases, while the generate code adapted to the specific board, which greatly abstracts many issues related to hardware abstraction compared to classic text coding. So far, we have included a subset of boards, but this can be extended in the future to include new ones:
While Facilino is a code generation tool, the actual code will be uploaded to using Facilino OTA Server (see next section). This will will upload code either through USB, selecting Facilino version, or over the air selecting Facilino OTA. We have also created a simplified version of Facilino (using USB), named as Facilino Junior where most of the blocks have been adapted to a simpler way of use, while limiting obviously the full capacity of the tool if advanced instructions were used instead.
Finally, the user must select a Block Instruction set. The purpose of this selection is to filter some blocks that the user will not use depending on the type of project he/she intends to do. In that sense, the option by default is a generic project with the full set of instructions, while other projects such as robotic projects or EcoThings project will require a different kind of instructions. Thus, by selecting a specific project, some instructions will not be shown by default and therefore, it’s easier for non-experienced users to find the instructions they need to user for their actual needs.
You can download here Facilino OTA Server. Select the appropriate version for your OS.
- Download Files
First, download Facilino OTA Server. Be advised that these downloads have been taken from Robotica Facil’s GitHub, where you can find the source code of the application and old releases.
- Facilino OTA Server Windows Installer
Click on the installer to execute it. Your computer might give a warning as the Installation comes from an unknown source. Simply, give permision under the extended tab option. The Facilino OTA Server is complety safe and does not pose a threat to your computer. Indeed, Facilino OTA Server actually is a port to the Facilino web page and Arduino-CLI. The web page generates code based on blocks, while Arduino CLI is the software that compiles your code so it is highly recommended to check that has been properly installed after the installation process finishes, including all boards and libraries required by Facilino, otherwise, compiling and uploading code might fail.
When executing Facilino OTA Server Installer, you should see the following window:
Select the installation location, this is automatically set to your folder C:\FacilinoOTAServer. We recommend you not to change this path.
Then installation should start immediately and a progress bar should be visible. This installation might take a few minutes, particularly when installing Arduino libraries, because they will be first downloaded and then installed.
3. Facilino OTA Server Windows ZIP (for non-admin users)
Unzip Facilino OTA Server and cd to the unzipped folder and type config.bat in the command shell. You should see on the shell output all arduino-cli commands required by Facilino to be able to compile and upload code to the supported boards and libraries.
4. Facilino OTA Server on Ubuntu
Untar Facilino OTA Server and cd to the uncompressed folder and bash config.sh in the console. You should see on the shell output all arduino-cli commands required by Facilino to be able to compile and upload code to the supported boards and libraries.
5. Arduino CLI
Open the command shell and move to Facilino OTA Server directory (i.e.: C:\FacilinoOTAServer). Then, cd to arduino-cli folder and type arduino-cli.exe core list (on Windows) or ./arduino-cli core list (on Ubuntu). You should see a list of supported boards:
If you type: arduino-cli.exe lib list you should see a list of installed libraries:
If any of the previous steps fails or during compilation of a program there’s a missing library, you can install them manually (see arduino-cli’s help by typing arduino-cli.exe -h on Windows or ./arduino-cli -h on Ubuntu).
6. Running Facilino OTA Server
You can run Facilino OTA Server from the command shell by typing FacilinoOTAServer.exe -e on Windows or ./FacilinoOTAServer -e on Ubuntu (you need to cd to Facilino installation folder).
Every time your computer restarts or you close the command shell, you will need to manually execute Facilino OTA server so it can compile or upload code. This is OK if you are the only user using the computer, however, if more users are about to use Facilino (i.e. in a Lab room), in order to avoid copies of the same libraries for each user, the recommended method is to install a service that runs automatically at boot up.
IMPORANT: In order to run Facilino OTA Server as a service, it must be installed by the administrator of the machine and the service must be installed also by the same user. In that case, open a command shell with administrative permission and cd to Facilino OTA Server and type FacilinoOTAServer.exe -i <user> <password> on Windows or sudo ./FacilinoOTAServer -i <user> <password> on Ubuntu, where <user> and <password> denotes the system user and password of the computer with administrative permisions.
Now, start the service simply by executing the command FacilinoOTAServer.exe on Windows or ./FacilinoOTAServer on Ubuntu. To stop the service, you can execute the command FacilinoOTAServer.exe -t on Windows or ./FacilinoOTAServer -t on Ubuntu.
It is recommended to check the status of the service through the Windows service utility.
In Ubuntu, you can check if the service is running by executing the command lsof -i:4000.
7. Compile & Upload
Here, we assume that you have registed an account on Facilino web page, if not, please go to Register and complete the registration and log in.
Here, we assume that you have registed an account on Facilino web page, if not, please go to Register and complete the registration and log in.
To check if Facilino OTA can compile and upload code, create a blank project. Goto to the dashboard page Dashboard, click on New Project and select the desired processor among the list of available ones; select Facilino as Facilino Version and Generic Project Block Instruction Set and press Create.
Then, connect your board to the USB port and click on Compile & Upload. A window will show up with the generated code (so far since the project is empty, only setup and loop functions should appear). Select the board port in the dropdown list (if necessary press the Refresh) and board:
Then, verify that the code compiles by click on Verify and then if succeed upload the code by clicking on Upload.
Remark: Every time you change the code, you need to compile first and then upload, otherwise the latest compiled code will be uploaded.
g. Block simplification and feature extension
While the previous version of Facilino included many blocks, in this new version, we have included new blocks, updated existing ones and add shadow blocks to provide a hint on the type of input that a block expects.
In particular, from the toolbox, we can see now all blocks variations so the user can directly select the one that he/she is interested in (previously, only the default block aspect was shown, but now we show all of them). For instance, the arithmetic block operation that included summation, subtraction, multiplication and division in a one single block, now it is shown as if they were four different blocks in the toolbox.
Also, on each input, we have added shadow blocks, which are default input values so that the user does not need to add by himself/herself. Of course, the user can change this default value to something which is more convenient for him/her, but in most of the cases, the default value serves as a hint to the user to know which kind of input is expected, but also as quick code generation, just by dragging few blocks.
We have updated, both the aspect and the code generated of some blocks, particularly those related with Bluetooth, because we have developed an App Inventor extension that is compatible with those blocks. Bluetooth-related blocks have also additional improvements. Among them, we can highlight the fact that now we can transmit and receive data between two ESP32 devices as long as one of them acts as master and the other one as slave. We have also created new blocks, such as HTTP REST API blocks to communicate WiFi devices with a mobile device via HTTP protocol. Another important block that has been modified that is widely used are blocks related to GLOBAL variables. Now, this block is simply added to the workspace, but not necessary in the setup as before. Since they are global variables, their definition is not link to either to “setup” or “loop” sections. In addition to this, PWM-related blocks have their own subcategory in the toolbox, which is easier to find them (before they were included in the Analog section).
We have also included many new blocks that were not included in the old version, such as servo motor attach/detach, ignore output, meArm-related blocks, HTU21D temperature/humidity sensor block.
When creating a project, we can select the type of project we intend to work with, which affects to the block instruction set. For instance, a generic project will have all blocks available by default, while other type of projects will show by default only some categories. The following table summarizes the categories and subcategories shown for each type of project:
Category | Subcategory | Project type |
Functions | – | All |
Control | Flow Control | All |
Programming | Generic | |
Interrupts | Generic | |
State machine | Generic | |
Logic | – | All |
Bitwise | Generic | |
Math | – | All |
Array | Generic | |
Curve | Generic | |
Variables | – | All |
Array | Generic | |
EEPROM | Generic | |
Text | – | All |
Basic I/O | Analog | All |
Digital | All | |
PWM | All | |
Button | Generic, Multisensor, Home Automation, LED race | |
Bus | Generic | |
Display | LCD 16×2 | Generic, Multisensor, Home Automation |
LED Matrix 8×8 | Generic, DYOR | |
RGB LEDs | Generic, DYOR, bPED, HomeAutomation | |
OLED 128×32 | Generic, DYOR, bPED | |
Communication | USB | All |
Bluetooth | All | |
WiFi | All | |
Light | Infrared | All |
Colour | Generic, DYOR, Multisensor, Home Automation | |
LDR | Generic, DYOR, Multisensor, Home Automation | |
Dimmer | Generic, Multisensor, Home Automation | |
Distance | – | All |
Sound | Buzzer | All |
Music | Generic, DYOR, bPED | |
MP3/WAV | Generic, DYOR, bPED, Multisensor, Home Automation | |
Movement | Motors | All |
Robot base | Generic, DYOR | |
Robot accessories | Generic, DYOR | |
Robot walk | Generic, bPED | |
Robot arm | Generic, mArm | |
System | Controller | Generic |
Filtering | Generic | |
Environment | Temperature | Generic, Multisensor, Home Automation |
Humidity | Generic, Multisensor, Home Automation | |
Rain | Generic, Multisensor, Home Automation | |
Gas | Generic, Multisensor, Home Automation | |
Miscellaneous | Generic, Multisensor, Home Automation |
i. Tutorial and Project-related Exercises
We have included a set of tutorials. The basic ones, have been fully integrated in the new version of Facilino, which includes now TinkerCAD simulations to reproduce the proposed exercises even without the need of programming the physical device. This basic exercises, have been designed to understand how to use specific block instructions. On every tutorial, it is explained which are the worked instructions and which are additional ones that will be used in the exercises. Every exercise includes a description and a hint on how to solve it and also includes the solution using Facilino code.
Also, we have created a set of exercises for specific projects.
As we can see, this is still a work-in-progress project and we hope to complete most of them by the end of 2023.
Here we can see a TinkerCAD circuit simulation which includes code generated by Facilino to reproduce a specific behaviour.
Here is a list with the number of examples created so far:
Basic Exercises | Intermediate Exercises | |
USB Serial Communication | 5 | 2 |
Blinking LEDs | 5 | 3 |
Logic | 4 | 3 |
Flow Control | 3 | 3 |
Functions and Procedures | 4 | 3 |
Variables | 4 | 3 |
Maths | 4 | 3 |
Text | 3 | 3 |
In order to provide a localization feature when using Facilino, we have included a translation tool that we hope it will help to translate Facilino into multiple languages. The basic idea of this tool is that a user applies for being part of the translation program, which means that he/she will be able to provide translations of specific texts, words and sentences that are used in Facilino and in their examples.
Based on previous contributors and an automated tool using Google translate services, Facilino has been already translated into other languages, but it needs to be revised. Thus, the translation tool asks a user to review/translate some text and he/she can modify it. Those translations will be reviewed by a second reviewer (and possibly more), and then confirmed added to the database.
To apply to the program, users must fill the following form:
Once filled and they apply, the administrator receives an email with the form data:
Here, you can see and example of a key to be translated/reviewed:
Facilino OTA can be used to program over-the-air devices such as ESP32 and ESP8266. This is a feature that allows programming a device without USB cable.
When creating a new project, we must select Facilino OTA in order to be able to use this feature:
3. Dissemination and Impact
Since Facilino has suffered from lots of changes, we decided to have an operational version of it before disseminating with users that had used the previous version. However, during development, we have perform several dissemination activities for small groups of users:
- Santiago Apostol school has used the tool, during the academic year 2022/2023, with their students to start learning the basics of coding with simple exercises such as turning on a LED, both in a simulated environment using TinkerCAD and with actual electronics using Facilino OTA. As a consequence, the tool has been testes on kids aged 10-12 years old.
- We have collaborated with a secondary school in Valencia, CE Marni, which is not part of this association, but they were willing to use this new version for some of their academic activities, because they were active users of the old version and decided to implement during the academic year 2022/2023. As a consequence, the tool has been tested on kids aged at 12-15 years old.
- Leopoldo Armesto, has encouraged their university students to use this tool to provide code templates as part of an academic work assignment consisting of building a robot within a robotic course of the Industrial Electronics and Automation degree at the UPV. As a consequence, the tool has been tested on adults too, with the main purpose of generating code which they will adapt to their specific needs later on.
- Sara Blanch and Leopoldo Armesto have co-tutorized two vocational students (Computer Science) performing an internship at the UPV, which have been also using this tool to generate code in order to complete their tasks assignments.
References
[1] Blockly https://developers.google.com/blockly
[2] Facilino (old version) https://roboticafacil.es/facilino/blockly/Facilino.html
[3] Robótica Fácil https://roboticafacil.es