Arduino Forum

Using Arduino => Programming Questions => Topic started by: prashant_k_2006 on Dec 25, 2015, 10:13 am

Title: Speed control brushed dc motor with arduino using radio signal
Post by: prashant_k_2006 on Dec 25, 2015, 10:13 am
Hi ,

I want to control brushed DC motor with arduino using radio signal.I have Fly sky CT6B 6 channel transmitter.I know that we can use pulsin() to read signal from receiver but i didnt find any code on how to output this signal to dc motor.

Please help me out.Thanks in advance.

regrads,
Prashant
Title: Re: Speed control brushed dc motor with arduino using radio signal
Post by: OldSteve on Dec 25, 2015, 11:01 am
If you're talking about reading the receiver's servo PWM output, you'll be getting pulseIn values between about 1000uS and 2000uS.
You should be able to convert those using map(), to values between 0 and 255, then use PWM with 'analogWrite()' to control the speed of your DC motor, using a suitable (MOSFET?) driver and separate power supply.
Code: [Select]
pwmVal = map(pulseWidth, 1000, 2000, 0, 255);
Title: Re: Speed control brushed dc motor with arduino using radio signal
Post by: prashant_k_2006 on Dec 25, 2015, 07:16 pm
Thank you very much for your reply.That helped a lot. One more question? Do we need a separate power supply? Actually i didnt want to make my assembly heavy with extra power source.I need it to fly of the ground.Is there any way to use common power supply.
Title: Re: Speed control brushed dc motor with arduino using radio signal
Post by: OldSteve on Dec 26, 2015, 01:39 am
Thank you very much for your reply.That helped a lot. One more question? Do we need a separate power supply? Actually i didnt want to make my assembly heavy with extra power source.I need it to fly of the ground.Is there any way to use common power supply.
You haven't provided details of the DC motor, ie running current under load, and stall current, or the number of motors.
Also the batteries. Their voltage may pull down to an unacceptable level, especially when the motors start or accelerate quickly. What other loads do you have connected besides motor(s) and the Arduino itself?

Generally, you cannot power DC motors directly from an Arduino. It's asking for problems, even with small motors, because more than likely, the startup current surge will exceed the ratings of the Arduino. It can cause unexpected behaviour, and can even reset the Arduino.

You might get away with powering the motor(s) directly from the battery via transistor/MOSFET drivers, with the battery also feeding the Vin of the Arduino, but separate power is the best.

And note that the 1000uS to 2000uS valuesthat I gave are only approximate. You'll need to measure the actual range of pulsewidths from your receiver and set the values in 'map()' appropriately.