FRC team 5584. Est. 2014

 

 

Follow Our Progress

Keep updated with the team by following our social media channels. For exciting highlights videos and robot reveals, be sure to subscribe to our YouTube channel!

Read more

 

Robocamps

Come and join us at one of our Robo Camp workshops! Held at three locations across the Eastern suburbs of Melbourne. Register on our website now!

Read more

 

Our Sponsors

The companies that support our team to run each season and are helping us promote a bright future for STEM in Australia. 

Read more

 

Overview

This article describes how we replicated the Team 2220 infrastructure using three Raspberry PIs to enable control of an FRC robot from a remote site using a VPN. 

CREDIT: https://www.team2220.org/how-to-program-and-drive-your-robot-over-the-internet

 

 

Setting up the PIs

The online instructions in the above link were used verbatim to configure the three PIs with these exceptions ...

1: When running mkvars on VPN SERVER PI ...

  • Enter your country code [US]: AU
  • Enter the name of your state or province [Minnesota]: Victoria
  • Enter the name of your city [Eagan]: Melbourne
  • Enter the name of your organization [EHS Robotics]: ICRobotics
  • Enter your email address [This email address is being protected from spambots. You need JavaScript enabled to view it.]: This email address is being protected from spambots. You need JavaScript enabled to view it.
  • Enter the name of your organizational unit [Team 2220]: Team 5584

2: When setting up CA on VPN SERVER PI ...

  • Common Name (eg: your user, host, or server name) [Easy-RSA CA]: ICRobotics CA

3: When creating the /etc/init.d/bridge configuration files on the VPN CLINET PIS we initially hardcoded the WAN IP (as reported by http://myip.cpanel.net/), so the remote line looked like this ...

remote 101.181.130.94 1194

If the VPN SERVER IP is to be hosted at a site with a non-static WAN address then refer to the "Handling VPN SERVER PI at site with dynamic WAN IP address" section below where we replace the IP address in the remote line.

4: When setting up the bridge we make sure the /etc/init.d/bridge file on the clients contains the following IPs on the ROBOT CLIENT PI ...

pi@icpi02:~ $ grep 55.84 /etc/init.d/bridge
eth_ip_netmask="10.55.84.251/24"
eth_broadcast="10.55.84.255"
eth_gateway="10.55.84.1"
pi@icpi02:~ $

And on the DRIVER STATION ClLIENT PI ...

pi@icpi03:~ $ grep 55.84 /etc/init.d/bridge
eth_ip_netmask="10.55.84.253/24"
eth_broadcast="10.55.84.255"
eth_gateway="10.55.84.1"
pi@icpi03:~ $

Testing PI connectivity within the VPN

On all three PIs you should be able to ping all the following VPN IPs:

  • 10.55.84.200 (tap0 on one VPN client)
  • 10.55.84.201 (tap0 on other VPN client)
  • 10.55.84.250 (tap0 on VPN server)
  • 10.55.84.251 (br0 on Robot VPN client)
  • 10.55.84.253 (br0 on DS VPN client)
  • 10.55.84.254 (access point attached to Robot VPN client)

If any of these fail, check ...

1: The WAN IP (e.g. 101.181.130.94) has not changed and that IP is set in each of the client /etc/openvpn/openvpn.conf files (if we have used the dynamic dns service described in the section below then login to duckdns.org to check the IPv4 address that is being served there)

2: The port forwarding is set up in your home router for port 1194 (udp) on the firewall and/or set up a port forward rule to forward udp/1194 on your Server Pi

Setting static IP on VPN SERVER PI

CREDIT: https://pimylifeup.com/raspberry-pi-static-ip-address/

1: Login as pi user then run "sudo bash"

2: Determine <ROUTERIP> by running "ip r | grep default" and select the first IPv4 format IP that is reported (in our case 192.168.0.1)

3: Determine the <DNSIP> by running "grep nameserver /etc/resolv.conf" and select the IPv4 format IP that is reported (in our case 192.168.0.1)

4: Choose the <NETWORK> that is to be set up as static IP (in our case wlan0)

5: Select a suitable <STATICIP> that is outside your main router DHCP range (in our case we will use 192.168.0.252)

6: Add these lines to the bottom of the file /etc/dhcpcd.conf, replacing tokens with the above values

interface <NETWORK>
static ip_address=<STATICIP>/24
static routers=<ROUTERIP>
static domain_name_servers=<DNSIP>

In our case this will be ...

interface wlan0
static ip_address=192.168.0.252/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

7: Apply the changes by restarting with "sudo shutdown -r now"

8: SSH to the VPN SERVER PI and confirm that IP has been set to the static 251 IP using "ifconfig wlan0"

9: We also need to change the port forwarding rule on our main router to forward 1194/UDP packets to the new IP address (in our case it was automatically updated but worth checking!)

Handling VPN SERVER PI at site with dynamic WAN IP address

1: Create "account" at https://www.duckdns.org (simply login using one of the methods in the banner of the site)

2: This should take you to the https://www.duckdns.org/domains page

3: Enter a sub domain name (e.g. icrobotics) and select "add domain"

4: Check that the new record has been correctly configured with your current WAN address (you can find the current IP by visiting http://myip.cpanel.net/ or by browsing your router web interface)

5: Check that it works using a command prompt to run "ping icrobotics.duckdns.org", if all is well this should report your WAN IP address :)

6: Note that you can see the current state of the IPv4 (and IPv6) addresses.

7: Make a note of your token and then logout of duckdns.org

8: Full instructions for installing the updater on your site are available at https://www.duckdns.org/install.jsp ... its actually quite easy on a Linux host we just add a crontab line on the VPN Server Pi ...

As the pi user (does not need to be root user), execute ...

mkdir duckdns
cd duckdns
vi duck.sh

Add the following content (with your token from step 7 above) ...

echo url="https://www.duckdns.org/update?domains=icrobotics&token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce&ip=" | curl -k -o ~/duckdns/duck.log -K -

... then save and exit

Execute ...

chmod 700 duck.sh
crontab -e

Add the following line ...

*/5 * * * * ~/duckdns/duck.sh >/dev/null 2>&1

... then save and exit

You can test the script with ./duck.sh and view the response from duckdns.org in the duck.log file, if it worked the response will be "OK", if otherwise then response will be "KO".

9: We can now replace the remote line in /etc/openvpn/openvpn.conf on each of our VPN Client PIs ...

remote 101.181.130.94 1194

can be replaced with the more robust ...

remote icrobotics.duckdns.org 1194

D-Link DAP-1522 setup instructions

We will make use of an disused FRC robot radio (D-Link DAP-1522 set up as an Access Point) connected to the ethernet port of the ROBOT VPN CLIENT PI to provide the wireless link to the robot. 

CREDIT: these steps are from the Team 2220 page ...

  • (a) Set the IP address of the router itself to 10.TE.AM.254 (e.g. for Team 5584 that would be 10.55.84.254)
  • (b) Set the network mask to be 255.255.255.0
  • (c) Configure for either the 2.4 or the 5GHz (preferred) wireless band
  • (d) Set the security mode to WPA2 Personal(e) Select an SSID name and passphrase of your choosing for the wireless network
  • (f) Enable DHCP and select the IP address range 10.TE.AM.20 to 10.TE.AM.199 (e.g. for Team 5584 the range would be 10.55.84.20 to 10.55.84.199)

All of the above are covered in the instructions that follow ...

1: Device in AP 5GHz mode and power up with just power connected to DAP-1522

2: Hold in the reset button with a pen for 10 seconds to factory reset

3: On Laptop connect to "dlink" wireless network

4: Select properties for the "dlink" wireless network

5: Under "IP Settings" select "Manual"

6: Set ...

  • "IPv4" = On
  • "IP Address" = 192.168.0.49
  • "Subnet prefix length" = 24
  • "Gateway" = 192.168.0.50
  • "Prefered DNS" = 192.168.0.50
  • "Alternative DNS" = 192.168.0.50

... then select "Save

7: In command prompt check connectivity with "ipconfig", "ping 192.168.0.49" and "ping 192.168.0.50"

8: Browse to http://192.168.0.50 and login with DAP-1522 default user credentials (admin with blank password)

9: Select "Next"

10: Select "Manual" then "Next"

11: Enter SSID = IC VPN NET and Key = XXXXXXXX then select "Next"

12: Select "Save"

13: In the popup window select "Cancel"

14: Wait for device to restart

15: On Laptop connect to "IC VPN NET" wireless network (provide password specified in step 11 above when prompted)

16: Select properties for the "IC VPN NET" wireless network

17: Repeat steps 6, 7 and 8 above to reconnect to web interface

18: Select "Maintenance" then "Admin"

19: Change default password and then select "Save Settings"

20: Maintenance > System > Reboot

21: Login again to make sure the new password works!

22: Select "Setup" then "Wireless Settings"

23: Check Security Mode" = WPA Personal

24: Set ...

  • "WPA Mode" = WPA2 Only
  • "Cipher Type" = AUTO(TKIP/AES)

... then select "Save Settings"

25: Select "Advanced" then "DHCP Server"

26: Set ...

  • "Enable DHCP Server" = Ticked
  • "DHCP IP Address Range" = 10.55.84.20
  • "to" = 199
  • "Default Subnet Mask" = 255.255.255.0
  • (leave the rest blank)
  • "DHCP Lease Time" = 1440

... then select "Save Settings"

27: Select "Setup" then "LAN Settings"

28: Set "LAN Connection Type" = "Static IP"

29: Set ...

  • "IPv4 Address" = 10.55.84.254
  • "Subnet Mask" = 255.255.255.0
  • "Default Gateway" = 10.55.84.251
  • "Primary DNS Server" = 10.55.84.251
  • "Secondary DNS Server" = (blank)

... then select "Save Settings"

30: On Laptop, reconnect to the "IC VPN NET" wireless network

31: Reset to "Automatic (DHCP)" via "IC VPN NET" > "Properties"

32: Disconnect and reconnect to "IC VPN NET"

33: In command prompt check connectivity with "ipconfig", "ping 10.55.84.254"

34: Browse to http://10.55.84.254 and login with default user credentials (admin with blank password)

35: Connect port 1 of DAP-1522 to ethernet port on Robot Client Pi

36: Confirm connectivity with DAP-1522 either

  • SSH to Robot Client Pi and run "nc -zv 10.55.84.254 80"
  • this should report "Connection to 10.55.84.254 80 port [tcp/http] succeeded!"

OR

  • Launch VNC Viewer and connect to Robot Client Pi (192.168.0.93 at the moment)
  • In web browser navigate to http://10.55.84.254
  • If all is well you will see the dlink DAP-1522 web interface