Instructibles Calendar Raspbian Project

The following is from Instructibles.com
The project is everywhere you search when looking for top projects.
Here is the contents
Awesome Authors:  and 
Equipment you will need

  • Home network (wireless if you can’t run a cable to the Pi)
  • Raspberry Pi (I’ve used the model B)
  • SD card 2GB or larger
  • AC Adaptor (I used a USB wall charger for mobile phones check here http://elinux.org/RPi_VerifiedPeripherals#Power_adapters)
  • Micro USB cable
  • USB keyboard and mouse
  • USB wireless adaptor (MAKE SURE IT IS COMPATIBLE OUT OF THE BOX http://elinux.org/RPi_USB_Wi-Fi_Adapters)
  • HDMI cable
  • Wall mountable HDMI capable monitor or any monitor with some kind of HDMI converter
  • Wall bracket for your monitor

*I will not be showing how to wall mount your monitor as the bracket was already on my wall*

Step 1: Raspberry Pi Setup

Picture of Raspberry Pi Setup
step2-2.png
First we’ll setup the Raspberry Pi, to do this you’ll need to have Raspbian installed. You can buy a Pi with Raspbian pre-installed or you can use a 2GB or larger SD card that you already have.

I am using an SD card I already have. Plug the SD card into your computer and download the latest Raspbian http://downloads.raspberrypi.org/raspbian_latest

I’m using windows so I unzipped the file and used win32diskimager (http://sourceforge.net/projects/win32diskimager) to write the Raspbian image to the SD card.

If you are still not sure there is a tutorial here http://elinux.org/RPi_Easy_SD_Card_Setup

Ok now we have Raspbian installed it’s time to get our Pi up and running, plug in your SD card, Wi-Fi dongle, USB keyboard, Ethernet cable to your router, HDMI to your monitor and lastly the micro USB cable to the power socket. The first time you boot up you’ll end up with the configuration screen.

The changes you need to make are:

  • Expand the filesystem so Raspbian utilises the entire SD card
  • Change your password
  • Enable boot to desktop
  • Set your language, region and time zone

Go into advanced options

  • Change your hostname so you can recognise your Pi on the network.
  • Enable SSH so you can access your PI from a computer on your network.
  • Select finish which should restart your Pi.

Step 2: Keyboard and updates

Picture of Keyboard and updates
If you are in the US or Australia like me you will want to change the keyboard layout to US.
To do this you’ll need to change a file by opening your terminal and entering the command:

sudo nano /etc/default/keyboard

Use the arrow keys to move the cursor and change the gb to us.
Now save the file by pressing ctrl + X and Y to save changes

Now to update your Pi, type the following commands:

sudo apt-get update
sudo apt-get upgrade

Press y and hit enter to download updates (this will take ages so go have a coffee/beer).

Step 3: Wireless Setup

If you just want to use Ethernet you can skip this step.

To get your Wi-Fi dongle working you may need to edit the wpa_supplicant.conf file by typing

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Then make it look like this:

ctrl_interface=/var/run/wpa_supplicant
network={
proto=RSN
scan_ssid=1
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
ssid=”your network ID in quote marks”
psk=”your network password in quote marks”
}
update_config=1

To save the file press ctrl + x then Y and enter to save

Restart the Pi by entering:

sudo reboot

You should be able to see if your Wi-Fi dongle has an IP address with the command

sudo ifconfig

You should get something like this

wlan0     Link encap:Ethernet  HWaddr 64:66:b3:06:43:1b
inet addr:10.0.0.75  Bcast:10.0.0.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:912384 errors:0 dropped:121692 overruns:0 frame:0
TX packets:706463 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:694114055 (661.9 MiB)  TX bytes:71017681 (67.7 MiB)

Step 4: Iceweasel

Now we’ll install a browser that actually displays your google calendar properly. Iceweasel is a derivative of Mozilla’s Firefox, to install enter the following command.

sudo apt-get install iceweasel

Type y and hit enter to complete download and install.

Once complete Iceweasel should pop up in the menu under internet, open it so we can start configuring. First open up your google calendar and save the password in case you get logged out at some point. Now set google calendar as your start page.

Now we need to disable restore pages after crash in case of power outage google calendar might not show up by itself which is annoying if you have no KB/Mouse connected.

Type in about:config in the address field and hit enter.
Now find the “browser.sessionstore.resume_from_crash” line and double click to change it to false.

Hit the F11 key to go fullscreen and hover your mouse at the very top of the screen then close the browser once the x appears in the top right corner.
Re-open the browser and it should open to your google calendar and still be full screen.

We also want Iceweasel to start automatically so we’ll need to change the autostart options.

sudo nano /etc/xdg/lxsession/LXDE/autostart

add @iceweasel to the list
now press ctrl+x the Y and enter to save the changes

Step 5: Cursor and powersave

The next step is to get rid of that pesky mouse cursor and stop the screen from going to powersave/sleep mode.
First we’ll install Unclutter to get rid of the cursor when it’s not in use.

sudo apt-get install unclutter

Now we need to edit the /etc/lightdm/lightdm.conf file to prevent powersave/sleep mode

sudo nano /etc/lightdm/lightdm.conf

Move down to: [SeatDefaults]
Change this line:
#xserver-command=X

to this:
xserver-command=X -s 0 –dpms

now press ctrl+x then Y and enter to save the changes

Instructible Calendar v2.0…..
This is an addition to Piney’s awesome directions. I wanted a Google calendar display with a webcam as a motion sensor so that the monitor will only turn on when someone is near it and turns off when nobody is around. I also added a weather panel to display weather with the calendar.

Materials needed:
-Raspberry Pi
-Compatible Webcam (list of compatible ones here) I’m using a Logitech C270.
-Powered USB Hub for Webcam (some of them can also be used to power the Raspberry pi as well!) List of compatible powered USB hub. I’m using a Plugable 7 Port USB from Amazon which I’m using to power the Raspberry pi itself.
Step 1: Setup Raspberry Pi Google Calendar

Follow Piney’s direction’s here.

NOTE: Skip the part about powersave/sleep since we are using webcam to control when monitor turns on and off.

Step 2: Setup Webcam / Motion

Setup Motion by following the “Step #3: Setup motion” on Alex Nikolaidi’s instructions on how to setup a raspberry pi alarm system.

IMPORTANT: Type the following command into console:

sudo chmod u+s /bin/chvt
This allows motion to turn monitor back on directly from the motion configuration file (this took me 2 hours to figure out..)

Adjust the following settings to motion.conf (find where they are in the file and edit the settings):

gap 40
# This is seconds you like monitor to be on, I’m using 40, you can changes this to your liking.

on_event_start /opt/vc/bin/tvservice -p ; chvt 6; chvt 7
# This turns on the monitor when motion is sensed.

on_event_end /opt/vc/bin/tvservice -p; /opt/vc/bin/tvservice -o
# This turns off the monitor when motion is sensed

ffmpeg_cap_new off
ffmpeg_cap_motion off
output_normal off
output_motion off
# These settings turn off capturing movie and images on each motion detected in the default director (/tmp/motion). This helps so the SD card is not getting constantly written by new images/movies.

Optional: use a mask file by editing “mask_file” to your liking on the motion.conf. More info about mask file here.

Start the motion daemon and test it make sure monitor turns on when you are in front of the camera and off when you are away form the camera.

Step 3: Optional weather side panel setup

a) get conky:
sudo apt-get conky

b) Get a weather configuration you like. I used 1a)Accuweather_ConkyWeather_Font from TeoBigusGeekus so the rest of the directions will be specific to this file. However you can modified the instructions to any Conky weather widget you like to use.

c) Follow directions on the 1a_accuweather_conkyweather_font\1a_README_INFO\1a_README.pdf on the expanded tarball you downloaded from TeoBigusGeekus.

d) IMPORTANT: make the following change to .conkyrc_1a_usa (or the international version if you are not in the USA) or else you will not see a window under LXDE:

own_window_type panel
(You can change it to a normal window if you want but I find panel makes the weather widget always on top, I haven’t found a way how to set it up so it’s always on top without doing a panel)

e) Optional adjust alignment, color and transparency on .conkyrc_1a_usa to your liking, my settings are:
own_window_transparent no
own_window_colour black
alignment bottom_left

f) Finally edit LXDE startup file so conky will autostart
sudo nano /etc/xdg/lxsession/LXDE/autostart
add this line:
@conky -c ~/1a_accuweather_conkyweather_font/.conkyrc_1a_usa

That’s it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s