# 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 2. edit controller/config/__init__.py and set your controller ID to unique number 3. configure cron to run controller.py every 15 minutes as a superuser: ``` crontab -e -u root #enter these lines */5 * * * * cd /home/pi/projects/tfm/controller && sh activity.sh */30 * * * * /usr/bin/python /home/pi/projects/tfm/controller/network_check.py */1 * * * * /usr/bin/python /home/pi/projects/tfm/controller/camera_capture.py ``` 4. add following lines at the end of /etc/rc.local before "exit 0" ``` python /home/pi/projects/tfm/controller/lockdown.py python /home/pi/projects/tfm/controller/dweet.py ``` 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 ``` 7. install packages ``` sudo apt-get update sudo apt-get install libav-tools ``` 8. set timezone ``` sudo cp /usr/share/zoneinfo/Europe/Sarajevo /etc/localtime sudo ntpd -gq ``` 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 #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): 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 ```