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
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
4 жыл бұрын
Thank you, Peter! 😊
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
4 жыл бұрын
Hi Andrew! I'm glad you got the kit too, and I'm glad you're having fun with it! 😉
Thank you......thank you for being here for me during COVID man, means a lot!
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
4 жыл бұрын
Thank you very much. I'm glad you and your son are having a good time with the kit now! 😀
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!
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
4 жыл бұрын
Glad you like them! Thanks so much! 👍
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!
Great videos , I be following you to the end of these tutorial,series. Thanks , super job 👍🏻.
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!
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!!!
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.
Thanks I just startted getting into electronics and your videos helped me alot
These tutorials are so entertaining and it stops us from getting bored thank you for making these awesome tutorials for us!
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
Can't wait for the next episode in this series! :)
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!
Thanks for this lesson. I really like learning how to use arduino from you.
Another great video, Bryan. We enjoyed it.
thanks for spicing up the lessons
hi love your Arduino videos they are really helpful to my startup coding
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.
I love this so much😁 thank you
Great little example! 🤗
This one worked well. Thanks
Another great video! Thanks man
youre a great teacher thank you very much
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); } } }
yay satisfaction after my debauckle with the irremote i needed a success and this was gratifying
Great stuff, thanks for sharing Bryan!
@BV3D
4 жыл бұрын
Thanks for watching, Thierry! I appreciate it! 👍
Love it thank you so much
Hi thank you for the video
Another well-produced video. 👍
@BV3D
4 жыл бұрын
Many thanks, Old Curmudgeon! 😀
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.
Thanks!
@BV3D
Ай бұрын
Thank YOU! 😀
Yet another, pun filled, highly entertaining video, thanks Bryan. Grand Theft Uno eh, I didn't see that coming. Priceless.
@BV3D
4 жыл бұрын
Thanks Spike! Nobody sees it coming. That's why we need the Uno theft alarm! 😉
@spikekent
4 жыл бұрын
@@BV3D Good point lol
Thanks you
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.
Similar tilt switches used to kill motorcycle electrical circuit in the event if crashing od dropping etc. Even wheelies sometimes trigger it
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
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
4 жыл бұрын
BV3D: Bryan Vines alright, thanks for making these, keep up the great work
@BV3D
4 жыл бұрын
Sure thing. Thanks again!
Irregardless is not without regard. Lol 😆 great vid
@BV3D
4 жыл бұрын
Truth! (And thank you!) 😀
11:58 his laugh cured my sadness.
That is cool
@BV3D
4 жыл бұрын
Hi Paul! Thanks! 😊
Electronics starts with the basics.
@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. 👍
You need an affiliate link for the uk also I would happily buy things through it to support the channel
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?
cool
i love bryan vines all my homies love bryan vines
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
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. 😀
Bryan is there a link for your T-shirts - like the one you're wearing?
nice tutorial, (your shirt xdd)
hello. it would have been desirable to put a small delay for the activation of the buzzer
Hi tilt/ball switch! Nice to meet you! 😂
@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
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
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
4 жыл бұрын
@@BV3D haha well my pieces do disconnect occasionally. Last week I dislocated my hip again. Thankfully they don't completely fall off though!
I know irregardless isn't a word, but I say it irregardless.
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
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
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)
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
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
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😀
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
Жыл бұрын
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.
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?
Tried this in tinkercad and it wouldn't work until I changed the if statement digitalRead to low.
I added a reset switch by adding a button with if (digitalRead(resetButton) == LOW) { digitalWrite(ledPin, LOW); digitalWrite(buzzerPin, HIGH); }
@awesomename2766
3 жыл бұрын
same here!
On the sketch at 3:09, shouldn’t the resistor be upstream of the led? You wired it that way, I think 🤔
@josephr.6081
3 жыл бұрын
Don’t we want the resistor before the led to protect it? On the power side?
@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
2 жыл бұрын
@@moretao9837 well, it does seem to work.
How can I PM you?
@BV3D
3 жыл бұрын
You can send me a DM on Twitter @bryan_vines
@UViDSIRE
3 жыл бұрын
BV3D: Bryan Vines sound
im typing it in the exact way you are and its not working
irregardless lol
HE FORGOT THE LED
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
2 жыл бұрын
you spelled it wrong is why google can not help you.
@jeffbowyer4576
2 жыл бұрын
@@midnightrizer Say "Hi" to the kmotr for me. Hope he enjoys my work as his publicity agent.