-
3. Finalizing the hardware
06/14/2016 at 14:14 • 0 commentsHaving settled on the motor and LED controlling circuits, we need to add some form of user interface. Hacker community popularized the PCD8544 LCDs as a cheap, readable display, perfect where HD44780 LCDs are just too limited, and small size is a nice benefit. To make things even better, lots of excellent libraries have been written for it, it takes 3.3V logic and power - same as STM32s, and Chinese sellers offer ready-made modules with built-in backlight LEDs for very good prices on eBay. We're going to need some controls for pitch being tuned - I chose a potentiometer, which will be read with STM32's ADC. It provides a simple, intuitive control. Another potentiometer will be used to control pitch offset in cents. Three pushbuttons will complete the UI part, allowing us to implement some menus in a simple, up/down/select fashion.
As the brains of the project, STM32F103C8 is just what the doctor ordered: It's fast (72MHz, 32 bit) so it will easily churn out the exact tone frequencies. It has lots of peripherals, out of which we need:
- 3 PWM channels for motor control
- 1 PWM channel for backlight control
- 2 ADC channels for potentiometer readout
- 1 SPI for LCD
- .. And a few GPIO's.
The microcontroller will be clocked from a 12MHz crystal, to function as an accurate frequency reference.
The power supply section is very simple, it consists of a rectifier/filter and a pair of voltage regulators, providing +12V and +3.3V for all the circuitry.
-
2. The LED driver
06/14/2016 at 11:23 • 0 commentsThe earliest strobe tuners had used neon lamps to illuminate the strobe disk. In the 1950's they were the only electric source of light capable of being modulated with fast audio signals. Today, the obvious choice is a LED. As I planned to make the strobe disk quite large (~120mm diameter), I decided to use a 1W (350mA) power LED. Not to be confused with Peterson's reddish-orange, I picked my favourite colour: deep, InGaN green.
It simplifies things a lot that the LED intensity depends rather linearly on the junction current. To modulate the LED brightness all that we need is a current source, made out of an op-amp and a power transistor. Another two op-amps amplify the audio signal, and the remaining fourth op-amp is used to generate 1/2 Vcc voltage to bias the amplifying stages and the electret microphone.
Zener diode D1 limits the maximum instantaneous current source control voltage (rather non-linearly, but hey, it works).
VR3 potentiometer adjusts the level of gain, and VR4 controls the LED idle current. To be honest, after some testing I found I could do without VR4..
..but hey, one never has too many knobs and buttons.
-
1. Motor selection and control
06/14/2016 at 09:55 • 0 commentsThe heart of a strobe tuner is the strobe disk, driven by a small electric motor. It has to spin pretty fast (thousands of RPM), but the only mechanical load is inertia and air drag. The angular speed has to be very accurate and stable. These requirements sound very familiar: After all, a CR-ROM or HDD spindle motor does exactly that. I also had plenty of HDD spindle motors. By coincidence, one of them fits exactly in the center hole of a transparent CD I found in a cake box of CD-Rs some time ago. Two birds with one stone!
Still I was a bit worried about using a BLDC motor: The sensorless motor control scheme is quite complex, and it would be hard to write a good PID regulator, able to maintain the speed with required precision. However, a BLDC motor can be treated like a 3-phase synchronous motor and fed with three sine waves 120* apart. Then all that is left is to make a precision 3-phase sine generator. Of course it would be possible to perform switching with a trio of MOSFET half-bridges, but this technique creates a lot of electrical noise, which might affect the sensitive analog part of the tuner, so let's be gentle and go with the sine. At 1-2W of power, there's no reason to be super energy efficient in a stationary application.
Initial considerations gave me faith that everything will be possible on a STM32F103C8. Generating a sine wave on a microcontroller is possible with a technique called DDS (more on that later). Some F103's have a twin channel DAC, but I need three channels. Fortunately, STM32's have many 16-bit PWM channels, and adding a RC filter to a PWM channel makes it a poor man's DAC. Now, for 3.3V powered MCU our DAC is able to produce a voltage from the range of 0...3.3V. Most HDD and CDROM motors are powered from 12V. So we need to amplify the signal about 3.5 times. The motor requires some hundreds of mA of current, so let's add some medium power transistors - and voila, we have a motor driver! Simple, cheap and hacked together, but it should work.