Relais ESP

relai_esp

A tester : https://github.com/IOT-MCU

Ce module comporte un microprocesseur intégré relié à un relais et à un module ESP.

The relay is controlled by a secondary chip on the module which is sent instructions(in hex format) from the ESP-01 through the TX /RX lines. This also gives you the ability to still use the IO2 pin for your project. To program the ESP-01 with the Arduino IDE you need to have a wire attached from the ESP-01 IO0 pin to common ground to enter flashing mode. I soldered a header pin on the top of the ESP-01 for easy access and also soldered a 90 degree angled header pin on the ground pin of the serial connection pins. Add a jumper wire and connect a USB to TTL module to RX, TX & GND pins of ESP8266 relay module. Then power up the module and you can flash your program through the Arduino IDE.

16042911244915377714189138

Avec le code sur GITHUBhttps://github.com/elac/ESP8266-WiFi-Relay-Module/blob/master/ESP8266%20Relay%20Sketch

 

 

*******************

Pour l’utiliser, connecter le module à un adaptateur USB puis employer un émulateur par exemple sous windows USR-TCP232 ou utilisation de l’interface arduino.

For work mode 1(cell phones carry on the WiFi module directly),you should send the flowing commands step by step :

1, AT+CWMODE=2, select AP mode;

2, AT+RST, reset;

3, AT+CIPMUX=1, open multiple connections;

4, AT+CIPSERVER=1,8080, configure the TCP server, set the port number;

5, AT+CIFSR, view the IP mode under the AP address, such as: APIP, “192.168.4.1″;

ecran

6,Connect to the AP of ESP8266 wifi module on Android cell phone

ap

7,Install the “EasyTCP_20” on the Android cell phone and open it, click “connect” and enter the IP address and port

Capture1.JPG

8, Press the function blocks and enter the name and content of the serial command

Capture2

8, Finally you can send serial command to control the relay by press the function blocks.

Capture3

For work mode 2(cell phone and wifi module carry on the same router),you should send the flowing commands step by step:

1, AT+CWMODE=1, that is, the choice of STA mode;

2, AT+RST, reset;

3, AT+CWJAP=, , let WiFi module connect to the router, where SSID And password for the WIFI name and password, for example: AT+CWJAP=”LCTECH “, »123456″;

4, AT+CIPMUX=1, open multiple connections;

5, AT+CIPSERVER=1,8080, configure the TCP server, set the port number;

6, AT+CIFSR, view the IP mode under the STA address, such as: STAIP, “192.168.1.118″;

7, Using cell phone connect to the router(LCTECH)

Capture4

Capture5

Kindly Remind:  1.ESP8266 module has a timeout mechanism, when the phone haven’t sent instructions to the ESP8266 module over a period of time (default is 180s) , the ESP8266 module will kick off your mobile phone, you can send

AT + CIPSTO = < time >  on the PC to modify this time (time range 0-7200), such as: AT + CIPSTO = 3600.

  • Module need to reconfigure after restart
  • If you want to use a computer to control relay, you can unplug the ESP8266 WiFi module,and TX ,RX ,GND pin of USB to TTL module connect to TX ,RX ,GND pin of ESP8266 relay module, IN+ and IN- connect to DC5V power,

Send serial command(A00101A2 open relay; A00100A1 closed relay,command format must be hex) with debugging software on the computer to control the relay.

Connexions :

NO-COM-NC puis bornier connexion ESP puis alimentation IN- IN+ (5vCC)

Module baud rate: 9600,8,1,0,0

To turn on write 0xA0, 0x01, 0x01, 0xA2
To turn off write 0xA0, 0x01, 0x00, 0xA1

const byte miBufferON[] = {0xA0, 0x01, 0x01, 0xA2};
Serial.write(miBufferON, sizeof(miBufferON));

To disable the Relay send it by serial port:
const byte miBufferOFF[] = {0xA0, 0x01, 0x00, 0xA1};
Serial.write(miBufferON, sizeof(miBufferOFF)); – See more at: http://www.esp8266.com/viewtopic.php?f=160&t=13164&start=8#sthash.4aYAM4Q0.dpuf

Fichiers sources ici

Articles récents
Commentaires récents
fatima dans Bienvenue !
AdminDroid dans Bienvenue !
fatima dans Bienvenue !
Archives
Catégories
%d blogueurs aiment cette page :