giovedì 16 novembre 2017

Remote Control a 2 Channel Relay board with RemoteXY











A recurring question on some Arduino and ESP groups on Facebook goes like: "how to remotely control a relay?"

In this post I show a simple and quick way to remotely control a 2 Relay module through a mobile app using the RemoteXY service.

Pre-requisite to this post is a previous I have written : "Remote Control NodeMCU with RemoteXY" in which I introduce the development of mobile apps to control nodeMCU projects.


The Circuit





As shown in the above figure, the 2 Channel Relay module has 4 pins:

  • GND
  • IN1
  • IN2
  • Vcc

Those pins need to be wired in the following way:

  • Module: GND --> nodeMCU:GND
  • Module: IN1 --> nodeMCU:D4
  • Module: IN2 --> nodeMCU:D5
  • Module: Vcc --> nodeMCU:Vin

Note:

Those wire connections assume that the nodeMCU is powered with 5V.
In such situation on the module Vin pin there will be 5V which is the right voltage to provide to the Relay module.

If you power you nodeMCU with a different voltage, please make sure you adapt the voltage available on Vin to be exactly 5V.



Graphic Interface






Build this simple graphic interface by using 3 labels and 2 switch in the RemoteXY editor.

The switch si should be named:
  • switch_1
  • switch_2

Now in the configuration panel, bottom right, let's configure each switch in a way that they connect to pin D4 and D5 on the nodeMCU














Configuration 

Let's configure RemoteXy in this way





Don't forget to specify your WiFi name and password






Source Code


Here the link  of the shared RemoteXY project. Once on RemoteXY you can download the source code to upload on your nodeMCU


Testing


Below a short video showing the behavior of the application











Nessun commento:

Posta un commento