How to use Raspberry Pi Pico board on Raspberry Pi 4 ARMv7

This forum is for topics dealing with problems with software specifically in the ARMv7h repo.

How to use Raspberry Pi Pico board on Raspberry Pi 4 ARMv7

Postby foobar » Tue Feb 09, 2021 10:34 am

Hi,

I want to start with the new Pico microcontroller board on my Raspberry Pi 4 running Arch ARMv7 with LXDE desktop. I read that you need Thonny IDE for that so I tried installing thonny from AUR but that gave me an error "could not install missing dependencies".

I also use Pyzo IDE for my Python projects so I thought if I could just install MicroPython from AUR but that gave me "not available for 'armv7h' architecture", same as for micropython-git package.

When I connect the Pico to my Pi 4 it opens the filemanager and I can upload the MicroPython firmware after which it disconnects, It is supposed to be running MicroPython now but I have no idea where to go from here without Thonny IDE. I could not install MicroPython either.

The only thing I found that after installing minicom I could access the Pico (with the firmware installed) using "sudo minicom -o -D /dev/ttyACM0" and play around with some MicroPython commands but I have no idea how to write MicroPython scripts from here.

I'm a little lost here, this is also my first experience with a microcontroller board.
foobar
 
Posts: 37
Joined: Wed Oct 21, 2020 12:33 pm

Re: How to use Raspberry Pi Pico board on Raspberry Pi 4 ARM

Postby nsollars » Tue Feb 09, 2021 12:35 pm

Make sure you did everything on this list,

https://www.twilio.com/blog/programming ... icropython

This should work out of the box pretty much, hope this helps
nsollars
 
Posts: 21
Joined: Mon Sep 04, 2017 6:14 pm

Re: How to use Raspberry Pi Pico board on Raspberry Pi 4 ARM

Postby foobar » Tue Feb 09, 2021 2:13 pm

Hi @nsollars, thanks for your prompt reply. I just installed rshell from AUR. So here's what I did.

I have the Pico with the MicroPython firmware flashed on it connected to the USB of my Pi 4.

I start rshell to connect with the Pico using
$this->bbcode_second_pass_code('', 'sudo rshell --buffer-size=512 -p /dev/ttyACM0')

This invokes my home folder
$this->bbcode_second_pass_code('', '/home/user>')

From here I can invoke the MicroPython interpreter on the Pico using
$this->bbcode_second_pass_code('', 'repl')

Here I can start testing MicroPython and when done entering ctrl-x to quit the interpreter.

Now I can create a main.py file on my Pi 4 using my nano editor
$this->bbcode_second_pass_code('', 'shell nano main.py
from machine import Pin
from utime import sleep
led = Pin(25, Pin.OUT)
while True:
led.on()
sleep(1)
led.off()
sleep(1)
')

After saving the file now I can copy the main.py file on my Pi 4 to my Pico
$this->bbcode_second_pass_code('', 'cp main.py /pyboard/main.py')

and start running the code by invoking repl and do a soft reboot
$this->bbcode_second_pass_code('', 'repl
>>> CTRL-D')

And lo and behold: the led on the Pico starts blinking! Exiting rshell and reconnecting the Pico to my Pi 4 or a 5V powerbank immediately starts running the code and the led starts blinking. Excellent.

However when I want to create more complex code I guess I still would need a MicroPython IDE like Thonny for testing the code before copying it to the Pico. Since installing micropython from AUR seems not possible on armv7h this is perhaps why installing thonny from AUR gives me the error on installing missing dependencies.

For now I can play around with the Pico but I'm still struggling with the lack of a MicroPython IDE on my Pi 4 in order to do some serious programming.
foobar
 
Posts: 37
Joined: Wed Oct 21, 2020 12:33 pm

Re: How to use Raspberry Pi Pico board on Raspberry Pi 4 ARM

Postby foobar » Thu Feb 11, 2021 6:09 pm

I just found an interesting tool on github via the micropyton.org website:
http://docs.micropython.org/en/latest/reference/pyboard.py.html#

Using this python script I can execute a script from my Pi 4 on the Pico, without having to copy it first to the Pico:
$this->bbcode_second_pass_code('', 'python pyboard.py -d /dev/ttyACM0 script.py')

Very convenient for quickly testing a script before putting it on the Pico. You can also access the Pico filesystem with pyboard.py but I find rshell easier to use for that purpose since you can browse folders with that.
foobar
 
Posts: 37
Joined: Wed Oct 21, 2020 12:33 pm

Re: How to use Raspberry Pi Pico board on Raspberry Pi 4 ARM

Postby bulletmark » Thu Feb 11, 2021 9:46 pm

@foobar, I played around with my Pico recently and went down a similar track as you. I found issues with rshell, didn't want to use Thonny as I am a vim + command line guy, and didn't like pyboard.py because it is a single file from MicroPython so is not updated as a package. I eventually used ampy which is command line like pyboard but has a slightly better interface and works with both MicroPython and CircuitPython. Just `yay -S adafruit-ampy` to install it.
bulletmark
 
Posts: 98
Joined: Tue Oct 13, 2015 10:17 pm

Re: How to use Raspberry Pi Pico board on Raspberry Pi 4 ARM

Postby foobar » Fri Feb 12, 2021 7:35 am

@bulletmark, thanks for sharing. Looks like ampy is a bit more limitted than rshell but I guess it is all a matter of personal choice. In the end rshell, pyboard.py and ampy are basically doing the same thing: connecting to the board and transferring files.

As for now I'm able to get things running on the Pico using these tools. For small scripts these are ok but if I want to create a more complex code I still would like to have a MicroPython IDE on my Pi 4. I'm using Pyzo for my regular Python scripts which, to me, is very simple to use and still capable of doing advanced stuff. I was thinking that if I could install MicroPython on my Pi 4 then I could create a new shell in Pyzo using MicroPython instead of regular Python but so far I could not accomplish that.
foobar
 
Posts: 37
Joined: Wed Oct 21, 2020 12:33 pm


Return to ARMv7h

Who is online

Users browsing this forum: No registered users and 11 guests

cron