Skip to main content


Showing posts from February, 2014

WiFi Characteristics of mobile phones in screen lock mode

I have a Nexus 5 and I was wondering what power strategies/algorithms are used in it to save power when the screen is locked and the display is off. I wanted to have a practical first hand experience of seeing this happening.

So I pinged the phone from my computer while it was connected to my WiFi network. I did performed the process twice - once while the phone was active and I was switching between/using apps on it, and the second time when the screen was locked and the display was off.
I sent out 100 ping packets and here are the results:


When screen was locked and display was offMinimum = 8ms, Maximum = 866ms, Average = 295msSporadic replies to ping, although no no packet was lost. Maybe the WiFi receiver was always on but the transmitter was only turned on periodically.A very large variance in the round trip times.
When the phone was activeMinimum = 3ms, Maximum = 387ms, Average = 63msQuick replies. WiFi chipset must always be active.Lesser variance in round trip times

Generic Netlink sockets - example code

If you want to use netlink as a userspace-kernelspace interface for your own non-networking custom use, make sure to go the Generic Netlink path - get a family id assigned and then used that to exchange messages between your userspace and kernelspace. That said, its better to just use Netlink Protocol Library Suite (libnl). If for some extremely compelling reason you can't, use libnl, here is some sample code to get you started.
Its based on Ariane Kellar's code from here. I have simplified and commented the userspace side code a lot. The kernel space code is mostly unchanged. The kernel side code required a minor change in genlmsg_unicast() call to ensure compatibility with the newer kernel versions.

nl_kern.c :

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 …

IoT Weather Station using TP-LINK TL-MR3020

What does it do?
Uploads Temperature, Humidity, Light and Pressure readings to Xively every minute

What is it made of?
TPLINK TL-MR3020 router reflashed with OpenWRTUSB Hub4GB USB Flash DriveSparkfun USB Weather Board (now discontinued, but can be replaced with a pair of Weather Shield + Arduino UNO R3)A lunch box and some Blu-tack to weather proof the USB Weather BoardYou will need a separate home WiFi router with internet connection. The MR3020 will connect to it as a client.What does it look like?

Where are the reading being uploaded online? Visit to have a look. This is what the page looks like:

How much did it cost? Can the cost be reduced? Refer to the blog post here for the cost of the various components involved:
The USB Weather Board from Sparkfun used to cost USD 125. I had bought it locally from for INR 10,287. The USB Weather Board is discontinued now and is now replaced with Weather Shield. The Weather Shield when p…