I use the code below with a wemos d1 mini and it works fine. I receive the voltage sent by wemos on my phone in my blynk app.
Then i replace my wemos d1 mini by a similar version with external antena. (both from alliexpress).
And now my blynk app always says that my device is offline.
As soon as i replace with original wemos, my device appears online and send data.
I look here for a solution but i don’t find one.
Thank you for helping me.
/* Transmission de l'état de la batterie (tension) du camping-car à l'application Androïd "Blynk".
La communication se fait en Wifi; le camping-car doit donc être à portée d'un réseau connu.
Le smartphone peut avoir une liaison wifi sur le même point d'accès ou être connecté en mode data (4G).
Matériel utilisé: un circuit ESP8266 et un potentiomêtre côté emetteur
et un smartphone Androïd avec l'application Blynk côté récepteur.
La tension maximale sur la broche A0 ne devant pas dépasser 3,3V, la batterie à surveiller est connectée
aux extrémités d'un pont diviseur 12k-3k qui abaisse ainsi la tension à 3,3V maxi pour 15V.
Le signal "+" prélevé sur le centre du pont diviseur est injecté sur la broche A0 de l'Esp8266.
Le "-" de la batterie étant connecté sur la broche G (ground) de l'Esp8266.
Le code ci-après échantillonne la tension toutes les secondes grace au timer et l'envoie à l'application.
*/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "xxxxxxxxxxxxxxxxxxx"; /* Token obtenu à la création de l'application Blynk */
char ssid[] = "xxxxxxxxxx"; /* Réseau wifi */
char pass[] = "xxxxxxxxxxxxxxxx";
int sensorData ; /* Variable pour la valeur (tension) lue sur la pin choisie (A0) */
BlynkTimer timer; /* Création d'un objet de type "timer" de Blynk auquel on donne aussi le nom de timer */
void myTimerEvent() /* Gestion de l'évènement timer (quand le temps, défini par timer.setInterval plus bas, est écoulé) */
{
sensorData = analogRead(A0); /* Lecture de la valeur sur la pin A0 et transfert dans sensorData */
Blynk.virtualWrite(V5, round(sensorData * 15) / 1023); /* La valeur lue, comprise entre 0 et 1023, est convertie
en une valeur de 0 à 15 puis transmise à l'application Blynk */
}
void setup() /* Séquence d'initialisation */
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass); /* Connexion au réseau wifi */
timer.setInterval(1000L, myTimerEvent); /* Définition de la temporisation de l'objet timer de Blynk */
}
void loop() /* Programme principal */
{
Blynk.run(); /* Connexion à l'application Blink correspondant au token */
timer.run(); // Initiates BlynkTimer /* Démarrage du timer de Blink
}
I guess this is quite a hardware issue, not software. The mini pro has onboard “jumper” (0 ohm resistor) to switch from internal to external antenna. Had you set it up accordingly?
yes i see the “0 ohm resistor”. But i have “fing” app on my phone and i see my wemos d1 mini pro. It is connected to my wifi. Perhaps i’ll have better range removing the “0 ohm resistor” but is this sufficient to prevent me from reaching my blynk app on my phone.
Have you tried to create a new auth token from the app? - Maybe also change the hardware type on the app, or I think you can even add a new device to an existing project? (Which I think will give you new auth token also).
If you’re actually using the external antenna connector on the D1 Mini Pro then the
zero ohm connector needs to be moved. If not the leave it in its original position and it works the same as a standard (non-Pro) version with the onboard antenna created with a squiggly track on the PCB.
The external antenna needs to be designed to operate on the 2.4GHz frequency.
However, it sounds like you have a different issue, if you can see your device using Fing. The bet starting point is to see what is coming out of the serial monitor on your D1 Mini Pro.
Yes i tried new auth twice without success. Ok with wemos d1 mini but not with d1 mini pro (with antenna).
I changed the harware type too, but no effect.
Yes, I use the D1 Mini Pro, they work fine.
You say:
In your photo, the zero ohm resistor hasn’t been moved, so attaching an external antenna will make absolutely no difference - the built-in antenna (the white ceramic thing with “Rainsun” written on it) is what’s being used.
Sure! they are the obvious choice, when an external antenna is needed. And as @PeteKnight had pointed ONLY THEN the 0ohm resistor needs to be MOVED (or replaced with simple solder shunt)
And your issue… I don’t know. It connects to WIFI, obtains IP, and then can’t reach host. DNS issue??
When I look closely at the circuit board near the antenna and do some tests with my ohmmeter, it seems that the antenna is isolated from everything else. So removing 0 ohm resistor will desable internal antenna but not sure it’s enough fot activating external intenna. Don’t we need to connect the 0 ohm resistor or some jumper to extenal antenna ?
So thank you for these clarifications but first of all and whatever the antenna chosen i should be able to connect to blynk. Isn’t it !