Introduction: Color Copying Pen

About: Hello!

Hello! This project is a pen that can replicate a color found in any object. It works by touching any item with the end of your pen, click a button, and then draw using that same color as that object you chose.


I had this idea when I saw a pack of 48 markers at a store. I thought it would be so much easier to pick from the colors around you. So many drawings and paintings pull inspiration from the environment around us, so I created this!

Supplies

You will need the following items:

Arduino Nano

3 ml Syringes

Servo Motors

Color Sensor

Flathead Nails 1-2 mm

Jumper Wires

Breadboard

Ink (Cyan, Magenta, Yellow)

String


And the following tools are recommended:

Knife

Scissors

Tweezers

Step 1: Creating the Pumps

The first step is to create the three pumps. For this step you will need three syringes, string, and your three nails. Repeat the following steps 3 times:

1) Pull out the plunger and remove the small rubber piece at the end. Drill a hole in the center. This hole should be just big enough for a string to run through it. Make sure it is not too big as that will release needed pressure.

2) With the remaining barrel of the syringe, make a cut using a knife somewhere around the 2 mL mark. Keep the end containing the tip, and discard the rest.

3) Tie a string to the head of your nail. Push the nail through the small rubber cap. Place the nail through the tip of the syringe. Place the cap at the other end of the syringe. Make sure the end of the string is outside of the syringe.

The pump should look like the attached picture. Hold these on the side, as they will be used later.

Step 2: Circuit

Connect the circuit as shown in the picture. Then connect the servo motors by "stacking" them. Rotate

Step 3: Code

Use the following code and upload it to your arduino nano:


#include <Adafruit_TCS34725.h>

#include <Servo.h>


Servo mA;

Servo mB;

Servo mC;


Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);




void setup() {

Serial.begin(9600);

mA.attach(3);  //CYAN

mB.attach(5);  //YELLOW

mC.attach(6);  //MAGENTA

tcs.begin();

}


void loop() {


delay(3000);

float red, green, blue;

tcs.getRGB(&red, &green, &blue);

Serial.print("R: "); Serial.print(int(red));

Serial.print("  G: "); Serial.print(int(green));

Serial.print("  B: "); Serial.print(int(blue));

Serial.println();


float R = int(red);

float G = int(green);

float B = int(blue);


float cyan = 10 - R/25.5;

float magenta = 10 - G/25.5;

float yellow = 10 - B/25.5;


Serial.print("Cyan: ");\

Serial.print(cyan);

Serial.print("  Yellow: ");

Serial.print(yellow);

Serial.print("  Magenta: ");

Serial.print(magenta);


while(cyan>0){

mA.write(0);

delay(1000);

mA.write(90);

delay(1000);

cyan = cyan - 1;

}


while(yellow>0){


mB.write(180);

delay(1000);

mB.write(60);

delay(1000);

yellow = yellow - 1;

}

while(magenta>0){


mC.write(0);

delay(1000);

mC.write(90);

delay(1000);

magenta = magenta - 1;

}


delay(100000);

}

Step 4: Putting It All Together

Every component is now done. Now, we just need to put it all together, and compact it into a smaller space. For addition aid in this step refer to the third diagram above.

To do this, hot glue the servo motors as shown in the diagram. Make sure the extension sticks are on. Then, take your pumps, and make sure the nail is resting in the furthest down position possible. Then, tie the string to the servo motor respectively. Do this with all three. After this, attach a 9v battery to power the Arduino nano to the back of the breadboard. Then, glue the breadboard(make sure the color sensor is attached to the end of the pen), battery, and servo motors together as shown in the second diagram.

Step 5: Filling the Ink

Finally, fill the pumps(syringes) with ink. This ink can be bought, or made using paint and water. Make sure the pumps are filled with the correct ink. For example, the servo motor controlling the cyan value should also control the pump filled with cyan ink.

Step 6: Finalizing

After this, you can create a frame for your pen. 3d print a frame, or find something to cover the circuitry. Make sure the frame has a tip or opening for the ink. The project is complete! Scan an object using the end of your pen, and watch as that color will be replicated!

Colors of the Rainbow Contest

Participated in the
Colors of the Rainbow Contest