Basecam Clone BGC3.0 - compatible with SimpleFOC? What pins to use?

Hey folks,

I ordered a couple of BGC3.0 clones from AliExpress. Took me a Saturday but figured out how to re-flash the firmware onto them. Managed to upload an Arduino “Blink” sketch which works lovely, so I know the ATMega328Pb chips are working.

I just can’t figure out how to get a motor to move.

Here’s my setup:
Micro BLDC motor with 6 poles, 4300KV running on a 5V power supply (i’ve tested with a cheap ESC and it works between 3 and 7 volts).

I think I may just not have the right pins set on the driver? But also, not sure what are the right ones. Also, do I need to declare any “enable” pins?

// Open loop motor control example
#include <SimpleFOC.h>


// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(6);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(3,5,6);


//target variable
float target_velocity = 5;

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void doLimit(char* cmd) { command.scalar(&motor.voltage_limit, cmd); }

void setup() {

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 5;
  // limit the maximal dc voltage the driver can set
  // as a protection measure for the low-resistance motors
  // this value is fixed on startup
  driver.voltage_limit = 5;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // limiting motor movements
  // limit the voltage to be set to the motor
  // start very low for high resistance motors
  // currnet = resistance*voltage, so try to be well under 1Amp
  motor.voltage_limit = 5;   // [V]
 
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware
  motor.init();

  // add target command T
  command.add('T', doTarget, "target velocity");
  command.add('L', doLimit, "voltage limit");

  Serial.begin(115200);
  Serial.println("Motor ready!");
  Serial.println("Set target velocity [rad/s]");
  _delay(1000);
}

void loop() {

  // open loop velocity movement
  // using motor.voltage_limit and motor.velocity_limit
  motor.move(target_velocity);

  // user communication
  command.run();
}

Please post your progress whether you get responses here or not. I’m also curious about this board.

1 Like

Hey, please do a search in this forum for BGC 3.0 - I’ve posted the pinout a couple of times…

This board can be made to work - but its an ATMega MCU, and I2C sensors - you won’t get very good performance driving BLDCs in FOC on this. But it is possible.

1 Like

Fantastic! Thanks a lot, found it! For those interested, i’ve attached it here.

Finally got my motor to start turning. Picture attached, and code as per below. Here’s the unusual bit - it will only move when both the USB AND the external power supply are connected. With just one, I hear a faint clicking and it sounds like it is continuously resetting. Any thoughts on that?

// Open loop motor control example
#include <SimpleFOC.h>


// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(6);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(5,6,3, 8);
//BLDCDriver3PWM driver = BLDCDriver3PWM(9,10,1, 8);

// Stepper motor & driver instance
//StepperMotor motor = StepperMotor(50);
//StepperDriver4PWM driver = StepperDriver4PWM(9, 5, 10, 6,  8);


//target variable
float target_velocity = 2;

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void doLimit(char* cmd) { command.scalar(&motor.voltage_limit, cmd); }

void setup() {

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 5;
  // limit the maximal dc voltage the driver can set
  // as a protection measure for the low-resistance motors
  // this value is fixed on startup
  driver.voltage_limit = 6;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // limiting motor movements
  // limit the voltage to be set to the motor
  // start very low for high resistance motors
  // currnet = resistance*voltage, so try to be well under 1Amp
  motor.voltage_limit = 5;   // [V]
 
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware
  motor.init();

  // add target command T
  command.add('T', doTarget, "target velocity");
  command.add('L', doLimit, "voltage limit");

  Serial.begin(115200);
  Serial.println("Motor ready!");
  Serial.println("Set target velocity [rad/s]");
  _delay(1000);
}

void loop() {

  // open loop velocity movement
  // using motor.voltage_limit and motor.velocity_limit
  motor.move(target_velocity);

  // user communication
  command.run();
}

1 Like

Hey, cool to hear its working!

My guess is that giving 5V to the motors is at the lower limit of this board - isn’t it 8-18V or something? I can’t actually find a listing that gives the input voltage range, but my guess is the 5V is too low for the linear regulator (the big chip in the middle), which then can’t produce stable 5V for the logic side.

See what happens if you increase the supply to 7V or 10V?

1 Like

I tried playing around with the input voltage. Even at 7V and above it wouldn’t move. I rigged up some 100uF capacitors between the chip’s 5V and ground and then between 5.6V-6.2V, it turns as expected - magic. Outside of that range though, it just sort of “pulses”. The motor (and the driver) seem to get very hot. Even at super low velocity 2 rad/sec. I have the input voltage now at 6.2V, driver voltage limit at 3V and motor voltage limit at 3V, and the motor is too hot to touch. Am I doing something wrong? Full disclosure if not already apparent - I am a total newb when it comes to ESC’s and brushless motors. Would really appreciate any guidance you have :slight_smile:

Be careful: if things are getting hot, that’s not the best sign. May I ask what the phase resistance of your motor is? What kind of current levels are we talking about here?

This driver board doesn’t do current sensing, it’s only suitable for driving higher resistance “gimbal” type motors. A low ohm motor will draw too mich current the moment the MCU switches on the drivers, and the board will reset at best, or worse case, something will fry…

Thanks Runger. I measured the resistance between two of the wires on the motor and it looks to be about 0.9 ohms… I’m thinking this is too low a resistance as you’ve described? Current seems to be around 1 amp when it’s operating… If I add resistors to the circuit might that help? (But I imagine that would then reduce the performance of the motor)… Or would another board be more suitable?

Just did a bit of googling - I guess the issue is the motor itself - the windings are done with too thick gauge copper (designed for minimal resistance and high-speed operation). Is there any suitable driver for drone-style motors though with low phase resistance?

@ajf367 can you detail how you set up the board so that you could upload from arduino? i have no idea what im doing, other than trying to copy you. i’m using little baby gimble motors hopefully for direct driving a lil robot

Hi @ajf367 ,

I am sorry, I missed this thread due to holidays… I assume you’ve found some by now, but yes, there are a few options for drivers with higher current capacity. The problem right now is the availability… the B-G431-ESC-1 is one option, as are various drivers made by our community (search here in the forums).
Other than that, there is hardware which tends to be expensive, like ODrive, VESC or Moteus, or various evaluation driver boards from TI or ST-Micro…

There’s also AliExpress - if you search there with “SimpleFOC” you can find various clones of the SimpleFOC hardware, and also other drivers which claim to be compatible…

Its a bit hard at the moment to find components :frowning: