This will run a morning alarm system on a Raspberry Pi.
The system includes an LED strip which will simulate a sunrise for an hour before the alarm is set to go off.
- Scheduled tasks
- Add to the superuser's cron jobs (
sudo crontab -e)@reboot /absolute/path/to/project/bash/startServer.sh*/5 * * * * /absolute/path/to/project/bash/updateScheduledAlarms.sh
- Add to the superuser's cron jobs (
- Configure nginx to use PHP
- Edit
/etc/nginx/sites-enabled/default- Add
index.phpto the line that resemblesindex index.html index.htm; - Uncomment the following lines
- Add
- Edit
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
- Configure MySQL
- Create database
Alarm- Create table
Alarmwith fieldsIDINT AUTO_INCREMENT (PK)DaysVARCHAR(7)HourINTMinuteINTActiveBOOLEAN
- Create table
Userwith fieldsIDINT AUTO_INCREMENT (PK)UsernameVARCHAR(150)PasswordVARCHAR(150)TokenVARCHAR(150)
- Create table
- Create database
- Configure alarm tone
- Place
.wavor.mp3files in thealarmTonessubdirectory; one of these files will be chosen at random each time the alarm sounds
- Place
- Set up bluetooth speaker connection
- Give user permission to use bluetooth (
sudo usermod -G bluetooth -a pi) - Give root user permission to use bluetooth (
sudo usermod -G bluetooth -a root) - Start audio server at boot (Add
pulseaudio --startto the end of.bashrc) - Pair the device manually
- Give user permission to use bluetooth (
bluetoothctl
power on
agent on
scan on
pair [MAC]
trust [MAC]
connect [MAC]
quit
- System
- mysql-server
- nginx
- php-fpm
- pulseaudio
- pulseaudio-module-bluetooth
- PHP
- php7.0-curl
- Bash
- jq
- at
- Python 3
- requests