How do you wire a ssr relay to a arduino nano I am trying to wire a fss1-102z 5v ssr relay to my arduino nano but i cant get it to work here is my circuit. It stays stuck on and i cant get it to turn off.



Bluetooth control code

char val;         // variable to receive data from the serial port
int ledpin = 2;  // LED connected to pin 2 (on-board LED)

void setup()
{
  pinMode(ledpin = 2, OUTPUT); // pin 2 (on-board LED) as OUTPUT
  pinMode(ledpin = 3, OUTPUT); // pin 3 (on-board LED) as OUTPUT

    Serial.begin(9600);       // start serial communication at 115200bps

}

void loop()

{
  if( Serial.available() )       // if data is available to read
  {
    ;
  }
  val = Serial.read();         // read it and store it in 'val'

  if( val == 'a' )               // if 'a' was received led 2 is switched off
  {
    digitalWrite(ledpin = 2, HIGH);    // turn Off pin 2
  }

  if( val == 'A' )               // if 'A' was received led 2 on
  {
    digitalWrite(ledpin = 2, LOW);  // turn ON pin 2
  }

  if( val == 'b' )               // if 'b' was received led 3 is switched off
  {
    digitalWrite(ledpin = 3, HIGH);    // turn Off pin 3
  }

  if( val == 'B' )               // if 'B' was received led 3 on
  {
    digitalWrite(ledpin = 3, LOW);  // turn ON pin 3
  } //else (ledpin = 3, LOW)        //set led pin 3 to low state

  if( val == 'C' )               // if 'C' was received led 2 on for 1 second
  {
    digitalWrite(ledpin = 2, LOW);  // turn ON pin 2
    delay(1000);                     // wait 1 second
    digitalWrite(ledpin, HIGH);      // turn Off pin 2
  }

  if( val == 'D' )               // if 'D' was received led 3 on for 1 second
  {
    digitalWrite(ledpin = 3, LOW);  // turn ON pin 3
    delay(1000);                     // wait 1 second
    digitalWrite(ledpin, HIGH);      // turn Off pin 3
  }

  if( val == 'E' )               // if 'E' was received led 2 on for 5 seconds
  {
    digitalWrite(ledpin = 2, LOW);  // turn ON pin 2
    delay(5000);                     // wait 500 milli seconds
    digitalWrite(ledpin, HIGH);      // turn Off pin 2
  }

  if( val == 'F' )               // if 'F' was received led 3 on for 5 seconds
  {
    digitalWrite(ledpin = 3, LOW);  // turn ON pin 3
    delay(5000);                     // wait 500 milli seconds
    digitalWrite(ledpin, HIGH);       // turn Off pin 3
  }

  if( val == 'G' )               // if 'G' was received turn led pin 2 on for 500ms then switch off and turn on pin 3 for 500 mili seconds then off
  {
    digitalWrite(ledpin = 2, LOW);  // turn ON pin 2
    delay(500);                     // wait 500mili second
    digitalWrite(ledpin, HIGH);      // turn Off pin 2
    digitalWrite(ledpin = 3, LOW);  // turn ON pin 2
    delay(500);                     // wait 500 mili second
    digitalWrite(ledpin, HIGH);      // turn Off pin 2
  }

  if( val == 'h' )               // if 'h' was received switch off all pins
  {
    digitalWrite(ledpin = 13, LOW);    // turn Off pin 13
    digitalWrite(ledpin = 2, HIGH);      // turn Off pin 2
    digitalWrite(ledpin = 3, HIGH);      // turn Off pin 3
}

  if( val == 'H' )               // if 'H' was received switch pin 2 on and off 1000 times

  for(int i = 0; i &lt; 1000; i++)
  {
    digitalWrite(ledpin = 2, HIGH);  // turn ON pin 2
   delay (1000); //wait 1000 mili seconds
    digitalWrite(ledpin = 2, LOW);  // turn Off pin 2
   delay (1000); //wait 1000 mili seconds

  }

}
According to its datasheet, the FSS1-102Z doesn't work with DC-voltage. Also the minimal voltage required is 50VAC. Here is the excerpt from the datasheet: