0% found this document useful (0 votes)
60 views11 pages

Flowcode 9 Projects on Raspberry Pi

Raspberry Pi is now supported as a target for Flowcode projects, allowing users to create diverse IoT applications on the low-cost Raspberry Pi board. Flowcode generates code that runs on the Raspbian Linux operating system. Projects can be remotely downloaded, debugged, and run simultaneously on the Raspberry Pi. The E-blocks hardware also supports Raspberry Pi, and most projects can easily be ported between microcontroller targets.

Uploaded by

Yasser
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views11 pages

Flowcode 9 Projects on Raspberry Pi

Raspberry Pi is now supported as a target for Flowcode projects, allowing users to create diverse IoT applications on the low-cost Raspberry Pi board. Flowcode generates code that runs on the Raspbian Linux operating system. Projects can be remotely downloaded, debugged, and run simultaneously on the Raspberry Pi. The E-blocks hardware also supports Raspberry Pi, and most projects can easily be ported between microcontroller targets.

Uploaded by

Yasser
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Raspberry Pi as a Flowcode target

Raspberry Pi is an inexpensive board level target with digital I/O but also internet
functionality built in. As such it provides an ideal base for diverse applications including IoT
(the Internet of Things). For the first time, Flowcode 8 enables users to target this hugely
popular Raspberry Pi family of boards. Flowcode is an intuitive way to program, either at
home, in the classroom or for industrial uses.

Alongside this, our E-blocks2 hardware platform also supports the Raspberry Pi and the
Raspberry Pi Shield is perfect for those who wish to integrate their Pi into the E-blocks
system.

Flowcode is chip independent and the Raspberry Pi is just one target of 33 different families
of microcontroller that we support. Hence most projects can easily be ported from one
target device to any other.

There are many advantages to creating Flowcode applications on Raspberry Pi, here are just
a few:

• The huge library of Flowcode components can be used


• Remote download of the Flowcode generated applications via WiFi or Ethernet
• The Flowcode generated programs run on the Raspbian Linux operating system
• Flowcode generated applications can be called up from other programs
• Multiple Flowcode applications can be run simultaneously on the Raspberry Pi
• Debug message capability directly from the Raspberry Pi to a console window on the
PC
• When used in conjunction with the Matrix hardware the Ghost features of Flowcode
are available
Using Raspberry Pi with Flowcode 9
SD cards supplied with Matrix products are pre-programmed with the Raspbian image, in
this case please go to the “Configuring Raspberry Pi for use with Flowcode” section.

Help can be found at [Link]

Creating a Raspberry Pi OS on a micro SDHC card


• Download& install the Raspberry Pi Imager from the Raspberry Pi website
• With the minimum size of 16gig SD card, connected to your PC via an SD and
ignore/close any waring about card not being formatted if there is already an old Pi
OS on it.
• Run the R Raspberry Pi Imager:

• Left-click CHOOSE OS and select Raspberry Pi OS (32-bit)

• Left-click CHOOSE STORAGE and select the popup.

• With a 16GB SD micro card should look like:

• WRITE should now be available to select.


Configuring Raspberry Pi for use with Flowcode

Flowcode uses secure shell, SSH, to transfer user applications to the Raspberry Pi.
SSH is easily enabled on the Raspberry Pi from the desktop.
Alternatively, this can be done by using raspi-config from the terminal.

From the Raspberry Pi menu, in the top left corner of the desktop, select “Raspberry Pi
Configuration” from the “Preferences” menu. In the “Interfaces” tab, select “Enabled” for
SSH and click OK. With SSH remote access enabled it is recommended that you to consider
changing the default pi user password (initial default is raspberry).

For wireless connections, click and set the “Set


WiFi Country” in the “Localisation” tab.
Click the OK button and close the dialog.

Then click on the network activity icon in the top


right of the desktop and connect to your WiFi
access point.

Flowcode projects require the setting of the IP


address of the Raspberry Pi, as configured by
your network.

Once you have your Raspberry Pi connected to


your network, its IP address can be seen by
hovering the mouse over the desktop network
activity icon. In the example shown the IP
address of this Raspberry Pi is [Link]
Creating your first Flowcode 9 Raspberry Pi project

For this example project we will use a Raspberry Pi 3B+ with simply a LED and resistor
attached to GPIO 4 to demonstrate digital output.
Run Flowcode 9 and select New project.
Under Choose a Target right-select on any target device & select Search.
Within the search box, enter rpi then what version you have e.g rpi3b or rpi3b+ etc.
Press the Enter key or select Find Next.
Select New<RBI3B> Embedded Project:

Select Build - ribbon, Project Options

Below Configure, enter the IP address for the Raspberry Pi together with the user name and
password (usually pi and raspberry).
Note: The “sudo” checkbox only needs to be enabled if PWM is used in the project.
Select Modify
Add a LED component, from the Components Libraries ribbon, Outputs menu, onto the
system panel. In the component properties window set the Connection property to
PORTG,4 (this represents GPIO 4).
Enable the Project Explorer by selecting it from the View ribbon.
Icons for example Loop, calculation box & Delay etc can be selected by clicking on the four
+ on the far left of the project explorer.

To the main flowchart add a loop of fixed count 10

Component icons can be selected by clicking on Component’s icon of the project explorer.
Together with component icons to turn on and off the LED with 500mS delays as shown:

Save the project without any spaces (underscores are OK), and the flowchart can be
simulated on screen by clicking the Run button.

To run the project on the Raspberry Pi click the Build ribbon, Compile to Target… icon.
The project compilation window will display followed by a console (Putty) window whilst the
program runs on the Raspberry Pi and flashes the LED 10 times.

Sample Flowcode 9 project for Raspberry Pi and E-blocks

For this example we will use an E-blocks 2 Raspberry Pi upstream board (BL0036), with
Raspberry Pi 3B+ installed, and a Combo board (BL0114).
As with the previous example, Run Flowcode 9 and select New project.
Under Choose a Target right-select on any target device & select Search.
Within the search box, enter BL0036.
Press the Enter key or select Find Next.
Select New< BL0036> Embedded Project
Select Build - ribbon, Project Options.
Below Configure, enter the IP address for the Raspberry Pi together with the user name and
password (usually pi and raspberry).
Note: The “sudo” checkbox only needs to be enabled if PWM is used in the project.
Select Modify.
Select Components Libraries ribbon then select Search.
Enter bl0114 & left or right-click, Add to 2D panel
Combo BL0114 component will be added onto the dashboard.
From the Project Explorer window drag and drop a Start icon followed by a PrintString icon,
set the text field to “Hello World”.

Save the project (no spaces) and click the “Compile to chip” button in the task bar.
The project compilation window will run followed by a console (Putty) window whilst the
program runs on the Raspberry Pi target, and “Hello World” should appear on the display.
(Note: Ensure that the BL0114 “LCD” switch is set to ON)

Running programs from the Flowcode IDE

Flowcode uses secure shell to transfer and run user applications, so whilst running you will
see the shell console window on the host PC. Note that in the case of programs with a
continuous loop this window will remain continuously present on the host PC.
Pressing CTRL and C in the window will abort the running program on the Raspberry Pi and
exit the console window.
The Flowcode DebugPrint component can be used to output text to the console window for
debugging or other purposes.
The shell console window runs concurrently with Flowcode such that ICD (In Circuit
Debugging) can be done with the use of the Flowcode Ghost features of the Matrix E-blocks
2 Raspberry Pi upstream board or Flowkit v2.
Running your programs independently of Flowcode

Once you have used Flowcode to create, compile and transfer your program to the
Raspberry PI, it will exist in the home directory of the selected user e.g. /home/pi

From there the application can be run via a serial console such as Putty or virtual desktop
such as VNC or RDP. VNC and SSH for Putty are enabled via the Raspberry Pi “Interface
Configuration” dialog.
Your application can also be configured to run from start-up of the Raspberry Pi by adding a
line to the /etc/[Link] file, but before the exit 0.
Editing this file must be done with root privileges, e.g. sudo nano /etc/[Link]

/home/pi/MyFlowcodeProject &

exit 0

Notes: It is vital that you do not use any spaces within the project name.
If you do, the code will not autorun on start up.
Underscores are allowed.

It is always best to add a space then & after the project name.
If you don’t then the Pi will not complete the
boot process.

Using Raspberry Pi hardware peripherals

Hardware peripherals on the Raspberry Pi are limited to UART, SPI, I 2C and PWM. To use
these peripherals with Flowcode they must be first be enabled via the Raspberry Pi
“Interface Configuration” dialog. There is no direct support for analogue or interrupts.
Analogue inputs and outputs would be implemented via external devices.
Also note that (at the date of this document) PWM requires programs to be run with root
privileges, for which Flowcode provides the option to run programs as sudo.
Flowcode provides software versions of SPI and I2C such that devices using these protocols
can be connected to any free GPIO pins. Due to the RTOS operation of Raspberry Pi, the bit
rate of these can depend upon other running processes. The same is the case for delays,
these can vary, the relative deviation being greater for shorter delays.

Common questions

Powered by AI

Flowcode's approach on Raspberry Pi for using SPI and I2C involves software emulation that allows these protocols to be connected to any free GPIO pins. This is different from other microcontrollers that may have dedicated hardware support for SPI and I2C. The software-based approach on Raspberry Pi is influenced by its RTOS operation, which can affect signal bit rates due to multitasking overhead, unlike the more predictable performance in hardware-based microcontroller implementations .

PWM in Flowcode projects on Raspberry Pi is used for varying signal power to peripherals, which is essential in applications like motor control. However, implementing PWM requires programs to be run with root privileges due to hardware constraints. Flowcode provides the option to enable the 'sudo' setting when PWM is part of the project .

Raspberry Pi is considered an ideal base for IoT applications using Flowcode due to its built-in internet functionality, which supports both WiFi and Ethernet for remote downloading of applications. Additionally, it offers a large library of Flowcode components for diverse functionality, compatibility with Raspbian Linux OS, and the ability to run multiple applications simultaneously .

When creating a boot-start project with Flowcode on Raspberry Pi, ensure that no spaces are used in the project name, as this will prevent the code from autorunning at startup. The project name should be followed by a space and an ampersand in the /etc/rc.local file to complete the boot process correctly. Root privileges are necessary to edit this file .

To configure a Raspberry Pi for running Flowcode applications over a network, enable SSH and set the WiFi Country in the 'Localisation' tab. Then, connect the Raspberry Pi to a network and determine its IP address by hovering over the network activity icon on the desktop. This IP address is required in Flowcode's project settings for network access .

Flowcode simplifies programming on Raspberry Pi through its intuitive interface that is chip independent, allowing applications to be easily ported between different microcontroller families. It supports a wide range of components, enhances debugging capabilities with Ghost features, and enables running multiple applications concurrently. Its integration with hardware platforms like E-blocks2 extends its industrial and educational usability, providing a more user-friendly and flexible alternative to traditional programming languages .

The E-blocks2 system is significant for Flowcode projects on Raspberry Pi as it provides a modular hardware platform that enhances flexibility and expandability of projects. It supports rapid prototyping through standardized boards and shields, allowing seamless integration of Raspberry Pi within electronic circuits and systems, facilitating both educational and industrial applications .

Flowcode facilitates debugging in Raspberry Pi projects through the use of DebugPrint components, which output text to a console window for monitoring and troubleshooting. The integration of the Flowcode Ghost features with Matrix E-blocks 2 or Flowkit v2 allows for in-circuit debugging, providing insight into live signal behaviors and performance issues. This capability is important for identifying bugs, optimizing performance, and ensuring the reliability of complex systems .

The benefits of using Flowcode to run multiple applications simultaneously on Raspberry Pi include increased versatility and productivity, as it allows for various tasks and processes to be executed in parallel, suitable for complex IoT systems. Challenges include managing the limited processing power and memory of Raspberry Pi, which may impact performance, and ensuring that the concurrent applications do not interfere with each other, especially regarding resource access and timing .

To set up SSH for remote access on a Raspberry Pi, navigate to the 'Raspberry Pi Configuration' in the 'Preferences' menu on the desktop, then select the 'Interfaces' tab, and enable SSH. Alternatively, SSH can be enabled using raspi-config in the terminal. It's recommended that the default user password be changed for security reasons .

You might also like