Hello,
I upload the Bittle Code in my Big Bittle Robot with the Arduino Mega board and with 8 x MG 996R Servos. I have also 25Kg Servos but i have a 4 Leg walking Robot (Now Big Bittle ;)) that walks ok.
But i thing its interesting for me to use the OpenCat.ino with it.
Where can i find this:
~~~~~~~~~~~~~~
#define MIN_PULSE_WIDTH 650
#define MAX_PULSE_WIDTH 2350
#define DEFAULT_PULSE_WIDTH 1500
#define FREQ 60 // Analog servos run at ~60 Hz updates
Or do i don't need it? I only find this in OpenCat.h:
// Uses default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
Yes, it works. Thank you very much. 🤗
Thank you for answer.
When i use the testServo.ino with: pwm.setPWMFreq(60); It works fine.
When I use the WriteInstinct.ino or the OpenCat.ino with the same Entry the servos do nothing. When I use there pwm.setPWMFreq(60 * 4); it works.
I cant understand that. Isn't it the same in the testServo.ino for using servos?
I used 60 Hz before, and switched back and forth between analog and digital servos. So defining a factor made it easier for the testes.
I find this now:
...
#elif defined NyBoard_V1_0
byte pins[] = {12, 11, 3, 4,
13, 10, 5, 2,
14, 9, 6, 1,
15, 8, 7, 0
};
#define BATT A7
#define LOW_BATT 640
#define DEVICE_ADDRESS 0x54
#define BAUD_RATE 115200
//define PIXEL_PIN 10
#endif
cut ... and this:
#define PIN 0 // 16 byte array
#define CALIB 16 // 16 byte array
#define MID_SHIFT 32 // 16 byte array
#define ROTATION_DIRECTION 48 // 16 byte array
#define SERVO_ANGLE_RANGE 64 // 16 byte array
#define MPUCALIB 80 // 16 byte array
#define FAST 96 // 16 byte array
#define SLOW 112 // 16 byte array
#define LEFT 128 // 16 byte array
#define RIGHT 144 // 16 byte array
cut ... and this:
//servo constants
#define DOF 16
#define PWM_FACTOR 4
#define MG92B_MIN 170*PWM_FACTOR
#define MG92B_MAX 550*PWM_FACTOR
#define MG92B_RANGE 150
#define MG90D_MIN 158*PWM_FACTOR //so mg92b and mg90 are not centered at the same signal
#define MG90D_MAX 515*PWM_FACTOR
#define MG90D_RANGE 150
#define P1S_MIN 180*PWM_FACTOR
#define P1S_MAX 620*PWM_FACTOR
#define P1S_RANGE 250
cut ... and this:
// Depending on your servo make, the pulse width min and max may vary, you
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#ifdef P1S
#define SERVOMIN P1S_MIN // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX P1S_MAX // this is the 'maximum' pulse length count (out of 4096)
#define SERVO_ANG_RANGE P1S_RANGE
#else
#define SERVOMIN MG92B_MIN // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX MG92B_MAX // this is the 'maximum' pulse length count (out of 4096)
#define SERVO_ANG_RANGE MG92B_RANGE
#endif
#define PWM_RANGE (SERVOMAX - SERVOMIN)
Its a little bit tricky for me. ;)
Witch defines must i change to use my MG99R Servos for they don't tilt so mutch? :D
I find this from comment from Rongzhong Li:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The regular range of servos should be 500~2500.
We multiplied a PWM_FACTOR of 4. You may need to remove the *PWM_FACTOR if you use 771~2193.
Every servo is different even in the same batch. It's always good to benchmark the servo by yourself.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I will test it ;)
I change this:
#define PWM_FACTOR 1 // 4
and this:
#define P1S_MIN 650 //180*PWM_FACTOR
#define P1S_MAX 2350 //620*PWM_FACTOR
#define P1S_RANGE 270 //250
Why do you make this in OpenCat.ino?
pwm.setPWMFreq(60 * PWM_FACTOR); // Analog servos run at ~60 Hz updates
It means that frequence is 240 Hz when factor is 4