Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

BLDC motor speed control...

Status
Not open for further replies.
Note to self, do not buy poorly documented kits without schematics from Robokits India.

Anyway, what's the part number of the big IC on the H bridge controller board?
 
Last edited:
You do know that you may be sending data to fast for the Atmel atmega 8au to read it.
 
Potentiometer Test and Debug

The brushless motor and driver can be tested by connecting GND to the SCL pin and applying a
fixed analog voltage from 0V to 5V on the SDA pin using a 1kohm – 100kohm potentiometer.
The driver will enter test mode on start-up if SCL is connected to GND and start the motor at a
speed depending on the voltage on the SDA pin. This can be used to simply test the
functionality of the motor driver and the brushless motor.

Have you tried this?
 
Service and Support
Service and support for this product are available from Robokits India. The Robokits Web site
(https://www.robokits.co.in) maintains current contact information for all Robokits products.
 
maybe the OP may be better served learning the phrase " Would you like a poppadom with your order sir".......
 
You need to adjust the I2C clock speed. It's in the SSPADD register. Take out the PIC16F877A datasheet and read the calculation part for the I2C speed.

You can try 5kHz at the start. Or, look at the manual for the motor controller.
 
Last edited:
I don't see it being 400khz it's probably using arduino code which the libraries are much slower then that start slow as picbits said Experiment
 
Experiment

Hi again,

The BLDC is working perfect now and i have added ADC control..


Code:
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
 
#define SDATA RC4
#define SCLK RC3
void I2C_init(),I2C_start(void),I2C_write(char x), I2cSTOP(void);	
void i2c_Wait(void);
adc();
void main(void){
 TRISA = 0xff ;
ADCON1=0b00000000;
ADCON0=0b10000001;//000 = channel 0, (RA0/AN0)
	ADIF=0;
	TRISC3=1; //direction to input have be changed
	TRISC4=1;

TRISC5=0;
RC5=0;
RC5=1;

__delay_ms(500);
RC5=0;
 
unsigned int a;

while(1){

 a=adc();
   I2C_init();
__delay_ms(50);
	I2C_start();

	I2C_write(0x12);//esc default addr

	I2C_write(a);//testing speed 0-255

   I2cSTOP();



}





}
 
 
 
 
void I2C_init(void)
	{
  SSPCON = 0x38;      // set I2C master mode
 SSPCON2 = 0x00;
SSPADD = 0x0C;  //400KHZ  20MHz xtal
SSPSTAT|=0X80;
 PSPIF=0;      // clear SSPIF interrupt flag
 BCLIF=0;      // clear bus collision flag
}
 
 
 
void I2C_start(void)
{
    i2c_Wait();
    SEN=1;
}
 
 void I2C_write(char x){
	i2c_Wait();	
SSPBUF=x;
 
 
 
		}
 
void i2c_Wait(void){
    while((SSPCON2 & 0X1F || (SSPSTAT & 0X04)));
}
 
void I2cSTOP(void)
{
    i2c_Wait();
    PEN=1;
}


adc(){

	
	__delay_us(10);
GO_DONE=1;
	__delay_us(10);

return ADRESH;

}
 
None at all. If you are happy with the result of all your hard work than good for you :D

Regards,
tvtech
 
No, i learning with testing if u want to give suggestion u can..

Learning from mistakes is the most efficient way of learning. I suggest you try to learn from errors and mistakes. When things are not working, try to understand why.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top