RPi 3G/4G Wireless Connection Backup Switcher

From EnigmaGuy Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

You can get this application in Python including source code for free at Github/.../WirelessSwitch

Preface

While I was developing surveillance camera I was facing a few challenges:

  1. There might be power outage
  2. Monthly cost should be kept to minimum (using 3G/4G pre-paid card as backup with primary cable network connection)

I was looking for a simple way how to switch between cable and 3G/4G connection in case of power failure (cable network modem is powered up by home electricity). I was hoping to find some simple Linux tool which will switch connection automatically but unfortunately I was unable to find any one. So I programmed one myself in Python. It was difficult to test it completely for all scenarios but currently most functionality should be stable and with correct 3G/4G settings it should reconnect you automatically in case of power outage longer than 5 minutes to backup connection and send notification e-mail.

To function properly you should have these set-up correctly:

  1. Battery backed-up Raspberry Pi - 5V UPS for Raspberry Pi
  2. 3G/4G connection - RPi 3G Mobile connection with Huawei E173
  3. E-mail account - e.g. GMail

Diagram