19 ms·
A Raspberry Pi dashcam with two cameras and a GPS
- jakobdabo 11y agoThanks for sharing. Little bit off-topic question for HN: is there any encrypted Linux filesystem which can be mounted in write-only mode using only the public key, and read-write mode using the private/public key-pair? I think that kind of filesystems would be very useful for dashcams and security cameras owners for their privacy.
- pmontra 11y agoI found this http://www.arthy.org/wocfs/ http://www.arthy.org/wocfs/ I have no idea if it really works. If you give it a try would you mind letting me know?
- robryk 11y agoIt'd be hard to imagine how that should work on filesystem level (if I can't read contents of any directory, how do I figure out which directory do I add a newly created file to?). OTOH, on the file contents level this seems very much doable. Sadly, I am unaware of any general purpose implementation of such a thing (encfs doesn't do anything of this kind).
- tw04 11y agoYou create a new directory on start that is based on the date/time - which you know will always be unique.
- ars 11y ago> which you know will always be unique. Which you hope will always be unique. Raspberry Pi's don't have internal clocks. Time starts over on every reboot.
- widdma 11y agoThe GPS module can give you time, but it's probably easier and cheaper to have an RTC. E.g.: http://www.futurlec.com/Mini_DS1307.shtml http://www.futurlec.com/Mini_DS1307.shtml
- cnvogel 11y agoFor the pretty limited usecase of a "record only" dashcam, you might consider recording in chunks. Create an ephemeral key for a symmetric encryption in advance, encrypt this ephemeral key with the public-key method of your choice and store somewhere. Then encrypt one minute of recording using this ephemeral key. I don't know if gnupg is performing good enough on all architectures, but in principle it can handle everything in one go, and it works exactly as described just above. ~ dd if=/dev/zero bs=1M count=50 | gpg -e -r 0x6AC3E4EC >encrypted.dat 50+0 records in 50+0 records out 52428800 bytes (52 MB, 50 MiB) copied, 0.486881 s, 108 MB/s (Intel(R) Core(TM) i5 CPU M 450 @ 2.40GHz) If you use mpeg transport streams, you can even cut at arbitrary positions (to make, say, each file exactly 50 MiB large). When you play back, decoders will catch up as soon as they find the proper markers. So your encryption pipeline doesn't even have to know much about video...
- cnvogel 11y agoJust pondered... there might be everything already be installed in a typical linux system, "split" does the right thing and can pipe into a command. Probably not the most efficient (making several copies of the data), but certainly enough for a proof-of-concept. $ dd if=/dev/urandom bs=1M | \ split -b5000000 -d -a4 --verbose \ --filter="gpg -e -r 0x6AC3E4EC >\$FILE" \ - recording_ executing with FILE=recording_0000 executing with FILE=recording_0001 executing with FILE=recording_0002 (...) • -b500000 split at 50 megabyte input file size. • -d decimal suffixes (0001, ... else aa..az..zz) • -a4 : suffixes of length 4 (0000) • --filter="" : filter through pgp, intended output file is in variable $FILE • - : read stdin • recording_ : prefix output files with this string $ file *recor* recording_0000: PGP RSA encrypted session key - keyid: 8F74FAFF 29C8C7C2 RSA (Encrypt or Sign) 2048b . recording_0001: PGP RSA encrypted session key - keyid: 8F74FAFF 29C8C7C2 RSA (Encrypt or Sign) 2048b . recording_0002: PGP RSA encrypted session key - keyid: 8F74FAFF 29C8C7C2 RSA (Encrypt or Sign) 2048b . (....)
- logicallee 11y agoI read your requirements. So, there's an analog loophole: in order to "write", the filesystem has to receive the data to be written - otherwise, it's untestable (if it doesn't get the data to be written it could write whatever it wants and pass all tests) which is a roundabout way of saying that if it doesn't get the data it can't possibly work. So it has to get the data. At that point it could be saved if the filesystem is modified (patched) to exfiltrate it. So we have to assume that you kind-of trust the filesystem not to be patched. But if the filesystem is not modified, though, that means you're fine with the path that that data takes all the way until your filesystem writes it -- however, in this case your requirements are 100% met by encrypting to the public key and writing that out. #jakobdabo's requirements #include <pgp stuff> #include <filesystem stuff> public key = arg0 private key = arg1 read_file(filename){ if (have_private_key) try decrypt(private_key, read(filenename)) return result except "didn't work" else "I wasn't called with a private key." } write_file(filename, data) towrite = encrypt(filename, data) //encrypted metada inside try write towrite except "didn't work" so this should meet all of your requirements. If you wanted the filesystem to do stuff like hide whether a file is even modified, hide timestamps, etc etc, those are almost impossible. Consider: I want to determine whether anyone is accessing a server at the moment. Server is idling, with sockets listening to answer web queries. Suddenly 5,000 Reddit users show up and look through the site, generating lots of logs which nginx dutifully saves - only you're saving it in your encrypted filesystem. Now. How would you make it so that the fact that all of this traffic is being saved is hidden? The updates to the drive image would have to happen like clockwork regardless of what was happening. But this isn't a reasonable requirement, as the amount of entropy entering the drive is bigger while Reddit is hugging it than normal. You couldn't make it so that you are saving as much information as at top load. so what do you do? Reduce the top average to some level that you can continuously fabricate? It doesn't make sense. So you wouldn't hide whether any data was being saved by the dash-cam at all. but it's easy to save an encrypted version. the dash cam doesn't even need the private key. but you do have to trust the software running on it. (for example to correctly do the encryption and not also write the underlying data somehow.)
- Natanael_L 11y agoNot quite the same thing, but forward secure sealing is relevant: https://lwn.net/Articles/512895/ https://lwn.net/Articles/512895/ You can always also use a smartcard type device to sign your files. Then a reboot (power cycle) will revoke signing capability until unlocked again.
- Sanddancer 11y agoYou could always just pipe it through gpg or the like. Just encrypt using the public key, and you can't decrypt unless you have the private.
- widdma 11y agoIf you really wanted it to work like a file system, you could write a passthrough FUSE module which pipes files through GPG before writing to the underlying file system. This seems like a good start: https://www.stavros.io/posts/python-fuse-filesystem/ https://www.stavros.io/posts/python-fuse-filesystem/
- ChuckMcM 11y agoNo need to do it at the filesystem level, just do it at the file level. You can encrypt using the public key in the dashcam, when you want to recover the video you bring the removable media to a system where you can use the private key to unlock it. Since there is often hardware support for AES you can use the public key to encrypt an AES key for the current segment, then when you get it home use the private key to recover the AES key and then use that to recover the video. The existence of the files is pretty obvious but they won't generally be decryptable.
- jakobdabo 11y agoThe advantage of doing this at the filesystem level is that you don't need to modify every piece of existing software which writes sensitive data (video/images/logs/etc.). I'm thinking of an EncFS type stackable solution (as suggested by @robryk) based on FUSE because you could copy the encrypted files from the upper level filesystem when needed (without remounting the lower level filesystem in read-write mode) and examine them on an air-gapped computer which holds the private key. The disadvantage of this type of stacked solution is that it wouldn't be possible to implement plausible deniability.
- cr3ative 11y agoThis is neat, but I would worry that something which is intended to be "set and forget", without the usual screen, would fail silently - especially with such a custom build. How are you assuring that it is functional and recording?
- pearjuice 11y agoBy verifying the contents of the hard drive once in a while?
- ghaff 11y agoIf it's not done automatically it won't routinely happen though. I wonder about this with some sensors at home. Some of them routinely ping me with status but other commercial ones are pretty much fire and forget. I can certainly set calendar entries to run tests but you're better off with things are self-testing in some manner.
- Nexxxeh 11y agoIf it's got wifi, you could check from your phone, or have it upload automatically from the garage (wifi range depending).
- dogma1138 11y agoCool project, although I would not advise using dashcams if you are involved in an accident the police can subpoena the footage which could potentially be used against you (in both criminal and civil suits). If you do run a dashcam I would suggest having one that does not record audio and only keeps the last 5-10min of footage on record because GL explaining to the cops why you have been driving like a jackass just before the accident even if it had nothing to do with it.
- swsieber 11y agoConversely, if you're a responsible driver then it prove that you are in the right.
- deleted 11y ago[deleted]
- fapjacks 11y agoRight. It's no accident (badum-psh!) that Russia and China are full of expensive cars with dashcams. Or even just regular cars with dashcams. The benefits far outweigh the penalties for the vast majority of dashcam users.
- dogma1138 11y agoDashcams in Russia are used because there is a huge problem with insurance fraud people would just either get hit intentionally or even jump on the hood of standing cars and claim they were hit. The police and the legal system in Russia wouldn't care about your dashcam if you want to get out a of a jam a bribe would work just fine (I've been pulled over in plenty of places where I had to pay dues, mostly Asia - Thailand, Philippines, Burma but it's not that uncommon in Russia and some Balkan states either), insurance companies on the other hand do like them very much.
- fapjacks 11y agoI am really wondering why you are pushing so hard against dashcams. Dashcams (along with bodycams) are making corruption in the justice system much harder to pull off. You can find a ton of videos on YouTube exposing corruption in law enforcement around the world, including the United States. This is not mass surveillance! This is a personal record of travel that isn't vacuumed up into the warrantless surveillance machine and twisted to serve an evil purpose (like Verizon's call record database, among many others). Your argument -- that your video could be subpoenaed and you might have to explain why you were driving like a jackass -- is weak to the point that I am beginning to suspect an ulterior motive. Why are you pushing so hard against dashcams?
- marincounty 11y agoThis is a good idea. The costs from getting a pulled over for no reason is a big deal. I gave been pulled over for no reason, so many times, you'd think I wasn't in America. I bought two $15 Chinese dash cams. The same ones that are being peddled for 40 bucks plus S&H on t.v. I bought the second one just in case the first one goes down. I haven't been pulled over since.
- fapjacks 11y agoSo you intentionally mount these things front/rear and plainly visible to police? Interesting. Also, what model camera did you buy?
- j_s 11y agoI'm interested in this too! I bookmarked the $20 Go-Pro-ish substitution recommended here, which was explained to be counterfeit the next day: https://news.ycombinator.com/item?id=10898640 https://news.ycombinator.com/item?id=10898640
- nommm-nommm 11y agoNot GP but I own this camera http://ebay.com/itm/310752336819?_mwBanner=1 http://ebay.com/itm/310752336819?_mwBanner=1
- kyberias 11y ago> I haven't been pulled over since. How many times did you get pulled over before the cameras and over what time period? And how long have the cameras been installed?
- tajen 11y agoSide question: Is it customary to drive across the dotted lane?
- dsr_ 11y agoA dashed lane marking means that both sides may temporarily use the other lane to pass -- provided that they can see it will be safe. A solid center line means you cannot do that. A double line with one side solid and one side dashed means that the dashed side may attempt to pass, not the solid side. All of these things become more clear once you realize they are primarily about sight-lines.
- ars 11y agoYes, you can change lanes across a dotted line as you like. You do have to signal first though. What does a dotted line mean in your country?
- arthulia 11y agoDid you watch the video in the article? He is driving with the middle of the car over the dotted line. If I had to guess, I'd say it's a two-way one-lane road with bike-lanes on either side that you can enter when cars are coming towards you.
- ars 11y agoNo, I did not watch the video. Driving over the dotted line is not customary, I thought he meant crossing it.
- 0942v8653 11y agoLink to "original" video if you have Flash disabled: https://www.youtube.com/watch?v=hCbZsu68zZU https://www.youtube.com/watch?v=hCbZsu68zZU
- blisterpeanuts 11y agoMaybe I missed it in the instructions, but how does the system handle the shutdowns? Does he manually shut it off each time, before USB power is turned off, or does it just handle the power cut-off gracefully? I worry that the file system will get corrupted after a while. There was some discussion about this on a pi board a while back; it seems that the only safe way to handle power-off is to (1) have a battery on the pi, and (2) catch the USB power-off signal and then shutdown gracefully. At least, that's how the Chinese dash cams seem to work. They all have rudimentary batteries that last about one minute unplugged from the power outlet.
- caffinatedmonk 11y agoHe wrote about handling shutdowns in another post on his blog.[1] > For the automatic shutdown I have used a 12V programmable timer in combination with an optocoupler. > When the car is powered the the timer gets triggered and is starting the power supply for the Raspberry pi, Dashcam pi will get started and will do its job. When the car is turned off the optocoupler triggers the GPIO pin of the raspberry and starts a shutdown. After 15 seconds the timer is shutting down and the raspberry pi is powerless. 1: http://pidashcam.blogspot.com/2016/03/cheap-solution-for-automatic-shutdown.html http://pidashcam.blogspot.com/2016/03/cheap-solution-for-aut...
- Animats 11y agoIf you're going to have multiple cameras, the next step is to combine them into one spherical image. Fujitsu has been doing this since 2010.[1] With four cameras, you can get the full vehicle perimeter. Other companies now offer such a capability.[2] [1] http://www.fujitsu.com/us/products/devices/semiconductor/gdc/products/omni.html http://www.fujitsu.com/us/products/devices/semiconductor/gdc... [2] http://www.fujitsu.com/us/products/devices/semiconductor/gdc/products/omni.html http://www.fujitsu.com/us/products/devices/semiconductor/gdc...
- deleted 11y ago[deleted]
- ps4fanboy 11y agoI would love to see a camera like the Dyson 360, that you mount on the top of your car. http://o.aolcdn.com/hss/storage/midas/93697564cc7197a3e35979bfa0133153/200691826/ysondyson3.jpg http://o.aolcdn.com/hss/storage/midas/93697564cc7197a3e35979... I guess it probably wouldnt work though as close objects would be obstructed.
- teekert 11y agoVery nice! Love it that he uses Arch, I also used to use Arch for everything, and I also run a RPi tutorials website. I switched though, because the only questions I'd get was of people using my commands on Raspbian and getting confused. I think the RPi audience is full of beginners that don't understand the difference between distro's and the kernel. Of course one should do as one pleases and Arch is the nicest distro if you known what you are doing, imho.
- undersuit 11y agoI'm a solid Debian user but I still keep the Arch wiki around since so much of the information is completely transferable. >I switched though, because the only questions I'd get was of people using my commands on Raspbian and getting confused. Not to attack your blog but was everything that Arch specific?
- teekert 11y agoWell, there's Pacman, Yaourt, no sudo by default, no Python-GPIO package by default, no Gui by default, no raspi-config... etc.
- undersuit 11y agoNo sudo by default! I forgot that was even a difference between Debian and Raspbian. I'm probably just not the beginner I used to be anymore, I can look at a Pacman package name and figure out if it's going to work for Apt, and I'm used to my GUI breaking every few months because I like to run proprietary Nvidia drivers.
- mschuster91 11y agoIf possible, I'd use two flash drives, mirrored with soft-raid, for storage. One clearly visible in the dashcam, the other hidden somewhere deeeep inside the car with an USB extender. Why? Because if a cop/other driver ever gets mad at you and forces you to hand over the flash drive, you still have a copy. Also, I'd add two microphones to the project, one for exterior sound, one for interior (e.g. to prove what exactly has been said, or in case of a crash if other drivers have honked, or if an ambulance had its sirens on). And, I wouldn't use a Pi, but rather something supporting SATA, because USB flash drives tend to have low lifecycles when constantly overwritten.
- codeulike 11y agoMy raspberry pi is great fun but a bit prone to failing randomly and very sensitive to input power levels, not sure I'd trust it if it was hooked up to car electrics.
- Grishnakh 11y agoThat's not a problem. It isn't that hard to design (or buy) a circuit to provide clean power from an automotive power source. The "carPC" community has been doing this for ages.
- johnflan 11y agoI have played around with this a little, using the camera pi module gives good results, but means you must mount the pi close to the camera. I wanted to use USB cameras but the USB bus on the pi is too slow. From a single USB webcam I was getting around 15fps. The newer pi's may have a faster USB bus.
- otterpro 11y agoThis is a really cool project, and I'm always thinking about doing something similar with RPi or other small computer. In the past, I had built my own x86-based CarPC for music/media/GPS/automation/etc. However, the rise of dash cams are better solution for video as they are much cheaper, easier to install and run, and video is much higher quality. The cheap $45 dashcam has 1080p with 30fps, no need to buy 12v relay timer and deal with other power issues. Also the video on dashcams outperform the webcam attached to the RPi due to RPi's slow USB2 (we're talking 15fps at best). For more complete and capable product, I'd suggest using something with USB 3.0 port, or possibly a used laptop, which provides enough processing power to record multiple videos at higher quality, and at the same time, has built-in battery, provide power management (using serial port/other hack to handle automatic shutdown and WOL for reboot). Note: A lot of the functionality of CarPC has been deprecated due to mobile device/phone/tablets, but it's still fun to have a PC running in a car.
- otterpro 10y agoActually, I think if you have all the parts already (i.e. RPi, webcams), this makes a lot of sense. Creating a Frankenstein system out of existing components would be interesting, and cost would be zero.