Pages: [1]   Go Down
Author Topic: Arduino + Motor Shield. Old guy needs help.  (Read 886 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is going to seem quite easy for all you brilliant people out there, but I'm stuck and I really need your help.

Here is what I want to do;
Control the motor on my camera slide so I can make the camera smoothly move faster or slower and there is obviously the need to do the same thing in reverse. I'd love to have a switch for putting the motor in reverse and a knob to change the speed.

The things I have is; An Arduino Uno, an Arduino Motor Shield and a motor. ( and a bunch of various potentiometers, diodes, resistors ETC )

This is the motor:
http://www.conrad.se/V%c4XELMOTOR-TYP-540-148:1-4%2e5-15V.htm?websale7=conrad-swe&pi=222366&ci=SHOP_AREA_19781_1210060

I want to run it on 9V.

If you know how to go about this, please let me know.
All help is much appreciated.
Logged

Ontario
Offline Offline
God Member
*****
Karma: 24
Posts: 862
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a mechanical design in mind?  How will the motor actuate the slide?  Are you thinking of using a cable system, a threaded rod or maybe having the motor directly drive the slider trolley on rubber wheels?
What sort of range of motion are you thinking of?  Do you want to build a 3m slide or a 50cm one?
What sort of rail or track system are you thinking of?
Logged

South Louisiana
Offline Offline
Full Member
***
Karma: 0
Posts: 178
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which motor shield you have?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which motor shield you have?

The Arduino Motor Shield R3.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a mechanical design in mind?  How will the motor actuate the slide?  Are you thinking of using a cable system, a threaded rod or maybe having the motor directly drive the slider trolley on rubber wheels?
What sort of range of motion are you thinking of?  Do you want to build a 3m slide or a 50cm one?
What sort of rail or track system are you thinking of?

This is the design, obviously it,s not mine, but its very very similar. Identical really:


The Igus 120cm rail, the stands, wire and all of that is already built and working just fine. The thing that I'm stuck on is how to interactively control the speed and direction of the motor in the best fashion possible.
Do you have any ideas on how to do that?

Thanks for replying. I appreciate it.
Logged

South Louisiana
Offline Offline
Full Member
***
Karma: 0
Posts: 178
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To the point of speed, this would be one, of many possible, ways to do it.

In this (untested) code your pot being in the center would stop motion. Go left and the motor goes one direction. Go right and the motor goes the other direction. The more you come from the center position the faster the motor will go.

Code:
// 10 bit input ranges 0 to 1023
// 8 bit output ranges 0 to 255
potVal = analogRead(potPin); // read the value from the potentiometer into potVal

if ( potVal > 520) {               // if pot is turned to the right
  motor.setSpeed(map(potVal, 520, 1023, 0, 255));  // make the speed proportional to the amount of turn on the pot
  motor.run(FORWARD); // set motor to move "forward"
}

else if (potVal < 504) {                // if pot is turned to the left
  motor.setSpeed(map(potVal, 0, 504, 0, 255));  // make the speed proportional to the amount of turn of the pot
  motor.run(BACKWARD);  // set motor to move "backward"
}

else {  // pot value must be between 504 and 520 which is our deadband
  motor.run(RELEASE); // stop motor
}
« Last Edit: October 13, 2012, 03:41:16 pm by Goofballtech » Logged

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 32
Posts: 1867
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, Hmmm lets see if I'm qualified to try to answer this:
- Made motors run under computer control for > 30 years
- > 70 years old
 smiley

- The code example looks basically good. (@GoofBallTech: Exactly what library are you using?? ) The OP will need to understand this.
- Is your motor already physically coupled to the lines that move the slide? 

The motor specs (Approximate translation of Svedish):
---------------------( COPY )--------------------------

- Engine with 6 V / DC - Nominal voltage: Idle: Speed ​​7500 rev / min, current 0.45 A
- At max power: Speed ​​6180 rev / min, current 2.1 A, 1.182 Ncm torque, 7.49 W
** And after the gear reduction **
- Idle speed (4.5 V)   40 rpm
- Idle speed (12 V)   106 rpm
-----------------( END COPY )----------------------

So... if the mechanical load is quite low, and using a nominal supply voltage of 9 to 12 V, you seem to have a reasonable range of speeds.

Other Question ( I assume you intend to shoot a series of images as the point of view of the camera changes):

- How will you control the camera?
- How closely do you want to synchronize the camera position and the exposures?

So: I would suggest you also be thinking of having a encoder of some kind (maybe just a disc on the motor shaft with drilled holes and LED/Phototransistor) to know the camera position more accurately.

If you are trying to do stuff like http://timescapes.org you will need some position feedback.  And then battery power to take it all out in the desert  smiley  So 12V sounds like a nice power supply to pick. 

Tell us more as you get this "moving"..

Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

South Louisiana
Offline Offline
Full Member
***
Karma: 0
Posts: 178
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@GoofBallTech: Exactly what library are you using?? )

I just googled the motor shield he was using and saw an entry on adafruit. It brought me here so i used that as the example code.

http://www.ladyada.net/make/mshield/use.html
Logged

Pages: [1]   Go Up
Jump to: