I am doing job at IOT from 6 months, as a fresher i got this project just to check,can we operate relay by 2 controllers at a time.
hardware with me
8 channel relay module
arduino uno
nodemcu
4.connecting wires
process details
relay ON Conditions
The first 4 channels of the relay board should be controlled first by Arduino Uno controller. relay 1 (ON) delay(2000)....relay 2(ON) delay(2000) relay 3( ON)...delay....relay 4 (ON) like wise
then next 4 channels of relay board should be controlled by ESP8266 nodemcu controller.. relay 5(ON)..delay relay 6(ON)...likewise.
2.Relay OFF conditions
after turning ON all LEDs....with same delay process, channel 8 should OFF first then 7,6,5 by nodemcu. And channel 4,3,2,1 should be OFF by arduino uno with delay process
all this should be done when we plug in both controllers to power supply.i have downloaded SoftwareSerial.h library for serial communication between both controllers and i am trying to sketch for both controllers but i can't do it
Strange that a supervisor asks you to use two processors for one task.
Show us the code for that part first. That should be a very simple task.
If you can't do that part, then I fear you have to go back to school again.
Leo..
This should be enough for the Arduino to turn on the first four in order, wait for the other processor to turn the 5th on and off, and turn off the first four in reverse order.
const byte Relay1Pin = 4;
const byte Relay2Pin = 5;
const byte Relay3Pin = 6;
const byte Relay4Pin = 7;
const byte Relay5Pin = 2; // To sense when Relay 5 is on or off
void setup()
{
pinMode(Relay5Pin, INPUT);
digitalWrite(Relay1Pin, LOW);
digitalWrite(Relay2Pin, LOW);
digitalWrite(Relay3Pin, LOW);
digitalWrite(Relay4Pin, LOW);
pinMode(Relay1Pin, OUTPUT);
pinMode(Relay2Pin, OUTPUT);
pinMode(Relay3Pin, OUTPUT);
pinMode(Relay4Pin, OUTPUT);
// Turn the first four on in sequence
digitalWrite(Relay1Pin, HIGH);
delay(2000);
digitalWrite(Relay2Pin, HIGH);
delay(2000);
digitalWrite(Relay3Pin, HIGH);
delay(2000);
digitalWrite(Relay4Pin, HIGH);
// Wait for the other processor to turn on Relay 5
while (digitalRead(Relay5Pin) == LOW) ;
// Wait for the other processor to turn off Relay 5
while (digitalRead(Relay5Pin) == HIGH) ;
// Turn the first four off in reverse order
delay(2000);
digitalWrite(Relay4Pin, LOW);
delay(2000);
digitalWrite(Relay3Pin, LOW);
delay(2000);
digitalWrite(Relay2Pin, LOW);
delay(2000);
digitalWrite(Relay1Pin, LOW);
}
void loop() {}
I am doing job at IOT from 6 months, as a fresher i got this project just to check,can we operate relay by 2 controllers at a time.
I think this is an inhouse exercise to check the abilities of the programmers/constructors.
I would say its to see how good they are at not just programming but using and connecting to basic hardware.
As we have seen in this forum, unfortunately, sometimes that is a rare combination.
@amrita93 Can you please tell us your electronics, programming, arduino and hardware experience?
Tom....
PS. The employer/educational institute seems to think it is within their capabilities.
Sir, I don't think i can expect help from you as i already mentioned my work,i mentioned i'm in learning state.your words hurting me.but anyway thank you so much
Can you post a picture of the 8 channel module, there are many different types and some are HIGH and some are LOW input to activate?
Have you got the controllers connected to the relay module?