Skip navigation
2017

Raspberry Pi

November 2017 Previous month Next month

I have seen a lot of guides to configure headless operations without attached display, keyboard, and mouse - all of which seem to be out of date.  Maybe it's because that Raspbian has evolved or something else.  Anyways, this technote is based on Raspbian Stretch or Stretch-Lite circa September 2017.

 

I got this Raspberry Pi Zero "W" for USD 5.00 by walking into a local store (http://www.microcenter.com/product/486575/Zero_W) in the Dallas/Fort Worth Texas USA area.  That price is for one.  If you want more, then the unit price goes up - sort of a volume "anti-discount" .  They also have a USD 5.00 price on the "official" Pi zero case.  Unfortunately, you have to walk-in as I was told.  There must be other stores around the 3rd rock that offer comparable discounts (UK? Hong Kong? Rotterdam?).

 

I'll assume that the reader has just created a MicroSD Raspbian installation in the usual manner on the workstation.  Make sure no writes are pending.  If the 2 Stretch partitions are not yet automounted, pull out the caddy and push it back in.  This should cause an automount of the 2 Stretch partitions of the MicroSD.

 

On my Linux system, `sudo blkid` shows the following after creating the Raspbian boot MicroSD:

 

/dev/sdc1: LABEL="boot" UUID="E5B7-FEA1" TYPE="vfat" PARTUUID="020c3677-01"

/dev/sdc2: UUID="b4ea8e46-fe87-4ddd-9e94-506c37005ac5" TYPE="ext4" PARTUUID="020c3677-02"

 

with corresponding mounts

 

/media/USER-NAME/boot/

/media/USER-NAME/b4ea8e46-fe87-4ddd-9e94-506c37005ac5/

 

Enable SSH on the first Raspbian power-up

 

cd /media/USER-NAME/boot/

touch ./ssh

 

Assuming that you are using Wifi, enable the connection.  The following is an example on my Linux system for the USA using WPA-PSK security.

 

cd /media/USER-NAME/b4ea8e46-fe87-4ddd-9e94-506c37005ac5/etc/wpa_supplicant

sudo vi  wpa_supplicant.conf

 

Replace the existing contents of wpa_supplicant.conf with the following:

 

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

country=US

 

network={

ssid="Your network SSID"

psk="Your WPA/WPA2 security key"

key_mgmt=WPA-PSK

}

 

I highly recommend setting up a static IP address; this is very convenient for headless SSH operation.

 

Assuming that:

 

    1. You are using Wifi and your wireless device is named wlan0
    2. The desired IP address for the Raspberry Pi = 192.168.1.104
    3. The router IP address = 192.168.1.1
    4. The primary DNS server is also at 192.168.1.1

 

append to /etc/dhcpcd.conf the following:

 

interface wlan0

static ip_address=192.168.1.104/24

static routers=192.168.1.1

static domain_name_servers=192.168.1.1 8.8.8.8

 

Adjust IP addresses as necessary for your environment.

 

Note that if you are using wired Ethernet instead of Wifi and its device name is eth0, then specify this interface instead:

 

interface eth0

 

Be sure to sync; sync; sync changes to the MicroSD before removing it from the USB port.

 

Insert the MicroSD into the Raspberry Pi and power up.

 

On your workstation, I would enter the host name and static IP address for the Raspberry Pi in /etc/hosts (assuming the workstation is Linux or Unix).

 

From your workstation, connect to the Pi

 

ssh pi@PI-HOST-NAME

 

Change the root password to something that you'll remember, just in case

 

Configure the Pi

sudo raspi-config

 

  1. Change password for user pi
  2. Localisation - Language and Regional settings
  3. Timezone - Where are you?
  4. If you already have a Raspberry Pi with host name "raspberrypi", you will probably want to change this Pi Zero W's host name to something else.
  5. Reboot

 

From your workstation, connect to the Pi

 

ssh pi@PI-HOST-NAME

 

Got an NFS file server that the user "pi" needs access to on a permanent basis?  Permanently mount "/mnt/bigtree.nfs"

 

1. I'll assume that your NFS server is set-up and you know how to manage it.  Practical overviews of NFS set-up can be found here:

Be sure to read the comments too.  All of us have learned NFS at the "School of Hard Knocks" but it is worth it.

 

2. Set up a local mount location:

 

cd /mnt; sudo mkdir bigtree.nfs; sudo chown pi:pi bigtree.nfs

 

3. Append the following to /etc/fstab; adjust per your local requirements:

 

# Mount bigtree.nfs using NFS

# NFS-SERVER is the host name as specified in /etc/hosts (static IP address).

# This NFS server has "bigtree" rooted directly under mounted file system "/data4188".

NFS-SERVER:/data4188/bigtree   /mnt/bigtree.nfs   nfs   rw,bg,auto,noatime   0   0

 

4. Test (In general, always test immediately after making system changes!):

 

sudo mount -a

touch /mnt/bigtree.nfs/xx

rm /mnt/bigtree.nfs/xx

 

Got a SAMBA file server that the user "pi" needs access to on a permanent basis?  Permanently mount "/mnt/bigtree.samba" as follows:

 

1. I'll assume that your SAMBA server is set-up and you know how to manage it.

 

2. Set up a local mount location:

 

cd /mnt; sudo mkdir bigtree.samba; sudo chown pi:pi bigtree.samba

 

3. Append the following to /etc/fstab:

 

# Mount bigtree using SAMBA

# SAMBA-SERVER is the host name as specified in /etc/hosts (static IP address).

# This SAMBA server has a share named "bigtree".

//SAMBA-SERVER/bigtree /mnt/bigtree.samba cifs auto,owner,rw,credentials=/root/bigtree.credentials,uid=pi,gid=pi 0 0

 

4. Create /root/bigtree.credentials for the login to the SAMBA server (read and write access):

 

username=SAMBA-USER-ID

password=SAMBA-USER-PASSWORD

 

5. Test mounting changes (In general, always test immediately after making system changes!):

 

sudo mount -a

touch /mnt/bigtree.samba/xx

rm /mnt/bigtree.samba/xx

 

Now is a good time to update your system

 

sudo apt -y update

sudo apt -y dist-upgrade

sudo apt -y autoclean

sudo apt -y autoremove

sudo reboot

 

That's it

 

Find any bugs?  Suggestions for improvement?

Richard Elkins

Dallas, Texas, USA, 3rd Rock, Sol

This is a light stand for the official Raspberry Pi 7"touchscreen Display. It is designed for quick prototyping as it is lightweight and takes little time to print.

  • 4 pcs M3-0.5x5mm or M3-0.5x6mm screws are needed.

At the beginning of the design I couldn't decide what was the best angle so I ended up designing 3 stands with with different angles (45, 60 and 70 degrees) -pictures attached-. Design based on the official drawing dimensions for the Raspberry Pi 7 Inch Display.

{gallery:width=640,height=480} 3D-printed light stand for Raspberry Pi 7" Touchscreen

3D-printed light stand for Raspberry Pi 7" Touchscreen

Front: 3D-printed light stand for Raspberry Pi 7" Touchscreen

3D-printed light stand for Raspberry Pi 7" Touchscreen

Back: 7" Touchscreen Display assembled to light stand and Raspberry Pi 3

45 degrees light stand for Raspberry Pi 7" Touchscreen

45 degrees: 45 degrees light stand for Raspberry Pi 7" Touchscreen

60 degrees light stand for Raspberry Pi 7" Touchscreen

60 degrees: 60 degrees light stand for Raspberry Pi 7" Touchscreen

70 degrees light stand for Raspberry Pi 7" Touchscreen

70 degrees: 70 degrees light stand for Raspberry Pi 7" Touchscreen

3D-printed light stand -45, 60 and 70 degrees side-by-side-.

3 stand versions: 45, 60, 70 degrees stands side-by-side.

4 pcs M3-0.5x6mm or M3-0.5x5mm screws

M3 screws: 4 pcs M3-0.5x5mm or M3-0.5x6mm screws are needed for assembly.

Fastening stand to the Raspberry Pi 7" Display

Stand assembly: Fastening stand to the Raspberry Pi 7" Display

 

Print Settings

Support: No

Brim: No

Material: PLA or ABS will work fine.

Infill: 20% or more.

Notes: Any stand you may choose, needs to be printed two times, one of them needs mirroring X or Y with the slicer app.

STL files available on Thingiverse.

My complete github project (https://github.com/texadactyl/rpi_clock ) provides a Raspberry Pi Clock & Weather display (rpi_clock), based on the Quimat 3.5" TFT Touch Screen with a 320x480 resolution and their software housed at https://github.com/goodtft/LCD-show.  The primary Tk window displays date, time, and current weather conditions outside according to the Richardson Texas USA station of the Weather Underground.  If you touch the screen, it will bring up a secondary Tk window which offers the user to go back to the primary window, reboot, or shutdown.

Go back, Reboot, or Shutdown?

You can see that I set up the primary window presentation for an American-formatted date & time presentation.  Modifying this is very simple by editing bin/rpi_clock.py constants FORMAT_DATE and FORMAT_TIME.  You can easily modify colors, fonts, widths, button sizes, etc. as you wish as they are also capitalized constants.  The weather data comes in a response from the Weather Underground using a JSON-oriented API for current weather conditions.  I chose to show temperature in both Celsius and Fahrenheit.  The conditions string ("partlycloudy" in the image above) was returned by the Weather Underground as part of its JSON response message, probably formatted for American English due to the station parameters (Richardson); I simply used it as is.

Had I purchased a larger screen (E.g. 7") I could have employed graphic images and other data which would have been more aesthetically-pleasing.

Sorry but I did not show the usual unboxing of the display hardware etc. as I only thought about sharing this experience after construction finished (oops).

Note that the directions from Quimat (TFT supplier) were quite sparse (being generous).  You can see my complete review at Amazon (https://www.amazon.com/gp/customer-reviews/RXAU7YNHXRTIP/ref=cm_cr_getr_d_rvw_ttl?ie=UTF8&ASIN=B06W55HBTX).  There are probably better hardware solutions although this worked fine for a persistent old hacker like me. (=:  In their defense, I'll say that the display hardware pushed onto the Pi's GPIO connectors without issues; no wiring required.  However, watch out for the supplied plastic case because it is very brittle - mine broke [] so I slapped together a semi-protective solution (bottom of a clear case in my bottom desk drawer) that covers the bottom of the Pi.  If the TFT (protecting the front of the Pi) dies because there is nothing protecting it, I'll look for another hardware vendor product.  See? I went cheap (USD 28 for TFT, touch pen, DVD-docs, and brittle clear case) and got bitten.  Lol@myself!

I used my existing Raspberry Pi 2 and passed along its USB drive (previous blog subject) to my new Raspberry Pi 3.  It would not be terribly difficult to modify the rpi_clock.py Python 3 script to employ:

  • A different touch-screen display product which interfaces with the Raspberry Pi 2 or 3.
  • Run in another Linux distribution or under any O.S. which supports Python 3, JSON, and Tk.

 

View from the top:

View from the top

View from the bottom:

View from the bottom

GITHUB CONTENTS

Subfolders:

  • bin - rpi_clock.py (Python 3 source code)
  • docs - preparation_notes.txt (how-to do everything required - really! - after following Quimat hardware installation instructions).

 

AFTERTHOUGHTS

Admittedly, there seems to be other 3.5" TFT display products which claim to NOT require special drivers as of the latest Raspbian during 2017 (more desirable IMO). In fact, the Quimat product might too. I just got caught in the middle! Some time in the future, I might try it without the Quimat-supplied driver software. If that effort is successful, I will update this blog and the github project.

Will this work on a Pi Zero? Pi A or B?

How well did I test preparation_notes.txt?

Find any bugs?

Suggestions for improvement?

The Weather Underground seems to be world-wide.  Alternate international weather data provider?

Richard Elkins Dallas, Texas, USA, 3rd Rock, Sol

Filter Blog

By date: By tag: