relay testing circuit

late_voyager

New Member
Hi. Im trying to test 24v automotive relays..
I have picaxe 20m2 output to bcx 38. (not sure if symbol on drawing correct).
this then activates 24v coil on relay 1, 24v is then switched to activate 24v coil on the test relay.
each normal open/nomal closed then feeds 24v to relay S1 and S2 which switches a 3v input to picaxe 20m2
i have flyback diodes on each relay... is this correct or better way to do etc
relays S1 and S2 are used as im testing other switches and 24v sensors.
Ive not shown 3v for picaxe etc
is protection ok is circuit ok?
 

Attachments

AllyCat

Senior Member
Hi,

Nice to see a safety fuse in the diagram, but for what are you actually trying to Test or Reject ? A simple Go / No-Go check would seem to need no more than a push button and a couple of LEDs.

The additional 3 relays seem unnecessary and would mask any capability to make more exotic measurements, such as Operating Time (delay timer), Just-Operate / Release voltages (via PICaxe PWM output) or contact resistance (ADC input), etc..

The Darlington transistor appears to be wired "upside down" (NPN collectors to negative supply), may need a resistor in series with its input (base) and D18 seems unnecessary.

Cheers, Alan.
 
Last edited:

late_voyager

New Member
Hi Alan,
Hi,

Nice to see a safety fuse in the diagram, but for what are you actually trying to Test or Reject ? A simple Go / No-Go check would seem to need no more than a push button and a couple of LEDs.

The additional 3 relays seem unnecessary and would mask any capability to make more exotic measurements, such as Operating Time (delay timer), Just-Operate / Release voltages (via PICaxe PWM output) or contact resistance (ADC input), etc..

The Darlington transistor appears to be wired "upside down" (NPN collectors to negative supply), may need a resistor in series with its input (base) and D18 seems unnecessary.

Cheers, Alan.
Hi Alan, many thanks for your advice,
I was just testing simple function of normal open/closed checking if actualy switching and not failed open or welded. would be great to test further.
I have removed the relays and gone more simple approach, i was looking and seems better to use the fet irf520 than the bx38?
i am using relay to test for a 24v input.. is there another way to do this? voltage divider with resistors?
 

Attachments

Last edited:

AllyCat

Senior Member
Hi,

It looks as if you have the 3v and 24v connections swapped on the relay connector. Generally it's worthwhile to put a resistor (typically 1k - 10k) in series with each PICaxe input pin to hopefully protect against a high voltage being accidentally applied.

I would connect the "Common" relay contact to ground (negative rail) for several reasons: For example, two resistors could be saved by activating the PICaxe's internal "Weak Pullup" resistors. Also, an ADC input could then measure the voltage drop across the contact (highest resolutuion available has about 1 mV steps). But you would need lower-valued pullup resistors (e.g. running at 10 - 100 mA) to estimate useful contact resistance values (tens - hundreds of milliohms).

Also, driving the FET from a "PWM capable" pin could allow testing the coil for the just-operate and release voltages. Pin B.4 (hpwm D) is the nearest pin to the one you've shown, but one of the four "normal" PWM output pins would be better (see the footprint in Manual 1 or PE6, etc).

Cheers, Alan.
.
 

premelec

Senior Member
FWIW I've often tested relays with DT contacts by putting a large capacitor across the coil and then putting voltage through the NC contact via resistor to the coil and capacitor - this makes a clicker sort of effect actuating the relay intermittently at speed determined by the capacitor etc - various currents can be run through various contacts with appropriate power supplies and loads.
 

hippy

Technical Support
Staff member
I would connect the "Common" relay contact to ground (negative rail)
For a comprehensive test, I would probably connect all three contacts ( Common, N/O, N/C ) to ADC pins with a pull-up and pull-down. Then you can put out a digital high and low to each of those and measure the voltage on the others, for High -
Code:
      .-----.-----.-----.----.            .-----.-----.-----.----.
      | COM | N/C | N/O | In |            | COM | N/C | N/O | In |
.-----+-----+-----+-----+----'      .-----+-----+-----+-----+----'
|  -  | 2.5 | 2.5 | 2.5 |           |  -  | 2.5 | 2.5 | 2.5 |
|-----+-----+-----+-----|           |-----+-----+-----+-----|
| COM |  -  |  5  | 2.5 |           | COM |  -  | 2.5 |  5  |
|-----+-----+-----+-----|           |-----+-----+-----+-----|
| N/C |  5  |  -  | 2.5 |           | N/C | 2.5 |  -  | 2.5 |
|-----+-----+-----+-----|           |-----+-----+-----+-----|
| N/O | 2.5 | 2.5 |  -  |           | N/O |  5  | 2.5 |  -  |
|-----+-----^-----^-----'           |-----+-----^-----^-----'
| Out |   Not Actived               | Out |    Activated
`-----'                             `-----'
For Low the 5's become 0, 2.5 remains 2.5
 

AllyCat

Senior Member
Hi,

To make a useful measurement of contact resistance would require a really "solid" connection between the (common) contact and ground. The resistance of the output pull-down FETs in the M2 chips is about 20 ohms (at Vcc = 5v, double that at 3 volts).

Here is quite a nice simple explanation that Google quickly found. But their term "power supply" needs some qualification: Most conventional power supplies (even lab. bench supplies) may have a significant decoupling capacitor (many uFs) connected directly across their output terminals. Closing a switch directly across a capacitor can cause a large current to flow and weld the contacts together. So I would add a series resistor of at least a few ohms. ;)

However, a realistic measurement for the contact resistance of an "Automotive" relay would not be easy. At 30 Amps, almost One Watt of heat/power will be dissipated for each milli-ohm of (contact) resistance !! Definitely getting into "magic smoke" territory. :)

Cheers, Alan.
 

late_voyager

New Member
hi, ok getting over my head now... slow down lol
noted put resistor on inputs, and change fet to IRL520

For a comprehensive test, I would probably connect all three contacts ( Common, N/O, N/C ) to ADC pins with a pull-up and pull-down. Then you can put out a digital high and low to each of those and measure the voltage on the others, for High -
Code:
      .-----.-----.-----.----.            .-----.-----.-----.----.
      | COM | N/C | N/O | In |            | COM | N/C | N/O | In |
.-----+-----+-----+-----+----'      .-----+-----+-----+-----+----'
|  -  | 2.5 | 2.5 | 2.5 |           |  -  | 2.5 | 2.5 | 2.5 |
|-----+-----+-----+-----|           |-----+-----+-----+-----|
| COM |  -  |  5  | 2.5 |           | COM |  -  | 2.5 |  5  |
|-----+-----+-----+-----|           |-----+-----+-----+-----|
| N/C |  5  |  -  | 2.5 |           | N/C | 2.5 |  -  | 2.5 |
|-----+-----+-----+-----|           |-----+-----+-----+-----|
| N/O | 2.5 | 2.5 |  -  |           | N/O |  5  | 2.5 |  -  |
|-----+-----^-----^-----'           |-----+-----^-----^-----'
| Out |   Not Actived               | Out |    Activated
`-----'                             `-----'
For Low the 5's become 0, 2.5 remains 2.5
I would probably connect all three contacts ( Common, N/O, N/C ) to ADC pins with a pull-up and pull-down ?
I would connect the "Common" relay contact to ground (negative rail) for several reasons: For example, two resistors could be saved by activating the PICaxe's internal "Weak Pullup" resistors. ?

Its a lovely picture but have no idea what it is!.... are we checking to see if inputs are ground rather that high 3v?
whats a pull up /down?
common relay contact is 3volt, do i not use this and have just to ground, not sure how i get input then?
confused now conect comm, n/o, n/c, to adc, c1,c2,c3. ?
 

Attachments

hippy

Technical Support
Staff member
I was visualising something like below; coil and drive not shown. All three relay contacts go to PICAXE ADC pins -
Code:
V+ -.---.---.
   .|. .|. .|.             Relay
   |_| |_| |_|           .-------.
    |   |   |         .--|--O    |
<>--^-.-|---|-----(O--'  |   \O--|--.
<>----|-^-.-|-----(O-----|--O    |  |
<>----|---|-^-.---(O--.  `-------'  |
     .|. .|. .|.      |             |
     |_| |_| |_|      `-------------'
      |   |   |
0V ---^---^---'
 

late_voyager

New Member
I was visualising something like below; coil and drive not shown. All three relay contacts go to PICAXE ADC pins -
Code:
V+ -.---.---.
   .|. .|. .|.             Relay
   |_| |_| |_|           .-------.
    |   |   |         .--|--O    |
<>--^-.-|---|-----(O--'  |   \O--|--.
<>----|-^-.-|-----(O-----|--O    |  |
<>----|---|-^-.---(O--.  `-------'  |
     .|. .|. .|.      |             |
     |_| |_| |_|      `-------------'
      |   |   |
0V ---^---^---'
wow must take ages to draw!
seems like ground conected to +V or are they resistors? have i just had a blonde moment... diodes...


.|. .|. .|.
|_| |_| |_| what are these?
| | |
 
Last edited:

hippy

Technical Support
Staff member
_| |_| |_| what are these?
Those are resistors.

I am however now thinking there should probably be more to it; inline series resistors. That would help protect against a coil to contact short.

What we don't have is a specification of what relay failure modes you actually want to test for.
 

AllyCat

Senior Member
Hi,

In addition to the basic functionality test (which as already said could be done with a push-button and a pair of LEDs) the fundamental characteristics of a relay are: the just-operate and hold/release coil voltages, the operate and release (delay) times (at the specified coil voltage) and the contact resistance(s). If the reason for testing these relays is that they are used/recycled or of dubious origin then IMHO a check of the contact resistance is well worthwhile.

Even if you don't want to specifically verify the pinning, it's still wise to protect against "releasing the magic smoke from the PICaxe" in case an accidental mis-connection does occur. However, I would still connect the Common relay contact directly to a Solid earth, so that a low contact resistance can be measured. Then, ALL the other relay pins can be protected (current-limited) by series resistors; A few kohms in series with each PICaxe input pin (ADC) and perhaps 10 - 100 ohms for all the other contact and coil connections. Low-valued carbon film resistors actually make quite decent "fuses" and are a lot cheaper to replace than a PICaxe. :)

Of course you could also put a resistor in series with the Common contact and perform a "differential" voltage measurement (i.e. Vcontact = Vno - Vcom) but that can only resolve to about 10 mV accuracy (each ADC step is 5mV, if Vcc = 5 volts). But by solidly grounding the Common pin, you can measure Vcontact directly to 1mV resolution, using FVR1024 as the ADC reference. Whether you use 1mA, 10mA, 100mA or 1A as the contact testing current will depend on how "serious" a measurement you want to make, but 30 or 33 mA/milliohms might be a good compromise.

Cheers, Alan.
 

late_voyager

New Member
Those are resistors.

I am however now thinking there should probably be more to it; inline series resistors. That would help protect against a coil to contact short.

What we don't have is a specification of what relay failure modes you actually want to test for.
Thanks for all input.. steep learning curve for me!
I was just checking for basic operation, checking it functions correctly, if contacts opening closing, not failed, sticky, welded etc. i dont need so in depth. however its nice to know these things possible and maybe a future add on.
I have already had push button with led's however now want message from picaxe, or maybe repeated cycle test 5 times.etc
I have a system running using relays to signal pic axe, but was getting feed/kick back and slow speed due to all the opps,
now looking to do direct to picaxe as above.

i will do a new drawing again later....
 

late_voyager

New Member
I was visualising something like below; coil and drive not shown. All three relay contacts go to PICAXE ADC pins -
Code:
V+ -.---.---.
   .|. .|. .|.             Relay
   |_| |_| |_|           .-------.
    |   |   |         .--|--O    |
<>--^-.-|---|-----(O--'  |   \O--|--.
<>----|-^-.-|-----(O-----|--O    |  |
<>----|---|-^-.---(O--.  `-------'  |
     .|. .|. .|.      |             |
     |_| |_| |_|      `-------------'
      |   |   |
0V ---^---^---'
if resistor these will just short..??
 

hippy

Technical Support
Staff member
you show drawing as this?
it will just short across resistor v+ to 0v
Yes, that's a better drawing than mine.

It's not however a short from V+ to 0V because there are resistors in the way. Current will flow and, being equal, with all PICAXE pins as input, each signal line will settle at about V+/2.

The relay contacts will short signals to signals, and PICAXE output which can then pull the signals low or high. The variations of voltage, 0V, V+/2, V+, read by other PICAXE inputs will then indicate whether things are as expected or not.
 

AllyCat

Senior Member
Hi,

What is actually measured will depend on where/how the PICaxe "+5V" and "0v" pins are connected. ;)

BTW note that your "Pins 11" to "Pins 20" (commonly called "Legs" in PICaxe terminology) are labelled in an incorrect (reversed) sequence (relative to the Port.pin names).

Cheers, Alan.
 

late_voyager

New Member
Yes, that's a better drawing than mine.

It's not however a short from V+ to 0V because there are resistors in the way. Current will flow and, being equal, with all PICAXE pins as input, each signal line will settle at about V+/2.

The relay contacts will short signals to signals, and PICAXE output which can then pull the signals low or high. The variations of voltage, 0V, V+/2, V+, read by other PICAXE inputs will then indicate whether things are as expected or not.

right done this on breadboard, working and triggering 24v relay, using bx38 for now to test.
latest drawing
to detect high or low just use if c.2= 1 then..... etc?
 

Attachments

late_voyager

New Member
Yes, that's a better drawing than mine.

It's not however a short from V+ to 0V because there are resistors in the way. Current will flow and, being equal, with all PICAXE pins as input, each signal line will settle at about V+/2.

The relay contacts will short signals to signals, and PICAXE output which can then pull the signals low or high. The variations of voltage, 0V, V+/2, V+, read by other PICAXE inputs will then indicate whether things are as expected or not.
Im not sure where to start programming this, with output pulling hi to low, and reading by other pins? any tips?
do i send out put to c 3 permenantly? etc etc..
 

hippy

Technical Support
Staff member
Im not sure where to start programming this, with output pulling hi to low, and reading by other pins? any tips?
I would use something like below -
Code:
#Picaxe 20M2

Do

  b0 = -1            : Gosub ReadInputs

  b0 = C.1 : High b0 : Gosub ReadInputs
  b0 = C.2 : High b0 : Gosub ReadInputs
  b0 = C.3 : High b0 : Gosub ReadInputs

  b0 = C.1 : Low  b0 : Gosub ReadInputs
  b0 = C.2 : Low  b0 : Gosub ReadInputs
  b0 = C.3 : Low  b0 : Gosub ReadInputs

Loop

ReadInputs:
  ; Read analogue inputs
  If b0 <> C.0 Then : ReadAdc C.1, b1 : End If
  If b0 <> C.1 Then : ReadAdc C.2, b2 : End If
  If b0 <> C.2 Then : ReadAdc C.3, b3 : End If
  ; Revert analogue inputs to digital I/O
  adcSetup = 0
  ; Make pins input
  Input C.1
  Input C.2
  Input C.3
  ; Fix results: 0=0V, 1=V+/2, 2=V+, 3=Invalid
  b0 = b1 : Gosub FixResult : b1 = b0
  b0 = b2 : Gosub FixResult : b2 = b0
  b0 = b3 : Gosub FixResult : b3 = b0
  Return

FixResult:
  Select Case b0
    Case <  $20 : b0 = 0 ; 0V
    Case <  $70 : b0 = 3 ; Invalid
    Case >= $E0 : b0 = 2 ; V+
    Case >= $90 : b0 = 3 ; Invalid
    Else        : b0 = 1 ; V+/2
  End Select
  Return
After each 'Gosub ReadInputs' one would check the values returned in b0-b2 that they were as expected.

You would do that twice, once with the coil energised and once when not.
 

late_voyager

New Member
I would use something like below -
Code:
#Picaxe 20M2

Do

  b0 = -1            : Gosub ReadInputs

  b0 = C.1 : High b0 : Gosub ReadInputs
  b0 = C.2 : High b0 : Gosub ReadInputs
  b0 = C.3 : High b0 : Gosub ReadInputs

  b0 = C.1 : Low  b0 : Gosub ReadInputs
  b0 = C.2 : Low  b0 : Gosub ReadInputs
  b0 = C.3 : Low  b0 : Gosub ReadInputs

Loop

ReadInputs:
  ; Read analogue inputs
  If b0 <> C.0 Then : ReadAdc C.1, b1 : End If
  If b0 <> C.1 Then : ReadAdc C.2, b2 : End If
  If b0 <> C.2 Then : ReadAdc C.3, b3 : End If
  ; Revert analogue inputs to digital I/O
  adcSetup = 0
  ; Make pins input
  Input C.1
  Input C.2
  Input C.3
  ; Fix results: 0=0V, 1=V+/2, 2=V+, 3=Invalid
  b0 = b1 : Gosub FixResult : b1 = b0
  b0 = b2 : Gosub FixResult : b2 = b0
  b0 = b3 : Gosub FixResult : b3 = b0
  Return

FixResult:
  Select Case b0
    Case <  $20 : b0 = 0 ; 0V
    Case <  $70 : b0 = 3 ; Invalid
    Case >= $E0 : b0 = 2 ; V+
    Case >= $90 : b0 = 3 ; Invalid
    Else        : b0 = 1 ; V+/2
  End Select
  Return
After each 'Gosub ReadInputs' one would check the values returned in b0-b2 that they were as expected.

You would do that twice, once with the coil energised and once when not.
wow thanks, its going to take me a while to digest this...
 
Top