Home        Store        Docs        Blog

Regarding ESC for T200


(Abdul Muqtadir) #1

I am using ESC to drive T200 Thruster, but instead of arduino I am using AVR controller for driving and for the same I am giving appropriate signals to ESC but still its not working. Someone kindly help me for generation the pulses and how many times i need to give pulses in a second? Apart from this how much time i shud wait for giving another pulse.


(Patrick José Pereira) #2

It’ll depends of which ESC are you using, but you should provide a pwm signal with this:

  • Frequency: 50-400 Hz
  • Signal from:
    • 1500us width (stops)
    • 1900us width (max forward)
    • 1100us width (max reverse)

You can get more information here :wink:


(Abdul Muqtadir) #3

Thanku for your answer sir,
Actually I am making a complete pulse of 3000us(Ton+Toff) as if Ton=x(us) so Toff=3000-x(us) with same stop, forward and reverse width specifications,where x=1500 or 1900 or 1100 us. So the Frequency is 333Hz almost. But still I am not getting my Thrusters rotation. Do i need to give any special pulse in the starting. Same hardware is running with arduino library but in my project I dont want to use Arduino but Raw controller wither AVR family or ARM family. Kindly tel me if you can give me any sample code for any raw controller rather arduino.


(Patrick José Pereira) #4

If you translate the Arduino example code to any µcontroller it’ll work.
From: http://docs.bluerobotics.com/bluesc/#example-code

void setup() {
	servo.attach(servoPin);

	servo.writeMicroseconds(1500); // send "stop" signal to ESC.
	delay(1000); // delay to allow the ESC to recognize the stopped signal
}

void loop() {
	int signal = 1700; // Set signal value, which should be between 1100 and 1900

	servo.writeMicroseconds(signal); // Send signal to ESC.
}

As described in this example code, you need to send a “stop” signal in the first seconds to calibrate the ESC when it’s turning on.


(Abdul Muqtadir) #5

Thank you for your kind response. Sir actually i tried my code with servo and that is working and when i am applying the same code with different duty and pulse duration’s then it is not working with thrusters. I Tried the code with PWM of AVR as well as using general nop delay functions. My code is as follows:

#define F_CPU 8000000UL
#include<avr/io.h>
#include<util/delay.h>

main()
{
DDRD=0xff;
while(1)
{
PORTD=0x01; //PWM pulse given by PORTD to the PWM pin of ESC
_delay_us(1800); //PWM for forward rotation, 1800Microseconds ON
PORTD=0x00;
_delay_us(700); //700Micrseconds OFF
}
}


(Jacob) #6

The esc must be armed first.
To arm the esc, send it a 1500us pulse until it beeps.


(Abdul Muqtadir) #7

Thank You for your kind reply sir.


(Abdul Muqtadir) #8

Sir, cant u give m any sample code, I tried with normal nop delay functions as well that thru Timer operated PWM of AVR but still I am not getting the result. Or if u can share me the timing diagram of the required signal for EAC.

my modified codes are:

  1. ///Without Timer with nop functions
    main()
    {
    DDRD=0xff;
    PORTD=0xff;
    _delay_us(1500);
    PORTD=0;
    _delay_ms(5000); //so that EAC can understand the pulse
    while(1)
    {
    PORTD=0xff;
    _delay_us(1700);
    PORTD=0;
    _delay_us(900);
    }
    }

  2. //With Timer1 of AVR Atmega8
    #define F_CPU 8000000UL
    #include<avr/io.h>
    #include<util/delay.h>

int main()
{
DDRB=0xff;
PORTB=0xff;
TCNT1=65535-1500; //for stop pulse
TCCR1B=2; //Switch On timer1 for 1 increment in 1 us
while(!(TIFR&(1<<TOV1))); wait till overflow occurs
TCCR1B=0; //Turn OFF timer1
_delay_ms(5000); //wait for EAC so that it can understand the arm signal
TCCR1B=0b00011010; //Configure timer for generating PWM
TCCR1A=0b10000010;
TCNT1=0;
ICR1=5000; //configure the length of pulse as 5 ms so that frequency will be 200 Hz
OCR1A=1700; //to generate a high pulse for 1700 us and 3300 us OFF and continuous repetition
while(1);
}

My Hardware is working well with arduino and same code which you have given before.


(Patrick José Pereira) #9

Hello,

Your code in (1) is not creating a pwm signal of 1500 for some seconds, as the arduino example describes and said by me and Jacob.

I’m not familiar with AVR architecture, but I would recommend to use a pwm abstraction class like this one.


(Jacob) #10

You are producing a single pulse. You need to produce the 1500us pulse at a frequency of 100 Hz for a duration of 7 seconds. Try the arduino example. https://github.com/bluerobotics/br-esc-examples/blob/master/arduino/BareMinimum/BareMinimum.ino