I've made a defusable bomb prop (with my Arduino UNO) for playing airsoft, but I've come across something I think is a bug. Sometimes (not so often) when I'm holding down the red button that is supposed to arm the bomb and begin the timer, the Arduino just counts wrong for how long I've held the button (see the attached picture "Problem counting.png" for an overview over the serial monitor). After holding the red button for 5 seconds, it's supposed to arm the bomb. However, when this bug appears, it arms the bomb a completely random time after I've held the button for 5 seconds. This is very bad when it comes to what this is going to be used for; a competetive game that is all about how much time you have. Sometimes it takes 5 seconds to defuse/disarm the bomb, but sometimes it takes 10 seconds, which is very unfair for the different players/teams.
I have no idea where this problem is located, so I'll just attach all of my code and a picture on the circuit ("airsoftBomb3.4.ino" and "Circuit.png").
Contents:
Arduino Uno, Real Time Clock (DS3231), red push button, blue push button, buzzer (I think it is electromechanical, since it can't create any tones), red LED (I call it "timerLED" in the code), RGB LED (I call it "statusLED" in the code).
I would also appreciate whatever feedback you can come up with and how I can make my project better.
Remember that I am kind of new when it comes to programming and using Arduino, so you might need to be more clear than usual when telling me something.
Please read the post at the start of any forum , entitled "How to use this Forum".
OR http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
TomGeorge:
Please read the post at the start of any forum , entitled "How to use this Forum".
OR http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Hi Tom, and thank you for taking your time!
I read that posts before posting, but couldn't make it happen because I had way too much text/code.
TomGeorge:
Instead of using Vin to supply the components on the protoboard, use 5V.
Do you have a DMM?
Sure thing, I'll change it to 5V! But I'm just curious, what's the reason to do this?
Also, I think I have a DMM laying around somewhere, so I'll seek for it soon!
Vin is connected to the DC socket on the UNO, it only has any power on it when you use the DC socket, this has to be 7V to 12V as it feeds the onboard 5V and 3v3 regulators.
As you are using the USB to power the project, Vin will have some stray voltage lower than 5V, so will not be supplying 5V to the protoboard.
Basically Vin pin is a Power Input pin.
TomGeorge:
As you are using the USB to power the project, Vin will have some stray voltage lower than 5V, so will not be supplying 5V to the protoboard.
Oh, sorry for the confusion with the picture. I'm using the DC socket and a 9V battery to power my project. So if I'm understanding this right, I can still use Vin?
arduotto:
Oh, sorry for the confusion with the picture. I'm using the DC socket and a 9V battery to power my project. So if I'm understanding this right, I can still use Vin?
No No. No!!! The Vin pin is connected almost directly to the 9V of your battery. There is actually a forward biased diode between the two so it will measure something between 8.4V and 8.6V which is too high to apply to arduino inputs or the RTC module. As Tom said use the +5V pin not the Vin pin.
IanCrowe:
No No. No!!! The Vin pin is connected almost directly to the 9V of your battery. There is actually a forward biased diode between the two so it will measure something between 8.4V and 8.6V which is too high to apply to arduino inputs or the RTC module. As Tom said use the +5V pin not the Vin pin.
The more you know! Once again, thank all of you for taking your time to give a newbie all of this great feedback!
arduotto:
Oh, sorry for the confusion with the picture. I'm using the DC socket and a 9V battery to power my project. So if I'm understanding this right, I can still use Vin?
Good reason for a hand drawn picture of a project with all the components and labels rather than stick with the unlabeled and inadequate fritzy picture.
Has moving to 5V pin made any difference?
Tom....