ChrisFreemanJr
Posts: 1
Joined: Wed Oct 10, 2018 1:52 pm

Escape Room Prop

Wed Oct 10, 2018 2:00 pm

Hi there! I am super beginner level and wasn't sure where to post this question. Basically, I am looking to see if this is even a possibility... I want to have someone help me build an escape room prop using a raspberry pi and a monitor/speaker setup. Basically, I would like the players to find four USB keys throughout the room and when each is plugged in, they trigger a specific video file to play. When all four are present, they trigger a button which can be pressed to disengage an electromagnet. I have worked with the magnetic locking devices before, I am just worried about where to start with the USB keys and video. Is there an easy way to do this? Is it even possible? Any help or ideas would be greatly appreciated! Thank you.

User avatar
topguy
Posts: 4925
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Escape Room Prop

Thu Oct 11, 2018 12:02 pm

Yes there are ways to do this. Its easier if the USB keys can be of different make/model. If it fits into the narrative of the escape room that they look different. If its four identical memsticks that is also possible, just a tad more complicated.

Every USB device has two identifiers called idVendor and idProduct. And whenever a new usb device is plugged into a Linux computer the kernel spits out the following:

Code: Select all

[1975578.241032] usb 1-1.1: New USB device found, idVendor=0930, idProduct=6545
[1975578.241036] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1975578.241038] usb 1-1.1: Product: DataTraveler 2.0
[1975578.241040] usb 1-1.1: Manufacturer: Kingston
The exact values here ( idVendor=0930, idProduct=6545) is for a Kingston 8GB memstick. When I plug in a different model memstick I get:

Code: Select all

[1975581.065550] usb 1-1.4: New USB device found, idVendor=126f, idProduct=0161
[1975581.065570] usb 1-1.4: New USB device strings: Mfr=0, Product=2, SerialNumber=3
[1975581.065575] usb 1-1.4: Product: USB Mass Storage Device
Now there is a system in Linux called "udev" that has rules can be used to trigger certain actions/services/etc. when devices are inserted or removed from the system. The actions are defined in "rules" files where you can filter on stuff like idVendor and idProduct.

So how I would do it:
- Add four rules to the "udev" so that when each of the sticks are inserted, we run one of four scripts. The purpose of each script is to send a signal to another program informing it that this particular memstick has been inserted.
- Then the second part is a program (or script) that runs automatically on start and listens for the signal, and based on the signal it will play a specific video.

Biggest questions remaining is:
- What language should the "program" be written in.
Almost any language is possible to use. Bash, Python, C/C++, Node.js...

- Exactly how should we send a signal.
Can be done so simple as to just create a file with a specific name, or one could use more advanced method like pipes or sockets or MQTT.

Return to “Other projects”