Recent Posts

Pages: [1] 2 3 ... 10
1
Español / Re: [Presentación y problema] ...
Last post by katsu31 - Today at 06:43 pm
hola EB3DJC hay algo que no he mencionado, no me asigna el puerto com, al conectar mi arduino por usb (osea al recibir corriente empieza a parpadear)pero lo que mas me duele es que windows al instalar los drivers me tira el error code 10 this device cannot start
2
Hi everyone,

I'm currently building a quadcopter and making my own flight controller using Arduino.  I'm using the Servo library to control my ESCs, and I'm writing an Android app to communicate over bluetooth.  I'm having two problems, both related to the ESC signal:

1) I calibrated my ESCs to respond to 800ms-2000ms pulses.  This works, however they really don't engage until about 850ms.  I tried making the lower bound 850, but then they wouldn't respond until about 900ms...Is there an obvious reason for this?  Up until now, I have just been dealing with it and ignoring signal changes below 850ms.

2) I'm getting very choppy throttle transitions in my motors.  I've set up my Android app with a SeekBar which sends out values 0 - 1000.  These are mapped to 800 - 2000 in the Arduino code.  Whenever I send a constant signal (e.g. 1000) the motors run at that speed without any problem.  However, when I send a series of throttle changes (sliding the bar on the Android app up or down), the motors frequently get bursts or surges of speed.  For example, say I was sending the following series of signals : 850, 851, 852, 853, 854, 855, etc....  The motor would increase in speed as it should, and then all of a sudden sound like it went up to 900 for a split second and then get back on track.  If I leave it on any speed though, it runs fine without any surges.

Is it maybe changing the pulse width too quickly?  Is it possible that the ESCs are losing track of the phase?  The input values received through the bluetooth are all correct and don't have any jumps in between them, so I don't think the problem is there.  I've also tried mapping the input to 850 - 1000 to target a smaller range and moved the bar very slowly, but these surges still occur...

This is the Arduino code I'm using:

Code: [Select]

#include <Servo.h>
#include <SoftwareSerial.h>

Servo m1, m2, m3, m4;


int bluetoothTx = 2;
int bluetoothRx = 3;
int val = 800;
int pos = 800;
String message = "";

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  //Setup usb serial connection to computer
  Serial.begin(9600);
 
  //Setup Bluetooth serial connection to android
  bluetooth.begin(115200);
  bluetooth.print("$$$");
  delay(100);
  bluetooth.println("U,9600,N");
  bluetooth.begin(9600);
 
  m1.attach(6);
  m2.attach(9);
  m3.attach(10);
  m4.attach(11);
}


void loop()
{
   m1.writeMicroseconds(pos);
   m2.writeMicroseconds(pos);
   m3.writeMicroseconds(pos);
   m4.writeMicroseconds(pos);

  //Read from bluetooth and write to usb serial
  if(bluetooth.available())
  {
    // Reading one byte in at a time until reaching newline
    char byteIn = (char)bluetooth.read();
   
    if (byteIn != '\n')
    {
      message += byteIn;
    }
    else
    {
      val = atoi(message.c_str());
      val = map(val, 0, 1000, 850, 2000);
     
      if (val > 850 && val < 2000)
          pos = val;
     
      Serial.println(pos);
      message = "";
    }
  }
 
}


Additional information about my hardware:

Arduino Pro Mini board
Sparkfun BlueSmirf Gold bluetooth module
12A ESCs
2300KV motors
1300mAh 3S Battery

Thanks for any help!

Ryan
3
And that, children, is one reason why using i as a variable name is not a good idea.
+5

I normally use 'n' in FOR loops

..R
4
Programming Questions / Re: Data over bluetooth
Last post by PaulS - Today at 06:42 pm
Quote
Here is my problem. I really don't get it, how to process data in arduino.
An example of what you are sending would be useful.

The Serial.read() function reads one digit of the string, if that is indeed what you are sending.

Casting the int that Serial.read() returns to an int is pointless. Expecting Serial.read() to do what Serial.parseInt() does is equally pointless.
5
If you are new to the Arduino (and even if you are not) I would advise getting the functional code (i.e. the servo stuff) to work first using the Serial Monitor for output and then add the LCD stuff later.

I would also separate the LCD code into its own function so that the servo code and the LCD code can both be tested separately.

...R
6
Hardware / Re: Comunicación entre Arduino...
Last post by mike_117 - Today at 06:41 pm
Por favor Lee las reglas del foro. Ya publicaste el topic en el área de Software. Solo se paciente y espera a que alguien responda, si puedes elimina este topic para evitar crear confusión.
8
Microcontrollers / Re: [Help needed] compiling an...
Last post by DrAzzy - Today at 06:39 pm
You should not have to build your own bootloader to make the board work - just use the one that's included with the IDE.

Why do you suspect that you need to change the bootloader on the board to make an ethernet shield work?
9
Software / Re: Comunicación entre arduino...
Last post by mike_117 - Today at 06:39 pm
Wooow ponerle más pines al mega No te son suficientes los casi 80 pines que trae entre digitales, analógicos y pwm? Jajaja no lo tomes a mal es solo una broma (Aunque si me sorprende).

Pues lo que podrias hacer es apoyarte en el C.I 74HC595N que no es más que un registro de desplazamiento de entrada serie y salida paralelo. Lo que se hace es usar 3 pines (1 para la salida serie de datos, 1 para señal de reloj, 1 para habilitar entrada de datos) para comandar 8 salidas por cada integrado 595. Es decir, tendremos 8 salidas con 1 integrado y 16 si usamos 2 integrados, pero en ambos casos necesitamos sólo 3 pines de Arduino. Puedes buscar más info. en internet sobre eso y la función shiftOut.
10
inspired by CosmicGold - what about using bitmasks?

Code: [Select]
int inMenu(int men, int p)
{
  p = (1 << p);
  switch(men)
  {
    case 7: return p & 0xFC;
    case 8: return p & 0x0C;
    case 9: return p & 0x04;
    case 10: return p & 0xFC;
    case 11: return p & 0x9C;
  }
  return 0;
}
Pages: [1] 2 3 ... 10