Show Posts
Pages: [1] 2 3 ... 241
1  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 26, 2014, 05:22:36 pm
Yes of course it is going to work but it is not good for the arduino. Once you put a load on the servo the arduino is dead.
2  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 26, 2014, 04:05:37 pm
I don't know what else to tell you. The circuit looks good (other than the 9V battery) and the code should work. Maybe you just have a bad servo.
3  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 26, 2014, 01:05:12 pm
The code says it should be on pin 9, but your picture shows its on pin 3.  smiley-wink Hmmm.

4  Using Arduino / Programming Questions / Re: 104 nano seconds on: August 26, 2014, 10:18:39 am
You have milliseconds and microseconds.

The arduino only has a 16Mhz crystal which is not nearly fast enough to do anything in nanoseconds.

What do you want to do in 104 nanoseconds?
5  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 25, 2014, 05:19:57 pm
Well you still haven't posted the code you're using.
6  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 25, 2014, 04:25:58 pm
1017 is a value based on a range of 0 - 1023 or ~0 - 5V.
To see the voltage from the pin, you need to multiply the value you get from the analogRead() by 0.00488759.

Code:
float V = float(analogRead(A0));

float V_final = V * 0.00488759;

Serial.println( V_final );

If you feed 5.7V into the analog pin, you will fry the Arduino Use a voltmeter!

7  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 25, 2014, 12:52:53 pm
I have those exact servos, and though they are rate for 4.8 - 6.0V, they don't do so good at 5.0V. I am running them at 5.7V using a 7805 and a diode. Look at this for schematic LINK
8  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 25, 2014, 10:47:06 am
That battery is probably not supping enough current. If you had 2 in parallel, it might work or you can just power the servo with 4xAA batteries without the regulator.

It could also be an issue with the code too, please post it.
9  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 25, 2014, 09:10:12 am
Here is another one that can be useful. I edited my current code a bit.

Single Joystick  (minor edit to flip conditions)
Code:
#define swap(type, A, B) {type T = A; A = B; B = T;}

const byte LMF = 3;// PWM Left motor forward pin
const byte LMR = 5;// PWM Left motor Reverse pin
const byte RMF = 11;// PWM Right motor forward pin
const byte RMR = 6;// PWM Right motor reverse pin

void setup()
{
  //Serial.begin(115200);
  pinMode(LMF, OUTPUT);                               
  pinMode(RMF, OUTPUT);
  pinMode(LMR, OUTPUT);                               
  pinMode(RMR, OUTPUT);
}

void loop()
{
  move(analogRead(A0), analogRead(A1), 5, 5, false, false);
}

void move(int FR, int T, int FRdead, int Tdead, boolean FRflip, boolean Tflip)
{
  int DRV1,DRV2,STRL,STRR;
 
  if(FRflip) // if the joystick is upside-down, user can flip it
    FR = 1023 - FR; // FR -= 1023 will not work

  if(Tflip) //if the joystick is left instead of right, user can flip it
    T = 1023 - T;

  if(T > (511 + Tdead))      // T > 511
    STRL = (511 - T)/2;      // ((511 + Tdead) - T)/2;
  else if(T < (511 - Tdead)) // ...
    STRR = (T - 511)/2;      // ...

  if(FR > (511 + FRdead))
    DRV1 = (511 - FR)/2;
  else if(FR < (511 - FRdead))
    DRV2 = (FR - 511)/2;

  if(FR > (511 + FRdead))//forwards               
  {
    //Serial.println("Forward with turning");
    analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255)); // Get the difference of forward and turning, make sure not to overflow.
    analogWrite(RMF, constrain(abs(DRV1 - STRR),0,255));   
    digitalWrite(LMR, LOW); // can be cut out if motor wires are pulled low
    digitalWrite(RMR, LOW); // can be cut out if motor wires are pulled low
  }
  else if(FR < (511 - FRdead))//backwards               
  {
    //Serial.println("Reverse with turning");
    digitalWrite(LMF, LOW);// can be cut out if motor wires are pulled low
    digitalWrite(RMF, LOW);// can be cut out if motor wires are pulled low   
    analogWrite(LMR, constrain(abs(DRV2 - STRL),0,255));
    analogWrite(RMR, constrain(abs(DRV2 - STRR),0,255));   
  }
  else if((FR < (511 + FRdead) && FR > (511 - FRdead)) && T > (511 + Tdead))//Right               
  {
    //Serial.println("360 left");
    digitalWrite(LMR, LOW);
    analogWrite(RMR, STRR);   
    analogWrite(LMF, STRR);
    digitalWrite(RMF, LOW);
  }
  else if((FR < (511 + FRdead) && FR > (511 - FRdead)) && T < (511 - Tdead))//Left             
  {
    //Serial.println("360 right");
    analogWrite(LMR, STRL);
    digitalWrite(RMR, LOW);   
    digitalWrite(LMF, LOW);
    analogWrite(RMF, STRL);   
  }

  else //full stop
  {
    digitalWrite(LMF, LOW);
    digitalWrite(RMF, LOW);       
    digitalWrite(LMR, LOW);
    digitalWrite(RMR, LOW);   
  }
}

Keep in mind, speed increments may be choppy.
10  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 25, 2014, 07:47:46 am
@Cr0sh

Yes the concept is correct in the link you provided, but if you look closely, that code only make the motors spin in one direction. Unless your using a driver that can change direction based off of (1 = forward, 0 = reverse) + speed, then that code wont work.
11  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 24, 2014, 09:33:20 pm
1) http://forum.arduino.cc/index.php?topic=247370.0
2) http://forum.arduino.cc/index.php?topic=211614.0
3) http://forum.arduino.cc/index.php?topic=161927.0

Just did a quick search for Skid Steering and just picked three of the ones I helped with.
Try doing a search for Differential Steering, you will find many more.
12  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 24, 2014, 06:29:21 pm
Differential steering with a single joystick is extremely simple, and there are countless examples on the forum that show just that.

I myself have a working code that I use on my RC truck, that I modified to work with a Wii classic controller and PS2 controller, both duel and single stick.
13  Development / Other Software Development / Re: New peek function for HardwareSerial on: August 24, 2014, 10:50:49 am
If your reffering to the post where PaulS was taking about the delay I put in the code and proper delimiters, the new code doesn't need any of them. The peek function that I modified looks at everything in the Rx buffer. The buffer is never actually cleared like I thought it was, instead the tail value is decremented with each call of read() giving the appearance of it being cleared. All in all the buffer just rolls over once it collects more than 64 bytes.
14  Using Arduino / Programming Questions / Re: Problem with SoftwareSerial on: August 24, 2014, 10:36:34 am
So choose two pins other than one that are already set a UART ports. Most common are pins 2 and 3
15  Development / Other Software Development / Re: New peek function for HardwareSerial on: August 24, 2014, 01:16:59 am
Yea... it didn't quite work like expected. making the head = tail (or vs) only makes Serial.available = false. I was looking for a better way to clean out the buffer without using a while/for loop. The peek function I added, worked like a charm, so I was happy with that.

Pages: [1] 2 3 ... 241