Hopefully this should be really simple, I need to use arduino to detect voltage output and respond to it by controlling the outputs. This will result in controlling 2 sets of relays. The problem being I have no idea how to do this... Haven't even figured out whare I would connet the leads to the board which are for detection... I know the rest of the setup before the arduino and after, but not how to set it up. Help! Thanks
Apart from an Arduino and two relays, what hardware have you been given for this experiment?
Some switches or what?
Can you describe the voltage you want to detect in more detail?
It's complicated. All I need to know is the Arduino side of it. I just need to know how to take a voltage input into the Arduino and control 1 to 2 outputs at 5v. So if the input hits 2.4v for example then the out is 5v. Drops to 2.2 for longer that 1.5 to 2 seconds then the out is off. If the input is 3.5v for more than 1 min in a period of 10 mins then the other output is powered for x mins.... i can explain the entire thing if needed but it's alot of typing
If it is a 5 volt Arduino, you can measure a voltage between 0 and 5 volts on an analog pin using analogRead(). This gives a range of 0 to 1023 so, for example an analog value of 512 indicates a voltage of 2.5
Then you need some of the following statements in your code:
pinMode()
if
else
digitalWrite()
millis()
I believe it is indeed. It's a standard not copy cat Arduino. In reality the 2.4v is 48v. But there's a resistor setup to drop the voltage. So it reads the voltage and activates outputs for an amount of time based on the time these voltages hold. If this is possible.
OK. It is possible. Begin by connecting your voltage source to an analog pin. Write a sketch which prints the value of analogRead() to the serial console. Expand your solution from there.
Good to know it's possible! The fact I know nothing about programming may make it hard though. Voltage hits 2.4... activate output until 1 second after the voltage drops below 2.2. Voltage hits 3.5 for more than 1 min in a period of 10 mins then activate second output for 30 mins but only once the voltage drops below 3v. It's complicated for a person who knows notta about programming. Not sure how you would do cumulative reading so if it's small spikes that add up to 1 min long in a 10 min period
Shadow_Storm56:
Not sure how you would do cumulative reading so if it's small spikes that add up to 1 min long in a 10 min period
It's getting more and more complicated.
What if after a few spikes you have a drop? How to account for that?
How long should a spike last to be recorded to begin with?
Etc. You have to answer all those questions or you'll be getting nowhere.
It's certainly doable - but does get pretty complex, fast, with this kind of requirements.
For starters you'll have to write down in detail every single condition you want to record, and exactly when/how you move to another condition. Without that, you're getting nowhere. Everything has to be clearly defined in numbers: no words as "small spike" but minimum time, minimum voltage for something to be a "small spike".
Another problem may be your voltage. You mention you're measuring 48V, and it's varying. There are spikes. What maximum voltage can you see? Any protection against overvoltage?
The ADC of the Arduino also needs time to react, so very short spikes you can't measure. If you have such spikes, better add a capacitor between ADC and GND to filter them out - gives also a bit of additional protection. For the same reason don't use a too big resistor on the high side - no more than 10k. Then add 500Ω between ADC and GND to bring down the 48V to about 2.4V.
For better accuracy: if 48V is the maximum you get, use 10k + 1k for your voltage divider so you get 4.4V on the ADC. Larger overall range gives better accuracy.
Is this a school exercise or is it a general project?
If it is a general project and you want to pay someone to do it for you, there is the Gigs and Collaborations section of this forum. Otherwise, make an attempt to do it yourself and, if you get into trouble, post the code here which you have written and ask for help.
Measuring voltages (0 to 5v) is no problem for a 5 volt Arduino, nor is switching a relay. Measuring the total length of time a voltage has crossed a threshold within a rolling time window makes the project interesting.
Edit: post crossed with wvmarle’s
It's a general project. Paying a person to make the program would be helpful.... I wonder how expensive it would be.
From what you've described, two programmers might create two differently behaving programs and yet they follow what you described. When the second output is activated, it stays on for 30 minutes. During that time, should the voltage be checked whether it goes over 3.5 V? Or is it irrelevant during the time output 2 is on? Something says me that if the voltage goes back to 3.6 V during the 30 minutes, you should not wait 10 minutes before activating the second output for another 30 minutes. I try to think like a programmer, whose task is to ask the right questions that only you know the answers to.
It will drop to 0v once output 2 is activated. Large contactor relays cross the phases of the turbines and thus act as a lock that keeps them going very slow. This is also why before activated output 2 I wanted the voltage to drop a bit so I don't kill my relay contacts.