I have been trying to run some tests with the T200 thrusters, with some basic code written in Arduino IDE. Unfortunately, I could run the motors only in one direction (reverse).
Specs: 14.8V 10Ah, 10C LiPo battery; AfroESC with max 30A; T200 thruster
Code: #include <Servo.h>
Servo servo;
static const byte servoPin = 9;
static const int MAX_FWD_REV_THROTTLE = 400; // Value between 0-400
static const int CENTER_THROTTLE = 1500;
void setup() {
servo.attach(servoPin);
servo.writeMicroseconds(CENTER_THROTTLE); // send "stop" signal to ESC.
delay(1000); // delay to allow the ESC to recognize the stopped signal
}
void loop() {
servo.writeMicroseconds(CENTER_THROTTLE-MAX_FWD_REV_THROTTLE); // backwards 1100
delay(5000);
servo.writeMicroseconds(CENTER_THROTTLE+MAX_FWD_REV_THROTTLE); // forward 1900
delay(3000);
}
Basically, the thruster ignores the 1900 microseconds command.
If they are Afro 30A ESCs, then it is possible to flash them with our custom firmware available on our ESC product page. Otherwise, you will need different ESCs.
Could you please be more precise about this process, especially that now you don’t call it Afro ESC anymore. I landed on the Github page and on the Google Code page after following your instructions.
I don’t know exactly which files are to be used and how.
The only bug is due to Arduino, as the code in ArduinoUSBLinker is not compilable for any Arduino board. During the compilation to an Arduino Due board, the “eemprom.h” library is signaled as missing, even though it is existent in the hardware libraries. Moving them in the ones called by the compiler does not solve the issue. Running the code online, on their Cloud will signal other issues…so it is quite a dead end. The Pololu A-Star has other issues as well, but compiling it for Arduino Uno or Duemivalone signals no problems at all. This may become frustrating for Arduino users, as each board has a different behaviour.
Unless you have a better suggestion, I will order an Arduino Uno and try the setup for reflashing the ESCs again.
Yes, I believe that code will only compile for an Arduino Uno. Getting an Uno sounds like a good idea, getting the right firmware on there should be all you need to do!
Just completed the reflashing using an Arduino Uno board. The motors have now a proper behaviour when running them on either Arduino or Raspberry Pi board.
Here’s the code I used for testing the motor out with Arduino:
#include <Servo.h>
Servo servo;
static const byte servoPin = 9;
static const int MAX_FWD_REV_THROTTLE = 75; // Value between 0-400
static const int CENTER_THROTTLE = 1500;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
servo.attach(servoPin);
servo.writeMicroseconds(CENTER_THROTTLE); // send "stop" signal to ESC.
delay(1000); // delay to allow the ESC to recognize the stopped signal
}
void blinkOnce() {
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
}
void stopMotor() {
servo.writeMicroseconds(CENTER_THROTTLE); // stop
delay(1000);
}
void loop() {
// signal backwards movement
blinkOnce();
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
servo.writeMicroseconds(CENTER_THROTTLE - MAX_FWD_REV_THROTTLE); // backwards
delay(2000);
// signal stop
stopMotor();
// signal forward movement
blinkOnce();
digitalWrite(LED_BUILTIN, LOW);
delay(500);
servo.writeMicroseconds(CENTER_THROTTLE + MAX_FWD_REV_THROTTLE); // forward
delay(2000);
// signal stop
stopMotor();
}