Connecting Pico W to Blynk IoT using Arduino IDE

Hi All,

I’ve looked around in past post on this but have not quite found my answer. Hoping to pick your brain with this post…

I’ve done several projects using ESP32 Dev module and Blynk IoT. Now I am interested in using R Pi W. I checked the Edgent examples in Arduino IDE but don’t see any relating to pico W. Also there does not appear to be a configuration for the Pico W in the settings.h file. I see there is a custom settings section, so I am wondering what I should edit there?

I want to use Arduino IDE to program the Pico W. I have already built the circuit (and tested that it works) for the Pico with a simply LED on GP14. For now to get started I simply want to turn ON and OFF the LED via the Blynk IoT app. I made a template and assigned a virtual pin to a switch button. All good. The thing missing is the configuration for the Pico in the settings. Any help is much appreciated.

Cheers,
MathPi


Edit # 1 - some further digging…
I am just trying to compile the sketch without declaring any board (e.g. such as #define USE_ESP32_DEV_MODULE). Below is my code.

#define BLYNK_TEMPLATE_ID "REMOVED"
#define BLYNK_TEMPLATE_NAME "REMOVED"
#define BLYNK_FIRMWARE_VERSION "0.0.1"
#define BLYNK_PRINT Serial
#define APP_DEBUG
// #define USE_ESP32_DEV_MODULE
#include "BlynkEdgent.h" 

BlynkTimer timer; // Announcing the timer

// Setting the pin numbers for the LEDs. Pin assignments are hardwired and therefore should not be changed here.
const int LED1 = 14;
const int LED2 = 15;

BLYNK_WRITE(V0) {
  // integer value for LED1
  int statusLED1 = param.asInt();
}

BLYNK_WRITE(V1) {
  // integer value for LED2
  int statusLED2 = param.asInt();
}

void setup() {
  // initialize the LED pin as an output:
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);

  Blynk.virtualWrite(V0, 0); // Set LED1 initially to off
  Blynk.virtualWrite(V1, 0); // Set LED2 initially to off

  timer.setInterval(5L, data_transfer);
}

void loop() {
  BlynkEdgent.run();
  timer.run(); 
}

data_transfer(){
  // check if B1 is pressed. If it is, the buttonState is HIGH:
  if (statusLED1 == HIGH) {
    // turn LED1 ON:
    digitalWrite(LED1, HIGH);
  } else {
    // turn LED1 OFF:
    digitalWrite(LED1, LOW);
  }

    // check if B2 is pressed. If it is, the buttonState is HIGH:
  if (statusLED2 == HIGH) {
    // turn LED2 ON:
    digitalWrite(LED2, HIGH);
  } else {
    // turn LED2 OFF:
    digitalWrite(LED2, LOW);
  }
}

Upon trying to compile I get error message that a file named Preferences.h is missing. I cannot find it under any folder within Blynk. Searching online I can’t find it either. Here are some of the messages I get…

In file included from [path removed]\Example\BlynkEdgent.h:8,
from [path removed]\Example\PicoBaseProto_Basics.ino:23:
[path removed]\Arduino\libraries\Blynk\src/BlynkSimpleEsp32_SSL.h:15:2: error: #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.
15 | #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.
| ^~~~~
In file included from [path removed]\BlynkEdgent.h:37,
from [path removed]\Example.ino:23:
[path removed]\Example\ConfigStore.h:111:10: fatal error: Preferences.h: No such file or directory
111 | #include <Preferences.h>
| ^~~~~~~~~~~~~~~
compilation terminated.

I got the correct board selected under Tools-> Board setting (Raspberry Pi Pico W).

I am using Arduino IDE 2.0.3 and the Blynk library 1.2.0. So I guess I now have two questions.

Finally, I know that I have Arduino IDE properly configured for RPi as other sketches (not Edgent related) work just fine. I am able to compile and upload sketches to the RPi and make an LED blink, for example.

  1. How to configure the settings.h file?
  2. How to fix the missing Preferences.h file?

Any tips or guidance would be much appreciated :smiley:

Pico W is not supported with Edgent. you can use plain Blynk

https://docs.blynk.io/en/blynk.edgent/overview#hardware-supported-by-blynk.edgent

Hi Juraj,

Yes I am aware Pico W is not supported. I guess my question is how can the header files in the Edgent library be configured such that Pico W does work with Edgent?

On The Blynk website, when I go to template settings, I can even enter from a dropdown menu that the hardware is Raspberry Pi… So I would at the very least think that there are plans to get Pico W supported.


MathPi

Am I missing something here?

  • You’ve been told that the Pico W is not supported by Edgent.

  • You’ve acknowledged that the Pico W is not supported by Edgent.

  • You want to know how to change Edgent so that the Pico W is supported.

Answer, you can’t, because the Pico W is not supported by Edgent!

You can use a non-Edgent sketch with the Pico W, but not Edgent, because that board isn’t supported by Edgent.

As far as the board types in the template settings are concerned, these appear to have no functionality at present, other than to act as a memo field.
Hopefully in future the analog and digital pins used in the digital datastreams will vary according to the board type selected, in a similar way to how they did in Blynk Legacy.

Either way, this setting is applicable to all sketch types, not just Edgent, so seeing Raspberry Pi in that list means nothing in terms of future plans regarding adding Edgent capability for the Pico W board.,

Pete.

Hi Pete,

I guess I had assumed it could be made supported by editing one or more of those header files in the Edgent Library. From what I am hearing now, there is no way to configure or edit these files such that Pico W can work with Edgent. If that’s the case, then I suppose this may be a wishlist item I can suggest to the Developers in another post. Thanks for your feedback.

Cheers,
MathPi

That is the case.

Pete.

1 Like

Ok, thanks. I’ll make a post for a wishlist item.

Cheers,
MathPi

that “Rasppbery PI” are the Linux SOC boards, not the Pico MCU

1 Like