I have a small desktop CNC mill (Nomad 883) and have just started to experiment with "trace isolation routing" fabrication of single-sided PC boards. This involves drawing the traces in CAD, and using a small cutter (in my case 0.50mm) to rout the trace outlines just through the copper layer. The turntable driver is my first fully-successful board. It does not have DCC capability (which would be easy to add with a slightly revised board) but my use will be by manually throwing a momentary toggle switch on the fascia.
Pins 2 through 9 of the Arduino connect directly across to pins EN (enable) through DIR on the DRV8880, other than SLP (sleep) which I hard-wired to the +5V supply to keep the board "awake" permanently. (I offset the DRV8880 strictly for space requirements so it appears that the pins are off registration.) I am supplying the 5V logic supply using a Power Trends PT5101 switching regulator that I had surplus from an old CNC stepper driver. This supplies enough current that I'll connect it to a bus under the upcoming layout to supply the 5V for the main DCC++ Arduino board.
The actual purpose of this post is to confirm that the Pololu DRV8880 board's current scaling does work well. In my simple Arduino sketch, I keep the current at 25% while the turntable is stationary, and immediately before moving set it to 100%, returning to 25% immediately after the movement is complete. Not an earth-shaking development for sure, but a power and heat savings given that the turntable will spend most of its life standing still.
For what it's worth, here my code
//Prague_TT //Code to turn Prague turntable half a turn with momentary switch actuation #include <AccelStepper.h> #include <MultiStepper.h> const int EN=2; const int M1=3; const int M0=4; const int T1=5; const int T0=6; const int STEP=8; const int DIR=9; const long int target=2000; //steps per half rotation with 5:1 geardown int Stepping= false; //is the TT in motion? AccelStepper stepper(1,STEP,DIR); //define the stepper and the pins it will use void setup(){ pinMode(EN, OUTPUT); //output enable pin pinMode(M1, OUTPUT); //step mode high bit pinMode(M0, OUTPUT); //step mode low bit pinMode(T1, OUTPUT); //current set high bit pinMode(T0, OUTPUT); //current set low bit pinMode(STEP, OUTPUT); pinMode(DIR, OUTPUT); pinMode(10, INPUT_PULLUP); //trigger digitalWrite(EN,HIGH); // enable outputs digitalWrite(M1,HIGH); //put in 1/4-step mode digitalWrite(M0,HIGH); digitalWrite(T1,HIGH); //put in quarter-current mode digitalWrite(T0,HIGH); stepper.setMaxSpeed(9); stepper.setAcceleration(1); stepper.setCurrentPosition(0); } void loop() { if (digitalRead(10) == LOW && Stepping == false) { Stepping = true; } if (Stepping == true) { digitalWrite(T0,LOW); //put into full-current mode digitalWrite(T1,LOW); stepper.moveTo(-target); //CCW since negative stepper.runToPosition(); //turn half a turn stepper.setCurrentPosition(0); //zero the position for next time digitalWrite(T1,HIGH); //put back into quarter-current mode digitalWrite(T0,HIGH); Stepping=false; } }
Randy