Whale Oracle with OpenWRT

Project Description

The Whale Oracle is a physical object that users can interact with through a website. The setup involves 2 wireless routers, a Raspberry Pi controlling an LED array, and a website hosted on a remote VPS. The travel router, Whaley, connects over wifi to the larger router, WhaleyHub, which is connected over ethernet to the home network. A webcam is connected to WhaleyHub through USB, and the Raspberry Pi is connected to Whaley by ethernet.

In the future, other objects beside Whaley can be added to the WhaleyHub wireless network.

Hardware

Routers / Servers:

Alias Machine Architecture Firmware / OS Peripherals
VPS n/a n/a Ubuntu 18.04.5 LTS (Bionic Beaver) n/a
WhaleyHub TP-Link TL-WDR3600 ver 1.4 Atheros OpenWrt 18.06.2, r7676-cddd7b4c77 Webcam
Whaley TP-Link TL-WR703N Atheros OpenWrt 14.07, r42625 (Barrier Breaker)
RaspPi Raspberry Pi Model B+ V1.2 ARM Raspbian 10 Lite (Debian Buster)

Webcams:

Bought a bunch of webcams and found that the UVC-compatible cams were easy to get working; non-UVC cams weren’t.

Webcam Linux Driver Works?
Logitech QuickCam Deluxe for Notebooks UVC (generic) Yes
Creative Live! VF0520 UVC (generic) Yes
Logitech C200 UVC (generic) Yes, but video is glitchy
Logitech QuickCam Messenger gspca_zc3xx (generic) No - couldn’t find streaming software
D-Link DSB-C300 ov511 (specific) No - didn’t bother trying to install driver
Addresses
Machine LAN IP WAN IP Default Gateway
VPS n/a http://hwsrv-640154.hostwindsdns.com n/a
Home 192.168.2.1 Dynamic n/a
WhaleyHub 192.168.1.1 192.168.2.45 192.168.2.1 (Home)
WhaleyHub - LuCI 192.168.1.1:80 192.168.2.45:50080
WhaleyHub - SSH 192.168.1.1:22 192.168.2.45:50022
Whaley 192.168.1.2 n/a 192.168.1.1 (WhaleyHub)
Whaley - LuCI 192.168.1.2:80 192.168.2.45:60080
Whaley - SSH 192.168.1.2:22 192.168.2.45:60022
RaspPi 192.168.1.3 n/a 192.168.1.1 (WhaleyHub)
OpenWRT Setup

OpenWRT 1st access:

IP 192.168.1.10
Default Gateway 192.168.1.1
Subnet Mask 255.255.255.0

Starting with a fresh OpenWrt installation:

Connecting WhaleyHub & Whaley

Determining what setup to use to connect WhaleyHub and Whaley:

Setting up a WDS wireless network bridge (aka repeater):

Accessing Luci & SSH over WAN

Debugging Connection Problems

Setting up WPA encryption on WhaleyHub
Setting up a webcam on WhaleyHub

Connect to WhaleyHub though PuTTY

Installing usb driver packages: openwrt.org/docs/guide-user/storage/usb-installing

Useful commands:

Installing webcam drivers: openwrt.org/docs/guide-user/hardware/video/webcam

Installing streaming software:

Setting up a basic streaming website:

  1. Setting up local streaming on the router’s LAN:
    • /etc/init.d/mjpg-streamer start
    • Visit video at 192.168.1.1:8080 (username: openwrt, password: openwrt)
  2. Start webcam stream at boot
    • System → Startup → Local Startup: Add /etc/init.d/mjpg-streamer start
  3. Allow video feed access from a device in our home LAN:
    • In LuCI → Network → Firewall → Port Forwards: Open up port 8080
    • Now can visit the video at WhaleyHub’s external IP, which I set to 192.168.2.45 in the home router.
  4. Allow video feed access from the outside internet via our home’s external IP:
    • In home router, opened port 8080 and forwarded it to WhaleyHub
    • Now can visit the video at our home’s external (dynamic) IP
  5. Hosting a temporary website on my VPS, embedding video from our home IP:
    • SSH into WhaleyHub, disable mjpg-streamer authentication:
      • vim /etc/config/mjpg-streamer
        • Remove the username and password lines with dd
      • /etc/init.d/mjpg-streamer restart
    • In VPS, create a webpage with the video embedded in an iframe
      • Note: can’t be tested from own internet (eg: need to use cell phone w data)

Debugging the video feed:

  1. Test feed as a client of WhaleyHub: 192.168.1.1:8080
  2. Test feed as a client of Home Router: 192.168.2.45:8080
    • port 8080 needs to be open on WhaleyHub
  3. Test feed @ Home External IP: [dynamic IP]:8080
    • port 8080 need to be open on Home router & forwards to WhaleyHub
  4. Test feed @ VPS (embedded from Home IP): http://hwsrv-640154.hostwindsdns.com/whaley/whaley.html
    • Need to have a webserver running on VPS
    • Remember to update our home IP (since it’s dynamic) in whaley.html