├── .gitignore ├── Firmware ├── Arduija_Demo │ └── Arduija2_1_1.ino ├── EasyDriver_Example1 │ └── EasyDriver_Example1.ino ├── EasyDriver_Example2 │ └── EasyDriver_Example2.ino ├── EasyDriver_Example3 │ └── EasyDriver_Example3.ino ├── EasyDriver_Example4 │ └── EasyDriver_Example4.ino ├── EasyDriver_Example5 │ └── EasyDriver_Example5.ino ├── README.md └── SparkFun_Big_Easy_Driver_Basic_Demo │ └── SparkFun_Big_Easy_Driver_Basic_Demo.ino ├── Hardware ├── BigEasyDriver.brd └── BigEasyDriver.sch ├── Production_Files ├── BigEasyDriver_GiantPanel_v16a.brd └── BigEasyDriver_Panel_v16a.brd └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ############# 33 | ## Eagle 34 | ############# 35 | 36 | # Ignore the board and schematic backup files 37 | *.b#? 38 | *.s#? 39 | 40 | 41 | ################# 42 | ## Visual Studio 43 | ################# 44 | 45 | ## Ignore Visual Studio temporary files, build results, and 46 | ## files generated by popular Visual Studio add-ons. 47 | 48 | # User-specific files 49 | *.suo 50 | *.user 51 | *.sln.docstates 52 | 53 | # Build results 54 | [Dd]ebug/ 55 | [Rr]elease/ 56 | *_i.c 57 | *_p.c 58 | *.ilk 59 | *.meta 60 | *.obj 61 | *.pch 62 | *.pdb 63 | *.pgc 64 | *.pgd 65 | *.rsp 66 | *.sbr 67 | *.tlb 68 | *.tli 69 | *.tlh 70 | *.tmp 71 | *.vspscc 72 | .builds 73 | *.dotCover 74 | 75 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 76 | #packages/ 77 | 78 | # Visual C++ cache files 79 | ipch/ 80 | *.aps 81 | *.ncb 82 | *.opensdf 83 | *.sdf 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | 89 | # ReSharper is a .NET coding add-in 90 | _ReSharper* 91 | 92 | # Installshield output folder 93 | [Ee]xpress 94 | 95 | # DocProject is a documentation generator add-in 96 | DocProject/buildhelp/ 97 | DocProject/Help/*.HxT 98 | DocProject/Help/*.HxC 99 | DocProject/Help/*.hhc 100 | DocProject/Help/*.hhk 101 | DocProject/Help/*.hhp 102 | DocProject/Help/Html2 103 | DocProject/Help/html 104 | 105 | # Click-Once directory 106 | publish 107 | 108 | # Others 109 | [Bb]in 110 | [Oo]bj 111 | sql 112 | TestResults 113 | *.Cache 114 | ClientBin 115 | stylecop.* 116 | ~$* 117 | *.dbmdl 118 | Generated_Code #added for RIA/Silverlight projects 119 | 120 | # Backup & report files from converting an old project file to a newer 121 | # Visual Studio version. Backup files are not needed, because we have git ;-) 122 | _UpgradeReport_Files/ 123 | Backup*/ 124 | UpgradeLog*.XML 125 | 126 | 127 | ############ 128 | ## Windows 129 | ############ 130 | 131 | # Windows image file caches 132 | Thumbs.db 133 | 134 | # Folder config file 135 | Desktop.ini 136 | 137 | 138 | ############# 139 | ## Python 140 | ############# 141 | 142 | *.py[co] 143 | 144 | # Packages 145 | *.egg 146 | *.egg-info 147 | dist 148 | build 149 | eggs 150 | parts 151 | bin 152 | var 153 | sdist 154 | develop-eggs 155 | .installed.cfg 156 | 157 | # Installer logs 158 | pip-log.txt 159 | 160 | # Unit test / coverage reports 161 | .coverage 162 | .tox 163 | 164 | #Translations 165 | *.mo 166 | 167 | #Mr Developer 168 | .mr.developer.cfg 169 | 170 | # Mac crap 171 | .DS_Store 172 | -------------------------------------------------------------------------------- /Firmware/Arduija_Demo/Arduija2_1_1.ino: -------------------------------------------------------------------------------- 1 | /*********************************************************** 2 | Arduija: Arduino Controlled Ouija Board 3 | Joel Bartlett 4 | Casey Kuhns 5 | SparkFun Electronics 6 | Oct. 22, 2014 7 | https://github.com/JoelEB/Arduija2_1_1 8 | 9 | This sketch uses the AccelStepper Library to controll two stpper motors, 10 | driven by two Big Easy Driver boards from SparkFun. Letters on a Ouija 11 | board are mapped out, given coordinates, and then massages are spelled 12 | out by looking up the coordinates in that table. 13 | 14 | Development environment specifics: 15 | Arduino IDE .0+ 16 | Arduino Uno 17 | 18 | This code is beerware; if you see me at the local pub, 19 | and you've found our code helpful, please buy us a round! 20 | 21 | Distributed as-is; no warranty is given. 22 | ***********************************************************/ 23 | #include 24 | #include //include the Accel Stepper Library 25 | #define MAX_ARRAY_LENGTH 32 26 | 27 | // Define two steppers and the pins they will use 28 | AccelStepper stepperX(1, 4, 5);//X axis 29 | AccelStepper stepperY(1, 6, 7);//Y axis 30 | //(driver=true, step, dir) 31 | 32 | int enableX = 10;//pins to controll the enable pins on each of the Big Easy Drivers 33 | int enableY = 11;//I tried using the intenral setEnablePin() function in the AccelStepper library 34 | //but couldn't get it to work, even when I inverted them with setPinsInverted(). 35 | 36 | int posX = 0;//Varibales to keep track of the planchet's current position 37 | int posY = 0; 38 | 39 | int switch_x_left = 8;//Limit switch variables 40 | int switct_y_top = 9; 41 | int switch_x_right = 3;//trying to set these up as interrupts (W.I.P.) 42 | int switch_y_bottom = 2; 43 | 44 | int bigButton = 12;//Added big dome pushbutotn to have it display a message when pressed. 45 | //Original plan was to have it run constantly, but the smaller stepper motor (ROB-09238) 46 | //gets hot when ran for even a shoirt while. I'm pushing it past it's max ratings. I would 47 | //recommend using a 68oz.-in. motor (ROB-10846) on both axes. Make sure you disable all motors 48 | //when not in use to minimize heat dissipation and power consumption. 49 | 50 | long randomNumber;//Random number for displaying random message when butotn is pressed. 51 | 52 | //table to store coordinates for all the letters, #s, etc on the board. 53 | //Due to the nature of the magnets and drag, getting exact coordinates took 54 | //lots of trial an error, and is still not perfect when you have the planchet 55 | //move in from different sides of the letter. 56 | unsigned int coordinatesTable[39][3] = { 57 | 1000,2600,'a', 58 | 2800,1900,'b', 59 | 4400,1700,'c', 60 | 6100,1500,'d', 61 | 8200,1300,'e', 62 | 9300,1100,'f', 63 | 11800,1200,'g', 64 | 13700,1200,'h', 65 | 15500,1100,'i', 66 | 16800,1500,'j', 67 | 18700,1700,'k', 68 | 20300,2100,'l', 69 | 22800,2500,'m', 70 | 1200,4500,'n', 71 | 2500,3900,'o', 72 | 4300,3400,'p', 73 | 6000,3200,'q', 74 | 7900,2800,'r', 75 | 9700,2600,'s', 76 | 11500,2600,'t', 77 | 13600,2700,'u', 78 | 15400,2700,'v', 79 | 17200,2800,'w', 80 | 19400,3400,'x', 81 | 20800,4000,'y', 82 | 22800,4500,'z', 83 | 0,0,'0', 84 | 0,0,'1', 85 | 0,0,'2', 86 | 0,0,'3', 87 | 0,0,'4', 88 | 0,0,'5', 89 | 0,0,'6', 90 | 0,0,'8', 91 | 0,0,'9', 92 | 4400,10,'+',//YES 93 | 19900,10,'-',//NO 94 | 0,0,'!',//GOODBYE 95 | 11700,100,'.'//SPACE 96 | }; 97 | //------------------------------------------------------------------------------ 98 | void setup() 99 | { 100 | Serial.begin(115200);//Serial print for debug 101 | 102 | pinMode(bigButton, INPUT_PULLUP);//Pullup button so external resistor is not needed 103 | randomSeed(analogRead(0));//Read analog(0) for random number generation 104 | 105 | pinMode(enableX, OUTPUT);// 106 | pinMode(enableY, OUTPUT); 107 | 108 | digitalWrite(enableX, HIGH);//Diable the motors 109 | digitalWrite(enableY, HIGH); 110 | 111 | //Had to play with these vallues to find a speed and acceleration that looked good 112 | //but also still ran smoothly. Tweeking these values and physically changing the 113 | //potentiometers on the Big Easy Driver will affect the speed of each axis. 114 | //BEWARE, changing these settings will change coordinates and mess up any characters 115 | //you have mapped out already. 116 | stepperX.setMaxSpeed(6000); 117 | stepperX.setAcceleration(5000); 118 | stepperY.setMaxSpeed(4000); 119 | stepperY.setAcceleration(4000); 120 | 121 | //This is the internal AccelStepper enable calls referred to 122 | //earlier. Must be called within setup() (W.I.P.) 123 | //stepperX.setEnablePin(10); 124 | //stepperY.setEnablePin(11); 125 | //stepperX.setPinsInverted(0,0,1);//invert the enable pin 126 | //stepperY.setPinsInverted(0,0,1); 127 | 128 | pinMode(switch_x_left, INPUT_PULLUP); 129 | pinMode(switct_y_top, INPUT_PULLUP); 130 | pinMode(switch_x_right, INPUT_PULLUP); 131 | pinMode(switch_y_bottom, INPUT_PULLUP); 132 | //Switch interrupts to ensure the planchet never goes out of bounds (W.I.P.) 133 | //attachInterrupt(0, homeing2, FALLING); //switct_y_bottom 134 | //attachInterrupt(1, homeing2, FALLING);//switch_x_right 135 | 136 | homeing();//set the cursor back to its home position at 0,0 first and on every reset 137 | 138 | } 139 | //------------------------------------------------------------------------------ 140 | void loop() 141 | { 142 | if(digitalRead(bigButton) == LOW)//Wait until the big dome pusbutton is pressed to start spelling a message 143 | { 144 | ouijaMessage();//Select a random message from the list and print it 145 | } 146 | 147 | //Uncomment this line and comment out everything else in loop() to jog the planchet with keyboard inputs 148 | //moveWithKeyboard(); 149 | } 150 | //------------------------------------------------------------------------------ 151 | void enableMotors() 152 | { 153 | //Enable the motors 154 | digitalWrite(enableX, LOW); 155 | digitalWrite(enableY, LOW); 156 | } 157 | //------------------------------------------------------------------------------ 158 | void disableMotors() 159 | { 160 | //Disable the motors 161 | digitalWrite(enableX, HIGH); 162 | digitalWrite(enableY, HIGH); 163 | } 164 | //------------------------------------------------------------------------------ 165 | void homeing() 166 | { 167 | enableMotors(); 168 | //Decided to move Y axis first since one of the magnets was hitting if it was all the way away from home. 169 | if(digitalRead(switct_y_top) == HIGH) 170 | { 171 | while(digitalRead(switct_y_top) == HIGH) 172 | { 173 | stepperY.moveTo(posY); 174 | stepperY.run(); 175 | posY = posY - 1; 176 | //Serial.println(posY); 177 | } 178 | if(digitalRead(switct_y_top) == LOW) 179 | stepperY.stop(); 180 | posY = 0; 181 | stepperY.setCurrentPosition(0); 182 | } 183 | else 184 | { 185 | posY = 0; 186 | stepperY.setCurrentPosition(0); 187 | } 188 | 189 | if(digitalRead(switch_x_left) == HIGH)//check to make sure this axis isn;t already in the home posotion 190 | { 191 | while(digitalRead(switch_x_left) == HIGH)//if it is not at home (HIGH) ... 192 | { 193 | stepperX.moveTo(posX);//start moving the X axis back to the home position 194 | stepperX.run(); 195 | posX = posX - 1;//decrement the position until we reach 0 (where the switch is triggered) 196 | } 197 | if(digitalRead(switch_x_left) == LOW)//Once the switch is hit and the signal goes LOW... 198 | stepperX.stop();//stop the motor 199 | posX = 0;//set this axis position to 0 200 | stepperX.setCurrentPosition(0); 201 | } 202 | else 203 | { 204 | posX = 0; 205 | stepperX.setCurrentPosition(0); 206 | } 207 | disableMotors(); 208 | } 209 | //------------------------------------------------------------------------------ 210 | void ouijaDelay(void){ 211 | //Delay to make it spoooooooky 212 | //Standard Delay until we can make it more spooky 213 | delay(200); 214 | } 215 | //------------------------------------------------------------------------------ 216 | //Look through the table until a character matching the current one is found 217 | int findSymbolInTable(char symbol){ 218 | int tableIndex; 219 | 220 | for(tableIndex = 0; tableIndex <= 39; tableIndex++){ 221 | //Serial.println(char((coordinatesTable[tableIndex][2]))); 222 | if(symbol == char(coordinatesTable[tableIndex][2])){ 223 | //Serial.print("Char FOUND = "); 224 | //Serial.println(tableIndex); 225 | return tableIndex; //Return the table location 226 | } 227 | } 228 | return -1; //if we got to the point 229 | // we didn't find our value in the table 230 | } 231 | 232 | //------------------------------------------------------------------------------ 233 | //Used to move the planchet to the next location on the baord. 234 | void moveToSymbol(char character) 235 | { 236 | int tableIndex = findSymbolInTable(character); 237 | 238 | //Serial.print("x = "); 239 | //Serial.println(coordinatesTable[tableIndex][0]); 240 | 241 | //Serial.print("y = "); 242 | //Serial.println(coordinatesTable[tableIndex][1]); 243 | 244 | //MoveMotors 245 | stepperX.moveTo(coordinatesTable[tableIndex][0]); 246 | stepperY.moveTo(coordinatesTable[tableIndex][1]); 247 | 248 | while((stepperX.distanceToGo() != 0)||(stepperX.distanceToGo() != 0)){ 249 | //Serial.println(stepperX.distanceToGo()); 250 | stepperY.run(); 251 | stepperX.run(); 252 | //if(digitalRead(switch_x_right) == LOW || digitalRead(switch_y_bottom) == LOW) 253 | //homeing(); 254 | } 255 | 256 | return; 257 | } 258 | 259 | 260 | //------------------------------------------------------------------------------ 261 | void ouijaPrint(char* charArray){ 262 | int i; 263 | for(i = 0; i <= MAX_ARRAY_LENGTH; i++){ 264 | //Serial.print(charArray[i]); //Debug the array as we move 265 | if(charArray[i] != 0){ 266 | ouijaDelay(); 267 | moveToSymbol(charArray[i]); 268 | ouijaDelay(); 269 | //if(digitalRead(switch_x_right) == LOW || digitalRead(switch_y_bottom) == LOW) 270 | //homeing(); 271 | } //Only move if there if valid data, if not let the loop run out. 272 | else break; 273 | } 274 | return; 275 | } 276 | //------------------------------------------------------------------------------ 277 | //Stores different messages to be speled out by the Ouija 278 | void ouijaMessage() 279 | { 280 | enableMotors(); 281 | randomNumber = random(5);//Generate a random number between 1-5 282 | switch (randomNumber) //switch messages based on that random number 283 | { 284 | case 0: 285 | {char arrayThing[30] = {'h','e','l','.','l','o',0}; 286 | ouijaPrint(arrayThing); 287 | homeing();}//Go back to home after each massage is printed 288 | break; 289 | case 1: 290 | { 291 | char arrayThing2[30] = {'s','p','a','r','k','f','u','n',0}; 292 | ouijaPrint(arrayThing2); 293 | homeing();} 294 | break; 295 | case 2: 296 | { 297 | char arrayThing3[30] = {'h','a','p','.','p','y','.','h','a','l','.','l','o','w','e','.','e','n',0};; 298 | ouijaPrint(arrayThing3); 299 | homeing();} 300 | break; 301 | case 3: 302 | { 303 | char arrayThing4[30] = {'g','r','a','n','d','m','a','.','s','a','y','s','.','h','i',0};; 304 | ouijaPrint(arrayThing4); 305 | homeing();} 306 | break; 307 | case 4: 308 | { 309 | char arrayThing5[30] = {'l','e','t','.','y','o','u','r','.','g','e','e','k','.','s','h','i','n','e',0};; 310 | ouijaPrint(arrayThing5); 311 | homeing();} 312 | break; 313 | default: 314 | disableMotors(); 315 | } 316 | disableMotors(); 317 | } 318 | //------------------------------------------------------------------------------ 319 | //This function was used to jog each axis 100 "steps" in each direction 320 | //call in loop and comment out everything else to allow keyboard control 321 | void moveWithKeyboard() 322 | { 323 | enableMotors(); 324 | if(Serial.available() > 0) 325 | { 326 | int temp = Serial.read(); 327 | 328 | if(temp == 119 || temp == 87)//dec for 'w' 329 | { 330 | stepperY.moveTo(stepperY.currentPosition() - 100); 331 | //stepperY.setSpeed(2000); 332 | while(stepperY.distanceToGo() != 0) 333 | { 334 | stepperY.run(); 335 | } 336 | Serial.print(stepperX.currentPosition()); 337 | Serial.print(" "); 338 | Serial.println(stepperY.currentPosition()); 339 | } 340 | if(temp == 115 || temp == 83)//dec for 's' 341 | { 342 | stepperY.moveTo(stepperY.currentPosition() + 100); 343 | //stepperY.setSpeed(2000); 344 | while(stepperY.distanceToGo() != 0) 345 | { 346 | stepperY.run(); 347 | } 348 | Serial.print(stepperX.currentPosition()); 349 | Serial.print(" "); 350 | Serial.println(stepperY.currentPosition()); 351 | } 352 | if(temp == 97 || temp == 65)//dec for 'a' 353 | { 354 | stepperX.moveTo(stepperX.currentPosition() - 100); 355 | //stepperX.setSpeed(3000); 356 | while(stepperX.distanceToGo() != 0) 357 | { 358 | stepperX.run(); 359 | } 360 | Serial.print(stepperX.currentPosition()); 361 | Serial.print(" "); 362 | Serial.println(stepperY.currentPosition()); 363 | } 364 | if(temp == 100 || temp == 68)//dec for 'd' 365 | { 366 | stepperX.moveTo(stepperX.currentPosition() + 100.00); 367 | //stepperX.setSpeed(3000); 368 | while(stepperX.distanceToGo() != 0) 369 | { 370 | stepperX.run(); 371 | } 372 | Serial.print(stepperX.currentPosition()); 373 | Serial.print(" "); 374 | Serial.println(stepperY.currentPosition()); 375 | } 376 | 377 | //move in larger increments with the right side of the keyboard 378 | if(temp == 105 || temp == 73)//dec for 'i' 379 | { 380 | stepperY.moveTo(stepperY.currentPosition() - 1000); 381 | while(stepperY.distanceToGo() != 0) 382 | { 383 | stepperY.run(); 384 | } 385 | Serial.print(stepperX.currentPosition()); Serial.print(" "); Serial.println(stepperY.currentPosition()); 386 | } 387 | if(temp == 107 || temp == 75)//dec for 'k' 388 | { 389 | stepperY.moveTo(stepperY.currentPosition() + 1000); 390 | //stepperY.setSpeed(2000); 391 | while(stepperY.distanceToGo() != 0) 392 | { 393 | stepperY.run(); 394 | } 395 | Serial.print(stepperX.currentPosition()); Serial.print(" "); Serial.println(stepperY.currentPosition()); 396 | } 397 | if(temp == 106 || temp == 74)//dec for 'j' 398 | { 399 | stepperX.moveTo(stepperX.currentPosition() - 2000); 400 | //stepperX.setSpeed(3000); 401 | while(stepperX.distanceToGo() != 0) 402 | { 403 | stepperX.run(); 404 | } 405 | Serial.print(stepperX.currentPosition()); Serial.print(" "); Serial.println(stepperY.currentPosition()); 406 | } 407 | if(temp == 108 || temp == 76)//dec for 'l' 408 | { 409 | stepperX.moveTo(stepperX.currentPosition() + 2000); 410 | while(stepperX.distanceToGo() != 0) 411 | { 412 | stepperX.run(); 413 | } 414 | Serial.print(stepperX.currentPosition()); Serial.print(" "); Serial.println(stepperY.currentPosition()); 415 | } 416 | 417 | } 418 | disableMotors(); 419 | } 420 | //------------------------------------------------------------------------------ 421 | void drawCircleCW()//(W.I.P.) 422 | { 423 | enableMotors(); 424 | stepperX.moveTo(12000); 425 | stepperY.moveTo(1000); 426 | while((stepperX.distanceToGo() != 0)||(stepperX.distanceToGo() != 0)) 427 | { 428 | stepperX.run(); 429 | stepperY.run(); 430 | } 431 | 432 | stepperX.moveTo(14000); 433 | stepperY.moveTo(2000); 434 | while((stepperX.distanceToGo() != 0)||(stepperX.distanceToGo() != 0)) 435 | { 436 | stepperX.run(); 437 | stepperY.run(); 438 | } 439 | 440 | stepperX.moveTo(12000); 441 | stepperY.moveTo(3000); 442 | while((stepperX.distanceToGo() != 0)||(stepperX.distanceToGo() != 0)) 443 | { 444 | stepperX.run(); 445 | stepperY.run(); 446 | } 447 | 448 | stepperX.moveTo(8000); 449 | stepperY.moveTo(2000); 450 | while((stepperX.distanceToGo() != 0)||(stepperX.distanceToGo() != 0)) 451 | { 452 | stepperX.run(); 453 | stepperY.run(); 454 | } 455 | 456 | stepperX.moveTo(12000); 457 | stepperY.moveTo(2000); 458 | while((stepperX.distanceToGo() != 0)||(stepperX.distanceToGo() != 0)) 459 | { 460 | stepperX.run(); 461 | stepperY.run(); 462 | } 463 | disableMotors(); 464 | } 465 | 466 | 467 | 468 | 469 | 470 | -------------------------------------------------------------------------------- /Firmware/EasyDriver_Example1/EasyDriver_Example1.ino: -------------------------------------------------------------------------------- 1 | // Example1 code for Brian Schmalz's Easy Driver Example page 2 | // http://www.schmalzhaus.com/EasyDriver/EasyDriverExamples.html 3 | 4 | void setup() { 5 | pinMode(8, OUTPUT); 6 | pinMode(9, OUTPUT); 7 | digitalWrite(8, LOW); 8 | digitalWrite(9, LOW); 9 | } 10 | 11 | void loop() { 12 | digitalWrite(9, HIGH); 13 | delay(1); 14 | digitalWrite(9, LOW); 15 | delay(1); 16 | } 17 | -------------------------------------------------------------------------------- /Firmware/EasyDriver_Example2/EasyDriver_Example2.ino: -------------------------------------------------------------------------------- 1 | // Example2 code for Brian Schmalz's Easy Driver Example page 2 | // http://www.schmalzhaus.com/EasyDriver/EasyDriverExamples.html 3 | 4 | int Distance = 0; // Record the number of steps we've taken 5 | 6 | void setup() { 7 | pinMode(8, OUTPUT); 8 | pinMode(9, OUTPUT); 9 | digitalWrite(8, LOW); 10 | digitalWrite(9, LOW); 11 | } 12 | 13 | void loop() { 14 | digitalWrite(9, HIGH); 15 | delayMicroseconds(100); 16 | digitalWrite(9, LOW); 17 | delayMicroseconds(100); 18 | Distance = Distance + 1; // record this step 19 | 20 | // Check to see if we are at the end of our move 21 | if (Distance == 3600) 22 | { 23 | // We are! Reverse direction (invert DIR signal) 24 | if (digitalRead(8) == LOW) 25 | { 26 | digitalWrite(8, HIGH); 27 | } 28 | else 29 | { 30 | digitalWrite(8, LOW); 31 | } 32 | // Reset our distance back to zero since we're 33 | // starting a new move 34 | Distance = 0; 35 | // Now pause for half a second 36 | delay(500); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Firmware/EasyDriver_Example3/EasyDriver_Example3.ino: -------------------------------------------------------------------------------- 1 | // Example3 code for Brian Schmalz's Easy Driver Example page 2 | // http://www.schmalzhaus.com/EasyDriver/EasyDriverExamples.html 3 | 4 | #include 5 | 6 | // Define a stepper and the pins it will use 7 | AccelStepper stepper(1, 9, 8); 8 | 9 | int pos = 3600; 10 | 11 | void setup() 12 | { 13 | stepper.setMaxSpeed(3000); 14 | stepper.setAcceleration(1000); 15 | } 16 | 17 | void loop() 18 | { 19 | if (stepper.distanceToGo() == 0) 20 | { 21 | delay(500); 22 | pos = -pos; 23 | stepper.moveTo(pos); 24 | } 25 | stepper.run(); 26 | } 27 | -------------------------------------------------------------------------------- /Firmware/EasyDriver_Example4/EasyDriver_Example4.ino: -------------------------------------------------------------------------------- 1 | // Example4 code for Brian Schmalz's Easy Driver Example page 2 | // http://www.schmalzhaus.com/EasyDriver/EasyDriverExamples.html 3 | 4 | #include 5 | 6 | // Define two steppers and the pins they will use 7 | AccelStepper stepper1(1, 9, 8); 8 | AccelStepper stepper2(1, 7, 6); 9 | 10 | int pos1 = 3600; 11 | int pos2 = 5678; 12 | 13 | void setup() 14 | { 15 | stepper1.setMaxSpeed(3000); 16 | stepper1.setAcceleration(1000); 17 | stepper2.setMaxSpeed(2000); 18 | stepper2.setAcceleration(800); 19 | } 20 | 21 | void loop() 22 | { 23 | if (stepper1.distanceToGo() == 0) 24 | { 25 | pos1 = -pos1; 26 | stepper1.moveTo(pos1); 27 | } 28 | if (stepper2.distanceToGo() == 0) 29 | { 30 | pos2 = -pos2; 31 | stepper2.moveTo(pos2); 32 | } 33 | stepper1.run(); 34 | stepper2.run(); 35 | } 36 | -------------------------------------------------------------------------------- /Firmware/EasyDriver_Example5/EasyDriver_Example5.ino: -------------------------------------------------------------------------------- 1 | // Example5 code for Brian Schmalz's Easy Driver Example page 2 | // http://www.schmalzhaus.com/EasyDriver/EasyDriverExamples.html 3 | 4 | #include 5 | 6 | // Define the stepper and the pins it will use 7 | AccelStepper stepper1(1, 9, 8); 8 | 9 | // Define our three input button pins 10 | #define LEFT_PIN 4 11 | #define STOP_PIN 3 12 | #define RIGHT_PIN 2 13 | 14 | // Define our analog pot input pin 15 | #define SPEED_PIN 0 16 | 17 | // Define our maximum and minimum speed in steps per second (scale pot to these) 18 | #define MAX_SPEED 500 19 | #define MIN_SPEED 0.1 20 | 21 | void setup() { 22 | // The only AccelStepper value we have to set here is the max speeed, which is higher than we'll ever go 23 | stepper1.setMaxSpeed(10000.0); 24 | 25 | // Set up the three button inputs, with pullups 26 | pinMode(LEFT_PIN, INPUT_PULLUP); 27 | pinMode(STOP_PIN, INPUT_PULLUP); 28 | pinMode(RIGHT_PIN, INPUT_PULLUP); 29 | } 30 | 31 | void loop() { 32 | static float current_speed = 0.0; // Holds current motor speed in steps/second 33 | static int analog_read_counter = 1000; // Counts down to 0 to fire analog read 34 | static char sign = 0; // Holds -1, 1 or 0 to turn the motor on/off and control direction 35 | static int analog_value = 0; // Holds raw analog value. 36 | 37 | // If a switch is pushed down (low), set the sign value appropriately 38 | if (digitalRead(LEFT_PIN) == 0) { 39 | sign = 1; 40 | } 41 | else if (digitalRead(RIGHT_PIN) == 0) { 42 | sign = -1; 43 | } 44 | else if (digitalRead(STOP_PIN) == 0) { 45 | sign = 0; 46 | } 47 | 48 | // We only want to read the pot every so often (because it takes a long time we don't 49 | // want to do it every time through the main loop). 50 | if (analog_read_counter > 0) { 51 | analog_read_counter--; 52 | } 53 | else { 54 | analog_read_counter = 3000; 55 | // Now read the pot (from 0 to 1023) 56 | analog_value = analogRead(SPEED_PIN); 57 | // Give the stepper a chance to step if it needs to 58 | stepper1.runSpeed(); 59 | // And scale the pot's value from min to max speeds 60 | current_speed = sign * ((analog_value/1023.0) * (MAX_SPEED - MIN_SPEED)) + MIN_SPEED; 61 | // Update the stepper to run at this new speed 62 | stepper1.setSpeed(current_speed); 63 | } 64 | 65 | // This will run the stepper at a constant speed 66 | stepper1.runSpeed(); 67 | } 68 | -------------------------------------------------------------------------------- /Firmware/README.md: -------------------------------------------------------------------------------- 1 | SparkFun Big Easy Driver Example Code 2 | ====================================== 3 | 4 | 5 | Repository Contents 6 | ------------------- 7 | * **/Arduija_Demo** - Firmware for the [Arduija Project](https://www.sparkfun.com/news/1631). 8 | * **/SparkFun_Big_Easy_Driver_Basic_Demo** - Firmware for the [Big Easy Driver Hookup Guide](https://learn.sparkfun.com/tutorials/big-easy-driver-hookup-guide). -------------------------------------------------------------------------------- /Firmware/SparkFun_Big_Easy_Driver_Basic_Demo/SparkFun_Big_Easy_Driver_Basic_Demo.ino: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | SparkFun Big Easy Driver Basic Demo 3 | Toni Klopfenstein @ SparkFun Electronics 4 | February 2015 5 | https://github.com/sparkfun/Big_Easy_Driver 6 | 7 | Simple demo sketch to demonstrate how 5 digital pins can drive a bipolar stepper motor, 8 | using the Big Easy Driver (https://www.sparkfun.com/products/12859). Also shows the ability to change 9 | microstep size, and direction of motor movement. 10 | 11 | Development environment specifics: 12 | Written in Arduino 1.6.0 13 | 14 | This code is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round! 15 | Distributed as-is; no warranty is given. 16 | 17 | Example based off of demos by Brian Schmalz (designer of the Big Easy Driver). 18 | http://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html 19 | ******************************************************************************/ 20 | //Declare pin functions on Arduino 21 | #define stp 2 22 | #define dir 3 23 | #define MS1 4 24 | #define MS2 5 25 | #define MS3 6 26 | #define EN 7 27 | 28 | //Declare variables for functions 29 | char user_input; 30 | int x; 31 | int y; 32 | int state; 33 | 34 | void setup() { 35 | pinMode(stp, OUTPUT); 36 | pinMode(dir, OUTPUT); 37 | pinMode(MS1, OUTPUT); 38 | pinMode(MS2, OUTPUT); 39 | pinMode(MS3, OUTPUT); 40 | pinMode(EN, OUTPUT); 41 | resetBEDPins(); //Set step, direction, microstep and enable pins to default states 42 | Serial.begin(9600); //Open Serial connection for debugging 43 | Serial.println("Begin motor control"); 44 | Serial.println(); 45 | //Print function list for user selection 46 | Serial.println("Enter number for control option:"); 47 | Serial.println("1. Turn at default microstep mode."); 48 | Serial.println("2. Reverse direction at default microstep mode."); 49 | Serial.println("3. Turn at 1/16th microstep mode."); 50 | Serial.println("4. Step forward and reverse directions."); 51 | Serial.println(); 52 | } 53 | 54 | //Main loop 55 | void loop() { 56 | while(Serial.available()){ 57 | user_input = Serial.read(); //Read user input and trigger appropriate function 58 | digitalWrite(EN, LOW); //Pull enable pin low to set FETs active and allow motor control 59 | if (user_input =='1') 60 | { 61 | StepForwardDefault(); 62 | } 63 | else if(user_input =='2') 64 | { 65 | ReverseStepDefault(); 66 | } 67 | else if(user_input =='3') 68 | { 69 | SmallStepMode(); 70 | } 71 | else if(user_input =='4') 72 | { 73 | ForwardBackwardStep(); 74 | } 75 | else 76 | { 77 | Serial.println("Invalid option entered."); 78 | } 79 | resetBEDPins(); 80 | } 81 | } 82 | 83 | //Reset Big Easy Driver pins to default states 84 | void resetBEDPins() 85 | { 86 | digitalWrite(stp, LOW); 87 | digitalWrite(dir, LOW); 88 | digitalWrite(MS1, LOW); 89 | digitalWrite(MS2, LOW); 90 | digitalWrite(MS3, LOW); 91 | digitalWrite(EN, HIGH); 92 | } 93 | 94 | //Default microstep mode function 95 | void StepForwardDefault() 96 | { 97 | Serial.println("Moving forward at default step mode."); 98 | digitalWrite(dir, LOW); //Pull direction pin low to move "forward" 99 | for(x= 0; x<1000; x++) //Loop the forward stepping enough times for motion to be visible 100 | { 101 | digitalWrite(stp,HIGH); //Trigger one step forward 102 | delay(1); 103 | digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again 104 | delay(1); 105 | } 106 | Serial.println("Enter new option"); 107 | Serial.println(); 108 | } 109 | 110 | //Reverse default microstep mode function 111 | void ReverseStepDefault() 112 | { 113 | Serial.println("Moving in reverse at default step mode."); 114 | digitalWrite(dir, HIGH); //Pull direction pin high to move in "reverse" 115 | for(x= 0; x<1000; x++) //Loop the stepping enough times for motion to be visible 116 | { 117 | digitalWrite(stp,HIGH); //Trigger one step 118 | delay(1); 119 | digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again 120 | delay(1); 121 | } 122 | Serial.println("Enter new option"); 123 | Serial.println(); 124 | } 125 | 126 | // 1/16th microstep foward mode function 127 | void SmallStepMode() 128 | { 129 | Serial.println("Stepping at 1/16th microstep mode."); 130 | digitalWrite(dir, LOW); //Pull direction pin low to move "forward" 131 | digitalWrite(MS1, HIGH); //Pull MS1,MS2, and MS3 high to set logic to 1/16th microstep resolution 132 | digitalWrite(MS2, HIGH); 133 | digitalWrite(MS3, HIGH); 134 | for(x= 0; x<1000; x++) //Loop the forward stepping enough times for motion to be visible 135 | { 136 | digitalWrite(stp,HIGH); //Trigger one step forward 137 | delay(1); 138 | digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again 139 | delay(1); 140 | } 141 | Serial.println("Enter new option"); 142 | Serial.println(); 143 | } 144 | 145 | //Forward/reverse stepping function 146 | void ForwardBackwardStep() 147 | { 148 | Serial.println("Alternate between stepping forward and reverse."); 149 | for(x= 1; x<5; x++) //Loop the forward stepping enough times for motion to be visible 150 | { 151 | //Read direction pin state and change it 152 | state=digitalRead(dir); 153 | if(state == HIGH) 154 | { 155 | digitalWrite(dir, LOW); 156 | } 157 | else if(state ==LOW) 158 | { 159 | digitalWrite(dir,HIGH); 160 | } 161 | 162 | for(y=0; y<1000; y++) 163 | { 164 | digitalWrite(stp,HIGH); //Trigger one step 165 | delay(1); 166 | digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again 167 | delay(1); 168 | } 169 | } 170 | Serial.println("Enter new option"); 171 | Serial.println(); 172 | } 173 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SparkFun Big Easy Driver 2 | ======================== 3 | 4 | ![SparkFun Big Easy Driver](https://cdn.sparkfun.com//assets/parts/9/7/2/6/12859-01.jpg) 5 | 6 | [*SparkFun Big Easy Driver (ROB-12859)*](https://www.sparkfun.com/products/12859) 7 | 8 | This is a stepper motor driver board capable of driving bi-polar stepper motors at up to 2A/phase. 9 | 10 | Repository Contents 11 | ------------------- 12 | 13 | * **/Firmware** - Example Arduino sketches 14 | * **/Hardware** - All Eagle design files (.brd, .sch) 15 | * **/Production** - Test bed files and production panel files 16 | 17 | Product Versions 18 | ---------------- 19 | * [ROB-12859](https://www.sparkfun.com/products/12859)- Version 1.6. Currently available. 20 | * [ROB-11876](https://www.sparkfun.com/products/retired/11876)- Version 1.5. Retired. 21 | * [ROB-11699](https://www.sparkfun.com/products/retired/11699)- Version 1.3. Retired. 22 | * [ROB-10735](https://www.sparkfun.com/products/retired/10735)- Version 1.2. Retired. 23 | 24 | Version History 25 | --------------- 26 | * [Hw-v1.6_Fw-v1.0](https://github.com/sparkfun/Big_Easy_Driver/tree/HW-v1.6_Fw-v1.0) -GitHub tag for hardware version 1.6, firmware version 1.0. 27 | * [HW-v1.5](https://github.com/sparkfun/Big_Easy_Driver/tree/HW-v1.5) - GitHub tag for Hardware version 1.5. 28 | 29 | License Information 30 | ------------------- 31 | The hardware is released under [Creative Commons Share-alike 3.0](http://creativecommons.org/licenses/by-sa/3.0/). 32 | 33 | The code is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round! 34 | 35 | Distributed as-is; no warranty is given. 36 | 37 | Getting Started Help 38 | -------------------- 39 | There's a great [Big Easy Driver Hookup Guide](https://learn.sparkfun.com/tutorials/big-easy-driver-hookup-guide) by SparkFun. 40 | 41 | There are six example sketches in the **/Firmware** directory. Examples 1 through 5 have hookup diagrams and explanations on the [Easy Driver Examples](http://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html) page. 42 | 43 | _This is a collaboration with Brian Schmalz._ 44 | --------------------------------------------------------------------------------