Setting date and time in Pi

First to configure the timezone

  1. Enter the command:
    • sudo dpkg-reconfigure tzdata
  2. Link for more explanation.

Configuring time:

  1. If time differs from the current time by a significant amount, need to set manually by using the command:
    • sudo date -s “Thu Aug  9 21:31:26 UTC 2012”
  2. Configure the NTP to sync the time (require internet connection)
  3. Enter the command to edit the NTP config
    • sudo nano /etc/ntp.conf
  4. Visit the NTP website to select list of server near the region
  5. Restart the daemon:
    • sudo /etc/init.d/ntp restart
  6. For information, see the link


Scheduling jobs on RPi

  1. Enter following command in Pi terminal
    • crontab -e
  2. Enter a new job by entering the time at which the program is scheduled to run e.g
    • 0 0 * * * python ~/UserScripts/ which will run a python script in the folder UserScripts at every day at midnight.
  3. To see if the script is working, can add in log of the output using
    • 0 0 * * * python ~/UserScripts/ >> havlog.log which will have a log file “havlog.log” at the /home/pi directory.
  4. A problem using seen in the the crontab not working is that the directory or file path is not correctly set.
  5. More Information is shown in link.
  6. More on debugging crontab can be found in link.

Remote Desktop to Pi

At the Pi side:

  1. install vncserver using command:
    • sudo apt-get install tightvncserver
  2. Run the command to active the VNC server:
    • vncserver :1 -geometry 1024×600 -depth 16 -pixelformat rgb565

At the Computer (to remote access the Pi):

  1. Install putty.exe for SSH log in.
  2. Download and install tightvnc
  3. SSH in using putty to remote computer (known IP)
  4. Type “vncserver :1” into terminal

To kill the VNC server (at Pi side):

  • Type: vncserver -kill :1

In the case where the blank screen is experienced:

  1. Type in command to open the file:
    • sudo nano .vnc/xstartup
  2. Edit the file by replacing the contents with below:
    • !/bin/sh
      xrdb $HOME/.Xresources
      xsetroot -solid black
      /usr/bin/lxsession -s LXDE &

More resources can be found below:

  1. Basic Installation
  2. Solution tp the Empty screen and set up remote desktop automatically

Resolve keyboard layout Issue in Raspberry Pi

Resolve keyboard character mismatch or keyboard layout issue.

  1. Keyboard setting for the pi might be in Great Britain format causing the mismatch in character displayed.
  2. Resolved by:
    1. Enter command: sudo nano /etc/default/keyboard (use nano editor)
    2. Change XKBLAYOUT=“us” in editor
    3. Save and Reboot:  sudo reboot
  3. Some of links that are helpful include: