RFID Video Daemon

Hello Everyone,

I have my Arduino board and RFID reader, they work fine with the code used from the library. Found here: http://www.arduino.cc/playground/Learning/PRFID

What I want to do is run a video when the user hovers a tag over the RFID reader, at the moment it just displays the tag's code being read.

I believe I need to use serproxy to allow communication between the board and computer.

I'm scared to change the code on the board and make the RFID reader stop working.

This all seems rather difficult for such a simple task.

Is there an easier way of producing this result?

Help?

in witch video the code is showed? arduino can't support graphics over game-boy like

you don't need serproxy, you can use the serial connection and on the PC a program that read the code and play the right video

lesto, thanks for your reply!

I didn't know arduino would communicate with the PC directly without serproxy to translate the data.

if(bytesread == 10) { // if 10 digit read is complete Serial.print("TAG code is: "); // possibly a good TAG Serial.println(code); // print the TAG code }

Instead of Serial.println(code); I would like to do something similar to Open.file(video.mpeg);

I hope this makes more sense, I tried using flash as the program that runs the video but it gets very complicated.

Thanks again.

(the board is constantly connected to the PC)

sorry, but the player program is on your pc, so no way.. You have to write a driver (a program) that listen the code from the serial and execute the Open.file(video.mpeg);

at least arduino can send not the code but directly the video's name.

With processing this is very simple

lesto, I understand what you mean but have no idea how to go about doing it.

The arduino returns the video name to the driver that executes the file, would that be right?

Thanks again.

yes, the "driver" is just a little program that run in background listening the serial or whatever... in unix is called "daemon"

What is the daemon written in?

I have been trying to use flash, I have tried using Firmata, I have tried using serproxy, they work to an extent but the thing that I want to do is a lot more basic than the examples that I am finding.

I have been following this tutorial:

http://www.arduino.cc/playground/Interfacing/Flash

As far as I know the serproxy is putting the arduino onto a network to allow communication. The RFID reader prints out when it works and I want flash or any daemon file to recognise that it has printed and play the video.

Why is it so hard?

because flash can't read the serial, you have to use serproxy: serproxy is a TCP and serial server. It reads the incoming connection from serial and output it in it's TCP stream, and vice-versa.

it IS a complication because a "missing" of flash.

try using java ( RXTX is the library for serial, it's the same used by arduino :) )

Thanks for your reply, however still struggling.

Playing a video in java is hard enough, I would have to download and install JMF too?!

I'm not sure how to catch/use the arduino's output, only in the serial monitor.

I want it to graphically look good too.

Really don't understand why it is so complicated.

The ardiuno writes what I want it to over the serial but I dont know how to manipulate that data.

Use Qt in Windows, Linux and Mac, its C and C++, or use GTK or Visual Studio, use a prgramming language and not that stupid Action Script, and 10 layers of interfaces just to use a serial port.

every things can be done easily in processing: just use the right tool for the right work!!! phase 1: acquire processing; http://processing.org/ it's gui is the same of arduino (or better, processing it's the father of arduino ide) phase 2: read the serial http://processing.org/reference/libraries/serial/index.html (the library is included in IDE, so no problem) phase 3: play the desired movie; http://processing.org/reference/libraries/video/index.html (again the library is included in IDE, so no problem) phase 4: show your friends!!

@Senso: I quote for "use a prgramming language and not that stupid Action Script, and 10 layers of interfaces just to use a serial port." but is not good for a beginner "Use Qt". just my 5 cent

I am begginning to doubt this is even possible.

I don’t have money to go out and purchase Visual Studio or any other software.

Even if i download qt or gtk i still don’t know how to manipulate the signal and open a file.

I thought it was a simple idea but obviously not.

I’m also using windows.

Thanks for your advice, I am going to look for free software, and how to code the daemon.

I’m thinking the arduino uses Serial.Write(“video.mpg”); and the Daemon captures it and loads it as a file, but How?

Any further advice would be highly appreciated.

Thank again.

read my last post before surrender, it's really easy! processing have many tutorial (also for arduino), with a bit of cut-paste and little programming skill it can be done

lesto, your keeping my hopes strong.

I thought processing was arduino!

Some of them programs are difficult but i have used C++ and Java before, just not over serial.

Thank you so much!

Quick update, I like Processing and the Library comes in very handy.

I have coded but haven't tested a program yet, I am exporting and opening the html files because I dont know how to open .jar or .java

There is a lot of duplicate functions that I have combined, not sure if this will ruin the process or not.

Will find out when I get to testing.

Thanks!

Do I still need to use serproxy and firmata with this setup???

The code is as follows: (so far)

import processing.serial.; import processing.video.;

Serial myPort; Movie myMovie;

void movieEvent(Movie m) { m.read(); }

void setup() {

println(Serial.list());

myPort = new Serial(this, Serial.list()[4], 9600);

size(200, 200); myMovie = new Movie(this, "video.mpg"); myMovie.play(); }

void draw() { while (myPort.available() > 0) { image(myMovie, 0, 0); } }

the "play" button in processing will compile AND run your code, so no need to export while tesing. java file has to be manually compiled (pain for noob!) jar file are easier: java -jar filename.jar :-)

Hi,

At the moment I am coming up with a null pointer error referring to the video, do I have to declare the full directory name of the video or do I copy the video into the sketch folder?

I cannot test until the errors have stopped appearing.

Where exactly will the video play in processing? I can see the details on the bottom but dont understand how a video will be played.

Once again I will post my code

Thank you.

import processing.serial.; import processing.video.;

Serial myPort; // The serial port Movie myMovie;

void movieEvent(Movie m) { m.read(); }

void setup() { // List all the available serial ports println(Serial.list()); // I know that the first port in the serial list on my mac // is always my Keyspan adaptor, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[1], 9600); //Video Code: size(200, 200); myMovie = new Movie(this, "video.mpg"); myMovie.play(); }

void draw() { while (myPort.available() > 0) { //Video Code: image(myMovie, 0, 0); } }

The previous code is running in the background of an rfid reader.

The code for the arduino rfid is on the arduino playground and has not been edited.

I want these prrograms to run together and play a video when a tag is over the rfid reader.

Do I need to associate them better and is this feasible?

Thank you

4kingrich: Hi,

At the moment I am coming up with a null pointer error referring to the video, do I have to declare the full directory name of the video or do I copy the video into the sketch folder?

yes, the video has to be put in the project folder located in processing's sketchbook folder. Or you can use absolute path

4kingrich: I cannot test until the errors have stopped appearing.

Where exactly will the video play in processing? I can see the details on the bottom but dont understand how a video will be played.

Movie class probably has a setSize() method, in witch you set the video's window dimension.

your code is not right: in draw you have to look if you have received a full command. for example in case the command is long 4 char: while (myPort.available() > 4) {

read the code: String command = myPort.read()+myPort.read()+myPort.read()+myPort.read(); //read 4 char. it isn't and addiction but a string of 4 char

then load the video (in this case same name than the command) and play it myMovie = new Movie(this, command+".mpg"); myMovie.play();

end the if }

and now paint the frame if we already loaded a video: if (myMovie != null){ image(myMovie, 0, 0); }

Thank you for all your replys.

The arduino code is printing a 10 digit number over the serial like this: 3600A9C9F8

I have renamed my video to 3600A9C9F8.mpg and placed it in the Processing/sketch_apr05a/ folder.

So my serial needs to read the 10 digits like this: String command = myPort.read()+myPort.read()+myPort.read()+myPort.read()+myPort.read() +myPort.read()+myPort.read()+myPort.read()+myPort.read()+myPort.read();

The edited code now looks like this:

import processing.serial.; import processing.video.;

Serial myPort; // The serial port Movie myMovie;

void movieEvent(Movie m) { m.read(); }

void setup() { // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[1], 9600); }

void draw() { while (myPort.available() > 10) { //Video Code: String command = myPort.read()+myPort.read()+myPort.read()+myPort.read()+myPort.read() +myPort.read()+myPort.read()+myPort.read()+myPort.read()+myPort.read(); size(200, 200); myMovie = new Movie(this, command+".mpg"); myMovie.play(); }

if (myMovie != null){ image(myMovie, 0, 0); }

}