#215

  Рет қаралды 7,290

Ralph S Bacon

Ralph S Bacon

Күн бұрын

The PICO might be tiny but it's going to be huge. When Raspberry Pi launches a new embedded microcontroller you just know they mean business.
JLCPCB Only $2 for PCB Prototype any colour jlcpcb.com/cyt
Please take a few minutes to visit this excellent PCB manufacturer.
Luckily for us Arduinites, it's all very familiar: it's Nano-sized, with a few more pins, and even the MicroPython language doesn't look that different from C++.
Resources are plentiful, as is the PICO RP2040 module, and the bare chips are now available for soldering to your own PCB if the module doesn't meet your needs.
Getting started:
projects.raspb...
Thonny IDE
thonny.org/
Raspberry Pi PICO Datasheet
datasheets.ras...
FAQs for PIC and RP2040
datasheets.ras...
RP2040 Programmable IOs
www.cnx-softwa...
Where to buy (UK/Europe)
www.elektor.co...
shop.pimoroni....
thepihut.com/p...
Reset button (or make your own)
shop.pimoroni....
Bare RP2040 chip:
thepihut.com/c...
List of all my videos
(Special thanks to Michael Kurt Vogel for compiling this)
bit.ly/KZbinV...
If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey
My channel, GitHub and blog are here:
------------------------------------------------------------------
/ ralphbacon
ralphbacon.blog
github.com/Ral...
------------------------------------------------------------------

Пікірлер: 98
@NigelAtkinson256
@NigelAtkinson256 3 жыл бұрын
One powerful feature of running the micropython REPL on the board is you can type Python code line by line to experiment. For example print out the ADC value of a pin, turn a LED on, and so on. You can also call functions you have previously defined.
@RalphBacon
@RalphBacon 3 жыл бұрын
I didn't know that you could invoke functions defined in the code. Good to know! Yes, the whole REPL environment is very good, something we Arduinites have not had before.
@kevingrimshire7462
@kevingrimshire7462 3 жыл бұрын
Great video but could you do some using the Arduino IDE? Every Pico video on KZbin is using Python. We can use our Arduino skills we have built up over the years.
@RalphBacon
@RalphBacon 3 жыл бұрын
Yes we can! Next video, maybe? I hope you are using the Arduino IDE 2.0 (beta). What? Not tried it. Sigh. kzbin.info/www/bejne/d6DMpmqkoaqmj5I
@tubeDude48
@tubeDude48 3 жыл бұрын
USB 1.1 just KILLED it for me! They should have, at least, went for USB 2.0! Thanks for the info, though.
@RalphBacon
@RalphBacon 3 жыл бұрын
As a USB device it's ok surely? Keyboard emulator etc?
@Mr.Leeroy
@Mr.Leeroy 3 жыл бұрын
why the requirement?
@tubeDude48
@tubeDude48 3 жыл бұрын
@@Mr.Leeroy - Pi engineers always seem to hold-back on USB. I see NO reason this went with 1.1, stupid!! I bitched at Upton over and over until Upton put 3.0 in the Pi 4...
@Mr.Leeroy
@Mr.Leeroy 3 жыл бұрын
​@@tubeDude48 I was asking about your practical need for 2.0 apart from bitching.
@AtlantaTerry
@AtlantaTerry 3 жыл бұрын
I just ordered some of the Pimoroni reset buttons. Thank you for telling us about them.
@RalphBacon
@RalphBacon 3 жыл бұрын
Such an oversight by Raspberry Pi. What's the betting a V2 will be released soon with one built in?
@andymouse
@andymouse 3 жыл бұрын
Hi Ralph, Its gonna be interesting watch this develop...cheers.
@RalphBacon
@RalphBacon 3 жыл бұрын
Yes, it is quite interesting. Since I made this video I've found so many new modules into which the PICO plugs into. I said it would be a success, and it already is!
@jyvben1520
@jyvben1520 3 жыл бұрын
the "repl" is something the arduino crowd really needs to learn, also there is circuitpython for rp2040 and the learn.adafruit .com eco system.
@RalphBacon
@RalphBacon 3 жыл бұрын
So many choices, Jyv. I think MicroPython will be good for prototyping and quick "one-offs" without having to upload and compile. It will be interesting to use C++ (probably with Visual Code, which is familiar to me with my PlatformIO system).
@fredflintstone1
@fredflintstone1 3 жыл бұрын
Ralph, I got a Pico before christmas it has been sitting in the draw CPC sold it, but now I have to learn Thorny when I have just got passed the flashing an LED in Arduino:-)
@RalphBacon
@RalphBacon 3 жыл бұрын
You will find MicroPython easier to learn, I suspect and you can run the code immediately just as I showed, no compiling or uploading required.
@ianleitch9960
@ianleitch9960 3 жыл бұрын
Hello Fred, The Pi Pico came out at either the end of January 2021 or beginning of February. I believe that Arduino had a pico board, so I am just a little confused; and hope that you have merely got the purchase timeline slightly confused. There are oodles of official MicroPython examples and once the .rp2 interpreter is loaded, then it's relatively plain sailing with small modifications to the examples to allow you to explore. I have never been a Python fan, but have to confess that it is an extremely fast development model and each time you run, the code is saved (presumably on the Pi Pico), where the Pico can be put into your pocket and.taken around to a mates PC (running Thony) and all your examples stay with the board and can be run just by plugging in.
@fredflintstone1
@fredflintstone1 3 жыл бұрын
@@ianleitch9960 I odered it but I had to wait you are right it turned up at the house on 09/02/21 @ 12.21 :-)
@willofirony
@willofirony 3 жыл бұрын
OK, I have been a bit sniffy about using "littleme" PCs for embedded electronics project in the past. However, I do have to admit that the PICO 2040 is a real option to Arduino boards. I am impressed by the interactive software development environment. I have used Python scripts develop algorithms, which I later write in C++ and this has speeded up development manifold. I look forward to seeing your videos of C++ development on the PICO and would also be interested in comparisons with the STM32 family. Great video, Ralph (must get a rubber stamp with that on).
@RalphBacon
@RalphBacon 3 жыл бұрын
Yes, the RP2040 has certainly piqued my interest, Michael, especially now I've got it running on the Arduino IDE using C++. Unfortunately, the overall lowest sleep current of the PICO board is 180μA which is an order of magnitude higher than I can get with a Nano (well, the ATMega328P chip) at 0.2μA. I just wonder how much it affects the charge lifespan of, say, a fully charged 18650.
@borayurt66
@borayurt66 3 жыл бұрын
Making projects using Pyton scripts is very trendy now, but I don't like the idea of running my code thru an interpreter and using hundreds of clock cycles to execute a simple instruction that would otherwise only need 2-3 cycles if ran on machine code. Good to know about this Thonny IDE, It seems like a good choice for a beginner. I will try it as soon as my Pi Pico arrives sometime next week, and try to learn some µPython too. But, the Arduino IDE has RP2040 support now, that is what I am actually interested in. Love to see a video (even a series of them) from you. Thank you and take care!
@RalphBacon
@RalphBacon 3 жыл бұрын
Using the PICO in the Arduino IDE is not quite as straightforward as you might have hoped, Bora. Yes, flashing an LED is fine but for anything a bit more complex, and for which we might use libraries, it will be a challenge. Watch the video this Friday for more info.
@borayurt66
@borayurt66 3 жыл бұрын
@@RalphBacon Yes, I would expect AVR specific libraries wouldn't work, same with the STM32 bluepill boards. But clever people write multiplatform libraries, I managed to find a lot of libraries that work with ESP8266 boards on Arduino IDE. I am hopeful😄 Curiously waiting for Friday. 👍
@arniep740
@arniep740 3 жыл бұрын
Thanks for another well done video. I look forward to more in this series. Maybe include something on the Arduino RP4020 board as well? Keep up the good work. Did that open bin lid fall down on your finger? Ouch!
@RalphBacon
@RalphBacon 3 жыл бұрын
The Arduino RP2040 board is quite expensive. I will have to see what it gives us. I hurt my finger whilst building the workshop. Ouch!
@borayurt66
@borayurt66 3 жыл бұрын
Yes, as Ralph said, incomparable price difference due to Arduino RP4020 being packed with WiFi and BT radio, sensors etc. Pi Pico is barebones, almost a breakout board for the RP4020 which IMHO, makes it more versatile (debatable, I know) I don't know whether the new board definition of the IDE for Arduino RP4020 is fully compatible with the Pi Pico but I believe it should work. I'll see when I receive my Pi Pico next week.
@asagk
@asagk 3 жыл бұрын
Just tried this PICO-thing, but along with "linux on windows" environment and a gcc cross compiler instead of PYTHON. Nice stuff really, I must admit!
@RalphBacon
@RalphBacon 3 жыл бұрын
"This PICO-thing" 😅🤣 Sounds like grudging acceptance there may be something to this new kid on the block!
@flemmingchristiansen2462
@flemmingchristiansen2462 3 жыл бұрын
Nice introduction. Is the Python interpreter running on the 2nd. core, would kind of make sense. Could be interesting to compare speed between the Python interpreter and C+++. All in good time. Looking forward for the Bin Lid alarm continuum.
@RalphBacon
@RalphBacon 3 жыл бұрын
Yes, a speed comparison between Python and the equivalent program in C++ is something I intend to do (in the fullness of time).
@bbowling4979
@bbowling4979 3 жыл бұрын
@@RalphBacon I will be surprised if there's any competition at all. An interpreted language v. a compiled one?
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 жыл бұрын
What your given in one hand you throw away with Python. "Ease of use in one hand" and "speed and memory penalties in the other".
@RalphBacon
@RalphBacon 3 жыл бұрын
Maybe. I think for many users (and uses) the speed penalty will be of less importance. Think of my Green Bin Lid monitor; would I really notice the difference between C++ and Python. Unlikely.
@theonlymudgel
@theonlymudgel 3 жыл бұрын
Hey Ralph, really enjoyed the video. Must go back over the last few and catch-up on the bin lid portion of the vids. Sounds interesting. Cheers Mike V
@RalphBacon
@RalphBacon 3 жыл бұрын
Please do! You can lie back in that chair of yours to watch them. Keep well.
@Brian_Of_Melbourne
@Brian_Of_Melbourne 3 жыл бұрын
Good decision to move to all through hole for your 'bin lid' project. Is the DIP chip the best solution? Would a nano, pro-micro, or pro-mini (with pins) soldered to the board like a giant DIP be a better choice? Strangely the boards can be cheaper than the plain chip! During testing one could put it in a socket, and maybe even reuse it later if so desired.
@RalphBacon
@RalphBacon 3 жыл бұрын
I thought about it, Brian, but with any kind of module there are bound to be external components that could suck power away (eg another voltage regulator). I never realised the DIP version of the ATMega328P was so expensive. Hmm. I wish I had known that, as a Pro-Mini would have worked just as well, I reckon. But my design, currently stuck in the factory in China due to their 14th June holiday, will work fine, I think. I will now look for more DIP chips, I had loads, now only a few.
@Brian_Of_Melbourne
@Brian_Of_Melbourne 3 жыл бұрын
@@RalphBacon That was my thought, the price and scarcity of the DIP chips. Because power consumption is part of the primary design brief maybe other CPUs are in scope for choosing as a 'DIP' module. ATTinyNN too few pins, BluePill - too big, ESP12 - wrong pin pitch, ESP201 - possible, ESP32 - generally pricey but sleep capable, XIAO - maybe. The list is almost endless, but the pro-mini is a good choice; it has the crystal, it has a regulator that can be disconnected, it has very little else (low cost & low current), development uses an external serial so that's not in the final power budget, and it has a reset button.
@RixtronixLAB
@RixtronixLAB 3 жыл бұрын
Cool info, thanks :)
@RalphBacon
@RalphBacon 3 жыл бұрын
Glad it was helpful!
@avejst
@avejst 3 жыл бұрын
Great walkthrough as always 👍😀 Thanks for sharing your experience with all of us 👍😀
@RalphBacon
@RalphBacon 3 жыл бұрын
Glad you enjoyed it, Asger!
@keitholiver3981
@keitholiver3981 3 жыл бұрын
Exciting times ahead using the raspberry pi, just used Jlcpcb for the first time very pleased with the service and quality. $2 for 5 PCB’s only quibble is the delivery charge to the UK.
@RalphBacon
@RalphBacon 3 жыл бұрын
I'm happy you found the JLCPCB service up to scratch. I'm having a PCB made there right now for my Bin Lid Monitor. Now, the delivery charge is (sort of) up to you. DHL is super quick and you can track it every meter of the journey but carries a premium. And they are picky about customs duties etc. But there is a GB Postal Service (whatever it's called) that is much cheaper. I've used that and it took 2 weeks but it did arrive and cost about £9. The other thing to consider is that if you were making not 5 boards, but 5,000 then the delivery cost is far less (per board) and is just added to overall, final price. It's just us hobbyists that notice it because it is a disproportional amount compared to the board cost.
@UtsavShah_25
@UtsavShah_25 3 жыл бұрын
Thanks for sharing this! Great tutorial
@RalphBacon
@RalphBacon 3 жыл бұрын
My pleasure!
@roostertechchan
@roostertechchan 3 жыл бұрын
Couple of weeks ago I've build a solar powered weather station around the Pico, only in MicroPython. I've connected an anemometer, wind vane, rainfall bucket, temp, pressure and humidity sensors. All data transferred every 5 min via Lora module to the Raspberry Pi running home automation software. Had to adapt some regular python code from Raspberry Pi, but in general it works quite stable outside for two weeks.
@RalphBacon
@RalphBacon 3 жыл бұрын
Sounds nice. Who knows, perhaps this will eventually evolve in a full blown MQTT/Node-Red system for me which I was planning to do over 2 years ago!
@interestingspagetti
@interestingspagetti 3 жыл бұрын
I picked up one of these pico's a while back. I am still learning C++ (arduino), so learning python at the same time could be troublesome. But found that arduino ide now supports the pico. Unfortuatley, my boot select boot button fell apart which was needed for the first sketch uploaded. I have order another pico and really looking forward to using it. Will look forward to seeing how you get on.
@RalphBacon
@RalphBacon 3 жыл бұрын
You can fix that bootloader issue. Solder a wire to TP6 (Test Point 6 under the board) and connect that to an external switch which goes to GND. You now have a new BootSel button! And we'll cover using the PICO with the Arduino IDE and C++ next video.
@shaunstewart4064
@shaunstewart4064 3 жыл бұрын
Now that Arduino offically support this device in their IDE, will you please consider covering development on this device from an Arduino IDE perspective? I'm just being selfish really because I don't like Python but I do love your videos and the way you present stuff.
@RalphBacon
@RalphBacon 3 жыл бұрын
Yes, ok, Shaun, I will. 😃👍 Now can I go and get a beer?
@shaunstewart4064
@shaunstewart4064 3 жыл бұрын
@@RalphBacon Oh! Go on then. Seeing as you asked so nicely :)
@andrewtoogood1429
@andrewtoogood1429 3 жыл бұрын
It would be interesting to see speed and memory comparisons using C++ and python on this device fot the same functionality. So far havn't seen a reason to learn python...
@shaunstewart4064
@shaunstewart4064 3 жыл бұрын
@@andrewtoogood1429 I would also be keen to see a like for like comparison. I used Python for a specific project because it was a requirement. Never felt the need to use it since.
@Mr.Leeroy
@Mr.Leeroy 3 жыл бұрын
@@andrewtoogood1429 because there is no reason to use it while even easier Arduino framework exists. It's mostly a marketing gimmick, because real Python is on the rise and it is "beginner friendlier". And the speed of C++ is like its strongest advantage, so comparison would be a boring sport. Moreover its a subset of Python, which would always be limiting. Not to mention terrible Java-like syntax.
@dave-in-nj9393
@dave-in-nj9393 3 жыл бұрын
starting in the RPi world, one does not need to learn C++ to get into the Arduino Universe. a plus for Pi users. If one is in the Arduino world, then it is not just an enhanced Arduino, it is a new software system and new hardware. that would beg the question of benefits over what already exists inside of the Arduino Universe. ....then there is that hard boarder of being allowed to discuss alternate devices. one is banned from talking about a bananaPi on the RPi forums/chat boards. in the Arduino Universe. the ESP32 is openly discussed the RPi204 is an allowed topic on the Official Arduino forums discussing Arduino, software, troubleshooting, etc is strictly banned on the RPi boards.
@RalphBacon
@RalphBacon 3 жыл бұрын
Hmm. What are they all scared of? The other modules exist so let them be mentioned, is my view. Anyway, now I've got it (Pico) running on the Arduino IDE I guess we can mention them, officially!
@Mr.Leeroy
@Mr.Leeroy 3 жыл бұрын
Raspberry crowd is a lot more mainstream and probably less willing to invest time and effort in solving own confusion in technical aspects rather then spreading it on forums. I imaging that having other hardware realms to discuss on their boards makes a hell of a mess for underplayed moderators.
@yogeshitaliya473
@yogeshitaliya473 3 жыл бұрын
😍😍😍
@RalphBacon
@RalphBacon 3 жыл бұрын
I guess you like it, Yogesh! 👍
@lorenzo.c
@lorenzo.c 3 жыл бұрын
Ralph, yes, the RP2040 has a single 64 bit timer but each "slice" of the PWM block is an independent timer with a 16-bit counter with clock pre-scaler able to control 2 outputs, input capture, IRQ, DMA... For some reasons Raspberry Pi decided to call the entire section "PWM" instead of "Timers"
@RalphBacon
@RalphBacon 3 жыл бұрын
Thanks, Lorenzo, for this information. I'll read up about the timers and see how the 64-bit timer is "shared". Exciting times ahead!
@gregorymccoy6797
@gregorymccoy6797 2 жыл бұрын
Nice video. I am not a fan of Python or any other high-level language on devices like these. As a developer (professional) I'm not even a fan of Python on any device at all. Love your lab.
@RalphBacon
@RalphBacon 2 жыл бұрын
I don't like the idea of (relatively slow) interpreted languages, but once I get over that I don't like the syntax indentation forming part of the logic. That's just weird. Apart from that, it's a fine language! 😜
@hansdegroot652
@hansdegroot652 3 жыл бұрын
Hi Ralph. It says 2020 on the board. Not 2040. Is that me? or did you make a mistake?. okay I guess it could be a 4 after all.
@RalphBacon
@RalphBacon 3 жыл бұрын
It definitely says 2020 on the board, Hans, because it was manufactured then. The chip / module is an RP2040. Look confusing, I admit.
@dave-in-nj9393
@dave-in-nj9393 3 жыл бұрын
the label on the board is : ©2020 Raspberry Pi Pico copyright 2020
@hansdegroot652
@hansdegroot652 3 жыл бұрын
@@RalphBacon oh. haha. Glad you cleared that up :-) Silly me.
@fredflintstone1
@fredflintstone1 3 жыл бұрын
My Pico is now blinking:-)
@RalphBacon
@RalphBacon 3 жыл бұрын
Good job! Now write it in C++
@fredflintstone1
@fredflintstone1 3 жыл бұрын
@@RalphBacon you just wish to punish me:-) go too line 6, end
@RalphBacon
@RalphBacon 3 жыл бұрын
Watch this week's video, I show you how to get it all connected for C++ in the Arduino IDE. Simples.
@Stuart-AJC
@Stuart-AJC 3 жыл бұрын
Great video, thanks. I might have to get a few of these. One point though: at 3:53 the SRAM size is 264 KB (Bytes) not Kb (bits)
@RalphBacon
@RalphBacon 3 жыл бұрын
Close enough surely? Bits, bytes, all the same aren't they? 🤪😁😅
@Stuart-AJC
@Stuart-AJC 3 жыл бұрын
@@RalphBacon *8 ;)
@dave-in-nj9393
@dave-in-nj9393 3 жыл бұрын
compare with a Blue Pill
@RalphBacon
@RalphBacon 3 жыл бұрын
We _can_ compare and contrast, Dave, but they are different beasts really. Look at all the add-ons for the PICO that are out there already. Ideal for beginners. Not so the Blue Pill (not after my shenanigans with the bootloader, anyway!).
@Cptnbond
@Cptnbond 3 жыл бұрын
Hi Ralph, how do you remove the interpreter after you found that this thonny/python is not right for a project and want to reverse back to a nice clean pico, that behaves as a normal attached USB in Arduino IDE? I have found that this python-drive is very stubborn and refuse to be removed, or did I miss something? Also thanks for giving us stranded Europeans a hint about were to buy, this Brexit thing has just made it so much more expensive shopping online on UK-sites, in particular for smaller value orders. Cheers.
@K9-33
@K9-33 3 жыл бұрын
Download flash_nuke.uf2 from the Pico website. Drag it into the Pico drive for a nice clean Pico.
@RalphBacon
@RalphBacon 3 жыл бұрын
Yes, @K9 has described it well. I also just used the Arduino IDE on my PICO and it splatted over the top as far as I can tell. I need to check I'm not missing memory.
@fredflintstone1
@fredflintstone1 3 жыл бұрын
HA HA through hole great :-)
@RalphBacon
@RalphBacon 3 жыл бұрын
Is that an endorsement or a judgement against TH components? I've just realised that one switch (the RESET) and one chip (the Si4599) are still SMD. PCB is now in production, too late to change. Ooops.
@fredflintstone1
@fredflintstone1 3 жыл бұрын
@@RalphBacon As long as the SMD is 1206 I am happy :-)
@Tinker001
@Tinker001 3 жыл бұрын
@@fredflintstone1 SMD ain't so hard... kzbin.info/www/bejne/hmiVhmWvfbx-ic0 :P
@bbowling4979
@bbowling4979 3 жыл бұрын
@@RalphBacon Whoops!
@tubeDude48
@tubeDude48 Жыл бұрын
As of 10/14/2022 THONNY version 4.0.1
@RalphBacon
@RalphBacon Жыл бұрын
Ooh, another update, cool!
@RalphWLundvall
@RalphWLundvall 3 жыл бұрын
Once micropython is loaded and you stay with it, no more need to BOOTSEL and reconnect.
@RalphBacon
@RalphBacon 3 жыл бұрын
Doesn't always work for me. But I may be confused as I was using Arduino IDE with it today.
@RalphWLundvall
@RalphWLundvall 3 жыл бұрын
@@RalphBacon Sometimes I do have to pull the USB at my laptop to successfully stop code and get the REPL prompt but I haven't used the BOOTSEL button again.
@LdaHashZero
@LdaHashZero 3 жыл бұрын
Arduino C/C++, Raspberry pi C/C++, everything else C/C++ ... Python? Nope.
@RalphBacon
@RalphBacon 3 жыл бұрын
It sounds like you're still undecided then. 🤪🤣😅
At the end of the video, deadpool did this #harleyquinn #deadpool3 #wolverin #shorts
00:15
Anastasyia Prichinina. Actress. Cosplayer.
Рет қаралды 20 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 58 МЛН
Raspberry Pi Pico
16:16
ExplainingComputers
Рет қаралды 310 М.
#220 PICO and PIO: First Look - far easier than you might 💭 think
21:51
Pico Prototyping - Building a "Pico Uno"
36:08
DroneBot Workshop
Рет қаралды 90 М.
Every Developer Needs a Raspberry Pi
27:27
Sam Meech-Ward
Рет қаралды 559 М.
Arduino vs Pico - Which is the Best Microcontroller For You?
20:38
Gary Explains
Рет қаралды 295 М.
Pi Pico W with the Arduino IDE | Using WiFi
49:26
DroneBot Workshop
Рет қаралды 153 М.
Raspberry Pi Pico - Review and Getting Started
18:32
Gary Explains
Рет қаралды 75 М.