Hey Folks. First time here.
So I'm making a sculpture, it is set up at the World trade Center of Montreal right now, which is great! But it ... doesn't work and the art director is getting impatient, so I need someone's help.
It's pretty much a pulley system that lifts a jar that slowly pour sands on the floor. I'm using a Nema 23 stepper motor ( bipolar, jk57hs76 2804) and a TB6600 Driver.
On my prototype at home, everything worked (using the 5vdc and the driver that comes with the arduino kit) but when I installed the arduino on the main system, it does not work, or should I say, everything works, but something is interfeering.
I'm having a homing sequence in the Void Setup that pulls the cable down until the limit switch is pressed ( there's an object screwed on the cable that hits the switch at the desired lenght ) which then triggers the Void loop. I'm using the Serial buffer to send HIGH or LOW. The thing is, when I set it up, the pulley pulls the cable, but around 10 to 60 second (it's quite random) the TX on my arduino flashes even tho nothing thouches the switch and the loop begins. I'm seriously losing my mind over this.
Anyway here's my code:
#include <AccelStepper.h>
#define homing 9
AccelStepper stepper(AccelStepper::DRIVER,4,3);
long limit = 850000;
long initial_homing = -1;
void setup()
{
Serial.begin(9600);
pinMode(homing, INPUT_PULLUP);
stepper.setMaxSpeed(3600.0);
stepper.setAcceleration(100.0);
stepper.setSpeed(400);
stepper.runSpeed();
Serial.println(initial_homing);
while (digitalRead(homing)== LOW){
stepper.moveTo(initial_homing);
initial_homing++;
stepper.run();
delay(5);
}
stepper.setCurrentPosition(0);
initial_homing = 1;
while(digitalRead(homing)== HIGH){
stepper.moveTo(initial_homing);
initial_homing--;
stepper.run();
delay(5);
}
stepper.setCurrentPosition(0);
stepper.setMaxSpeed(3600.0);
stepper.setAcceleration(100.0);
stepper.setSpeed(400);
stepper.runSpeed();
Serial.println(initial_homing);
}
void loop()
{
stepper.moveTo(limit);
stepper.runToPosition();
delay(1000);
stepper.moveTo(0);
stepper.runToPosition();
delay(1000);
stepper.run();
}
I'm assuming the issue is either with the code or the wiring, but I want to be sure because I really don't understand what's wrong here.
Thanks folks.