Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / Project Guidance / Weight Guidance... help. on: February 02, 2013, 07:20:24 pm
So I purchased the following motors and wheel caster (links below).
and planning to use a lightweight sheet of wood for chassis.

How can I know whats the appropriate weight the motors can hold/run, like will they be able to hold a 7 pound laptop? What is the range of weight they can hold? how do I calculate it. Thank you

Motor Ratings (at 7.2 VDC):
No-load Current: 0.27 A @ 310 RPM
Stall Current: 4.8 A
Max Torque: 4.6 lb-inch (5.3 kg-cm)

Does it mean I can't go over 4.6lb?

http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/587/Default.aspx?txtSearch=motor+wheel+kit
http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/527/Default.aspx?txtSearch=ball+caster
32  Using Arduino / Project Guidance / Driving a robot... help please. on: February 01, 2013, 06:44:08 pm
So, my code is supposed to do some calculations and it saves the value into "turn" and if "turn" is a certain value I want the robot to drive in a certain direction. But the code is not working, not sure why, this is what happens: When the value is 128, it drives forward but when the value changes it keeps going forward when in reality its supposed to stop going forward and go right or left. But, if I reset it and the value is for example 135 from the beginning and it turns right the appropriate direction but it stays turning there even if the value changes to 120 and in reality 120 is left, it keeps going right till I reset it. Whats am i doing wrong?


Code:

void loop(){
I do some calculations and it saves into value "turn".

 if ( turn == 128 ){
  drive_forward();  
  analogWrite(PWMR, 200);// speed control
  analogWrite(PWML, 200);// speed control
  }

  if ( 132 > turn > 129 ){
  drive_Left();
  analogWrite(PWMR, 100);// speed control
}
  if ( 175 > turn > 132 ){
  drive_Left();
  analogWrite(PWMR, 150);// speed control
}
  if ( turn > 175 ){
  drive_Left();
  analogWrite(PWMR, 200);
}
   if ( 127 > turn > 120 ){
   drive_right();
  analogWrite(PWML, 100);// speed control
}
  if ( 120 > turn > 100 ){
  drive_right();
  analogWrite(PWML, 150);// speed control
}
  if ( 100 > turn ){
  drive_right();
  analogWrite(PWML, 200);// speed control
}
 
}

void drive_forward()
     {
  digitalWrite(RFWD,HIGH);// right wheel foward h-bridge
  digitalWrite(RRVS,LOW);
  digitalWrite(LFWD,HIGH);//left wheel foward h-bridge
  digitalWrite(LRVS,LOW);
  return;
     }
    
void drive_Left()
     {
  digitalWrite(RFWD,HIGH);// right wheel foward h-bridge
  digitalWrite(RRVS,LOW);
  digitalWrite(LFWD,LOW);//left wheel foward h-bridge
  digitalWrite(LRVS,LOW);
  return;
     }
    
void drive_right()
     {
  digitalWrite(RFWD,LOW);// right wheel foward h-bridge
  digitalWrite(RRVS,LOW);
  digitalWrite(LFWD,HIGH);//left wheel foward h-bridge
  digitalWrite(LRVS,LOW);
  return;
     }
    
void drive_stop()
     {
  digitalWrite(RFWD,LOW);// right wheel foward h-bridge
  digitalWrite(RRVS,LOW);
  digitalWrite(LFWD,LOW);//left wheel foward h-bridge
  digitalWrite(LRVS,LOW);
  return;
     }

33  Using Arduino / Motors, Mechanics, and Power / Re: Simple Motor Help... on: January 08, 2013, 08:46:21 pm
http://www.pololu.com/catalog/product/1213 looks promising - 5A peak, 2.5A continuous, dual H-bridge

I looked at those first but I thought D1 and D2 disable inputs and other stuff looked a little complicated(status flag and slew), I was looking for a straight forward motor driver.
34  Using Arduino / Motors, Mechanics, and Power / Simple Motor Help... on: January 08, 2013, 08:31:59 pm
http://www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/List/0/SortField/4/ProductID/587/Default.aspx?txtSearch=ball+caster

Motor Ratings (at 7.2 VDC):
No-load Current: 0.27 A @ 310 RPM
Stall Current: 4.8 A
Max Torque: 4.6 lb-inch (5.3 kg-cm)

I'm searching for a simple dual H-Bridge motor driver that would work perfectly with these motors, I've been searching for a week and couldn't find any to be simple and fit the 4.8A stall. I usually use the SN7****, but can't here.

Can anyone throw a suggestion or advice?
35  Using Arduino / Project Guidance / Re: Xbee With Ping)) Sensor on: January 04, 2013, 08:40:22 pm
The xbee gives you a serial stream over a wireless link. I don't see how you can drive a ping sensor from that without something sitting between the xbee and the ping sensor to receive from the serial stream and drive an I/O pin. There are plenty of wireless alternatives to xbee but it's impossible to know which ones might meet your need without knowing more about the distance you're trying to cover and what sort of environment you're in.
The ping sensor works off a high low combination, when the ping is powered to 5v its at high and then the xbee can somehow bring it low, by sending 0's?

its not much of a distance like 10 feet and its both indoors outdoors, doesn't matter.
36  Using Arduino / Project Guidance / Xbee With Ping)) Sensor on: January 02, 2013, 10:18:34 pm
Hello,

So I'm at the final phase of my project but stuck!

I'm trying to wirelessly make a ping)) sensor ping using an xbee(without another microcontroller).

So basically on one side I have an Arduino and xbee and on the other side I have an xbee and a Ping)) sensor.
Arduino->xbee->xbee->Ping)) sensor

What is the simplest way to wirelessly make the ping sensor ping(I dont care about receiving, I just need it to ping)?

Any advice, code or hardware?

http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
37  Using Arduino / Programming Questions / Re: PWM code help, Mapping on: December 29, 2012, 10:37:55 pm
Sure,

I don't understand the ==128 case.  What are you trying to do if turn is 128?  I thought that was the stop case.

Also, what are PWMA and B?  Do these pins drive motors?  What motors?

EXAMPLE:
(Thinking of an X-Y plane)The 128 is proportional to angle 90 degrees and signals to drive forward, and anything from 129 to 250 is 90 degress to 0 degrees and signals drive right, and 0 to 127 is 90 degrees to 180 degrees and signals drive left.

PWMA and PWMB is PWM to motor driver so I can make the motors drive proportional to the "turn" value:
http://www.pololu.com/catalog/product/1213
and motors:
http://www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/List/0/SortField/4/ProductID/587/Default.aspx?txtSearch=ball+caster

or do you recommend just driving the motors without PWM?
38  Using Arduino / Programming Questions / Re: PWM code help, Mapping on: December 29, 2012, 10:10:08 pm
Thanks for the info, so I incorporated what you have into mine.

Is this correct?

The whole goal of this is I'm trying to make the robot drive slow when it's close then become fast when it's far away(aka 0 and 250) prpotional to the distance and PWM.

Code:
 
if ( turn == 128 ){
  drive_forward(); 
  analogWrite(PWMA, 250);// speed control
  analogWrite(PWMB, 250);// speed control
  }
if (turn <= 127){
speed=map(turn,0,127,255,0);
drive_right();
analogWrite(PWMA, speed);
analogWrite(PWMB, speed);
}
if (turn >= 129){
speed=map(turn, 129, 250, 0, 255);
drive_Left();
analogWrite(PWMA, speed);
analogWrite(PWMB, speed);
}
39  Using Arduino / Programming Questions / PWM code help, Mapping on: December 29, 2012, 08:30:59 pm
How do I do this?

So the range of my variable "Turn" is from 0-250.
I have 128 is the (forward, zero point), when it's from 0-127(right), I want it to PWM 127 being slow and increasing to 0(fastest).
When its from 129-250(left), I want it to PWM 129 being slow and increasing to 250(fastest).

drive_forward();
drive_Left();
drive_right();
 
40  Using Arduino / Project Guidance / Re: PING)) Sensors.. Communication Help on: December 28, 2012, 01:06:23 pm
The main goal is, I'm trying to figure out what's the distance(or time) difference of the 2 receivers that are located on the robot, so I can adjust the motors and drive.

So the sender itself is not being controlled by the robot, you're only trying to detect the timing difference between the pings being received by two receivers?

Perhaps just knowing which receiver was triggered first would be enough and you may not need to know the precise timing difference between the two receivers. In that case I guess your best bet would be to try to get the receivers to trigger a pin change interrupt, and in each ISR register which receiver was triggered and what time it was triggered at. The time value would enable you to ignore subsequent signals from the 'other' receiver which would presumably be caused by the same incoming ping. I don't know how reliable this would be and you may need to be smarter about how you treat the inputs from the two receivers (for example you might require both receivers to have detected the signal before you pay any attention to which one was first) but that would take more effort - I'd try the simplest approaches first.

I have 3 ping)) sensors... I detached the transmitter from 2, making them receivers. And detached the receiver from one making it a transmitter. So I have 2 receivers on the robot and I'm holding a transmitter I signal a ping to the transmitter and the receivers "think" they also sent out a ping, but in reality it's the transmitters. Then both receivers will wait for the echo, Im trying to configure it so both receivers receive something, that way I can calculate in what direction the transmitter is in.

For example: Ping request sent
receiver 1 10 inches
receiver 2 15 inches
now I know the transmitter is to the right and i can adjust the motors.

But the problem I'm facing is with my code shown earlier in the first post, I'm only getting one reading of receiver 1 and nothing for receiver 2 (and I think its because receiver 1 is getting called up first, because when I interchange and make receiver 2 read first it works and receiver 1 doesnt)
41  Using Arduino / Project Guidance / Re: PING)) Sensors.. Communication Help on: December 28, 2012, 11:55:29 am
try this:

(duration1, duration) = pulseIn((pingPin2,pingPin), HIGH);          

It didn't work!

Well of course it didn't work! It was complete nonsense.

I don't understand what you're trying to achieve or how multiple ping sensors helps you achieve it. Are you trying to detect obstacles in multiple directions, or something? If so, the easiest way to read from multiple receivers is to pretend you have one sender and one receiver and do one 'ping' in the usual way, then do exactly the same thing with the sender and the other receiver. This means you will send out a separate ping for each receiver, but I don't see any harm in that.

The alternative is to use a completely different method to get the response from the receiver, which enables you to receive from two inputs simultaneously. That's going to be much harder to do, and is not the approach I'd recommend. But if you have a remote sender and you're trying to use stereo receivers to determine the direction to the source, then you will need to read them both simultaneously to see which one receives the pulse first. In this case the exact timing might not matter (you can't determine range unless you know when the pulse was sent) and all you'd care about was which receiver picked the pulse up first. I suspect you could do that using interrupts and direct port access to grab the state of both inputs with minimal latency, but it's going to need an approach that's very different to the conventional ping range finder.

I'm not an expert at Arduino(how do you do direct port access), can you please help me figure out how to do that? Are you referring to something like this:(code)

The main goal is, I'm trying to figure out what's the distance(or time) difference of the 2 receivers that are located on the robot, so I can adjust the motors and drive.

Code:
pinMode(ultraSoundSignal1, INPUT); // Switch signalpin to input
pinMode(ultraSoundSignal2, INPUT); // Switch signalpin to input
val1 = digitalRead(ultraSoundSignal1); // Append signal value to val
val2 = digitalRead(ultraSoundSignal2); // Append signal value to val

while((val1 == LOW) || (val2 == LOW) ) { // Loop until pin reads a high value
 if (val1 == LOW){
   val1 = digitalRead(ultraSoundSignal1);
   }
 if (val2 == LOW){
   val2 = digitalRead(ultraSoundSignal2);
  }
}

while((val1 == HIGH) || (val2 == HIGH)) { // Loop until pin reads a high value
 if (val1 == HIGH){
   val1 = digitalRead(ultraSoundSignal1);
   timecount1 = timecount1 + 1;
 }
 if (val2 == HIGH){
   val2 = digitalRead(ultraSoundSignal2);
   timecount2 = timecount2 + 1;
 }
}

 
//  val1 = digitalRead(ultraSoundSignal1);
 // val2 = digitalRead(ultraSoundSignal2);
//  timecount1 = timecount1 +1;            // Count echo pulse time
//}


/* Writing out values to the serial port
 * -------------------------------------------------------------------
 */

ultrasoundValue1 = timecount1; // Append echo pulse time to ultrasoundValue
ultrasoundValue2 = timecount2;
//ultrasoundValuee = timecountt; // Append echo pulse time to ultrasoundValue
serialWrite('S'); // Example identifier for the sensor
printInteger(ultrasoundValue2 - ultrasoundValue1);
serialWrite(10);
serialWrite(13);
42  Using Arduino / Project Guidance / Re: PING)) Sensors.. Communication Help on: December 28, 2012, 12:35:42 am
try this:

(duration1, duration) = pulseIn((pingPin2,pingPin), HIGH);         

It didn't work!
43  Using Arduino / Project Guidance / Re: PING)) Sensors.. Communication Help on: December 28, 2012, 12:33:56 am
I don't think there is an actual way, because all motors/servos are not the same. Unless you code it yourself with set ranges (between 5 - 12 inches, turn this much) that's what I did for my robot.

Did you do a similar project?... But how will it know how much to turn, for example if its 5 inches or 50 inches?

And, I did not figure out how to use both sensors at once, going back to my first question, it didnt work, it only shows me one sensor!
44  Using Arduino / Project Guidance / Re: PING)) Sensors.. Communication Help on: December 27, 2012, 08:14:50 pm
please use code tags.

Quote
So I figured it out, I did it like this:....... But now I'm trying to figure out how I can run a motor when the transmitter is in a certain direction, does anyone know a certain calculation that will allow me to dictate what the direction the transmitter is, so it can drive to it?
For that, you can try which ever signal is the closest.

The main problem is that the pings)) signal is very narrow, so the receivers have to be close.

So what do you mean? how would it know which one is closer? for an example, receiver 1 is at 12 inch and receiver 2 is at 20 inch.. How would I know how far the robot has to drive or turn?
45  Using Arduino / Project Guidance / PING)) Sensors.. Communication Help on: December 27, 2012, 07:18:53 pm
So I have 3 Ping)) sensors... I have 2 set up as receivers and 1 as a transmitter. I'm trying to get the distance(inches) for both of them on the serial monitor, but I keep receiving only 1 of the distances and not the other, but when I turn off one of them the other works. The problem seems to be when I need to read the signal from the PINGS))) it only reads one, what am I doing wrong?

Here is my code:

Code:
const int pingPin = 7;
const int pingPin1= 4;
const int pingPin2=2;

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
}

void loop()
{
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long duration, duration1, inches1, inches;
 
  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(pingPin, OUTPUT);
  pinMode(pingPin1, OUTPUT);
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin, LOW);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  pinMode(pingPin2, INPUT);
  duration1 = pulseIn(pingPin2, HIGH);          //THE PROBLEM SEEMS TO BE HERE
  duration = pulseIn(pingPin, HIGH);             //THE PROBLEM SEEMS TO BE HERE
 
  // convert the time into a distance
  inches = microsecondsToInches(duration);
  delay(50);
  inches1 = microsecondsToInches(duration1);
  delay(50);
 
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(inches1);
  Serial.print("in2, ");
  Serial.println();
 
  delay(100);
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}


Moderator edit: [code] [/code] tags added.
Pages: 1 2 [3] 4