Skip to content
Permalink
f3ace5ae9d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
73 lines (47 sloc) 2.17 KB

Raspberry Pi Zero W

In this lab you will be configuring a Raspberry Pi Zero as a Bluetooth iBeacon.

Start by installing the Raspbian Stretch Lite image and installing it on the SD card. Before we plug it into the Raspberry Pi we need to configure the network and enable ssh. Eject the SD card from your computer then plug in back in again to access the boot partition.

Create a file called wpa_supplicant.conf and insert the following code, subsitituting the SSID and password for your wireless network:

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
       ssid="SSID"
       psk="PASSWORD"
       key_mgmt=WPA-PSK
    }

SSH is disabled by default, to enable this create a blank text file in the boot partition called ssh. If you eject the SD card you need to insert it into the RPi and boot it up. It will have the network name raspberrypi. You should be able to ssh using the username of pi and the password raspberry.

Once in you need to change the permissions to allow non-root users to use the hcitool and hciconfig commands.

sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hciconfig`

To set up the device as an iBeacon you should use the PiBeacon.sh shell script you will find in the exercises/ directory, passing it your SSID, major and minor.

./PIBeacon.sh DCEF54A2-31EB-467F-AF8E-350FB641C97D 99 0

https://medium.com/@aallan/setting-up-a-headless-raspberry-pi-zero-3ded0b83f274

https://bbs.archlinux.org/viewtopic.php?id=215080

https://github.coventry.ac.uk/leej64/PIBeacon

Camera

interfacing options to enable camera.

Simple shell script to take a photo:

#!/bin/bash

mkdir -p timelapse
raspistill -o timelapse/$(date +%Y%m%d-%H%M%S).jpg

Set up a crontab to run every 5 min, start by editing the crontab with crontab -e. Add the following line:


Tnen restart the crontab:

sudo systemctl restart cron

From a local machine, sync the photos:

mkdir -p timelapse
rsync -avzh USERNAME@HOSTNAME:/home/USERNAME/timelapse/* ~/Downloads/timelapse/