jes notes Index Gallery . 4th axis Anniversary Clocks Blog ideas Micro-machining CNC milling machine Paint colours CNC Router Shaft passers Snap issues Software ideas Stepper motor clock Toy ideas Watchmaking Wildflowers

2024-07-06

Last modified: 2024-07-08 21:28:41

< 2024-06-29 2024-07-08 >

Keyless entry

New project: keyless entry for the house.

The nissan leaf has keyless entry, where if you have the key in your pocket you can just walk up to the door and press the button on the handle and it locks/unlocks. I want something like this for my front door, except it detects presence of my phone using bluetooth, or alternatively a "Tile Mate" bluetooth beacon. And then if you press the button on the door it locks/unlocks the door by rotating the thumbturn on the inside with an electric motor. No need to get your keys out of your pocket.

Requirements:

The thumbturn knob is held on to the lock with a grubscrew, I'm thinking I take the knob off, affix a shaft extension with a new grubscrew, put a gear on the shaft that my motor can turn, and put the knob on the extended end of the shaft. So then both the knob and the motor can turn the same shaft. And I'm thinking have some pogo pins in the door jamb to conduct power to the motor. And have the electronics in a box on the wall near the door, but with shielding so that the bluetooth antenna can only pick things up outside. I don't mind that the signal will be attenuated by the wall, because I only need very close range detection anyway. I already have a spare ESP32-c3, which has builtin bluetooth, and I have some quite small electric motors with builtin gearboxes, which I expect will be powerful enough to operate the lock.

So step 1 is make some test module that can stick to the door and operate the thumbturn, then step 2 is to make the ESP32 detect the presence of my phone, and ensure that I can make it only detect it when I'm standing outside, and not when I'm in bed, step 3 is conduct power to the motor through pogo pins in the door jamb, and step 4 is see about using some custom "rolling code" bluetooth app on the android, instead of just detecting the MAC address or something which can easily be replay-attacked.

Also need the button on the outside of the door.

So I think I probably want 4 pogo pins, motor +/-, and 2 contacts that the switch will connect together. You can't trivially get away with a common ground for the motor and the switch because the motor needs to be reversible, and the method I have for reversing it to swap the positive and negative. You could obviously reversing it by supplying +5v for one direction and -5v for the other, but that would require a power supply that can give you -5v.

And once it works for the main door I also want "central locking" so that it operates all of the doors at once. No point having auto-lock on the main door if I have to get the key out to lock the conservatory door right next to it anyway. And finally, just to increase the attack surface, I want to be able to remotely lock/unlock over the internet.

This is where we're starting.

Obviously if it all works I would put a cover over the works in the final version. That has 3:1 reduction from motor to thumbturn shaft; there is a tradeoff between making sure the motor has enough mechanical advantage to turn the shaft, without making it annoyingly difficult for a human to backdrive the shaft using the thumbturn.

I have printed these parts, need to make the shaft extension on the lathe before I can find out whether it works.

NAS

So I have finally plugged in the MicroServer, after having not touched it since we moved house 3 years ago. I'm thinking I want to use it as a NAS to try to organise paperwork a bit better, also have a mirror of all my github repositories, and keep CAD files on it so that they're more easily accessible from the computer in the garage.

And this is kind of a prelude to upgrading the Ubuntu 20.04 install on my main computer. If I can switch to a workflow where all the important stuff is kept on a different box, it becomes easier.

I've got a fresh install of Rocky Linux 8 on the MicroServer (Rocky 9 wouldn't work because the CPU is too old??). The "cockpit" web interface is quite cool, never used this before.

What is the best way to expose the NAS to my other computers?

Options are:

scp is annoying because you have to manually copy files around. rclone sounds good, but in practice is not because it drops the executable bit, and also LibreOffice for some reason can't write to files on an rclone mount. I read that you should never ever use NFS, but I don't know why. And I can't get SMB to work, it rejects my authentication. Syncthing works really well but duplicates all your files across every machine, which is not what I want.

So I think I need to look up why you shouldn't use NFS, and then probably just use NFS over an SSH tunnel.

I have one other requirement, which is that I want to be able to access the NAS away from home, over probably a Wireguard VPN? So I'd run a Wireguard VPN server on pillbox, and I'd have the NAS connect to it, and my laptop connect to it. And then I'd have some service running on the laptop that works out whether it can connect to the NAS over the LAN, and if so it does, otherwise it tries via the VPN, and this service sets up the SSH tunnel, and exposes it on a consistent port, and then the NFS mount is of localhost at that port. And then the VPN is transparent to the NFS mount configuration.

Also, I have 2 more 2TB drives coming, and I want to set them up with "snapraid", but I want it to somehow alert me if it detects a problem. How do I do this? Do I need to make cron be able to email me? Worry about that later.

Do I want to have tarsnap backups of the most important stuff? Maybe.

So still todo is:

I couldn't get NFS mounting to work. I got as far as mount giving me "Operation not permitted", and couldn't work out why.

CIFS is working with:

$ sudo mount -t cifs -o username=jes,password=...,uid=$(id -u),gid=$(id -g) //starship/nas /nas

Needs cifs-utils package. And this is superior to rclone because LibreOffice can read/write files under /nas without any trouble.

< 2024-06-29 2024-07-08 >