Pid motor control - matching a tapped tempo

Hi guys ;

I am trying to create a program that will match the rpm of a motor to the tempo tapped on a button. I'd like to use a Hall effect sensor to read rpm.

I have looked at some pid and tap tempo code but am woefully over my head. Any help would be greatly appreciated.

I'd like to use a Hall effect sensor to read rpm.

Permission granted.

I am trying to create a program that will match the rpm of a motor to the tempo tapped on a button.

How are you getting the tempo? How regular is the tempo?

Why do you think you need PID for this? I'm guessing that this is game, and that people are going to get bored real quick. I can't see that PID is going to accomplish anything.

I have looked at some pid and tap tempo code but am woefully over my head.

Then why are you doing this project? If it's to learn something, fine. But, if you are trying to learn something, you need to do a better job of explaining what you are having difficulties with.

The user would tap the tempo in with a button. The program would take the time interval between the clicks as the tempo and then sync a spinning motor to the tempo. I'd like the starting rpm to be 45rpm

I figured a pid would be the best way to tune the motors rpm to the tempo

Later I would like to add additional buttons to spin the motor at multiples of the tempo (2x, 10x). This for an art installation.

If you know what RPM you need and are measuring it, just go there with a simple control loop. The motor responds fast enough that PID isn't needed.