Wiring Diagram and Example code for RPI 4-Channel Relay Shield

yangze2065
edited July 2023 in All Other Parts

I just bought the "Inland RPI 4-Channel Relay 5V Shield for Raspberry Pi/ CE Certification" from Houston branch recently. It is a nice relay board to use on my Pi 3B+ and 4 following the reviewer code from one of the product review. But this HAT occupied all 40-pin without exhausting every GPIO pin. I would like to desolder the 40pin-connector (or jump-wire) and use only vcc, gnd, and actual signal pings to free other GPIOs. I was not able to find any resources for source code or wiring diagrams for the RPi 4-chan relay. Any help?

Best Answer

  • Lambdaben
    Lambdaben ✭✭✭
    5 Likes 5 Awesomes First Anniversary 5 Insightfuls
    Answer ✓

    I'm not good with wiring, but I kinda help with the coding

    Sample Code

    #include <wiringPi.h>
    int main()
    {
      wiringPiSetup();
    
      pinMode(7,OUTPUT);
      pinMode(3,OUTPUT);
      pinMode(22,OUTPUT);
      pinMode(25,OUTPUT);
      printf("relay testing!\n");
      while(1)
      { 
            digitalWrite(7,HIGH);
            delay(500);
            digitalWrite(7,LOW);
            digitalWrite(3,HIGH);
            delay(500);
            digitalWrite(3,LOW);
            digitalWrite(22,HIGH);
    	delay(500); 
            digitalWrite(22,LOW);
    	digitalWrite(25,HIGH);
    	delay(500);
    	digitalWrite(25,LOW);
    	delay(500); 
      }	
    }
    


    Hope this helps!

Answers

We love seeing what our customers build

Submit photos and a description of your PC to our build showcase

Submit Now
Looking for a little inspiration?

See other custom PC builds and get some ideas for what can be done

View Build Showcase

SAME DAY CUSTOM BUILD SERVICE

If You Can Dream it, We Can Build it.

Services starting at $149.99