How to make a DIY Dot painting machine with Arduino

How to make a DIY Dot painting machine with Arduino

Hello and welcome back. In this project, we will learn how to make a DIY dot painting machine with Arduino. For that, I mainly used the Arduino UNO board and L293D motor driver shield. It is like a CNC machine. But, I have used a simple program for this machine. You can calibrate it as you like.

So this project consists of four main parts. For that, I used two stepper motors and two servo motors. That is, the 28BYJ-48 stepper motor is used to rotate the base plate, while the older DVD writer stepper motor is used to move the base plate forward and backward. Furthermore, the SG90 servo motor is used for dotting and the MG995 servo motor is used for ink pick up. But, you can also use two SG90 servo motors. Also, no CNC knowledge is required for this project. I used a simple manual program for this project. You can adjust it as you like. If you want to learn how to make a DIY CNC machine with old DVD writers, please use the link below.

  • How to make a DIY drawing CNC machine with Arduino – Click on me

Let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, prepare the old cd driver parts. For that, use this project. And then, cut the foam board using the following sizes. You can use any other suitable material for that.

Step 3

Third, paste this piece to the back side of the CD drive base. Also, paste the support pieces for the main foam board piece.

Step 4

Now, paste the 28BYJ-48 stepper motor on the CD drive motion part and paste the 65mm wheel on this stepper motor. Then, paste the CD in the middle of this wheel.

Step 5

Next, paste the piece of foam board on the MG995 servo motor. And then, paste it on the main support. For that, use the picture below.

Step 6

Now, cut a 12.5cm piece of foam board and glue it onto the servo horn. Then, glue the support pieces to it. Use the following images for that.

Step 7

OK, now paste the pencil holder plate in front of this machine(I used a pencil to place the dots). And then, paste the pencil holder parts on this plate. For that, I used a pen clip and a piece of small pipe.

Step 8

Next, install the SG90 servo motor on the pencil holder plate. And then, create the hook to move the pencil up and down. I used an iron stick for that. Finally, connect it to the servo horn.

Step 9

Now, connect the L293D motor driver shield to the Arduino UNO board. And then connect the stepper motors and servo motors to the motor driver shield.

How to make a DIY Dot painting machine with Arduino

Step 10

Then, install this board on the side of the machine and connect it to the computer.

Step 11

Now, copy and paste the following program on the Arduino IDE.

#include <Servo.h>
#include <AFMotor.h>

#define penup 130
#define pendown 150
#define getColor 130
#define drawing 180

AF_Stepper motory(48, 1);
AF_Stepper motorx(48, 2);

//AF_DCMotor(1, 8KHZ);

Servo servoPen;
Servo servoRotete;

void setup() {
  servoPen.attach(9);
  servoRotete.attach(10);
  motorx.setSpeed(400);
  motory.setSpeed(400);

  getcolor();
  firstRound();
  getcolor();
  secondRound();
  getcolor();
  thirdRound();
  getcolor();
  fouthRound();
  getcolor();
  fifthRound();
}

void loop() {


}

void getcolor() {
  servoPen.write(penup);
  delay(100);
  for (int a = drawing; a >= getColor; a-- ) {
    servoRotete.write(a);
    delay(10);
  }
  delay(100);
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
  for (int a = getColor; a <= drawing; a++ ) {
    servoRotete.write(a);
    delay(10);
  }
}

void firstRound() {
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
  motorx.step(60, BACKWARD, MICROSTEP);
}

void secondRound() {
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
  motorx.step(60, BACKWARD, MICROSTEP);
}

void thirdRound() {
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
  motory.step(200, BACKWARD, INTERLEAVE);
  delay(100);
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
  motorx.step(60, BACKWARD, MICROSTEP);
}

void fouthRound() {
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(200, BACKWARD, INTERLEAVE);
    delay(100);
  }
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
  motory.step(200, BACKWARD, INTERLEAVE);
  delay(100);
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
  motorx.step(60, BACKWARD, MICROSTEP);
}
void fifthRound() {
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  getcolor();
  for (int a = 0; a < 3; a++) {
    delay(100);
    servoPen.write(pendown);
    delay(100);
    servoPen.write(penup);
    delay(100);
    motory.step(250, BACKWARD, INTERLEAVE);
    delay(100);
  }
  servoPen.write(pendown);
  delay(100);
  servoPen.write(penup);
  delay(100);
}
  • You have to change the servo motor degree values according to your servo motor horn positions.
  • And then, select the board and port. After, click the upload button.

Step 12

Now, remove the USB cable. And then, glue the piece to put the paints. Next, put the paints and place the paper sheet on the CD.

Step 13

Finally, provide an external 12VDC power supply and turn on this dot painting machine. Now you can see your machine perform.

OK, enjoy this project. The full video guide is below. We hope to see you in the next project or tutorial.

How to make a Dot painting machine with Arduino

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *