Files
old-tfm/controller/README.md

95 lines
3.5 KiB
Markdown
Raw Normal View History

2015-12-27 07:12:51 +01:00
# Tfm Controller - little thingy that reads sensors, runs motors and communicates with the cloud
## Installation
1. Go to every subdirectory in drivers directory and follow instructions about installation of drivers
2016-06-08 10:34:05 +02:00
2. edit controller/config/__init__.py and set your controller ID to unique number
2016-01-24 09:57:03 +01:00
3. configure cron to run controller.py every 15 minutes as a superuser:
2015-12-27 07:36:20 +01:00
```
crontab -e -u root
2016-01-24 09:50:49 +01:00
#enter these lines
*/5 * * * * cd /home/pi/projects/tfm/controller && sh activity.sh
2016-06-08 10:45:32 +02:00
*/30 * * * * /usr/bin/python /home/pi/projects/tfm/controller/network_check.py
*/1 * * * * /usr/bin/python /home/pi/projects/tfm/controller/camera_capture.py
2015-12-27 07:36:20 +01:00
```
2016-06-08 10:34:05 +02:00
2016-10-08 23:30:58 +02:00
4. add following lines at the end of /etc/rc.local before "exit 0"
2016-06-08 10:34:05 +02:00
```
python /home/pi/projects/tfm/controller/lockdown.py
python /home/pi/projects/tfm/controller/dweet.py
```
2016-10-01 17:01:37 +02:00
5. create directory
```
mkdir -p /mnt/zoblakdata
```
6. add following line to /etc/fstab for ramdisk
```
tmpfs /mnt/zoblakdata tmpfs nodev,nosuid,size=100M 0 0
```
2016-10-08 18:48:19 +02:00
7. install packages
```
sudo apt-get update
sudo apt-get install libav-tools
```
2016-10-08 21:23:22 +02:00
8. set timezone
```
sudo cp /usr/share/zoneinfo/Europe/Sarajevo /etc/localtime
sudo ntpd -gq
```
2016-10-08 22:15:50 +02:00
9. to set 3g mode
```
sudo apt-get install usb-modeswitch ppp
cd
mkdir umtskeeper
cd umtskeeper
wget "http://mintakaconciencia.net/squares/umtskeeper/src/umtskeeper.tar.gz"
tar -xzvf umtskeeper.tar.gz
chmod +x sakis3g umtskeeper
2016-10-08 23:30:58 +02:00
#add following line at the end of /etc/rc.local before "exit 0" (USBMODEM='12d1:1506' is a VARIABLE visible by issuing the command: lsusb):
2016-10-08 22:18:37 +02:00
sudo /home/pi/umtskeeper/umtskeeper --sakisoperators "USBINTERFACE='0' OTHER='USBMODEM' USBMODEM='12d1:1506' SIM_PIN='0000' APN='CUSTOM_APN' CUSTOM_APN='active.bhmobile.ba' APN_USER='0' APN_PASS='0'" --sakisswitches "--sudo --console" --devicename 'Huawei' --log --silent --monthstart 1 --nat 'no' --sakismaxfails 20 --httpserver &>> /home/pi/umtskeeper/error.log
2016-10-08 22:15:50 +02:00
```
2016-11-28 09:26:44 +01:00
10. to set up vpn
```
generate vpn certificate, key and config (ovpn) files on server (see STEP 3: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-14-04)
2016-12-18 21:00:39 +01:00
transfer them to the client (WinSCP or a similar tool, maybe need to copy the key files to another directory, "chmod 644 [filename]" for the .key file in order to transfer it - see STEP 4: see STEP 3: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-14-04)
2016-12-18 21:04:12 +01:00
unify the OpenVPN profile (see STEP 4: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-14-04)
2016-11-28 09:26:44 +01:00
edit /etc/rc.local add the line
openvpn --daemon --cd /etc/openvpn --config zoblakFarmAlarmAmirZepce01.ovpn
before "exit 0" in order to start the vpn daemon on startup, where zoblakFarmAlarmAmirZepce01.ovpn is the generated conf file
p.s. just for reference, the setting whether the client is using local or remote gw for internet access is being set for all clients in the /etc/openvpn/server.conf file on the server - comment or uncomment line ;push "redirect-gateway def1 bypass-dhcp"
```
2016-11-28 16:04:52 +01:00
11. to set up the hardware watchdog
```
please follow this guide (it is valid for RPI3!):
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=147501
please note that in the /etc/watchdog.conf it is sufficient to uncomment these lines:
max-load-1 = 24
watchdog-device = /dev/watchdog
furthermore, this can be added at the end o the file:
# I added the following command to get rid of a pesky error message
watchdog-timeout=15
```