Get Started in Electronics #6 - Motion-Activated Tilt Switch Uno Alarm!

Поділитися
Вставка
  • Опубліковано 2 жов 2024
  • Hello, 3D Printing friends! Today we're going to learn about an unusual little switch, and use it to build an anti-theft alarm with an Uno, writing code in the Arduino IDE!
    In this series, we're using the Elegoo Uno Super Starter Kit. Want to buy an Elegoo Uno Super Starter Kit for yourself? You can pick one up here:
    • amzn.to/2B92t4i 🇺🇲US [affiliate link]
    • amzn.to/2IR2n5n 🇨🇦Canada [affiliate link]
    LINKS:
    BV3D Arduino Prototyping Base
    • www.thingivers...
    Did this video help you out, save you a bunch of time, or help you learn something new?
    If so, please consider becoming a channel member, or buying me a coffee, or leaving a tip! Your support really helps, and is VERY MUCH APPRECIATED!
    ✅ BV3D Channel Membership: ua-cam.com/users/bv...
    ☕️ Buy Me a Coffee: www.buymeacoff...
    👍🏻 PayPal tip jar: www.paypal.me/...
    *️⃣ The BV3D Channel Storefront on Amazon:
    • www.amazon.com...
    *️⃣ Popular 3D printer affiliate links:
    • BIQU: shrsl.com/3s4hr
    • Creality: shrsl.com/3qu2u
    • Comgrow: bit.ly/33xcDtB [Check out the Creality REFURBS!]
    • Elegoo: shrsl.com/3pu98
    • FLSun: flsun3d.com/?r...
    • Pergear: bit.ly/BV3Dper...
    • Sovol: bit.ly/3h90d2L
    • Sunlu: bit.ly/3hGNzpQ
    • Voxelab: bit.ly/3vVG9Wq
    *️⃣ In the market for a magnetic flexible build system for your 3D printer?
    💥Wham Bam Systems flex plates: bit.ly/2YzogLZ
    As a Wham Bam Systems Associate I earn from qualifying purchases.
    *️⃣ Shop for just about anything:
    🛒🇺🇲US: amzn.to/2x4hBxS [affiliate link]
    🛒🇨🇦Canada: amzn.to/2Ycb5ju [affiliate link]
    As an Amazon Associate I earn from qualifying purchases.
    SOCIAL MEDIA
    Follow me on Twitter (@bryan_vines): / bryan_vines
    Disclosure:
    I sometimes receive compensation such as discounted or free products, and when applicable, this is disclosed in videos and their descriptions. Whether free, discounted, or paid full price, any reviewed product is tested to the best of my ability, and I give my honest impression. All opinions expressed are my own.
    #BV3D
    #BV3DChannel
    #3DPrintingFriends

КОМЕНТАРІ • 99

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

    Thank you......thank you for being here for me during COVID man, means a lot!

  • @mechamochi9627
    @mechamochi9627 2 роки тому +1

    I'm here a year late, but this guy is actually amazing. I've learned so much for this series, definitely think about subscribing and liking!

  • @petersolomon3505
    @petersolomon3505 4 роки тому +26

    Bryan I can’t thank you enough for these great videos, we got the kit for Christmas and now with this quarantine myself in my 10-year-old son are working through your great tutorials and learning how to code and work with arduino. Your videos are so clear and efficient they make following along and learning a real joy. In our book you arduino, are the weknow

    • @BV3D
      @BV3D  4 роки тому +2

      Thank you, Peter! 😊

  • @ehtshammalik
    @ehtshammalik 9 місяців тому

    These tutorials are so entertaining and it stops us from getting bored thank you for making these awesome tutorials for us!

  • @AndrewAHayes
    @AndrewAHayes 4 роки тому +11

    I am so glad I bought the Uno starter kit before all this COVID business kicked off, it has kept me occupied when I run out of household chores, and at the same time your Arduino series started, BONUS!

    • @BV3D
      @BV3D  4 роки тому +1

      Hi Andrew! I'm glad you got the kit too, and I'm glad you're having fun with it! 😉

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

    Hi Bryan,
    Great content, really enjoying it!
    I've been watching the guides up until this point, I didn't want to lose the functionality of power on/off:
    // Pin Variables
    // Making use of on/off monentary switches
    int buttonOnPin = 5;
    int buttonOffPin = 3;
    int buzzerPin = 9;
    int ledPin = 8;
    int tiltPin = 10;
    // String variables to hold power and tilt state
    String powerStatus = "OFF";
    String tiltStatus = "OFF";
    void setup()
    {
    pinMode(buttonOnPin, INPUT_PULLUP);
    pinMode(buttonOffPin, INPUT_PULLUP);
    pinMode(buzzerPin, OUTPUT);
    pinMode(ledPin, OUTPUT);
    pinMode(tiltPin, INPUT_PULLUP);
    // Start Buzzer and LED at off
    digitalWrite(buzzerPin, LOW);
    digitalWrite(ledPin, LOW);
    }
    void loop()
    {
    // put your main code here, to run repeatedly:
    //Setup Pins
    if (digitalRead(buttonOnPin) == LOW)
    {
    //Power On LED Lights Up
    powerStatus = "ON";
    digitalWrite(ledPin, HIGH);
    }
    while (powerStatus == "ON")
    {
    if (digitalRead(tiltPin) == LOW)
    {
    // Triggered when tilt twitch is upright (mine is on long cables so when held up triggers LED to flash and buzzer to beep intermittently)
    tiltStatus = "ON";
    }
    while(tiltStatus == "ON")
    {
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(50);
    digitalWrite(ledPin, LOW);
    digitalWrite(buzzerPin, LOW);
    delay(50);
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(50);
    digitalWrite(buzzerPin, LOW);
    digitalWrite(buzzerPin, LOW);
    delay(50);
    if (digitalRead(tiltPin) == HIGH)
    {
    tiltStatus = "OFF";
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, LOW);
    }
    }
    if (digitalRead(buttonOffPin) == LOW)
    {
    powerStatus = "OFF";
    digitalWrite(buzzerPin, LOW);
    digitalWrite(ledPin, LOW);
    }
    }
    }

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

    Thanks for this lesson. I really like learning how to use arduino from you.

  • @suziq4549
    @suziq4549 4 роки тому +8

    I am so happy I came across your video. I bought this starter kit 9 months ago for my 12 year old son but was unable to figure any of it out and so we pretty much gave up on it. Your tutorials made it easy to understand . We brought out the kit again and following your tutorial step by step. Thank you so much for these great videos! I hope to see more!!

    • @BV3D
      @BV3D  4 роки тому +1

      Thank you very much. I'm glad you and your son are having a good time with the kit now! 😀

  • @jamiemoles7275
    @jamiemoles7275 13 днів тому +1

    I need help trying to do a job for my company can you do one one with a relay switch vibration, switch, and alarm speaker so that when the vibration sensor triggers, it will activate the relay and set the alarm off

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

    11:58 his laugh cured my sadness.

  • @curtis8988
    @curtis8988 4 роки тому

    Another great video, Bryan. We enjoyed it.

  • @russellmartin7809
    @russellmartin7809 4 роки тому +6

    I really enjoy the time you put into these videos to make them more interesting than the basic lessons in the guide. Thank You

    • @BV3D
      @BV3D  4 роки тому +1

      Glad you like them! Thanks so much! 👍

  • @MrMeadowfresh
    @MrMeadowfresh 4 роки тому +3

    Recently had to use an Arduino for work and enjoyed it so much that I picked up the Eelegoo kit as it looked like a good starting point to learn all about them. I have been really enjoying working through your videos and I look forward to more! I don't really like or sub to videos on UA-cam but since yours have been very helpful I am making an exception!

  • @OldCurmudgeon3DP
    @OldCurmudgeon3DP 4 роки тому +1

    Another well-produced video. 👍

    • @BV3D
      @BV3D  4 роки тому

      Many thanks, Old Curmudgeon! 😀

  • @spencersamples619
    @spencersamples619 4 роки тому +5

    I just Finnished #5 yesterday, your videos have been incredibly helpful. You are a great teacher. Can we expect a monthly upload or maybe sooner?

    • @BV3D
      @BV3D  4 роки тому +4

      Hi Spencer! I'm glad you're enjoying the series. I try to release these once per month. Sometimes the schedule slips a little bit, but that's my target. 👍

    • @spencersamples619
      @spencersamples619 4 роки тому

      BV3D: Bryan Vines alright, thanks for making these, keep up the great work

    • @BV3D
      @BV3D  4 роки тому +1

      Sure thing. Thanks again!

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

    Similar tilt switches used to kill motorcycle electrical circuit in the event if crashing od dropping etc. Even wheelies sometimes trigger it

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

    Thanks I just startted getting into electronics and your videos helped me alot

  • @brentsmith-d8h
    @brentsmith-d8h 5 місяців тому

    I know irregardless isn't a word, but I say it irregardless.

  • @welbot
    @welbot 4 роки тому +2

    Hi tilt/ball switch! Nice to meet you! 😂

    • @BV3D
      @BV3D  4 роки тому +1

      Next time I might do something like, "And now, a component which needs no introduction..." and then go on to another topic. 😄
      Hope you and your dad are doing OK!

    • @welbot
      @welbot 4 роки тому +1

      @@BV3D 😂🤣 It wouldn't surprise me at all if you did something like that! Classic Bryan!
      And thanks, Dad is slowly improving. Still a few months to go before normality returns, but definitely improving bit by bit :) As for me, I'm just stuck in limbo until the hospitals return to some kind of 'normal' operational level. Apart from the recent re-dislocation of my hip, nothing getting too much worse at least

    • @BV3D
      @BV3D  4 роки тому +1

      I'm glad to hear it. I worry sometimes that your pieces are going to fall off and the mechanics won't be able to put them back on! 😁

    • @welbot
      @welbot 4 роки тому +1

      @@BV3D haha well my pieces do disconnect occasionally. Last week I dislocated my hip again. Thankfully they don't completely fall off though!

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

    Hi Anyone
    Why did setting my pins this way
    #define ledPin 8
    #define buzzerPin 9
    #define tiltPin 10
    yield the same result as using the INT function as presented in the tutorial as shown below?
    int ledPin = 8;
    int buzzerPin = 9;
    int tiltPin = 10;
    What is the difference and how do I know which way I should do it?

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

    I have typed this code exactly like you have.
    But when I try and verify it before uploading I get "tiltPin was not declared in this scope
    }
    ^
    Exit status, 1
    'tiltPin' was not declared in this scope
    (Maybe being 75 and just starting to learn doesn't help😀

  • @JR-je7ce
    @JR-je7ce 3 роки тому

    You need an affiliate link for the uk also I would happily buy things through it to support the channel

  • @philipanderson9434
    @philipanderson9434 4 роки тому +1

    Great videos , I be following you to the end of these tutorial,series. Thanks , super job 👍🏻.

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

    yay satisfaction after my debauckle with the irremote i needed a success and this was gratifying

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

    hello. it would have been desirable to put a small delay for the activation of the buzzer

  • @paulcumber4732
    @paulcumber4732 4 роки тому +1

    That is cool

    • @BV3D
      @BV3D  4 роки тому

      Hi Paul! Thanks! 😊

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

    nice tutorial,
    (your shirt xdd)

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

    im typing it in the exact way you are and its not working

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

    How can I make the buzzer beep instead of constantly hurting my ears? I tried combining the code from the previous lesson (high, delay > low, delay) but it doesn't work unless the tilt switch is constantly in the high position

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

      Ok so I just repeated the high state on the buzzer (so now it's like high, delay > low, delay > high, delay) and it's constantly going on and off, as wanted, but I don't get it. Coding is weird

  • @changofaceanimations5402
    @changofaceanimations5402 4 роки тому +1

    This is great stuff Bryan; I watch these videos every month!
    I have a question though, I noticed you may be using global variables. Are these variables only held within the namespace of the sketch where the setup and loop functions are? Shouldn't we avoid global variables, or does it not matter because the programs we are writing are so small?
    I love your shirt by the way!

    • @BV3D
      @BV3D  4 роки тому +1

      Hi, and thanks! Yes, the variable I'm declaring at the start of the sketch are global, so they're in scope for every function/method in the sketch. And yes, these are such little projects that this is fine. 😀

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

    Ok I recreated this video easily enough. Then I thought I'd add a button to the project to 'Turn Off' the alarm. And it works but I have to hold the button down. When I let go of the button then the alarm starts back up. Any recommendations? Pressing the reset button on the arduino will silence it so I googled resetting programatically but it doesn't work.

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

      Disregard this question. Five minutes after posting the question I found the answer. Just ran the button to the reset pin on the Arduino board. I should note that my tilt sensor had to be mounted to a breadboard because it has to remain upright otherwise it is switched on all the time.

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

    i love bryan vines all my homies love bryan vines

  • @spikekent
    @spikekent 4 роки тому +1

    Yet another, pun filled, highly entertaining video, thanks Bryan. Grand Theft Uno eh, I didn't see that coming. Priceless.

    • @BV3D
      @BV3D  4 роки тому +1

      Thanks Spike! Nobody sees it coming. That's why we need the Uno theft alarm! 😉

    • @spikekent
      @spikekent 4 роки тому +1

      @@BV3D Good point lol

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

    This one worked well. Thanks

  • @yerixfuentes3746
    @yerixfuentes3746 4 роки тому +1

    hey BV3D i need help when i put the code in it says error ; ')' at end of input exit status 1 expected ')' before '(' token what do i do and its o the line if (digitlaWrite

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

      double check the ( is always matched with a ) , the same goes for { and }, also check for spelling and capitals where they should be and at the end of most lines they should end with a semicolon ; (generally useful stuff)

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

    Do you have a t-shirt that says "Whether or not...You meant to say whether. Seriously, stop it."?
    I did a quick google search. Found your "Irregardless" t-shirt. Didn't find a "Whether or not" t-shirt. A million-dollar idea for you, and I'm only requiring 10% of profits with no liability.
    Don't say I never did anything for you. :-)

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

      you spelled it wrong is why google can not help you.

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

      @@midnightrizer Say "Hi" to the kmotr for me. Hope he enjoys my work as his publicity agent.

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

    You've put together something great here Bryan! I just started coding and robotics as a hobby, and I'd be lost without the humorous guidance you give via this channel. Thank you!!!

  • @UA-qj1oc
    @UA-qj1oc 3 роки тому

    Hey Bryan great videos man, I've been following along so far made a few amendements ie changing high and low for 1 and 0, using the void *func name* () { insert code} to tidy up the code a bit as I noticed in a video made by Education is life on embedded systems. Great teaching style, very engaging, well explained and timed great. Also love the dad jokes top notch stuff brother.

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

    Great series. Would like to see more like this, your videos are easy to understand and informative. I like that you explain stuff and don't just roll though the tutorial assuming everyone knows what you're saying.

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

    Hi! Love the content, I have learned a LOT from your videos! - Question, I have tried to run my arduino of the 9 volt battery included in the kit, but it doesn't seem like the arduino remembers the code. Do I have to do something different to run my arduino off external power?

  • @Ron_Ventura
    @Ron_Ventura 4 роки тому

    Love the t-shirt Bryan. Irregardless is one of my pet peeves, along with “we’re all in agreeance”. (Is that just an Australian thing?) where can I get one of those shirts. Oh yeah, love your videos too. Always informative and fun.

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

    Hi i have been following along and im learning a lot, however, i cannot seem to get this one to work. i keep getting a message 'tiltPin' was not declared in this scope.
    what could be wrong, i have checked grammar and capitalization 100 times

  • @Kidge.6081
    @Kidge.6081 3 роки тому

    On the sketch at 3:09, shouldn’t the resistor be upstream of the led? You wired it that way, I think 🤔

    • @Kidge.6081
      @Kidge.6081 3 роки тому

      Don’t we want the resistor before the led to protect it? On the power side?

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

      @@Kidge.6081 the way resistors function and based on electronic principles, it does not matter which side of the LED we place the resistor (I think); if you wanted to, you could place the resistor on the lengthier anode side of the LED and it would still work the same.

    • @Kidge.6081
      @Kidge.6081 2 роки тому

      @@moretao9837 well, it does seem to work.

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

    Hi thank you for the video

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

    Omg Bryan you are a life saver! I would have never survived all of the hard coding lessons but your simple code here saved me big time. Keep it up!

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

    I had a lot of fun making this and you’re a great teacher. Thanks for making this video, you’re waaaay better than those boring lessons that come with the kit and you make things easy to understand

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

    Fantastic work on these lessons, really appreciate the improvements you've made on the guide's basic module lessons, and I also appreciate not just having all the code written for me already!

  • @UViDSIRE
    @UViDSIRE 4 роки тому +1

    How can I PM you?

    • @BV3D
      @BV3D  4 роки тому

      You can send me a DM on Twitter @bryan_vines

    • @UViDSIRE
      @UViDSIRE 4 роки тому

      BV3D: Bryan Vines sound

  • @lizk6007
    @lizk6007 4 роки тому

    Thanks again for these videos! They're great as usual. I'm super new to electronics, so I end up pausing and rewinding a lot when you wire it up, but your clear camera shots and descriptions at each step make that easy to do. :) And I appreciate you customizing the Elegoo lessons, like adding the buzzer to this one - you're right that it makes it more fun to make a silly alarm rather than just a light.

  • @simonriley1530
    @simonriley1530 4 роки тому

    Tried this in tinkercad and it wouldn't work until I changed the if statement digitalRead to low.

  • @brembojoe
    @brembojoe 4 роки тому +1

    Irregardless is not without regard. Lol 😆 great vid

    • @BV3D
      @BV3D  4 роки тому

      Truth! (And thank you!) 😀

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

    hi love your Arduino videos they are really helpful to my startup coding

  • @tadas3891
    @tadas3891 4 місяці тому +1

    Thanks!

    • @BV3D
      @BV3D  4 місяці тому

      Thank YOU! 😀

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

    Bryan is there a link for your T-shirts - like the one you're wearing?

  • @zachary9738
    @zachary9738 4 роки тому

    I added a reset switch by adding a button with
    if (digitalRead(resetButton) == LOW) {
    digitalWrite(ledPin, LOW);
    digitalWrite(buzzerPin, HIGH);
    }

  • @TD3DMakes
    @TD3DMakes 4 роки тому +1

    Great stuff, thanks for sharing Bryan!

    • @BV3D
      @BV3D  4 роки тому

      Thanks for watching, Thierry! I appreciate it! 👍

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

    HE FORGOT THE LED

  • @quocanalexdjentertaiment99996

    Thanks you

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

    I love this so much😁 thank you

  • @jamiem5736
    @jamiem5736 4 роки тому

    Another great video! Thanks man

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

    cool

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

    thanks for spicing up the lessons

  • @alessandroc1456
    @alessandroc1456 4 роки тому

    Can't wait for the next episode in this series! :)

  • @MrFramitz
    @MrFramitz 4 роки тому +1

    Electronics starts with the basics.

    • @BV3D
      @BV3D  4 роки тому

      Yep! We're just about to the end of the simple input & output devices, so things should get a little more interesting in the next few installments in the series. 👍

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

    youre a great teacher thank you very much

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

    Love it thank you so much

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

    Great little example! 🤗

  • @randomdud581
    @randomdud581 2 роки тому +1

    irregardless lol