Arduino dc motor speed control with RPM

Hi all,

I'm quite new in arduino.

I want to make a dc motor controller with rpm feedback.

Ex: There are 2 buttons one is set to rpm to 1000 and second one is set to 2000

when I click to first button encoder will send data to arduino to change speed of dc motor (I can use L298n) and keep rpm to 1000 and second one to 2000 and I want to see rpm value on lcd.

I cannot write code from scratch but if I can find some example code I can modify them.

Thanks in advance

I have recently been working on something similar. I posted my latest code here.

...R

Do you have a way of measuring RPM? ...If the controller doesn't know how fast the motor is going it can't control the speed.

Otherwise, it's really just [u]if-statements[/u]. If the 1000 RPM button is pressed, run at 1000 RPM and if the 2000 RPM button is pressed run at 2000 RPM. If the actual speed is below the target, speed-up and if it's below the target, slow-down.

I cannot write code from scratch but if I can find some example code I can modify them.

Just take it one step at a time. I recommend you do some little "mini projects", experimenting with one thing at a time.

Then once you're confident you make all of the "parts" work, don't put everything together at once... For example, get the motor running fast/slow, then add the stuff to read RPM, then add the feedback to control the speed based on the RPM reading. That's just an example... It doesn't really matter what you do first as long as you take it one step at a time and test as you go.

Use the serial monitor to monitor your software, especially before you get the LCD working. For example, you can send-out little messages that say "1000 RPM button pressed", or you can display the PWM value, or the RPM reading, etc.

You can find examples of using PWM to control motor speed or to dim an LED. Start with something like that, slowing-down or speeding-up the motor without knowing the exact RPM before you add the RPM feedback.

The RPM measurement is going to depend on whatever hardware you have to read motor speed.

The LCD code can be different depending on the particular LCD, and of course to which pins it's connected.

Hi,

Yes I can measure rpm. I did tachometer with my arduino. It can use hall sensor effect (or infrared sensor). It can show rpm on lcd screen. And I can adjust speed with potentiometer.

What I want is when I press button "1" rpm should set to 1000 and system will read rpm from hall sensor and increase or decrease motor speed automatically until reach to 1000 rpm and stay in 1000 rpm

thanks

cyberguy:
What I want is when I press button "1" rpm should set to 1000 and system will read rpm from hall sensor and increase or decrease motor speed automatically until reach to 1000 rpm and stay in 1000 rpm

I guess you missed Reply #1 ?

...R

Hi Robin2

I'm reading your topic. Not finished :slight_smile: yet

Regards

help me
make coding rpm with rotary encoder and motordc

nahjulfikry:
help me
make coding rpm with rotary encoder and motordc

Please start your own thread. Give it a meaningful title and explain in full detail what you want to do. Please provide information and/or links to all the hardware.