thegreatmisdirector
Posts: 1
Joined: Sat Sep 19, 2015 2:15 am

What do I need?

Sat Sep 19, 2015 2:34 am

Someone let me know if I'm not doing this right: I want to tell you what I'm trying to accomplish and if you could provide some advice on what I'll need, I'd appreciate it.

My wife loves Disney princesses, she grew up loving them and would love to share them with our daughter. We never bought any of the DVDs or Blu-Rays for these movies and no longer own a VCR. So I'd like to use a Raspberry Pi to create a device that will play these movies at the push of a button! There are 12 movies that I'd like to have stored on this device and that's pretty much it. More detailed, I want to have a figurine of each princess behind the button for that specific movie so that when my daughter gets older, she can push the button in front of Ariel and The Little Mermaid will come on.

I don't really have a budget but I'd like to do this as well as I can without completely breaking the bank.

I'm also trying to determine what to put the Pi in/figurines and buttons on. I don't want some plain box, but I don't want anything too massive. Any cool ideas for that would be appreciated as well.

Additionally, does this seem realistic for someone without programming experience? I know my way around a computer moderately but I've never programmed in my life.


Thanks and if this isn't the right place for this, could someone tell me where to go??

Thanks!

fruitoftheloom
Posts: 17675
Joined: Tue Mar 25, 2014 12:40 pm

Re: What do I need?

Sat Sep 19, 2015 3:12 pm

thegreatmisdirector wrote:Someone let me know if I'm not doing this right: I want to tell you what I'm trying to accomplish and if you could provide some advice on what I'll need, I'd appreciate it.

My wife loves Disney princesses, she grew up loving them and would love to share them with our daughter. We never bought any of the DVDs or Blu-Rays for these movies and no longer own a VCR. So I'd like to use a Raspberry Pi to create a device that will play these movies at the push of a button! There are 12 movies that I'd like to have stored on this device and that's pretty much it. More detailed, I want to have a figurine of each princess behind the button for that specific movie so that when my daughter gets older, she can push the button in front of Ariel and The Little Mermaid will come on.

I don't really have a budget but I'd like to do this as well as I can without completely breaking the bank.

I'm also trying to determine what to put the Pi in/figurines and buttons on. I don't want some plain box, but I don't want anything too massive. Any cool ideas for that would be appreciated as well.

Additionally, does this seem realistic for someone without programming experience? I know my way around a computer moderately but I've never programmed in my life.


Thanks and if this isn't the right place for this, could someone tell me where to go??

Thanks!
You are not clear about the Movies, are they on a VCR Tape :?:
Adieu

danjperron
Posts: 3076
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: What do I need?

Sat Sep 19, 2015 4:04 pm

Why not doing like Nintendo!

Use an RFID reader and put a sensor inside each figurine. When you put the figurine under the reader it will run a script which start a movie from a mpeg or mp4 file. When the figurine is removed from the reader you run a script to kill the player application.

The RFID reader is cheap. A RC-522 will be okay.
http://www.dx.com/p/rfid-rc522-rf-ic-ca ... f2GvLTlhCc

ghans
Posts: 7807
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: What do I need?

Sat Sep 19, 2015 6:04 pm

https://pipresents.wordpress.com/

should do what you want and be relatively easy to use. Don't forget to read the manual.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

danjperron
Posts: 3076
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: What do I need?

Sun Sep 20, 2015 3:00 am

Ok this is a proof of concept using rfid stamp to change video on the fly.

This is the video

https://dl.dropboxusercontent.com/s/89l ... ngRFID.MP4

I'm using this code to read the RFID

https://code.google.com/p/rpi-rc522/source/checkout

I compile the code and install the executable into /usr/local/bin

Code: Select all

cd ~/rpi-rc522-read-only/rc522
gcc config.c rfid.c rc522.c main.c -o rc522_reader -lbcm2835
sudo cp rc522_reader /usr/local/bin

Now with the debug mode , the -d at the end, I was able to figure out the serial number of the RFID stamp.

On the config file in /etc/RC522.conf I enter the serial number of the stamp and ask to echo the movie file name to a pipe /tmp/fifoRFID

sudo nano /etc/RC522.conf

Code: Select all

# SPI_SPEED - spi clock rate in kHz. Must be >=4 and <=125000
SPI_SPEED=5000

#User id and group id (no user root allowed)
#I select the  'pi' user
UID=1000
GID=1000

# Path for store memory dump of UltraLight tags. File will named as serial number.
NEW_TAG_PATH=/tmp/

#GPIO pin (bsm2835 gpio number!) for indiction of active tasks.
#GPIO=18
[95c95806] echo -n Barcelona.mp4 >/tmp/fifoRFID
[d5515b06] echo -n Paris.mp4 >/tmp/fifoRFID
[a5d95806] echo -n Roma.mp4 >/tmp/fifoRFID
[3cd44c02] echo -n quit >/tmp/fifoRFID
Ok with the RFID reader working we need to create the pipe

Code: Select all

mkfifo /tmp/fifoRFID
N.B. Be sure that /tmp folder is type tmpfs ( ram drive).

The only thing to do is to intercept the pipe /tmp/fifoRFID and read the contents. Once we know which file to read we will ask omxplayer to quit and restart with the correct movie.

This is the python script playerOnRFID.py

Code: Select all

#!/usr/bin/env python

import subprocess
import time
import sys,errno

proc = None


def showVideo(video):
  global proc
  if not (proc == None):
    try :
     proc.stdin.write('q')
    except IOError as e:
     if e.errno == errno.EPIPE:
       pass
    time.sleep(0.1)
  proc = subprocess.Popen(['/usr/bin/omxplayer','-b','--display','0','/mnt/sda1/Voyage/'+video],stdout=subprocess.PIPE,stdin=subprocess.PIPE)
   

while True:
  try:
    rfid = open('/tmp/fifoRFID','r')
    cmd = rfid.readline()
  except IOError as e:
    if e.errno == errno.EPIPE:
      proc=None
    continue
  print cmd
  rfid.close()
  if len(cmd)>0:
    if cmd =='quit' :
      break
    showVideo(cmd)

if not (proc == None):
  proc.stdin.write('q')
N.B. My video are on USB stick , /mnt/sda1 , you will need to change the path for your own movie location

And for the magic run the reader application followed by the python script

Code: Select all

sudo rc522_reader &
python playerOnRFID.py
Be careful about the fifo /tmp/fifoRFID. Be sure that it exist and it is not a standard file. Since it is on a tmpfs folder you will need to create it every time its boot.

Return to “Beginners”