Picture

Trial and error: Arduino and Wi-Fi connectivity part 3

Day 9 of trying to control my Arduino over a website. In this blog, I'll try to control an Arduino Uno Wi-Fi Rev2 through a website.

  • # Wi-Fi
  • # Uno Wi-Fi Rev2
  • # Web Client
Picture

After a long time of struggeling with the ESP 8266 Wi-Fi module, I decided to switch to an Arduino with built-in Wi-Fi. According to my research, this board has a more stable internet connection than the other options. Moreover, you can also find better tutorials and demos for this board, it is better supported and there is a good online library (WiFiNINA). The Arduino can serve as either a server accepting incoming connections or a client making outgoing ones.

I started from an example of the WiFiNINA library to set up the Arduino as a Wi-Fi web client. You can make a HTTP request using the Arduino Uno Wi-Fi Rev2. This can return HTML from most online websites. The results of this search are viewable as HTML through your Arduino Software (IDE) serial window.

I am following a tutorial where I can retrieve the HTML of a website. This is just an example demo , but if I know this works, I will also be able to send custom data from my own web page to the Arduino in a later phase. After running this code, the html was logged in the serial monitor

I ran a similar test, but this time with my Arduino Mega and Ethernet shield. I wanted to know if there was a difference in performance. Here I did a HTTP request to a website I created for integration 2. Here is the code and this is what happens in the serial monitor when I run the code:

Picture

This was proof that it is possible to retrieve data from a custom website and use it in Arduino (CC+). The code can certainly be optimized, because now you fetch all your website in the form of HTML (too many bytes), while I would only need some parameters (e.g. a string with the message I want to show in my Christmas tree). It is not yet an optimal solution, but certainly a start.

In part 4, I take a completely different route and try to link the Firebase real-time database to my Arduino Uno Wi-Fi.