What is it?
After having finished my MendelMax2 enough to print with it, I decided to do so, and also make so I can make something I enjoy to watch… Timelapses!
First of, what is a timelapse movie? It is basicly just a video running faster than the frames per second it was captured at. The way I do it is to just take a picture every few seconds instead of the 24fps my camera normally would.
In this first video I set my camera to take a picture every 5th second, then merged them into a movie running at 24fps.
While this works, it is still difficult to see what is actually going on because everything is moving so fast, and the hotend is never at the same place either. To make up for that, you can have the microcontroller controlling the printer, also control the camera, and that is what this post is actually about.
How do I make timelapses like this?
To be able to control my camera, I use some software called chdk. It will run alongside the original firmware in the camera, and give it a lot of extra features, where one of the features is how to remotely control it.
On the chdk site you find the instructions on how to put it on the sd card, and how to start it afterwards.
The camera I got is a Canon PowerShot A560, but the A570 is most likely a better choice because it also got focus and exposure lock, so it can trigger faster when receiving the signal to fire.
To make sure it wont run out of power, I also ordered a mains power supply for it, and this is also where I really like this camera. It got a connector for a power supply and a usb b-mini connector. In the software you can adjust if the camera should power off by itself and how long screen should stay on. In some of the newer camera’s I got (not canon powershot’s) I can not connect a power supply, the usb connector isn’t a standard one, and when I connect it the camera goes into file transfer+recharge mode and can’t be used for anything else than that while the cable is connected. In the settings, or lack of, I can’t decide if it should stay on either. So even when this Canon PowerShot camera is old, it seems to be better than some newer cameras from other manufacturers within the same price range.
One last thing I needed was a usb cable to put between the controller and camera, this was also easy to find on eBay, and I even found a good quality 5 meter cable.
The connection on the camera isn’t something that should give any problems, as it is just a normal usb b-mini connector. The tricky part is most likely how to connect it to the controller, so here it goes.
On the picture you can see a 4 wire female pin header connector connected to my Rumba board, which is the controller for my 3D printer. From left to right the pinout is 12V-GND-PIN4-ANALOG9. To trigger the camera to take a picture only GND and a 5V trigger pin is needed, but having the option to expand functionality later is always good to have.
What is left is to cut the usb connector off the usb cable (not the one going into the camera), and solder the wires from the pin header to the usb cable. A good thing would be to check polarity and not rely on the wire colors being correct, in my cable GND was RED and 5V was BLACK.
After having connected the pin header to the usb cable, and enabled the remote function in chdk (check the instructions on the chdk site), all that is left is to make the controller trigger the camera to take a picture.
The way I do it is to simply use gcode to change one of the pins, in this case PIN 5.
M42 P4 S255 G04 P50 M42 P4 S0
Or even better!
With the last update I got into Marlin, it is possible to useM240
and configure it to work with CHDK. It will then result in a seamless printing motion, with the camera triggering while the printer is moving.
This will set pin 4 to HIGH, which means it will be outputting 5V, it will then wait 50mS before setting it to LOW again (0V).
A thing I quickly noticed was that with my camera and the buffer in the controller, it would set the pin high about 5-8 seconds before the layer was actually done, the camera would then start to get focus and exposure lock. The printer would then finish the layer and get to the G04 P50 where it would wait and following set the pin low again. When the pin goes low the camera takes the picture, resulting in it taking a picture at the right time, even when not having manual focus and exposure lock.