Pages: [1] 2 3   Go Down
Author Topic: Arduino Network causing severe battery drain on WiFi connected devices.  (Read 2606 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I have a weather station that uploads weather data to COSM every 10 seconds. This works fine.

However, I noticed that when my Weather Station is running, the battery life on all of the mobile devices that are connected to the network via WiFi (i.e. several mobile phones, couple of tablets, various brands/types) is terrible. To put this difference in perspective, with the Weather Station on, the battery life on my phone is about 4 hours. With the Weather Station off it's 2 days. This is repeatable every time.

I can see from some diagnostics on my phone that 98% of the battery use is due to WiFi RX Wakelocks. In other words, it's receiving stuff on WiFi and having to wake up deal with it.

Wireshark tells us what the problem is. Every time the Weather Station uploads its data to the internet it sends an ARP broadcast:

ARP Who has 192.168.0.1?  Tell 192.168.0.20


192.168.0.20 is the IP of the Weather Station, and 192.168.0.1 is the gateway.

So what it's doing is trying to get the MAC address for the router from its IP address so that it can communicate with it. This is absolutely normal... ONCE (it should store the MAC address in its ARP table), but it does this every time it tries to connect. The rest of my devices only send such ARP broadcasts once after a reboot.

Does anybody have any suggestions on how to fix or work around this?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What kind of Arduino Wifi hardware are you using?
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 65
Posts: 3638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Interesting. I see the same thing happening with my arduino ethernet: every time it wants to talk to its target web server, there is an ARP request. Mind you, there's a bunch more ARP requests going on that don't make sense either - some of them generated by the router, and my Mac and XP box seemingly can't remember each others MAC address. I suspect that the same thing is going on with my wifi shield too but I can't see that traffic with wireshark.
Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 219
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Put a cheap router between them and have two subnets (such as 198.168.0.* and 198.168.1.*), or if your gear is capable, change the routing in it to implement this.  The ARPs will not find their way off the arduino's subnet to the other one where your phones and tablets are connected.

I'll hedge a bit and say I'm pretty sure that will solve the problem, but not 100%.  ARP is OSI L1 and therefore does not pass through the router.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the replies so far. To answer everyone...

I'm using an Arduino Ethernet, not a WiFi one: http://arduino.cc/en/Main/ArduinoBoardEthernet

I tried putting it on another subnet (192.168.1.20 as opposed to 192.168.0.20), but the requests still appear on every device on the LAN. I'm guessing this is because they're sent to a MAC of FF:FF:FF:FF:FF:FF. I didn't try putting another router between the device as I don't have a spare. Really though, I don't want yet another device plugged in with even more cabling, when this seems like a an issue that could be fixed in the library or code.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's not the subnet that holds back the ARPs, it a different segment, so you need a router between the two segments. Depending on the router you're using for your WLAN you may have the possibility to separate the WLAN and LAN part of your network. For example if you're using OpenWRT on your WLAN router, this is possible.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the clarification - much appreciated. I was sort of naively hoping that putting it on another subnet would be enough as some broadcasts I see on Wire Shark are sent to 192.168.0.255 and I also hoped the router would segment the subnets itself given everything on the other subnet is all coming off one port on the router.

If this can't be fixed in the Ethernet code (or mine), then I'll look at getting an additional router. The one I have doesn't have an OpenWRT port (yet).

I'm hoping that when I have time to trawl through the network libraries I'll be able to find a place where I can add entries to an ARP table.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ARP isn't done on the Arduino processor but by the WizNet5100 itself, so you cannot change the Ethernet library to work around that.

Have you checked your routers configuration if there isn't an option to separate the wireless from the fixed network? Some of the routers (even without an Open Source firmware) offer such an option.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll not check the Ethernet library then smiley Thanks for saving me a lot of time there.

It's a shame there's no function to add an IP address with its MAC too so it never has to try and get that info from the network. Obviously on Windows or Linux you can manually add a static ARP entry with the arp command.

On my router I can "isolate" any of its WiFi networks, which means all devices using that SSID have no access to the LAN and can only access the internet. This does work and would be a good solution but I need to access my LAN from wireless devices (e.g. VNC/Remote Desktop from my phone to PC).

Unless there's some undocumented arp command, it looks like I'll need a cheap router. There's another device that is (optionally) connected to my network that does this every second (another embedded system) so that sweetens the situation a bit.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 139
Posts: 5860
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just because I am curious (and use a lot of routers) what make/model router do you have now?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Asus RT-N66U
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino gets its revenge on all those devices with the fancy power saving.  Denial of service by battery depletion.  Not a novel attack, but possibly a novel vector.

-br
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 139
Posts: 5860
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I downloaded that router manual, just because I haven't used it before, but it seems fairly easy to set up. It appears by the manual the wireless network will use 192.168.1.1/24.

edit: I do not see any ethernet LAN ports on that box.
« Last Edit: February 05, 2013, 05:30:20 am by SurferTim » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You sure you got the right manual? Check here: http://www.asus.com/Networking/RTN66U/

As you can see from the description it has 4 gbit LAN and 1 gbit WAN (which you can also use as a normal LAN port if you're using the router in just Access Point mode).

The RT-N66U is an awesome little router. Just this morning I was telnetted into its Linux shell and reading of the temperatures from three temperature sensors on the board. It's a geek-boy's dream smiley-wink
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Forgot to say... I'm not sure where those IP ranges are coming from. There is only one place to set the IP and MASK that the router will use. It uses the same for both LAN and WLAN. Even in the DHCP settings it won't let you set IPs out of the range of that single IP + Mask.
Logged

Pages: [1] 2 3   Go Up
Jump to: