Loading...
Pages: [1]   Go Down
Author Topic: Wireless motor control using PWM  (Read 655 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

we can control speed of motor using PWM.
But how does same thing can be done wireless by using a simple rf module.
please let me know in detail.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 36396
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But how does same thing can be done wireless by using a simple rf module.
please let me know in detail.
You need to provide more details about what you are trying to accomplish. Will there be an Arduino on both ends of the wireless link? If so, you can simply send the value that should be written to the PWM pin, from one Arduino to the other, and have the other Arduino analogWrite that value to a PWM pin.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ya i'm using two arduino.
I have successfully sent data wirelessly from one arduino to another.
similarly i can send the PWM value. but at the receiver end how can we inplement that that value for analogue write.
please help me dude, i'm stucked.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 36396
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have successfully sent data wirelessly from one arduino to another.
Good.

Quote
similarly i can send the PWM value
Then, what's the problem?

Quote
at the receiver end how can we inplement that that value for analogue write
If you've received a value, just call analogWrite() with that value. If you've received an array of characters, use atoi() to convert the NULL terminated array of characters to an int, and call analogWrite() with that value.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you've received an array of characters, use atoi() to convert the NULL terminated array of characters to an int, and call analogWrite() with that value.

ya i receive an array of characters,
ya thats what is problem: how to convert array of character to an integer value.
atoi( ):i have never use this function, can i have a demo? or link, sth that explains me.
and how do we do analoge write these values.

Logged

Global Moderator
UK
Online Online
Brattain Member
*****
Karma: 142
Posts: 19339
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
atoi( ):i have never use this function, can i have a demo?
Have you tried google?
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

0
Offline Offline
Tesla Member
***
Karma: 58
Posts: 6766
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
ya i receive an array of characters,
ya thats what is problem: how to convert array of character to an integer value. atoi( ):i have never use this function, can i have a demo? or link, sth that explains me. and how do we do analoge write these values.

Below is some code I use with servos where a character string is captured and converted to a number. You may be able to modify it for PWM use.

Code:
// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(2000); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(1); 
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    }
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray);
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  }
}

Logged

Why I like my 2005 rio yellow Honda S2000 with the top down, and more!
GOOGLE ADVANCED FORUM SEARCH BELOW!  
Go to:  http://www.google.com/advanced_search?hl=en
put in key search words,
use site or domain:  http://arduino.cc/forum
or in a google search box put key words site:http://arduino.cc/forum

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i'll go for my work.
thanks a lot.
Logged

Pages: [1]   Go Up
Print
 
Jump to: