I am having issues turning on any of the relays on my 8 channel 12V relay board.
Relay Board: Amazon.com
I have the board connected to a 12v power supply with a common ground between the board and the arduino. The arduino is plugged into a laptop.
The issue is that the output pins, in this case pin 12, can't turn on the relays even though I am measuring 5v from the pin. However, If I use the 5v or 3.3v output pins then the relay opens with no issues.
Using the 5v pin, relay is open:
Using 3.3v pin, relay is open:
Using pin 12, relay is closed:
I measure 5v from pin 12 when not connected to the relay terminal, but that drops to 1.2 - 1.4v when connected to the relay terminal. I'm not sure why the voltage keeps dropping from pin 12, but no issue from 5v and 3.3v pins.
Edit: Adding Code - basically just turning on multiple pins:
#include <SD.h> // need to include the SD library
#define SD_ChipSelectPin 47 //connect pin 4 of arduino to cs pin of sd card
#include <TMRpcm.h> //Arduino library for asynchronous playback of PCM/WAV files
#include <SPI.h> // need to include the SPI library
TMRpcm tmrpcm; // create an object for use in this sketch
int temp=1;
//int pp=5;
//int next=6;
//int prev=7;
int BlueTree1 = 13;
int BlueTree2 = 12;
int BlueTree3 = 11;
int BlueTree4 = 10;
int BlueTree5 = 9;
int BlueTree6 = 8;
int LightTree = 7;
int GreenBall1 = 6;
int GreenBall2 = 5;
int GreenBall3 = 4;
int LowIce = 3;
int MidIce = 14;
int TopIce = 17;
int CarLight = 16;
int RedBall = 15;
int CycleCounter = 0;
int delay1=1000;
int delay2=2000;
int delay3=1000;
int delay4 = 500;
int delay5 = 1000;
int rest=5000;
int pattern = 1;
void setup()
{
// pinMode(pp,INPUT_PULLUP);
// pinMode(next,INPUT_PULLUP);
// pinMode(prev,INPUT_PULLUP);
tmrpcm.speakerPin = 46; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) // returns 1 if the card is present
{
Serial.println("SD fail");
return;
}
tmrpcm.setVolume(5); //
tmrpcm.play("Song1.wav"); //the sound file "song" will play each time the arduino powers up, or is reset
//try to provide the file name with extension
pinMode(BlueTree1, OUTPUT);
pinMode(BlueTree2, OUTPUT);
pinMode(BlueTree3, OUTPUT);
pinMode(BlueTree4, OUTPUT);
pinMode(BlueTree5, OUTPUT);
pinMode(BlueTree6, OUTPUT);
pinMode(LightTree, OUTPUT);
pinMode(GreenBall1, OUTPUT);
pinMode(GreenBall2, OUTPUT);
pinMode(GreenBall3, OUTPUT);
pinMode(LowIce, OUTPUT);
pinMode(MidIce, OUTPUT);
pinMode(TopIce, OUTPUT);
pinMode(CarLight, OUTPUT);
pinMode(RedBall, OUTPUT);
}
void loop()
{
Serial.println("All on");
digitalWrite(BlueTree1, HIGH);
digitalWrite(BlueTree2,HIGH);
digitalWrite(BlueTree3,HIGH);
digitalWrite(BlueTree4,HIGH);
digitalWrite(BlueTree5,HIGH);
digitalWrite(BlueTree6,HIGH);
digitalWrite(LightTree,HIGH);
digitalWrite(GreenBall1,HIGH);
digitalWrite(GreenBall2, HIGH);
digitalWrite(GreenBall3,HIGH);
digitalWrite(LowIce,HIGH);
digitalWrite(MidIce,HIGH);
digitalWrite(TopIce,HIGH);
digitalWrite(CarLight,HIGH);
digitalWrite(RedBall,HIGH);
delay(rest);
//








