I'm trying to use an Arduino to simplify the circuit I created with 2 relays and a 555 timer but I don't know a thing about programing. What I need is for the Arduino to create a short, currently using a relay, to close a circuit after getting an input voltage 5 or 12 volts, depends on the platform I attach my circuit to, for about 45 seconds then open the short. I would also like an LED to be on when the timer and short is not going. I know its probably super simple but again I don't know programming at all and looking to slim down my current massive build with an Arduino Micro, currently have a UNO to do my first tests with.
Use the forum Google search function in the upper right of this page to search for the key words of your project. You will probably find many similar previous project discussions and code to get you started.
Snieprp:
input voltage 5 or 12 volts
First is to make sure you condition that 12V down to 5V, I'd say.
Snieprp:
What I need is for the Arduino to create a short, currently using a relay
I think you'll still need a relay (or a transistor) to close the circuit: the Arduino would simply control that.
Have a look at the state change detect tutorial to see how to monitor an input for changes. When it does, capture the startTime with millis() and set the output with digitalWrite() to activate the relay/transistor.
Then monitor the ever-increasing-millis(), comparing it to startTime. If 45s has elapsed, open the relay/transistor.
My "problem" is I'm topping of a robotic system i really cant dive into to much. On some of the older systems I have a way of pulling 5V otherwise I'm stuck with 12V unless I use a voltage regulator to bring it down. This voltage is just what i would be using to signal the Arduino not power it. Powering I can use a small battery pack so that wont be an issue.
As for using a Relay or Transistor I was really hoping to do everything internal with the Arduino for as few failure points as possible. My current setup uses two relays, a 555 timer, and the needed resisters and caps. But for what I'll be using it for, and other who are not a savvy with electronics that I am, I need something a bit less prone to possible failure and robust. If absolutely needed I could use a single relay or transistor, just trying to minimize things.
As for the tutorial you pointed out I will definitely give it a look over, thank you.
Snieprp:
I'm stuck with 12V unless I use a voltage regulator to bring it down. This voltage is just what i would be using to signal the Arduino not power it.
In fact 12V would be ok for power, it's the signal that's the problem. A voltage divider would work.
Snieprp:
I was really hoping to do everything internal with the Arduino
I'm no expert but I'm pretty sure this has been asked before, the Arduino can't act as a switch as such, as opposed to controlling a switch. Await further replies....
Can you give us a schematic of your circuit? It would help to know what you are doing exactly.
Here is the circuit I made, In this drawing I did change the first relay in the system to a transistor as that is what i was playing around with before i thought of using the arduino to do this.
With some help from a buddy we were able to get the code working. However, I’ve now run into a weird issue. I’m using A0 to read the voltage and if above 2.5V then send the high command to one of the digital pins but whenever I connect a wire into A0, or any of the analog pins for that matter, the voltage jumps up and skips around 2.5-5V. Even just a jumper wire not connected to anything will have the voltage exceed the 2.5V thread hold I’ve set. I’m completely puzzled at this point, BTW using an Arduino Uno for now before moving to the micro.
Adding to previous reply, it's called floating input; you can google it
So I put a 10K resister from A1 to ground and the voltage reading is around 0V, thank you. However, now when I send the 5V to pin A1 it’s not reading it. I hook up a multimeter and see 5V is being applied to the pin but nothing is happening.
Snieprp:
So I put a 10K resister from A1 to ground and the voltage reading is around 0V, thank you. However, now when I send the 5V to pin A1 it’s not reading it. I hook up a multimeter and see 5V is being applied to the pin but nothing is happening.
I don't see any code, so have you tried testing your setup just using the basic analog example code? Using the serial plotter instead of the serial monitor may give a better look at what is going on.
Well I’m an idiot, it wasn’t a coding issue but a wiring issue. I never connected the ground from the board back to my “signal” voltage. So yes in the multimeter I saw 5V since that was on the ground but since from the board to the battery there wasn’t a ground it wouldn’t complete the circuit. I did it and now it’s running perfectly