Softata: Keep It Simple Stupid! A quick and easy approach to getting started with Softata. Softata facilitates dynamically orchestrating a Raspberry Pi Pico W over WiFi from a .NET context. It can be driven from a local .NET Console or Blazor app. It can also be orchestrated from a Swagger or Blockly interface to a local web service. These last two can also be accessed from an existing Azure Static Web.

THIS PAGE IS INCOMPLETE. PLEASE WATCH THIS SPACE!

Nb: Local here means running on the same local network.

Getting Started

  1. Access the Softata Azure website softatawebapii azure websites
  2. Get the .zip file from Get the SoftataOTA bin and related batch files for upload without IDE: Download as zip
  3. Extract it into a folder.

KISS

With a RPi Pico W provisioned for Arduino, Softata can be uploaded directly over USB using a given batch file and downloadable prebuilt image. With tunnelling, it can be exposed to the Softata Azure Web site where Blockly can be use to drive it. There are a number of example programs in the Blockly site that can be used. This is all without needing the Arduino IDE.

If you have already installed the earlephilhower Arduino BSP onto your Pico W and you know its IP Address on the local WiFi network, you can skip the next section. Expand the next section if you need either:

BSP and IP Address ## Spoiler This does require that the Pico has previously been provisioned with the Arduino BSP via the Arduino IDE such that a sketch can be deployed to it from the IDE. Youcan provision the device via teh Arduino IDE: [Provision of RPi Pico W with Arduino BSP (_earlephilhower version_)](https://github.com/earlephilhower/arduino-pico?tab=readme-ov-file#installation) **But lets avoid the IDE if we can (KISS):** Connect the Pico via USB. ub2 will be used to upload. - Connect the USB cable to the Pico - Hold the BootSel button on the Pico and insert the USB cable into the PC. - D drive (or similar) will now become available - Copy ```SoftataOTA.ino.uf2``` to D (or whatever) drive. It will upload and flash the image! ***Simples*** > Issue: We need to get the WiFi connection details into that image in a "generic" manner. Also, you need the Pico W's WiFi IP Address in the local network. If you don't have it then run a Sketch that connects to the local WiFi and get its address. _(You will need the ID for this). For example, run this sketch: ```cpp #include char ssid[] = "yourLocalNetwork"; //SSID of your network char passwd[] = "your password"; int status = WL_IDLE_STATUS; // the Wifi radio's status IPAddress ip; // the IP address of your shield void setup() { // initialize serial: Serial.begin(115200); WiFi.begin(ssid,passwd); if ( status != WL_CONNECTED) { Serial.println("Couldn't get a wifi connection"); while(true); } else { //print the local IP address ip = WiFi.localIP(); Serial.println(ip); } } void loop () {} ``` Alternatively, to avoid the IDE, install the [Fing](https://play.google.com/store/apps/details?id=com.overlook.android.fing&hl=en_IN&gl=US) app on your phone, run the app, select See Devices and look for a device with a name starting with pico-. That's your Pico W. Note is IP Address. _Nb: If you install Fing on your PC you will possibly have to run it in Admin mode._ </details>
> Past this point you don't need the Arduino IDE at all Nb: Also we don't need the COM port, and we don't need to Pico W's IP Address for getting started. ## ------------------------------------------------------ ## Continuing 1. Open a cmd terminal to the folder where the download from Azure was expanded. 2. Connect the Pico via USB. ub2 will be used to download. - Connect the USB cable to the Pico - Hold the BootSel button on the Pico and insert the USB cable into the PC. 3. Run the batch file ```USBSerial-pythoninpath.bat``` in the terminal. > Actually, this just repeated the previous upload! The Serial messages have been disabled _(actually, all Serial.print etc statements just invoke a 100ms delay)_ in this image so you will only see the the InBuilt LED flash. The serial flash terminal output: ``` USB-Serial uf2 deployment of (previously) built sketch uf2 Expecting python3 to be in Path Expecting the built sketch uf2 in Sketch folder\ota Expecting the uf2conv.py from tools in ota folder Also expect pyserial folder from tools in ota folder Remove device from USB, hold down BOOTSEL button, plug in USB, release BOOTSEL button. =================================================== Sketch: SoftataOTA Sketch Folder: .\SoftataOTA serialPort: uf2 =================================================== . Press any key to continue . . . Converting to uf2, output size: 1387520, start address: 0x2000 Scanning for RP2040 devices Flashing D: (RPI-RP2) Wrote 1387520 bytes to D:/NEW.UF2 Press any key to continue . . . ``` #### The (Serial) Boot Flash sequence - Booting: 5 short pulses - Got WiFi: 3 long pulses - Ready: 8 ultra short pulses - Finally you get the extra long flashes - Note that these are shorter when Softata apps are connected. > From now on you can use OTA to upload the bin to the Pico. Click below to expand.
OTA Boot ## OTA Boot Run the batch file ```OTA-pythoninpath.bat``` in the terminal. You will be prompted for the IP Address. ``` OTA deployment of (previously) built sketch bin Expecting python3 to be in Path Expecting the built sketch bin in Sketch folder\ota Expecting the espota.py in ota folder from tools folder: Enter ipaddress for device ... Or edit in this batch file =================================================== What IPAddress? Default: "192.168.0.20" Sketch: SoftataOTA Sketch Folder: .\SoftataOTA Device IPAdress: "192.168.0.20" OTA Port: "2040" =================================================== . Press any key to continue . . . Uploading............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ Complete Press any key to continue . . . PS C:\Users\david\Downloads\ota\ota> ``` #### The OTA Flash Sequence - Start OTA: 4 Ultra Short Flashes - _Error: 6 Ultra Long pulses_ - End OTA: 4 long pulses - Ready: 8 ultra short pulses - Then you get the Boot Flash sequence as its rebooting
## Running Blockly 1. Access the Softata Azure website [softatawebapii azure websites](https://softatawebapii.azurewebsites.net/) and select [SoftataNetCoreBlockly](https://softatawebapii.azurewebsites.net/BlocklyAutomation) under **Run as Blockly*** 2. Expand Blockly Core->SwaggersMy Site->API - You can pause this and follow the popups if you wish 3. From the Examples menu select the second option **Softata Start Example**. If this web site was running locally we could just enter the IP Address and be away. As the site is running on Azure we need some "tunnelling". This has been covered in a previous post here [Softata: Running Blockly on local Pico from Azure Softata API](https://davidjones.sportronics.com.au/softata/Softata-Running_Blockly_on_local_Pico_from_Azure_SoftataAPII-softata.html) but lets just use the ngrok option: Ngrok enables a remote service to tunnel in to a local network and access services running there. You download [ngrok from here](https://ngrok.com/download) 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 ``` From a command prompt run: ``` ngrok tcp 192.168.XX.YY:4242 ``` where 192.168.XX.YY is the Pico's IP Address You will get something like: ``` Web Interface http://127.0.0.1:4040 Forwarding tcp://0.tcp.ngrok.io:18069 -> 192.168.0.20:4242 ``` The index in what follows is 0 (from tcp://0.tcp) and the port is ```18069```. Install ngrok as per link above. Back in blockly, load the ngrokBasic example _(not there yet)_. Enter the index and port values as above, and run it. Alternatively you could have used the first example setting the IP Address to ```0.tcp.ngrok.io``` Output windows shows something like: ``` vRelease2024.502.2130 :start running code ! Connected to 0.tcp.ngrok.io:18069 and Ready Softata Version:9.40 DEVICES:sensor,actuator,communication,display,serial finish running code! ```

 TopicSubtopic
  Next: > Sample RPi Pico Sketches
   
 This Category Links 
Category:Softata Index:Softata
  Next: > Softata
<  Prev:   Softata