# A simple function plotter project

To plot any curve or a function on a paper we need points of that curve, so to draw a curve, I will store a set of points in the processor and use motors, markers and other mechanism to draw straight lines attaching these points and these points are so close to each other that the resultant will look an actual curve.

So I am going to draw the curve with a marker or a pen.

1. Yes to do this project I need motors which would change the position of a marker but which one?

With my knowledge stepper motor and servo motors are appropriate but not sure whether they are appropriate since I have never used them, so will they work?

The dimension of paper on which I will be working on is 30x30 cms.

I have two ideas for this machine

a. A rectangular one as shown

I would make my marker holder movable with help of rack and pinion mechanism but I am not sure that this would be precise and I may have to alter to some other mechanism and if you know such then that can really help me.

b. A cylindrical one

Here I would roll a paper on this cylinder and this paper will get unrolled as the cylinder rotates and even the marker holder is movable but only in X direction and the rolling of paper is nothing but change of Y position.

1. Which one of the above two methods is good?

2. I know about microcontrollers and I want to control the motors using them so I decided to go with Atmega 16 microcontroller. But here i might need microstepping of signals how would I be able to do that with microcontrollers?

Edit : To draw lines of particular slope I would have to know the slope between two points and the depending on the slope I would rotate motors with particular speed so that marker will move in a straight fashion with that slope.

• -1 One question per question please. Feb 4 '16 at 17:13
• I suppose those are not very big questions so they might look better at one place @BendingUnit22 Feb 4 '16 at 17:44
• I knew someone would do this but it would be much better if all related smaller questions of a particular topic are at one place. Also If I made different questions navigation would be irritating and I would have to explain the same thing again and again in every question. I apologize for this but I think you people understand and also it would be much better if continuation of such smaller questions are at one place @Bending Uniy 22 Feb 4 '16 at 17:46

1. For the range of motion you are talking about, I would recommend stepper motors. Motion control will be easier to implement because they move a fixed distance per step.

2. Assuming the drum (idea B) is larger than the gear/pulley you would use for idea A, then I would say idea A is better. This is because the motor you use will turn some finite angle $\theta$, which means the carriage or drum will traverse a distance $r\theta$ - whichever device has a shorter radius (pulley or drum) will result in smaller motions, giving you a smoother curve. Also, putting paper correctly indexed on the drum (and holding it there!!) will be considerably more difficult than laying it flat in a frame. For example, if your stepper motor has a step size of 1.8 deg (0.0314 rad), and you use it on a pulley for a carriage where the pulley radius is 1cm, then your minimum motion on that axis is (0.0314 * 1)cm = 0.314mm. However, if your drum is big enough to hold the 30x30cm paper (perimeter = 30cm), then the drum radius is about 4.75cm, so your new minimum motion is (0.0314*4.75)cm = 1.5mm, or almost 5 times the distance between points!

3. Typically you won't controller the stepper motors directly from the microcontroller; you'll use a stepper driver to run the motors. The microcontroller then tells the driver what size steps to take (full, half, quarter, etc.) and how many steps to take and the driver does all of the power electronics and phasing for you.

As a reminder - you'll need a mechanism to raise and lower the pen or your entire drawing will be one connected line.

## :EDIT:

Finding a mechanism to raise and lower the pen frame is outside the scope of this site [shopping recommendation], but I would try a spring-loaded pen attached to a servo motor.

Regarding micro-stepping, I'm not sure what your question is. For the driver I linked above, you set two bits for full [0,0], half [1,0], quarter [0,1] or eighth [1,1] stepping. That's it. You would use GPIO pins to do this, wired to the MS2 and MS1 pins on the stepper driver. When you want to take a step, you send a pulse to the STEP pin on the driver. The driver takes care of everything else.

• 1. As for question 1 Yes I need easier implementation since I am a beginner so I am going to use a stepper motor, 2. Yes I don't have a number 2 and I am going to edit the question, 3. Yes the math will be harder and I can overcome it but also the overhead of indexing the paper exists so I am going with idea a, 4. Yes I know that I would need a driver but how can I do microstepping with MCU. Please explain this part in more detail. For full quarter, half it is easy to just connect pins of MCU and program it to achieve the result. But how would I achieve step angles as low as 1.8 degrees. Feb 4 '16 at 18:03
• It will be very nice of you if you also help me in finding a mechanism to lower or raise the pen frame. Feb 4 '16 at 18:10
• Ok so the driver turns my digital signal from MCU into a nice analog signal which are then given to motors. So it is all the driver which would do the job.... I see it now. Feb 4 '16 at 18:31
• @Jasser - Well... essentially, yes, the driver takes care of the "magic" of interfacing with the motors, but they're stepper motors, so there's not really an analog signal per se like there is with a typical DC motor. But for all intents and purposes, yes, it works like that. Feb 4 '16 at 18:32
• Oh yes its not an analog signal and thankyou for the #2 part too. Feb 4 '16 at 18:34