D1 mini lite won't connect to WLAN - arduino

I am building some simple IoT devices like tem / humi and window sensors for the house and would need some support with a simple method to connect a D1 mini lite to my WLAN.
There are already more than enough examples and tutorials out there to do this and I was already successful to connect a D1 mini and a Raspberry Zero with the sensors and to my WLAN and post some messages on a local MQTT server.
It was pretty clear and easy to do this and worked as I was told for the D1 mini and the Rasp Zero, but the D1 mini lite just won't connect to my WLAN. I kept the sketch (see code below) very simple and tried the exact same code for D1 mini and the D1 mini lite. The mini connects and the lite won't.
I am using the Arduino IDE and installed the additional board manager from here: http://arduino.esp8266.com/stable/package_esp8266com_index.json
For the D1 mini I chose "LOLIN(WEMOS) D1 R2 and mini" and for the D1 mini lite I chose "LOLIN(WEMOS) D1 mini Lite" under Tools->Board->ESP8266 Boards (3.0.2) (seems to be the most current one according to github)
The IDE gave me no errors on compiling or transferring to the board. The blue LED blinked on both boards when transferring the compiled sketch and when plugin in USB.
The serial monitor shows the IP of the connected WLAN for the D1 mini after 2 or so printed dots. The D1 mini lite keeps on printing dots without ever connecting or showing any other error / exception.
Is there a way to check the functionality of the wifi functionality of the board or to see why it was not able to connect? Any hint or link to documentation is appreciated.
I am not aware of having to use another other WiFi framework for the D1 mini lite as the one I used in the pretty much copy and pasted sketch. If this is the case would someone please let me know where this is mentioned to avoid future problems.
As I am very new to C++ - did I miss anything obvious? Please let me know and I will add the information or correct my beginners fault.
#include <ESP8266WiFi.h>
char ssid[] = "wlanssid";
char pass[] = "supersecretpassword";
void setup()
{
Serial.begin(115200);
Serial.println();
WiFi.begin(ssid, pass);
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {}
My settings in Arduino under Tools for the mini lite

Related

Unable to connect to WiFi with a Wemos S2 Mini clone?

I bought this Wemos S2 Mini three-pack from Amazon last week and I've been pulling my hair out trying to get them to connect to WiFi. I have the Ardiuno IDE 1.8.19 set to a LOLIN S2 Mini from Espressif 2.0.3 as directed, with Arduino WiFi 1.2.7, and am running this code:
#include <WiFi.h>
void setup() {
WiFi.mode(WIFI_STA);
WiFi.begin("ssid", "psk");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Connected to WiFi network with IP Address:");
Serial.println(WiFi.localIP());
}
void loop() {
//
}
All I get is endless ........ in the Serial Monitor. I've tried:
running the esp32 WiFi Scan samples and all I get is "no networks found"
attempting to rename my router's ssid to something without a space
connecting to my phone's hotspot
flashing all three boards
choosing other random ESP32-S2 dev boards in the Boards Manager
several different USB-C to USB-C and USB-C to USB-A cables into my computer
No dice. Bad hardware? What am I missing?
Purchased an actual LOLIN S2 Mini from AliExpress, ran the same code, worked immediately. Don't buy these shitty knockoffs from Amazon.
enable "Verbose" in Arduino for compilation - you will get all the
messages/errors to start with
make sure your AP does not have white/black list for MAC addresses
ssid/password ok? (sorry, but sometimes it happens)

ESP32 can't connect to iPhone Personal Hotspot

This is my code
#include <WiFi.h>
const char* ssid = "wifiname";
const char* password = "12345678";
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA); // SETS TO STATION MODE!
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(1000);
}
Serial.print("IP is ");
Serial.println(WiFi.localIP());
}
void loop() {
}
I can found my iPhone's personal hotspot using the WiFiscan routine, but I can't connect to it.
I tested your code and I was able to connect my ESP32 to my iPhone 8+. Since you were able to scan your iPhone's hotspot, you could try the following:
Make sure that you are using the 2.4GHz hotspot and NOT the 5GHz. If you have a iPhone 12, which now supports 5GHz hotspot, disable 5GHz by going to Settings -> Personal Hotspot -> enable(!) "Maximize compatibility"
Try to connect with an other wifi (in the 2.4GHz range)
(sounds stupid but): did you try to change the SSID and PW on your iPhone? Are you sure that your "ssid" and "password"-variable are both correct (no spelling mistakes)? For testing purposes you could even try to exclude special characters and only use letters and numbers.
If all fails it might be a HW issue. Did you try to use a different ESP32?
FWIW: I have apparently been able to connect the ESP32 chip's Wifi to my iPhone13 pro running IOS 15.3.1. The line of code:
WiFi.mode(WIFI_STA); // SETS TO STATION MODE!
was the break thru allowing me to make this connection. Note that I can make the connection even with settings->personal hotspot->Maximize Compatibility DISABLED.
I believe the iPhone hotspot turns off (or at least stops broadcasting an SSID) shortly after leaving the "Personal Hotspot" screen in "Settings". Leaving the "Personal Hotspot" screen open with my iPhone unlocked allowed me to connect my ESP32.
This Apple support discussion from 2011 describes the behavior (assuming it hasn't changed in the last decade): https://discussions.apple.com/thread/2784174
For me, the apostrophe in the default hotspot SSID was problematic (ex: John Doe's iPhone). I changed the iPhone name (and therefore the SSID name) in Settings > General > About. Afterwards, my ESP32 was able to connect to the hotspot.
Potential caveat: instead of programming the firmware directly, I was using ESP Web Tools to configure the ESP32 with ESPHome, so my issue may have been specific to the ESPHome firmware (and how it handles character encodings).
I find a solution for that issue by trials and may be it could help :
1.You have to be in the iPhone hotspot settings when the ESP32 is trying to connect specially if there's no other device connected to the hotspot!
2.Hotspot works fine until the phone gets locked and ESP32 went to deep-sleep and after wake up the ESP32 cannot connect again in some cases until you go again to the hotspot page!

Connect Arduino to Blynk with ESP8266

so I got my Arduino Uno today. For a porject I want to be able to control some relays on my Arduino via Wifi (via Blynk app). For this I want to use the ESP8266-01 as a Wifi shield.
I used this tutorial: https://create.arduino.cc/projecthub/nolan-mathews/connect-to-blynk-using-esp8266-as-arduino-uno-wifi-shield-m1-46a453
Only difference is I'm using Win10. Here is what I got:
Arduino Uno R3
Arduino IDE 1.8.1
included all Blynk/ESP libraries and installed ESP8266 as board (generic)
uploaded empty sketch to the Arduino
Connections to Between Arduino/ESP as follows . http://www.teomaragakis.com/hardware/electronics/how-to-connect-an-esp8266-to-an-arduino-uno/ (I know about to 3.3V to 5V issue but seems to work so far)
Okay, first problem is that I couldnt flash the Firmware of the ESP (got it from Sunfounder) as said in the Tutorial. Downloaded the latest firmware and flashed it with ESP8266Flasher.
Other Problem that is when I try to compile the code from the first tutorial, I always get error :
C:\Users\Chris\Documents\Arduino\libraries\Blynk\examples\Boards_WiFi\ESP8266_Shield\ESP8266_Shield.ino:5:21: fatal error: ESP8266.h: No such file or directory
As said I have installed all libraries. Cant really think of things to do anymore. Any help would be much appreciated. Best regards from Berlin, Chris.
To close the code I try to upload to the board (both Arduino Board or generic ESP8266 does not work)
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266.h>
#include <BlynkSimpleShieldEsp8266.h>
// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "???";
void setup()
{
Serial.begin(115200); // Set console baud rate
delay(10);
EspSerial.begin(115200); // Set ESP8266 baud rate
delay(10);
Blynk.begin(auth, wifi, "???",
"???");
}
void loop()
{
Blynk.run();
}
The ??? I switched for my token and data ofc.
Try changing this
#include <ESP8266.h>
to this
#include <ESP8266_Lib.h>
The file was renamed in this commit.

Serial port programming in Galileo

I am new to Intel Galileo. I am trying simple things. How do I use serial TX(Digital pin 1) and serial RX(Digital pin 0) for communicating with other UART devices ? Which serial port is this UART ?
I tried to connect it by configuring it as uart 0/1/2 but did not work.
void setup() {
Serial1.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial1.println("Hello Galileo");
delay(300);
}
I have never used the Galileo but I was not aware that it had more than 1 serial port. So basing my thinking on the UNO as well as the MEGA, pin 0 and 1 should not be Serial1 but just Serial, meaning that if you connect the TX pin to the RX pin of another device and then, as you posted above, run your code with Serial.begin(9600); and Serial.println.... instead of Serial1.... it should work as far as I know... Also, I sometimes use Serial.Write but I am unsure of what the difference is. I normally would not answer a question I don't know the exact solution to but as there are no answers yet I thought I would give it a try.
I'm using a Gen2 and the latest build of Windows IoT (9600.16384.x86fre.winblue_rtm_iotbuild.150309-0310_galileo_v2). In that build, Serial is the correct object for COM1 on pins D0 and D1 and I've used it successfully.
Serial1 is supposed to be COM2 on D2 and D3, but I get an error when I try to open it. I'm still working on that.

arduino suddenly shows "avrdude: ser_open(): can't open device "\\.\COM3" after last upload

I am using arduino uno to make a sound detector.
I uploaded a program, found error in the code that it returns unintended numbers unreasonably big. I also think I used wrong code for the module, but it was connected in the way that can work properly with the proper code.
The code I uploaded was:
const int ledPin =13;
const int middleValue = 512;
const int numberOfSamples =128;
int sample;
long signal;
long averageReading;
long runningAverage = 0;
const int averagedOver = 16;
const int threshold=400;
void setup(){
pinMode(ledPin, OUTPUT)
Serial.begin(9600)
}
void loop(){
long sumOfSquares = 0;
for (int i=0; i<numberOfSamples; i++){
sample = analogRead(0);
signal = (sample - middleValue);
signal *= signal;
sumOfSquares += signal;
}
averageReading = sumOfSquares/numberOfSamples;
runningAverage=(((averagedOver -1 )*runningAverage)+averageReading)/averagedOver;
if(runningAverage>threshold){
digitalWrite(ledPin, HIGH);
}else{
digitalWrite(ledPin, LOW);
}
Serial.println(runningAverage);
}
When the arduino suddenly stopped sending serial numbers, I pressed reset button and uploaded the default code:
void setup() {
}
void loop() {
}
but now it shows that it cannot connect to COM3 (arduino) and cant find the device, When I can see arduino uno successfully connected to PC using device manager (windows 8.1). The led light of arduino also turns on when I connect it to power source or usb.
it shows "port not found" when I click to see the serial output
Did I just fry Arduino?
How should I fix this?
Also, i checked the led pin 13 blinking three times when i plug in the usb. I just cant upload anything
What worked for me:
Tools>Port>(your COM)
Just selecting that solved the error.
You should do a few checks in order to jump to a conclusion, your Arduino may be just fine. As far as I know, Code cannot destroy a controller.
Check if any other software is using the same serial port. Two softwares cannot use the same serial port at the same time
Restart your PC and then try again
Remove the Microcontroller from the board, connect it to the PC and try to open the com port. If it opens then connect your Tx pin with the Rx pin, send some data and check if you are getting the data back. This way you will ensure your USB-TTL converter is fine
If this goes successful, then insert your microcontroller in some other board and check if it is getting programmed
I am sure after these checks you will find out the reason of the failure of your board/microcontroller.
Yes, check everything.... especially the USB cable or the USB port. It is crucial. My problem was just dirt on the computer USB port. Dirt, dust and grime. Crazy isn't it ? Just clean up the USB port and connector and the problem solve.
I also had a same problem and solved it.
try this one.
1. disconnect all cables from your arduino
2. connect external power
3. connect usb cable
4. then upload it.
I used my arduino with CNC shield(GRBL) and plugged external power to arduino.
after this. it was not possible to upload new firmware to arduino with usb cable only.
Once you success to upload with usb + external power then you can upload any firmware with usb cable only.
To solve the problem.
Method-1:
Go to Tools>Port>Select the Port
Method-2:
Unplug your board and plug it back in.
Method-3:
Restart your computer or laptop and reinstall Arduino software.
For more details you can visit "https://arduinopoint.com/fix-most-common-error-uploading-to-arduino/"

Resources