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

Ғылым және технология

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.thingiverse.com/thing:393...
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: kzread.infojoin
☕️ Buy Me a Coffee: www.buymeacoffee.com/5lKshEVvL
👍🏻 PayPal tip jar: www.paypal.me/bv3d
*️⃣ The BV3D Channel Storefront on Amazon:
• www.amazon.com/shop/bv3dbryan...
*️⃣ 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/?ref=ifo73zup-gb
• Pergear: bit.ly/BV3Dpergear
• 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

Пікірлер: 98

  • @petersolomon3505
    @petersolomon35054 жыл бұрын

    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 жыл бұрын

    Thank you, Peter! 😊

  • @AndrewAHayes
    @AndrewAHayes4 жыл бұрын

    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 жыл бұрын

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

  • @nbdcbn
    @nbdcbn3 жыл бұрын

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

  • @suziq4549
    @suziq45494 жыл бұрын

    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 жыл бұрын

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

  • @mechamochi9627
    @mechamochi96272 жыл бұрын

    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!

  • @russellmartin7809
    @russellmartin78094 жыл бұрын

    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 жыл бұрын

    Glad you like them! Thanks so much! 👍

  • @MrMeadowfresh
    @MrMeadowfresh4 жыл бұрын

    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 KZread but since yours have been very helpful I am making an exception!

  • @philipanderson9434
    @philipanderson94343 жыл бұрын

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

  • @fennecbesixdouze1794
    @fennecbesixdouze17943 жыл бұрын

    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!

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

  • @lizk6007
    @lizk60074 жыл бұрын

    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.

  • @jjonno
    @jjonno3 жыл бұрын

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

  • @ehtshammalik
    @ehtshammalik6 ай бұрын

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

  • @Drpepperspray1010
    @Drpepperspray1010 Жыл бұрын

    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

  • @alessandroc1456
    @alessandroc14564 жыл бұрын

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

  • @declanoflynn1055
    @declanoflynn10553 жыл бұрын

    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!

  • @SethTaylor_Provo
    @SethTaylor_Provo3 жыл бұрын

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

  • @curtis8988
    @curtis89884 жыл бұрын

    Another great video, Bryan. We enjoyed it.

  • @Raven_of_Doom
    @Raven_of_Doom3 жыл бұрын

    thanks for spicing up the lessons

  • @Theuniquegirl2024
    @Theuniquegirl20243 жыл бұрын

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

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

  • @sarahmooney5901
    @sarahmooney59013 жыл бұрын

    I love this so much😁 thank you

  • @himbary
    @himbary3 жыл бұрын

    Great little example! 🤗

  • @wherami
    @wherami2 жыл бұрын

    This one worked well. Thanks

  • @jamiem5736
    @jamiem57364 жыл бұрын

    Another great video! Thanks man

  • @WhiteNucklin
    @WhiteNucklin3 жыл бұрын

    youre a great teacher thank you very much

  • @grrrmuffman
    @grrrmuffman3 жыл бұрын

    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); } } }

  • @TheByers1
    @TheByers12 жыл бұрын

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

  • @TD3DMakes
    @TD3DMakes4 жыл бұрын

    Great stuff, thanks for sharing Bryan!

  • @BV3D

    @BV3D

    4 жыл бұрын

    Thanks for watching, Thierry! I appreciate it! 👍

  • @MrKobyp7
    @MrKobyp73 жыл бұрын

    Love it thank you so much

  • @yfchannel2884
    @yfchannel28842 жыл бұрын

    Hi thank you for the video

  • @OldCurmudgeon3DP
    @OldCurmudgeon3DP4 жыл бұрын

    Another well-produced video. 👍

  • @BV3D

    @BV3D

    4 жыл бұрын

    Many thanks, Old Curmudgeon! 😀

  • @UA-qj1oc
    @UA-qj1oc3 жыл бұрын

    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.

  • @tadas3891
    @tadas3891Ай бұрын

    Thanks!

  • @BV3D

    @BV3D

    Ай бұрын

    Thank YOU! 😀

  • @spikekent
    @spikekent4 жыл бұрын

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

  • @BV3D

    @BV3D

    4 жыл бұрын

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

  • @spikekent

    @spikekent

    4 жыл бұрын

    @@BV3D Good point lol

  • @quocanalexdjentertaiment99996
    @quocanalexdjentertaiment99996 Жыл бұрын

    Thanks you

  • @Ron_Ventura
    @Ron_Ventura4 жыл бұрын

    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.

  • @tonycstech
    @tonycstech Жыл бұрын

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

  • @spencersamples619
    @spencersamples6194 жыл бұрын

    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 жыл бұрын

    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 жыл бұрын

    Sure thing. Thanks again!

  • @brembojoe
    @brembojoe4 жыл бұрын

    Irregardless is not without regard. Lol 😆 great vid

  • @BV3D

    @BV3D

    4 жыл бұрын

    Truth! (And thank you!) 😀

  • @manuelboada8470
    @manuelboada84703 жыл бұрын

    11:58 his laugh cured my sadness.

  • @paulcumber4732
    @paulcumber47324 жыл бұрын

    That is cool

  • @BV3D

    @BV3D

    4 жыл бұрын

    Hi Paul! Thanks! 😊

  • @MrFramitz
    @MrFramitz4 жыл бұрын

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

  • @JR-je7ce
    @JR-je7ce3 жыл бұрын

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

  • @TheDogMaster
    @TheDogMaster3 жыл бұрын

    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?

  • @hail2287
    @hail22873 жыл бұрын

    cool

  • @zeoberlerb6371
    @zeoberlerb6371 Жыл бұрын

    i love bryan vines all my homies love bryan vines

  • @changofaceanimations5402
    @changofaceanimations54024 жыл бұрын

    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 жыл бұрын

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

  • @tbrandx2
    @tbrandx23 жыл бұрын

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

  • @thanushmanchikanti8911
    @thanushmanchikanti891110 ай бұрын

    nice tutorial, (your shirt xdd)

  • @technophile01
    @technophile01 Жыл бұрын

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

  • @welbot
    @welbot4 жыл бұрын

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

  • @BV3D

    @BV3D

    4 жыл бұрын

    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 жыл бұрын

    @@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 жыл бұрын

    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 жыл бұрын

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

  • @user-ld7vk9bj6m
    @user-ld7vk9bj6m2 ай бұрын

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

  • @ChangedWayz
    @ChangedWayz3 жыл бұрын

    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

  • @yerixfuentes3746
    @yerixfuentes37464 жыл бұрын

    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

  • @grrrmuffman

    @grrrmuffman

    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)

  • @carlosflorentino8874
    @carlosflorentino88743 жыл бұрын

    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 жыл бұрын

    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

  • @denny9466
    @denny94662 жыл бұрын

    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😀

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

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

  • @simonriley1530
    @simonriley15303 жыл бұрын

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

  • @zachary9738
    @zachary97384 жыл бұрын

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

  • @awesomename2766

    @awesomename2766

    3 жыл бұрын

    same here!

  • @josephr.6081
    @josephr.60813 жыл бұрын

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

  • @josephr.6081

    @josephr.6081

    3 жыл бұрын

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

  • @moretao9837

    @moretao9837

    2 жыл бұрын

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

  • @josephr.6081

    @josephr.6081

    2 жыл бұрын

    @@moretao9837 well, it does seem to work.

  • @UViDSIRE
    @UViDSIRE3 жыл бұрын

    How can I PM you?

  • @BV3D

    @BV3D

    3 жыл бұрын

    You can send me a DM on Twitter @bryan_vines

  • @UViDSIRE

    @UViDSIRE

    3 жыл бұрын

    BV3D: Bryan Vines sound

  • @johno8253
    @johno82539 ай бұрын

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

  • @randomdud581
    @randomdud5812 жыл бұрын

    irregardless lol

  • @noobguitar4252
    @noobguitar42523 жыл бұрын

    HE FORGOT THE LED

  • @jeffbowyer4576
    @jeffbowyer45763 жыл бұрын

    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.

Келесі