The Cheapest Microcontroller? Getting started with the 10 cent Puya PY32.

  Рет қаралды 44,735

Zach of All Trades

Zach of All Trades

Күн бұрын

The Puya PY32 is an amazingly cheap 32-bit microcontroller with an ARM Cortex M0+ core. These parts can be had for under 10 cents each in modest quantities, making projects requiring large numbers of microcontrollers affordable for us DIYers.
This video gives a brief introduction to the Puya PY32F0 series of microcontrollers, starting first with the benefits and drawbacks. I’ll then discuss the four options available and their respective features and cost. Next, I’ll go over the software and hardware tools needed to develop code and program these, including details on how to set up the software. Finally, I will show two demonstration codes to prove that these microcontrollers work as advertised and are relatively straightforward to use. First, I’ll do a classic blinking LED test using the onboard LED and one of the timer peripherals. The second example will use the internal analog to digital converter (ADC) to read an analog voltage and send the result out over the serial UART peripheral.
Check out these previous videos where I’m putting the PY32 to use:
Programming the PY32 for the tile backsplash project: • Programming the Smart ...
Introduction to the smart LED tile backsplash project: • LEDs, Microcontrollers...
Chapters:
00:00 Introduction
01:40 Why you might want a 10 cent microcontroller
06:12 The PY32 options
08:43 Getting started with uVision
13:53 Blinking an LED with a timer example
16:55 Reading an analog voltage and sending the result over UART example
19:42 Conclusion
The code used in this video can be found in this repository:
github.com/AllTradesZach/PY32...
The microcontrollers can be procured from LCSC here:
www.lcsc.com/products/Microco...
The development board:
www.lcsc.com/products/Develop...
Some of the tools I’m using in this video can be found here:
ST Link V2 Clone: amzn.to/4arg6u1
Official ST Link V3: amzn.to/4auZe5G
Quality Breadboards: amzn.to/43wJw82
As an Amazon Associate I earn from qualifying purchases.

Пікірлер: 98
@lohikarhu734
@lohikarhu734 18 күн бұрын
I've built stuff, and designed IC's to use in 500 million volumes... Part of the cost calculation goes to a bunch of factors, not least of which are assembly cost, passive components needed, PCB area and technology, connectors, and, believe it or not, production test. So, for high volumes, if you need anything outside the MCU, like capacitors, crystal, resistors, transistors (driving actuators, indicators). In one device case, we were able to build in quite complete self test capability, which saved almost 1/2 the price of the device, in reduced production test ( tested not just the device, but most of its connected components), and we "designed-out" current setting resistors, I2C pull-up resistors, and provided enough drive on the device to handle 95% of use cases... Sorry to blather on, just wanted to bring out some of the "stuff" that needs to get put into the "system cost" consideration. But, still, the amount of logic, or mechanism, that can be programmed into 10¢ !
@lohikarhu734
@lohikarhu734 18 күн бұрын
As much of a whiner as I can be, your video is very nicely done ... Good style, and good pacing... the one thing that I find, in many of this kind of video, that it would be nice to "zoom in" a bit on the screen images of the development setup. Sonst, prima.
@AllTradesZach
@AllTradesZach 18 күн бұрын
Thanks for the suggestion! I'm definitely learning here, so any constructive feedback is welcome
@AllTradesZach
@AllTradesZach 18 күн бұрын
I definitely see where you're coming from. I'm one of my earlier videos I discussed the engineering tradeoffs for the project, and had a lot of the same thoughts you're alluding to. My day job is in a high reliability, high quality field, so BOM cost isn't something we even worry about. In my earlier video though, i mention spending more on passive components than active components, which was absolutely true! Good quality caps and resistors add up!
@murraymadness4674
@murraymadness4674 17 күн бұрын
Indeed, as a DIY'r the first thing I look at is how many external components do these chips need. I really like the attiny202 because it needs NONE, and I'm using it now with its sdi to interface to a 2.4ghz radio to do very simple stuff. I previously used the msp430 back when they were new, which still needed a couple caps, but really needed a crystal for consistent timing. Although today when you can have small quantity of boards assembled in china, they can put on those external parts, which cost pennies instead of assembling yourself which is very painful for tiny smd parts, which everything is now. I got the ch32v parts recently to test them, real cheap and has so much more than an attiny. I have a new project to switch on/off hundreds of leds, and the ws leds are not bright enough, so the easy way isn't possible.
@lohikarhu734
@lohikarhu734 15 күн бұрын
Cool...as I said, overall very good video!
@RGormanJr
@RGormanJr 25 күн бұрын
As an older GenXer, I laughed when you said that 10¢ could buy half a GIGAbyte of storage. I can honestly remember the days when computer scrappers would pay a few bucks per MEGAbyte for non-working hard drives. (Of course an actual working drive cost hundreds of dollars per MB)
@AllTradesZach
@AllTradesZach 24 күн бұрын
You know, I almost left that one out, 'cause when I calculated that I realized just how cheap flash storage is. But then I remembered that each of these videos takes at least a quarter terabyte of storage, so I suppose it's all relative.
@musiqtee
@musiqtee 18 күн бұрын
My studio boss got mad at me for the invoice of four MB of RAM for our Atari ST. The set of four chips cost a little over $450 in 1989 - More than the actual computer… 😅
@lohikarhu734
@lohikarhu734 18 күн бұрын
In about 1980, one could buy a MASSIVE "Winchester" hard disk, even including the control board, for only about USD $2200... for.. 10 Megabytes! $220 per Megabyte !
@edwardfletcher7790
@edwardfletcher7790 17 күн бұрын
​​@@musiqteeyeah, that's 8x the standard RAM !! LOL I remember getting a 16mb Ram stick for my Amiga in the late 90's for US$150. I paid the same for a secondhand 200mb HD in the early 90's👍😁
@eightsprites
@eightsprites 16 күн бұрын
Had a 50mb harddrive in my Amiga 2000. No idea what that costed. Much I bet. Thanks dad ❤.
@user-lx9eg4yv5p
@user-lx9eg4yv5p Ай бұрын
YES!!! Thanks for the upload Zach! Still tuned & sub'd for the whole project! (and any others you may think of in the future!)
@edwardfletcher7790
@edwardfletcher7790 17 күн бұрын
Cortex M0 is a powerful little chip!
@cpk001
@cpk001 23 күн бұрын
Looking forward to future videos
@larsu1212123
@larsu1212123 Ай бұрын
Hey, I've been waiting for the follow-up, ever since your video on the "Backdrop" panels. Keep up the great work!
@larsu1212123
@larsu1212123 Ай бұрын
RP2040 is a bitt more comlex than the ~1$ controller. You still need NOR Flash, which sets you back around another dollar in small quantities. And at that pricepoint, competition of the esp32 series is getting relevant. Thus, even the more "expensive" PY32s may be worthwile, in my opinion.
@AllTradesZach
@AllTradesZach Ай бұрын
Thanks! You bring up a fair point with the RP2040 also needing a flash chip. The size of the RP2040 plus a flash chip is also substantially bigger than the QFN-16 PY32. I don't know about you, but when I get charged by the square inch for boards I make them as small as I can! For the backsplash project in particular size is very important. I think the -F030 has a compeling feature set for general purpose use and is a steal at 30-40 cents each. If it's true that the -F002A is the same die and can be convinced it is actaully a -F030 then that would be the real bargain.
@mytechnotalent
@mytechnotalent 17 күн бұрын
Incredible Zach!
@MrVipulLal
@MrVipulLal 15 күн бұрын
Eye opener video. Many thanks
@WessieNC
@WessieNC 16 күн бұрын
I find this chip very useful and interesting. Thank You.
@omar_l_p
@omar_l_p 18 күн бұрын
Muy buen video!! Simple e informativo.
@stefanguiton
@stefanguiton 17 күн бұрын
Great video
@Bianchi77
@Bianchi77 19 күн бұрын
Creative video, thanks :)
@mehmetkendi6067
@mehmetkendi6067 17 күн бұрын
Thank you!
@manfredbogner9799
@manfredbogner9799 19 күн бұрын
Very good
@parthsahni8952
@parthsahni8952 14 күн бұрын
Very good and informative vid! im ur 700th sub lol
@andymouse
@andymouse 18 күн бұрын
Interesting stuff, all the setup work is above my paygrade at the moment, fascinating nonetheless....cheers. Edit: oh yeah 'PB5' same port and pin on the Arduino Uno for the built in LED.
@choppergirl
@choppergirl 17 күн бұрын
I wonder if you could add input and output to convert this to the equivalent of an old mainframe.
@klassikkustard4828
@klassikkustard4828 14 күн бұрын
Commented cause i loved this
@LifeGeneralist
@LifeGeneralist 19 күн бұрын
Helpful!
@qnaman
@qnaman 18 күн бұрын
I've bought about 58 LGT8F328P - LQFP32 Boards of different kinds and they work as regular pro mini and are faster. But initally there was serious problem with libraries for them. Once I almost burned mine programmator, because one of pins started sending singnals through pin which works as input - which lead to shortcircuit.
@GnuReligion
@GnuReligion 18 күн бұрын
Oh, the Logic Greens? I have some of those atmega328 sorta-clones ... both the 20-pin and 32 pin. The ADC is superior on these, but still mystified that they did not make true clones, instead of these semi-compatible things, or something completely new.
@nguyenthinh6188
@nguyenthinh6188 18 күн бұрын
I agree, py32f002 is cheapest arm mcu can buy at here. Yes 4600vnd for 1 unit, easy to program via dap,stlink clone,etc...
@nguyenthinh6188
@nguyenthinh6188 18 күн бұрын
Fmd60 cheaper but programmer of that 8bit mci not cheap
@WallaceRoseVincent
@WallaceRoseVincent 14 күн бұрын
Hey Zach, I have a useful idea for the microcontroller that fits your channel. Since you are a jack of all trades then would a controller that monitors your ac system on your house be useful? A monitor system that helps you see ac problems before the turn catastrophic. It would be mostly temp sensing.
@RWBHere
@RWBHere 14 күн бұрын
Ten cents for all of that capability? I remember paying £100 for a megabyte of RAM and thinking that it was a bargain price. How times have changed.
@Really2950
@Really2950 2 күн бұрын
Flash size?
@yigitozen
@yigitozen 10 күн бұрын
well done YT recommendations.
@TheRainHarvester
@TheRainHarvester 16 күн бұрын
😮"wait 11:26 for it to update" oh yank-ware which may stop at any time? Is there a way to download everything to not depend on a company?
@AllTradesZach
@AllTradesZach 14 күн бұрын
I know, this can be frustrating. Puya revised their website when I was making this video and now some of the documentation is gone. Luckily I did download all of it locally. The packs, datasheets, and some of the tools are available right from GitHub for download though. As far as the IDE's, fingers crossed I guess...
@marsrocket
@marsrocket 15 күн бұрын
How long until there is compute power in EVERYTHING and it all meshes together?
@AllTradesZach
@AllTradesZach 14 күн бұрын
Well, we've got smart toasters, so I'd say that time is now.
@saddle1940
@saddle1940 18 күн бұрын
I had to smile when you described over several minutes, thee code needed to flash a led. It reminded me of the joke about the king and the toaster design. Even with interrupts, I'd be thinking under a minute with an arduino before youd be flashing the chip. So much prewritten code and definition files, i worry about code errors made by others, but thats the cost of wanting things like USB to work from libraries.
@usrrsr
@usrrsr 15 күн бұрын
Gr8 video and +1 subriber
@ChandrashekarCN
@ChandrashekarCN 18 күн бұрын
💖💖💖💖
@murraymadness4674
@murraymadness4674 17 күн бұрын
I get the sense you reading from a teleprompter?
@Ed19601
@Ed19601 17 күн бұрын
The development board is about 5 USD, which is lunacy compared to and ESP32 board
@AllTradesZach
@AllTradesZach 17 күн бұрын
Completely agree, they were $18 at one point which is absolutely absurd. These only make sense if you're spinning your own boards, and lots of them. Otherwise I'll personally grab a nucleo.
@Ed19601
@Ed19601 17 күн бұрын
@@AllTradesZach I have no experience with the Nucleo but they seem like pretty decent boards
@TimHayward
@TimHayward 4 күн бұрын
And you can load a forth environment to an esp32, which would be the most important thing.
@etmax1
@etmax1 14 күн бұрын
RP2040 has no internal Flash and only uses SPI Flash so it has to load the program or bits of program into RAM, reducing how much RAM you actually have for data so your comparison is a non starter in my opinion. What I do really like about this device though is that it's ARM M0+ rather than the somewhat inferior RISC-V. In my opinion the only thing RISC-V really gives you is the cheap FPGA synthesis. What I find interesting here is check the price out of an RTC chip compared to these micros. Obviously you need to be able have low power and a low power 32 kHz crystal connection, but basically you get about 5-10 of these for 1 RTC. I used to use MSP430 family devices as RTC's because they were 1/3 the price of an RTC. We use cheap micros for all sorts of glue logic because you can replace 100 or more logic gates with one of these for a fraction of the cost and PCB area if you don't need fast logic. Oh one last thing, when listing all of the serial options it has, I thought I'd mention that a lot of MCUs have shared HW for the various serial engines eg. the SPI Tx register and UART Tx Register could be the same HW meaning if you use SPI you're down a UART channel. It's not exclusively so, but just something to watch out for.
@AllTradesZach
@AllTradesZach 14 күн бұрын
I agree on the RP2040 not having flash, I probably should have mentioned that. I do still maintain that it is a powerful chip for 80c (+50c or so for a SPI flash), but needing that flash certainly makes it bigger and more expensive. I'm excited for RISC-V in the future, but so far I haven't seen anything that has made me make the jump. I definitely appreciate open source, but I haven't really seen RISC-V parts being drastically cheaper than ARM parts. This part is probably the cheapest way to get any of the peripherals! I can see using it just for the ADC, or as a GPIO expander, or as a serial translator. Hmm, I'd have to double check to see if there's any conflicting peripheral hardware. So far everything I've run has been fine, but I've not used all the serial peripherals simultaneously.
@etmax1
@etmax1 14 күн бұрын
@@AllTradesZach I agree, the pico chip is a great bundle, and the PIO engine is really something. The biggest issue is knowing what the real-time performance is going to be for any given implementation once programs exceed the available RAM. PCB footprint with external Flash is also a factor. On the peripherals sharing pins front, that is half of it, and I had a quick look at the Puya and the block diagram "Suggests" the peripherals themselves are separate (I didn't check for pin clashes). The thing I meant was eg. Infineon has not got I2C, SPI, UART, it instead has USIC0 and USIC1 which means that the registers are shared and they have a switchable state machine to make each USIC (only 2 of them) either I2C, SPI or UART. I got stuck with this where I needed 2 UARTs and 1 I2C. Another gotcha was that I couldn't get the SPI to work fast enough to do WS2812 because I couldn't reload the SPI register quick enough to do a 840bit stream without gaps. I could with a PIC.
@voidpointmedia853
@voidpointmedia853 27 күн бұрын
Weird fact: these can be found for free inside geek bar vapes. I recently decided to start disassembling these and found this micro controller in them which is wild being that these are DISPOSABLE VAPES. Such e-waste for no reason
@charlieRcarter
@charlieRcarter 25 күн бұрын
So hyped for fossilized computer chips in 1 million years
@AllTradesZach
@AllTradesZach 24 күн бұрын
That's quite interesting, I'd be curious to know what other products use them. They're in a bit of a weird place I think, because they're flash based and not the absolute cheapest, but also don't have the heritage/support/options of more expensive chips from STM, TI, Renesas, etc. But yes, quite a shame that the proliferation of cheap electronics has allowed society to make disposable electronics.
@andymouse
@andymouse 18 күн бұрын
Awesome, I have been collecting a stock of 3.7v cells from these 'disposable' vapes that litter my town ! I shall take a closer look at the controller now...cheers.
@PainterVierax
@PainterVierax 18 күн бұрын
most of the time, those cheap devices embed label-sanded chips that can come from any PRC manufacturer so it's not worth salvaging. most of the time they look like PIC pinouts but the programming is very different. And of course, those could be useless one-time-programming chips.
@TheOpticalFreak
@TheOpticalFreak 18 күн бұрын
Wait whut 😳😲 is that like an AT Mega?!😮
@isoslow
@isoslow 17 күн бұрын
AVR stuff is 30 years old overpriced joke compared to modern micros at 1/20 of the price.
@jayneatkinson2747
@jayneatkinson2747 17 күн бұрын
I found datasheets in Chinese a few days ago, but even they've disappeared. I'll stick with STM32
@AllTradesZach
@AllTradesZach 17 күн бұрын
In Chinese here: www.py32.org/mcu/PY32F002Axx.html They redid their website while I was making this video, there used to be English versions there that were quite good.
@bikkelchiefwizard1681
@bikkelchiefwizard1681 14 күн бұрын
at EEBLOG they mention an repository with all data sheets (also English)
@No-mq5lw
@No-mq5lw 21 күн бұрын
I honestly thought this was a new RISC-V chip. My disappointment was palpable when the reveal dropped.
@isoslow
@isoslow 17 күн бұрын
What's so good about RISC-V??! To me currently nothing. ARM has a huge codebase or ready-made opensource libraries for literally everything, RISC support on the other hand is nonexistent.
@No-mq5lw
@No-mq5lw 17 күн бұрын
@@isoslow FOSS isa lends itself to completely free resources, Verilog. Also newer ESP32 chips are RISC-V.
@LimbaZero
@LimbaZero 17 күн бұрын
@@isoslow With ARM cores manufacturer have to pay license to ARM. With those cheap mcu:s it can be risk if it's not paid by manufacturer. Basically all arm cores are from arm. Some have custom core using expanded instruction set but still they pay arm to use instruction set. Edit: STM and others who use ARM cores one reason why those cost more than chinese clones is that they pay that ARM license. For hobby user it can be ok to use those but to use in real product it can be problematic.
@No-mq5lw
@No-mq5lw 17 күн бұрын
@@isoslow Free ISA under Creative Commons lends itself nicely to free simulators, free Verilog/VHDL/etc soft cores, and the ISA itself can be customized to whatever specification you want including custom Instructions. This makes embedding a RISC-V processor in whatever you want pretty much free. For the moment though, the mid to high end performance tier RISC-V options definitely do have a lot of work ahead of them in order to get them production ready. Espressif is basically jumping ship from Xtensa to RISC-V with their next generation designs like the ESP32 -P4, C6, C3. And imagine how many devices have been shipped utilizing the *proprietary* Xtensa ISA. Just because it's not ARM doesn't mean that's stopping products from being shipped.
@AI-Doom-
@AI-Doom- 17 күн бұрын
Not available in my country (India) and import costs makes them expensive.
@stepannovotny4291
@stepannovotny4291 16 күн бұрын
Why do you need a HAL for something like this? The code is on bare metal isn't it? Doesn't the HAL just get in the way of actual hardware capabilities and introduce someone else's bugs?
@curtisnewton895
@curtisnewton895 5 күн бұрын
this is not a microcontroller, it is a microcontroller dev board
@Kysen10
@Kysen10 11 күн бұрын
This looks like a clone chip of STM.
@lohikarhu734
@lohikarhu734 18 күн бұрын
"if we're really being *pedantic*..." Or, am I being too pedantic?
@rocccyborg
@rocccyborg 4 күн бұрын
It's purely Chinese .. provide info on either Taiwan Japanese Korean American chipset
@user-iq2uz4vp9n
@user-iq2uz4vp9n 6 күн бұрын
The Cheapest Microcontroller? CH32v003
@MSM5500
@MSM5500 3 күн бұрын
_"overpaying for micro controller"_ I bought a handful of "Arduino" boards just for $1.5 from China then had to chuck them in a bin altogether. No way I'll ever look at anything cheap. You get what you pay for. A greedy always pays twice but an idiot pays for the rest of their life.
@amandioreal2293
@amandioreal2293 17 күн бұрын
This a clone of stm32f0 and use the same documentation.
@bikkelchiefwizard1681
@bikkelchiefwizard1681 14 күн бұрын
No the PY32F0 can run on 5V something the new ST micros lack
@Miguel-tr2ev
@Miguel-tr2ev 3 күн бұрын
Even the drivers, uses stm32 drivers
@amandioreal2293
@amandioreal2293 3 күн бұрын
@@bikkelchiefwizard1681 so why it runs on st ide and use the same documentation? Also you can clone and replace the ldo. Cube was developed only for st chip it no like Keil.
@bikkelchiefwizard1681
@bikkelchiefwizard1681 3 күн бұрын
The PY32F0xx can be powered from 5V the ST parts can not. They only go to 3.6V max.
@tcurdt
@tcurdt 17 күн бұрын
Is there platformio support? otherwise I'll pass
@awaagrikh8331
@awaagrikh8331 14 күн бұрын
no for now
@nyeleskettes
@nyeleskettes 16 күн бұрын
This looks like a cortex clone along with the debug interface and all the drivers.
@robotboy3525
@robotboy3525 3 күн бұрын
It gets the job done so who cares ?
@pacsmile
@pacsmile 27 күн бұрын
everytime you said 10 cent i thought you were saying "tencent", the chinese company
@luminousfractal420
@luminousfractal420 6 күн бұрын
too much talk im gone 😂
@hitension7
@hitension7 16 күн бұрын
You buy cheap, you buy twice! This video looks like paid ad.
EEVblog 1524 - The 10 CENT RISC V Processor! CH32V003
19:55
EEVblog
Рет қаралды 299 М.
ESP32 Guide 2024 | Choosing and Using an ESP32 Board
41:06
DroneBot Workshop
Рет қаралды 208 М.
Barriga de grávida aconchegante? 🤔💡
00:10
Polar em português
Рет қаралды 39 МЛН
原来小女孩在求救#海贼王  #路飞
00:32
路飞与唐舞桐
Рет қаралды 66 МЛН
Маленькая и средняя фанта
00:56
Multi DO Smile Russian
Рет қаралды 2,5 МЛН
Use the very attractive new ATTINY chips for your projects
14:34
Andreas Spiess
Рет қаралды 193 М.
ISD1820 Sampler Chip - How it works and easy Mods
14:48
Igor Brichkov
Рет қаралды 8 М.
You’ve Never Seen WiFi Like This
20:43
Data Slayer
Рет қаралды 385 М.
Make Dumb Electronics Smart for $3
13:13
I Like To Make Stuff
Рет қаралды 381 М.
Extracting Firmware from Embedded Devices (SPI NOR Flash) ⚡
18:41
Flashback Team
Рет қаралды 503 М.
The simple, clever sensor behind automatic windshield wipers
11:18
Technology Connections
Рет қаралды 919 М.
Top Fifteen Mistakes People Make When Designing Prototype PCBs
12:26
Cosplay Light and Sound
Рет қаралды 122 М.
A Better Way to Waterproof Fabric
28:50
NightHawkInLight
Рет қаралды 505 М.
Testing out the Milk-V Duo - The new $9 RISC-V eSBC that runs Linux!
23:19
phone charge game #viral #tranding #new #reels
0:18
YODHA GAMING RAAS
Рет қаралды 12 МЛН
Apple Event - May 7
38:22
Apple
Рет қаралды 6 МЛН
Why spend $10.000 on a flashlight when these are $200🗿
0:12
NIGHTOPERATOR
Рет қаралды 17 МЛН
Купите ЭТОТ БЮДЖЕТНИК вместо флагманов от Samsung, Xiaomi и Apple!
13:03
Thebox - о технике и гаджетах
Рет қаралды 53 М.