#219

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ • 117

  • @johnwilson3918
    @johnwilson3918 3 роки тому +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  3 роки тому +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 роки тому +1

    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

  • @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. ua-cam.com/video/N7R3FMTO_GU/v-deo.html

  • @markday3145
    @markday3145 3 роки тому +1

    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 роки тому +2

      or 'for tone in tone[::-1]:'

    • @RalphBacon
      @RalphBacon  3 роки тому +1

      Ian's just showing off now (but I do like that construct, I will probably use it and claim I knew all about it).

  • @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 роки тому +1

      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).

  • @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.

  • @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!

  • @ifell3
    @ifell3 3 роки тому +1

    Love your work!!

  • @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!

  • @1larrydom1
    @1larrydom1 3 роки тому +1

    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? ua-cam.com/video/sD20xkVWh2s/v-deo.html

    • @1larrydom1
      @1larrydom1 3 роки тому +1

      @@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.

  • @willofirony
    @willofirony 3 роки тому +1

    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 роки тому +1

      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.

  • @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!

  • @grahamwise5719
    @grahamwise5719 3 роки тому +2

    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

  • @mihumono
    @mihumono 3 роки тому +1

    You can write Your for loop like this:
    for tone in tones:
    buzz(tone)

    • @RalphBacon
      @RalphBacon  3 роки тому +2

      I knew that. I did. Really I did. OK, I didn't. Now I do.

  • @j1952d
    @j1952d 3 роки тому +3

    Little bit of low-pass RC filtering on the sounder may made the sound a bit more pleasant.

    • @asagk
      @asagk 3 роки тому +1

      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 роки тому +1

      @@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 роки тому +1

      @@asagk - Hahaha!

  • @andymouse
    @andymouse 3 роки тому

    It's said it's first words !...cheers.

    • @RalphBacon
      @RalphBacon  3 роки тому +1

      But it most certainly was not "Da-da".

  • @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.

  • @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.

  • @TheEmbeddedHobbyist
    @TheEmbeddedHobbyist 3 роки тому +1

    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 роки тому +1

      Your sooooo right !

    • @TheEmbeddedHobbyist
      @TheEmbeddedHobbyist 3 роки тому +1

      @@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

  • @jyvben1520
    @jyvben1520 3 роки тому +2

    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 роки тому +1

      @@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 !

  • @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 роки тому +1

      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 роки тому +1

      @@RalphBacon Funny how that works...

  • @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 роки тому +1

      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!

  • @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. 🙂

  • @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  Рік тому +1

      I've added the schematic to my GitHub for the project you are referring to (video #221 ua-cam.com/video/eLnfiYkxCQ4/v-deo.html ) 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 !

  • @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 роки тому +1

      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.

  • @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.

  • @dpratte
    @dpratte Рік тому

    Nice work. Thanks!

  • @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 роки тому +1

      They come from Pimoroni, see link: shop.pimoroni.com/products/captain-resetti-pico-reset-button

    • @asagk
      @asagk 3 роки тому +1

      @@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.

  • @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.

  • @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

  • @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!

  • @MUHAMMADYAWARIFRAHEEM
    @MUHAMMADYAWARIFRAHEEM 3 роки тому

    Very informative videooo Sir

    • @RalphBacon
      @RalphBacon  3 роки тому +2

      Glad you like it, Muhammad!

  • @tubeDude48
    @tubeDude48 3 роки тому +1

    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 роки тому +1

      I thought a Kettle whistle.

  • @gedtoon6451
    @gedtoon6451 Рік тому

    I had difficulty with the question of whether Python is strongly or weakly typed. It is in fact strongly typed.

  • @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 роки тому +1

      @@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 Рік тому +1

      @@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.

  • @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.

  • @manuelr7121
    @manuelr7121 2 роки тому

    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  2 роки тому +1

      I'm glad this video was useful to you, but the bad news is that I'm not really a Python coder.