Softata: Running Blockly on local Pico from Azure Softata API
softata rpipico firmata arduino csharp grove swagger asp.net blockly
SoftaWebAPI has been deployed to Azure at softatawebapii /BlocklyAutomation. You can create Softata Blockly app there. Now you CAN actually orchestrate Softata on a RPi Pico W remotely using Blockly from that service.
Softata runs on a RPi Pico W as an Arduino Shield. The shield runs a TCP service accepting remote commands, interpreting and actioning them, and then returning the result. The calling software is a .NET library which can be called from a Console or Blazor app. There is now a web API wrapper of the library that is now used with NETCoreBlockly to provide a Blockly low-code programming environment.
As per 2 posts ago, SoftataWebAPI has been deployed to Azure as a web service as per the link above. The previous run scenario was to run the the SoftataWebAPI app locally on a desktop/laptop and using the BLocklyAutomation page connecting to a Pico W running on the local network. Using the Azure manifestation of the API app to connect to the local Pico W requires getting external access from Azure to the local network, in particular to the Arduino TCP service.
There are two options, Ngrok and NAT.
Ngrok
Ngrok enables a remote service to tunnel in to a local network and access services running there. You download ngrok from here and run such as:
ngrok tcp 192.168.0.12:4242
… where 192.168.0.12 is the Pico’s IPAddress and 4242 is its TCP service port.
That command will return with something like:
Forwarding tcp://4.tcp.ngrok.io:15129 -> 192.160.012:4242
You would then use 4.tcp.ngrok.io
as the address for remote access such as with Softata Blockly and 15129
the port.
There are now two blocks in the Blockly suite with which you can just supply the index, 4 above, and the port, 15129 above. You can just use
NgrokConnect
or choose theNgrokStart
which directly handles all of the other setup steps:
Nb: There are also
Connect
andStart
with similar options for local connect withe latter getting the Softata Version and Devices.
NAT
You configure Network Address Translation on the local router such when the network is accessed via its external IpAddress with a port specified. The configuration specifies what local IPAddress is used to forward the external request for that port to, and to what port on the internal recipient it is forwarded. This configured by accessing to router.
In my case:
- Router
- Internal 192.168.0.1
- External _(say)__ 39.48.36.56
- Pico W
- 192.168.0.12
- Port 4242
- NAT Configuration:
- Setup after logging into the Routre’s Internal IpAddress
Server Name | External Port Start | External Port End | Protocol | Internal Port Start | Internal Port End | TCP Svc IPAddress | WAN |
---|---|---|---|---|---|---|---|
Arduino | 4242 | 4242 | TCP | 4242 | 4242 | 192.168.0.12 | eth4.3 |
So remotely access the Pico using (say) 39.48.36.56:4242 which will translate to 192.168.0.12:4242
This works using SoftataWebAPI Blockly on Azure to access a local Pico W running Softata. :)
State
This works for a single user at a time. Technically a second user could also connect through Azure Blockly to another Pico W running in the same or another local network. State though is not though sessional. It is maintained in SoftataLib and is not reentrant. A user needs to complete the End command so that a subsequent user can start ith a fresh instance of the library.
This aspect is a work in progress. Maybe the start can be made sessional or commands use an ID. Or maybe single use could be enforced with a ???
Topic | Subtopic | |
This Category Links | ||
Category: | Softata Index: | Softata |
Next: > | Softata | Latest NetCoreBlockly Updates |
< Prev: | Softata | Blockly Functions |