Herramientas de usuario

Herramientas del sitio


Barra lateral

anakino_aquarium_v2:preparando_mega_wifi

Nueva placa Mega Wifi

Características

Preparación

La placa hay que hacerle unos cambios para que sea compatible con Blynk.

Para conectar el Robotdyn mega a Blynk necesitas hacer los siguientes pasos:

  1. Flash ESP
  2. Subir código
  3. Ajuste de switches

This was a quick overview. Now let’s go to do it.

Flash ESP

I flashed new official firmware from here: https://espressif.com/en/support/download/sdks-demos 30 I used version v1.5.4 and patch V1.5.4.1 Patch_20160704

I used Flash Download Tools v3.4.4 tool from here: https://espressif.com/en/support/download/other-tools 17

I used instructions from here: http://remotexy.com/en/help/esp8266-firmware-update/ 20

In the bin folder coming from the .zip file are the files needed to flash the ESP8266.

Please note that in the folder from the patch is a newer esp_init_data_default.bin file to be used. In the AT folder under the bin file are folders and files.

In the README.txt file are instruction on what file to store where in the ESP8266 memory location. As the Robotdyn UNO + WiFi has ESP8266 which is stated to be 8Mb I used:

Which means files from the 512+512 were used.

After flashing the ESP it finally started to reply to AT commands.

Flash size 32Mbit: 512KB+512KB

boot_v1.2+.bin              0x00000
user1.1024.new.2.bin        0x01000
esp_init_data_default.bin   0x3fc000 (optional)
blank.bin                   0x7e000 & 0x3fe000

Upload code

Para subir el código es importante fijarse en los interruptores:

1- OFF
2- OFF
3- ON
4- ON
5- OFF
6- OFF
7- OFF
RXD0 x TXD0
Be very careful with dip-switch! 2.1. For this task, dip setting should be 3.ON 4.ON others are OFF. 2.2.I have downloaded an example 5 and made some changes. 2.3. You need to change Serial from 1 to 3 like this: #define EspSerial Serial3. (exactly this i was solving four months) Code should look like this:

#define BLYNK_PRINT Serial


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "...";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "...";
char pass[] = "...";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial3

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

void setup()
{
  // Debug console
  Serial.begin(9600);
  delay(10);

  // Set ESP8266 baud rate;
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

Esto es el código mínimo para conectar la placa y probarlo. Cuando la conexión sea satisfactoria podrás ver como el status de tu aplicación Blynk pasa a estar ONLINE.

Ajuste de los interruptores

Para que funcione el código deben estar los interruptores así.

1- ON
2- ON
3- ON
4- ON
5- OFF
6- OFF
7- OFF
RXD3 x TXD3
3.1. esto permite la comunicación entre el MEGA y el ESP8266 y el puerto serie en tu PC. This setting let you see serial print and at the same time it will communicate with ESP. 3.2. switch near ICSP set to After moving all necessary switches go to the next step.

Conecta la placa, abre tu aplicación y tomate una cerveza!

That’s all folks…

Problemática.

Wrong Dip-setting Weak WIFI signal Wrong SSID, PASS, AUTH Use external power supply Possibly it could be high baud of ESP (never happen to me). You can reduce it to 9600 (to the same level as Serial.print) For reducing baud use this

AT+UART_DEF=9600,8,1,0,0
or

AT+CIOBAUD=9600
it should reply

OK

anakino_aquarium_v2/preparando_mega_wifi.txt · Última modificación: 2019/01/09 20:07 por anakino7