Physics locks using a smartphone
This tutorial shows how to use the Phyphox application to design small locks to be unlocked by physically acting on a smartphone, for example for puzzle games or escape games.
A first riddle...
Here is how it looks for the user:
To test the locks yourself
How to create a lock
The creation of the lock uses the free and open source application Phyphox. This application allows access to the measurements of the different sensors present in a smartphone; it was not designed to make locks, but it is highly modular and can be diverted from its primary use. To do this, you only need to follow 2 steps: first, modify a small program and then transmit this program to phyphox.
The codes to download and modify
We propose hereabove two examples of programmes to be modified to adapt them to your uses. The comments indicate what can be changed to personalise them.
The first example allows you to create a lock using 3-axis sensors: acceleration, acceleration without taking into account gravity, rotation speed or magnetic field.
The second example uses 1-axis sensors: pressure, light (Attention, some phones, especially iPhones, do not allow access to this last sensor, and only top-of-the-range smartphones will have all these sensors).
In these examples, the experiment is first launched with the triangular button at the top right, and the secret code is unlocked by holding the smartphone for 2 seconds vertically (1st code) or by lighting it strongly at more than 300 lux for 2 seconds (2nd code). See video.
Edit the files in a text editor (such as the Windows notepad or a program editor). It is possible to set the duration of the manipulation to be carried out, the direction in the case of a 3-axis sensor and the thresholds (e.g. illuminance higher than 1000 lux or lower than 200 lux), the secret code revealed by the application, etc.
However, these example programmes only allow simple handling. It is not possible to link two tests (telephone vertically for 1s then horizontally for 1s) and it is not possible to combine conditions (telephone vertically and light off). Basic programming in XML and reading the Phyphox documentation will allow the most motivated people to do this.
How to transfer the code to phyphox on smartphone
To transfer the programme to players’ smartphones, the simplest solution is to have a Dropbox or Google Drive account. You can also drop the programme on another server as long as you can retrieve a corresponding web link.
Transfer via email
- Send the file as an email attachment. The player must open the message from his smartphone, as phyphox is already installed, then click on the link that will open the program in Phyphox.
Transfer via Dropbox
- Drop your file in the dropbox and then retrieve the sharing link, in the form https://www.dropbox.com/s/xxxxxxxxx/tuto_cadenas_1axe.phyphox?dl=0
- Create a link by crawling the final “dl=0” with “dl=1 “
- When the end user clicks on this link on his smartphone (already equipped with phyphox), the lock will be installed in the phyphox menu.
- You can also create a QR code associated to the link via https://www.qrcode-monkey.com/ The end user will be able to scan it directly from phyphox via the big “+” button on the menu.
- The player can then choose whether or not to save the lock on his phone. If he saves it, he must find the experience in the list. The player just has to press the “Play” button in the top right corner and do the correct manipulation.
Transfer via Google Drive
- Drop your file on the drive then copy the share link. It should look like this: https://drive.google.com/file/d/xxxxxxxxxxxxxxxxxxxxxx/view?usp=sharing.
- Transform this link by copying the part between d/ and /view in this form: https://drive.google.com/uc?export=download&id=xxxxxxxxxxxxxxxxxxxxxxx.
- When the end user clicks on this link on his smartphone (already equipped with phyphox), the padlock will be installed in the phyphox menu.
- You can also create a QR code associated to the link via https://www.qrcode-monkey.com/. The end user will be able to scan it directly from phyphox via the big “+” button on the menu.
- The player can then choose whether or not to save the padlock on his phone. If he saves it, he must find the experience in the list. The player just has to press the “Play” button in the top right corner and do the correct manipulation.
Via a Web Site
- Upload your file *.phyphox on the web site.
- Create a link towards this file, exchanging the address prefix “http://” by “phyphox://”
- You can also create a QR code associated to this link.
This project was developed by Gautier Creutzer in the “La Physique Autrement” team.
It benefited from the support of the “La Physique Autrement” Chair, carried by the Paris-Saclay University Foundation supported by the Air Liquide group.
It was partly developed in the Center d’Expérimentation Pédagogique of the Villebon-Georges Charpak Institute.