Hope this is the right area for this. I have an APP which is controlling my Mega. The APP is controlling A0 to A8. The output on those pins are at 0v until an activity takes place within the APP and at which time a 5v pulse will appear on the selected pin. I have a 5v Opto latching relay attached to the pin and it works well. The opto on the relay module sees the HIGH level and the relay latches. Here is my issue. In the APP when a certain activity takes place it will set a different output pin to the HIGH value for a short amount of time. I need to use that to unlatch the relay. This means the input to the OPTO o the relay needs to be connected to both pins and that will connect two output pins together. Everything I read is I do not want to do that as it will damage the MEGA. Could the solution be as simple as using some diodes on those output pins? Thanks for any inputs.
Hello al-al-al
We need some additional information.
Post your sketch, well formated, with well-tempered comments and in so called
code tags "< code >" and a detailed circuit diagram to see how we can help.
Have a nice day and enjoy coding in C++.
Are you saying that the relay latches when it receives a pulse, and that the pulses cycle it sequentially (in other words, first pulse turns relay ON, next OFF, then ON, OFF, ON, OFF, for each additional pulse)? Or does the relay have separate inputs for the ON and OFF pulses?
(better yet, can you post a link to the actual relay module)
No code used! The APP is telling the Mega what to set on the pins.
Here is the relay I am using. It is set for a HIGH as that is what the APP is providing on the output pins of the MEGA. I need to use two different output pins. One will latch the relay when a HIGH is received from the first pin and the relay will unlatch when a HIGH is received from the second pin. There is only ONE input pin to the relay which is connected to an OPTO. https://www.amazon.com/dp/B07DSZFLMQ?ref=ppx_yo2ov_dt_b_product_details&th=1
That is not a latching relay, what type of "pulse" do you get from the arduino? That relay should require a constant HIGH to remain activated.
< edit > There is code running on the Mega, otherwise the APP would not be able to do anything through the Mega. Where did you find the code?
Must have sent you the wrong info. The relay is for sure a latching relay. Sorry. Code came from a friend of mine. I do not know that much regarding coding etc so I may have been wrong in saying the APP controls the Mega. All I can tell you is when an activity occurs on the APPS UI a certain output pin on the Mega goes from low to high and latches the relay. The output of that pin returns to a low.
Wiring diagram aka schematic please...
I do not have a schematic and not sure how to put one together and display it here. As I mentioned in my first post this is my concern.
Two output pins on the MEGA are feeding one input to an opto isolator on the relay board. As I have read many places the MEGA can be damaged if one output of the MEGA goes high and the other Pin goes LOW keeping in mind that those two pins are wired together. I am thinking that using diodes on the output pins of the MEGA to form an OR circuit will prevent the short. Thank you.
An OR arrangement would turn the relay ON if either or both of the outputs from the Mega were HIGH - the relay would only turn OFF if both outputs were LOW.
Can't think of any simple way for diodes to work. Even if you can arrange an external circuit so that having a HIGH on the 2nd output pin turns the relay OFF, the 1st output pin would not be able to control the relay until the 2nd output pin was set back to LOW.
What you really need is to modify either the APP or the code running on the Mega.
Ah, well then I should have directed you to the reference threads at the top of the forum, which you were offered a link to when you created an account. If you look there, you will find instructions and tips for making and posting schematics.
Also, a very good explanation of why they are necessary.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.