Search code examples
raspberry-piwifigoprotimelapse

Raspberry pi two AP wifi connection


The title is simple but let me add some more interesting components. I building a time lapse camera, I already have 6 Gopro hero 4, ups 12v and a stepdown to 5v. I want to operate from home the camera, so here is how is done:

1 UPS Cyber power 12V/7.2A Link

1 Car power tehnology 12 5v/3A converter with usb ports Link

1 Raspberry pi 3b+

1 Tplink TL-WN722N Link

1 Eletrical cabinet and a satelite antena holder and Camera suite software Link

I already had a Gopro and I didn't want to buy a pi camera because the quality and post production lens corrections (Gopro lens correction). Let's talk about Gopro for a moment, It's a crap of camera for remote contorting, you can control it only by wifi and the power issue, when the power is out, automatically the wireless AP on the camera go off, great, by manually accessing you can turn AP on.

So here come the UPS, with this UPS the system is online for minimum 5 hours, the ups have some "data" connections, only by resistance, so you know when is on battery, when the battery is low, when to replace the battery and if the battery is missing. I know for sure that Raspberry can listen this 4 ports. But here the problem, there are 2 wireless devices wlan0 and wlan1. with configuring wpa_supplicant_wlan0 and wlan1 the wlan0 is connected to the AP of Gopro and the wlan1 to the network.

When the network connection go down, by restarting RPI or the rooter, the RPI connects to the AP of GoPro with booth wlan and there is no way to access the RPI remotely again, someone must do it manual, and is not easily accessible.

Is there a way to make raspberry wlan1 avoid to connect to the AP of the Gopro if there are no connection?


Solution

  • The solution is to create a routing rule 40 in /lib/dhcpcd/dhcpcd-hooks/40-my-routing-rule

    route delete default gw 10.5.5.9 wlan0
    #the ip 10.0.0.9 is the default GoPro address
    ip route add default via 192.168.43.1 wlan1
    #or
    route add default gw 192.168.1 wlan1
    #it will also do the same.
    

    and for the static ip

    interface eth0
    stati ip_address=192.168.0.2
    
    interface wlan0
    static ip_address=10.5.5.101
    
    interface wlan1
    static ip_address=192.168.43.228
    
    static routers=192.168.43.1
    static domain_name_servers=192.168.43.1
    

    but I must check, I'm putting the raspberry on a not easy accessible place, so maybe is better to ask the network admin to assign the ip address by mac address and have a option to connect to the raspberry also by my mobile phone AP for more security.

    just an option for static ip