Git Product home page Git Product logo

wifinina's Introduction

WiFiNINA library for Arduino

Check Arduino status Compile Examples status Spell Check status

Enables network connection (local and Internet) with the Arduino MKR WiFi 1010, Arduino MKR VIDOR 4000 and Arduino Uno WiFi Rev.2.

With this library you can instantiate Servers, Clients and send/receive UDP packets through WiFi. The board can connect either to open or encrypted networks (WEP, WPA). The IP address can be assigned statically or through a DHCP. The library can also manage DNS.

For more information about this library please visit us at https://www.arduino.cc/reference/en/libraries/wifinina/

License

Copyright (c) 2018 Arduino SA. All rights reserved. Copyright (c) 2011-2014 Arduino LLC. All right reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

wifinina's People

Contributors

aentinger avatar agdl avatar alranel avatar cmaglie avatar damellis avatar dependabot[bot] avatar egueli avatar facchinm avatar fede85 avatar fmatray avatar giulcioffi avatar hasenradball avatar karlsoderby avatar luigigubello avatar markpatterson27 avatar mlafauci avatar ncguk avatar pennam avatar per1234 avatar rocketct avatar sami-m avatar sandeepmistry avatar shfitz avatar stevisco avatar thekunalsaini avatar tigoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wifinina's Issues

WiFiNINA_OTA ?

Hi all,

Are there plans for a WifiNINA_OTA library like you have for the MKR1000 board ? Or.. is there somewhere a library that is allowing OTA programming ?

Thanks for your input

MKR1010 WiFi Latency with web response time

We are experience a 2 second latency with all of the basic web server code examples. Our testing environment included UniFi UAP LR and UAP-Pro's via WPA with standard security. We also tested a TP-Link WA801ND. The MKR1000 yield an almost immediate response for the SimpleWebServer. Ethernet products (Leonardo Eth and Arduino Ethernet) contain an almost immediate response similar to the MKR1000 on wireless. Sandeepmistry requested we open a ticket.

He stated "I think byte by byte reads from sockets can be optimized inside the library to avoid this behavior."

FirmwareUpdater not work for Arduino WiFi Rev2

Hi

I'm trying to update the esp32 module on the arduino wifi rev2, but nothing comes out on the serial monitor

I have tried the CheckFirmwareVersion and

`WiFiNINA firmware check.

Firmware version installed: 1.0.0
Latest firmware version available : 1.2.0

Check result: NOT PASSED

  • The firmware version on the module do not match the
    version required by the library, you may experience
    issues or failures.
    `
    My arduino IDE is HourlyBird 1.8.8

Thanks

WPA2 Enterprise?

Are there any plans for developing capability to connect with WPA2 Enterprise? I am interested in using the Arduino MKR WiFi 1010 with a WPA2 Enterprise connection. Apologies if this is duplicated elsewhere.

IP broadcast in AP mode results in packet loss

Hi folks,

I have observed an issue when sending UDP broadcast messages with my Arduino MKR WiFi 1010.

When running the Arduino as access point (AP mode, using WiFi.beginAP()) more than 80% of my packets are dropped (checked with Wireshark).

When connecting the Arduino to an existing access point (station mode, using WiFi.begin()) everything works as expected with rest of my code unchanged.

If I am using IP unicast instead of broadcast, both variants work as expected.

That's why I think that I hit a bug in WiFiNINA related to IP broadcast in AP mode.

Arduino version is 1.8.9, WiFi firmware version is 1.2.1.

Here is my example sketch:

#include <WiFiNINA.h>
#include <WiFiUdp.h>

char ssid[] = "broadcasttest";
WiFiUDP Udp;
int count=0;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
    Serial.println("Please upgrade the firmware");
  } else {
    Serial.print("Firmware:");
    Serial.println(fv);
  }

  Serial.println("\nConnecting to WiFi.../Creating AP...");
  //WiFi.begin(ssid);
  WiFi.beginAP(ssid);
  Serial.println("Ready!");
  printWifiStatus();
  Udp.begin(2323);
}

void loop() {
    Udp.beginPacket(IPAddress(255,255,255,255), 7373);
    Udp.write((byte)40);
    if (!Udp.endPacket()) Serial.println("Error sending packet!"); else Serial.println("Packet sent!");
    Serial.println(count++);
    delay(1000);
}

void printWifiStatus() {
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
}

uno wifi rev 2 firmware

sorry if this is not the right place to post, but I updated the firmware and tried uploading the AP_SimpleWebServer example and it fails to create an access point so I uploaded the firmware check and it tells me to put on 1.2.0, so I went back to the firmwareupdater sketch and the firmware tool only shows 1.2.1
1.1.0
1.0.0

WiFiNINA firmware check.
Firmware version installed: 1.2.1
Latest firmware version available : 1.2.0
Check result: NOT PASSED

  • The firmware version on the module do not match the
    version required by the library, you may experience
    issues or failures.

if this is the wrong place to post let me know where is more appropriate that this team checks
Thanks
wifiuno firmware

MKR 1010 - WiFi status always returns 1 when using reserved dhcp ip

WiFiNiNA version : 1.2
Board : MKR 1010
Board version : 1.1

I am using a meraki acces point. I noticed that the MKR returns 1 as its wifi status whenever I turn on a DHCP reservation for it. I will test on other routers I have lying around but it consistently happens with the current WiFi setup I have. Let me know if you would like the AP logs.

The result of WifiWebClient example is a redirection link

Using the MKR1010, the result of this example is a message that says "Click here if you are not redirected in a moment", however when I try the corresponding example in the wifi101 library with the MKR1000, the result is as expected.

Expected latency for UDP?

Hi - I'm doing some tests using UdpClient, both multicast and on a regular port. I updated to the latest firmware yesterday.

There's some latency - looks like around 200ms as best I can tell, although it does vary a lot. I'm basically using (pseudocode-ish):

WiFi.setHostname("blop1"); // this doesn't work, by the way - hostname is `arduino-1ce0`
WiFi.begin("my network", "pass..");
udp1 = WiFiUDP();
udp1.beginMulticast(IPAddress(226,1,1,1), 4096);
udp2 = WiFiUDP();
udp2.begin(4096);

void loop() {
  int d;
  d = udp1.parsePacket();
  if (d > 0) { /*  invert LED */ }
  d = udp2.parsePacket();
  if (d > 0) { /*  invert LED */ }
}

If I hit the send button on my laptop every second, it inverts the LED every second, after a delay.

If I spam the send button (4 per second say?), they seem to get batched or something.. it kind of tends to tend towards on or off, flickering to the other. If I slow down, it's even again.

Is that kind of latency expected? I'm hoping for <50ms, ideally..

(I'm good for using any means to get this latency down. I'm fine to use multicast to discover devices, then establish a TCP connection for instance... but am keen to understand where the issue lies first! Any tips or pointers greatly appreciated!)

(Bonus edit: so I've timed parsePacket() at 4 microseconds, so it doesn't look like slow SPI comms. Can anyone help narrow this down?)

MKR WiFi 1010 not connecting to wifi

Yesterday, my code worked nicely at first, but without any code changes it stopped working after I soldered the arduino to a protoboard. I took care not to put the soldering iron on it for more than a second, and used a really low-temperature solder with a really low temperature setting on my soldering iron. After soldering, I can still communicate with the WiFi chip, as the example sketches for scanning networks don't complain that they can't find the module. I can fetch the firmware version for it as well.

But any task that involves the antenna seem to fail. ScanNetworks gives me 0 available networks, and my program gets stuck on trying to connect. Could I have overheated the antenna or am I using any pins that should be reserved for the WiFi chip? I am using pins 0 to 11 and the 5v, vcc and ground.

Schematic, using an arduino uno as my program for creating schematics doesn't have the MKR WiFi 1010 yet

EDIT: I tried upgrading the firmware version to the latest (1.2.1) in case I had ran into some bug with voltage instabilities or something (unlikely, I know... But at least I tried to fix it :)). The upgrade completed without any issues and the CheckFirmwareVersion example shows the correct firmware version.

failure to connect to AP with WAP

Hello,

I have a problem with 2 MKR WIFI 1010 board to connected on a extended wifi router (TPLink RE650).
The Wifi.status result is alway 1 (WL_NO_SSID_AVAIL) but the router indicate to me that the board is connected and I can also ping it.
Any other device connects to it and so do 2 MKR1000 boards on the latest firmware 19.5.4.

Any help is greatly appreciated.
thanks

failure to connect to hotspots

I have not been able to connect a MKR1010 to WPA2 mobile hotspots.
I have a Huawei E5337 setup as 2.4GHz only and an iPhone 8 with enabled Personal Hotspot.
Any other device connects to it and so do 3 MKR1000 boards on the latest firmware 19.5.4.

Any help is greatly appreciated.

thanks
ubi

TLS fails for io.adafruit.com

I'm having trouble connecting with TLS on the Arduino MKR 1010. I have a sketch that sends data to io.adafruit.com via MQTT. The code works fine for a non-encrypted connection on port 1883, but fails to connect to the MQTT broker using WiFiSSLClient on port 8883. I don't think this is a server problem. I have a MKR GSM 1400 using MQTTS on io.adafruit.com.

The MQTT server appears to be using the same SSL certificate as https://io.adafruit.com so I modified the WiFiSSLClient example to load https://io.adafruit.com/api/docs/. The MKR 1010 connects but fails to load any content before disconnecting.

dev_cu_usbmodem1461__arduino_mkr_wifi_1010

Is this a certificate problem? Any ideas on how to debug this?

Environment:
Arduino IDE 1.8.7
macOS 10.13.6
WiFiNINA 1.1.1

/*
This example creates a client object that connects and transfers
data using always SSL.

It is compatible with the methods normally related to plain
connections, like client.connect(host, port).

Written by Arturo Guadalupi
last revision November 2015

*/

#include <SPI.h>
#include <WiFiNINA.h>

#include "arduino_secrets.h" 
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
char server[] = "io.adafruit.com";    

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
WiFiSSLClient client;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv != "1.0.0") {
    Serial.println("Please upgrade the firmware");
  }

  // attempt to connect to WiFi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
  Serial.println("Connected to wifi");
  printWiFiStatus();

  Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  if (client.connect(server, 443)) {
    Serial.println("connected to server");
    // Make a HTTP request:
    client.println("GET /api/docs/ HTTP/1.1");
    client.println("Host: io.adafruit.com");
    client.println("Connection: close");
    client.println();
  }
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  while (client.available()) {
    char c = client.read();
    Serial.write(c);
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting from server.");
    client.stop();

    // do nothing forevermore:
    while (true);
  }
}


void printWiFiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

printMacAddress()

The printMacAddress() function in the ScanNetworks example returns an 11 character MAC address of the form:

AA:BB:CC:11:2:33

instead of:

AA:BB:CC:11:22:33

Software/hardware: OS X Yosemite, Arduino IDE 1.8.5, Arduino MKR WiFi 1010

does not connect to wifi

good afternoon, there is a problem connecting to the internet, board MKR WIFI 1010, Library Wifinina 1.3.0
image

Lacking API documentation

The library is very frustrating to use due to its lacking documentation. The reference page http://www.arduino.cc/en/Reference/WiFiNINA fails to mention the existence of several functions. For example I needed to use the following functions, for which no documentation was provided or some function overloads were not mentioned:

  • WiFi.channel(wifiAccessPoint)
  • WiFi.BSSID(wifiAccessPoint, bssid)

WiFi Rev 2 - connecting to local network?

I am using Airport Extreme Base Station as a WLAN router. I wanted to add my Arduino Uno WiFi rev 2 units to this local area network. When the router is connected to internet via ethernet cable to router from the wall, the Arduinos using WiFiNINA establish connection reliably.

However, when the router is disconnected from the internet to create a WLAN, my Arduinos keep repeating "Attempting to connect to SSID: XXXXXX", and never establishes connection. I am using WiFiUdpSendReceiveString example. I want to have Arduinos communicating in local network environment, so that latencies are faster and more reliable.

I am a noob in networking, and searched a lot of information. Things I have tried:

  • I tested the local area connection using two computers, and they successfully send and receive udp messages, so the WLAN itself isn't the problem.
  • The computers get self-assigned ip when it's connected to WLAN, so I suspected maybe WiFiNINA had trouble retrieving an IP address? So I tried assigning static ip, using WiFi.config(ip), but unsuccessful.
  • I tried putting WiFi.disconnect(); before WiFi.config(ip), since apparently this is a work-around for some people, but unsuccessful.

Please help! This is very important to me.

#include <SPI.h>
#include <WiFiNINA.h>
#include <WiFiUdp.h>

int status = WL_IDLE_STATUS;
#include "arduino_secrets.h" 
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

unsigned int localPort = 2390;      // local port to listen on
unsigned int sendPort = 2391; // local port to send msg

char packetBuffer[255]; //buffer to hold incoming packet
char  ReplyBuffer[] = "acknowledged";       // a string to send back

IPAddress ip(192, 168, 0, 177);
WiFiUDP Udp;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < "1.0.0") {
    Serial.println("Please upgrade the firmware");
  }

  //WiFi.end();
  //WiFi.disconnect();
  WiFi.config(ip);

  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    
    status = WiFi.begin(ssid, pass);

    //Serial.println(status);

    // wait 10 seconds for connection:
    delay(10000);
  }
  Serial.println("Connected to wifi");
  printWifiStatus();

  Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  Udp.begin(localPort);

  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
  #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
    clock_prescale_set(clock_div_1);
  #endif
    // END of Trinket-specific code.
  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
  blinkLights();
}

void loop() {
...
}

Deep sleep

Hi,

We are developing a station that reads some sensors and after reading send the info to the server. After this process goes to sleep.

We are using MKRFOX1200 and low-power library and It works, but when I'm using with mkr wifi1010 the module still consumes energy in a voracious way.

IS it possible to cut the energy to hall mkrwifi1010? or deep sleep the wifi module?

thank's for your help

Eduard

Version 1.1.1 does not accept Scheduler

I have a code with a Scheduler and it does not work with 1.1.1. With 1.1.0 everything was fine.
The code that I tested is

#include "secrets.h"
#include <SPI.h>
#include <WiFiNINA.h>
#include <Scheduler.h>

// WIFI
WiFiClient client;
IPAddress server(SERVER_ADDRESS);

void setup() {
  Serial.begin(115200);
  while (!Serial);

  //  Serial.println(sizeof(DataRecord));

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    while (1);
  }

  Serial.print("Firmware: ");
  Serial.println(WiFi.firmwareVersion());
  if ((String)WiFi.firmwareVersion() != "1.0.0") {
    Serial.println("Please upgrade the firmware");
  }

  connectToWiFi();

  Scheduler.startLoop(sendDataLoop);
}

void loop() {
  Serial.println(millis());
  delay(1000);
}

void sendDataLoop() {
  connectToWiFi();

  httpPOSTData();
  delay(1000);
}

char request_response[1024] = { 0 };
int request_response_len = 0;
int request_status = 0;
char c;

bool httpPOSTData() {
  Serial.println("Trying to send data");

  if (client.connect(server, SERVER_PORT)) {
    Serial.println("connecting...");

    client.println("POST "SERVER_PATH" HTTP/1.1");
    client.println("Host: 127.0.0.1");
    client.println("User-Agent: ArduinoWiFi/1.1");
    client.println("Connection: close");
    client.println("Content-Type: application/octet-stream");
    client.println("Content-Length: 5");
    client.println();
    client.println("abcde");
    client.println();

    request_response_len = 0;
    request_status = 0;

    while (!client.available()) {
    }

    // Getting status
    while (client.available()) {
      c = client.read();
      request_response[request_response_len] = c;
      request_response_len++;

      if (request_response_len == 12) {
        request_status = ((request_response[9] - '0') * 10 + (request_response[10] - '0')) * 10 + (request_response[11] - '0');
        Serial.print("Request status: ");
        Serial.println(request_status);

        if (request_status >= 400) {
          Serial.println("SERVER/CLIENT ERROR");
          client.flush();
          client.stop();
          return false;
        }
        else {
          memset(request_response, 0, sizeof(request_response));
          request_response_len = 0;
          break;
        }
      }
    }

    // Getting headers
    while (client.available()) {
      c = client.read();
      request_response[request_response_len] = c;
      request_response_len++;

      if (request_response[request_response_len - 4] == '\r' &&
          request_response[request_response_len - 3] == '\n' &&
          request_response[request_response_len - 2] == '\r' &&
          request_response[request_response_len - 1] == '\n') {
        memset(request_response, 0, sizeof(request_response));
        request_response_len = 0;
        break;
      }
    }

    // Geting payload
    while (client.available()) {
      c = client.read();
      request_response[request_response_len] = c;
      request_response_len++;
    }
    Serial.print("PAYLOAD: ");
    Serial.println(request_response);

    client.flush();
    client.stop();
    return true;
  } else {
    Serial.println("connection failed");
    client.stop();
    return false;
  }
}

void connectToWiFi() {
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(SECRET_SSID);

    WiFi.begin(SECRET_SSID, SECRET_PASS);
  }
  Serial.println();
  Serial.print("CONNECTED TO: ");
  Serial.println(SECRET_SSID);
  Serial.print("signal strength (RSSI):");
  Serial.println(WiFi.RSSI());
  Serial.println();
}

It freezes after Serial.println("connecting...");

Get Server status and restart

Hello

currently i use the function "server.begin ()" to launch the web server on my arduino and it works very well. However I noticed that after several wifi disconnection the server ended up crashing.
My problem is that I do not see any function to obtain the state of the server or to restart it.
Do you have a solution to offer me?

Duplicate SSID not handled.

I might be wrong. Just working a coupe of hours with WiFiNINA.
This possible problem might be a severe security issue.
I tracked the issue back to wifi_drv.cpp.

I noticed that if there are wifi networks with identical SSID available, for example "ABC123", the behavior of programs based on WifiNINA 1.40 might become unpredictable.

It looks like the developer of this lib thought that SSIDs are some sort of UUIDs.
But SSIDs are not unique. even on a single channel, e.g. 2.427GHz, multiple networks with the same SSID could be created.

Long story short instead of begin SSID (+PWD) there should be at least an option to select the network, e.g. index, from the structure of detected/available networks during scan.

Tonight I really have no time for layer 2 research, also the "mesh" technology of AVM is not open source and they might do some tricks with mac-address-tables (and the behavior of mesh nodes is pretty stupid...)

Here is a Log from scan networks
also see attached screenshoot.

02:10:23.619 -> Name:
02:10:23.619 -> ABC123
02:10:23.619 -> Signal:
02:10:23.619 -> -58 dBm
02:10:23.619 -> ~~~~~~~~~~~~~Found a Home-SSID!
02:10:23.619 -> Name:
02:10:23.619 -> ABC123
02:10:23.619 -> Signal:
02:10:23.619 -> -73 dBm
02:10:23.619 -> ~~~~~~~~~~~~~Found a Home-SSID!
02:10:23.619 -> Name:
02:10:23.619 -> ABC123
02:10:23.619 -> Signal:
02:10:23.619 -> -75 dBm
02:10:23.619 -> ~~~~~~~~~~~~~Found a Home-SSID!
02:10:23.619 -> Name:
02:10:23.619 -> ABC123
02:10:23.619 -> Signal:
02:10:23.619 -> -88 dBm
02:10:23.619 -> ~~~~~~~~~~~~~Found a Home-SSID!"

net1

MKR1010 consumption

Hello,

I'm not sure Wifi.end() really turns off the WiFi module.
I have the same consumption with, or without this instruction before a LowPower.sleep().
I'm close to 50mA, while without starting the Wifi, I get 17mA in standby mode.

Cisco AP networks not found.

Networks generated by Cisco AirNet 3602, AP is using WPA2 encryption are not visible by the antenna on a MKR WIFI 1010. The network uses multiple channels: 1, 6, and 11.

The only networks visible are generated by D-Link and Netgear routers.

Feature sketch request. (pretty please)

Would it be possible to have a "Check Firmware" sketch just for the MKR1010 like there is for the MKR1000.
If that could possibly be added to the EXAMPLES / TOOLS that I think might be of use to noobs like me who are a little unsure if the UPDATE FIRMWARE sketch went through OK.

Thanks in advance for even looking at this.

Can't connect to server after Wifi reconnect

To save battery I want to end my WiFi connection and then reconnect when next message has to be send. It works fine the first time; and after I call WiFi.End I can connect to wifi again with WiFi.begin but I can't talk to any servers. Is that a feature or a bug?

Board: MKR Wifi 1010
Wifinina library: 1.4.0

Example:

#include <WiFiNINA.h>
#include "arduino_secrets.h"

char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;
WiFiSSLClient client;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }
}

void loop() {
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, pass);
    if (status != WL_CONNECTED)
      delay(10000);
  }
  Serial.println("Connected to wifi");
  
  makeRequest();

  Serial.println("Disconnecting from Wifi");
  WiFi.end();

  delay(10000);
}

void makeRequest(){
  Serial.println("Starting connection to server...");
  if (client.connect("www.arduino.cc", 443)) {
    Serial.println("connected to server");

    client.println("GET /asciilogo.txt HTTP/1.1");
    client.println("Host: www.arduino.cc");
    client.println();
    
    while (client.connected() && !client.available()) {
      delay(100);
    }

    if (client.connected()){
      while (client.available()) {
        char c = client.read();
        Serial.write(c);
      }
    }

    Serial.println();
    Serial.println("disconnecting from server.");
    client.stop();
  }
  else {
    Serial.println("Could not connect to server");
  }
}

connect.client hangs on wifi reconnect for Arduino Uno Wifi Rev 2

This needs to run autonomously in an environment where the Wifi often drops out. However, when attempting to recover from router reboot or too weak signal, the code stops at "client.connected()". I've tried DHCP from router and fixed IP. Can you replicate?

#include <SPI.h>
#include <WiFiNINA.h>
#include <OneWire.h> //Using latest from Paul Stoffregen
#include <Time.h>
#include <TimeLib.h>

char ssid[] = SECRET_SSID; 
char pass[] = SECRET_PASS; 
int status = WL_IDLE_STATUS;

WiFiClient client;
IPAddress ip(192, 168, 0, 33);
char server[] = "www.something.com"; 

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }

  while (status != WL_CONNECTED) {
    status = WiFi.begin(ssid, pass);
    delay(5000);
  }
}

void loop() {

  while (client.available()) {
    char c = client.read();
  }
  
  client.stop();

  if (WiFi.status() != WL_CONNECTED) {  
     Serial.println(WiFi.status());
     WiFi.disconnect();
     WiFi.config(ip);
     status = WiFi.begin(ssid, pass);
     delay(5000);
  }
  else {
    delay(1000);
// ************************* PROBLEM HERE **************************************
    // Also tried 'if (client.connect...' but using int here to see what comes back. This is where it hangs after network loss
    int cc = client.connect(server, 80);
    Serial.println("Client connect: " + String(cc));
    if (cc == 1) {
      if (client.connected()) {
// ******************************************************************************************
        Serial.println("Connect ok");
        String celsius_string = "50";
        //Insert temp record into database
        client.println("POST /insert.php?Value=" + celsius_string + " HTTP/1.1");
        client.println("Host: www.***.***");
        //client.println("User-Agent: Arduino/1.0");
        client.println("Connection: close");
        //client.println("Content-Type: application/x-www-form-urlencoded; charset=UTF-8");
        //client.println("Content-Length: ");
        client.println();
        //Serial.println(WiFi.status());
      }
    }
    else {
      delay(1000);
      if (client.connect(server, 80)) {
        delay(5000);
        Serial.println("Attempt reconnect");
      }
    }
  }
  delay(5000);
}

MKR Vidor 4000 - CheckFirmwareVersion fails looking for firmware version 1.2.1

This was posted on the forum but I believe this is a more appropriate location for it.
I have run through the WiFiNINA firmware updater for the MKR Vidor 4000 and once the firmware has been update, if I run the CheckFirmwareVersion sketch it reports an error and is expecting FW version 1.2.1. The most recent FW rev available from the Firmware Updater for the Vidor 4000 is 1.1.0 with no 1.2.1 listed. I am running with Arduino IDE version 1.8.9 on Windows 10 with all current Libraries and Board Manager update. This
is seen with the Hourly build of the Arduino IDE as well.

This is what the CheckFirmwareVersion sketch is reporting.



WiFiNINA firmware check.

Firmware version installed: 1.1.0
Latest firmware version available : 1.2.1

Check result: NOT PASSED
 - The firmware version on the module do not match the
   version required by the library, you may experience
   issues or failures.

AccessPoint issues

Some issues with the wifi.beginAP() command:

Default Espressif AP showing up

Using Wifi Firmware 1.1.0 and WiFi NINA library 1.4.0, the hotspot is created ignoring my config (ssid,pass), and being an open network with ssid like ESP-XXXXXX

Update to firmware 1.2.1

When updated the wifi module to the last firmware available, the hotspot fails to initialize.

NB I'm using MKR WIFI 1010 & Arduino IDE 1.8.9, I've also tried with the Web Editor and the 1.8.8, no luck

Initialization changes pinmode on GPIO 10 on Arduino UNO WiFi Rev2

Afaik none of the 0-13 GPIOs on the board are in use by the WiFiNINA module, however during initialization the pinmode of pin 10 is changed to input for some reason, and I don't know why. I only noticed this because the backlight control of my LCD shield didn't work unless I moved pinMode after the first call to WiFi.status() .

Add timeout for connect

Hi,

I think that you should add a timeout parameter for connect methods. I did it locally for me as I need it.

Thanks

MKR 1010 WiFi.getTime() returns always zero

After this code

WiFi.config(ip);
  
  // reduce power consumption (testing it)
  // WiFi.lowPowerMode(); 
  
  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED)
  {
    #ifdef FLAG_DEBUG
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    #endif

    // Connect to WPA/WPA2 network.
    status = WiFi.begin(ssid, pass);

    // wait 1 second before retry connection:
    if (status != WL_CONNECTED)
    {
      delay(10000);
    }
  }

if I call WiFI.getTime() I get zero.

Static IP address assignment not working

Bard used: MKR WIFI 1010

According to WIFI.config() documentation it should be possible to connect to WIFI assigning a fixed IP address (no DHCP) calling WIFI.config method before calling WIFI.begin

actually, I have tried and it doesn't work and always get from the router (DHCP) a different IP address from the one I specified.

void setup() 
{
 Serial.begin(115200);

 WiFi.config(ip, gateway, subnet);
 
 WiFi.begin(ssid, pass);

 // connect to MQTT broker...
 mqttClient.begin(MQTT_BROKER_IP, net);

 // register the callback
 mqttClient.onMessage(messageReceived);

 connect();

 pinMode(pinControl, OUTPUT);
 pinMode(pinInternal, OUTPUT);

 digitalWrite(13, LOW);
}

MKR WIFI 1010, Static ip no work

Hi, I'm using mkr1010 wicth this example.

https://www.arduino.cc/en/Reference/WiFiNINAConfig

`
#include <SPI.h>
#include <WiFiNINA.h>

// the IP address for the shield:
IPAddress ip(192, 168, 0, 177);

char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP)

int status = WL_IDLE_STATUS;

void setup()
{
// Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

WiFi.config(ip);

// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);

// wait 10 seconds for connection:
delay(10000);

}

// print your WiFi's IP address:
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}

void loop () {}

The code connect to the router, but the ip is not the correct.

I have this.

IPAddress ip(192, 168, 1, 177);

But , device have 192.168.1.44

Intermittent no socket available / status 255 unless interrupts are disabled

I have a timer interrupt (Timer B0, 10 Hz) I use for some timekeeping and unless I disable interrupts before calling client functions I get intermittent (1% - 10% occurrence) no socket available / status 255. Example:

noInterrupts();

if (!client.connect(SERVER_ADDR, SERVER_PORT))
{
  interrupts();
  return false;
}

client.println(request);
client.println(host);
client.println("Connection: close");
client.println();
client.stop();

interrupts();

Comment out the noInterrupts() call and the errors occur. Is this expected behavior? Is it a symptom of some other issue? I would except the library to disable interrupts internally when required like the standard Arduino library does.

Fastest way to check if host is up

I have a http server on my internal network. I need to detect whether the host is up in a quick manner so that I can send a wakeonlan packet if it isn't. So far the only ways I've found are:

  1. Ping the host, however it has a hardcoded 5s timeout
  2. Try to connect to the http server using WifiClient.connect, but this seems to have a hardcoded 10s timeout too.

I know for sure that this host will respond under 100ms. What would be the fastest way to either ping it, connect to it, or check that the relevant http port is open, with a cap at 100ms?

If this is not feasible as of now, how would you suggest me to implement it? A few suggestions: I could add an optional timeout param to the ping command, or a new command checkPortOpen(ip, port, timeout).

DNS not resolve the URL name after AP reconnection

Using the WiFiClient connenction API, affter a reboot of the access point the NINA module is not able to resolve the server url, defined in the sketch, the test case is:

  • Connect the board to the AP;
  • Call the WiFiclient connection API;
  • After the connection disable the AP and wait for module disconnection;
  • Enable again the AP, connect the board and call again the WiFiClient Connection.

In this last case some time the board stay connected to the access point but following the API chain called by the WiFiClient connection, the board is not able to resolve the host and get the IP address.
seems that in the f/w of the NINAthis line https://github.com/arduino/nina-fw/blob/master/arduino/libraries/WiFi/src/WiFi.cpp#L63 return NULL, i have used an arduino uno wifi rev 2 and the sketch used for the issue is:

#include <SPI.h>
#include <WiFiNINA.h>
#include <OneWire.h> //Using latest from Paul Stoffregen
//#include <Time.h>
//#include <TimeLib.h>
#include "arduino_secrets.h"


char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
int status = WL_IDLE_STATUS;

WiFiClient client;
IPAddress ip(192, 168, 0, 33);
//char server[] = "www.google.com"; 
IPAddress server(216,58,205,132);
void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }

  connectWiFi();
}

void loop() {

  if (client.available()) {
    char c = client.read();
    Serial.println("client available");
  }

  if (WiFi.status() != WL_CONNECTED) {
    Serial.println("tring to reconnect");
    Serial.println(WiFi.status());
    client.stop();
    WiFi.disconnect();
      connectWiFi();
  }
  delay(1000);

  if (client.connected()) {
    Serial.println("Connect ok");
    String celsius_string = "50";
    //Insert temp record into database
    client.println("POST /insert.php?Value=" + celsius_string + " HTTP/1.1");
    client.println("Host: www.***.***");
    //client.println("User-Agent: Arduino/1.0");
    client.println("Connection: close");
    //client.println("Content-Type: application/x-www-form-urlencoded; charset=UTF-8");
    //client.println("Content-Length: ");
    client.println();
    //Serial.println(WiFi.status());

  } else {
    Serial.println("not connected");
  }

  delay(5000);
}


void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

void connectWiFi() {
  status = WiFi.status();
  //WiFi.config(ip);
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, pass);
    delay(5000);
  }
  Serial.println("Connected to wifi");
  printWifiStatus();
  if (client.connect(server, 80)) {
    Serial.println("Connected");
  } else {
    client.stop();
    WiFi.disconnect();
    Serial.println("Not connected");
  }
}

Incorrect header comments in example sketches

Not declared in this scope error

I'm trying to compile a simple app using the WifiNINA library. I keep getting the following errors. I checked the code and it seems correct. Any ideas?

/Users/tbaggs/Documents/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static void SpiDrv::begin()':
/Users/tbaggs/Documents/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp:97:15: error: 'NINA_GPIO0' was not declared in this scope
pinMode(NINA_GPIO0, OUTPUT);
^
/Users/tbaggs/Documents/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static int SpiDrv::available()':
/Users/tbaggs/Documents/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp:566:25: error: 'NINA_GPIO0' was not declared in this scope
return (digitalRead(NINA_GPIO0) != LOW);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.