Show HN: I made a tiny camera with super long battery life (opens in a new tab)toaster.llc
843 pointsHey HN!
A few years ago someone kept trying to steal my motorcycle, so I decided to make a small camera with really long battery life to catch them.
The hardware/software is totally open source, but the companion app only supports macOS currently. (I'm a big fan of native apps, and didn't want to block releasing on Linux/Windows support.)
I wrote some blog posts about the process:
PCB design: https://toaster.llc/blog/pcb
Enclosure design: https://toaster.llc/blog/enclosure
Image pipeline: https://toaster.llc/blog/image-pipeline
Rainproofing: https://toaster.llc/blog/rainproofing
Source: https://github.com/toasterllc/Photon
Comments (299) 87 threads
Earlier commentsWhy not just have it connect as a generic mass-storage device?
I wrote/tested Photon Transfer (the companion app) on macOS 10.15 (Intel), so it should work on that and above. If not it's a bug that I need to fix!
Given the rate at which the data flows -- nothing at all for a long time, then a burst that isn't particularly time-sensitive, then nothing at all again for a while -- I wonder if the right way to do something like this is with LoRA. That way the camera could be mounted someplace hard to access, with no need for a file system at all. There would then be a separate receiver module that could listen for traffic from multiple cameras and store it for later access by a PC/Mac/whatever.
1. To maximize Photon's battery life I tried to make the hardware do the absolute minimum to record imagery. To that end, Photon stores images on an unformatted SD card (ie one huge linear array of bytes) which is easy and fast to index into.
2. A 16-bit MSP430 handles writing the image data, and the MSP430's codespace is 99% exhausted without dealing with the complexities of a filesystem like FAT32, so adding support for a filesystem wouldn't currently fit. (This line of MSP430, MSP430FR2433, has a maximum of 16 KB of FRAM, but perhaps I could use a different line.)
3. Photon stores images as RAW image data that require post-processing to view the images. Since I wanted to provide a polished app to view the imagery anyway, I figured I'd just make it a requirement.
I'm not saying those are all particularly good reasons, but that was my reasoning anyhow.
Personally I think you should keep the focus on a polished mac app. For other platforms you can do just the bare minimum with a web app that uses WebUSB. People will bitch that it's Chromium only but, I mean, chromium has 95% market share outside Apple world (and I say this as a FF user).
A hardware solution could be to add a cheap microcontroller that would handle the usb port. It wouldn't be powered by the battery, only USB and it would act as a proxy between the raw sd card and the computer. Presenting a mass storage to the computer with folders, converting images to PNGs. Such capable MCUs are very cheap (rp2040, esp32-s3) but it certainly adds complexity to your project...
SD cards aren't really black magic since they "speak" SPI, meaning people have been interfacing basic microcontrollers to them since forever.
Continue this thread — 2 replies
The MSP430 is actually the puppet master for an ICE40 FPGA that does the high-speed transfers (102 MHz) between image sensor -> SDRAM -> SD card.
Here's a post about the architecture if you're curious:
https://toaster.llc/blog/architecture
Thanks for the feedback!
No it isn't. Accessing an SD card from a microcontroller requires you to do that. To use FAT involves more effort, though lightweight libraries are available.
I'm not judging, they were all the rage in low-power embedded applications 10-15 years ago, just feels weird to see it in a modern design today, when the market now is flooded with low-power ARM chips that are way more capable than that, and probably easier to program.
Another reason was MSP430's low power consumption, but like you said it sounds like ARM has caught up.
Would love to hear about alternative designs -- are there low-power ARM chips that have something like FRAM and don't require erase/programming dances to write data?
Continue this thread — 5 replies
That is likely even lower than the effective self discharge rate of a lithium coin cell battery. I don't believe the Arm equivalents like the Cortex M0 can deliver such low absolute current - maybe microamps, but more than an MSP430 from what I can see.
Ref - https://metebalci.com/blog/measuring-the-power-consumption-o...
Continue this thread — 8 replies
Also, is the RAW data specific to the device and if so, why? If the device simply used, say, DNG or TIFF, then decoding could be done by external software, and all your own software would have to do would be to read the SD card and produce RAW files...?
If I had more time and money I certainly would!
> Also, is the RAW data specific to the device and if so, why?
To maximize battery life, the hardware does zero processing on the image data; it simply copies the raw pixels output by the image sensor to the unformatted SD card.
> If the device simply used, say, DNG or TIFF, then decoding could be done by external software, and all your own software would have to do would be to read the SD card and produce RAW files...?
True, perhaps I should've used an existing RAW format like DNG and exposed the images as a filesystem. That would require using a different architecture (ie not using an MSP430, like Rinzler89 suggested), and would likely reduce the battery life due to having to maintain a filesystem on the SD card.
Continue this thread — 5 replies
Continue this thread — 1 reply
Continue this thread — 5 more replies
Continue this thread — 4 more replies
- There's no license on the code and design files in the Github repo, thus this currently isn't open source but rather "source-available". If you plan to allow others to modify the code and build their own cameras you should add an appropriate license.
- The Mac only support (and it's MacOS only, with no iPad/iPhone support) with a dedicated app to operate it seems to really limit the market for this device. Since all the app does is allow you to view/transfer photos and configure the device you probably could make do with a simple MTP interface for access to the photo files and have a second interface for configuration. Also if you do plan to release this under an OSS license and market it as a hackable + privacy friendly device Linux support is pretty much a requirement.
- Consider using automotive grade ICs to allow the device to function below freezing. The current stuff may be fine for Cali but people in northern states won't be able to use it outdoors in the winter.
Support isn't required for linux: I think there will be people who will be keen to hack up Linux support based on the open source code available, and the same with Windows. However if "Dave" wants access a larger market, Windows or even Android support would make sense.
How about an SD card slot with a configuration in a plaintext file, so that one isn't tied to the software which may or may not be available in the future.
I just got myself a Sony Mavica which shoots photos on a floppy disk, and I can still use it without thinking about which OS my computer runs.
For a camera that boasts battery life in years, needing "exclusive" software (that may or may not be available years down the line) defies the point.
I guess this is more of a marketing thing but I wouldn't be interested in buying this as a Linux user even with the other benefits if it came with unknown DIY support. If you're advertising it as an open source device and such then the people willing to play with it and pay a premium are typically Linux makers/hackers. If it's being sold as a Mac only device with a slick interface and app-only control that appeals to a different market entirely.
Do you think this would be appropriate for turning into a long form video? I’m imagining seeing videos of my boys growing and playing where I just periodically dump the camera and eventually sitch it as frames into a movie.
Anyway to know when it’s about to write over itself in storage?
Time-lapses are certainly one of the intended use-cases. I still need to add video-export features to the companion app though. Right now it only supports exporting images.
> Anyway to know when it’s about to write over itself in storage?
Currently it silently overwrites the oldest photos once the storage is filled, but I've been thinking it should have a setting to prevent that.
When the battery gets below 2%, the device enters "battery trap", where it stops capturing images and simply blinks the red LED every 5 seconds. Maybe there should be an optional setting to enter that mode when the storage is filled. Would that work for you?
Blinking when full would work. I think it’d also be helpful to know when that might be- like could I see the expected date somehow based on the rate of capture? Maybe that’s too niche of a feature.
It looks like you could just 'dd if=/dev/disk123 of=/tmp/bigrawfiles' and then postprocess with said python script.
Yes, not as good as a polished apple app, but for many people that really like the hardware and don't mind a bit of DIY, it's maybe enough...
https://github.com/toasterllc/MDCCode/blob/rev10/Tools/MDCUt...
That outputs the raw data stored on the SD card though, so I need to implement converting that to a standard format like DNG.For example:
All comments shown.
Couldn't load more comments. Check your connection and try again.