Configure Raspberry pi for wireless logger with TFT 2.8

Install raspberry pi light image on memory card

Enable ssh

Add an empty file ssh.txt in sd-card after image is copied

Add static IP fallback to dhcp
edit file /etc/dhcpcd.conf and add the following to the bottom of the file:

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
profile static_eth0
static ip_address=192.168.0.1/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

# fallback to static profile on eth0
interface eth0
fallback static_eth0

Enable TFT28 framebuffer module

  1. cd ~
  2. wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
  3. chmod +x adafruitpitft.sh
  4. sudo ./adafruitpitft.sh

insert the following file /etc/modprobe.d/fbtft.conf

#options fbtft_device name=adafruit22 rotate=270
options fbtft_device name=fb_ili9341 gpios=reset:25,dc:24,led:18 speed=16000000 bgr=1 rotate=90 custom=1

/etc/modules-load.d $ cat modules.conf

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

i2c-dev
spi-bcm2835
fbtft_device

Enable pygames

sudo apt install python3-pip

sudo pip install pygame

sudo apt install libsdl1.2-dev

sudo apt install libsdl-ttf2.0-dev

sudo apt install wiringpi

 

 

 

git clone git://github.com/Trixarian/sakis3g-source
sudo apt install libusb-1.0.0-dev

cd sakis3g-source
vi dependencies/usb-modeswitch/usb_modeswitch.h
change
#include <libusb.h>
#include <libusb-1.0/libusb.h>

./compile

 

 

/etc $ cat sakis3g.conf
USBMODEM=”2001:7d0e”
USBINTERFACE=”2″
APN=”internet.telenor.se”
#APN=”online.telia.se”
#SIM_PIN=”xxxx”

/etc $ cat usb_modeswitch.conf

# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# Evaluated by the wrapper script /usr/sbin/usb_modeswitch_dispatcher
#
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"


# Disable automatic mode switching globally (e.g. to access the original
# install storage)

DisableSwitching=0

# Disable check for MBIM module presence and configuration globally (to aid
# special embedded environments)

DisableMBIMGlobal=0

# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others

EnableLogging=0


# Optional increase of "delay_use" for the usb-storage driver; there are hints
# that a recent kernel default change to 1 sec. may lead to problems, particu-
# larly with USB 3.0 ports. Set this to at least 3 (seconds) in that case.
# Does nothing if the current system value is same or higher

#SetStorageDelay=4

 

/etc $ cat wvdial.conf

[Dialer Defaults]
Init1 = ATZ
Init2 = AT+CPIN?
Stupid Mode = 1
Modem Type = Analog Modem
Baud = 9600
Modem = /dev/ttyUSB0

[Dialer pin]
Init3 = AT+CMEE=1
Init4 = AT+CPIN="xxxx"

[Dialer nopin]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init5 = AT+CGDCONT=1,"IP","online.telia.se"
Init6 = AT+CFUN=1
Stupid Mode = 1
Modem Type = Analog Modem
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = *99#
Username = { }
Password = { }

 

:/etc $ cat rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi

# disable console blanking on PiTFT
sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0"

#Start gui
FRAMEBUFFER=/dev/fb1 /usr/bin/python3 /home/pi/projects/python/loggergui/infoscreen.py
exit 0



 

Add ramdisk

/etc $ cat fstab
tmpfs /mnt/tmpfs tmpfs nodev,nosuid,size=1M,mode=1777 0 0

~ $ cat enableantenna.txt
send AT+CFUN=1
expect OK
exit 0

adafruit-pitft.sh
Adafruit_Python_ILI9341
enableantenna.txt
sakis3g-source

/datalogger $ git status
On branch aggregating_data_improvement
Your branch is up-to-date with ‘origin/aggregating_data_improvement’.
nothing to commit, working tree clean

:~/projects/python/loggergui $ git status
On branch master
Your branch is up-to-date with ‘origin/master’.

~/projects/python/logstasher $ git status
On branch master
Your branch is up-to-date with ‘origin/master’.

Don't be such an angerball