To light paint a Christmas tree using an autonomous drone.Background
The Crazyflie 2.0 quadcopter is an open source flying development platform that can be controlled remotely from a computer over radio (the Crazyradio). It has an expansion port where it is possible to add decks with added sensors and hardware. The Flow Deck adds the ability to fly autonomously and the LED-ring adds light. This hack describes how to combine the two to create a light painted picture shot with open shutter.The setup
- A Crazyflie 2.0 with a LED-ring and Flow Deck mounted (see below how to do this).
- A computer with python and a Crazyradio installed
- A camera on a tripod
Light painting is when you shoot a photo in a dark room with a long shutter time and move lights around to create patterns in the image. As long as the shutter is open any light will be added to the image, the motion of the light source becomes strokes in the image. In this hack the idea is to paint a Christmas tree with three Christmas tree balls.The Flow Deck
The flow deck has two sensors, an optical flow sensor (in essence a small camera) and a distance sensor, and is mounted under the Crazyflie looking down. Theses sensors enable the Crazyflie to understand how it moves across the floor and makes it possible to script its motion. A simple python script with commands such as "go forward 0,3 m" or "go left 0,5 m" controls its movements.
The goal is to move in a path similar to this
See the attached script. It starts in the bottom left part of the trunk, follows the outline all the way around to the circle. At this point it moves upwards again and make three stops to paint the Christmas tree balls.The LED-ring
The LED-ring is an expansion deck with a ring of powerful RGB LEDs. The color of the LEDs can be controlled remotely and provide the light for the light painting.Mounting Flow and LED decks
Both the LED-ring and the Flow deck are designed to be mounted under the Crazyflie, and it is not possible to use them at the same time.
Luckily, there are no important components or PCB tracks on the LED-ring at the positions of the Flow and distance sensors on the Flow deck. This makes it possible to drill holes in the LED-ring and mount it underneath the Flow deck, and enable the Flow deck to "see" through the holes.
Needless to say, drilling in the LED-ring voids any warranty! We take no responsibility if you chose to modify it.
Start by unsoldering R6 on the LED-ring, since it is located where we will drill one of the holes. The LED-ring will work without the resistor but may light up during the boot sequence. If it does, and you find it annoying you will have to solder a replacement resistor to ground later on.
Now drill holes through the cross in the center and the BC-logo. Use the drill or a small mill to make the hole in the logo wider.
Now use the long pin headers of the Crazyflie and mount first the Flow deck and then the LED-ring. You may have to move the black plastic bar on the pin headers around a bit to make it all fit.
Make sure the lens of the optical flow sensor, and the two dots on the distance sensor are visible through the holes.Details on the flight path
One problem with this hack is that light painting requires darkness while the flow sensor requires light. As long as the LED-ring is lit up, the Flow sensor will work just fine, but it is not possible to move the quadcopter around if it is off.
While the Crayzflie follows the outline of the tree we use green on full power and all is good. In the second half when we move to the positions of the balls we would ideally want to turn the LED-ring off, but that is not possible since the flow deck will not work. Instead we turn the power down and fly a bit faster to reduce the painting effect. When at the ball position the LED power is cranked up again but with a different color.Painting
This is what it looked like when the Crazyflie was flying, the end of the sequence.
Note the jumpy behaviour at the end, this is due to the battery is almost empty.The result
The final picture:
Note: The blue and red thin lines are the LEDs on top of the Crazyflie. It might look like there is a lot of noise in the image, but it is actually the pattern of the floor.
Happy holidays from the Bitcraze team!