Raspberry Pi drop WiFi connection

I built a reef controller with Raspberry Pi. Basically it is just a replay controller, It controls when which replay should be turned on. But there is a problem. it will drop the Wifi connection every few days. This is really annoying since I need to monitor the equipment remotely using internet.

The solution: writing a script to detect the lost a Wifi connection, it the connection lost, then reboot the raspberry pi, or just to reset the wifi connection. But the best way is to find the underline cause. This is caused by the power saving mode of raspberry Pi. The pi turned the wifi off to saving power. We need to make the following change to disable the power saving mode.

1. Create a new file in /etc/modprobe.d/8192cu.conf

sudo nano /etc/modprobe.d/8192cu.conf

2. paste the following in

# Disable power saving
options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

3. reboot with sudo reboot