How do I turn on/off relay through the Serial Monitor?

Do you have a question on how to do something.
Ask in here.
Post Reply
Im2Nelson4u
Posts: 10
Joined: Mon Aug 22, 2011 7:40 pm

How do I turn on/off relay through the Serial Monitor?

Post by Im2Nelson4u »

Hi, I was just wondering how to use the commands posted here http://forum.reefangel.com/viewtopic.ph ... 41&p=23677

I have the original 1st Gen RA with no wifi module and was wondering how do I send commands through the Serial Monitor to do things like turn off relays.

So far the only thing I've been able to do is simple GET commands like "GET /sr " or "GET /v " to retrieve data but im not sure how to send commands.

According to the forum post the command for turning on/off a relay is

/rxy - override relay where
x=relay
y=0 - mask off
y=1 - mask on
y=2 - auto


I've tried things like "POST /r11 " or "PUT /r11 " to turn on Relay 1 but it doesn't work. Anyone know what the proper command is?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How do I turn on/off relay through the Serial Monitor?

Post by rimai »

GET /r11
Roberto.
v01d
Posts: 5
Joined: Wed Jan 25, 2017 5:17 am

Re: How do I turn on/off relay through the Serial Monitor?

Post by v01d »

Hi Im2Nelson4u,

Sorry I can't send private messages apparently.

Your message:
"Hi, I just bought a NodeMCU esp8266 module and was wondering how to wire it to the reefangel ? Do i need a converter to go from the reef angels 5v to 3.3v or can i use the VIN on the NodeMCU?"

You can't exactly use the RA to power the NodeMCU because it gets power from the microusb on the board. It's design for plug-and-play. For what you want to do I would probably get one of the other ESP8266s that need 3.3V and use a converter between the RA power and the ESP. I powered mine from the bottom pins on the RA where you'd also find the Serial In/Out pins. If you want to use the NodeMCU, just power it externally and only connect the Serial In/Out from the RA to it.
v01d
Posts: 5
Joined: Wed Jan 25, 2017 5:17 am

Re: How do I turn on/off relay through the Serial Monitor?

Post by v01d »

This is what I used for my wiring. Don't ask why pin 7 was 5v I don't know. Also the colours of the cables were just what I had. Note, 4 is RX and 5 is TX and this is starting from the Right Hand side as pin 1. So in your case:

NodeMCU's "TX" to RA's Pin 4 "RX"

and

NodeMCU's "RX" to RA's Pin 5 "TX"

The wiring to connect the RA to the ESP is as follows:

RA Pin 1 (on RHS of controller) - GND (Black Cable) – to Arduino GND
RA Pin 4 - RX (Blue Cable) – to Arduino TX (Digital Pin 1)
RA Pin 5 – TX (Yellow Cable) – to Arduino RX (Digital Pin 0)
RA Pin 7 - 5V (Red Cable) – to Arduino 5V

And yes, use a microUSB cable connected to the NodeMCU to provide power. Just remember so still connect GND from the RA to the NodeMCU. One always needs a common GND with these things.

EDIT: Sorry, you may actually be able to power the NodeMCU straight form the RA using the VIN as you suggested. I take no responsibility though :)
Last edited by v01d on Mon Jan 07, 2019 3:18 am, edited 1 time in total.
Im2Nelson4u
Posts: 10
Joined: Mon Aug 22, 2011 7:40 pm

Re: How do I turn on/off relay through the Serial Monitor?

Post by Im2Nelson4u »

v01d wrote:This is what I used for my wiring. Don't ask why pin 7 was 5v I don't know. Also the colours of the cables were just what I had. Note, 4 is RX and 5 is TX and this is starting from the Right Hand side as pin 1. So in your case:

NodeMCU's "TX" to RA's Pin 4 "RX"

and

NodeMCU's "RX" to RA's Pin 5 "TX"

The wiring to connect the RA to the Ethernet add-on is as follows:

RA Pin 1 (on RHS of controller) - GND (Black Cable) – to Arduino GND
RA Pin 4 - RX (Blue Cable) – to Arduino TX (Digital Pin 1)
RA Pin 5 – TX (Yellow Cable) – to Arduino RX (Digital Pin 0)
RA Pin 7 - 5V (Red Cable) – to Arduino 5V

And yes, use a microUSB cable connected to the NodeMCU to provide power. Just remember so still connect GND from the RA to the NodeMCU. One always needs a common GND with these things.

EDIT: Sorry, you may actually be able to power the NodeMCU straight form the RA using the VIN as you suggested. I take no responsibility though :)
dude your amazing everything works and is awesome, my 1st gen RA is working great with your code and the NodeMCU and i dont even need to power it thru the microusb
v01d
Posts: 5
Joined: Wed Jan 25, 2017 5:17 am

Re: How do I turn on/off relay through the Serial Monitor?

Post by v01d »

Awesome, glad I could help. I don't maintain that code at the moment. Hopefully someone will pick it up when it needs enhancement.
Post Reply