Using the Raspberry to use a local emonCms server (with ready-to-use disk images)

This is the most straightforward way of getting your system running. The drawback is that it is more difficult to update to the latest version of emonCms.

1 Write the disk images

This installation is based on this tutorial.

  • Download the images that will be written on the SD card (boot) and on the external hard drive (file system).
  • Extract it and you will get two images : boot.img (SD) and pi_hdd_stack.img (HDD).
  • Plug in the SD card to your computer and write the boot.img file to the SD card. On Linux run this command (changing /dev/sdX to the one assigned to your SD card) :
    sudo dd bs=4M if=boot.img of=/dev/sdX
  • Plug in the USB hard drive to your computer and write the pi_hdd_stack.img file to your hard drive. On Linux run this command (changing /dev/sdY to the one assigned to your hard drive) :
    sudo dd bs=4M if=pi_hdd_stack.img of=/dev/sdY
  • Using a software like gparted, resize the partition that was created to 10 Go (by default it is 2.9 Go and may be too small to log all your data).

2 Getting started

  • If you can, plug in an external monitor to your Raspberry PI so that you can see what is happening.
  • Power on the hub : the Raspberry Pi should be switched on and start.
  • Connect to your Raspberry Pi over ssh (password is by default 'raspberry') :
    ssh pi@<RASP_IP>
  • Look at the /etc/fstab file, you should have something like this :
    proc    /proc   proc    defaults    0   0
    /dev/mmcblk0p1  /boot           vfat    defaults    0   2
    /dev/sda2   /   ext4    defaults,noatime    0   1
    • /dev/mmcblk0p1 is the device corresponding to your SD card and is mounted and the /boot partition
    • /dev/sda2 is the device corresponding to your USB drive.
    • Note : If your /boot directory is empty and if during the boot of the Raspberry Pi you got an error message like : “special device /dev/mmcblk0p1 does not exist” it means that the device name of your SD card is wrong. Run
      df -h

      and see what is the name, change the line in /etc/fstab/ accordingly and reboot.

    • Configure date / time by running
      sudo dpkg-reconfigure tzdata

      . Normally the UTC date/time should be automatically set at startup by the ntc service.

3 Configure emonCms

  • Make sure the date/time is right. By default the Raspbian uses the ntp protocol for clock synchronization.
  • Launch your browser and connect to you local emoncms :
  • Click on “Raspberry PI” in the main menu and configure your installation like this. If you also wish to send the data to the remote server, enter your API key. Click on the save button to save your changes
  • Click on “Inputs” in the main menu. After a while you should see data from your sensors.

4 Update emonCms

  • Make a backup of the /var/www/emoncms directory
  • Go to the /home/pi/usefulscripts directory and execute :
    chmod +x
    sudo ./
/var/www/tech_mirelsol/data/pages/projects/open_energy_monitor_unmonastery/raspberry_local_emoncms_images.txt · Last modified: 13/05/2014 12:25 by Mirelsol