Configure Wi-Fi on your Raspberry Pi via the command line

Find available Wi-Fi networks

To scan for Wi-Fi networks, use the command

sudo iwlist wlan0 scan

This will list all available Wi-Fi networks along with other useful information. Look out for:

ESSID:"testing"

This is the name of the Wi-Fi network.

IE: IEEE 802.11i/WPA2 Version 1

This is the authentication used; in this case it is WPA2, the newer and more secure wireless standard which replaces WPA1.

These instructions should work for WPA or WPA2.

You will also need the password for the WiFi network. For most home routers this is located on a sticker on the back of the router. The ESSID (ssid) for the network in this case is testing and the password is testPassword

Add the network details

Open the wpa-supplicant configuration file in nano:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and add the following:

network={
    ssid="The_ESSID_from_earlier"
    psk="Your_wifi_password"
}

In the case of the example network, we would enter:

network={
    ssid="testing"
    psk="testPassword"
}

Now save the file by pressing ctrl+x then y, then enter.

At this point, wpa-supplicant will normally notice a change has occurred within a few seconds, and it will try and connect to the network. If it does not, either manually restart the interface with:

sudo ifdown wlan0
sudo ifup wlan0

or reboot your Raspberry Pi with

sudo reboot

You can check if it’s worked using

ifconfig wlan0

If the inet addr field has an address beside it, the Pi has connected to the network. If not, check your password and ESSID are correct.

Setting up a Raspberry Pi with a Tontec TFT 3.5″ screen (Model MZ61581)

Install the drivers

Taken from: https://s3.amazonaws.com/ttbox/35screen.zip

This is taken from information last updated on 2015-09-05

Below you will find instructions for installing the appropriate drivers for the Tontec 3.5 inch screen on your Raspberry Pi (including Pi 2). This guide was written for Raspbian wheezy, specifically 2015-05-05-raspbian-wheezy.img, though the guide should work on later versions as well.

1. Initial Config of New Raspberry Pi Install

After booting your Raspberry Pi for the first time on Raspbian-Wheezy, we will need to perform the normal tasks of setting up our Raspberry Pi. E.g expand filesystem,

Then we need “update” and “upgrade”

sudo apt-get update
sudo apt-get upgrade
sudo reboot

2. Update Firmware

We now need to update the dtb file to the newest version to support Tontec screen.

cd /boot/overlays
sudo rm mz61581-overlay.dtb
sudo wget http://www.itontec.com/mz61581-overlay.dtb
sudo reboot

3. Enable SPI and set overlay for Tontec MZ61581 Screen

Open /boot/config.txt

sudo nano /boot/config.txt

And add these lines to the bottom

dtparam=spi=on
dtoverlay=mz61581

Then save and reboot

4. Set Tontec 3.5 Screen as the default display instead of HDMI

sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

Here we will change the default output display from HDMI to Tontec Screen

Change

Option "fbdev" "/dev/fb0"

To

Option "fbdev" "/dev/fb1"

– if you want to switch back to the HDMI display, just change it back to fb0

5.  Edit cmdline.txt

Here we will enable Tontec Screen to display during the booting process

sudo nano /boot/cmdline.txt

Add fbcon=map:10 at the end of current line. (No need to start a new line)

6.  Reboot

sudo reboot

Done!


 

Calibrate the touch screen for X Windows

Taken from: http://s3.amazonaws.com/ttbox/35calibrate.zip

We’ll install an xinput_calibrator and a script to load the calibration data each time X starts.

 

1. Install all the prerequisites required for calibration

sudo apt-get install libtool libx11-dev xinput autoconf libx11-dev libxi-dev x11proto-input-dev -y

2. Download and install xinput_calibrator

git clone https://github.com/tias/xinput_calibrator
cd xinput_calibrator/
./autogen.sh
make
sudo make install

3. Download and setup the calibration script

cd ~
wget http://s3.amazonaws.com/ttbox/xinput_calibrator_pointercal.sh
sudo cp ~/xinput_calibrator_pointercal.sh /etc/X11/Xsession.d/xinput_calibrator_pointercal.sh
sudo sh -c 'echo "sudo /bin/sh /etc/X11/Xsession.d/xinput_calibrator_pointercal.sh" >> /etc/xdg/lxsession/LXDE-pi/autostart'

4. Reboot

sudo reboot

Calibrating

Start up X Windows

startx

Plug in a USB mouse as you won’t be able to click on much as the screen’s not calibrated.

Click on [Menu] -> [Preferences] -> [Calibrate Touchscreen]

Go through the calibration and a console window will appear.

The calibration program will create a file which stores the calibration data( /etc/pointercal.xinput)

Click [File] -> [Close]

To perform calibration again, just delete /etc/pointercal.xinput and restart X. You will be presented again with the calibration program once X starts.