Intro: Quadcopter Spray Can Mod
This guide follows an attempt to make a spray painting quadcopter for indoor drone painting.
It is a series of experiments and observations, not quite a perfect step-by-step tutorial! =D
Use this guide on your own property only! Use of this technology is not endorsed for any illegal painting.
Step 1: Materials & Tools
This project has many parts and optional components.
For the sprayer device:
- Can Gun or Spray Extender
- Micro servo or high-torque micro servo
- Paper clip or other small piece of wire
- Rotary tool for drilling mounting holes
- Zipties and/or E6000 adhesive
For the plug-and-play power circuit:
- Piece of Perma-Proto or other perfboard
- 5V regulator or UBEC Step-Down (Buck) Converter
- Premium jumper wires
- Header pins
- Velcro tape
- Soldering station and supplies
General quadcopter stuff:
- 3D printed prop guards (now updated for IRIS+)
- extra propellers
- spray paint with straw from cleaning spray bottle
- stiff wire for mounting sprayer - we found that tomato cages work great
Step 2: Sprayer Device
This sprayer worked well for us but there are others available online or in your local hardware store that will work just as well! Open it up to reveal the mechanism inside...
Test fit your micro servo in a location where the movement can pull the can trigger. Affix with E6000 glue or epoxy and allow to dry (quadcopter foot being used in above photo as a spacer only while the glue dries).
Drill a small hole in the trigger for affixing a wire later.
Cut the red trigger mechanism so it fits around the motor and doesn't intersect.
Attach a wire to the horn of the motor and run it through the hole in the trigger. It's also useful to route out a bit of clearance in the handle itself for the wire to move.
Route the servo wire out the top of the can gun and leave slack on the trigger wire for calibrating later.
When prototyping, it's always helpful to have two of each part in case one breaks or needs troubleshooting! The can gun on the right suffered a small break while trimming the red trigger, which was fixed with pieces of a chopstick and copious glue. Learn from our mistake and only trim a small amount from the red trigger mechanism.
We also had success with this type of spray trigger, which was designed to attach to the end of a painting extension pole for spraying wasps' nests, etc. This type did not require any drilling, as the motor sits nicely at the pole junction, held in place with zip ties.
Holes do need to be drilled for mounting to the quadcopter, however. =]
To mount to IRIS+, we used a tomato cage (available at most big box home/garden stores), cut down to size. The round shape lets it fit against the bot's arms and attach with zip ties, and the three straight supports come down and stick into holes on the plastic sprayer.
Step 3: Power/servo Circuit
On a small piece of perfboard, solder a 5V regulator. Attach three wires with female headers to the perfboard: one to the regulator input (far left pin), one to the regulator ground (center pin), and one to a free row on the perfboard (servo control).
Solder three header pins to the perfboard in a row: to the voltage regulator ground, output, and the servo control wire.
If you want to control more than just a servo, use a buck converter! It can deliver more current without heating up. It is wired similarly to the voltage regulator where the 12V battery source and ground hooks up to the input, and the header pins wire up to the output + and -, as well as the servo control as above.
Step 4: Control Servo With IRIS+
Use Velcro tape to affix the PCB to the underside of IRIS+.
Connect the voltage regulator input wire to IRIS+'s red power wire, and likewise connect the ground wire to the black IRIS+ ground wire.
Connect the servo signal wire to the white wire on IRIS+ (shown above is original IRIS with different colored wires). The black wire remains not connected.
Connect the servo to the header pins on the circuit, being sure to connect it in the correct orientation-- the brown wire is ground and should align with the voltage regulator center pin (ground), the red wire is positive and should align with the voltage regulator output, and the yellow wire should align with the servo signal coming from IRIS+.
We'll configure IRIS+ to activate the servo as if it were one of the servos in a gimbal.
At first we triggered the servo with channel 6, the knob on the IRIS+ controller as shown above. On IRIS classic, this "just worked" when the servo control wire was plugged into the orange gimbal control wire because the knob is already configured to adjust the angle of a camera this way. This approach didn't work out of the box on IRIS+, however, and requires adjusting the parameters to link up the control channel to the gimbal control.
Another option is to link the imaginary gimbal's 'camera trigger' servo to channel 7 (the switch to the left of the knob on the controller). The system expects this servo to press for a configurable length of time, then release.
Either trigger mode might be preferable, depending on whether you want long stretches or short bursts of spray! Attached is a parameter file you can load into your bot for the camera shutter option.
Click the "LOAD" button on the right in your mission planning software, and select your recently downloaded param file to load.
If you want to edit your own params, here's the important stuff! To use the channel 7 switch, set CH7_OPT to 9.
To adjust the parameters of the servo control, set the RC7 parameters to the min/max and trim values of the servo.
Adjust your CAM_* parameters for spray duration, etc.
Step 5: Settings for Indoor Flight
We followed the ArduPilot tutorial on indoor flying, so be sure to read through it thoroughly. We've created a settings profile you can load onto your copter but you should also be familiar with these basic ideas:
- many auto modes use GPS, and GPS doesn't work inside. GPS must be disabled and no auto modes can't be used.
- Adding a downward-facing sonar sensor can help make an indoor altitude hold mode
Step 6: Sonar Sensor Cables
The Pixhawk can receive info from two analog sonar sensors, which you can use to aid in an indoor "altitude hold" mode or for checking distance from a wall. Check out the ArduPilot page on wiring and configuring sonar sensors to the Pixhawk and Mission Planner.
These sensors are sensitive to interference caused by the quadcopter's motors. To cut down on interference, a special cable must be made! In addition to one of the MaxBotix sensors suggested in the ArduPilot guide, you will need:
- shielded cable with at least three wires (recycled USB cable works)
- 100uF capacitor
- 10 ohm resistor
- heat shrink tubing
- 5-position connector for Pixhawk
Strip and tin the three wires, joining the shielding to the black ground wire and attaching the resistor at the end of the red power lead. Slide a small piece of heat shrink over the resistor and its wire connection.
Insert black to ground, the power-line resistor to V+, and the white signal wire to the sensor's analog out.
Before soldering, also insert the capacitor between power and ground, making sure the long leg goes to ground.
Solder the other ends of the wires to correspond with the pins on the 5-connector plug on the Pixhawk and of the cable according to this diagram from the ardupilot site.
Although we did get sonar signals coming into the Pixhawk, we did not get so far as to use them to successfully control the autopilot for IRIS+ for this project-- perhaps you can pick up where we left off!
Step 7: Fly It!
Easier said than done! This rig is very challenging to fly, especially indoors. Make sure you have plenty of practice before affixing the spray can, which changes the center of gravity of the bot.
Step 8: Prior Attempt at Standalone Sprayer
If your drone isn't so forthcoming about providing power connectors or gimbal control documentation, you may wish to create a standalone parasitic device to trigger your spray can while it's mounted on the quadcopter. Pictured above is the "icarus one" version of the device used in KATSU's drone paintings, which uses a 3D printed servo can mount based off sliptonic's silly-string trigger on Thingiverse.
The store-bought injection-molded plastic spray mounts are really much better suited for this project than 3D printing, but for some reason it just hadn't occurred to me to look for such a product at the time.
The electronics consist of the following:
- standard servo
- Arduino Micro
- on/off switch
- 9v battery clip
- 315MHz RF receiver and remote
- half-sized Perma-Proto
Sure, the range on the transmitter/receiver pair isn't close to the range on he quadcopter's radios, but for painting you want to be close to the action anyway so this was considered an acceptable limitation.
The code (attached) simply took two digital inputs from the RF receiver and used their states to turn on the servo and press the lever as well as release it.
It is this standalone device that was attached to a DJI Phantom quadcopter to create KATSU's drone paintings. A circuit diagram is available at the icarus one site.
The current draw on the circuit seems to decrease the sensitivity of the RF receiver, resulting in a spraying can that can't be turned off remotely, so it sprays until it runs out of paint. This was also considered an acceptable limitation for experimentation under the circumstances.