Pico W with Arduino...
 
Notifications
Clear all

Pico W with Arduino IDE

49 Posts
9 Users
2 Likes
3,228 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1076
Topic starter  

Use the new Pico W with the Arduino IDE instead of microPython!

On June 30, 2022, Raspberry Pi announced the latest iteration of it’s RP2040-based Pico microcontroller. The Pico W has the same pinout and form factor as the original Pico and has WiFi capabilities.

Raspberry Pi also released a new UF2 file and several samples using microPython with the new WiFi chip. However, although they did release a C++ SDK, there was no update to the Arduino IDE for the new microcontroller.

But you CAN use the Pico W with the Arduino IDE by using a new boards manager file that covers virtually every RP2040-based board.   And today, I’ll show you how to install that for the classic Arduino IDE 1.8 and the newer IDE 2.0.

After installing the new boards manager, we’ll give it a test. Then we’ll see how we can use the new WiFi features to control LEDs and servo motors with a web-based interface.

Here is the Table of Contents for today's video:

00:00 - Introduction
03:25 - Raspberry Pi Pico W
08:05 - Bluetooth issues?
10:55 - Pico W vs. ESP32
13:35 - Installing the Boards Manager
18:22 - Blink test
20:48 - WiFi Network Scan
23:10 - Using the WiFi Library
28:07 - Using Web Data
30:56 - Pico W LED Control
37:43 - Pico W Servo Control
47:28 - Conclusion

The Arduino IDE is a popular interface for programming microcontrollers, and now we can use it with the Pico W.

Hope you enjoy the video!

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
Quote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2519
 
Posted by: @dronebot-workshop

Use the new Pico W with the Arduino IDE instead of microPython!

Yay ! Now you're talkin', thanks Bill.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6930
 
Posted by: @dronebot-workshop

Use the new Pico W with the Arduino IDE instead of microPython!

HOWEVER, there are projects (I have one) that need the C/C++SDK, will/can you cover that at some point? My very cursory look tells me I need to use a Raspberry Pi and run various GIT commands, WGET, and a few others. The project is for a PICO UPS using a daughter board and rechargeable AA battery.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@bwims)
Member
Joined: 2 years ago
Posts: 1
 

Hi,  I am having difficulties here.  I want to use a RPi running Arduino to program the Pico, but it stubbornly refuses to create a tty port when plugged in.

 

This issue implies that a port should be created (see the dropdown on ports) but I cannot find any way to do it!  Any advice gratefully received!

 

B.


   
ReplyQuote
(@timbo)
Member
Joined: 3 years ago
Posts: 2
 

I have several EPS-32 projects using VSCode with PlatformIO as the IDE. I got a lot of help from your videos on those.

Can you use VS/PlatformIO to program the Pico W?


   
ReplyQuote
(@nsshore)
Member
Joined: 1 year ago
Posts: 14
 

Hi. I am using Arduino IDE 2 and have followed all the steps in the video but after many attempts, Google searches, and unplugging and reconnecting my usb cable innumerable times have been unable to connect. The strange thing is that the OS (POP OS Linux) recognizes the Pico W and I can read the files on it but the IDE doesn't know it is there. No ports appear on the board manager and I cannot find anyplace to specify a port. So I am at a loss here as to what to do next. It doesn't seem that it should be this hard or time consuming or frustrating. Any help will be much appreciated. Thanks in advance.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2519
 

@nsshore 

Are you wanting to program it in C++ or microPython ?

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6930
 

@nsshore You need to provide screen shots. You are right, it shouldn't be hard at all. The usual problem is a wrong driver. I am running a Mac but do have a Raspberry Pi4 I might get out tomorrow and have a look.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6930
 

@nsshore Here is my boards setup, make sure you have what is needed. Also a shot of my ports.

Screenshot 2022 12 13 at 20.04.02
Screenshot 2022 12 13 at 19.58.42
Screenshot 2022 12 13 at 19.59.41

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@nsshore)
Member
Joined: 1 year ago
Posts: 14
 

Thanks for the quick responses. I would prefer to continue in C++ as I've already invested in learning it but have no aversion to micropython.

I followed the Adafruit instructions for micro/circuit python and it connected right up no problem. 

And now when I try the Arduino IDE I have a port and can connect. So something in the Adafruit process added a port.

Until I run the Blink sketch then I get a bunch of errors and the port disappears, I unplug the usb cable and get the port back but blink does not work.

Error messages as follows:

Resetting /dev/ttyACM0
Converting to uf2, output size: 634880, start address: 0x2000
Traceback (most recent call last):
File "/home/michaelwybo/.arduino15/packages/rp2040/hardware/rp2040/2.6.4/tools/uf2conv.py", line 401, in <module>
main()
File "/home/michaelwybo/.arduino15/packages/rp2040/hardware/rp2040/2.6.4/tools/uf2conv.py", line 388, in main
drives = get_drives()
File "/home/michaelwybo/.arduino15/packages/rp2040/hardware/rp2040/2.6.4/tools/uf2conv.py", line 262, in get_drives
for d in os.listdir(rootpath):
FileNotFoundError: [Errno 2] No such file or directory: '/opt/media'
Failed uploading: uploading error: exit status 1

 

Anyway, thanks for your help.

Cheers

 


   
ReplyQuote
(@timbo)
Member
Joined: 3 years ago
Posts: 2
 

I am working on a project using Thonny for my IDE, running on Ubuntu 22.04. When I plug in the USB cable, most often it does not connect. If I unplug it and plug it back in multiple times (e.g. 8-10 times) it will eventually connect; you can see /dev/ttyACM0 or you will see it show up using lsusb command.

Is it a problem with the OS, driver, IDE, ???

Very strange.

When I connect with the USB cable and it is not detected, it is still providing power to the Pico and running the program. I know this because I incorporated MQTT to send temperature/humidity readings to a broker. I am receiving these messages and various "debug" messages the same as when I run the program and view the output in REPL. 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6930
 

@timbo Please start a new thread in an appropriate sub-forum. Screen shots will be useful, I don't use Thonny so I can't help.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6930
 

@nsshore Post actual screen shots. Use the Help menu at the top right of the forum to learn how to post, where to post and understand we are NOT mind readers. There is almost no useful info in your problem description. Forget everything else, start from scratch and try to run the Blinik sketch, if that works try something like the WiFiScan.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6930
 

@timbo So other than having to plug the cable in numerous times everything is ok. If you think it's an OS problem, post in the OS vendors forum, if you think it's the driver, post in the vendors driver forum, if you think it's the IDE, post in the appropriate GIT section. Since you appear to be a seasoned developer because you have MQTT set up it's confusing to hear you confused about the power being supplied. What the heck is REPL. It sounds like you are running Linux and working with a PICO. The procedures for connecting a PICO are VERY different than an arduino. Make sure you have that mastered by running a sample like blink. Once you know the procedure to load code onto a pico then move on to something more complex.

Since this is not about Bills video, start a new thread in an appropriate sub-forum

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@nsshore)
Member
Joined: 1 year ago
Posts: 14
 

@zander I'll try to be more detailed here.

The overall problem is that I am unable to connect to a Raspberry Pico W.

Here is a screen shot of the boards manager connected to the Arduino Uno

UNO connected Port

and the IDE

UNO port

 

And connected to the Pico W which appears on my linux machine at a USB drive RPI-RP2

As you can see there are no ports available.

Pico no port

I have followed the instructions as per Bill's video

Library installed

library installed

JSON URL installed in Preferences

json installed

I cannot seem to get a capture of the expanded Tools menu but the PICO W is selected.

When I try to run the Blink sketch I get this which is expected as there are no ports associated with the Pico.

Blink no port

So my problem is that I cannot find a way to create a port to the PICO.

I have been able to find a UF2 file written in C on the Rasp Pi documentation site ( https://www.raspberrypi.com/documentation/microcontrollers/c_sdk.html#blink-an-led) by doing the following:

Blink UF2

I have been able to load a few CircuitPython files and get them to run but this also is a bit sketchy as sometimes the Pico comes up as a writable USB RPI - RP2 and sometimes as CIRCUITPY. How it appears seems somewhat random but that is not the immediate problem, just some extra information that may be helpful. I also do not understand the whole UF2 thing and am not asking here for an explanation but just whether I need to delve into that as well in order to use the PICO with the Arduino IDE. I hope not.

I have started from the beginning several times as you suggested but with the same results; no connection.

Thanks for any help you can provide. I hope this information helps.

 


   
ReplyQuote
Page 1 / 4