Arduino communication with WiFi router ?

Hello, I am involved in a project where we require an Arduino connected directly to a home wifi router, to be able to tell if any users are currently connected to that router.

Basically our goal is to have the Arduino perform simple operations whenever a user connects/disconnects to the home wifi network.

How difficult would this be to achieve for someone with limited programming/electronics experience? Thanks

(deleted)

I'd say your missing the biggest part of the equation..

"HOW"?

What are you using are your conditional to determine if a user is current connected to the target router?

Does this router provide some of API? a feed? a query/response service?.. and even at that point, let say it 'does'..(which I highly doubt)...

Does it know who 'users' are? by IP address? by device name/profile?

If its a DHCP router (assigns IP addresses dynamically when a new device connects).. you might get one IP address returned for a user who was on at 8:00am... but then leaves. Another user joins network, get assigned this same IP address.... how do you know anything about the user?

These are all questions you need to have answers to.

IMHO.... (without having done any R&D on the topic to be clear)... the best approach might be to try and get this info using a scripting language or something.. that dumps things to a database or some sort of feed/return... then have the Arduino with an ESP8266 device poll this script/database.....etc..

The keys things you need to identify are:

  • How/What you consider 'identifying' information for a network user
  • How to get this information (or any data) from your router.

Perhaps taking a look at all those ESP wi-fi 'jammer' (really wifi- de-auth packet) project work.. as I believe they get a list of connected devices? (or perhaps just devices in the local area looking for network? I havent played any of them that much)

Also.. what router?

While I consider myself a noobie/beginner as well... I'm guessing I have more experience than you do... and I would find myself in the same situation

George1955: I am involved in a project where we require an Arduino connected directly to a home wifi router,

Depending on what you mean by directly....... If you have not already bought the Arduino, you would probably be better off getting a NodeMCU instead. It can be programmed like an Arduino, is usually a better proposition for WiFi operations, and is a hell a lot cheaper.

Having a CCNA 2 qualification in networking i can say that this would be possible, you need to send a ARP to the router i.e. 255.255.255.255 and see what responds to the request, you have to make your own table that store the devices mac address though to link the ip's. Here's some info that should be useful https://www.tummy.com/articles/networking-basics-how-arp-works/

KawasakiZx10r: Having a CCNA 2 qualification in networking i can say that this would be possible, you need to send a ARP to the router i.e. 255.255.255.255 and see what responds to the request, you have to make your own table that store the devices mac address though to link the ip's. Here's some info that should be useful https://www.tummy.com/articles/networking-basics-how-arp-works/

But would an Arduino be fast enough to be sure to capture all the replies ?

Thanks for the replys!

Currently im thinking of using an Arduino with an Ethernet Shield to connect directly to the router via RJ45 , then would it be possible to "log in" to the router in the same way as using my PC browser (for example i just enter 192.168.1.1 in my web browser)

Using my pc browser i can see who is currently connected to the router via the GUI menu, wireless > station info. Is it possible for the Arduino to request this "station info" from the router? and then perhaps use the "if" command to carry out operations based on the data received ?

Any advice greatly appreciated!

George1955: (for example i just enter 192.169.1.1 in my web browser)

I presume you mean 192.168.1.1 ?

George1955: Currently im thinking of using an Arduino with an Ethernet Shield to connect directly to the router via RJ45 , then would it be possible to "log in" to the router in the same way as using my PC browser (for example i just enter 192.169.1.1 in my web browser)

Using my pc browser i can see who is currently connected to the router via the GUI menu, wireless > station info. Is it possible for the Arduino to request this "station info" from the router? and then perhaps use the "if" command to carry out operations based on the data received ?

I don't know how big the html responses are to these sorts of queries, but I'd guess larger than can be reasonably handled in the memory of a low end microcontroller. If it were me I'd use a Raspberry Pi or similar interactive SBC for this sort of task.

I am sure the router requires https to access the web configuration. 8-bit Atmega has not the power to work with https encryption.

KawasakiZx10r: Having a CCNA 2 qualification in networking i can say that this would be possible, you need to send a ARP to the router i.e. 255.255.255.255 and see what responds to the request, you have to make your own table that store the devices mac address though to link the ip's. Here's some info that should be useful https://www.tummy.com/articles/networking-basics-how-arp-works/

Would the ARP approach work given the Arduinos limited capabilities ?

Also would it be possible to use ARP to get current user info from the router, and not just a list of mac addresses that have been active in the past ?

thanks!

George1955:
Also would it be possible to use ARP to get current user info from the router.

Yes, you could do it with a Cisco Wireless router via the command line interface.

I dont know of any domestic wireless routers that have a similar capability.

And also appreciate that the arp table is cached, it is not a list of currently connected devices.

One point to consider, if what you wanted to do was straight forward to do, it should be easy to find examples with a Googl search.

I can see the web interface thing work - not with an Arduino, but with a NodeMCU or other ESP8266 based board it could work.

They can connect to https sources, and have the memory to handle big pages: about 80 kB RAM, and if that's not enough you have to configure SPIFFS (file system on the internal flash, can be 3 MB in size) to cache the page and work from there.

The ESP8266 has WiFi built in, so that sorts the communication to the router. It has 11 GPIO pins for outputs, which you can use for whatever response you have in mind.

Juraj: I am sure the router requires https to access the web configuration. 8-bit Atmega has not the power to work with https encryption.

Quite possibly but not always. My Verizon supplied router just uses http.

Any somewhat modern router built by a company that has even heard about the concept of "security" would have its interface on https.

You would hope so, but from what I read, routers intended for home use are notoriously insecure. So to the OP, I'd suggest: try parsing the admin page.

Slightly off-topic, I went through the admin pages for my router and discovered that it does indeed offer 443. Sadly, when I tried it, my browser threw a fit about invalid certificates and a possible man-in-the-middle attack. I guess I'll stick with port 80.