Hello all,
I have build a rig to control 4 actuators using Arduino.
Components used as follows:
Arduino Mega 2560
4 channel relay board Link
8 channel relay board Link
10 button remote - custom made
12v battery
Code:
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(A7, INPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
pinMode(A6, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int Aseven = analogRead(A7);
int Azero = analogRead(A0);
int Aone = analogRead(A1);
int Atwo = analogRead(A2);
int Athree = analogRead(A3);
int Afour = analogRead(A4);
int Afive = analogRead(A5);
int Asix = analogRead(A6);
Serial.println(Aseven);
Serial.println(Azero);
Serial.println(Aone);
Serial.println(Atwo);
Serial.println(Athree);
Serial.println(Afour);
Serial.println(Afive);
Serial.println(Asix);
if (((Azero >=600) && (Azero<= 950))|| Afive > 950 ) { //Relay 2 and 13
digitalWrite(2, HIGH);
digitalWrite(13, HIGH);
}
else (Azero < 200 || Afive < 200 ); { //Relay 2 and 13
digitalWrite(2, LOW);
digitalWrite(13, LOW);
}
if (((Atwo >=600) && (Atwo<= 950))|| Afour > 950 ) { //Relay 3 and 4
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
}
else (Atwo < 200 || Afour < 200 ); { //Relay 3 and 4
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}
if (((Atwo >=600) && (Atwo<= 950))|| Athree > 950 ) { //Relay 5 and 6
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);;
}
else (Atwo < 200 || Athree < 200 ); { //Relay 5 and 6
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
if (Azero > 600) { //Relay 7 and 8
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
}
else (Azero < 200 ); { //Relay 7 and 8
digitalWrite(7, LOW);
digitalWrite(8, LOW);
}
if (Atwo > 600 || Athree > 950 || Afour > 950 ) { //Relay 9 and 10
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);;
}
else (Atwo < 200 || Athree < 200 || Afour < 200); { //Relay 9 and 10
digitalWrite(9, LOW);
digitalWrite(10, LOW);
}
if (((Azero >=600) && (Azero<= 950))|| Aseven > 600 ) { //Relay 11
digitalWrite(11, HIGH);
}
else (Azero < 200 || Aseven < 200 ); { //Relay 11
digitalWrite(11, LOW);
}
if (((Azero >=600) && (Azero<= 950))||((Aseven >=600) && (Aseven<= 950))|| Asix > 950 || Afive > 950) { //Relay 12
digitalWrite(12, HIGH);
}
else (Azero < 200 || Afive < 200 || Asix < 200 || Aseven < 200 ); { //Relay 12
digitalWrite(12, LOW);
}
}
The Problem:
the power LED on the relay board is very bright but when a pin goes high to flick the relay the relay led comes on very dim and doesn't flick the relay.
Wiring Diagram coming shortly