Need help with idea - Arduino controlled safe

Selfbondage software and other kinky developments

Moderators: Riddle, Shannon SteelSlave

Philbert
*
Posts: 25
Joined: 18 Apr 2013, 03:36

Re: Need help with idea - Arduino controlled safe

Post by Philbert »

So I've been looking around at random ideas and came across the EmlaLockBox code in these forums. There are API calls in the code that I didn't even know existed and I was even able to track down (to some extent) where API Devices come into play. From what I've put together, it sounds like an Emlalock session can be started using an API call but I'm not sure of the details - I found the documentation but it boils down to the fact that I don't speak German.

https://www.emlalock.com/wiki/doku.php? ... lasafe_api

I've been able to register a new API Device to my account but when I go to start a device session, it says there is no active session. I'm wondering if there is a main session and then the API Devices are sub sessions.
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

sweh wrote:But I realised there's a big issue... with the USB port it'd be perfectly possible to send a new sketch to the Arduino that opens the safe. That's not too good! We'd need to use a board that can only be put into programming mode via a jumper and bootloader mode, or have some way to simulate this :-(
Solution is to use the SoftwareSerial module on pins 10/11 and a super cheap ($3-ish) USB/serial adapter, and then use a normal USB power adapter so there's no way to upload a new sketch while the safe is closed.

Interestingly the cheaper USB/serial adapters are better 'cos they tend to be 5V, whereas RS232 really should be 12V. A better more compliant serial port would need a resister to drop the voltage.

With minor code changes ("#include <SoftwareSerial.h>" and "SoftwareSerial mySerial(10,11,true);" and then use "mySerial" instead of "Serial") was all it took, and this works :-)

When I get the time I'll try and write this up as a complete project, with pictures.
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

Philbert wrote:So I've been looking around at random ideas and came across the EmlaLockBox code in these forums. There are API calls in the code that I didn't even know existed and I was even able to track down (to some extent) where API Devices come into play. From what I've put together, it sounds like an Emlalock session can be started using an API call but I'm not sure of the details - I found the documentation but it boils down to the fact that I don't speak German.

https://www.emlalock.com/wiki/doku.php? ... lasafe_api

I've been able to register a new API Device to my account but when I go to start a device session, it says there is no active session. I'm wondering if there is a main session and then the API Devices are sub sessions.
Coming back to this after some time doing other stuff, I think I've worked out how to do this.

You need to register your device, and give it a description.

Now on the main web site when you go to start a session, instead of selecting "combination" or "verification" you should also be able to select the safe that you registered. If you select this then the "upload picture" option disappears. Go through and complete the session startup as normal and "start session".

At this point the top timer box will tell you "start your session on the device". This is where you can call the activeDeviceSession call with the combination.

When the session is over if you try and "end session" on the web site then it will tell you you need to end the session on your device.

So now you call the endDeviceSession call and it will return the password you set. You don't get to see the combination on the website and you don't get emailed a picture.
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

I've written up how I've modified the safe to work with an Arduino. I still need to work on the PC side software, but everything else should work!

The writeup is here: http://bdsm.spuddy.org/writings/Safe/

Please let me know if something isn't clear.
User avatar
Keyless
***
Posts: 344
Joined: 22 Dec 2013, 12:33

Re: Need help with idea - Arduino controlled safe

Post by Keyless »

sweh wrote:I've written up how I've modified the safe to work with an Arduino.
I love tech like this. That’s a great piece of work.

As I understand, an Arduino runs its boot loader for a short while after reset. I think this might be 0.5 secs. After that it runs whatever sketch is loaded. Presumably the boot loader runs on power up, so it might be possible to cheat your system by initiating an upload at the same time as powering up the Arduino. You might need to try lots of times to get it right. If it’s a problem you might want to close it off. I understand that the USB interface connects to the processor through a serial port. On some models, there is only one serial port. To allow upload of a sketch without manual reset, the DTR line from the USB is connected, through a capacitor, to the reset. This puts a narrow negative going pulse on the reset line. Hence it is always possible to upload a sketch via the USB port. (Note: Leonardo is different.) Without that feature a manual reset would be needed. It might be possible to remove the capacitor or otherwise disable that system, but you would need a very steady hand and might well damage the board. Also, you might need to be able to restore the automatic reset to have a reliable way to upload sketches.

Perhaps you could render the automatic reset ineffective and eliminate the potential power up cheat by preventing the Rx line from working for a short period after reset. Perhaps a 555 timer could be set to provide a “high” output for a couple of seconds after power up. That system could easily be disabled to allow a sketch to be uploaded, but once enabled and locked up in the safe, it would not be possible to upload a sketch.

I think the output of the USB is isolated from the Rx input of the processor by a resistor. If so, it should be possible to clamp the Rx input without drawing an excessive current from the USB side. A simple diode and, perhaps a resistor as well, between the Rx line and the output of the 555, so as to hold the Rx line high if the 555 output is high might do it (perhaps use a germanium diode for a small forward voltage drop. I have not done a careful design so make sure voltages and currents are all OK).

If you did want to use the built in USB interface without the possibility of loading a new sketch you could connect the reset line to the trigger on the 555 timer so that the Rx line would be disabled following any reset, including the automatic reset before an upload. Your programs would need to delay any attempt to communicate until after the timer expires.

Would the connection work properly after the timer expires? Could the system do any damage to the Arduino? Would it be cheat proof? Is the power up cheat a real problem? I don’t really know.

Another possible solution would be to use a soft serial port, so you have to have the sketch running before you can talk to it.

What do you think?
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

Yeah, software serial on pins 10/11 is the way I went. In some respects it complicated the solution (need power + serial to enter the safe) but it also means that the reload of the safe sketch can't be interrupted, leaving it a secure solution.

I did leave a USB cable connected (and folded into the battery compartment) so that if the door is open then I could upload a new sketch (more functionality, bug fixes) without needing to pull the safe apart again, but in normal use (safe closed, locked) that can't be reached and so we're limited to only the software serial interface for interaction.

Amusingly, the same design would work for a vanilla usage of the safe; a password vault (eg LastPass) could be used to store a strong generated password; the safe would have it's original use but with strong passwords instead of 6 digit PINs :rofl: The choice of functionality would depend purely on the software being run on the PC!
User avatar
Keyless
***
Posts: 344
Joined: 22 Dec 2013, 12:33

Re: Need help with idea - Arduino controlled safe

Post by Keyless »

sweh wrote: I'm not an expert at Arduino. :-)
I doesn’t look like that to me. It took me quite a bit of research to discover the soft serial port and I didn’t spot that you had used that method. Still I know about it now and, you never know, the knowledge might be useful some day.
tiemeupalso wrote:people love to make things complicated.
I think there are several reasons people like to look for technological solutions to bondage. The first depends on how you intend to use the bondage. Like lots of other things, if it’s a one off, you might be prepared to do it the simple but time consuming way. If its something regular, like your laundry, you might think it worthwhile to get a washing machine. The machine is complicated, but it makes the job simpler. My forced cycling program is an example. It’s complicated, uses GPS and took ages to build, but I could load a route, get locked up and out on the bike quickly, knowing that I can’t undress, get back into the house or whatever I’ve locked until I’ve cycled round the route. I used it a lot. It kept me fit and helped me relax. I doubt I would have completed the route on many occasions without it. Something requiring more preparation to use it would not have worked. A computer controlled safe would have been a much better solution than the encrypted photograph technique I did use, but I didn’t think of it at the time.

The second reason is that the construction of the equipment is itself interesting. The knowledge I have gained from kinky projects has been very useful in other contexts.

The third reason is that it can be made to do complicated things. For example I have a computer timer. I can set it so I have to ask to be let out. If I ask too early I just get time added. That can be fun if I've no other way of telling the time. It's got a random function too but I've never had the nerve to use both features at the same time.

Then, of course, there’s the satisfaction of having built something that works well.

A final point - your emergency release must be simple and fail safe. The consequences of using it can be complicated, provided you get free even if that bit doesn't work.

Any thoughts folks?
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

Keyless wrote:A final point - your emergency release must be simple and fail safe. The consequences of using it can be complicated, provided you get free even if that bit doesn't work.

Any thoughts folks?
The immediacy of the emergency release may also be relevant to the bondage scenario. So if you've worn a chastity belt for 2 weeks and then you find your key release (eg this arduino controlled safe) fails, you may be able to survive one or two more days for the emergency release to kick in ("the key is in a locked drawer at work; it's Friday night; I can't get there until Monday"). That's clearly different to "chained to the wall", which needs a more immediate emergency release.

There's no "one size fits all scenarios" solution. Each person needs to evaluate their risk factors,their appetite for risk, their cost levels ("walking out locked in a maids outfit to open a PO box to get the key") and so on.
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Need help with idea - Arduino controlled safe

Post by Sir Cumference »

The relatively elaborate software/upload-hack has a very simple mechanical sister.

When the solenoid is energized, it draws a piece of soft iron into it.
This piece of iron is resting on a very weak spring, meaning that "bumping" the safe can move it, thus opening the lock.

It is a serious mechanical weakness, that makes them very easy to open without knowing the combination.
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
ruru67
****
Posts: 530
Joined: 05 Feb 2009, 03:38
Location: NZ
Contact:

Re: Need help with idea - Arduino controlled safe

Post by ruru67 »

Sir Cumference wrote:When the solenoid is energized, it draws a piece of soft iron into it.
This piece of iron is resting on a very weak spring, meaning that "bumping" the safe can move it, thus opening the lock.
That depends a lot on the solenoid. I have two-way solenoids (salvaged from computer case locks) that latch in the position they're placed in. I used one for my home-made timer lock box. Using the actual solenoid pin as the latch (i.e. no other sprung machanics) it would take one hell of a bump to open it.

(I have no idea how the latch works - it's buried in the solenoid unit. But it takes a reasonable amount of force to overcome it.)
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

Sir Cumference wrote:The relatively elaborate software/upload-hack has a very simple mechanical sister.

When the solenoid is energized, it draws a piece of soft iron into it.
This piece of iron is resting on a very weak spring, meaning that "bumping" the safe can move it, thus opening the lock.

It is a serious mechanical weakness, that makes them very easy to open without knowing the combination.
Yeah, the goal of this project wasn't to fix the physical issues with the safe, it was to make it more usable as a toy.

For those who aren't aware of the issue; the locking part of the safe effectively looks like this:
SOLENOID_400.jpg
SOLENOID_400.jpg (75.38 KiB) Viewed 3550 times
You can see the small spring. At the top of the spring is a small plate. This is the plate that the emergency key pushes down on, and that causes the solenoid to go down. Unfortunately the spring is a little weak and so banging on the safe can make the locking pin go down a little, and turning the lock at the same time can sometimes let you open it. The solution is to replace the spring with something stronger. Since you have the cover off this might be a good time to do that update. You have to remove the solenoid from the door, and remove the outer shell; that gives you access to the spring area. It's an easy fix; I'm surprised the manufacturers didn't just do this over the past decade.
User avatar
Keyless
***
Posts: 344
Joined: 22 Dec 2013, 12:33

Re: Need help with idea - Arduino controlled safe

Post by Keyless »

sweh wrote: The immediacy of the emergency release may also be relevant to the bondage scenario. So if you've worn a chastity belt for 2 weeks and then you find your key release (eg this arduino controlled safe) fails, you may be able to survive one or two more days for the emergency release to kick in ("the key is in a locked drawer at work; it's Friday night; I can't get there until Monday"). That's clearly different to "chained to the wall", which needs a more immediate emergency release.

There's no "one size fits all scenarios" solution. Each person needs to evaluate their risk factors,their appetite for risk, their cost levels ("walking out locked in a maids outfit to open a PO box to get the key") and so on.
I do agree, but I don't want anyone to overestimate the reliability of some relatively complicated release, and therefore underestimate the risk.
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

sweh wrote:The solution is to replace the spring with something stronger.
Haha, someone has another variation of how to do this; https://www.youtube.com/watch?v=SAgDQ1FBSMM - basically made the gap between the solenoid in the "open" position and the locking plate shorter by bending it. Now banging on the safe may still cause the pin to bounce, but not enough!
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

OK, I've written the PC software that allows control of the safe. It can handle keyholder and self-lock scenarios.

http://bdsm.spuddy.org/writings/Safe/software.html

It's not pretty (I'm a terrible web designer), but it works :-)

Image
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Need help with idea - Arduino controlled safe

Post by sweh »

And I'm now testing my first session with it. Hopefully Emlalock won't break 'cos I can't get to the backup keys for a week!
Post Reply