How to Setup a Raspberry Pi Pico and Code with Thonny

  Переглядів 119,476

Core Electronics

Core Electronics

День тому

Let's get set up with coding/scripting in Thonny for the Raspberry Pi Pico. We'll install Thonny, configure for Pico and write our first MicroPython script. To follow along you'll need:
- A Raspberry Pi Pico
- A USB micro B lead
- PC/Mac/Linux/Raspberry Pi (computer) with Internet
The full guide: core-electronics.com.au/tutor...
If you have any questions about this content or want to share a project you're working on head over to our maker forum coreelec.io/forum
Core Electronics is located in the heart of Newcastle, Australia. We're powered by makers, for makers. Drop by if you are looking for gear from:
• Raspberry Pi Pico core-electronics.com.au/catal...
• Raspberry Pi core-electronics.com.au/raspb...
• Arduino core-electronics.com.au/ardui...
• Sparkfun core-electronics.com.au/brand...
• Adafruit core-electronics.com.au/brand...
• Pololu core-electronics.com.au/brand...
• DFRobot core-electronics.com.au/brand...

КОМЕНТАРІ: 132
@dnywh
@dnywh Рік тому
For the other Pico W / Pico WH owners out there: to get the blinking LED to work you need to swap out 25 on line 4 for 'LED'. So from: led = Pin(25, Pin.OUT) to: led = Pin('LED', Pin.OUT)
@aaronmorgan4466
@aaronmorgan4466 Рік тому
LOL, I was just coming back to make the same comment; wish I'd scrolled down 20 minutes ago...
@commanderpandesoft
@commanderpandesoft Рік тому
You're a lifesaver, got worried I messed up lol
@wayland7150
@wayland7150 Рік тому
led = Pin("LED", Pin.OUT) double quotes.
@pickledorange
@pickledorange Рік тому
@@wayland7150 Both work
@nathanielpoulton2460
@nathanielpoulton2460 9 місяців тому
@@aaronmorgan4466 same here
@chrisfaux3769
@chrisfaux3769 3 роки тому
Please don't stop making these videos! They are by far the best on this subject. Thanks for these!
@videosonix4473
@videosonix4473 10 місяців тому
This is by far the best introductory video for the Pico I've seen on UKposts. Very easy to follow, and everything worked fine. Thank you very much for getting me off the ground with it. Would love to see more in a similar vein. Pressing the subscribe button now!
@Dbean48
@Dbean48 2 роки тому
You cleared my Machine module problem. Loading the correct interpreter. Great clip for beginners..Thanks Don
@Mumme666
@Mumme666 2 роки тому
Thanks buddy! I´ve just received my first pair of RP Picos, and have´nt had much luck communicating with the board, till I watched this video. We´re blinkin´!!! ;)
@philosophyben
@philosophyben 3 роки тому
Both your REPL guide and this one have been extremely easy to follow and a bit of a life saver. I was getting in a bit of a muddle from the setup pdf from the pi foundation on how to set up the pi, setting up cmake and all sorts of other things for vscode etc etc. Why they didn't just have a simple "Use Thonny in this simple way" is a bit beyond me but there you go
@Core-Electronics
@Core-Electronics 3 роки тому
Thanks Ben, all the best with your projects!
@mathewrtaylor
@mathewrtaylor 2 роки тому
Super appreciate you posting this!!
@JoeSteffy1932
@JoeSteffy1932 Рік тому
Thank you for making this video. I'm a complete noob and you helped me get started. 👍
@paulnielson8266
@paulnielson8266 3 роки тому
Thanks for this, I have been trying to workout how you view saved files on the Pico
@mwilliams0303
@mwilliams0303 3 роки тому
another good video on the Pico
@elujarcaos
@elujarcaos 6 місяців тому
so helpfull thx very much i'm beginner with pico and that learn me so many things
@paulpomme2502
@paulpomme2502 Рік тому
Hi! Thanks you for this good introduction. On my Seven system I needed Zadig for Windows to get the good driver ;)
@hballouz
@hballouz 7 місяців тому
this is the best explanation of Pico and thonny, all other videos just assume that you know how to use thonny although they title their videos : for Absolute Beginners !!! (which is my case. :) ) ... thanks a lot !!! . hope you can show us a step by step video of building and programming a simple pico robot
@steveaustin62
@steveaustin62 5 місяців тому
Many thanks, this was very helpful.
@gilangjanuar3552
@gilangjanuar3552 2 місяці тому
This works perfect, thanks bro
@jannsander
@jannsander Рік тому
Awesome content! A shining example how a tech tutorial sould be👍
@Core-Electronics
@Core-Electronics Рік тому
I appreciate that!
@seanswartz9033
@seanswartz9033 26 днів тому
Awesome video man! Thanks
@phrtza
@phrtza Рік тому
Great guide! Subscribed.
@SciHeartJourney
@SciHeartJourney 3 місяці тому
Thank you for this video. I think that the most impotant lesson is to save your final file as main.py in the root directory of the RP2040 zero.
@anokhautomation4453
@anokhautomation4453 2 роки тому
Hi Sir. Can you explain how we can install micropython machine module in python??so i can create some application in tkinter to control the gpio pins of raspberry pi pico.
@3DSage
@3DSage 2 роки тому
I found this video very helpful and I really wanted you to know that!
@Core-Electronics
@Core-Electronics 2 роки тому
That's great to hear 😃 Thanks, and best of luck with your projects!
@MultiShaun1989
@MultiShaun1989 2 роки тому
hello, enjoying your videos but struggling to get anything to work on my pico. my project isnt compicated. just need a couple of outputs triggers when given an input. basic switches etc. cant seem to get any coding to work.
@mahoneytechnologies657
@mahoneytechnologies657 2 роки тому
One quick question how do I change the Port setting in Thonny, Thonny thinks my pico is at port 13 and my computer thinks the pico is at port 14. I have to edit the configuration.ini file, Port = setting but it keeps reverting back to Port = 13
@robotboy3525
@robotboy3525 Рік тому
Hi, I'm more of a C/C++ type of person. Is there anyway i can use the Plotter and the Shell in Thonny as an output for my C codes on the pico ?? I've written a code in C to output data for proximity sensor but minicom, putty and the arduino console can't detect uart output.
@scripterman
@scripterman Рік тому
Great video, I've followed it to the letter, unplugged it but now the green light stays on solid and cant stop it? thanks
@tedrostesfaab1838
@tedrostesfaab1838 2 роки тому
Thank you for the nice presentation. can you make a demo how of how to use this device with hx771 ADC ?
@superdogmeatmeat
@superdogmeatmeat 3 роки тому
Man it's like the arduino IDE in simplicity.. but way better. Is there a way to get it easily working in VS code? I've seen two videos on it, but it seems like a giant pain.
@rohiniikhanderay5762
@rohiniikhanderay5762 3 роки тому
suppose if i close thonny then LED will stop working.in arduino if we close arduino IDE still project runs on board.likewise how it can be happen in pico?
@antospin4004
@antospin4004 4 місяці тому
Hi, great video! May I ask you a question? I have a pico W but I can't get REPL to work! Thonny keeps telling me that the device is busy, i tried soft rebooting, pressing ctrl+d, ctrl+c, tried connecting pin 30 or RUN to ground for a soft reboot, but nothing, even tried deleting code.py from the pi. I am running Circuit Python 8.1, i don't know if it is my pi the problem, please do you have any suggestion?
@nileshpathak9443
@nileshpathak9443 3 роки тому
thanks bro
@RandomPickles
@RandomPickles Рік тому
is this close to the same with the PI zero? Can I connect the PI zero?/
@mahoneytechnologies657
@mahoneytechnologies657 2 роки тому
Ok I found it. Tools > Options > Interpreter > Port Don't know why I didn't see it before!
@uttamdutta3664
@uttamdutta3664 3 роки тому
every thing is working fine , Program is getting executed by "Run" option, but there is no "download" option to burn the micropython program in the flash memory. When I am removing USB Plug from laptop blinking of LED stopped because it is not getting power through USB it is Ok, but when I am reconnecting USB with 3 second pressing of USB and port is also showing connected , then also LED is not blinking, unless I again "run" the program, that means program is not getting burnt in flash memory , How it can be done (this type of problem is not there with Arduino board)
@J.S.McDuff
@J.S.McDuff 10 місяців тому
i made a watch dial in pygame and im trying to covert to micropython will that work?
@midwifeymomkempjj258
@midwifeymomkempjj258 Рік тому
Keep in mind, this led code is for the regular Pico, NOT the Pico W. Great tutorial, thx!
@wayland7150
@wayland7150 Рік тому
@OG duolingo man led = Pin("LED", Pin.OUT)
@Jude_Mertens
@Jude_Mertens 11 місяців тому
I was so confused
@prateeksrivastava8470
@prateeksrivastava8470 3 роки тому
I downloaded thonny on my ubuntu couldn't see pico option in there.. had to download it on windows to work with it.. It would be a lot of help if you could make a video for ubuntu users as well.. Great video BTW i enjoyed it very much
@bodziobran
@bodziobran 2 роки тому
Probably you have older version of Thonny. Remove it and install through : pip3 install thonny
@palanikumaravels3088
@palanikumaravels3088 2 роки тому
good video
@natorverinumbe3161
@natorverinumbe3161 Місяць тому
Thanks a trillion
@geirha75
@geirha75 2 роки тому
how to clean up gpio pico when exiting/stopping code in Thonny. Now ...when I stop the code the led stays on...
@Videogame9559
@Videogame9559 Рік тому
I have had trouble in finding code you run on strip leds running pi pico any help please internal code led worked fine. I keep error example code 1 from raspberry pi pi pico libaray line no name pixel? Any help anyone.
@cutsdbz
@cutsdbz Рік тому
Nice video, I am wondering, instead of using sleep, is there a way to flash the LED while a code is running on the PICO, like to run the flash led parallel to another program that's running. I don't know if it have to run in a different thread or how this would be approached.
@Core-Electronics
@Core-Electronics Рік тому
Certainly - this is called non-blocking code. Look up how to use ticks_ms() and scheduling.
@cutsdbz
@cutsdbz Рік тому
@@Core-Electronics thank you very much
@retrobombstudios1258
@retrobombstudios1258 5 місяців тому
does anyone know why i get an error code when i try and download packages within python
@Gayatri02
@Gayatri02 3 роки тому
DOES THONNY IDE WORK ONLY ON WINDOWS 10?
@NotMarkKnopfler
@NotMarkKnopfler 2 роки тому
Do we have to install micro python on the pico first, or is it pre-installed?
@ianbertenshaw4350
@ianbertenshaw4350 2 роки тому
Yes - download it from the raspberry pi foundation and it is a simple drag and drop operation
@shamanthks7218
@shamanthks7218 Рік тому
Blink LED code for Raspberry Pi Pico W: import machine import time led = machine.Pin('LED', machine.Pin.OUT) while (True): led.on() time.sleep(.2) led.off() time.sleep(.2)
@joeshmoe7899
@joeshmoe7899 Рік тому
How run micropython Pico on 32bit Ubuntu machine?
@MrPrathampatil
@MrPrathampatil 3 роки тому
Thanks, how do i stop the pico from executing the program?
@wayland7150
@wayland7150 Рік тому
Throw it away and get another pico.
@teddybless2904
@teddybless2904 7 місяців тому
Am having an error (can't import name pin) Please I need help
@10001000101
@10001000101 Рік тому
Anyone else having issue getting the led to flash on win+Pico, go to run>run current script.
@reddoglavrador
@reddoglavrador 3 роки тому
How to use an android smart phone to program and send it to pi pico?
@robloxplayer_and_meowshit_3527
@robloxplayer_and_meowshit_3527 Рік тому
Does it work on W and I'm trying to work it on W and it's not working
@noicthebrave
@noicthebrave Рік тому
I ... actually did not know that about the plotter thing... huh... does that only work if you do the { } stuff for the print statement? Aka, can I just use simple concatenation instead of { } ? (It's not a problem, I can start using { } , but my brain just default's to concatenation XD )
@Core-Electronics
@Core-Electronics Рік тому
It works for regular printed messages. (Regular in the sense that the format is unchanging). Just make sure to only print one message per loop. Thonny will detect the format and put in the plot labels automatically. So, yes, it will work for concatenated prints too!
@CyberRRoland
@CyberRRoland 9 місяців тому
Thonny says pyhon is 3.10 but I have 3.11 so my code wont work
@kiransalan8179
@kiransalan8179 Рік тому
hi, I am dragging and dropping uf2 file onto rp2 drive, it dispears but I can't find micro python from drop down in Thornny in Interpretor drop down in options. can you help?
@Core-Electronics
@Core-Electronics Рік тому
The best way to get technical help for any of our content is on the forums: forum.core-electronics.com.au/ We're full-time makers and are on the forums every working day!
@pravinrajan1542
@pravinrajan1542 3 роки тому
Hey! Great video. I wonder how to log an excel sheet with Micropython. I hope anyone can help me. Thanks
@phil2268
@phil2268 Рік тому
You simply write data to a file separated by commas. Add a new line for new data. Name it with the .csv extension. Excel will take care of the rest.
@PushUp-yt5is
@PushUp-yt5is 16 днів тому
Can someone plz explain why it is useful to have ur pico printing numbers and what would be a scenario I need to use it in
@Core-Electronics
@Core-Electronics 15 днів тому
This example of printing was just a demo, but print commands are incredibly helpful for debugging. If you have code that makes a series of decisions, you can put print statements in those decisions and see how it is "thinking". You might also want to double check that you are converting numbers correctly (maybe your sensor reads in Celsius and you need to convert to Fahrenheit), so your might print it out to double check that the Pico is calculating it correctly.
@PushUp-yt5is
@PushUp-yt5is 15 днів тому
@@Core-Electronics what commands do I use to see what my pico is thinking🤔
@stevenchan9885
@stevenchan9885 Рік тому
sweet
@TomParish
@TomParish Рік тому
I'm on a mac. No go with your instructions. At this point the ESP32 seemed easier to get going. It's like there is a step missing I'm not seeing from the RPI documentation or your video to get going.
@qus.9617
@qus.9617 Рік тому
Complete novice here. So let's say the pico is powered from a power supply instead of a computer. And then at 6:06 pico loses power which can easily happen. And then power comes back on. Should the code autostart or does it need to be connected to a computer again and with thonny stop/restart code and ctrl+D ?
@Core-Electronics
@Core-Electronics Рік тому
If you save the name of your code onto the Pico as main.py then it will automatically run when power is connected, otherwise you will need to reconnect to Thonny and restart the code.
@Beanbag59
@Beanbag59 2 місяці тому
can u use java
@GeorgeKowalski
@GeorgeKowalski 3 роки тому
Shame that Thonny on Linux does not support the pico out of the box with version 3.2.7. This tutorial does work on a MAC x86 as of today.
@jyvben1520
@jyvben1520 3 роки тому
needs 3.3.3+ , no shame, things evolve, this pico board is not even 6 months old,
@Gndt1
@Gndt1 Рік тому
Made it as far as 'from machine import pin' . 'No module named machine. Looked at 'manage packages' No machine there either. Tried pip and pip3 with the same result.
@kentharris7427
@kentharris7427 2 роки тому
Downloaded Thonny and get a Site Certificate Expired error. Even after manually installing MicroPython 1.18 onto the Pico. Been trying to fix this error for 2 days now.
@laurenasl37
@laurenasl37 Рік тому
Did you ever find a fix to this? I'm having a similar problem
@icaruscomplex5588
@icaruscomplex5588 Рік тому
if using Pico W, replace 25 with "LED", debugged this for half a day lol
@aringangal6614
@aringangal6614 2 роки тому
can anyone help me with the pico. It keeps rebooting everytime i try to install micropython in it. also even i do not press the bootsel button it still opens as a removable drive
@aringangal6614
@aringangal6614 2 роки тому
and by rebooting i mean i doesnt install micropython but just closes and opens as a drive again
@smnsdf
@smnsdf 3 роки тому
That install is not coming
@caspianscontent
@caspianscontent 2 роки тому
thanks
@Core-Electronics
@Core-Electronics 2 роки тому
You're welcome!
@tubeDude48
@tubeDude48 Рік тому
Are you saying CTRL- A, D or V?
@Core-Electronics
@Core-Electronics Рік тому
Soft reboot is CTRL + D
@tubeDude48
@tubeDude48 Рік тому
@@Core-Electronics - Thanks, could not understand what you said.
@abedoubari
@abedoubari 3 роки тому
Please letWhich is the best raspberry Pico or Arduino ?
@Core-Electronics
@Core-Electronics 3 роки тому
There are lots of Arduino versions out there, though Pico has our heart for the moment! It is after all, the latest microcontroller on Earth :)
@abedoubari
@abedoubari 3 роки тому
@@Core-Electronics I think Pico is faster and easier to interface with the raspberry Pi ... the mother and the daughter..
@mushedpotatoesking7484
@mushedpotatoesking7484 2 роки тому
when i try to install or update firmware it says error
@laurenasl37
@laurenasl37 Рік тому
Did you ever find a fix to this? I'm having the same problem
@kevingpearce
@kevingpearce 2 роки тому
Me too, Cyrus !!!! I see your comment was made 1 month ago. Is anyone checking our comments, or should we be posting them on "Core Electronics's" forum ? I took a look there, but unable to navigate to any assistance. May need to unsubscribe to this channel if that's all the support they can offer !!!! I here repeat your question: "from machine import Pin" when I run this, it say cannot find module 'machine' Any solutions ?
@mingosutu
@mingosutu Рік тому
Computer said: NOOOO. No module called machine
@uzb_coder
@uzb_coder 4 місяці тому
What want to do you mean bro?
@mingosutu
@mingosutu 4 місяці тому
Hi, you came after one year!!!@@uzb_coder
@thediscoman2001
@thediscoman2001 3 місяці тому
that totaly failed from start dint work at all
@rverm1000
@rverm1000 3 роки тому
got an error . ModuleNotFoundError: No module named 'serial.tools' installed serial,pyserial but couldnt get it to work. got any suggestions?
@pixel_arc8550
@pixel_arc8550 3 роки тому
I think I had the same thing happen, you have to change your interpreter. To do that, under "Run", select interpreter and change it to Pi Pico. If you dont have that option, in the top right there should be a line "change to default" or something like that. Press that, restart Thonny and you should have the option under run. Hope that helps
@kevingpearce
@kevingpearce 2 роки тому
I get "Couldn't find the device automatically. Check the connection (making sure the device is not in bootloader mode) or choose "Configure interpreter" in the interpreter menu (bottom-right corner of the window) to select specific port or another interpreter.%Run -c $EDITOR_CONTENT". So at what point do I unplug and replug the Pico ? I assume that I'm still in "bootloader" mode until I do ? Even that does not work, so where to go from here. This device appears to be so new to the market, that no one has released a UKposts video that fully explains the pitfalls.
@Core-Electronics
@Core-Electronics 2 роки тому
It sounds like there could be a bit going on here. We have a dedicated forum topic for this tutorial, and full-time technical support staff who can help forum.core-electronics.com.au/t/how-to-use-raspberry-pi-pico-with-thonny/9226
@TroyBrophy
@TroyBrophy 5 місяців тому
I guess I have a Pico W which the script doesn't work for.
@Core-Electronics
@Core-Electronics 4 місяці тому
Hey Troy, the Pico W uses pin 25 for its wireless chip, so now you control the led pin with "LED", instead of 25. Old Line: led = Pin(25, Pin.OUT) New Line: led = Pin("LED", Pin.OUT) This should work for all Pico variants as well.
@manuelfreitas4526
@manuelfreitas4526 5 місяців тому
the code don't work!!!
@RudiOnRails
@RudiOnRails Рік тому
Anyone else getting CERTIFICATE_VERIFY_FAILED when clicking install?
@RudiOnRails
@RudiOnRails Рік тому
Had to install lets-encrypt-r3.der for it to start working.
@Error-0x0194
@Error-0x0194 Рік тому
0:37 I can't see what you are clicking on. Can you read aloud what you are looking at? There is so much stuff on the screen. Where/What is "a download folder"? Too bad, if I could see what you clicked on, "it just runs". You might start your video stating what the viewer must know. The rest is clear.
@tetraquark2402
@tetraquark2402 2 роки тому
I get a certificate expired error
@RudiOnRails
@RudiOnRails Рік тому
Same here did you ever resolve this?
@tetraquark2402
@tetraquark2402 Рік тому
@@RudiOnRails Sorry no. I'm still using the pi ide and it's so slow. I want to use visual studio code and eventually write some assembly so I can try write my own version of forth.
@ianbertenshaw4350
@ianbertenshaw4350 2 роки тому
No semi colon, curly braces and any other annoying things that the Arduino IDE and C++ has
@kevinstampe
@kevinstampe 2 роки тому
Yo, thats not red.. Thats green, you colorblind?
@stephenwong9723
@stephenwong9723 2 роки тому
Your keyboard is very loud, perhaps don’t aim your boom mic downward to avoid that loud keyboard clicking sound!
@nathvandyk5213
@nathvandyk5213 Рік тому
why is micro python so slowwwwwwwwwwwwwww i mean slow
@russianorctrash6591
@russianorctrash6591 2 місяці тому
Doesn’t work.
@alperenalperen2458
@alperenalperen2458 2 роки тому
It's not funny.
@anaislafontaine6172
@anaislafontaine6172 Рік тому
Hello @Core-Electronics my program is suddently inable to regonize my devis ? Unable to connect to COM6: could not open port 'COM6': OSError(22, 'Le délai de temporisation de sémaphore a expiré.', None, 121) Process ended with exit code 1.
@anaislafontaine6172
@anaislafontaine6172 Рік тому
I'm fine thank you for that course :) I change my open port and reboost it
How To Use A Rotary Encoder With Raspberry Pi Pico
9:59
Core Electronics
Переглядів 14 тис.
Спаси её волосы🙏🏻
00:40
БРУНО
Переглядів 2,1 млн
How to Use VSCode with Raspberry Pi Pico W and MicroPython
6:14
Raspberry Pi Pico - Getting Started with MicroPython with Thonny and rShell
11:00
Turning a Raspberry Pi Pico into a GPU!
16:42
element14 presents
Переглядів 98 тис.
How to Set Up Visual Studio Code to Program the Pi Pico (Windows)
10:09
Learn Embedded Systems
Переглядів 107 тис.
Connecting To The Internet With The Raspberry Pi Pico W (via WiFi)
5:53
Core Electronics
Переглядів 45 тис.
Raspberry Pi Pico - Review and Getting Started
18:32
Gary Explains
Переглядів 73 тис.
CircuitPython with Raspberry Pi Pico - Getting Started
42:47
DroneBot Workshop
Переглядів 191 тис.