# Huge 1st Project: 150 LED Traffic Flow visualiser

**URL:** <https://forums.blinkstick.com/t/huge-1st-project-150-led-traffic-flow-visualiser/1501>\
**Category:** Projects\
**Created:** [November 26, 2021, 3:21pm UTC](https://forums.blinkstick.com/t/huge-1st-project-150-led-traffic-flow-visualiser/1501 "2021-11-26T15:21:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nebiros](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/n/e480ec/32.png) [@nebiros](https://forums.blinkstick.com/u/nebiros)\
**Post date:** [November 26, 2021, 3:21pm UTC](https://forums.blinkstick.com/t/huge-1st-project-150-led-traffic-flow-visualiser/1501/1 "2021-11-26T15:21:16Z")

</div>

Hello everyone, greetings from the Netherlands!  
At our recent annual LAN party, the idea arose to visualize the internet data flow with an LED strip attached to the UTP cable bundle.  
While looking for possible solutions, I came across BlinkStick, and ordered one.

I’m not an electrical expert, but I know my way around software and scripting, and I generally get a lot done by reading and trying.

This BlinkStick project may be too ambitious, but if you don’t try, you won’t know.

What I want to do in a few steps:

- get the download bandwidth usage from pfSense (probably using SNMP)

- Connect WS2812B LED strip of 50 LEDs to BlinkStick (without additional power supply, because as a test I want to switch on a few LEDs at the same time at low brightness)

- Make a program that:

If this is successful, I want to expand further by adding a power supply and a total of 150 LEDs (3x 50).

And then maybe also add upload bandwidth with a flow the other way.

I am very curious what you think of this Project, and think it is feasible.  
I don’t know yet in which language I want to make the program, what do you suggest? I have some experience with VBA, AutoIT, batch, SAS, SQL.

By the way, help is welcome!

---

<div class="post-metadata">

**Author:** ![nebiros](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/n/e480ec/32.png) [@nebiros](https://forums.blinkstick.com/u/nebiros)\
**Post date:** [December 7, 2021, 9:29pm UTC](https://forums.blinkstick.com/t/huge-1st-project-150-led-traffic-flow-visualiser/1501/2 "2021-12-07T21:29:36Z")

</div>

Got my BlinkStick Pro in the mail today 🙂  
Thanks for the handwritten heads up Arvy!

Another few weeks for my Ebay ordered LED-strip will arrive.

In the meanwhile I’ve started experimenting in Visual Studio with vb forms.  
No real experience doing this, so please help me make my code better.

The SNMP readout is working.

`
Imports System
Imports SnmpSharpNet
Public Class Form1
Dim LedCount As Long = 64
Dim RevolutionsCount As Long = 1
Dim downloadspeed As Long = 0
Dim uploadspeed As Long = 0
```
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    Timer1_Tick(Nothing, Nothing)
    Timer1.Interval = 5000 '5 seconds
    Timer1.Enabled = True
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    Timer1.Enabled = False
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    Dim host As String = "127.0.0.1"
    Dim community As String = " **********"

    Dim requestOiddwn() As String
    Dim dwnresult1 As Dictionary(Of Oid, AsnType)
    Dim dwnresult2 As Dictionary(Of Oid, AsnType)
    requestOiddwn = New String() {".1.3.6.1.2.1.2.2.1.10.7"}

    Dim requestOidup() As String
    Dim upresult1 As Dictionary(Of Oid, AsnType)
    Dim upresult2 As Dictionary(Of Oid, AsnType)
    requestOidup = New String() {".1.3.6.1.2.1.2.2.1.16.7"}

    Dim snmp As SimpleSnmp = New SimpleSnmp(host, community)
    If Not snmp.Valid Then
        Console.WriteLine("Invalid hostname/community.")
        Exit Sub
    End If
    dwnresult1 = snmp.Get(SnmpVersion.Ver1, requestOiddwn)
    upresult1 = snmp.Get(SnmpVersion.Ver1, requestOidup)
    Threading.Thread.Sleep(2000)
    dwnresult2 = snmp.Get(SnmpVersion.Ver1, requestOiddwn)
    upresult2 = snmp.Get(SnmpVersion.Ver1, requestOidup)

    Dim kvp As KeyValuePair(Of Oid, AsnType)

    If dwnresult1 IsNot Nothing And dwnresult2 IsNot Nothing Then
        Dim download1 As Long
        For Each kvp In dwnresult1
            download1 = kvp.Value.ToString
        Next
        Dim download2 As Long
        For Each kvp In dwnresult2
            download2 = kvp.Value.ToString
        Next
        downloadspeed = (download2 - download1) / 2 / 1024 / 1024 * 8
    Else
        Console.WriteLine("No complete download results received")
    End If
    Console.WriteLine(downloadspeed.ToString & " mbit/s down")
    Label1.Text = downloadspeed & " mbit/s down"

    If upresult1 IsNot Nothing And upresult2 IsNot Nothing Then
        Dim upload1 As Long
        For Each kvp In upresult1
            upload1 = kvp.Value.ToString
        Next
        Dim upload2 As Long
        For Each kvp In upresult2
            upload2 = kvp.Value.ToString
        Next
        uploadspeed = (upload2 - upload1) / 2 / 1024 / 1024 * 8
    Else
        Console.WriteLine("No complete upload results received")
    End If
    Console.WriteLine(uploadspeed.ToString & " mbit/s up")
    Label2.Text = uploadspeed & " mbit/s up"
End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
    Dim bsFinder As New BlinkStickInterop.BlinkStickFinder
    Dim bsLedstrip As BlinkStickInterop.BlinkStick = bsFinder.FindFirst()

    ' To hold the three primary colors as Bytes
    Dim R As Byte, G As Byte, B As Byte

    ' For the For loop
    Dim n As Long, i As Long

    If bsLedstrip Is Nothing Then
        MsgBox("BlinkStick not found!")
    Else
        MsgBox("BlinkSick found: " & bsLedstrip.GetSerial)
        MsgBox("down: " & downloadspeed & vbCrLf & "up: " & uploadspeed)
        Dim vbaColor As Long

        With bsLedstrip
            ' Strip out the three primary colors
            R = vbaColor Mod 256
            G = vbaColor \ 256 Mod 256
            B = vbaColor \ 65536 Mod 256

            ' Animation
            i = RevolutionsCount * LedCount
            .SetDelay(downloadspeed)
            For n = 0 To i
                .BlinkIndexed(0, (n Mod LedCount), R, G, B)
            Next n

        End With

    End If
End Sub

```
`

`End Class
`
