How can I connect to an Arduino using WiFi?

  • I'm working on building a solar powered, Arduino based weather station. The weather station consists of a temperature sensor and a photoresistor, and I plan to add an anemometer in the future. I would like to connect the weather station to my wireless network so that I can retrieve the sensor data from my computer without having to run wires (I live in a rental).

    What are the different options for connecting the Arduino to WiFi? I've looked at ethernet shields, WiFi shields, and something called Xbee, but I don't understand what each of them are for.

    I also have a wireless home router that I could use. Is it possible to connect my Arduino Uno to the router via the routers ethernet or USB port and then receive data from and send commands to the Arduino wirelessly over my home network? If so, how would this be accomplished?

    I currently have a bare Arduino Uno.

    Do you have an Ethernet shield?

    You need to clarify your question: what does "communicate with it" mean? Upload sketches? Send commands to a sketch? Get data from a sketch?

    I've attempted to add detail and context to the question. I do not have any shields currently.

    I don't think any revision of the official Uno has an ethernet port. I guess you must have an Arduino Ethernet (which is similar), or perhaps an unofficial clone of some kind?

    I've edited the question to specify the ethernet port on the wireless router. So the question is: [Arduino + ? + (Wireless Router OR ?) = Arduino sending data over my wireless network].

    Also have a look at adafruit cc3000 wifi module. If you need to log data on internet server, wifi/ethernet is recommended, if you just need the data on your pc, a cheaper option would be using motinos from low power lab.

  • sachleen

    sachleen Correct answer

    7 years ago

    You have a few options for connecting your Arduino to the network/Internet.


    Something like the Arduino Ethernet Shield allows you to plug in an Ethernet cable from the wall or router into your Arduino. Obviously, the main limitation is that your device is now tethered by the cable. For outdoor use, I wouldn't do this.


    The Arduino WiFi Shield allows you to connect to your home WiFi network. This is just like the Ethernet except its now wireless.

    The ESP8266 is a cheaper alternative that, with the default firmware, has the same functionality as the WiFi Shield. Be careful that you power it with 3.3V and not 5V as the rest of the Arduino. It also uses 3.3V logic levels so don't connect the Arduino's TX pin directly to the ESP's RX pin; use a voltage divider.


    If you have a lot of sensors or other devices that need to communicate with each other, the best option is usually an RF module. You have many options here, XBee being one of them. Check out the Sparkfun XBee Buying Guide to look at all the options available. And that's just XBee. There are many other wireless options available, at all sorts of prices.

    The thing with RF is that none of these will connect to the Internet. You will have all your devices communicate with each other or a base station, which will then be connected to the network by either a WiFi or Ethernet module.

    Wireless Router Serial

    Depending on what kind of wireless router you use, you can have the Arduino communicate directly with it and use that as your connection to a network.

    As for "RF" communication, you can also use the popular nRF24L01+ modules. There are some good libraries out there for this. The issue with the RF link is that you need to have another Arduino or Raspberry Pi etc. running as the "receiver" which then is connected to your computer where you want to store/view/analyze the data. For Wifi there are now also CC3000 shields available

    While researching the options you provided I came across the Yun. Would that be a more straightforward option? Thanks.

    Maybe. never used it myself. The shields aren't hard to interface with and may be cheaper.

  • Marry OpenWrt and your Arduino

    Get a small OpenWrt-capable router like "TP-Link TL-WR703N", flash it with the current stable version of OpenWrt and connect your Arduino to the router's USB port.

    This solution ist half or less of the cost of WiFi-shields and has far more power.

    ...and cheaper as a YÙN.

    Smart home automation webserver on OpenWRT router WR703N interfaced to Arduino, compared to Raspberry Pi and Ubuntu may be a starting point to read about this and your favorite search engine will find many more links about marrying WR703N and Arduinos...

    (!) Please see too....

  • ESP8266 is a cheap 5$ wifi module with UART, SPI connectivity. This can be integrated with Arduino seamlessly either through the stock firmware using AT commands, or by writing custom firmware using the SDK provided and GIPO available. For more reference

  • I've been working with xbee on the arduino and raspberry pi for a few months now. Whilst it does have it's issues and quirks, it is a great tool in the communication chain. It's not perfect but given the mesh side of it, for me it reaches further than my wifi and can even be more reliable (my raspberry pi with wifi occasionally drops out, however the connected xbee continues to function in the background.

    Specifically in my case it allows for a serial connection between my devices (being several arduinos, a raspberry pi (coordinator) and my mac (used primarily for monitoring but also occasionally injecting serial data)). In this case it's perfect. It doesn't allow internet access or access beyond the xbee framework, but that suits me perfectly since implementation is as simple as Serial.print and with no Ethernet overhead.

  • I use Spark Core which is a very easy to use Arduino programming platform. This platform was built on the primus that WiFi should be easy to use and cheap. Can even program the Spark Core from anywhere, any time.

    How does it compare to XBee in terms of: price (including Arduino connecting stuff such as a shield), distance range, programming (on Arduino)?

  • You could try a Arduino Yun, it is like a Uno but it has a WiFi directly on the board.

    There is a part in the "Guide to the Arduino Yún" called "Configuring the onboard WiFi", that describes how to configure the WiFi.

    Hi, could you edit your answer with some more information. OP already knows about the Yun so your answer would be more useful if, for example, it guided people to how to use the WiFi chip on it.

  • What you want is pretty easy to do, and the code exists already. But the way I invision it, you won't connect the sensor Arduino to your wifi. Instead, you'll use another Arduino as your gateway like this:

    Sensor Arduino: Located outside, connected to temperature sensor, wind speed, rain gauge?

    Gateway Arduino: Located inside, w/ Wiznet 5001 ethernet shield

    The Sensor Arduino and Gateway Arduino talks to each other using a VERY easy to use wireless transceiver, nRF24L01+. The wireless modules are $3 each, and the library for use is very mature. All the sensor data is easily communicated to the Gateway using this library.

    The Gateway Arduino w/ the ethernet acts as a webserver, enabling any computer in your local network to open up a page and view current conditions. Look at this page for the Arduino code:

    You want to also save historical temperature/wind speed information right? This is the best part! The Gateway Arduino can push data to a service like Xively, a free web-based data collection service that also gives you a nifty way to visualize/graph your data. There is a little hiccup with using the Wiznet along with the nRF24L01 module. The wireless module and ethernet shield both use the same bus to communicate, so take a look at this blog to see how you can use both at the same time:

    Xively also lets you make that data public or private, so you can chose to contribute your weather station data to the community.

    Some other notes: I like nRF24L01+ modules because they're dirt cheap. Xbee modules cost more than the Arduinos themselves. You can keep adding nRF24L01+ modules around the house once you establish a gateway. The same cost problem exists with wifi shield - expensive.

  • If you want a cheaper alternative to add WiFi capabilities to Arduino look at ESP WiFi shield.

    It works great with WiFiEsp library. Programming model is exactly the same as Arduino WiFi Shield

  • Using the ESP8266 sield is error prone, requires an update that needs to be flashed, some soldering required, and it's not appropriate for a production environment. Also, there are issues with the power supply because you need to have a separate 3.3V power supply. It's 2016 (!) and there are a bunch more options available now.

    "The UNO WiFi board is the Arduino UNO with integrated WiFi."


    "The Star Otto is the first Arduino board featuring the STM32F469 processor with WiFi." (Actually, as of October, it's still not available, "Coming Soon").

    Please note these two boards are from the OTHER Arduino organization.

  • After several trials & errors in my IoT project, I would recommend working on ESP32 over ESP8266(and also Arduino Uno & Nano), except if you know very well the scope of your project.

    Advantages of ESP32 over ESP8266:

    1. Bigger RAM, ESP8266: 32KB instruction & 80 KB user data, ESP32: 520 KB

    I'm working on an IoT project and trying to authenticate the device on GCP using a certificate. The root certificate of GCP is already about 120 KB, so it does not fit into ESP8266. There are alternatives but that complicates things.

    1. ESP32 has bluetooth & ESP8266 not

    Well at some point of your IoT project you might want bluetooth to connect your device with your phone ...

    1. Some versions of ESP32 has integrated ports for the camera (search ESP32 CAM)

    With ESP8266 you can surely use a camera but that will involve more coding & wiring and potentially worse performance.

    And at last, I tried to wire a wifi chip with Arduino Uno & Nano but I encountered some bugs and problems with the AT commands. Thus now I'm quite happy with ESP32 because everything is integrated.

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM