Go Down

Topic: Setting the start position for motors connected to a relay board. (Read 306 times) previous topic - next topic

mukundsanthshosh

I am currently working on a project where I am using the Arduino mega to control the dc motors on the OWI-535 robotic arm. the motors are connected to the Arduino through relays. there are 5 motors(10 inputs, 2 for each motor). I can't seem to figure out how to set the starting position for the arm such that every time I press the reset button on the board it goes back to that position. I made attempts at trying to set a starting position but the motors keep moving without stopping. Any help on this matter will be much appreciated I would be grateful if someone could post example code to help me get started.   

vinceherman

Quote
I would be grateful if someone could post example code to help me get started.
OR, you could post your code and we can help you work through the issues.

Help us out with the hardware.  What position sensors do you have?  When you say 'dc motors' that does not necessarily mean there are position sensors.

mukundsanthshosh

Code: [Select]

// M1 TO M5 POSITIVE 3-7 M1-M5 8-12 NEGATIVE
   



const int in12 = 12;
const int in11 =11;
const int in10 = 10;
const int in9 = 9;
const int in8 = 8;
const int in7 = 7;
const int in6 = 6;
const int in5 = 5;
const int in4 = 4;
const int in3 = 3;

void setup() {
  pinMode (in12, OUTPUT);
  pinMode (in11, OUTPUT);
  pinMode (in10, OUTPUT);
  pinMode (in9, OUTPUT);
pinMode (in8, OUTPUT);
pinMode (in7, OUTPUT);
pinMode (in6, OUTPUT);
pinMode (in5, OUTPUT);
pinMode (in4, OUTPUT);
pinMode (in3, OUTPUT);

digitalWrite(in10, LOW);
digitalWrite(in5, HIGH);
      delay(500);
}

void loop() {
     
}


This is the code that I've got. I know it seems like I haven't done much but I tried my best. I'm new to Arduino.

Also the motors don't have position sensors.

vinceherman

Without positional awareness, you will have little luck trying to move to a known position.

Your OWI-535 arm was designed with human control in mind.  5 forward/reverse switches.  This relies on the human knowing when to stop, because the human has visual and audio sensors that can detect physical location and differentiate the motor sound between free-running and binding.

How will your arduino know when to stop?

Edit: Here is an instructible that shows how to add positional awareness.

Go Up