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:
https://www.raspberrypi.org/documentation/rp2040/getting-started/

1. [for outdated Google Chrome] 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

September/2021 update: If you are using the latest Google Chrome or Microsoft Edge, you do not need to enable “experimental web platform features” anymore. It comes enabled on the default installation.

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

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

pico_select

4. Click on the USB Symbol

pico_select

4a. Next, click on “Serial”

pico_serial

 

4b. Select the USB port your Raspberry Pi Pico is connected to

pico_port

5. Go to the Console tab and you should be able to talk with the board! 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!

6. 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
https://bipes.net.br/beta2/ui/#4xcc9e

bipes rpi pico example1

2. Blink built in LED with different approach
https://bipes.net.br/beta2/ui/#jfg4h3

bipes rpi pico example2

3. Fading built in LED with PWM
https://bipes.net.br/beta2/ui/#e3eahj

pico_pwm

4. Read GPIO Input
https://bipes.net.br/beta2/ui/#dwq8df

bipes rpi pico example4

4b. Read GPIO Input and show on IOT tab

BIPES allows you to send data from Raspberry Pi Pico Serial port to a flexible and customizable IoT dashboard using USB/Serial! This example will update a LED on the IOT tab on real time according with the pin 1 state. You can easily customize the dashboard using the “wrench” button.

https://bipes.net.br/beta2/ui/#z2dot6

pico_bipes2

pico_bipes

5. Read ADC Input (raw values)
https://bipes.net.br/beta2/ui/#g56zdg

bipes rpi pico example5

5b. Read ADC Input (raw values) and show on the dashboard
https://bipes.net.br/beta2/ui/#35yvmr

pico_adc1
IOT Tab:

pico_adc2

6. Temperature sensor
https://bipes.net.br/beta2/ui/#w2aibu

pico_temp1

IOT Tab:

pico_temp2

7. Share your dashboard with anyone using MQTT / BIPES EasyMQTT

Even if your board is not connected to the Internet, BIPES offers the “EasyMQTT bridge” option, which uses your web browser as a bridge between the board (connected over USB) and a MQTT server. The browser received data on the USB port and forwards the data to a MQTT server, allowing data and dashboards to be shared with anyone, in real time over the Internet!

To use it, just enable the EasyMQTT bridge on the Console tab:

bridge1You can also click on the gear icon to setup the EasyMQTT session. There you will be able to specify a ID for your EasyMQTT session:

bridge2

I randomly typed 9764422 to be the ID of this test. You can also click on “View this EasyMQTT session”, which you send you to a page with all the data stored on this EasyMQTT session. For example:

bridge3

The EasyMQTT session above can be accessed by this URL:

http://bipes.net.br/easymqtt/?session=9764422

As data is stored on the BIPES EasyMQTT server, you can setup your dashboard to get data from the EasyMQTT session, so anyone can view your dashboard with real time updates:

bridge4

This dashboard can be accessed here and will look exactly the same you saw on the dashboard with local / USB access:

https://bipes.net.br/beta2/ui/#mkke2m

File Manager and Editor

BIPES also offer a complete file manager and text / program editor on the Browser. Without the need of any additional software or plugin, you can use BIPES on your web browser to manage and edit files on the board connected on the USB Port!

bipes_file_manager

BIPES OFFLINE
If you need, you can download BIPES for offline usage. Go to:

https://github.com/BIPES/BIPES/releases/

Download bipes_offline.zip, extract the ZIP File to a folder and open index.html on your favorite browser. You will be able to use BIPES to program, monitor and manage your Raspberry Pi Pico without Internet connection.

Demonstration video (english):

Demonstration video (portuguese):
https://www.youtube.com/watch?v=er4cQtDe5qU

BIPES Source code is available on github:

https://github.com/BIPES/BIPES

23 thoughts on “Block based programming on Raspberry Pi Pico with BIPES

  1. Pingback: Block Based Coding Comes To the Raspberry Pi Pico - Moloft

  2. Pingback: Block Based Coding Comes To the Raspberry Pi Pico - The Designer News

  3. Pingback: Block Based Coding Comes To the Raspberry Pi Pico | Tom's Hardware - INFOSHRI

  4. Pingback: Block Based Coding Comes To the Raspberry Pi Pico - NewsDay24.com

  5. Pingback: EasyMQTT with BIPES and ESP8266 – Quick demonstration | Yet Another Technology Blog

  6. Pingback: BIPES apporte la programmation Visual MicroPython basée sur des blocs au Raspberry Pi Pico, RP2040 | WeMenus

  7. Rudolf Schenke

    I have a problem with Raspberry Pi Pico with blocks:
    – Created a variable with block “set to 1” -> OK
    – Adding a block “change by 1”: In python is a line added “from numbers import Number”
    – Running gives the error “ImportError: no module named ‘numbers’.
    Thats true, there is no module named ‘numbers’ in MicroPython.

    Reply
    1. Rafael Aroca Post author

      Hi Rudolf, thanks for trying BIPES and sorry for the error. Could you please share the blocks you made using the button that shares the program as a link? In fact, there is no module numbers in MicroPython, but we will try to fix it. Anyway, could you please share the blocks with the error by posting the URL to the program here?

      thanks!

      Reply
    1. Rafael Aroca Post author

      Hi Rudolf! Thanks again for the interest. Could you please try again? I have made a few modifications, and “change by” block should generate a different code now.

      best regards!
      Rafael

      Reply
  8. Rudolf Schenke

    Hi Rafael, Unfortunately, I cannot continue because the program is behaving strangely.
    – I set the program to “USB / Serial” and “Raspbery Pi Pico”
    – Then comes my traffic light program that I built yesterday
    – I load the example “… # qnrnyn” that I published (with the problem)
    – The program shows again “ESP8266 (NodeMCU) for device.
    – I switch back to “USB / Serial”, then my traffic light program is back.
    So it is not possible for me to load a program from “Shared”.
    Furthermore: I added a variable to my traffic light program and added a “Change …” block to the program, the same effect: “from numbers import Number”.
    So now I see 2 problems …
    About my background: I am an instructor in our Technic Club, where children and young people learn to program. So far we have programmed a lot with Scratch. Bipes would be a good addition to expand with controllers.
    With regards, Rudolf.

    Reply
    1. Rafael Aroca Post author

      Hi Rudolf, sorry for the delay!

      You found some bugs, sorry! Thanks for pointing them out. Hope to fix them soon.

      But there are workarounds that you can use, if you could try:

      First, the link you shared:

      http://bipes.net.br/beta2/ui/#qnrnyn

      is different than:

      http://bipes.net.br/beta2serial/ui/#qnrnyn

      Because /beta2 implements functions to talk to ESP8266 and other using wifi / WebREPL protocolo and not USB. So, for Raspberry Pi Pico, we must use:

      http://bipes.net.br/beta2serial/ui/#qnrnyn

      Second bug you found (sorry again), is that when a shared link is opened in beta2serial, USB stops working. There is no problem for wifi connection, but it causes a failure with USB.

      I made some tests, and as a workaround, I would kindly suggest / ask you to proceed as follows:

      1. Load your shared program:
      http://bipes.net.br/beta2serial/ui/#qnrnyn

      2. Click on Save Icon, and you will save XML file with the program. You can always save the program to a local file.

      3. Close the browser window and open again directly to:
      http://bipes.net.br/beta2serial/ui/#qnrnyn

      5. If older blocks appear, click on the trash button to clean the workspace.

      5. Select Raspberry Pi Pico in the combo box selection box

      6. Click in the load XML icon (a disk with an arrow) and select the recently saved XML file

      7. Connect and run your program 🙂

      Again, sorry for the bugs. As you know, BIPES is a beta software, and you are helping us getting it better. Hope we can fix these issues soon, but these workaround should help by now.

      PS.: Fixed import numbers to for the block “change by”

      best regards!

      Reply
  9. Pingback: BIPES: Visual development environment for Raspberry Pi, ESP32 & Co. | Marijuanapy The World News

  10. Teare

    Hello,
    I tried to use the OLED block and the resulted code is
    I2C(-1, SCL=,….)
    so I get an error saying this is an error. Shouldn’t it be a 0 by default. In fact I think it is the I2C number which could be 0 or 1
    What do you think ?

    Reply
    1. Rafael Aroca Post author

      Hi! Thanks for the report, and sorry. Funny how MicroPython handles it. For ESP32 and ESP8266, the correct option is -1 while for RPI Pico is 0. We will need to add an IF to BIPES code generator. Hope we implement this soon. Sorry for the error.

      best regards

      Rafael

      Reply
      1. Teare

        In fact depending on the GPIO you choose for sda/scl the value is 0 or 1 – FOr GPIO 8-9 or 16-17 it is 0, for 6-7 or 18-19 I2C id is 1 !
        Thanks for your prompt response

      2. Rafael Aroca Post author

        Hi Teare! Just updated BIPES (serial version: https://bipes.net.br/beta2serial/ui/) adding the option of selecting the I2C port as one input of the OLED Init block. Could you please check if it solves the issue / helps? Depending on your setup, you might need to force reloading BIPES webpage with Ctrl+F5 or Shift+F5.

        Please, let us know if it works. Best regards!

  11. Teare

    Sorry to disturb again but I have another question :
    I tried to use the Character DISPLAY – It says to install the I2C_LCD.py library but when I try to run the python code shows:
    from esp8266_I2c_lcd import I2cLcd

    module not found : esp8266_I2c_lcd
    So 1) it is the good library and include ?
    if yes, sounds like import library didn’t work (I don’t see anything on console)
    If I transfer library locally and I go to FILES and try to upload to device It stays there forever. How can I debug that to see what’s going on ?
    Thanks and Best regards

    Reply
  12. Pingback: Welcome do BIPES – BIPES

  13. Pingback: BIPES and Raspberry Pi Pico

  14. Pingback: Block Based Coding Comes To the Raspberry Pi Pico – Resource Website

  15. Pingback: Raspberry Pi Pico with BIPES updates | Yet Another Technology Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s