Combining multiple srd05vdc - what am i doing wrong?

hello, i am using two srd05vdc relays for switching between coiling on transformer to get lower, greater or the exact amplitude. I have made a simple switching circuit with these relays:

Two of the combinations work, to be exact, when com1 and com2 is both set to low and when they are both set to high as well (i see a beautiful sine wave as i should). But the combination when com1 is set to low and com2 is high doesn't work as expected. This is the code that Arduino is using: (pin 7 represents com1 and pin 8 represents com2)

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(7, LOW);
  delay(100);
  digitalWrite(8, LOW);
  for(int i = 0; i < 10000; i++){
    Serial.println(analogRead(A0)+1000);
    }
  
  digitalWrite(8, HIGH);
  delay(100);
  digitalWrite(7, HIGH);
  for(int i = 0; i < 10000; i++){
    Serial.println(analogRead(A0)+2000);
    }
 
  delay(100);
  digitalWrite(7, LOW);
  /*for(int i = 0; i < 10000; i++){
    Serial.println(analogRead(A0)+3000);
    }*/
}

The circuit that is used "after" this switching is basically the same as this one, from openenergymonitor with a difference - i use 3.3V instead of 5V as offset, and there are some differences in voltage divider resistors.

openenergymonitor

Sorry i probably murdered some of your brain cells by calling srd relay COMs, but i'm sure you understand this :smiley:

Well, quite obviously three of the combinations work and - given that you are using a relay module that is active LOW, the combination you describe where COM1 is LOW (relay switches to "NO") and COM2 is HIGH (relay rests on "NC") connects both lines to the centre connection, so no voltage.

OTOH, the exact opposite will see the full "600" transformer winding and a voltage boost. :+1:

2 Likes

Hi
Using this diagram;

|---------------------------------------|
|RELAY  | POS   | POS   |  POS  |  POS  |
|-------|-------|------ |-------|------ |
| COM1  |   A   |   B   |   A   |   B   |
| COM2  |   A   |   A   |   B   |   B   |
|-------|-------|------ |-------|------ |
| VOLTS |  200  |   0   |  600  |  400  |
|  OUT  |       |       |       |       |
|---------------------------------------|

Tom.... :grinning: :+1: :coffee: :australia:

1 Like

oh, right, so i've been afraid of making this exact connection because i thought it would destroy the arduino (i thought my connection is the right one.).. Good to know it doesn't destroy it, so i'll try to connect the opposite. thanks alot :slight_smile:

I was trying to do exactly this, though i misunderstood how the nc and no works. so when i wanted to do com1 on position a and com2 on position b, i was doing com1 on b and com2 on a. so i guess it works the opposite way, as paul said. Thanks alot too :slight_smile:

Well, what I gather tricked you was that you are (sensibly) using a twin relay module which actuates the relays - switching from "NC" to "NO" - when you pull the input LOW.

Generally using this circuit:

![](upload://frISOSnf0ga9eiCFiA69Obwye44.jpeg)

sorry there is something wrong with your picture i don't see it. But yes, that's the thing i guess, because it makes sense.. I thought this was going to work and i was afraid to try the other option, because i thought it will create the combination when com1 no a com2 nc are connected, hence will damage the arduino.


Though i didn't manage to test it yet because i have to get to school to properly find out. (a little detail though, i don't use twin relay module, i use two single relay modules, but that doesn't matter i guess)

I will let you know here if it worked or not, thanks for your help :slight_smile:

Can't see how switching the relays to various positions will damage the Arduino. It isn't connected to your transformer output, is it?

1 Like

Hi,
I hope you have fuses in each of the windings?
I hope you have the two secondaries phased properly, if not, you will not damage anything just get different results.

Tom.... :grinning: :+1: :coffee: :australia:

1 Like

no it's not connected directly to the output. there's offset and voltage divider so the voltage is safe to input into arduino. I was just worried about connecting com1 posB and bom2 posA that's all

alright i just tried this out. all three combinations work now and nothing is exploding so far, thanks alot for your help both :slight_smile:

i have no idea and i don't really know how to tell.. but my teacher gave me this transformer, so i guess the transformer itself should be alright..

:+1: :+1: :+1: :+1: :+1: :+1:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.