#219

  Рет қаралды 8,430

Ralph S Bacon

Ralph S Bacon

Күн бұрын

Sounds from the Raspberry Pi PICO? Easy! But will it be music to my ears?
JLCPCB Only $2 for PCB Prototype any colour jlcpcb.com/cyt
Aluminium PCBs too for $2 for 5pcs - you must check them out!
Generating simple sounds or tones from any μController is pretty easy so let's see what the PICO gives us and how nice it sounds. Let's make it more interesting by using MicroPython! My fridge door alarm sounds must be "nice" or it will get shut down.
Sketches used in this demo can be found here:
github.com/Ral...
PRODUCTS
Bag of 50 (yes, fifty) passive buzzers from Amazon for just £5.09 (Garosa Store)
amzn.to/3jSSN5D
In fact, the price has just gone down, worth a quick visit before they are all gone.
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 (and other μControllers) journey
My channel, GitHub and blog are here:
------------------------------------------------------------------
/ ralphbacon
ralphbacon.blog
github.com/Ral...
------------------------------------------------------------------

Пікірлер: 117
@johnwilson3918
@johnwilson3918 2 жыл бұрын
Thank you for this! I know your intent was not to give a programming tutorial - but I hope you don't mind me showing some extra features of Python. The language has really neat features when dealing with arrays, such as allowing you to use negative indexes. So. Starting with an example array... tones = [100, 200, 300] You can use negative indexes to grab from the end of an array. tones[-1] is 300 tones[-2] is 200 tones[-3] is 100 You can easily reverse an array. try:- print(tones[::-1]) You can also remove the need for using an index. # Fridge Opened for freq in tones: buzz(freq) # Fridge Closed for freq in tones[::-1]: buzz(freq)
@RalphBacon
@RalphBacon 2 жыл бұрын
Thanks for sharing, John! As I don't really know microPython it's good to get posts like this that everyone can benefit from, me included!
@DustinWatts
@DustinWatts 3 жыл бұрын
Hi Ralph! Just to save you from any headache in the future... you might want to add a resistor across the piezo when driving it with a BJT. Simply put, you need to pull the collector up to 5V in order to get a change in voltage happening across the piezo. I suspect in this case your multimeter was acting like that resistor, so you should have a noticeable difference when not having the DMM across.
@RalphBacon
@RalphBacon 3 жыл бұрын
Quite possibly, Dustin. However, even as it was with the DMM across the output, it was more than loud enough (the video compresses the sound so it's not as noticeable). But I'll try it.
@AtlantaTerry
@AtlantaTerry 3 жыл бұрын
Ralph, did you look into the *floating ground* issue we discussed a few weeks ago? As I understand it, this can happen when you connect your new backyard workshop to your house with anything conductive such as an Ethernet cable. Electricity (like water) wants to find an equilibrium for its potential so it tries to do so by moving energy through anything available. If it is your Ethernet cable, this can prove to be damaging to devices such as routers, repeaters, etc. Back in the '90s when I worked for a small computer shop, we would run into floating ground issues when we would attempt to connect multiple nearby office buildings or various buildings on military installations with coaxial Ethernet cables. To stop the problem one can use purpose-made optoisolators, microwave transmitter/receiver pairs, or fiber optic Ethernet lines instead of copper. Terry Thomas PC Tech Support Atlanta, Georgia USA
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 жыл бұрын
Any gound with current flowing throught it will create a voltage between the two ends. if I going to run ethernet between buildings now days i go stright to fibre, breaks the ground loop and give far better lightning protection. an optoisolator only save one end if your lucky.
@RalphBacon
@RalphBacon 3 жыл бұрын
I did indeed look for web articles and a simple, RJ45 plug-in, isolation device to break the ground connection (if any) on my LAN cable from house to workshop. None to be found in the UK, only the USA. Now, that said, I'm was thinking about whether my LAN cable is connected to _actual_ ground. It has a shield, for sure, but whether that is connected to the device (router) ground or the ground/earth coming into my house via the mains electricity is questionable (and difficult to test). Most routers probably have a floating earth? Not connected to mains earth at all (perhaps for the reasons you state)? My workshop has its own Earth. A copper rod buried into the actual ground outside my workshop and connected to all my mains sockets and consumer unit (fuse box) in my workshop. This is now the preferred way to earth outbuildings in the UK, to mitigate risk from "broken" earth cables (that go pretty much undetected) between house and outbuilding. Electrician said I had a better earth (lower resistance) than the house did! So what's the next step.
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 жыл бұрын
@@RalphBacon It's just a difference in earth potential, So I'd look for a fibre ethernet and run a fibre link up to the shed, you get full isolatation and prection from lightning. something like a pair of TP-Link Gigabit SFP to RJ45 Fiber Media Converter, Fiber to Ethernet Converter and a fibre cable. should get change from £100 and can be found on Amazon
@markday3145
@markday3145 3 жыл бұрын
If you just want to iterate through a list of items, you can do it directly, without using an index: for tone in tones: buzz(tone) And to do it in reverse: for tone in reversed(tones): buzz(tone) For a cleaner sound, using an analog output (DAC) with a sine wave (or multiple sine waves added together for a chord) seems good. But the DAC output can't supply much current, so you'd need some kind of amplification. I wonder if a transistor would be sufficient, or you'd need something like an op amp?
@IanSlothieRolfe
@IanSlothieRolfe 3 жыл бұрын
or 'for tone in tone[::-1]:'
@RalphBacon
@RalphBacon 3 жыл бұрын
Ian's just showing off now (but I do like that construct, I will probably use it and claim I knew all about it).
@andymouse
@andymouse 3 жыл бұрын
It's said it's first words !...cheers.
@RalphBacon
@RalphBacon 3 жыл бұрын
But it most certainly was not "Da-da".
@ifell3
@ifell3 3 жыл бұрын
Love your work!!
@RalphBacon
@RalphBacon 3 жыл бұрын
Thank you! Cheers!
@mihumono
@mihumono 3 жыл бұрын
You can write Your for loop like this: for tone in tones: buzz(tone)
@RalphBacon
@RalphBacon 3 жыл бұрын
I knew that. I did. Really I did. OK, I didn't. Now I do.
@1larrydom1
@1larrydom1 3 жыл бұрын
Hello Ralph from Ohio, USA! Your episodes always seem to inspire me to do something, which is one of the points of them, I'd guess. Anyway, I bought an old pulse-dial phone and found that much of the functions can be run off of 5v DC. (Even the AC ringer can be operated by flip-flopped DC.) Going to take the old dfplayer mp3 module and make it into a dialable story phone for my grandkids. Thank you for the inspiration!
@RalphBacon
@RalphBacon 3 жыл бұрын
Sounds great! Did you see my video on an old, rotary telephone dialler? kzbin.info/www/bejne/qXWVYauhi7ybaNU
@1larrydom1
@1larrydom1 3 жыл бұрын
@@RalphBacon I didn't, but will watch it! Thank you. There is a library called bounce2.h that I was going to use. I'll look at what you did and see which is better for me.
@gpTeacher
@gpTeacher 3 жыл бұрын
Great as always Ralph. Last year I did a little 555 timer project with a piezo on-board as a beeper I could feed down inside a wall cavity to locate a cable. It's powered by a little 12V battery like in a garage door opener. It's EAR-BLEEDINGLY-LOUD. Maybe you could add something like that to your circuit to increase your volume. Very instructive as always Ralph. Thank you.
@RalphBacon
@RalphBacon 3 жыл бұрын
That is awesome! In fact, my ears are bleeding just from reading your comment, Gord! In my Arduino projects I can use a tone library which leverages the push-pull effect from the Timer output pins D9 and D10; I don't know how to do this in MicroPython (yet?) so the transistor was an obvious step!
@JxH
@JxH 3 жыл бұрын
In the 1980s, the Tandy Radio Shack Colour Computer (6809 based) had a relay used to turn the external cassette deck off and on. Of course we used to program machine code to make it buzz, and play crude music. Not for long durations of course, as it was abusing the relay. Going back even further, the original monochrome TRS-80 (Z80 based) had a commercial game or two that played music (intentionally) on a nearby MW AM radio by means of intentional EMI. It was RF comedy and a display of extremely clever programming.
@RalphBacon
@RalphBacon 3 жыл бұрын
Stop, stop! You'll be telling me next that the Morse code operators of the WWII made little tunes up to confuse the enemy (or to pass messages on, perhaps!). Oh. kzbin.info/www/bejne/hGi1ZHmDibSSfbc
@ianleitch9960
@ianleitch9960 3 жыл бұрын
Different shades of the same; progressing ideas through a number of projects in a timeframe, that's why I called myself a software developer, rather than a programmer. The next program in line usually borrowed from it's predecessor even if only the initial credits remained finally. Keep having fun, JLPCB certainly seem to be coming along in leaps and bounds, offering to the enthusiasts products that were unobtainable until recently.
@RalphBacon
@RalphBacon 3 жыл бұрын
More than a software developer, Ian, a _software engineer_ at the very least! In fact, they called me a senior software engineer at my last job and were very particular about it! And, no, they were not referring to my age. 😡 Yes, JLCPCB seem to be trying hard to provide the services small/medium companies are demanding. Amazing what is out there.
@jyvben1520
@jyvben1520 3 жыл бұрын
17:00 for tone in tones: next line buzz(tone)
@RalphBacon
@RalphBacon 3 жыл бұрын
Hang on, this is _advanced_ MicroPython, now you're just showing me up. 😔
@jyvben1520
@jyvben1520 3 жыл бұрын
@@RalphBacon and for the next trick , for tone in reversed(tones) ;-) still your video helped me, my sound buzzer was not good, thought it was the hardware, PWM helped !
@flemmingchristiansen2462
@flemmingchristiansen2462 3 жыл бұрын
Nice video as usual. It's not only the pets that learn to tone. Wife learn it too, so no sneaking in the fretch any more. Wonder if you thought of that 😉
@RalphBacon
@RalphBacon 3 жыл бұрын
Oops, hadn't thought of that. I remember that's one reason why I had the touch switch on the old fridge alarm, so that I could sneak the door open (so Benny wouldn't hear, of course, not so that the wife would not hear me sneaking some extra cake, of course not).
@CTCTraining1
@CTCTraining1 3 жыл бұрын
Thinking about increasing the sound output of the unit ... have you looked at some of the lovely smooth and flat surfaces that fridges often have and try to use them as sounding boards? Yes you probably need a firm connection, perhaps magnetically, to transfers the force but it might be a cheap win. Keep up the great work 👍😀
@RalphBacon
@RalphBacon 3 жыл бұрын
It would be a cheap win for about 30 seconds and then the boss would spot it. Mind you, I could use the _top_ of the fridge; she is too short, er, vertically challenged, to see that!
@Chriva
@Chriva 3 жыл бұрын
80's games, welcome back! :)
@RalphBacon
@RalphBacon 3 жыл бұрын
I don't think it was even that good, Christian! 80s games were quite musical!
@grahamwise5719
@grahamwise5719 3 жыл бұрын
Hi Ralph, use two pins for the buzzer with inverted signals so have a bridge circuit? Should be louder than 5v.
@joseph9915
@joseph9915 3 жыл бұрын
If you want another option this might also work wikipedia.org/wiki/Voltage_doubler#Dickson_charge_pump
@RalphBacon
@RalphBacon 3 жыл бұрын
@Graham yes, I do that with the Arduino but didn't know how to do that with the RP2040, especially not with MicroPython - a future version perhaps?
@grahamwise5719
@grahamwise5719 3 жыл бұрын
@@RalphBacon Not easy perhaps an interrupt pin change on the PWM output pin and use that to set the inverted pin in the interrupt service. or use a transistor to invert the signal? Use the 12S output and a sound chip on 3v3 with a embedded data of the sound? Graham
@j1952d
@j1952d 3 жыл бұрын
Little bit of low-pass RC filtering on the sounder may made the sound a bit more pleasant.
@asagk
@asagk 3 жыл бұрын
I guess the piezo already does some kind of low pass filtering, since it cannot directly follow the steep flanks of the signal anyways. Membrane speakers do filtering that even better, due to their elastic resistance as well as resistance of the air moved around. But some low pass filtering with an op-amp (integrator circuit) might do even better than passive RC low pass filtering, since an integrating op-amp amplifier also gets rid of the transistor amplifier at the same time.
@gpTeacher
@gpTeacher 3 жыл бұрын
@@asagk absolutely! A small 8R speaker sounds MUCH better than a piezo. Thanks for mentioning!
@j1952d
@j1952d 3 жыл бұрын
@@asagk - Ralph could do wonders with some analog processing - or maybe digital synthesis - but it's just a little "bleeper". I was just suggesting a very easy way to possibly make it sound a bit less "harsh" (using 2 passive components). AFAIK he's not trying to emulate a Hammond organ!
@asagk
@asagk 3 жыл бұрын
@@j1952d "AFAIK he's not trying to emulate a Hammond organ!" --- ... what a pity, isn't it?! :-)
@j1952d
@j1952d 3 жыл бұрын
@@asagk - Hahaha!
@willofirony
@willofirony 3 жыл бұрын
Awesome video, Ralph. I have always disliked the ubiquitous "Hell World" program as a starting point, Why? Well, you cannot take that code any further (OK, OK, yes, you could change it to "Goodbye World"). A couple of videos ago I embarrassed you by lauding your presentation technique. Well this video is an apt example. You introduced us to a few lines of python code then slowly built that up into a functioning program. Yes there is still further to go: sensing the state of the fridge/bin door/lid etc. However, we have learnt a little micro python and the functioning of passive and active buzzers. Further, you showed us why one would choose from these two. You didn't skip to the punchline with a "don't bother with passive devices, you won't be happy with the result". Well done you, Ralph.
@RalphBacon
@RalphBacon 3 жыл бұрын
I'm glad I'm being consistent, if nothing else, Michael! TBH, I've been aware (and concerned) for some time that my channel no longer addresses the needs of beginners to the hobby; I'm trying to address that with videos like these. I'm hoping it's working.
@neildarlow
@neildarlow 3 жыл бұрын
You can increase the output volume by driving the piezo sounder with complementary signals. You could use an inverter but this might be a good application for the PIO feature of the RP2040.
@RalphBacon
@RalphBacon 3 жыл бұрын
Great idea, Neil. I intend to experiment with the PIO (some sort of strange assembler language, by the looks of it) but I'm not sure the output can be dynamically changed; for example output different output frequencies controlled by the main program. I must do some R&D.
@fluiditynz
@fluiditynz 2 жыл бұрын
There's some missing stuff in your transistor piezo circuit. most piezos register as open circuit at working voltage tests, they behave a lot like capacitors. Your transistor can give a lot sharper edges to your tone signals in but without a resistor to pull the gnd end of the piezo back up to 5 volts, it will just stay down at gnd + the transistor emitter forward voltage. If I really needed the volume and had spare pins I used to pair pins up as a full bridge driver back in my past life on microcontrollers where I was bit banging much of my custom code. A 1k resistor across your piezo should sharpen up the sound. So long as you power down mode with your output switched to input there's no standby current penalty.
@RalphBacon
@RalphBacon 2 жыл бұрын
Sounds like some good info there, Graham, thanks for sharing. I shall bear this all in mind.
@kentswanson2807
@kentswanson2807 3 жыл бұрын
Pick frequencies that map to notes. E.g. 440 for A. Also I believe piezo are essentially analog, so a cap and resistor to filter some high frequency harmonics.
@RalphBacon
@RalphBacon 3 жыл бұрын
I'll try that and a couple of other things, to see if we can make it more melodious!
@BER-UK
@BER-UK 3 жыл бұрын
If you want a better sine wave rather than a square wave, add a 1khz low pass filter to the output.
@RalphBacon
@RalphBacon 3 жыл бұрын
A couple of components should do that; I might try it.
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 жыл бұрын
You could use the pwm to produce a nice signwave the pico is fast enough to do this with ease. Square waves are just so Z80 :-)
@RalphBacon
@RalphBacon 3 жыл бұрын
Ah, the Z80... I was a 6502 man myself but that's all a lifetime away!
@andymouse
@andymouse 3 жыл бұрын
Your sooooo right !
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 жыл бұрын
@@RalphBacon Well the first chip i ever programmed was an SC/MP or INS8060 on a Sinclair Mk14 with 256 bytes of ram. now I'm showing my age. muist have been 77 or 78
@NormanNodDunbar
@NormanNodDunbar 3 жыл бұрын
Hi Ralph, Another great video, thanks. You mentioned the tone() function sounded better on the Nano. Probably because the Nano was running compiled C/C++ code whereas the Pico was (semi-)interpreted byte code. Not quite the same. I don't know if the Python code bit-bangs or uses a timer to generate sound. (I'm not a great Python fan.) The Nano sound is generated using a hardware timer (timer 2, 8 bit) and an interrupt (CompA). This is fairly well covered on pages 104 onwards, in chapter 3 of a slighly famous book on the Arduino. ;-) Your tones appear to be fairly randomly chosen. Maybe using actual tones of the notes in a scake would sound better? Hope you are settled in your new home. Take care. Cheers, Norm.
@RalphBacon
@RalphBacon 3 жыл бұрын
Hey Norm! Yes, pretty much settled in, thank you, but still have a couple of things to do in my workshop as I discovered when doing this week's video! Never enough USB sockets! Or they are too far away! Regarding the tones from the PICO, it undoubtedly sounded worse due to my non-scale choice of tones; it will doubtless improve as I select proper, known tones. Nope, can't bring to mind that book you mention covering the Nano, timer-generated sounds 😊 But PICO bit-banging works OK, as I found out this week with the easier-than-you-think PIO feature - keep tuned!
@NormanNodDunbar
@NormanNodDunbar 3 жыл бұрын
@@RalphBacon Pio? I'm definitely looking forward to that video. It's definitely an intriguing feature of the RP2040. USB (or any) socket, there's never enough and/or in the right place. Even when you decide how many youneed, then double it! 😉 Cheers, Norm.
@dpratte
@dpratte Жыл бұрын
Nice work. Thanks!
@RalphBacon
@RalphBacon Жыл бұрын
Glad you liked it!
@borayurt66
@borayurt66 3 жыл бұрын
I think that "loose variable type" business is because it is an interpreter not a compiler. A compiler has to know everything beforehand since it aims to create the smallest, fastest running code possible and has do this "blindly" (without running the code and see what's going on). Just a logical guess based on my ZX Spectrum BASIC days in the 80's. Oh, by the way, I love that protoboard, care to share a link for it?
@RalphBacon
@RalphBacon 3 жыл бұрын
I think it might be more that (Micro) Python is just a loosely-typed language, like JavaScript or some variants of BASIC. Whatever, as long as the developer doesn't abuse that feature I guess it's all good! That breadboard (you're not the first to ask!) it's this one (UK supplier): coolcomponents.co.uk/products/ad-11-advanced-solderless-breadboard
@44mod
@44mod Жыл бұрын
I love this video. The way you explain the code I can understand. If I understand correctly you are running code directly from Thonny instead of saving the code directly to Pico that would run all the time. I have been watching some lecture videos by Hunter Adams he is taking a Pico and changing the squire waves and using the ADC to convert them to Analog waves to make the sound of a cricket. Would this speaker work on analog waves also? I am an old man of 59 or that is what people tell me. I feae in my mind like I am young man hungry for knowledge and that is how I ended up at this awesome video as we said in the 80's. Thank you and God Bless!
@RalphBacon
@RalphBacon Жыл бұрын
The code definitely runs on the Pico; I can't remember all the details now but I uploaded the code using Thonny, for sure. The speaker I used here was (probably) some piezo sounder; only really designed for square waves (ie digital sounds). To play analog sounds you need a "proper" loudspeaker (not too low an impedance) which are fairly cheap but can sound quite good if mounted on some sort of baffle (even an enclosure side panel would suffice). It can be small too, I have some that are less than 1" across. But better ones are a bit bigger, say 2" diameter.
@asagk
@asagk 3 жыл бұрын
Ralph tell me one thing, where does that little attached reset button come from? Is it a nifty self made thingy? (Already thinking about creating some, while I have lots of spare smt push buttons somewhere in my chaotic 'mechanic parts nirvana box' ). Or is it some product from somewhere? Didn't find it ... perhaps looking for the wrong 'naming'.
@andrewhartley8781
@andrewhartley8781 3 жыл бұрын
They come from Pimoroni, see link: shop.pimoroni.com/products/captain-resetti-pico-reset-button
@asagk
@asagk 3 жыл бұрын
@@andrewhartley8781 Ty!
@RalphBacon
@RalphBacon 3 жыл бұрын
Andrew is correct; as I was ordering the RP2040 boards from them I included the ridiculously simple reset buttons too (and £1 from each goes to the Raspberry Pi foundation). But I'm sure a simple SMD button soldered across the pins would suffice too.
@markj3851
@markj3851 3 жыл бұрын
Great to see you again Ralph- I'm looking for a tone to mimic the rotary encoder "tick" as it's turned up and down and was wondering if you have any suggestions?
@RalphBacon
@RalphBacon 3 жыл бұрын
I would have thought that a standard tone (beep) but at a low frequency (100Hz) that is short (eg 50ms or less) might sound like a tick, Mark. The problem will be to keep it in sync with the actual movement as you won't want to be initiating tones within an ISR.
@fluiditynz
@fluiditynz 2 жыл бұрын
@@RalphBacon If the piezo drive is push/pull then simply connect the other piezo pin to the pulse output of the rotary encoder. It will click. It will also drive the micro pins low for half the clicks but internal static protection circuitry will deal with this unless your piezo is huge!
@laurentstrodiot8434
@laurentstrodiot8434 Жыл бұрын
Very instructive video, I like your style :-) on your pcb, the one you show at the end, you have a 18650 battery and a TP4056 I beleive, would you mind sharing the shematic of the circuit. I am actually designing a pcb with that kind of set up. Thanks, Best.
@RalphBacon
@RalphBacon Жыл бұрын
I've added the schematic to my GitHub for the project you are referring to (video #221 kzbin.info/www/bejne/m33Rl5yPoN12h5Y ) and you can find it here: bit.ly/3Yo2r1r
@laurentstrodiot8434
@laurentstrodiot8434 Жыл бұрын
@@RalphBacon Many thanks for this ! this is exactly what I needed for my pcb project. keep on the good work !
@tubeDude48
@tubeDude48 3 жыл бұрын
Sounds like a Jet Engine at 22:00!
@RalphBacon
@RalphBacon 3 жыл бұрын
Sounds pretty awful, quite frankly. I shall have to play a proper (very short) tune for the final product.
@gordanmilne7034
@gordanmilne7034 3 жыл бұрын
I thought a Kettle whistle.
@andrewhartley8781
@andrewhartley8781 3 жыл бұрын
Another great video, thanks Ralph. As has already been said, the sound reminded me of the 8bit computer games back in the 80's. Have you managed to get the pico-probe debugger working via a 2nd Pico yet? I prefer C and C++, so that's what I'm now using. Currently writing a class for outputting numbers to 7-segment displays via MAX7219s. The debugger helps no end. Perhaps you can show the use of the debugger with C or C++ code in a future demo?
@RalphBacon
@RalphBacon 3 жыл бұрын
That's a great idea but time is my enemy. What with multiple projects on the go and a gazillion other things to do I have to be very selective where I spend my time. But it's most definitely on my list of *very important things* to do (regrettably, not on my wife's list at all).
@Roy_Tellason
@Roy_Tellason 3 жыл бұрын
@@RalphBacon Funny how that works...
@petermoore9504
@petermoore9504 3 жыл бұрын
Hi Ralph, bit of a weird question but I have the same breadboard which I really like but I've had it for decades with no recollection where I got it from. Do you remember where you got yours? Cheers and thanks for the videos. Ps I've been having fun with a teensy 4 playing recordings.
@theonlymudgel
@theonlymudgel 3 жыл бұрын
I’m in Australia but got my breadboards from the UK at.this company.. coolcomponents.co.uk/products/ad-12-advanced-solderless-breadboard Excellent range of quality breadboards. Cheers Mike V. Hi
@RalphBacon
@RalphBacon 3 жыл бұрын
Same place as Mike but this is my version: coolcomponents.co.uk/products/ad-11-advanced-solderless-breadboard
@petermoore9504
@petermoore9504 3 жыл бұрын
@@theonlymudgel Thanks
@petermoore9504
@petermoore9504 3 жыл бұрын
@@RalphBacon Thanks, its the six pin rails I particularly like. 🙂
@MUHAMMADYAWARIFRAHEEM
@MUHAMMADYAWARIFRAHEEM 3 жыл бұрын
Very informative videooo Sir
@RalphBacon
@RalphBacon 3 жыл бұрын
Glad you like it, Muhammad!
@gedtoon6451
@gedtoon6451 Жыл бұрын
I had difficulty with the question of whether Python is strongly or weakly typed. It is in fact strongly typed.
@RalphBacon
@RalphBacon Жыл бұрын
Good to know!
@fredflintstone1
@fredflintstone1 3 жыл бұрын
could you use a speaker amp and a wav file??
@RalphBacon
@RalphBacon 3 жыл бұрын
I can't use a wav file unless I can access it. So I either need to store the file in EEPROM or SPIFFS or something, or use an SD card - none of which I want to do for a simple fridge door alarm. But others may want to experiment, it would be a good way to learn. (Others=you, in case you missed that 😁)
@fredflintstone1
@fredflintstone1 3 жыл бұрын
@@RalphBacon Me!! HA HA!
@_emanmodnar
@_emanmodnar Жыл бұрын
🎶💨😣 For all those out there who got ticks from listening to the sound of the awful scale played in this video… use this instead to at least get an equal tempered scale from the note A: 220 * 2**(tone/12) # Hz. 220=root tone, tone=number of semitones up from the root tone
@_emanmodnar
@_emanmodnar Жыл бұрын
major_scale = [0,2,4,5,7,9,11,12] root = 220 # Hz of the root tone of the scale to play (A3 in this case) for semitone in major_scale: Hz = root * 2**(semitone/12) # equal tempered, an octave divided in 12 equal semitones buzz(int(Hz)) print(Hz) # If you want to check the individual frequencies sleep(2) # Other comon scales: cromatic = [0,1,2,3,4,5,6,7,8,9,10,11,12] minor_scale = [0,2,3,5,7,8,10,12] minor_scale_mel_up = [0,2,3,5,7,9,11,12] # Melodic minor scale in upgoing direction minor_scale_mel_down = minor_scale # Melodic minor scale in downgoing direction minor_scale_har = [0,2,3,5,7,8,11,12] # Harmonic minor scale for semitone in minor_scale_mel_up: Hz = root * 2**(semitone/12) buzz(int(Hz)) for semitone in minor_scale_mel_down[-2::-1]: Hz = root * 2**(semitone/12) buzz(int(Hz))
@RalphBacon
@RalphBacon Жыл бұрын
Sorry 😔 I'm no musician (as this video proves) 😢
@_emanmodnar
@_emanmodnar Жыл бұрын
@@RalphBacon But you are making the world smarter with your videos ☺
@flipschwipp6572
@flipschwipp6572 3 жыл бұрын
21:54 so much jitter! your timing is way off, generate timing in hardware!
@RalphBacon
@RalphBacon 3 жыл бұрын
Well, the PIO feature on the PICO is hardware so I might use that.
@BEdmonson85
@BEdmonson85 3 жыл бұрын
@@RalphBacon In the past where I needed accurate timing (on a PIC at least), I used an interrupt based timer algorithm. In my case I was using it to get around Microchip's MPLAB compiler adding nop's and other crap when compiling with with the free version.
@RalphBacon
@RalphBacon 3 жыл бұрын
It was the added NOPs (and other non-optimal compiling) that made me veer away from PIC processors, they (MicroChip) were pretty mean with their compiler (that produces code for their own bleeping chips, after all). Now look what happened to Atmel!
@BEdmonson85
@BEdmonson85 3 жыл бұрын
@@RalphBacon Yep, complete BS. They were hoping people would pay for the pro version (and I assume the truly "pro" users did), but in a lot of cases I think it just drove many people away. I think their MPLAB-X IDE is pretty good, but the XC-xx compilers are terrible if you're using the free versions.
@manuelr7121
@manuelr7121 Жыл бұрын
wow just what i was looking for please make another video just like this but explain to us lay peoepl how you turn a wav file into pwm with python i have seen other videos but they are confusing
@RalphBacon
@RalphBacon Жыл бұрын
I'm glad this video was useful to you, but the bad news is that I'm not really a Python coder.
@UReasonIt
@UReasonIt 3 жыл бұрын
If you want break-out boards for the Pico, I have a Gerber set for one you can have made at your favorite PCB maker. It can be found here: github.com/jscottb/pcbs under the RPI-Pico folder
@RalphBacon
@RalphBacon 3 жыл бұрын
Nicely done; I like the way you've wired in the RST button across the board too.
@UReasonIt
@UReasonIt 3 жыл бұрын
@@RalphBacon Thanks. I had some SMD buttons and added leads to them.
#220 PICO and PIO: First Look - far easier than you might 💭 think
21:51
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 6 МЛН
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 63 МЛН
#218 Dual Switch Detection using Diodes and an Arduino 😲
18:42
Ralph S Bacon
Рет қаралды 7 М.
DON'T Use Raspberry Pis for Servers! (Use THIS)
16:23
Hardware Haven
Рет қаралды 1,1 МЛН
3 engineers race to design a PCB in 2 hours | Design Battle
11:50
Predictable Designs
Рет қаралды 135 М.
Putting an end to the WORST kind of gears.
16:35
Not An Engineer
Рет қаралды 228 М.
PicoMiteVGA: Raspberry Pi Pico Boot-to-BASIC Microcomputer
23:58
ExplainingComputers
Рет қаралды 127 М.
I Built The First LAMINAR FLOW ROCKET ENGINE
15:51
Integza
Рет қаралды 1,9 МЛН
Raspberry Pi  Pico PIO  - 8 Little Processors You Can Program
31:55
Gary Explains
Рет қаралды 91 М.
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15