Saturday, July 12, 2014

NodeJS / Express and Restful API on the PI

Am now looking at how to provide a restful interface for the PI using NodeJS thankfully there was already a blog entry that explained how to get started with exposing a restful interface ( GET , POST , DELETE) using NodeJS express.

So if you are like me and want to have something clean and easy that gets you up and running check out the following :

All the codes work seamlessly on the Raspberry PI .

I also found a NodeJS plugin which seems very promising to integration with omxplayer at the following link:

I have thus managed to integrate a REST API on the PI that allows me to Post a Request to play a file and it actually calls omxplayer and the video file is played on my HDMI TV.

I will post a sample Express NodeJS file once I have something working well with basic features e.g

1. Controls for pausing , forward etc..
2. Availability to display currently playing file in list
3. Looping
4. Amount of time remaining (no idea if this is achievable)
5. etc..

Saturday, July 05, 2014

No Audio on Raspberry PI

If for some reason you are not getting any audio through omxplayer on your Raspberry Pi , try the following steps:

  1. Execute:  sudo nano /boot/config.txt
  2. Uncomment line:  hdmi_drive=2
  3. Re-start your Raspberry Pi such as it reboots
  4. Connect to your PI again and try to play a file e.g  omxplayer -o hdmi /home/pi/myNAS/myShare/The.Big.Bang.Theory.mp4
The important thing is to use the -o hdmi option.

Mounting a NAS Drive on Raspberry Pi

I got my Pi last year in December and I know i went through the painful task of searching for all the options for configuring my Pi to access a NAS (Network Attached Storage) drive. In my case my Transcend 750GB HD is connected to my Orange Livebox .

Today I decided that I would restart from scratch with my PI installation as OMXPlayer somehow stopped working so am writing this up such as others can quickly setup their NAS drive.

First thing you need to create the following directory on your PI :


this is simple as executing :

  1. mkdir myNAS
  2. then cd myNAS
  3. mkdir myShare
Once you've create the directory you need the following information :

  • Location of your NAS storage device e.g //livebox/myNASLocation
  • Username and password to connect to the NAS device e.g myUsername / myPassword
Then login to your raspberryPi and execute the following command:

  • sudo nano /etc/fstab
You will need to specify the mapping for the NAS within this file simply add a line like the following to the file within the nano editor:
  • //livebox/myNASLocation/  /home/pi/myNAS/myShare cifs username=myUsername,password=myPassword,uid=pi  0 0

Obviously you will need to replace :

  1. //livebox/myNasLocation/  
  2. , myUsername with your actual NAS username
  3. and myPassword  with password for your NAS
-with your own values.

Now do a CONTROL+X  to exit nano , enter Y to save and enter on your Return to exit Nano.

Just to make sure you might want to re-open the file to check whether the settings were correctly saved.

Now that we have added the value , the last thing that to do is to mount the NAS , simply enter the following command :

  • sudo mount /home/pi/myNAS/myShare