Wifi locking up Arduino Uno Wifi Rev. 2

Hello

I hope this is the correct section - I'm not sure what the issue is so unsure where to post.

I've got a relatively simple project to control 2 pairs of fans and monitor the RPMs. However, I'm having an issue with the WiFI communication - everything else works fine.

The project runs fine when there is no client connected to the wifi module and the IP address pings no problem throughout. I can run it for hours without issue, whether my devices are connected or not, so I'm pretty sure the issue isn't with the device setup. When it's all running I have 4 fans, 2 dual relay and 5 digital temperature sensors connected. But like I said, no devices connected and it works just as well with all devices connected.

Until ... I browse to the IP address of the Wifi module. It may work for a few refreshes (auto refresh every 5 seconds), and then will stop responding. I have attached the serial_output_error.PNG file which shows that it appears to be reconnecting the client over and over again. The serial_output_normal.PNG shows the data outputted each second which will run for hours without a client connected. The client page when loaded successfully simply shows JSON data.

I've attached the entire code.

Hopefully someone can point out what I am failing to see.

Any help appreciated and if there's any more information needed please let me know.

By the way the script started life as the Wifi Server example for WifiNINA.

serial_output_error.PNG

serial_output_normal.PNG

FanController.ino (13.1 KB)

It looks like you're running out of memory. Although the UNO WiFi Rev.2 has about 3 times the RAM of the UNO you're wasting a lot of memory with modules like ArduinoJson and the String class. You can use these classes on the ARM based Arduinos because they have much more memory and a better memory controller but they are not suitable for any AVR based Arduino model.

The output you get in the error case looks like parts of the client header sent to the Arduino. As your sketch is not printing that to the serial interface it must origin from a buffer overflow somewhere which usually indicate a low memory situation.

Apologies, I didn't get a notification that I had a reply to this and I appreciate the reply.

I ended up using a solution whereby the Arduino acted as a client instead of a server. This has been running fine for a while now with no issues.

The memory idea is a good one. It does have all the symptoms.

Many thanks for your help.