Hi again
Is it possible to connect the arduo to a denentech relay board as the board has some electronics on it and is not just relays like I thought /wanted
Post a link to the boards datasheet so we can see what it is.
hi
there was a post on that a month or so ago... that board accepts either serial or I2C commands to trip the relays. the serial is easy, just connect the TX pin and GND of the Arduino to the board, and then send, for example:
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(relay_address, BYTE); // send relay module address
Serial.print(100, BYTE); // All relays on
Serial.print(relay_address, BYTE); // send relay module address
Serial.print(101, BYTE); // Turn relay 1 on
//etc
Serial.print(relay_address, BYTE); // send relay module address
Serial.print(110, BYTE); //All relays off
Serial.print(relay_address, BYTE); // send relay module address
Serial.print(111, BYTE); //Turn relay 1 off
//etc
}
You'll need to read the datasheet and figure out what jumper setting is for straight serial, and what the proper code is for the relay_address.
D
Thank you all yet again looks like it's going to be another wet week end here in England so maby I'll get some more Adruinoing in.
Thanks again
Jon
Daniel cant seem to get this sketch to compile
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(100, BYTE); // All relays on
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(101, BYTE); // Turn relay 1 on
//etc
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(110, BYTE); //All relays off
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(111, BYTE); //Turn relay 1 off
//etc
}
get this error relay-address was not declaired
not shure where to go next
here r boards relay adressesCommands for Serial
Command
Action
dec hex
90 5A Get software version - transmits a single byte back to the controller containing the software revision
91 5B
Get relay states - transmits a single byte back to the controller, bit high meaning the corresponding relay is powered
92 5C Set relay states - the next byte sent to the command register will set all relay states, All on = 255 (11111111) All off = 0
100 64 All relays on
101 65 Turn relay 1 on
102 66 Turn relay 2 on
103 67 Turn relay 3 on
104 68 Turn relay 4 on
105 69 Turn relay 5 on
106 6A Turn relay 6 on
107 6B Turn relay 7 on
108 6C Turn relay 8 on
110 6E All relays off
111 6F Turn relay 1 off
112 70 Turn relay 2 off
113 71 Turn relay 3 off
114 72 Turn relay 4 off
115 73 Turn relay 5 off
116 74 Turn relay 6 off
117 75 Turn relay 7 off
118 76 Turn relay 8 off
160 A0 1st byte in sequence to change serial address
165 A5 3rd byte in sequence to change serial address
170 AA 2nd byte in sequence to change serial address
hi Jon
what is the error reported by the IDE?
D
I get this error relay-address was not declaired
Hope this is enough info
You need to declare relay_address1. Try adding this line above setup:
byte relay_address1;
Hi thanks for the sugestion but have tried byte relay_address1. in every line in the program either it doesen't work or i dont understand where to put it . I have tried it on every line to no avail .
yours confused
Jon
Here is the whole thing, and it compiles without errors for me.
byte relay_address1;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(100, BYTE); // All relays on
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(101, BYTE); // Turn relay 1 on
//etc
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(110, BYTE); //All relays off
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(111, BYTE); //Turn relay 1 off
//etc
}
Hi thanks for that I can get it to compile & load to the board but when the sketch runs all i get is a load of text in the serial monitor like( ddheddheddhe).No relay switchin as yet the board is in pins 6 & 7 .The TX LED is on constantly
Still confused
Jon
Well, this sketch will just send the same thing over and over. That is why the Tx light stays lit all the time. And you will need to have the relay board connected to dig 0 and dig 1 (Rx Tx) to talk to the relay board. I think you also need to set relay_address1 = to whatever address you have the board setup for. You may also want to add a delay() between the messages so you are not bombarding the relay board with messages.
Hi thanks Digger some progress this
byte relay_address1;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(100, BYTE); // All relays on
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(101, BYTE); // Turn relay 1 off
delay(1000);
//etc
}
gets various letters sent over the serial and the delay helps but still no rela switching .I did get relay 5 to latch on but I think this is a fluke because I had to disconnect the board to get it off and could not repeat the situation .
Will cary on experimenting
Progress .This
byte relay_address;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(relay_address, BYTE); // send relay module address
Serial.print(100, BYTE); // Turn relay 1 on
delay(1000);
//etc
}
Seems to turn relay 5 on well at least i have a relay on now .
hi Jon
you need to assign a value for the relay address.
At the moment you are not assigning it; I imagine it is defaulting to 0.
The relay_address variable in your code holds the physical address of the module that gets sent with every command. Devantech uses this address in their communications protocol so that you can use more than one module on a network.
The default address is 1, so to send ocommands to a module with an address of "1" connected to the Arduino, you would use the code:
byte relay_address = 1 // set the relay module address to 1
This page tells you more, and also how to change a module's address.
D
Hi Jon,
Try this code, it should turn all relays on for 3 seconds and then off for 3 seconds.
byte relay_address1 = 1; //Tech sheet said 8 was default
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(100, BYTE); // All relays on
delay(3000);
Serial.print(relay_address1, BYTE); // send relay module address
Serial.print(110, BYTE); //All relays off
delay(3000);
}
hi Jon, Digger,
I just looked at the datasheet again and I think the probelm might also be the mode... you have to connect the mode pin on the module to ground to make it operate in straight serial.
Digger, where did you see that the default is 8? It says "The RLY08 can be found at a factory default address of 1" on the relay address web page.
D
Ahh, I misinterpreted the text "RLY08's address 1 (default) to 8". I updated my last post, good catch Daniel.
We are ever vigilant ![]()
Hi Daniel
with the following code i get the letters sent d e n o ay one second intervals but no relay switching take the delays out & relay 5 comes on and stays on. I thought I had declared relay address -1 it that example?.
byte relay_address=1;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(relay_address=1, BYTE); // send relay module address
Serial.print(100, BYTE); // All relays on
delay (1000);
Serial.print(relay_address=1, BYTE); // send relay module address
Serial.print(101, BYTE); // Turn relay 1 on
delay (1000);
//etc
Serial.print(relay_address=1, BYTE); // send relay module address
Serial.print(110, BYTE); //All relays off
delay (1000);
Serial.print(relay_address=1, BYTE); // send relay module address
Serial.print(111, BYTE); //Turn relay 1 off
delay (1000);
//etc
}