Arduino Nano test circuit.

SSR Based High Voltage H-Bridge

by Lewis Loflin

See related Arduino Solid State Relay Motor Control.

Safe H-Bridge test setup

To use the above H-bridge circuit power on 1B and 1b at the same time. Make sure 2A and 2B are turned off. Connect 1A-1B to Arduino DP9. Connect 2A-2B to DP10.

To reverse direction turn off DP9 then turn on DP10.

Only when the above is wired and programmed correctly - polarity reverses and the lamp stays off, move to next step.

Solid state DC relay H-bridge circuit.

Using the program below motor should forward and reverse by pressing SW1 and SW2.

Solid state relay transistor based H-bridge circuit.

This is the same except two of the solid state relays with bipolar transistors or MOSFETs.



#define SW1 2
#define SW2 3
#define LED1 9
#define LED2 10
#define LED3 11
#define pot 0

// HIGH = 1 and LOW = 0

#define ON 1
#define OFF 0

byte temp;

void setup() {
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(SW1, INPUT);
  digitalWrite(SW1, HIGH); // pull up on
  pinMode(SW2, INPUT);
  digitalWrite(SW2, HIGH); // pull up on

}

void loop() {
  delay(100);
  if ( S1() && !S2() ) {
    delay(200);
    if (S2()) { } // do nothing
    else digitalWrite(LED1, 1);
  }
  else digitalWrite(LED1, 0);

  if ( S2() && !S1() ) {
    delay(200);
    if ( S1() ) { } // do nothing
    else digitalWrite(LED2, 1);
  }
  else digitalWrite(LED2, 0);

  // power enable
  if ( S1() && S2() ) {
    byte temp = !digitalRead(LED3);
    digitalWrite(LED3, temp);
    while ( S1() || S2() ) {}
  } // end if// end loop

// returns 1 if switched pressed
byte  S1(void)   {
  if (digitalRead(SW1) != 1)   return 1;
  // or use (digitalRead(SW1) == 0)
  // 1 is a HIGH
  else return 0;
}

// returns 1 if switched pressed
byte  S2(void)   {
  if (digitalRead(SW2) != 1)   return 1;
  else return 0;
}