Adafruit PWM/Servo Shield and ESC

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Lestat75
 
Posts: 3
Joined: Sun Dec 23, 2018 5:48 am

Adafruit PWM/Servo Shield and ESC

Post by Lestat75 »

Hi,
I'm getting crazy with the Adafruit 16-Channel 12-bit PWM/Servo Shield and ESC connected to a brushless motor.
The connections are:
- Arduino powered by USB (Desktop PC)
- Shield I2C address changed to 0x41 with soldering
- ESC connected to the Shield connected on Port 4
- Shield receive power from the ESC directly
- The ESC receive power from a LiPo 3s (11.1V 2.2Ah)

The issue is that the motor sometime works, sometime doesn't work
I think I'm missing some "init" command, but really I do not know.

Here the code:

Code: Select all

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

Adafruit_PWMServoDriver pwm;

#define PWM_MAX_REVERSE 100
#define PWM_MAX_FORWARD 500
#define PWM_ZERO PWM_MAX_REVERSE + ((PWM_MAX_FORWARD-PWM_MAX_REVERSE)/2)
#define PWMFREQ  50

void setup() 
{
  pwm = Adafruit_PWMServoDriver(0x41);
  pwm.begin();
  pwm.setPWMFreq(PWMFREQ); 
  pwm.setPWM(4,0,PWM_ZERO);
  delay(2000);
  pwm.setPWM(4,0, PWM_MAX_FORWARD );
  delay(2000);
  pwm.setPWM(4,0,PWM_MAX_REVERSE);
  delay(2000);
  pwm.setPWM(4,0,PWM_ZERO);
  delay(2000);
}


void loop() 
{
}
Last edited by dastels on Thu Apr 13, 2023 1:44 pm, edited 1 time in total.
Reason: Add code tags

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit PWM/Servo Shield and ESC

Post by adafruit_support_bill »

You didn't mention the type of Arduino you are using. Some ESCs don't work reliably with 3.3v control signals. So if you are using an Arduino with a 3.3v processor chip, that could be the issue.

I have seen some ESCs that require a specific initialization signal. You would need to check the specifications for your ESC about that.

User avatar
Lestat75
 
Posts: 3
Joined: Sun Dec 23, 2018 5:48 am

Re: Adafruit PWM/Servo Shield and ESC

Post by Lestat75 »

i am using an Arduino Mega

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit PWM/Servo Shield and ESC

Post by adafruit_support_bill »

The Mega is 5v, so that should be OK. If you post some clear photos of the front and back of the board we can look for any assembly issues.

User avatar
Lestat75
 
Posts: 3
Joined: Sun Dec 23, 2018 5:48 am

Re: Adafruit PWM/Servo Shield and ESC

Post by Lestat75 »

I solved it.
The ESC needs to be "calibrated" setting PWMs to the min and max value

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit PWM/Servo Shield and ESC

Post by adafruit_support_bill »

Good to hear you found the solution. Thank for the follow-up.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”