Git Product home page Git Product logo

piclock's Introduction

Pi Clock

Raspberry Pi Based Internet Radio Alarm clock with 3.5 inch touchscreen. Each day of the week can have a differant alarm time and internet radio station to play. Also has a "Holiday Mode" which sets the alarm to a fixed time.

Originally based on http://mattdyson.org/projects/alarmpi/ (https://github.com/mattdy/alarmpi) But its changed considerably

Features

  • 3.5 inch TFT touch screen
  • Web page for alarms and settings
  • api for use by the above webpage
  • fsapi for use by OpenHab (or can use MQTT)
  • Uses Google calendar to indicate holidays when that days alarm goes of later (at a fixed time)
  • Optional MQTT server for radio and alarm control as well as station name and URL configuration

Hardware required

Install packages Etc

  • Python 2
  • mplayer2
  • mplayer.py
  • festival
  • Fonts

mplayer Install

Plays the Inernet radio streams

sudo apt-get install mplayer2

mplayer.py Install

Python interface to mplayer2

sudo git clone https://github.com/baudm/mplayer.py.git

The clone command puts the code in the mplayer.py folder so link mplayer to a sub folder where the piclock.py is

cd piclock
ln -s mplayer ..../mplayer.py/mplayer

festival Install

Allows the clock to speak. Two choices "festival" or "pico"

sudo apt-get install festival
sudo apt-get install libttspico-utils

Fonts Install

Install 7 & 14 segment Font from http://www.keshikan.net/fonts-e.html

Probably

sudo apt-get install fonts-dseg

Python 2 Librarys

sudo apt-get install python-gflags python-httplib2
sudo apt-get install python-dateutil
sudo apt-get install python-pip
sudo pip install pytz
sudo pip install --upgrade google-api-python-client
sudo pip install --upgrade oauth2client
sudo pip install --upgrade oauth2client.tools
sudo pip install TSL2561
sudo pip install Adafruit_GPIO

SSL Certificate generation

openssl req -new -x509 -keyout serverssl.key -out serverssl.crt -days 365 -nodes -extensions req_ext -config sslconfig.txt

Sample sslconfig.txt provided in the config directory. This certificate will have to be renewed every 365 days

Calendar credentials

  • Generate Client ID and Client Secret
  • Copy and rename the file ~/piclock/config/client_secret.json.txt to \~/piclock/calendar-python.json (Note change of name)
  • Edit the file calendar-python.json and fillin <CLIENTID> and <CLIENTSECRET>
  • Run the code as follows
sudo python piclock.py  --noauth_local_webserver
  • Copy the displayed URL and past into your web browser
  • Follow the prompts to allow accesss
  • Copy and Paste the authorisation code back into piclock
  • You can then stop piclock using CRTL+C and start it normally

Note

  • If the clientid or client secret change, delete your previously saved credentials
  • at ~/.credentials/calendar-python.json

TFT Configuration

Follow instruction at https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi

Starting the Clock

Manual Startup

sudo python piclock.py

Starting this way logs everything to the screen

Auto Startup

You should do this only when you're sure the clock is working correctly when you start it manually

sudo ln -s /home/pi/piclock/piclock.sh /etc/init.d/piclock

Logs go to /home/pi/piclock/piclock.log and as a last resort /home/pi/piclock/piclockerror.log Normally errors will go to the normal piclock.log as "INFO" due to the web server also logging connections to stderr

FSAPI based on the following

piclock's People

Contributors

pjwerdna avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.