Jennifer Chen
Created October 19, 2015 © GPL3+

Spirograph Drawing Machine

Automate a drawing machine to draw effortless spirographs

IntermediateShowcase (no instructions)469
Spirograph Drawing Machine

Things used in this project

Hardware components

DC motor (generic)
×1
4xAA battery holder
4xAA battery holder
×1
AA Batteries
AA Batteries
×2

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Code

Stepper Motor Code using AccelStepper

C/C++
// accellsteppertest.ino
// Runs one stepper forwards and backwards, accelerating and decelerating
// at the limits. Derived from example code by Mike McCauley
// Set for 28BYJ-48 stepper

#include <AccelStepper.h>

#define FULLSTEP 4
#define HALFSTEP 8

//declare variables for the motor pins
int motorPin1 = 8;  // Blue   - 28BYJ48 pin 1
int motorPin2 = 9;  // Pink   - 28BYJ48 pin 2
int motorPin3 = 10; // Yellow - 28BYJ48 pin 3
int motorPin4 = 11; // Orange - 28BYJ48 pin 4
                        // Red    - 28BYJ48 pin 5 (VCC)

// The sequence 1-3-2-4 required for proper sequencing of 28BYJ48
AccelStepper stepper2(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);

void setup()
{    
  stepper2.setMaxSpeed(1000.0);
  stepper2.setSpeed(200);
}

void loop()
{
  stepper2.runSpeed();
}

Credits

Jennifer Chen

Jennifer Chen

13 projects • 12 followers

Comments