|
|
Line 43: |
Line 43: |
| ==Examples== | | ==Examples== |
| | | |
− | | + | ===LoraWAN Demo=== |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | The MQTT component requires connection to a Network Comms component via the "Network Component" property, to provide the bridge for simulated TCP/IP communication.
| |
− | | |
− | The Network Comms component can then be linked to an embedded TCP/IP component to provide embedded TCP/IP support.
| |
− | | |
− | [[File:MQTT_Connection.jpg]]
| |
− | | |
− | Here is a typical setup for using MQTT on a Raspberry Pi.
| |
− | | |
− | | |
− | ===Local Weather=== | |
− | | |
− | A simple example demonstrating how to use MQTT with Flowcode SCADA to get the local weather conditions.
| |
− | | |
− | The example shows temperatures from Halifax in the UK and from Sydney in Australia.
| |
− | | |
− | {{Fcfile|SCADA_BBC_TEMPERATURES.fcsx|SCADA BBC TEMPERATURES}}
| |
− | | |
− | | |
− | | |
− | ===Publish===
| |
− | | |
− | ====Raspberry Pi====
| |
− | | |
− | Here we have an embedded Raspberry Pi project connected to an I2C Sensor, the sensor is sampled and the data is published to a MQTT server.
| |
− | | |
− | {{Fcfile|RPI3_MQTT_IOT_EBM016.fcfx|RPI3 MQTT IOT EBM016}}
| |
− | | |
− | | |
− | ====ESP8266 Module====
| |
− | | |
− | Here we have an embedded project using an ESP8266 wifi module, an analogue input is sampled and the data is published to a MQTT server.
| |
− | | |
− | {{Fcfile|PublishESP8266.fcfx|MQTT IOT ESP8266}}
| |
− | | |
− | | |
− | ===Subscribe===
| |
− | | |
− | ====ESP8266 Module====
| |
− | | |
− | Here we subscribe to a topic and receive it back into Flowcode embedded using an ESP8266 module.
| |
− | | |
− | {{Fcfile|SubscribeESP8266.fcfx|Subscribe ESP8266 MQTT}}
| |
− | | |
− | | |
− | ====Flowcode App Developer====
| |
− | | |
− | Here we subscribe to a topic and receive it back into Flowcode App Developer.
| |
− | | |
− | {{Fcfile|SCADA_MQTT.fcsx|Subscribe App Developer MQTT}}
| |
− | | |
− | | |
− | ===Making your own Raspberry Pi based MQTT Broker===
| |
− | | |
− | Click here for instructions on creating your own [[Raspberry_Pi_MQTT_Broker|Raspberry Pi MQTT Broker]].
| |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
| | | |
| ==Macro reference== | | ==Macro reference== |
Revision as of 09:04, 9 June 2025
Author
|
Jac Kersing
|
Version
|
1.0
|
Category
|
Comms: IoT/Cloud
|
LoRaWAN (Seeed WIO-E5) component
LoRaWAN Component for the Seeed WIO-E5 module.
Detailed description
No detailed description exists yet for this component
Examples
LoraWAN Demo
Macro reference
ChkConnected
|
ChkConnected
|
Sends AT command and checks response to check the LoRa E5 module is connected to the controller.
|
- INT
|
Return
|
Ev_Start
|
Ev_Start
|
Broadcast to all components that simulation is starting
|
- ULONG
|
Return
|
Ev_Stop
|
Ev_Stop
|
Broadcast to all components that simulation has stopped
|
- ULONG
|
Return
|
Ev_Timer
|
Ev_Timer
|
Called back on the panel command System.TimerStart
|
- ULONG
|
TimerID
|
The identifier passed to the System.TimerStart panel command
|
- ULONG
|
Return
|
FreeUart
|
FreeUart
|
Release UART resources (to allow for sleeping on some microcontrollers)
|
- VOID
|
Return
|
GetDownlinkByte
|
GetDownlinkByte
|
Get one byte from the received downlink message, returns -1 if no more bytes are available.
|
- INT
|
Return
|
GetId
|
GetId
|
Get the specified ID from the LoRaWAN module. Valid types are DevEUI, AppEUI and DevAddr
|
- STRING
|
type
|
|
- STRING
|
Return
|
GetPort
|
GetPort
|
Get the portnumber of the downlink message.
|
- BYTE
|
Return
|
GotDownlink
|
GotDownlink
|
Was a downlink received?
|
- BOOL
|
Return
|
Initialize
|
Initialize
|
Initialize the component. Should be called before any other function is used but after the component received a hardware reset. (Toggle of the reset pin)
|
- VOID
|
Return
|
Join
|
Join
|
Execute a join command to have the module join the LoRaWAN network. Returns 1 on a successfull join, 0 if the join failed. Keep in mind there is no interaction with the LoRaWAN network if Join mode is ABP so it will always succeed if all parameters have been initialized correctly. In Join mode OTAA a join will fail if the module does not get a valid response from teh network which may occur if the DevEUI, AppEUI or AppKey are not correct or if there is no coverage at the location.
|
- BYTE
|
Return
|
LowPowerSleep
|
LowPowerSleep
|
Set low power sleep mode. Specify the number of seconds to sleep in the range 6-12959.
|
- INT
|
seconds
|
|
- BYTE
|
Return
|
ReInitUart
|
ReInitUart
|
Reclaim the UART after low power sleep of the CONTROLLER (not the LoRaWAN module).
|
- VOID
|
Return
|
SendMsg
|
SendMsg
|
Send LoRaWAN message, the message should be an array of byte values. To conserve airtime no ASCII strings should be used.
|
- BYTE
|
msg
|
|
- BYTE
|
len
|
|
- BYTE
|
Return
|
SendMsgConfirmed
|
SendMsgConfirmed
|
Send a confirmed LoRaWAN message, the message should be an array of byte values. To conserve airtime no ASCII strings should be used. Use confirmed messages sparingly as transmitting gateways can normally receive 8 parallel messages but not 1 message while transmitting. So it kills scalebility of a LoRaWAN network!
|
- BYTE
|
msg
|
|
- BYTE
|
len
|
|
- BYTE
|
Return
|
SetDr
|
SetDr
|
Explicitly set DataRate of transmissions. Valid values depend on the region used please consult the LoRaWAN regional parameter document to find them.
|
- BYTE
|
dr
|
|
- BYTE
|
Return
|
SetId
|
SetId
|
Set an ID. Valid options are "AppEUI", "DevEUI" and "DevAddr". The value to use is an 16 HEX character long string for EUIs or a 8 HEX characters long string for DevAddr. Examples: AppEUI: "001122334455AABB" DevAddr: "001122AA"
|
- STRING
|
type
|
|
- STRING
|
value
|
|
- BYTE
|
Return
|
SetJoinMode
|
SetJoinMode
|
Set the join mode, valid options are MODE_OTAA or MODE_ABP.
|
- STRING
|
mode
|
|
- BYTE
|
Return
|
SetKey
|
SetKey
|
Set encryption key. Valid key types are: "APPKEY", "APPSKEY" and "NWKSKEY". For OTAA only APPKEY is required. For ABP both APPSKEY and NWKSKEY are required. The value shoud be a 32 HEX character string. Example value: "00112233445566778899AABBCCDDEEFF"
|
- STRING
|
type
|
|
- STRING
|
value
|
|
- BYTE
|
Return
|
SetLowPower
|
SetLowPower
|
Set the Low Power mode of the module. Low power can be off (false) or on (true)
|
- BOOL
|
on
|
|
- VOID
|
Return
|
SetPort
|
SetPort
|
Set the port used for transmissions
|
- BYTE
|
port
|
|
- BYTE
|
Return
|
SetRegion
|
SetRegion
|
Set the LoRaWAN region to be used. For US915 the band (of 8 channels) to be used needs to be specified as well, the band is ignored for EU868 TTN uses band 1 in US915.
|
- STRING
|
region
|
|
- BYTE
|
band
|
|
- BYTE
|
Return
|
Property reference
|
Properties
|
|
LoRaWAN settings
|
|
Max Downlink Size
|
Sets the number of byte elements inside the circular buffer.
|
|
Connections
|
|
Channel
|
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller.
|
|
Baud Options
|
Baud rate option selector
|
|
TX
|
Pin to be used for Transmit data
|
|
TX Remap Pin
|
Allows the hardware transmit pin to be configured from a list of available pins based on your target device,
|
|
RX
|
Pin to be used for Receive data
|
|
RX Remap Pin
|
Allows the hardware receive pin to be configured from a list of available pins based on your target device,
|
|
Simulation
|
|
Console Data
|
Selects if the console data is automatically generated or not
|
|
Console Format
|
Controls if the data is shown as a log with time and date stamps or just as raw data
|
|
Console Columns
|
Number of characters that can be displayed on a single line of the console.
|
|
Data Source
|
Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port API - Routes the communication data via a data injector component on the Panel.
|
|
API
|
Selects which API component to route the communication data via. Add API components to the panel before they will be available in this list. API components are available from the Comms component category.
|
Component Source Code
Please click here to download the component source project: FC_Comp_Source_lora-e5-component.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_lora-e5-component.fcfx