Wemos Mega/Arduino Mega + ESP8266 Problems getting signal strenght (rssi)

Hello Friends,

I have a Problem with my project.

I use this Arduino Mega Board with build in ESP8266:

After flashing the ESP8266 with the latest AT Firmware that is supportet by Blynk (>see getting startet)
everything works fine.

The ESP connects to blynk, i can upload a sketch to the mega, and my blink app shows me my sensor data.

now i want to get the signal strengh printet to the serial monitor and to virtual pin V7.

the problem is, that the value is everytime “0”.

do this lib wiFi.h dont work with the esp? or what do i wrong.

thank you for your help and sorry for my bad english.

Here is my code:

#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)

#define ONE_WIRE_BUS 2 //ds18b20 module attach to pin2
OneWire oneWire(ONE_WIRE_BUS);// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// 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[] = "WLAN-NSTZNK 2,4GHz";
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);

BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void pressure()
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, (analogRead(A0)-102)*13.7895/819);
  Serial.print("Press: ");

void getTemp()
  sensors.requestTemperatures(); // Send the command to get temperatures
  Blynk.virtualWrite(V6, sensors.getTempCByIndex(0));
  Serial.print("Temp: ");

void wlansignal()
  long rssi = WiFi.RSSI();
  Blynk.virtualWrite(V7, WiFi.RSSI());

void setup()
  // Debug console
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 

  sensors.begin(); // initialize the bus

  // Set ESP8266 baud rate

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

  // Setup a function to be called every second
  timer.setInterval(2000L, pressure);
  timer.setInterval(10000L, getTemp);
  timer.setInterval(4000L, wlansignal);

void loop()
  timer.run(); // Initiates BlynkTimer

And the serial monitor:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.4 on Arduino Mega

[713] Connecting to WLAN-NSTZNK 2,4GHz
AT version: 11 2016 18:09:56)
SDK version:1.5.4(baaeaebb)
Ai-Thinker Technology Co. Ltd.
Jun 13 2016 11:29:20
[8922] +CIFSR:STAIP,""
[8929] Connected to WiFi
[19408] Ready (ping: 13ms).
Press: 101
Press: 102
Press: 116
Press: 101
Temp: 19.31

best regards!

As far as I have seen and tried, you can not do that with an Arduino/ESP-as-shield setup… as the device actually doing the WiFi stuff is in a simple transceiver mode and not directly accessible by the Arduino code (as that connection is busy with the Serial-ESP link).

1 Like

Thank you Gunner, i set up an wemos d1 mini pro too, that works very fine. Compared to that Mega-thing is 10 times faster (connecting and ping) mhhh but I need more i/o, is there a way to expand the gpios on the wemos?

Best regards

Heh, I was just referencing that on another topic… you can use ESP32 for the most available pins in the ESP class, or use other multi-device methods… multiple devices in one project, each controlling their section… even sharing info across projects with Bridge widget if needed

Or using a Standalone ESP running Blynk code monitoring and controlling an Arduino running basic code, via other connectivity (Serial or I2C)

1 Like

Thank you again =)

Mhhh an ESP32/NodeMCU is no option for me, I need the plug for the external antenna, that’s why I use Wemos pro too. =(

Do you know if blynk works with this port expander?

There are ESP32 boards that use external antennas as well.

Also, be sure you have moved the 0 ohm resistor to the proper position on the Wemos D1 Mini (a finicky soldering job that one :stuck_out_tongue: ), else you are actually still using the internal antenna even though you plugged in the external one.

Also be aware that many 2.4Ghz antennas are actually poorly made and may be even worse then the internal ones. You pretty much need proper antenna test equipment to determine it they actually perform as claimed.

Sure… Blynk doesn’t actually care what hardware you connect to your MCU. With Virtual Pins in your code, you can control any other port expanders via whatever codes they requiree

1 Like

As @Gunner said, there are, or there’s the ESP32 option.
However, it might be better to look at using multiple ESP8266 devices. I find that it’s very rare that all of the sensors, relays etc that you want to control area actually in the same physical location. If this is the case then the project lends itself to using multiple ESPs in different locations.
Even if all of your sensors etc are in the same location, there’s often something to be said tor taking a modular approach to the hardware configuration. This can make it a bit harder to set-up in the first instance, but easier to diagnose and troubleshoot issues in the future - when something stops working. It also make scalability easier, as when you run out of available points on one device, you just add another alongside it.

Also on the subject of available pins on the ESP8266, you have fewer than you think anyway. You should read this:


1 Like

Thank you Gunner and Pete!

@Gunner: yes i switched the position of the 0ohm resistor to external antenna (no chance with my soldering iron :joy::joy::joy: I used a mini heat gun (Dremel)) the effect was +10dbm in compare to the internal ceramic antenna! The internal antenna would be good enough for my project, but at the end, the wemos is in a steel case with 2mm thickness… that’s why I need the external :wink:

I think I try the wemos d1 mini pro with this gpio expander:

Thank you both again for your kindly help!

1 Like