Category: Raspberry Pi

How to update speedtest mod – Pi-hole

Updating speedtest mod is simple.

Switch to root

If you dont have speedtest.db in /etc/pihole
# get latest webpage.sh file
Get latest admin from github
If git remote -v  gives something like origin https://github.com/arevindh/AdminLTE If git remote -v  gives something like mod https://github.com/arevindh/AdminLTE

Add Speedtest to Pihole WebUI

So this project is  just another fun project integrating speedtest to PiHole Web UI.

Note : It’s just a quick solution , nowhere near perfect . If you made it better please let me know here Google+ Community

It will be using speedtest.net on background for testing. More frequent the speed tests more data will used.

What does this mod have in extra ?

  1. Speedtest results of 1 /2 4/ 7/30  days as graph.
  2. Custom speed test server selection.
  3. Detailed speedtest results page.
  4. Ability to schedule speedtest interval.

Latest Updates will listed here :  Pihole mods Community 

Inspiration : https://arstechnica.com/business/2016/02/comcast-customer-made-bot-that-tweets-at-comcast-when-internet-is-slow/

How to update to new version

Tested on Raspberry pi and Ubuntu PC

Needs latest pihole installed and working

Start with installing required packages on your Raspberry Pi / Linux

Find php version 

if it is 5.x

if it is 7.x

Restart Pi

You can try run it using

If Everything is ok, proceed to next step

Get the new set of admin Code from github ( New method  or try old one here)

Test its working

Go to your pihole admin page

http://pi.hole/admin

Note : First load may be slow

Login 

Now go to settings and enable speedtest

Note: If the item does not change to option you have chose just go to dashboard and comeback, it will be fine. I am currently working on it

Now create a speedtest Manually and make sure it’s appearing on dashboard

Go back to terminal and type  Not needed  : admin will call this if there is no data 

It may take few seconds to appear , but once its loaded you can see that on dashboard.

Please consider posting a screenshot link in the comments , I would like to know how it looks on different devices.

If there are any problems , ask here :  PiHole mods G+


Will my regular updates have problems ?

If you are upgrading pihole please revert all changes back and do the upgrade. Scroll down for instructions .

Speedtest gone missing after Pi-hole update

Dont worry your data is safe , update procedure here

Can the developer held responsible if anything goes wrong.

Absolutely not ,but you can always ask for help

I lost my DB file what Should I do ?

Here is a blank one : SpeedtestDB Zip

Can i get more features added to it ?

You can ask me via this link, I will do if feasible

Can I get it via regular pihole -up

Not currently. Hope this will get integrated into the baseline. If that happens you can easily get it via regular pihole update

The time is not not showing correctly in chart 

Please get latest code via git pull

I don’t want this , I want to go back to the original version .

If you have followed all instructions correctly , the code below will revert all the changes you have done .


Notes

Just a quick solution , you should move the db file to a directory outside www folder for security reasons.

Uses codes from

  • https://github.com/sivel/speedtest-cli
  • https://github.com/HenrikBengtsson/speedtest-cli-extras

 

Old Method for admin area

Voice activated Google Assistant on Raspberry Pi with visual feedback

How to enable Ok google in Google Home running on raspberry pi.

Add visual notifications

It allows us to understand what is the current state of our Raspberry Pi assistant

Blue Light : Google  Assistant is listening.

Red :Ligh : Google Assistant is saying something.

Schematics 

Coding part

Clone the Google SDK git repository  to home directory .

Now edit the hotword.py file

 

sudo nano /home/pi/assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/library/hotword.py

Modify the contents [ changes/ additions are highlighted ]

Install RPI GPIO in virtual environment 

pip3 install RPi.GPIO

Testing 

Run as a Service

Make sure that you are in virtual environment 

(env) pi@raspberrypi:~ $

else run

source /home/pi/env/bin/activate

 

We need to create an shell script to enable virtual environment “hotword.sh “

nano /home/pi/assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/library/hotword.sh To run as a service you need to create a service file in /lib/systemd/system/ folder

sudo nano /lib/systemd/system/assistant.service Enable and start service

sudo systemctl start assistant.service

Check Status of the service

sudo systemctl status assistant.service

Enable service

sudo systemctl enable assistant.service

All cotents are also in Gist: https://gist.github.com/arevindh/ae50e18394625747e6beae600b10e374

Enable GPIO in env
pip3 install RPi.GPIO

USB Sound Card Adapter
https://goo.gl/Y3RYTq

 

Load balancing home router with Raspberry Pi

After the fix for Realtek usb ethernet card for openwrt to run on raspberry pi 2,  I started my new project,  Load balancing router.

The working is quite simple, install and configure MWAN3 but I can’t install from repo since I got the source and compiled it with the patch for my usb ethernet card, purchased a few more of those from eBay and combined to form 2 WANs and  2 LANs.

The WAN

WAN uses 2 usb ethernet adapters and one configured to dial my PPPoE fiber connection  and another to cable modem, so that I could combine both to  get load balancing.

Then LAN

One lan port is same as the built in of Raspberry pi and another usb adapter.
One lan port is configured to use for my private network which contains few laptops,  a NAS and few cell phones via Dlink DIR850L 1200 dual band AC router .
Another one is to a wireless AP dedicated to guest,  which I keep isolated from my private network.

Since you are much experienced i am not mentioning how to install OS to a memory card for Raspberry pi . I have already compiled a version of OpenWrt for raspberry pi with MWAN3 , Firmware for USB adapter QHM8106 USB 2.0 Lan Adapter , drivers .

It works on Ethernet adapters with following firmware

  • AX88772B ASIX Elec. Corp
  •  RTL8152 Realtek Semiconductor Corp

Few other things like Freifunk [for splash screens on wifi connect ] , VnStat , QoS etc are also included in this build.

Download SD card image from  Google Drive 

Just after you finished your memory card and connected the USB ethernet card , insert it to your Pi 2 and boot  connect a rj45 lan cable from Pi to your PC / Mac .

Point your browser to http://192.168.1.1/

Set the basics such as password  and enable SSH ,

Set up the interfaces 

Here we are configuring eth0 as main LAN ,  eth1 , eth2 as WAN , WAN2 and eth3 as GUEST

To set up the interface to go Network -> Interfaces

Adding new interface

Click on Add new Interface

Enter “Name of the new interface” as  WAN for  interface eth1 , WAN2 for eth2 and Guest for eth3 . [ WAN , WAN2 , GUEST are to entered separately corresponding to interface selection ]

“Protocol of the new interface” should be static for GUEST  . For WAN , WAN2 it should correspond to connections you have, in my case it was PPPoE for WAN and DHCP for WAN2 since i have a Fiber GPON device and an ordinary cable modem with WiFi .

Adding WAN / WAN2

 

Step 1 : Adding WAN / WAN2

After clicking submit button on the next window enter the details of the connection such as username and password if required , if the connection type is dhcp there is nothing to do here , go to next step.

Step 2 : Adding WAN with PPPoE connection

Next step is to assign “Use gateway metric” 10 for WAN and 20 for WAN2 . Go to Advanced settings and add gateway matric

Step 3 : Use gateway matric

Now we have to go to the firewall settings tab and and it to WAN zone

Step 4 : Assign to wan Zone

Save and Apply

Repeat the above steps for the WAN2 also.

 

Adding GUEST interfaceÂ

The same way add an interface , name it as guest and set the protocol as static , submit

Step 1 : Adding Guest

On the Next window  Set IP address [ not the same as LAN uses ]  I selected 192.168.100.1  and the select subnet mask as 255.255.255.0 .

Scroll bottom to DHCP server section , got Advanced and tick “Dynamic DHCP”

Step 2 : Setting IP address and Enable DHCP Server

Next is to assign it to a new Firewall zone called Guest . Go to Firewall setting on the top .

Step 3 : Assign Firewall Zone

Save and Apply

 

Configuring Interfaces is now complete .

Setting up firewall

In order to allow guest to internet we need to add one rule go to Network – > Firewall scroll down to Zones and Click Add  , use the settings from below image.

Save and Apply

Now connect all cables and check internet connectivity through LAN and GUEST ports . If all working move to next step .

Load balancing

We are using MWAN3 which is pre installed to the image file given above .

Configure MWAN3

Go to Network -> Load Balancing 

You can see Live status as of interfaces .

Go to Configuration and  click on edit against WAN2

Edit WAN2

 

Select Enabled to Yes

 

Save and Apply

Now you will be able to use both connections  . Wiki Article on Load Balancing 

Use MWAN Member Configuration to fine tune settings .

To test it download a torrent since normal web connection’s speed can’t be increased since it should be done using same IP . Please read below reference material to know how to configure MWAN3 for your best performance .

Reference : MWAN3 ,OpenWrt , OpenWrt Ethernet USB Dongle Compatibility  , Another post on MWAN3

Notes :

In order to install packages from OpenWrt Repo

Go to System – > Software – > Configuration

Replace the distribution feeds with

Then Save and Apply

If there is any mistakes or corrections , please comment below .

OpenWRT with rtl8152 for Raspberry Pi 2

Raspberry pi OpenWrt with rtl8152 USB Ethernet dongle support . By default it is disabled in kernel we can enable it and compile [ Refer : https://forum.openwrt.org/viewtopic.php?pid=279394 ] here the one i have compiled for my Raspberry Pi 2.

Working Flashable image with rtl8152 support

openwrt-brcm2708-bcm2709-sdcard-vfat-ext4.img

How to manually do it 

Refer : How to build OpenWrt

Refer : https://forum.openwrt.org/viewtopic.php?pid=279394

The following lines should add the 2 realtek USB-Ethernet modules to OpenWrt:
(in packages/linux/modules/usb.mk)

 

Add those two modules in Kernel -> Modules – > Usb support 

Then compile the whole code