A timelapse camera in a Tic Tac box.
Among my more questionable life choices is my regular participation (as part of The B-Team) in the 24 Hours of LeMons endurance racing series. We take old cars (many of which weren’t good when they were new), kit them out with roll cages and such, and race them all weekend. Good times are had by all. A friend of mine is half of the LeMons Supreme Court, and their job is to assign penalties to drivers/teams who do stupid things during the race. This generally involves public humiliation, and is pretty darn entertaining for everyone else. Anyway, one of the other things this chap does is attach timelapse cameras to competitors’ cars. He gets some pretty exciting on-track shots this way. He asked me to make something more disposable to help with this. The fact is, in a race this long and with this many cars (over one hundred is common), some swapping of paint is inevitable. Sooner or later, the camera will be in the wrong place at the wrong time. Why not try making something really cheap that, if crushed under the paws of a V8 e30, is no big loss?
He suggested the infamous “808” camera as a starting point, and after a little research, I was inclined to agree. The 808 is a keychain camera that is cranked out by the
fu shipload in China, and they are ridiculously cheap. They can be found on eBay, and other places as well. The quality on them is awful (as you might imagine for that price) but they are quite hackable, and a subculture has developed around them. In actual fact, “the 808” is a series of around twenty cameras that are all quite different internally, and you don’t really know what you’re going to get when you order one. Each variation has its own quirks, but they all have fun “features” like unprotected battery charging and high lead content in the plastic. Good times.
Around the same time as this idea came about, the fine folks at Newark sent over some some signal relays for me to test. I love these things, because they make it really easy (and cheap) to hack a microcontroller on to any existing device in order to automate it. This would turn out to be very serendipitous timing, as we’ll see.
My thought was to take one of these 808 cameras, hack an ATtiny microcontroller on to it to make it into a timelapse, and shove the whole thing in a magnetic box that can be slapped on the side of a race car. Here’s how I went about doing precisely that.
With the guts ripped out, I set about trying to figure out how to control this thing. The instructions are translated so poorly that they make for some delicious word salad . Here’s an unedited sample:
Enter the camera mode in turned off status long time press til yellow light on click the yellow light flash one time then take one photo. The product video recording same time with time display function canadjust the time according to their own
So… um… yeah. Your guess is as good as mine. Luckily, this website is a virtual encyclopedia of the 808 and it has a much better explanation. Without that information, it might have been quite difficult to figure out. All you have are two unmarked buttons, and a yellow light that blinks furiously at you in inscrutable patterns. It’s pretty tough to automate something when you can’t even figure out how a human is supposed to use it. The camera has a surprising number of special modes and features, so knowing exactly how to get the right behaviour is important.
With that sorted, it was time to try controlling it digitally. The aforementioned website has an article on using a microcontroller to drive this camera, but no part of those instructions worked for me. As I mentioned, the 808 is really a whole series of cameras, and while they appear identical on the outside, they seem to vary wildly on the inside.
I poked around at mine with some jumpers, and found that I could turn on the power by applying 5V to a particular pin on the power button. That’s great, because it saves a relay. The shutter button was not so cooperative, and refused to behave in any way except when bridged with a jumper. Clearly a signal relay would be needed here. Luckily, as mentioned earlier, Newark had just sent me some! Huzzah!
The lithium battery had to go. The stock 808 has really poor battery life (under two hours) even for light usage. I’m going to be driving it hard and putting it away wet, so that won’t do. I need it to last for an entire 24 hour endurance race, and it should use batteries that you can find at a small-town convenience store. That’s frequently the only source of supplies at racetracks. I measured a peak of 180mA when the camera is writing to the SD card following a photo, so that means quite a bit of maH capacity will be needed. The SD card I’ll be using is 4GB, and the photos are quite low resolution, so storage isn’t a concern. The limiting factor is how quickly the camera will allow the shutter to be pressed. In my testing, that proved to be about four seconds. So, with the camera snapping a photo every four seconds for twenty four hours straight, we’ll need some serious juice.
With those details figured out, it’s off to the breadboard.
The circuit I ended up with is very simple:
The code is equally trivial. The only tricks were figuring out the delay needed for the camera to start up, the delay between photos, and how long to push the shutter button. Here’s the code I ended up with to do that:
[iframe_loader src=”http://pastebin.com/embed_iframe.php?i=cGkPvP1y” height=”600″ scrolling=”yes” marginheight=”50″]
With that settled, I needed an enclosure. I decided to use a Tic Tac box for this. It’s a good size, and should be easy to modify.
It seems like every project has that one little “gotcha”. Sometimes it can be a real killer, like the counterfeit chips in my EEPROM burner. Other times, it just makes you laugh. The camera behaved strangely when fully assembled. The power would come on, but instead of going into photo mode, the 808 was doing something I didn’t understand. The status light was flashing one of its wacky enigma patterns, and I couldn’t tell what was wrong. I pulled the case apart again to check for problems, and it started it working again. So… it works when outside the case, but not when inside. What’s different about being inside the case?
MAGNETS! (how do they work?)
Yes, in my infinite subgenius, I neglected to consider that perhaps a magnetic relay wouldn’t like living right next to eight strong magnets. Luckily, this problem was pretty easy to figure out, and I laughed out loud when the cause dawned on me. It’s just as well, because I was underwhelmed by the strength of the magnets. A race car is a very difficult environment, and they were not likely strong enough to hold anyway. It will need to be zip-tied in place.
It also occurred to me that the batteries are projectiles waiting to happen (not good on a racetrack), so the camera should be mounted with the battery pack face-down against the surface of the car. In light of all this, I opted to affix a lanyard to the new top of the camera to pass a zip-tie through. It’s made of more scrap plastic from that old cellphone. I secured it with JB Weld, and made sure it’s at the balance point of the whole device (with batteries installed), in case the user wants to hang it from something (like say, in the pit area).
That wraps up the Tic Tac Timelapse. If my LeMons Supreme Court Justice friend ends up taking some nice shots with it, I’ll post them here!