I have a circuit that controls a relay. Its always closed but periodically, the relay will open and then close again. I can't change anything on that existing circuit, so all I can use it that relay. Nothing else is plugged into the load side of the relay
It’s a little unclear, are you controlling the relay with the Arduino?
If not, is there an unused set of contacts on the relay ? if yes, that could ‘replace’ a switch..
or
If the contacts are already in use, we need more information about what’s being switched, and what’s controlling the relay.
It’s possible to ‘test’ the coil voltage to determine if the relay is energised or not... tell us more. Maybe a block/circuit diagram..?
No the arduino is not controlling the relay. The relay is part of a turnstile system. All I want is detect when someone goes through the turnstile. When the turnstile is turned on, the relay closes. When someone walks through the turnstile the relay opens and then closes again.
There are 2 wires at the moment that go to the old system that monitors the turnstile but the wires will be disconnected so I can connect the arduino to the relay.
Not sure about the coil voltage. would that be important even though the arduino would never get in contact with the coil voltage?
The current system simply sends a 24V signal which drops to about 21V I guess because of the length of wire. The current system monitors about 30 turnsiles. I was thinking to place 1 arduino per block of turnstiles which is between 5 or 6 right next to each other. That way I wouldn't need to worry about the voltage drop
You’ve done well, so it looks like the contacts are clear - they were used previously by the ‘old’ controller, being replaced by the Arduino.
You’re good to go - using the contacts in place of a switch, because no external voltage will be applied to the Arduino.
Use INPUT_PULLUP, switch to 0V, and make sure to debounce the contacts to avoid mis-triggering / counting.
Give it your best shot - maybe use a simple switch on the workbench to test your ideas, then you can move across to the turnstile when it works!
If possible, try not to use delay() for your timing...meet used to millis()
Thanks for the suggestion. I have not a lot of experience with arduinos or electonics. I nerver even heard of opto-isolators. So if the relay will work I would prefer going down that route.
For all ATmegaxx8 and I imagine all ATmegaUxx processors, yes, including most "analog" pins which are in fact, digital pins with additional analog reading functionality.
No conduit at all. At the moment there is one central system that connects to all turnstiles. I am trying to replace the system with 7 arduinos. They will be located directly at the turnstiles and each will monitor between 3 and 6 turnstiles. I am going to use uno's with ethernet shield. The arduino will then send a http request to a server ( in the same building ) every time the turnstile has been activated by simply submitting the turnstile ID. That ID will then be stored in a database along with date and time so that that we can display total numbers and also flowrates.
hope that makes sense.
The Turnstiles are in a football ( or soccer depending on where you life ) stadium. There are 7 groups of turnstiles ( 30 turnstiles in total ). Its not a massive stadium, about 15000 seats in total. The arduinos are replacing an old broken system.
Plan is to store all turnstile movements in a mysql database and then we will have a number of different screens that show different stats.
Yes at the moment there is a central place where they meet. But the stadium is big and you get voltage drops. So I am going to place an arduino on each group of turnstiles ( anywhere between 3 and 6 turnstiles.
The relay is already there, there is power and ethernet ports. So I thought best to have each group of turnstiles watched by a different arduino. If something goes wrong with the arduino, at least the other groups are still working. Also I would think that 30 turnstiles for 1 arduino would be too much. Each time a turnstile is turned, a signal needs to be sent and stored in a db. But I would think 3-6 are manageable.
I created a test setup and got the code ready for checking to see if the relay is open or closed. Just need to add the http request bit now.
the OP said there are Eithernet ports at the turnstile.
that would indicate to me the installation is less than 30 years old and since there was some form of monitor, I would venture to guess that the original installation had offered a count of attendees.
also, if you have eithernet, it does not make sense to run wires from individual turnstiles back to a central monitor, but just send the data in serial.
it would be interesting to see photos of a turnstile, but the the eithernet is there, using that does seem like the easiest way.