Arduino Drawing Machine

Posted on 25/04/2019 by demej00
Steps completed / 2
Press to mark a step as
completed or click here to complete all
Components you will need
Select missing items to add them
to the cart or select all
Introduction

A simple artist copying machine using two potentiometers, two servos and an Arduino Uno. It produces a squiggly line drawing but is a nice collaboration between man and machine.


This is an easy little project that I might actually keep around and use, unlike most of my other projects. It is kind of an electronic pantograph - copying a picture by tracing it then produces a facsimile copy  - although the copy is quite rough, it looks fairly artistic and faithful to the original without being a duplicate.

It will be improved by using a longer arm to make a larger copy and by replacing the micro servos with standard size ones to produce a less wavy line

Quite fun and easy to use.

 

#include <Servo.h>
Servo arm,elbow;
int potPinArm = 1;
int potArmVal = 0;
int potPinElbow = 2;
int potElbowVal = 0;
void setup() {
  Serial.begin(9600);
  arm.attach(2);
  elbow.attach(3);
}
void loop() {
potArmVal = analogRead(potPinArm);
Serial.print("potArm="); Serial.print(potArmVal); 
potArmVal = map(potArmVal,0,700,179,0);
Serial.print("potArmVal="); Serial.print(potArmVal); 
arm.write(potArmVal); // make the servo go to the pot position
delay(10);
potElbowVal = analogRead(potPinElbow);
Serial.print("potElbow="); Serial.println(potElbowVal);
potElbowVal = map(potElbowVal,0,700,179,0);
Serial.print("potElbowVal="); Serial.println(potElbowVal);
elbow.write(potElbowVal); // make the servo go to the pot position
delay(10);
}

LikedLike this to see more

Spread the word

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post