Show Posts
Pages: [1] 2 3
1  Using Arduino / Networking, Protocols, and Devices / Re: Xbee with arduino pro mini 5v on: May 17, 2012, 09:41:08 am
I know i can use a Voltage Regulator - 3.3V to power the xbee, what i don´t know is if i can use normaly the pin comunucation RX/TX directly?
2  Using Arduino / Networking, Protocols, and Devices / Xbee with arduino pro mini 5v on: May 17, 2012, 02:15:33 am
Hi,

I have one xbee Serie 2 to connect in one arduino pro mini 5v, for this i have one Breakout Board for XBee Module:
http://www.hobbytronics.co.uk/xbee-breakout?keyword=BOB-08276

My problem is the 5V, i know the xbee only accept 3.3V, can i use a voltage regulator between 5v in arduino to vcc in my xbee?can i have problems with RX/TX Pins?

Thansk,
3  Using Arduino / General Electronics / Re: Voltage divider for lipo on: May 13, 2012, 01:47:33 pm
And for possible noise from the esc the best to do is to put one capacitor between analog input and Gnd?what is the diference between resistance like R1=10k and R2=1K with R1=27k and r2=2.7k with same ratio?

thanks,
4  Using Arduino / General Electronics / Voltage divider for lipo on: May 13, 2012, 01:28:24 am
Hi,

I went to read the voltage value of my 2s lipo 7.4V in my arduino, i thinking do this with one voltage divider but don´t know if i use lower resistance like 1Kohm and 10Kohm or resistance with highter values.

I use the lipo to powering the arduino and an Esc from an RC car.

What do you think?
5  Using Arduino / Project Guidance / Re: Trying get RPM Value with IR LED on: May 08, 2012, 09:45:18 am
ok is good but without Cap, with the cap in High speed the QDR don´t detect the blank mark, i don´t know why.

Just a little question, im learning C with Arduino and don´t understand the syntax of this line:
Code:
  int rpm = (copyTime != 0) ? 60000/copyTime : 0;

is an equal with conditions?for what is the "?"
 
6  Using Arduino / Project Guidance / Re: Trying get RPM Value with IR LED on: May 08, 2012, 08:05:35 am
Sorry but what is the functions enable() and disable()? you call the function but don´t appear on your code
7  Using Arduino / Project Guidance / Re: Trying get RPM Value with IR LED on: May 08, 2012, 05:39:46 am
I think have found the solution:
I use the 4.7Kohm resistor and 220ohm, is the best value i have found...
And i make on shunt between pin 2 and A0 to can read the analog value at the same time i use interupt, and i say if i found one interupt, check also the anolog value before count the sample:

Code:
#define PwmPinMotorB 11
#define DirectionPinMotorB 13

unsigned long time[1];
unsigned long timeBetweenRising=0;
int index=0;
int count=0;
int Led=0;
int lastrpm=0;


//---------------------------------------------------------
void setup(){

  Serial.begin(9600);

  pinMode(PwmPinMotorB, OUTPUT);
  pinMode(DirectionPinMotorB, OUTPUT);
  digitalWrite(DirectionPinMotorB, LOW);
  analogWrite(PwmPinMotorB, 255);

  attachInterrupt(0, sample, RISING);

  pinMode(6,OUTPUT);

}

//---------------------------------------------------------
void loop(){




  int rpm=2*60000/(timeBetweenRising);

//If i have a crazy value, replace by last good rpm
if (rpm<0) rpm=lastrpm;
  lastrpm=rpm;
Serial.println(rpm);

delay(500);



}

//---------------------------------------------------------
void sample(){

int valueQDR=analogRead(A0);
if (valueQDR<=600){
    if (Led==0){
      digitalWrite(6,HIGH);
      Led=1;
    }
    else
    {
      digitalWrite(6,LOW);
      Led=0;
    }

    if (count==1){
      index=1;
      time[index]=millis();
      timeBetweenRising=time[1]-time[0]; 
      time[0]=time[1];
    }

    if (count==0){
      time[index]=millis();
      count++;
    }
}

}


now i have good values for high and low speed:

Code:
0
0
1518
1518
1666
1690
1690
1666
1666
1714
1666
1690
1690
1714
1739
1690
1690
1714
1690
1690
1714
1714
1714
1714
1690


Please comment.
8  Using Arduino / Project Guidance / Re: Trying get RPM Value with IR LED on: May 08, 2012, 04:13:01 am
Hi,

Thanks for your reply, i have write a new sketch based on your advice:

Code:
#define PwmPinMotorB 11
#define DirectionPinMotorB 13

unsigned long time[1];
unsigned long timeBetweenRising=0;
int index=0;
int count=0;
int Led=0;



//---------------------------------------------------------
void setup(){

  Serial.begin(9600);

  pinMode(PwmPinMotorB, OUTPUT);
  pinMode(DirectionPinMotorB, OUTPUT);
  digitalWrite(DirectionPinMotorB, LOW);
  analogWrite(PwmPinMotorB, 35);

  attachInterrupt(0, sample, RISING);

  pinMode(6,OUTPUT);

}

//---------------------------------------------------------
void loop(){



  Serial.println(timeBetweenRising);
  double rpm=2.0*60000.0/(timeBetweenRising);
  Serial.println(rpm);

  delay(500);


}

//---------------------------------------------------------
void sample(){



    if (Led==0){
      digitalWrite(6,HIGH);
      Led=1;
    }
    else
    {
      digitalWrite(6,LOW);
      Led=0;
    }

    if (count==1){
      index=1;
      time[index]=millis();
      timeBetweenRising=time[1]-time[0];  
      time[0]=time[1];
    }

    if (count==0){
      time[index]=millis();
      count++;
    }
  

}


I have put one LED to on/off each time the interrupt is On at low speed, i can see the led blink when the QRD pass on blank mark but i think is too sensible because the LED blink inconstant out of blank mark.

i think is because the resistance i use, or can i use on interrupt based in analog Value from QRD?

Edit: If i change the resistor 4.7K for 2.2k i have better results but it´s not enough, in 10 samples i have 2 false:(

if i use the 4.7Kohm in 10 samples i have 5/6 false...
9  Using Arduino / Project Guidance / Trying get RPM Value with IR LED on: May 07, 2012, 12:19:35 pm
Hi,

Im trying to mesure rpm of an motor with arduino and one QRD1114 IR Led.

the QRD1114 connection from Bildr, i use 220ohm and 4.7Kohms:


To making test im using one motor with ardumoto with same speed at 100 using analogWrite. I put one blank mark to make the "pulse".

the first sketch i upload is to count the number of turns during 60s:

Code:
#define PwmPinMotorB 11
#define DirectionPinMotorB 13

unsigned long time1=0;
unsigned long time2=0;
int motorOn=0;
int count=0;


void setup(){

 Serial.begin(9600);
   pinMode(PwmPinMotorB, OUTPUT);
     pinMode(DirectionPinMotorB, OUTPUT);
digitalWrite(DirectionPinMotorB, LOW);
 
}


void loop(){
int valorQRD=analogRead(A0);
Serial.println(valorQRD);
if (valorQRD<100){
  count++;
}

if (motorOn==0){
time1=millis();
analogWrite(PwmPinMotorB, 100);
motorOn=1;
}


 
time2=millis();

if (time2>=time1+60000){
analogWrite(PwmPinMotorB, 0);
Serial.print(count);
Serial.println(" RPM");
motorOn=0;
count=0;
delay(5000);
}

 

 
}

he give me 550 turns during each 60s for pwm 100.

Now i know the rpm for this motor with 100 pwm.

I want to mesure the actual rpm, for this i use the code from Arduino Playground:
http://arduino.cc/playground/Learning/Tachometer

Just little modifications to add the ardumoto:

Code:
int val;
long last=0;
int stat=LOW;
int stat2;
int contar=0;
#define PwmPinMotorB 11
#define DirectionPinMotorB 13
int sens=100;  // this value indicates the limit reading between dark and light,
              // it has to be tested as it may change acording on the
              // distance the leds are placed.
int nPalas=1; // the number of blades of the propeller

int milisegundos=250; // the time it takes each reading
void setup()
{
  pinMode(PwmPinMotorB, OUTPUT);
pinMode(DirectionPinMotorB, OUTPUT);
digitalWrite(DirectionPinMotorB, LOW);
analogWrite(PwmPinMotorB, 100);
  Serial.begin(9600);

}

void loop()
{
  val=analogRead(0);
  if(val<sens)
    stat=LOW;
   else
    stat=HIGH;

                          //indicate the state of the circuit.

   if(stat2!=stat){  //counts when the state change, thats from (dark to light) or
                     //from (light to dark), remmember that IR light is invisible for us.
     contar++;
     stat2=stat;
   }
   if(millis()-last>=milisegundos){
     double rps=((double)contar/nPalas)/2.0*1000.0/milisegundos;
     double rpm=((double)contar/nPalas)/2.0*60000.0/(milisegundos);
     Serial.print((contar/2.0));Serial.print("  RPS ");Serial.print(rps);
     Serial.print(" RPM");Serial.print(rpm);Serial.print("  VAL ");Serial.println(val);
     contar=0;
     last=millis();
   }
}

but it´s not the results i expect:

Code:
2.50  RPS 10.00 RPM600.00  VAL 766
2.00  RPS 8.00 RPM480.00  VAL 805
2.00  RPS 8.00 RPM480.00  VAL 749
2.00  RPS 8.00 RPM480.00  VAL 827
2.50  RPS 10.00 RPM600.00  VAL 40
2.50  RPS 10.00 RPM600.00  VAL 771
2.00  RPS 8.00 RPM480.00  VAL 729
2.00  RPS 8.00 RPM480.00  VAL 807
3.00  RPS 12.00 RPM720.00  VAL 867
2.00  RPS 8.00 RPM480.00  VAL 925
2.00  RPS 8.00 RPM480.00  VAL 765
2.00  RPS 8.00 RPM480.00  VAL 782
3.00  RPS 12.00 RPM720.00  VAL 832
2.00  RPS 8.00 RPM480.00  VAL 924
2.00  RPS 8.00 RPM480.00  VAL 764
2.00  RPS 8.00 RPM480.00  VAL 809
3.00  RPS 12.00 RPM720.00  VAL 799
2.00  RPS 8.00 RPM480.00  VAL 753
2.00  RPS 8.00 RPM480.00  VAL 826
3.00  RPS 12.00 RPM720.00  VAL 855
2.00  RPS 8.00 RPM480.00  VAL 901
2.00  RPS 8.00 RPM480.00  VAL 761
2.00  RPS 8.00 RPM480.00  VAL 810
3.00  RPS 12.00 RPM720.00  VAL 850
2.00  RPS 8.00 RPM480.00  VAL 922
2.00  RPS 8.00 RPM480.00  VAL 751
2.00  RPS 8.00 RPM480.00  VAL 774
3.00  RPS 12.00 RPM720.00  VAL 901
2.00  RPS 8.00 RPM480.00  VAL 794
2.00  RPS 8.00 RPM480.00  VAL 882
3.00  RPS 12.00 RPM720.00  VAL 784
2.00  RPS 8.00 RPM480.00  VAL 745
2.00  RPS 8.00 RPM480.00  VAL 968
2.00  RPS 8.00 RPM480.00  VAL 743
3.00  RPS 12.00 RPM720.00  VAL 840
2.00  RPS 8.00 RPM480.00  VAL 766
2.00  RPS 8.00 RPM480.00  VAL 822
3.00  RPS 12.00 RPM720.00  VAL 758
2.00  RPS 8.00 RPM480.00  VAL 882
2.00  RPS 8.00 RPM480.00  VAL 788
2.50  RPS 10.00 RPM600.00  VAL 50
2.50  RPS 10.00 RPM600.00  VAL 717
2.00  RPS 8.00 RPM480.00  VAL 784
2.00  RPS 8.00 RPM480.00  VAL 854
3.00  RPS 12.00 RPM720.00  VAL 763
2.00  RPS 8.00 RPM480.00  VAL 857
2.00  RPS 8.00 RPM480.00  VAL 904
2.00  RPS 8.00 RPM480.00  VAL 783
3.00  RPS 12.00 RPM720.00  VAL 806
2.00  RPS 8.00 RPM480.00  VAL 779
2.00  RPS 8.00 RPM480.00  VAL 801
3.00  RPS 12.00 RPM720.00  VAL 834
2.00  RPS 8.00 RPM480.00  VAL 767
2.00  RPS 8.00 RPM480.00  VAL 863
2.50  RPS 10.00 RPM600.00  VAL 44
2.50  RPS 10.00 RPM600.00  VAL 885
2.00  RPS 8.00 RPM480.00  VAL 761
2.00  RPS 8.00 RPM480.00  VAL 943
3.00  RPS 12.00 RPM720.00  VAL 857
2.00  RPS 8.00 RPM480.00  VAL 761
2.00  RPS 8.00 RPM480.00  VAL 895
3.00  RPS 12.00 RPM720.00  VAL 827
2.00  RPS 8.00 RPM480.00  VAL 749
2.00  RPS 8.00 RPM480.00  VAL 852
3.00  RPS 12.00 RPM720.00  VAL 400
2.00  RPS 8.00 RPM480.00  VAL 844
2.00  RPS 8.00 RPM480.00  VAL 916
2.00  RPS 8.00 RPM480.00  VAL 766
3.00  RPS 12.00 RPM720.00  VAL 922
2.00  RPS 8.00 RPM480.00  VAL 776
2.00  RPS 8.00 RPM480.00  VAL 941
3.00  RPS 12.00 RPM720.00  VAL 754
2.00  RPS 8.00 RPM480.00  VAL 741
2.00  RPS 8.00 RPM480.00  VAL 958
2.00  RPS 8.00 RPM480.00  VAL 751
3.00  RPS 12.00 RPM720.00  VAL 776

i have constant speed but rpm change a lot, i know the speed is +/-550rpm by results in my first test but from 480 to 720 it´s a huge difference!

Every time val<100 i have a good value=600 (+/- 550), i know is when the blank mark pass by the IR Led.

Any ideas?
10  Using Arduino / Motors, Mechanics, and Power / Re: Control an ESC from Velineon on: April 25, 2012, 12:24:26 pm
Quote
never run a brushless motor like yours at high speed with no load attached

Ok thanks for the advice, i don´t know about this but for the next experience i will put a load in my motor.

i have found the max speed in both direction and the brake also.

I have all values i need:
- arm with a value between 89 to 97 during 2s
- one direction:99 to 138 and the other 87 to 48
- brake but is too bad for the motor, i don´t use them in my project:0 and 254.

i have more two position but i don´t know what it does:88 and 98.

I use the servo library:)

thanks for your help.
11  Using Arduino / Motors, Mechanics, and Power / Re: Control an ESC from Velineon on: April 25, 2012, 11:10:07 am
now i need to make a rpm counter to know the max speed on both direction, i have hall sensores and ir sensores but never work with this, can help?i can use another arduino i have just for this.
12  Using Arduino / Motors, Mechanics, and Power / Re: Control an ESC from Velineon on: April 25, 2012, 09:51:29 am
You can arm the ESC sending on PWM of this range 89 to 97 during 2s, now im searching for máx speed in both direction and brake:)
13  Using Arduino / Motors, Mechanics, and Power / Re: Control an ESC from Velineon on: April 25, 2012, 09:44:31 am
hi,

i have make some tests and have new improvement with this esc:

- to arm the esc you need to send one pwm value 90 to the esc during 2s (neutral position).

- 99-> the motor start in one direction
- 87-> the motor go to other direction


Green led is one with pwm 89 to 97 but motor don´t run, i think you can set this pwm to arm the ESC
nothing appears with 88 and 98 (motor don t run and led is off, maybe for brake?)
14  Using Arduino / Motors, Mechanics, and Power / Re: Control an ESC from Velineon on: April 25, 2012, 04:01:46 am
hi DuaneB,

i have study your work since last weeks and its a great help for me, you have made a nice work and i want to say thank you to give for other users.

my setup is a traxxas slash 4x4 chassis, original Servo, motor+esc+fan from velineon, two arduino uno, lipo 2s, xbee for comunication between control and rc car, one wiichuck and one BEC 6V.

i have the comunication setup ok, i can control the servo with nunchuck with xbee and now i´m started working with ESC and motor.

i a have the lipo powering the ESC/Motor and i use an adjustable boost regulator from polulu to powering the arduino from lipo (isolate from possible noise of motor).

to connect the ESC i thinking in this wire config:

ESC:
Red/black power->to lipo
3 wire ABC to motor
last 3 wire to control ESC: one to pwm from arduino, the others black and red to output of BEC (6V). im thinkink trying this config today, one your blog you says to put one resistor in pwm line, im thinking put one 330ohm like u.

But i can´t find any documentation to arming this type of ESC.
15  Using Arduino / Motors, Mechanics, and Power / Control an ESC from Velineon on: April 24, 2012, 03:34:16 pm
Hi,

Im trying to put an Esc from Velineon working with arduino, anyone with experience with this?

I can´t find any documentation to arm this ESC.

It´s from an RC car Slash 4x4 from Traxxas.

Thanks,
Pages: [1] 2 3