Nano pwm pins output only after a pin is physically pulled

I am using nano and multiwii to build a quadcopter. When I tried to calibrate ESCs, there is no pwm output from the nano, and could not calibrate. The same code on uno had no problem. But when I pulled one pwm pin out and put it back, then the pwm pins would have output and calibrate the ESCs. After calibration, I tried to fly the copter (with nano, did not test uno), it did not start when I have the motor throttle up, ESCs just kept beeping. Thanks for any suggestion.

It sounds like there is a bad pin on your Nano. The pins do not pull out of the board. Post a picture and a simple schematic if you can.

I did not mean that I really yanked a pin out from the board, I had to disconnect a pwm output pin so they would have output.

Did you write the copter code yourself? otherwise maybe the PWM pin is used during startup to setup parameters if it is pulled low (or high).
Like putting a receiver in bind mode by connecting a jumper cable and then power up.

we are flyin in the dark here - can you provide a schematic please?

1 Like

I am not familiar with them windy things so please post links to technical information on all the hardware devices. Market places such as amazon and Aliexpress only provide mainly sales information.

I am posting the calibration code first, then a video clip of what's happening. Here is the code:
'''
/*ESC calibration sketch; author: ELECTRONOOBS */
#include <Servo.h>

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 1000
#define MOTOR_PIN1 6
#define MOTOR_PIN2 5
#define MOTOR_PIN3 11
#define MOTOR_PIN4 3

int DELAY = 1000;

Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;

void setup() {
Serial.begin(9600);
delay(1500);
Serial.println("Program begin...");
delay(1000);
Serial.println("This program will start the ESC.");
pinMode(MOTOR_PIN1, OUTPUT);
pinMode(MOTOR_PIN2, OUTPUT);
pinMode(MOTOR_PIN3, OUTPUT);
pinMode(MOTOR_PIN4, OUTPUT);
motor1.attach(MOTOR_PIN1);
motor2.attach(MOTOR_PIN2);
motor3.attach(MOTOR_PIN3);
motor4.attach(MOTOR_PIN4);

Serial.print("Now writing maximum output: (");Serial.print(MAX_SIGNAL);Serial.print(" us in this case)");Serial.print("\n");
Serial.println("Turn on power source, then wait 2 seconds and press Enter");
motor1.writeMicroseconds(MAX_SIGNAL);
motor2.writeMicroseconds(MAX_SIGNAL);
motor3.writeMicroseconds(MAX_SIGNAL);
motor4.writeMicroseconds(MAX_SIGNAL);

// Wait for input
while (!Serial.available());
Serial.read();

// Send min output
Serial.println("\n");
Serial.println("\n");
Serial.print("Sending minimum output: (");Serial.print(MIN_SIGNAL);Serial.print(" us in this case)");Serial.print("\n");
motor1.writeMicroseconds(MIN_SIGNAL);
motor2.writeMicroseconds(MIN_SIGNAL);
motor3.writeMicroseconds(MIN_SIGNAL);
motor4.writeMicroseconds(MIN_SIGNAL);
Serial.println("The ESC is calibrated");
Serial.println("----");
Serial.println("Now, type a values between 1000 and 2000 and press enter");
Serial.println("and the motor will start rotating.");
Serial.println("Send 1000 to stop the motor and 2000 for full throttle");

}

void loop() {

if (Serial.available() > 0)
{
int DELAY = Serial.parseInt();
if (DELAY > 999)
{
motor1.writeMicroseconds(DELAY);
motor2.writeMicroseconds(DELAY);
motor3.writeMicroseconds(DELAY);
motor4.writeMicroseconds(DELAY);
float SPEED = (DELAY-1000)/10;
Serial.print("\n");
Serial.println("Motor speed:"); Serial.print(" "); Serial.print(SPEED); Serial.print("%");
}
}
}
'''

Please read the forum guidelines and post your code accordingly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.