Noah W.
Published © CC0

Color-Copying Pen

A pen that can replicate colors found in other objects.

IntermediateFull instructions provided6 hours134
Color-Copying Pen

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
9V battery (generic)
9V battery (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Gravity: TCS34725 RGB Color Sensor For Arduino
DFRobot Gravity: TCS34725 RGB Color Sensor For Arduino
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Ink Pumps

Make the ink pumps using 3 cut syringes, flathead nails, and sewing string

Servos

Configure Servos like this diagram. Tie the strings of the pumps to the servos.

Circuit

Configure circuit like this diagram

Entire Pen

Configure Pen like this diagram

Code

Code

Arduino
#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);

}

Credits

Noah W.
2 projects • 0 followers
High School student making stuff
Contact

Comments

Please log in or sign up to comment.