run bldc using bluetooth HC06 and bletooth terminal or rc android car app

i tried to run bldc using Hc 06 bluetooth module but it is not working i tried ur code(one with throttle speed(0,6,9…) also but it didn"t work also .i am using bluetooth terminal or i can also use rc android car app.Thing i want to do is to run bldc using app and bluetooth module HC06.I used the following code to run servo motor and it is working properly.but when i used it for bldc it is not working. and we can run bldc using same servo code(if we remove the bluetooth part and manually run bldc using this servo library).It is running properly but i don’t understand what is the problem on merging it with bluetooth.I have tried many other codes also but i cannot post here all of them…This is one of the code which is atleast running our servo using bluetooth terminal.If i can run bldc too then my problem is solved… I tried software serial also but that is also not working.

what happens while running this code is app is perfectly working.It is properly printing…but what i saidit to do with bldc. i think it could not understand may be we have to change bldc part bluetooth part is okay as far as i know

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position
void setup()  
{
  // set digital pin to control as an output
myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  // set the data rate for the Serial port
  Serial.begin(9600);
  // Send test message to other device
  Serial.println("Hello from Arduino");
}
char a; // stores incoming character from other device
void loop() 
{
  if (Serial.available()>0)
  // if text arrived in from hardware serial...
  {
    a=(Serial.read());
    if (a=='1')
    {
    for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }          // tell servo to go to position in variable 'pos'
    for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
      
      
      Serial.println("LED on");
    }
    
    // you can add more "if" statements with other characters to add more commands
  }
}

Think your esc and arduino's connection is not right. put ur esc's signal wire into pin 9 and ground wire in gnd

Hi and welcome.

You made me look, so congratulations on that. A title like the one of this thread is an omen for some student who will be posting on the Saturday before they have to hand in their test/project next Monday. So students now think it is a good idea to get help by telling nothing about their problem, except for its urgency in a single line.

This is the international part of the forum, and the language spoken over here is English. This means your questions are supposed to be in the English language. Even if you put Google translate to work on 'ur', you'll be corrected by that system telling you what word you should have used.

Answers like this one are subject to whiners, whining that this forum would suck and no help is offered for serious problems. Well, this thread is exemplary of how to not get help. And that is what you should expect. Think before you post, and proof read also before posting. You can click the 'Preview' button right next to the 'Post' button, so use that. If this is the way you are going about your study, you will flunk and you are beyond any help.

So come on. Put some effort in it. Perhaps you might get someone to put in some effort in your problems too.

I concur.

Give us program and circuit with a description of what is does and does not do as well as what you want it to do.

Weedpharma

thanks sir for helping me but i have made right connections just same as you are saying....

hello sir thank you so much for seeing my post with title "urgent". and also for such a long description about this forum.But one thing i should make clear that i am not that kind of person you are thinking me to be.I am in IIT BOMBAY.i tried everything,gave my 7 days to this problem and now when it is not still working then i have posted this because of course there are some time restrictions.I don't give up easily. That's why i m in best institute of technology.I wrote such a big post not with intention to make you feel down or show off.i just want to say that don't judge people before understanding their problem.Thank you so much to others for helping me

ok thanks…
i am using bluetooth terminal or i can also use rc android car app.Thing i want to do is to run bldc using app and bluetooth module HC06.I used the following code to run servo motor and it is working properly.but when i used it for bldc it is not working. and we can run bldc using same servo code. if we remove the bluetooth part and manually run bldc using this servo library.It is running properly but i don’t understand what is the problem on merging it with bluetooth.I have tried many other codes also but i cannot post here all of them…This is one of the code which is atleast running our servo using bluetooth terminal.If i can run bldc too then my problem is solved…
thank you so much for helping me

// connect BT module TX to D0
// connect BT module RX to D1
// connect BT Vcc to 5V, GND to GND

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0; // variable to store the servo position
void setup()
{
// set digital pin to control as an output
myservo.attach(9); // attaches the servo on pin 9 to the servo object
// set the data rate for the Serial port
Serial.begin(9600);
// Send test message to other device
Serial.println(“Hello from Arduino”);
}
char a; // stores incoming character from other device
void loop()
{
if (Serial.available()>0)
// if text arrived in from hardware serial…
{
a=(Serial.read());
if (a==‘1’)
{
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
} // tell servo to go to position in variable ‘pos’
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}

Serial.println(“LED on”);
}

// you can add more “if” statements with other characters to add more commands
}
}

Some bldc controlers require a starting throttle sequence to avoid accidents

@0141, if you need urgent assistance it would greatly help your cause if you first spent a few minutes reading How to use the Forum. You might even have a solution by now.

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor.

Help us to help you. Telling us a problem is “urgent” does not do that.

…R

// connect BT module TX to D0
// connect BT module RX to D1
// connect BT Vcc to 5V, GND to GND

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position
void setup()  
{
  // set digital pin to control as an output
myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  // set the data rate for the Serial port
  Serial.begin(9600);
  // Send test message to other device
  Serial.println("Hello from Arduino");
}
char a; // stores incoming character from other device
void loop() 
{
  if (Serial.available()>0)
  // if text arrived in from hardware serial...
  {
    a=(Serial.read());
    if (a=='1')
    {
    for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }          // tell servo to go to position in variable 'pos'
    for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
      
      
      Serial.println("LED on");
    }
    
    // you can add more "if" statements with other characters to add more commands
  }
}

0141: I used the following code to run servo motor and it is working properly. but when i used it for bldc it is not working.

It is not clear what this means.

Do you mean that it works properly when you send the commands using the Serial Monitor?

You are connecting the BLDC module to the same pins (0 and 1) that are used for communicating with the Serial Monitor over the USB connection.

Are you disconnecting the USB connection when you try the Bluetooth module so that the two things are not interfering with each other?

Have you tried using SoftwareSerial to create an extra serial port on (say) pins 6 and 7 and connecting the Bluetooth device to them. That will allow you to receive data from the Bluetooth device and display it on the Serial Monitor for debugging purposes.

And, if you edit your Original Post you can change the Title for the Thread.

...R Serial Input Basics

Yes it's works properly when I send command from serial monitor .I actually used a motor shield and connected the signal wire on the Servo controller pin which is actually pin 9 and pin 10 that represent servo 1 and servo 2 signal pin on that motor shield. Yes I disconnected the usb when I use Bluetooth And I simply puted that bt rx pin to arduino tx pin and arduino rx to bt tx pin

I used this code, it will works through both serial monitor and android app. I have just made a simple android app to send 0(for stop),6(for low speed) and 9(for high speed)

Here is the code:

#include <Servo.h>

#include <SoftwareSerial.h>

int incomingByte = 0; // for incoming serial data
int armingTime;
int pin = 9;
int counter = 0;
int pulseTime = 1100; //microseconds
boolean highSpeed = true;
Servo myservo;

void setup(){

Serial.begin(9600);

myservo.attach(9);

Serial.println(“Enter 0-9 to adjust motor speed.”);
Serial.println(“Enter h or l to change the speed range.”);
}

void loop(){

digitalWrite(pin, HIGH);
delayMicroseconds(pulseTime);
digitalWrite(pin, LOW);
delay(10-(pulseTime/1000));

if(Serial.available() > 0){
incomingByte = Serial.read();
}

//void incomingByte(){
//void readSerialVal(){

switch (incomingByte) {
case ‘0’:
setTimingParams(1100);
incomingByte=’*’;
Serial.print(“Throttle: “);
Serial.print((pulseTime-1100)/8);
Serial.println(”%”);
break;

case ‘6’:
setTimingParams(1600);
incomingByte=’*’;
Serial.print(“Throttle: “);
Serial.print((pulseTime-1100)/8);
Serial.println(”%”);
break;

case ‘9’:
setTimingParams(1900);
incomingByte=’*’;
Serial.print(“Throttle: “);
Serial.print((pulseTime-1100)/8);
Serial.println(”%”);
break;

}
}

void setTimingParams(int newPulseTimeVal){
if(highSpeed){
pulseTime = newPulseTimeVal;
} else {
pulseTime = 1025 + (newPulseTimeVal/10);
}
}

0141: I have tried many other codes also but i cannot post here all of them..This is one of the code which is atleast running our servo using bluetooth terminal.If i can run bldc too then my problem is solved... I tried software serial also but that is also not working.

You are saying that you are able to drive a servo with your system. If you are able to control a servo... then the correct signals - including voltage and power - are getting to your servo.

It is then your job to figure out whether or not the system is providing the correct driving signals for the brushless dc motor. This could mean using oscilloscope etc to monitor the ouput voltage of your system....and need to determine whether or not your circuit is capable of supplying the required voltage and current to the motor.

NahidHassan: Yes it's works properly when I send command from serial monitor Yes I disconnected the usb when I use Bluetooth And I simply puted that bt rx pin to arduino tx pin and arduino rx to bt tx pin

Are you sure you have the BT module connected the correct way round? Have you tried swapping the connections?

Have you tried my suggestion of using SoftwareSerial so you can monitor what is being received from the Bluetooth module.

...R

ya i checked my connections it is correct..i tried software serial also it is not working..i think either app couldn't understand what it has to do with bldc or there is some voltage problem with bldc..we are using lipo 11.1v battery for bldc...

0141: ya i checked my connections it is correct..i tried software serial also it is not working.

How did you verify that the connections are correct?

Post the code with SoftwareSerial in it?

What is the "it" that is not working - is it SoftwareSerial that is not working. You must be much clearer in your explanations when we are not beside you to see what you are doing.

...R

0141: ya i checked my connections it is correct..i tried software serial also it is not working..i think either app couldn't understand what it has to do with bldc or there is some voltage problem with bldc..we are using lipo 11.1v battery for bldc...

You mentioned earlier that your system worked with a servo motor. This means that your bluetooth system plus motor driver plus software works just fine with a servo motor. You now need to be clear about the new requirements ..... the new requirements needed to drive a different motor.... such as the bldc motor.

You probably need to connect your servo again....and start from there. And show your lecturer a circuit diagram involving motor driver and its connections to the motor. And show how the bluetooth module is linked to the motor driver.

If you need to solve a problem..... then help them to help you by providing adequate details about your system... hardware plus software details.

Should also test each component to make sure it works..... even without software. Eg.... test the bldc motor without software...make sure that motor runs.

Yes I'm sure .

NahidHassan: Yes I'm sure .

This has got too complicated for me. There seem to be two separate conversations going on. Two different people are answering questions intended for the other guy.

@NahidHassan, this Thread was started by @0141. Please start your own separate Thread for your own question. I think it is too complex for a Moderator to disentangle things here. Just for the sake of my own sanity I will not be answering any more of your questions in this Thread. But I will be happy to help if you start your own Thread.

...R