2019-04-21
Previously, we described why we would want to use these extra tools in a daily development process. In this post, we will show you the exact steps needed to build a basic system that consists of a Raspberry Pi (any model will do, in our case we've used a model Zero W) connected to a main computer (such as a MacBook) via Wifi, sharing the mouse and keyboard via Synergy, and displaying to a LCD monitor via HDMI.
You can either opt for a Raspberry Pi Zero with integrated Wifi or cheaper one without. This is the minimum hardware required:
Item Cost (GBP) Link
Raspberry Pi Zero W 11.30 https://thepihut.com/products/raspberry-pi-zero-w
16GB microSD card 3.34 https://www.amazon.co.uk/gp/offer-listing/B079H6PDCK
MiniHDMI adapter 1.00 https://www.ebay.co.uk/itm/173637998004
--------------------------------------------------------------------------------------------
TOTAL 15.64
OR
Raspberry Pi Zero 7.65 https://thepihut.com/products/raspberry-pi-zero
MicroUSB OTG adapter & 1.13 https://www.ebay.co.uk/itm/153447624953
MiniHDMI adapter
USB wifi adapter 1.00 https://www.ebay.co.uk/itm/183750479953
16GB microSD card 3.34 https://www.amazon.co.uk/gp/offer-listing/B079H6PDCK
--------------------------------------------------------------------------------------------
TOTAL 13.12
You will also need some means of powering the RPi0, either use your LCD display's USB plugs if available or use a 5V/2A mains power to microUSB adapter. These can easily be found refurbished or lot sale LCD monitors with self-powered (monitor powered) USB hubs for powering the Pi. For example, a HP Compaq LA2405x 24-inch LCD which sells for £63 in April 2019.
wpa_supplicant
file corresponding to your Wifi network into the root directory of the SD card.ssh
file in the same root directory: touch /Volumes/boot/ssh
(on MacOS)config.txt
file to disable any optional hardware access.ssh [email protected]
to log in with password "raspberry"
.raspi-config
, change your hostname to something unique so you may identify it locally, e.g. jimspi
RPD is based on LXDE, following these steps will set us up correctly under this environment.
sudo apt-get install synergy vim
synergy.host
and write the IP of your Synergy host here.initSynergy.sh
: we'll reuse this for startup as well as host IP changes.#!/bin/bash
killall synergyc
# Ref: https://unix.stackexchange.com/questions/122845/using-a-b-for-variable-assignment-in-scripts
# Replace jimspi with the name of your own Raspberry Pi
synergyc --daemon --name jimspi --restart "${1:-$(cat synergy.host)}"
# Make this the new default host
if test -z "$1"
then
echo "$1" > synergy.host
fi
Allow it to be executed by running:
chmod +x ./initSynergy.sh
Now create an auto-start entry:
sudo vim /etc/xdg/lxsession/LXDE-pi/autostart
then add this to the end:
@sudo /home/pi/initSynergy.sh
Configure boot options to automatically login to the Desktop on startup:
sudo raspi-config
Finally we need to run sudo reboot
. After this restart your system is ready for use.
initSynergy.sh
sudo ./initSynergy.sh <HOST_IP>
uses a new address. Use this command when your host IP has changed and the Synergy client needs to connect to this new IP. SSH into the Pi and run the script to reset.
sudo ./initSynergy.sh
uses the IP contained in the synergy.host file
In the next post, we will go over how to show the Pi's IP on the desktop, and performance tweaks allowing your Pi run more programs with less system resources.
Cohesive.dev provides comprehensive software, operating system, and network configuration audit services to ensure your computing resources continue to work reliably and efficiently. Improve your system setup by contacting us today.