Sunday, July 10, 2016

Touchpad plus.


RPi.

Touch pads good or bad are becoming so inexpensive that for the buck they are a better value than the lcd (liquid crystal displays) screens.  Also lcd's require interfacing. Just wanted something simple and elegant. So when thinking about making a portable device such as the Raspberry Pi, the touch pads had to be considered. Of course, other ways were considered also. For example you could use an an old black and white portable tv screen. Though portable and having it's own power source to power itself and the Raspberry Pi, they can be a bit bulky.


Then another choice was a bit less bulky and you had the advantage of having a dual purpose media device as a monitor. Yes a cd/dvd play could be considered if it has a least video in and a usb port for powering the Raspberry Pi.  As with the tv you will need to make a special case, but that is no big deal. 


The best choice it seemed to me would be to use a touch pad. But how to connect them both together. First you need the Raspberry Pi and it's own power source. There are lots of options there. If you are not in a remote place you, can just use a wall adapter. For connecting them, we will need to make a mini network.


While setting up the network, we will also want to install on the Raspberry Pi software to allow to connect to the tablet (or vice versa(,Using the Debian install Optionson the Raspberry Pi, you will first want to install two pieces of software. First if the remote desktop server known as xrdp and second is dnsmasq to delve out an ipaddress to the tablet.

$ sudo apt-get install xrdp dnsmasq

There is no real configuration needed for xrdp. As for dnsmasq, there is a bit of configuration. First you will need to set up a wifi dongle on the raspberry pi. Since everyone is different, you may have to adapt your setup. See https://www.raspberrypi.org/documentation/configuration/wireless/




Setting WiFi up via the command line

This method is suitable if you do not have access to the graphical user interface normally used to set up WiFi on the Raspberry Pi. It is especailly suited for use with a serial console cable if you don't have access to a screen or wired Ethernet network. Also note that no additional software is required; everything you need is already included on the Raspberry Pi.
Getting WiFi network details

To scan for WiFi networks, use the command sudo iwlist wlan0 scan. This will list all available WiFi networks along with other useful information. Look out for:  
ESSID:"testing". This is the name of the WiFi 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. This guide should work for WPA or WPA2, but may not work for WPA2 enterprise; for WEP hex keys see the last example here.
 
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 (psk) testingPassword.
 
Adding the network details to the Raspberry Pi

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="testingPassword" }

Now save the file by pressing ctrl+x then y, then finally press 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 and sudo ifup wlan0, or reboot your Raspberry Pi with sudo reboot.

You can verify if it has successfully connected 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.
Once you have that working, you will need to set up dnsmasq. See http://computoman.blogspot.com/2015/01/dnsmasq.html

You will want to make the ipaddress range only ONE address to help keep the system secure.

Almost forgot, you will need to install and rdp client on the touch pad.

----------------------------

pi setup

Download the latest image



$ unzip 2015-05-05-raspbian-wheezy.zip
Archive:  2015-05-05-raspbian-wheezy.zip
...

You need to see what storage devices are available. so that you do not overwrite your main drives. Match the disk size to your card. It is sdc for us.

$ sudo fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00027adf

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   485255167   242626560   83  Linux
/dev/sda2       485257214   488396799     1569793    5  Extended
/dev/sda5       485257216   488396799     1569792   82  Linux swap / Solaris

Disk /dev/sdb: 41.2 GB, 41174138880 bytes
255 heads, 63 sectors/track, 5005 cylinders, total 80418240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005d7c7

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    77277183    38637568   83  Linux
/dev/sdb2        77279230    80416767     1568769    5  Extended
/dev/sdb5        77279232    80416767     1568768   82  Linux swap / Solaris

Disk /dev/sdc: 7985 MB, 7985954816 bytes
246 heads, 62 sectors/track, 1022 cylinders, total 15597568 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa6202af7

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/sdc2          122880     6399999     3138560   83  Linux


$ sudo dd if=2015-05-05-raspbian-wheezy.img of=/dev/sdc

Make a used ip lister

[code]
 eddie@oedt01:~$ cat /home/eddie/bin/pingall.sh
a=""
for i in {1..254}
do
ping 192.168.1.$i -c1 -w1 -v | grep "icmp_req=1"
done
[/code]

Some systems need a variant

[code]
 eddie@oedt01:~$ cat /home/eddie/bin/pingall.sh
a=""
for i in {1..254}
do
ping 192.168.1.$i -c1 -w1 -v | grep "icmp_seq=1"
done
[/code]

$ chmod +x pingall.sh

$ ./pingall.sh
64 bytes from 192.168.1.51: icmp_req=1 ttl=64 time=0.557 ms
64 bytes from 192.168.1.128: icmp_req=1 ttl=64 time=0.694 ms
64 bytes from 192.168.1.168: icmp_req=1 ttl=64 time=0.068 ms


$ ssh pi@192.168.1.128
The authenticity of host '192.168.1.128 (192.168.1.128)' can't be established.
ECDSA key fingerprint is d4:7c:de:d5:60:21:8b:fe:8f:f6:b4:ad:28:71:0a:42.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.128' (ECDSA) to the list of known hosts.
pi@192.168.1.128's password:
Linux raspberrypi 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'

pi@raspberrypi ~ $


Select the first option so you can take full advantage of your card. Exit the program and then allow it to reboot.


Log back in as you did before.

pi@raspberrypi ~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           15G  2.4G   12G  18% /
/dev/root        15G  2.4G   12G  18% /
devtmpfs         87M     0   87M   0% /dev
tmpfs            19M  224K   18M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            37M     0   37M   0% /run/shm
/dev/mmcblk0p1   56M   19M   37M  34% /boot

Check out what space you have.

Run raspi-config again for changing other options that you might want to change.  You probably want to change your hostname and password for sure.

Bring the system up to date with:

$ sudo apt-get update
$ sudo apt-get upgrade

$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Now install the remote viewing server.

$ sudo apt-get install xrdp

See if you can attach to the pi. From a computer run your remote desktop viewer program. Set the ip with what you found earlier and use user will be pi.



 If you changed your password, you will need to use the new password here to log in.


 One neat thing about this is it saves you from having to purchase a monitor and hdmi cables for your pi.


You can exit out of the rdp software as we will go back to the command line. Now we get into the more advanced stuff. We to get into some network configuration. Let's see what alread is there.

Before installing wireless nic

$ sudo aptitude install wicd-curses

$ cat /etc/network/interfaces
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
        wireless-essid robotland
        wireless-mode Managed
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

 $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1


 $ iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

After installing wireless nic

$ iwconfig
wlan0     unassociated  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency=2.412 GHz  Access Point: Not-Associated  
          Sensitivity:0/0 
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless ext

What's around you?

$ sudo iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: AC:5D:10:F5:51:A9
                    ESSID:"2WIRE456"
                    Protocol:IEEE 802.11bg
                    Mode:Master
                    Frequency:2.442 GHz (Channel 7)
                    Encryption key:on
                    Bit Rates:54 Mb/s
                    Extra:wpa_ie=dd1a0050f20101000050f20202000050f2040050f20201000050f202


Reset connection.

$ sudo ifdown wlan0

$ sudo ifdown wlan0

or sudo reboot

Setup a router to see the pi picks up and ipaddress.

Now comes the fun part.

$ sudo apt-get install dnsmasq

Now you need to edit the dnsmasq.conf file fpr the setup

main gateway
dhcp-option=3,192.168.1.1

Range
dhcp-range=192.168.10.100,192.168.10.100,12h


Powering your RPi



No comments:

Post a Comment