I bought my Raspberry Pi a few months ago, mostly out of curiosity. I set up HAP-NodeJS on it over the next few weeks and got this HomeKit project working. Recently I have been tinkering a lot with ESP8266/Arduino and decided to document some projects on this website. For the HomeKit project, I had chosen to use my Raspberry Pi as the HAP server. To help make a better guide for the project (and help me not to forget!), a few days ago I put in a new SD card into the Pi and set it up from scratch. Here are the steps I followed.
Note: I am not a software developer, so I might have made some newbie mistakes and taken some shortcuts. I would appreciate if someone can point them out.
<img src="http://AdityaTannu.com/images/RpiKit.jpg" align="middle"alt=“RPiKit” height=“600”>
My Raspberry Pi came with an SD card pre-installed with NOOBS, but this time I am using a blank one.
Download NOOBS here.
Here are the instructions for installing NOOBS and then Raspbian
In my case SD Card was mounted as
Copied files from NOOBS Packacge to SD card
Insert SD card in to RPi, connect an HDMI display, mouse/KB and power up
If you did everything correctly you should have a working installation of Raspbian. At this point, you have an HDMI display, keyboard and mouse connected, so it is rather clunky. First thing, lets get WiFi working.
My Raspberry Pi kit came with an EDIMAX wifi dongle.
- Follow instructions here
- First check if wifi module is detected:
dmesg | more
Add your WiFi credentials
sudo nano /etc/network/interfaces
The file should look as follows:
auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 auto wlan0 iface wlan0 inet dhcp wpa-ssid "Your Network SSID" wpa-psk "Your Password"
Connect to the network
sudo service networking reload
Check if you have a valid IP address
Should look something like this.
``` wlan0 Link encap:Ethernet HWaddr 80:1f:02:aa:12:58
inet addr:192.168.1.8 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:154 errors:0 dropped:173 overruns:0 frame:0
TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:32399 (31.6 KiB) TX bytes:13036 (12.7 KiB) ```
- Now that wifi is working, next step is to enable SSH, so you can get rid of the keyboard, mouse and HDMI display.
SSH lets you remotely connect to your Raspberry Pi and get access to its terminal. VPN would be an option, but since most of your work is going to be in terminal, it is rather pointless (and sluggish).
- Enable SSH in this menu
- Try to SSH in from you computer. Defaults password is
ssh 192.168.1.155 -l pi
- Now that SSH is working, time for some customization.
The default hostname is
raspberrypi, I wanted to rename it to something shorter like, say,
- Open the hostname file in nano
sudo nano /etc/hostname
Rename to AdyPi, save and exit
Ensure that hostname gets applied on boot
- When you SSH in the next time, you prompt should look like
- Basically just one command
<img src="http://AdityaTannu.com/images/RPi_TFT.jpg" align="middle"alt=“RPiTFT” height=“600”>
I bought this super cheap $15 3.5” TFT touch screen. It is not really useful for the HomeKit project, but since I have it, might as well make it work!
- First copy files to Raspberry
rsync -avz -e ssh Downloads/raspberry_35_inch_ts/LCD_show.tar.gz firstname.lastname@example.org:TFTDriver/
- Install the driver
tar -xzvf LCD_show.tar.gz cd LCD-show sudo ./LCD35_v1
RPi should reboot and TFT should start
If you want to use the HDMI, you can run command:
Note: When you update the sytem, you must prevent the bootloader from updating
sudo apt-mark hold raspberrypi-bootloader sudo apt-get update sudo apt-get upgrade
Some useful commands
sudo shutdown -h now
sudo shutdown -r 0
screen: This helps to monitor multiple processes running on the RPi. Very useful when running HAP-NodeJS and mosca (MQTT broker) at the same time.
Start processes at bootup