Go Down

Topic: Wrong readings in digital inputs caused by electrical noise (Read 373 times) previous topic - next topic

wanderjose

Hello everyone,

I'm doing a project, which is to use an arduino to read a relay, which indicates several states of the elevator (firefighting mode, going up, down) and the floor where the elevator is located.

The relays are located on boards that are extensions of the elevator, the work of the arduino is only to read the relays, to know when they are open or closed.

I am having problems making these measurements, mainly in relays that indicate the floor number, the arduino makes correct readings, but very often it is interrupted by erroneous readings and thus alternating between correct and erroneous readings, which I think are caused by electric noise

Could you recommend any solution?

Is it recommended that all the digital pins that you are not going to use, initialize them in LOW?

Should I only use capacitors on each pin that goes to a relay?

I am using an Arduino Mega 2560, attached to the other board where all the relays are and I will specify the connection that I have,

I must also clarify that the tests must be done where there is an elevator, so I can not do the tests in my office with more tranquility, I appreciate in advance the help they provide me,

Thank you so much!.

jremington

Use optocouplers between the relay board and the Arduino, to electrically isolate the two circuits, and use a grounded shield around the Arduino wiring and circuitry.

Sunnytec

How are the 'S' outputs connected to the Arduino pins?
Do you have pull-downs?

wanderjose

I connected them with a 10-centimeter cable that I got by disarming a UTP cable.

I have not used Pulldown Resistors between the relays and the arduino pins, I'm going to try.

I was reading that the arduino has Pulldown integrated in each pin. Is this true?

Delta_G

I was reading that the arduino has Pulldown integrated in each pin. Is this true?
Which Arduino.  For most this is not true.  The AVR ones have built in pull-up resistors but not pull-down. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Sunnytec

Arduino MEGA has internal pull-ups.
Try using them:
  • Change the connection: in the picture you showed the COMMON connected to 5V. Change it to GND.
  • Change the software: when you declare the inputs, use this:
Code: [Select]
pinMode(..., INPUT_PULLUP);


    Now the pin should read 'LOW' when the relay's output is connected, and it should not oscilate.
    Tell us what you get.

    Unsigned_Arduino

      I just use 10K pulldown resistors and not changing the code. It makes more sense to me.
    Do not touch the String class.

    Ever.

    Delta_G

    I just use 10K pulldown resistors and not changing the code. It makes more sense to me.
    Spending extra money makes more sense? 

    If you mean HIGH meaning "pressed" or "on" makes more sense then you need to disabuse yourself of that notion soon.  It's not how 90% of things work.  Learning things backwards like that will hurt you in the future. 
    || | ||| | || | ||  ~Woodstock

    Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

    MarkT

    Try adding about 1nF to 10nF capacitance to ground on the pins, this should stop almost any
    noise, at the expense of slightly delaying the response (by microseconds, which is not as
    issue for mechanical relays!).
    [ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

    wanderjose

    The problem was solved using a snubber, (capacitor and resistance) at the output of the relay

    MarkT

    Hello everyone,

    I'm doing a project, which is to use an arduino to read a relay, which indicates several states of the elevator (firefighting mode, going up, down) and the floor where the elevator is located.
    Interfering/altering with a safety critical system like an elevator is strictly a no-no.  Or is this not a
    human rated elevator?

    To quote the ATmega's manufacturer's conditions:

    Quote
    8. SAFETY-CRITICAL, MILITARY AND AUTOMOTIVE APPLICATIONS
    (a) Products are not designed for and will not be used in connection with any applications where the failure of such Products would reasonably be expected to result in significant personal injury or death ("Safety-Critical Applications") without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Buyer will fully defend (at Atmel's option), indemnify and hold Atmel harmless from and against any cost, loss, liability, or expense arising out of or related to use of Products in Safety-Critical Applications.
    (b) Products are neither designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Buyer acknowledges that any such use of Products not designated as military-grade is solely at Buyer's risk, and that Buyer is solely responsible for compliance with all legal and regulatory requirements in connection with such use.
    (c) Products are neither designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade. Buyer acknowledges that any such use of Products not designated as automotive-grade is solely at Buyer's risk, and that Buyer is solely responsible for compliance with all requirements in connection with such use.
    [ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

    hammy

    Agree, you can't mess with an elevator carrying people . The only way forward there,  is to get the lift supplier to supply you the signals ( doubt they would tho ).
    As a general point ....
    Opto isolation is really the only way to go if you have long lead lengths , probably with screen cable . That way you can also isolate your connections .
      Internal
    Pull up/down resistors have too high a value to be of any use except on a desk top project. Even with an opto , use something like 10k as the input resistor to the processor .

    Go Up