- Table of contents
- Raspberry Pi
Raspberry Pi¶
A collection of helpful information on using / applying the Raspberry Pi!
Troubleshooting¶
Is your team's Raspberry Pi having issues? Not sure whether you did something wrong or the Raspberry Pi itself is malfunctioning? Check out the following Raspberry Pi Troubleshooting guide. By following this guide, you perform a test on all the hardware inputs and outputs of the Raspberry Pi. Compatible with all Raspberry Pi versions!
export:Software files/Raspberry Pi/Design Lab Raspberry Pi Test Plan.docx
Raspberry Pi Test Plan Table of Contents¶
- First boot
- Networking
- Audio
- GPIO
- USB Webcam
- Raspberry Pi Camera
- Bluetooth
- Ethernet
- Common FAQ
There is a Python test script bundled with this troubleshooting guide, which can be found below.
export:Software files/Raspberry Pi/simple_gpio_test.py
Connecting to RPi 3 to RPI WiFi¶
For Raspberry Pis running the latest Raspberry Pi OS, based on Debian Bookworm or later, NetworkManager is used to configure the network settings of the Raspberry Pi. See the Networking section of the Raspberry Pi Test Plan in the previous section for help connecting to a WPA Enterprise network such as RPI WiFi.
For Raspberry Pis running Raspberry Pi OS that are not based on Debian Bookworm or later, wpa_supplicant
needs to be modified in order to connect to RPI WiFi.
• Add following lines to /etc/wpa_supplicant/wpa_supplicant.conf
• Use tab instead of space
• Ensure there’s NO space at the end of each line
• Use an RCS account for identity and password. Note that the password is not encrypted.
network={ ssid="rpi_wpa2" scan_ssid=1 key_mgmt=WPA-EAP eap=PEAP identity="<RCS ID>" password="<RCS password>" phase1="peapver=0" phase2="auth=MSCHAPV2" }
Connecting to HDMI TV's¶
When connected to a Visio 55" LED TV, the output from the Pi did not fill the screen. Using the information found at: http://elinux.org/RPi_config.txt#Which_values_are_valid_for_my_monitor.3F add the following lines to \etc\config.txt
# force HDMI mode hdmi_drive = 2 # force DMT / computer mode hdmi_group = 2 # force proper 1920x1080 resolution hdmi_mode = 82
Then reboot!
Using VNC to Access the RPi¶
Sparkfun has created tutorial on this: https://www.sparkfun.com/news/2727
Displaying your PC screen on the Pi¶
This is accomplished in two parts. First, the Pi runs a vncviewer in listen mode. Second, the PC runs a vncserver that can push a connection to a viewer.
On the Pi¶
Screensaver¶
Disable the screen saver / screen blanking by alterning the lightdm configiuration as found on this website: http://raspberrypi.stackexchange.com/questions/2059/disable-screen-blanking-in-x-windows-on-raspbian
Edit /etc/lightdm/lightdb.conf and add the following line to the [SeatDefaults] section:
xserver-command=X -s 0 -dpms
VNC Viewer¶
Install a vncviewer:
sudo apt-get install xtightvncviewer
Based on information found at http://www.raspberrypi.org/phpBB3/viewtopic.php?f=27&t=43473 , put the following shell script in a file which we shall call start-viewer.sh (note that I did not bother to make it a one liner):
#!/bin/sh export DISPLAY :0.0 xtightvncviewer -listen
and make it executable:
chmod +x start-viewer.sh
Then, you must enable others to access the 0 display:
xhost +
If xhost is not already installed you will need to do:
# intsall xhost sudo apt-get install x11-xserver-utils
Then you need to run xhost so that all nodes can get in - yes this is NOT secure!
xhost +
Note that this provides the most unsecured access! Experiment with xhost to narrow down the range of those who can output to the main X window display (screen 0).
By executing the following command, the vncviewer will be started and left running and will return control back to the terminal:
nohup ./start-viewer.sh &
I recommend placing this in an 'autostart' file so that the vncviewer is started every time the Pi boots and the LXDE display manager starts up. This was found at: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=91&t=11256
*Create the folder home/pi/.config/lxsession/LXDE*In this folder put a file named autostart containing one line specifying the full path of the file to be executed:
- /home/pi/start-viewer.sh
*Make the autostart file executable by using the properties menu in the File Manager to alter the permissions on the file or use: - chmod +x home/pi/.config/lxsession/LXDE/autostart
Next time you reboot the vncviewer will automatically get started!
At this point, the Pi is ready to display a screen from whoever connects to it! If the above command is added to the startup scripts then it will automatically get launched when the Pi boots. alternatively, you can SSH into the Pi and run that command to start the viewer.
It has been noted that connecting to the vncviewer does NOT cause the screensaver to 'wake up' so for this application it appears that it should be disabled.
On the PC¶
VNC Server¶
The PC now needs a vncserver (NOT a vncviewer) that can connect to an existing listener. I have used tightvnc successfully for several years (on XP, Vista and now windows 7) and so I can recommend it. Download and install it from: http://www.tightvnc.com
Once installed, simply run the vncserver. It will place an icon in the system tray. Right click on that and choose "Attach Listening Viewer" and when prompted, provide the name or IP address of the node hosting the viewer, in this case the Pi. At this point your PC screen should be visible on the Pi's display. Note that if the Pi is running 1920x1080 then it may be 'larger' that your PC's display. If you run a two monitor setup on the PC, part of the second monitor's output may show up on the Pi. simply move that off screen if needed.
When you are done screen sharing, simply right click on the vncserver and choose "Disconnect all viewers" which will drop the connection.
In this configuration, many PC users may connect to the same Raspberry Pi without making any changes to the Pi. ONLY one PC can connect at a time.
Displaying the Pi on your PC¶
This is a standard Linux technique and is not unique to the Pi. On the Pi, you need a vncserver. One was already installed on the Wheezy distribution. If needed, you may install the tightvnc pages by using a terminal window and running:
sudo apt-get install tightvncserver
Once it's installed, run the following to start the server on display 1:
tightvncserver :1
It will prompt for a password for full access and a second one for read-only access. This starts the server with the default geometry of 1024x768.
You may also start multiple vncservers. For example, I can start a second server on display 2 with a higher resolution to match my PC's monitor resolution using:
tightvncserver :2 -geometry 1650x1050
Doing this leaves a server running for my high resolution PC access and a default one in case I connect from some other device / PC (like an Android tablet).
Changed to Fixed IP¶
The default for most Lijux systems including the Pi is to come up with a dynamically assigned IP address using DHCP. When using the Pi as a server, it may be more appropriate to use a fixed IP address.
NOTE - the fixed IP shown here is already assigned to Mark Anderson (see the assignment list on Virtual Machines. You will need to obtain a new/different address for your use.
Use your favorite editor or nano to edit /etc/network/interfaces. You must do this as superuser, so do this to make the edits:
sudo nano /etc/network/interfaces
And comment out this line:
iface eth0 inet dhcp
and replace it with:
# Your NAME and DATE HERE - always comment your changes! #iface eth0 inet dhcp iface eth0 inet static address 128.113.216.67 netmask 255.255.252.0 broadcast 128.113.219.255 gateway 128.113.219.254
Accessing the Campus VPN Network¶
This does NOT work yet - BUT the correct approach is to install the vpnc client.
Install vpnc¶
sudo apt-get install vpnc
Update the Configuration¶
You'll need to edit the config file located in /etc/vpnc/default.conf OR COPY it to /etc/vpnc/rpi.conf
sudo cp /etc/vpnc/default.conf /etc/vpnc/rpi.conf
In that file, you'll need to un-commment some lines and add make changes to a few as shown below. FYI - "psk" means "pre-shared key".
The original default file:
#IPSec gateway <gateway> #IPSec ID <group-id> #IPSec secret <group-psk> #IKE Authmode hybrid #Xauth username <username> #Xauth password <password>
The modified file when using an off campus network is shown here. If you need to use VPN from ON campus then the gateway should be vpn.wl.rpi.edu (as in wl = wireless lan).
IPSec gateway vpn.net.rpi.edu IPSec ID rpi IPSec secret c26!8m #IKE Authmode hybrid #Xauth username <username> #Xauth password <password>
If you do not include your RCS username and password (on the Xauth lines) it will just prompt you for that.
Accessing the VPN¶
From a terminal window use:
sudo vpnc defaultif you modified the default file OR use
sudo vpnc rpiif you made a copy of the default file and renamed it to rpi.
The above SHOULD work but does not yet appear to. This will be updated after we determine the problem.