Difference between revisions of "Examples and Tutorials"

From Flowcode Help
Jump to navigationJump to search
(35 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This page contains structured exercises used throughout [[Flowcode Help Overview|Flowcode Help]] section, and further exercises which are not featured in the Flowcode Help structure, these additional exercises range from expanded exercises on camera control and panel navigation to creating, testing, exporting and importing components.
+
==Introduction to Microcontrollers Course==
  
 +
We recommend going through the Flowcode section of the https://www.matrixtsl.com/resources/files/datasheets/Microcontroller%20compete%20course.pdf course which has been updated for the latest version of Flowcode and is available for free at the learning center section on the main [http://www.matrixtsl.com www.matrixtsl.com] website.
  
We recommend going through the Flowcode section of the [http://www.matrixmultimedia.com/courses/itm/index.php?n=IntroductionToFlowcode.IntroductionToFlowcode Introduction to Microcontrollers] course which has been updated for the latest version of Flowcode and is available for free at the learning center section on the main [http://www.matrixtsl.com www.matrixtsl.com] website.
+
If you have a Raspberry Pi you can look at
 +
[[https://www.flowcode.co.uk/wiki/index.php?title=Raspberry_Pi_Getting_Started_Guide]|RPI getting started guide]
  
  
A set of videos are available showing some projects using Flowcode as well as talking you through some example programs.
+
==Embedded Getting Started Guide==
[https://www.youtube.com/watch?v=g5SrkU-5TuU&list=PLCZaPFyK6UlLyg-a8Fm01ZWFvp-GxBLgc Flowcode video Playlist]
 
  
 +
The [[Embedded_Getting_Started_Guide|Embedded Getting Started Guide]] intoruces you to the Flowcode envioment and take you though to programming a microcontroller
  
==Getting Used To The Flowcode Environment==
 
*[[Exercise - Setting Up the System Panel|Setting Up the System Panel]] - Set up the system panel to your preference following instructions
 
*[[Exercise - Controlling the Camera|Controlling the Camera]] - Learn how to control the camera on the system panel
 
*[[Exercise - Setting Up the Dashboard Panel|Setting Up the Dashboard Panel]] - Learn how to use and configure the dashboard panel effectively
 
*[[Exercise - Creating a Flowchart|Creating a Flowchart]] - Preparing and and planning a program by adding icons to a flowchart to be expanded into a program.
 
*[[Exercise - Configuring Icons and Variables|Configuring Icons and Variables]] - Configuring the flowchart icons and variables to effective operate a program using components.
 
*[[Exercise - Adding Devices to a Program|Adding Devices to a Program]] - Adding, configuring and manipulating components for suitable and effective use in a program.
 
*[[Exercise - Simulating a Program|Simulating a Program]] - Testing and simulating a program in Flowcode using various methods and techniques of simulation.
 
*[[Exercise - Transferring a Program to the Microcontroller|Transferring a Program to the Microcontroller]] - Testing and running a program on hardware, compiling to a chip and the process required to do so.
 
*[[Exercise - Documenting a Flowchart|Documenting a Flowchart]] - Using comments to explain and describe your Flowchart and the process of the program.
 
*[[Exercise - Expanding a Program|Expanding a Program]] - Expanding your program further to increase functionality, effectiveness and efficiency.
 
*[[Exercise - Using Component Macros|Using Component Macros]] - Creating and expanding a program by using icons and components, specifically Component Macros.
 
*[[Exercise - Using Simulation Macros|Using Simulation Macros]] - Creating and expanding a program by using icons and components, specifically Simulation Macros.
 
*[[Exercise - Using Macros|Using Macros]] - Using Macros and local variables to effectively create and organise a program including components.
 
*[[Exercise - Inserting Code Into Flowcode|Inserting Code Into Flowcode]] - Adding custom code into a program and integrating it into the flowchart for use with components.
 
*[[Exercise - Using Interrupts|Using Interrupts]] - Using interrupts, custom interrupts and timers to call macros and configuring interrupt properties.
 
*[[Exercise - Using Analogue Input Devices|Using Analogue Input Devices]] - Creating a functioning program consisting of an LED and an analogue (ADC) dial to drive the system.
 
  
 +
==Web Developer getting started==
  
==Using The Component Panels==
+
New with the realise of Flowcode v10.1 is Web Developer which allows the development of interactive web pages using the Flowcode IDE environment on any platform that supports HTML browsers.
*[[Exercise - System Panel - Adding Objects|Adding Objects to the System Panel]] - Using the System Panel with components and configuring options for suitable use with components.
 
*[[Exercise - System Panel - Controlling Shapes|Controlling Shapes on the System Panel]] - Manipulating and displaying components on the System Panel and controlling the camera and views.
 
*[[Exercise - Dashboard Panel - Adding Objects|Adding Objects to the Dashboard Panel]] - Configuring the Dashboard Panel to manipulate components and component properties accordingly.
 
*[[Exercise - Dashboard and System Panel - Controlling Multiple Objects|Controlling Multiple Objects]] - Using the Dashboard and System Panel together to effectively program and simulate a system.
 
*[[Exercise - System Panel - Controlling Collisions|Controlling Collisions on the System Panel]] - Configuring the System Panel to display and control object collision using different methods.
 
  
 +
The [[Web_Developer_Getting_Started_Guide|Web developer getting started guide]] takes you through your first experience of Web Developer and demonstrates how to generate interactive HTML files.
  
==Component Creation==
+
 
*[[Exercise - Create an LED Component | Create an LED Component]] - Creating a flowchart revolving around an LED component driven by simulation macros and functions.
+
==PC Developer Getting Started Guide==
*[[Exercise - Exporting the LED Component | Exporting the LED Component]] - Exporting and saving the component, including simulation macros and properties and variables.
+
 
*[[Exercise - Importing the LED Component | Importing the LED Component]] - Importing the component into a new flowchart and preparing it for testing in simulation.
+
The [[PC_Developer_Getting_Started_Guide|PC Developer Getting Started Guide]] takes you through the various stages of creating PC developer code that includes switches, timer and graph logging.
*[[Exercise - Testing an Imported LED Component | Testing an Imported Component]] - Testing the imported LED by creating a flowchart program to run in simulation to test the component.
+
 
*[[Exercise - Building a Complex Component | Building a Complex Component - The Traffic Cone]] - Building and programming a component by grouping multiple elements on the System Panel.
+
 
*[[Exercise - Exporting the Traffic Cone Component| Exporting the Traffic Cone]] - Exporting and saving the component, including simulation macros and properties to prepare for testing.
+
==Using PC_Developer APIs to Control an Arduino==
*[[Exercise - Importing and Testing the Traffic Cone| Importing and Testing the Traffic Cone]] - Import the component and test it in simulation by calling the previously programmed simulation macro.
+
 
 +
The [[Using_PC_Developer_APIs_to_Control_an_Arduino|Using PC Developer APIs to Control an Arduino]] Takes you through creating HMI (Human machine Interface) Windows-based applications. that can control ESP32, and Arduino hardware in real time.
 +
 
 +
 
 +
==Raspberry Pi_Getting Started Guide==
 +
 
 +
The [[Raspberry_Pi_Getting_Started_Guide|Raspberry Pi Getting Started Guide]] shows you how to set up the Raspberry Pi to enable it to be programmed via Flowcode.
 +
 
 +
 
 +
==Sysblocks Getting Started Guide==
 +
 
 +
The [[Sysblocks_Getting_Started_Guide|Sysblocks Getting Started Guide]] take you through signal processing for Music technology, DSP, Communications and Software Defined Radio.
 +
 
 +
Sysblocks is an exciting piece of hardware for use with education in mind.
 +
 
 +
===Examples===
 +
 
 +
There are loads of examples available.
 +
To find an example of a component you are interested in.
 +
Search for the component by selecting the magnifying glass on the left Components Libraries ribbon.   
 +
Right-click on the component you would like to look at an example for,  then select help.
 +
If there are no examples available then you can request an example on the [https://flowcode.co.uk/forums/index.php forums].
 +
 
 +
==Embedded==
 +
 
 +
===Heat Control - Coarse===
 +
 
 +
lots of modern electronic systems include some form of simple closed loop heat control to function. Some examples include a kitchen oven, a microwave oven, an iron, hair straighteners, electric heater, etc.
 +
 
 +
These devices typically work by monitoring the temperature and then switching on a heating element when the temperature is less then the required temperature. The element is then switched off again when the required temperature is reached.
 +
 
 +
The electronics involved could be a microcontroller digital output pin connected to a simple transistor, diode and relay to control the heater element and a thermistor to measure the heat.
 +
 
 +
{{Fcfile|DSP_Heater_Coarse_Control.fcfx|DSP Heater Coarse Control}}
 +
 
 +
 
 +
===Heat Control - Fine===
 +
 
 +
More advanced electronic systems may require a bit more fine control of the temperature to avoid overshoot and improve response to load changes. Some examples include a SMD reflow oven, 3D printer hotend, soldering iron, etc.
 +
 
 +
These devices typically work by monitoring the temperature and then providing an analogue output to a heating element. The analogue value is calculated using a transfer function in this case we are using PID control.
 +
 
 +
The electronics involved could be a microcontroller PWM output pin connected to logic level FET or TRIAC to control the heater element and a thermocouple to measure the heat.
 +
 
 +
{{Fcfile|DSP_Heater_Fine_Control.fcfx|DSP Heater Fine Control}}
 +
 
 +
 
 +
=== Multi-function AC Power Monitor===
 +
 
 +
The PZEM-004T is Multifunction AC Power Monitor which uses MODBUS to communicate with the microcontroller.
 +
 
 +
It can measure Voltage, Current, Frequency Power, Power Factor & Energy used (Resetable).
 +
 
 +
The power level threshold can be set to give OVERPOWER warning.
 +
 
 +
Before programming, check LCD address and Power Level Threshold are correct within the 2D Panel Properties.
 +
 
 +
As the MODBUS uses UART channel on the Arduino Uno, the UART software timer is used to send all the power values.
 +
Therefore you will require a TTL to USB converter or an analyser that can decode UART.
 +
 
 +
{{Fcfile|Arduino_Uno_Mains_PM_LCDv1.2.fcfx|Arduino Uno AC Multi-function Monitor v1.2}}
 +
 
 +
===Current Sensor (ACS7xx) component===
 +
ACS7XX range of unidirectional and bidirectional  5, 20, 30, 50, 100, 150 & 200A current sensors
 +
 
 +
A simple example shows how to use a ASC712 component to measure a current range of +/- 5A.
 +
The component type can be changed within its properties.
 +
 
 +
{{Fcfile|Current_measure_ACS7xx.fcfx|ACS712 example}}
 +
 
 +
 
 +
 
 +
===Circular Buffer - Reliable Communications Data===
 +
 
 +
This example takes bytes received from the Serial UART and uses the circular buffer to store the bytes as they come in using an interrupt. The main routine then forwards the bytes through to a PC using a USB serial connection.
 +
 
 +
This example would work equally well for creating a bridge between several UARTs or translating Serial to SPI or I2C etc.
 +
 
 +
{{Fcfile|CommsBuffer.fcfx|UART to USB Serial Data Bridge}}
 +
 
 +
The LCD will retain the contents of the display, for high speed data we only want to have to write to the portion of the display that can change.
 +
 
 +
{{Fcfile|LCDDemo.fcfx|LCD Demo}}
 +
 
 +
{{Fcfile|BME280 Barometer plus Altitude v1.0.fcfx|BME280 Barometer plus Altitude v1.0}}
 +
This example reads and displays the pressure, temperature & humidity.
 +
If the pressure is increasing then Rise will be displayed.
 +
 
 +
Alternatively if the pressure is falling, then Fall will be displayed.
 +
 
 +
The altitude displayed is calculated based on the current pressure reading.
 +
 
 +
What makes the altitude useful is the ability to tare it,
 +
then after going up or downstairs for example the feet & meters are displayed.
 +
 
 +
Note since the altitude is calculated based on pressure, then if the sensor is left at the same height,
 +
the height displayed can be different each day.
 +
 
 +
==App Developer==
 +
 
 +
[[File:freeapp-io-monitor2.png]]
 +
 
 +
A range of example App Developer projects are available from here: https://www.flowcode.co.uk/app-developer/free-apps/
 +
 
 +
A simple example that shows how to use some common functions of the potentiometer in conjunction with an LCD.
 +
 
 +
{{Fcfile|Potentiometer Example.fcfx|Potentiometer Example}}
 +
 
 +
 
 +
 
 +
A basic worked example showing how to use Flowcode to create an embedded project that is controlled via a web app using HTTP.
 +
 
 +
This set of 6 projects provides a detailed look at simple communications between an ESP32 device and a web browser using Flowcode to construct both the embedded app and the web app.
 +
 
 +
[https://www.flowcode.co.uk/resources/software/Worked%20Example%20-%20HTTP%20Comms%20v1.0.zip HTTP Comms Worked Example - Web Developer]
 +
 
 +
 
 +
 
 +
 
 +
A worked example showing how to create an embedded project that communicates with a PC via the serial port.
 +
 
 +
This simple example shows two projects - an embedded app and a PC-based app - that communicate with each other using the serial port, exchanging text messages between the embedded device and the PC.
 +
 
 +
[https://www.flowcode.co.uk/resources/software/Worked%20Example%20-%20Serial%20Comms%20v1.0.zip Serial Comms Worked Example - PC Developer]
 +
 
 +
 
 +
 
 +
 
 +
A worked example showing how to develop Flowcode MQTT apps.
 +
 
 +
This project details a simple application for exchanging messages between embedded and non-embedded devices using the popular MQTT protocol. Flowcode is used to create three apps - an embedded app running on an ESP32 device, a PC app running on Windows and a web app running in a browser.
 +
 
 +
[https://www.flowcode.co.uk/resources/software/Worked%20Example%20-%20MQTT%20Comms%20v1.0.zip MQTT Worked Example - Web & PC Developer]
 +
 
 +
==Scenarios==
 +
This page contains a list of the scenarios included with Flowcode.
 +
 
 +
The corresponding components can be found in the '''Runtime''' section of the component toolbar.
 +
 
 +
*[[Traffic Light 1-Way]]
 +
*[[Pedestrian Crossing]]
 +
*[[Airplane Landing Gear]]
 +
*[[CNC Machine]]
 +
*[[Car Seat]]

Revision as of 11:36, 7 March 2024

Introduction to Microcontrollers Course

We recommend going through the Flowcode section of the https://www.matrixtsl.com/resources/files/datasheets/Microcontroller%20compete%20course.pdf course which has been updated for the latest version of Flowcode and is available for free at the learning center section on the main www.matrixtsl.com website.

If you have a Raspberry Pi you can look at [[1]|RPI getting started guide]


Embedded Getting Started Guide

The Embedded Getting Started Guide intoruces you to the Flowcode envioment and take you though to programming a microcontroller


Web Developer getting started

New with the realise of Flowcode v10.1 is Web Developer which allows the development of interactive web pages using the Flowcode IDE environment on any platform that supports HTML browsers.

The Web developer getting started guide takes you through your first experience of Web Developer and demonstrates how to generate interactive HTML files.


PC Developer Getting Started Guide

The PC Developer Getting Started Guide takes you through the various stages of creating PC developer code that includes switches, timer and graph logging.


Using PC_Developer APIs to Control an Arduino

The Using PC Developer APIs to Control an Arduino Takes you through creating HMI (Human machine Interface) Windows-based applications. that can control ESP32, and Arduino hardware in real time.


Raspberry Pi_Getting Started Guide

The Raspberry Pi Getting Started Guide shows you how to set up the Raspberry Pi to enable it to be programmed via Flowcode.


Sysblocks Getting Started Guide

The Sysblocks Getting Started Guide take you through signal processing for Music technology, DSP, Communications and Software Defined Radio.

Sysblocks is an exciting piece of hardware for use with education in mind.

Examples

There are loads of examples available. To find an example of a component you are interested in. Search for the component by selecting the magnifying glass on the left Components Libraries ribbon. Right-click on the component you would like to look at an example for, then select help. If there are no examples available then you can request an example on the forums.

Embedded

Heat Control - Coarse

lots of modern electronic systems include some form of simple closed loop heat control to function. Some examples include a kitchen oven, a microwave oven, an iron, hair straighteners, electric heater, etc.

These devices typically work by monitoring the temperature and then switching on a heating element when the temperature is less then the required temperature. The element is then switched off again when the required temperature is reached.

The electronics involved could be a microcontroller digital output pin connected to a simple transistor, diode and relay to control the heater element and a thermistor to measure the heat.

FC6 Icon.png DSP Heater Coarse Control


Heat Control - Fine

More advanced electronic systems may require a bit more fine control of the temperature to avoid overshoot and improve response to load changes. Some examples include a SMD reflow oven, 3D printer hotend, soldering iron, etc.

These devices typically work by monitoring the temperature and then providing an analogue output to a heating element. The analogue value is calculated using a transfer function in this case we are using PID control.

The electronics involved could be a microcontroller PWM output pin connected to logic level FET or TRIAC to control the heater element and a thermocouple to measure the heat.

FC6 Icon.png DSP Heater Fine Control


Multi-function AC Power Monitor

The PZEM-004T is Multifunction AC Power Monitor which uses MODBUS to communicate with the microcontroller.

It can measure Voltage, Current, Frequency Power, Power Factor & Energy used (Resetable).

The power level threshold can be set to give OVERPOWER warning.

Before programming, check LCD address and Power Level Threshold are correct within the 2D Panel Properties.

As the MODBUS uses UART channel on the Arduino Uno, the UART software timer is used to send all the power values. Therefore you will require a TTL to USB converter or an analyser that can decode UART.

FC6 Icon.png Arduino Uno AC Multi-function Monitor v1.2

Current Sensor (ACS7xx) component

ACS7XX range of unidirectional and bidirectional 5, 20, 30, 50, 100, 150 & 200A current sensors

A simple example shows how to use a ASC712 component to measure a current range of +/- 5A. The component type can be changed within its properties.

FC6 Icon.png ACS712 example


Circular Buffer - Reliable Communications Data

This example takes bytes received from the Serial UART and uses the circular buffer to store the bytes as they come in using an interrupt. The main routine then forwards the bytes through to a PC using a USB serial connection.

This example would work equally well for creating a bridge between several UARTs or translating Serial to SPI or I2C etc.

FC6 Icon.png UART to USB Serial Data Bridge

The LCD will retain the contents of the display, for high speed data we only want to have to write to the portion of the display that can change.

FC6 Icon.png LCD Demo

FC6 Icon.png BME280 Barometer plus Altitude v1.0 This example reads and displays the pressure, temperature & humidity. If the pressure is increasing then Rise will be displayed.

Alternatively if the pressure is falling, then Fall will be displayed.

The altitude displayed is calculated based on the current pressure reading.

What makes the altitude useful is the ability to tare it, then after going up or downstairs for example the feet & meters are displayed.

Note since the altitude is calculated based on pressure, then if the sensor is left at the same height, the height displayed can be different each day.

App Developer

Freeapp-io-monitor2.png

A range of example App Developer projects are available from here: https://www.flowcode.co.uk/app-developer/free-apps/

A simple example that shows how to use some common functions of the potentiometer in conjunction with an LCD.

FC6 Icon.png Potentiometer Example


A basic worked example showing how to use Flowcode to create an embedded project that is controlled via a web app using HTTP.

This set of 6 projects provides a detailed look at simple communications between an ESP32 device and a web browser using Flowcode to construct both the embedded app and the web app.

HTTP Comms Worked Example - Web Developer



A worked example showing how to create an embedded project that communicates with a PC via the serial port.

This simple example shows two projects - an embedded app and a PC-based app - that communicate with each other using the serial port, exchanging text messages between the embedded device and the PC.

Serial Comms Worked Example - PC Developer



A worked example showing how to develop Flowcode MQTT apps.

This project details a simple application for exchanging messages between embedded and non-embedded devices using the popular MQTT protocol. Flowcode is used to create three apps - an embedded app running on an ESP32 device, a PC app running on Windows and a web app running in a browser.

MQTT Worked Example - Web & PC Developer

Scenarios

This page contains a list of the scenarios included with Flowcode.

The corresponding components can be found in the Runtime section of the component toolbar.