Hi, I'm new and this is my first post.
I am going to acutely measure the speed of my turntable which I have just restored.
I used the code from Easy Peasy but I would have to adapt it for this new purpose.
I physically modified the two IR LEDs and placed them at 90 degrees to read the dots on the platter.
The turntable plat has 182 points.
What changes to the code should be changed?
Who helps me?
Either way, the variable should be qualified "volatile" and read back in non-interrupt context with interrupts disabled - no need to detach and reattach the interrupt.
Please remember to use code tags when posting code
An LP rotates at 33+1/3 RPM == 0.03 minutes per rotation == 1.8 seconds per rotation.
There are 182 dots, the expected frequency would be 182/1.8 == 101.1111111... Hz
Are you sure there are not 180 dots? That would make the dots frequency read 100.0 Hz, and a neon strobe would freeze that anywhere where there is a 50Hz line frequency.
Why do you attach and detach the interrupt every time through loop()? Not a good idea.
This is a better way - and most strobe discs are marked to work with 50/60 Hz mains lights anyways. The only requirement is that the mains frequency should be stable enough - it does vary but I guess a 1% variation would mean an error of 1% in the turntable speed...hardly recognisable by "ordinary" ears.
Yes, exactly 182 dots/reflectors.
Frequency Strobe:
From the Turntable Sevice Manual:
For this calibration, you need access to the component side of the drive control circuit board. Before you begin the calibration, you will need to set the main pitch control slider to "0", where the indicator lights up.
Connect the frequency counter between test point (TP27) and earth.
Adjust VR301 so that the frequency counter reads 262.08 kHz ±0.05 kHz
Thanks.
I tried different combinations,
unfortunately I am too ignorant of ARDUINO.
I also tried with the TimerOne.h library
but with no good results.
At this point, I'll first pay some of you via PayPal
for a well done script
THIS IS UNTESTED - no guarantee that it will work. You need to directly connect the sensor that reads the light to the interrupt pin. It assumes that the interrupts generated will be regular as in reading a repeating sequence of markers.
Add/modify the code wherever applicable (such as TO DO).
Let us know if it works.
#define INTERRUPT_PIN 6 //TO DO: Give the correct pin number
#define windowIntervalSec 2 //2 seconds window - increase this if the no. of markers is less for better accuracy
#define INTERRUPT_MODE FALLING //Set this to one of FALLING, RISING, CHANGE, LOW
#define NUM_MARKERS 182 //TO DO: Check this as per your setup
unsigned int numPulses = 0;
unsigned int lastMillis = 0;
unsigned int curMillis = 0;
float revPerMin = 0.0f;
void displayResults() {
//TO DO: Display 'revPerMin' or use it for something...
}
void interruptRoutine() {
numPulses++;
}
void setup() {
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), interruptRoutine, INTERRUPT_MODE);
numPulses = 0;
curMillis = lastMillis = millis();
revPerMin = 0.0f;
}
void loop() {
curMillis = millis();
if(curMillis >= lastMillis + (windowIntervalSec * 1000)) {
//Interval passed, time to calculate
revPerMin = 60 * ((float)numPulses / (float)windowIntervalSec / 182.0f);
//Reset everything for a fresh calculation...
lastMillis = curMillis;
numPulses = 0;
}
displayResults();
}
I won't work...as in millis() cannot be used? I have updated the code. As I mentioned I have no way of testing it, so the OP has to actually test it, after gathering inputs from others here...
And in most countries that's more accurate than the Arduino's clock, although the Arduino should be accurate-enough for this application.
It also requires a fluorescent (or neon) lamp. (Incandescent lamps don't flicker.)
Usually a turntable that has the dots also has a built-in strobe. These little neon lamps used to be common and I assume that's what's in my old turntable, but it could be an LED... I can't see what's behind the lens. The neon lamp just has to be connected to the AC power (with a series resistor) and no other electronics are required.
My turntable also has 4 sets of dots for 33 & 45 RPM and for 50 & 60Hz.