I am needing to count rpms, and trying to figure the easiest way. I have a spinning wheel that will spin 300-1000 rpm (a guesstament) and i want to serial print this value. I think the easiest way is an optical sensor, or rigging a simple contact switch ( a strip of aluminum that contacts a wire that completes the circuit and gives a high input). I am completely new to coding but am learning by using examples to fit my needs. All I need is a point in the right dirrection, and maybe a few opinion. any ideas are apprecated

If the wheel is a decent size you can mount a small magnet on it and use that to trigger a hall effect sensor or the reed switch of a bicycle speedometer.

rigging a simple contact switch

Forget that it will never work long term.

In addition to optical and hall effect you can use magnetic induction. Magnetic proximity switches are convenient but a bit pricey but have the advantage of not having to mount anything on the rotating part if there is a metal / no metal portion of the wheel.

I vote for the optical approach. Here's an example:

Since you're starting out, break it up into three projects: 1. Set up the sensor (optical or magnetic, whatever you decide), power it up, and use a scope or a multimeter and make sure you can see a change in voltage with each revolution.

  1. Figure out how to get the Arduino to read analog inputs and read data off of the sensor. Display the data in using the serial communication in the Arduino terminal. Now the Arduino is acting like your scope or multimeter.

  2. Write the code for the Arduino to detect revolution using a simple threshold crossing algorithm. Trigger a count when the voltage reaches a certain level, and then don't start counting again until the voltage goes back down below a certain level.

There are tutorials all around for each of these parts.