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.

koolguy

Active Member
Hi,

I am using BLDC motor with **broken link removed** i want to know can we use anything else than i2c to control speed of it like PWM...?
b'coz i have never used i2c.
 
Yes. The ESC is also said to have "Simple connectivity with an RC receiver PPM signal".
 
PWM is not the same as PPM. Unclear how that particular ESC would respond to PWM. Check its datasheet.
 
i have written I2C master code for BLDC motor at addr 0x12...but not working

**broken link removed**
 

Attachments

  • I2C.C
    797 bytes · Views: 247
There is so much wrong in that code that I would just start all over.

1) Check that all the connections are correct.
2) Make sure you have (10k) pull-up resistors on the SDA and SCL wires.
3) Read this: https://www.8051projects.net/i2c-twi-tutorial/pic-i2c-implementation.php
4) Use these I2C functions: https://www.8051projects.net/i2c-twi-tutorial/pic-i2c-code-example.php
5) Keep your test project as simple as possible. Forget the for loop. Try this to test your i2c:

C:
void main(void)
	// small delay here could be needed
	I2CInit();
	// small delay here could be needed

        // Try to send speed command to motor ESC
	I2CStart();    // Start condition
	I2CSend(0x12); // Address
	I2CSend(100);  // Speed value 0 to 255
	I2CStop()      // Stop condition

        // Motor should start spinning. Go into loop.. do nothing.
	while(1){
	}
}

EDIT: The examples are for 4Mhz clock. You may need to modify the I2CInit()-function if you use 20Mhz clock.
 
Last edited:
@Post#4

I read through the datasheet that was provided. In fact, as alec_t notes, that datasheet states "PPM," but I think what it means is the PWM that is used for model servos.

The datasheet goes on to state, "The PPM output of most RC receivers is compatible." I am not aware of any common receiver, much less most that output a PPM signal to servos. I think the author of that datasheet has confused the PPM modulation (PCM being another common mode) from the transmitter that the receiver receives with the decoded output from the receiver.

In short, connect a typical PWM servo tester to the esc, and I will bet it works. Most important, there are many examples of code in C for driving such servos. I believe that is worth a try for your project.

John
 
In short, connect a typical PWM servo tester to the esc, and I will bet it works.

I was thinking the same, but didn't want to say anything because I don't know in detail how RC systems actually work.. It just sounded weird that it would take in PPM. How would you choose the channel? The specs didn't mention any fixed channel.
 
Last edited:
How would you choose the channel?

That question can't be answered without knowing the details (i.e., brand and model) of the transmitter and receiver.

If he is using a typical, Asian-made TX and RX, then I would recommend plugging the esc into the receiver pinout labeled, "throttle." Any pinout will work, but throttle will often have a friction drag and not be self-centering on the transmitter control stick.

In reality, since he is using the 16F877, the term "channel" is meaningless. All of the channels look the same on the signal wire to each one. That is a result of the decoding I mentioned. All he needs to do is put the PWM signal on one pin. The PIC can provide sufficient signal to drive the servo directly.

John
 
That question can't be answered without knowing the details (i.e., brand and model) of the transmitter and receiver.

I meant that If the signal (that you feed directly to the esc) is really proper PPM, then which channel does the esc use? That's what was suspicious to me, because none of that was in the specs.
 
I meant that If the signal (that you feed directly to the esc) is really proper PPM, then which channel does the esc use? That's what was suspicious to me, because none of that was in the specs.

That is the whole point of it. The signal to the esc or servo is NOT PPM. I have never seen one that was. Many years ago (60+ years) some of the controls were pulse coded, but that was before servos became universally used for control. All of what I have said is relative to model servos. Industrial servos may very likely use different control signals.

John
 
That is the whole point of it. The signal to the esc or servo is NOT PPM.

Yes, yes. I agree. I was just trying to explain (to myself) why it can't be PPM.
 
The scl and sda will be set to 0 or 1?
For taking output it should be 0 in master mode but in link he isvusing input why?
 
The scl and sda will be set to 0 or 1?
For taking output it should be 0 in master mode but in link he isvusing input why?

Because I2C works differently than normal IO. You are not allowed to drive the signals. You are only allowed to pull the signal low, you are not allowed to drive it high. That is why you need the pull-up resistors. The resistors pull the signal high when needed.
 
The datasheet goes on to state, "The PPM output of most RC receivers is compatible." I am not aware of any common receiver, much less most that output a PPM signal to servos. I think the author of that datasheet has confused the PPM modulation (PCM being another common mode) from the transmitter that the receiver receives with the decoded output from the receiver.

RC systems do use Pulse Proportion Modulation (PPM). See this document for a good explanation of servo control.

Whilst the PWM module is used to generate servo signals it is not in PWM mode. In this example I use the PWM module in Special Event Trigger mode to generate the signals.

Mike.
 
RC systems do use Pulse Proportion Modulation (PPM). See this document for a good explanation of servo control.

That was not the point. We were not discussing how RC systems work in general. We were discussing about the ESC Ritesh is using.. the documentation says that it can take PPM signal in to control the speed, but that is not possible. There must be a mistake in the documentation. It must be PWM that the ESC takes in.
 
Ok.. yeah. I'm reading every post too quickly today. We are mixing three different things here.

Pulse Position Modulation (PPM)
Pulse Proportion Modulation (PPM)
Pulse Width Modulation (PWM)

You can't control the device (ESC) with Pulse Position Modulation.
But you can control it with Pulse Proportion Modulation.. which in PICs is generated exactly the same way as PWM.
 
I am talking about tris setting to 1or0?

Use the settings that was used in the example code I posted.

TRISC3 = 1; /* SDA and SCL as input pin */
TRISC4 = 1; /* these pins can be configured either i/p or o/p */
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top