Introduction: How to Make an Artbot: Colour Sensing, Drawing Arduino Robots Making Generative Art
For the course Hardware and Physical Computing supervised by Paul Klomp as part of the Media Technology programma at the Leiden University, we created two drawing robots. Each robot was build around an Arduino Uno, and equipped with two wheels driven by DC motors, an acryl paint marker and a colour sensor. They would leave a coloured trail on the white paper they were driving on, and change their behaviour depending on the colours their colour sensor would detect. The result, an evolving artwork created by robots making moves based on simple rules.
As we got a lot of inspiration from websites such as instructables and Polulu, it seems fair to give something back by documenting the steps in the creation process of these artbots.
The bots consisted of the following components:
- Arduino Uno
- Tamiya's Twin-Motor Gearbox (including two DC motors)
- Texas Instrument's DRV8833 Dual Motor Driver Carrier
- I2C Level Converter 5V-3.3V
- Adafruit's Flora Color Sensor with white illumination LED - TCS34725
- 3 LEDs
- Soldering tin
- Wooden wheels
- 15 mm Acrylic paint marker
- Metal holder
- Angle iron
- 2 9V battery holders
- 2 9V batteries [BEWARE: 9V batteries run out really fast, it might be wiser to use a set of AA batteries, or a rechargeble battery)]
- 2mm x 15mm x 1m aluminium sheet
- 1cm diamater wood
- White paper sheets
- Dark paper for the borders
- Bolts and nuts
- Rubber (tape)
- Adhesive tape
- Soldering equipment
- Drill press with circle bit
- Iron saw
Step 1: Step 1: Assembling the Gearbox and Frame
The first step is cutting out the wheels (diameter: 5 cm) out of wood using the circle bit on a drill press.
Next, the Tamiya gearbox is assembled following the manual inside. We chose to assemble the gearbox in the slower 203:1 ratio. And unintended advantage being that two little yellow parts we did not need fitted exactly in the middle of the wooden wheels.
The print board is sawn into a bigger (7cm X 10 cm) and a smaller (7cm X 4 cm) piece, which eventually are placed on top of each other. The gearbox is hung on the bottom using bolts and nuts. The metal holder is put into place using the iron angle. 9V batteries holders are stuck on top with tape.
Three ca. 10 cm sheets are cut from the aluminium. Two are used as bumper holders and one as holder for the colour sensor. All are attached to the frame using bolts and nuts.
From another aluminium sheet, we made a bumper to avoid the two robots from collision
Step 2: Step 2: Soldering and Connecting the Hardware
The pin rows are soldered to the DRV8833 and I2C chips.
Next, the chips are soldered to a smaller printboard. In our case, we had to cut through the copper lanes to prevent short circuiting from happening, between pins as well as around holes for bolts.
Wires are soldered to connect them to the pins in the board and onto the pins of the colour sensor.
In made an impression of the wiring in Fritzing (see embedded image), using different chips. Note that the wiring here is "reversed" from chips in the second image, as our chips are hanging upside down.
The sensor was hanged ca. 3 mm from the floor.
Further details on the hardware, how to wire it and official factsheets can be found here:
Step 3: Step 3: Drawing and Coding
We built two artbots, and equipped one with a blue acrylic paint marker, and the other with a red marker.
We used the r, g and b values of the colour sensor to define the boundaries between black, red, blue and white. The measurements being quite prone to disturbances such as small deviations in the distance from ground to sensor, we made sure the margins were quite big.
We found we needed to sent slightly different PWM values to the motors to make the robots go straight ahead. An error of which we did not find the cause (suggestions are welcome!)
In our demonstration, the bots had two modes. The first instruction being "go straight and turn when a red or blue line is encountered", the second one being a sinus function where the sine period increased or decreased when lines were encountered. Black paper was used for the outer boundaries, the bots making a "go back and turn" move whenever they encountered black. After encountering ten lines, the bots switched between modes.
Of course, many other scenarios can be thought of. If you have other ideas for the robot's behaviour, feel free to share them with us in a comment.
Our Arduino code can be found in the zip file.