Introduction: Internet Speedometer

About: Electrical Engineer and a Maker from India. Engineering is fun once you start applying it!

With complete lockdown going on in India, everything including mail services has been closed. No new PCB projects, no new components, nothing! So to overcome the boredom and to keep myself busy, I decided to make something from the parts which I already have at home. I started searching from the pile of electronics junk and found an old, broken analog multimeter. I salvaged the 'meter movement' from it and decided to display some kind of information but didn't exactly know what. First, I thought of displaying COVID-19 stats but there are already many better projects on the internet. Also, the data is updated after a few hours and a still pointer of the meter would be boring. I wanted data that changes quickly, changes every second. I asked for suggestions on Instagram and one of my followers replied with Internet Speedometer. It sounded interesting and decided to make it!

In this Instructable, I will show you how I grabbed data from my WiFi router using SNMP and displayed the upload and download speeds on the meter.

Let's get started!

Step 1: The Plan

As always before starting with the project I did a bit of research on the internet. I found a few projects related to this topic. They were of two kinds. One which showed internet speed by measuring the 'strength' of the WiFi signal. I am not a networking expert guy but this did not sound right. The others measured the latency and categorized speed as slow, medium or fast. Latency is the time delay between sending the request and getting the response and so it cannot be the actual representation of the internet speed. We can call it a network response speed though! Then there were legit projects which measured the time required to download some data and calculated the internet speed based on that.

But it was in this project (by Alistair) that I learnt about Simple Network Management Protocol or SNMP. Using SNMP, we can communicate with the WiFi router and get the required data directly from it. Easy, right? Actually, no! Because different models of WiFi routers use have different settiings and need a lot of trial and error before you finally get the output. Don't be scared. I will explain in brief whatever I learnt about SNMP and the difficulties I faced in the upcoming steps.

So the plan is to use NodeMCU to connect to the WiFi Router. These are the steps to get to the final output:

  • Send a request to the router 'requesting' the required data
  • Get the response from the router
  • Analyse the response and parse the required data from it
  • Convert the 'raw' data into understandable information
  • Generate voltage proportional to the internet speed for the meter
  • Repeat

I will be using a DAC or Digital to Analog Converter for controlling the meter.

Step 2: Things You Will Need

1x NodeMCU

1x Analog Meter Movement

1x MPU4725 DAC

1x SPDT Switch

1x 10k Potentiometer

1x Resistor

Step 3: Calculating Full-scale Deflection Current

Note: Jump to Step 7 for the actual build!

Skip this step if you already know the full-scale deflection current for your meter. My meter had no mention of it so I had to calculate. But first, let us quickly see how does such a movement work. It consists of a coil suspended in a magnetic field. When current flows through the coil, according to Faraday's law, it experiences a force. The coil is allowed to rotate freely in the magnetic field and so does the pointer which is attached to the coil. The magnitude of current which makes the pointer move at the 'end of the scale' is called full-scale deflection current. This is also the maximum current which must be allowed to flow through the coil.

There's a lot more going on but this is enough for what we are doing. We now have the movement. It can be used as a voltmeter by adding a high resistance in series with it or as an Ammeter by adding a small resistance in parallel to it. We will be using it as a voltmeter to display the voltage proportional to the internet speed. So, we need to calculate the resistance which is to be added in series. For that, we first need to calculate the full-scale deflection current.

  1. Choose a high resistance value (like >100k)
  2. Connect it in series with the movement and apply a variable voltage across it using the pot.
  3. Keep increasing the voltage slowly till the pointer reaches the end of the scale.
  4. Using a multimeter, measure the current flowing through. This is the full-scale deflection current. (I = 150uA in my case)

We are using a DAC which has the output voltage range from 0 to VCC (3.3V due to NodeMCU). This means that when 3.3V is applied to the meter, it should point at the end of the scale. This can happen when full-scale deflection current flows through the circuit when 3.3V is applied. Using Ohm's Law, 3.3/(full-scale deflection current) gives the value to resistance to be inserted in series.

Step 4: Creating SNMP GET Request

Simple Network Management Protocol (SNMP) is an Internet Standard protocol for collecting and organizing information about managed devices on IP networks and for modifying that information to change device behavior. Devices that typically support SNMP include cable modems, routers, switches, servers, workstations, printers, and more. For this build, we will be communicating with our WiFi Router using SNMP and get the required data.

But first, we need to send a request known as a 'GET Request' to the router mentioning the details of the data which we want. GET Request format is shown in the picture. The request consists of various parts. I have highlighted the bytes which you might want to change.

Please note that everything is in Hexadecimal.

SNMP Message -In my case, the length of the entire message is 40 (grey color) which when converted to hexadecimal is 0x28.

SNMP Community String - The value 'PUBLIC' is written in hexadecimal as '70 75 62 6C 69 63' whose length is 6 (yellow).

SNMP PDU Type - In my case, the length of the message is 27 (blue) i.e. 0x1B.

Varbind List Type - In my case, the length of the message is 16 (green) i.e. 0x10.

Varbind Type - In my case, the length of the message is 14 (pink) i.e. 0x0E.

Object Identifier -

As mentioned earlier, SNMP-enabled network devices (e.g. routers, switches, etc.) maintains a database of system status, availability, and performance information as objects, identified by OIDs. You need to identify the OIDs of your router for Upload and Download packets. It can be done using a free MIB Browser like this one.

Enter Address as and OID as . (ifInOctets) or . (ifOutOctets). Select Get operation and click on Go. You should see the OID along with its value and type.

In my case, the length of the message is 10 (red) i.e. 0x0A. Replace the value with the OID. In this case, '2B 06 01 02 01 02 02 01 10 10'

That's it! Your request message is ready. Keep the rest of the bytes as they are.

Turning ON SNMP on your router:

  • Log on to your WiFi router's page through the default gateway. Type in your browser and press enter. By default, the username and password should be 'admin'.
  • I am using a TP-LINK (TD-W8961N) router. For this router, you have to go to Access Management > SNMP and select 'Activated'.
  • GET Community: public
  • Trap host:

Step 5: Understanding GET Response

You can skip this step, but it's good to know if you need to do some troubleshooting.

Once you upload the code and run it, you can take a look at the response through the Serial monitor. It should look like as shown in the picture. There are a few bytes you need to look for which I have highlighted.

Starting from 0,

15th byte tells the PDU Type - 0xA2 means that it is a GetResponse.

48th byte tells the data type - 0x41 means that the data type is Counter.

49th byte tells the length of data - 0x04 means that the data is 4 bytes long.

Byte 50, 51, 52, 53 contains the data.

Step 6: Digital to Analog Converter (DAC)

Microcontrollers are digital devices that do not understand Analog voltages directly. I am using an analog meter that needs a variable voltage as the input. But microcontroller can just output HIGH (3.3V in case of NodeMCU) and LOW (0V). Now you might say why don't just use PWM. It won't work since the meter will only display the average value.

I am using MCP4725 DAC to get variable voltage. It is a 12-bit DAC i.e. in simple terms, it will divide 0 to 3.3V into 4096 (= 2^12) parts. The resolution will be 3.3/4096 = 0.8056mV. This means that 0 corresponds to 0V, 1 corresponds to 0.8056mV, 2 corresponds to 1.6112mV,....., 4095 corresponds to 3.3V.

The internet speed will be 'mapped' from '0 to 7 mbps' to '0 to 4095' and then this value will be given to DAC to output a voltage which will be proportional to internet speed.

Step 7: The Assembly

Connections are very simple. The schematic has been attached here.

I designed and printed the scale. The upper one is for download speed and the lower one is for upload speed. I glued the new scale over the old one.

I removed all the old stuff from the multimeter and I crammed everything in it. It was a tight fit. I had to drill a hole in the front to attach the toggle switch which is used to select between upload and download speed.

Step 8: Time for Coding

The code has been attached here. Download and open it in Arduino IDE. Install the MCP4725 library from Adafruit.

Before you upload:

  1. Enter your WiFi SSID and Password
  2. Enter maximum upload and download speed mentioned on the scale.
  3. Make the necessary changes in the request array for download as well as upload packets.
  4. Uncomment line 165 to view response on the serial monitor.

Hit upload!

Step 9: Enjoy!

Power it up and enjoy watching the needle dancing around as you surf the internet!

Thank you for sticking to the end. Hope you all love this project and learned something new today. Let me know if you make one for yourself. Subscribe to my YouTube channel for more such projects.

Arduino Contest 2020

Participated in the
Arduino Contest 2020