Tuesday, 24 April 2012

The Turntable Motor Controller Project - Part 4 - Prototyping and Hair Pulling

Initial Testing Prototype
Here is a picture of the earliest prototyping stage, it was minimal to test the most basic functions and critical stages.  The wooden base is a general prototyping box I made some time ago, it has a place for the mounted micro controller (left) the prototyping board (right) and a bank of switches, buttons and pots that are prewired and easily connected to the protoboard with wires popping up through the slot just above them.  Helps keep everything in place when doing projects.

So the micro controller is an Atmel based board with built in USB interface and various I/O ports including the all important PWM ports needed in the generation of the sine waves, serial communications.  It has analog input ports too, but I have not used them for anything on this project, yet.  On the protoboard is mounted one channel of the filter network, part of the op-amp circuit and the power supplies. You can see off to the left the power op-amp mounted to a heat sink.  The op-amps I used need hefty heat sinks as they can handle a fair amount of current and also generate pretty good heat in the process, without the heat sink, they would fry fast.

My first steps involved finding a method of generating the sine waves with the micro controller.  Browsing around for ideas and clues I came across a technique that I really liked laid out by a guy at the University of Koln in Germany.  After checking the program out and seeing it would be great for my purposes I wrote the author of the code for permission to use some of it in my project.  Nice guy, he gave me his blessings.  So I set out altering the code (by the way, the whole thing is programmed in C ) to meet my needs and add all the code necessary to operate the unit.  My first test codes generated a very nice sine wave, oh yeah I thought, this can work!  So once I verified the basic sine wave generation, I had to get my fingers dirty generating all the code to make it a dual sine wave generator with the features I wanted in it.  Dang, I have not programmed in a long time, simply due to a lack of any specific project or purpose needing coding. So it was a bit of work brushing the 'rust' off my coding skills.  But hey, like riding a bike they eventually came back, wobbly, but came back.  That is where the hair pulling came in, debugging code and programming all the bits and pieces.  As mentioned this was the basic test bed, so no fancy LCD displays, minimal functions.

The area that did cause me headaches was the op-amp circuit, getting it to behave and produce a clean sine wave was a bit of battle with components, values and dealing with the heat issues (first prototyping took place without a heat sink, that was dumb) a lot of the instability was because the op-amp chip was overheating.  I did eventually get to a good working stage, so I designed the schematic according to the configuration on the protoboard.  

3D Rendered Model of the PCB
So, next phase was to layout a complete schematic for a working board on my computer to advance to the next stage of designing the complete working PCB with everything needed to generate and amplify two independent sine waves, connect the LCD display and button panel and the power supplies.  That was fun to do, a very zen thing.  There is some great software out there for hobby, and professional, board design and layout.  To the right you can see the 3D model of the board I designed with the micro controller mounting to the bottom (gray part at bottom centre).  I liked the look of how it came out, so I checked and re-checked and re-checked again and again before finally sending out an order for 3 prototype boards to get made up for me.  I was really excited and all I could do was wait the month or so it took to get the boards back.  That was a painful wait.

So, my next blog I will go into my adventures with the second prototyping phase, the full build. 
The Turntable Motor Controller Project - Part 3 - Design Goals

Enough of the motor stuff, let's get to the controller and what I want it to accomplish.  There are other manufacturers that have AC motor controllers out there, they seem to fall into what I feel are two product categories, the more basic model that is intended to only generate a single precise AC sine wave and still have a capacitor to generate the second shifted AC waveform and the higher end category that generates two separate AC waveforms driving each coil independently and not using the capacitor.  Products like the Linn Valhalla fall into the first category, as for the second category there are a couple out there and they don't come cheap.

With this one I am shooting for the stars and will look to make a unit that doesn't pull any punches, go big or go home.  So here is what it should have:
  1. Precise digital generation of the sine wave
  2. Dual independent sine wave generation
  3. Generation and selection of frequencies for 33.3 rpm and 45 rpm
  4. Frequency adjustment with a precision of 0.01 Hz
  5. Adjustable phase shift of the two sine waves
  6. Calibration mode to adjust output for any specific turntable/motor combination
  7. Ability to adjust frequency during play
  8. The ability to turn off or dim the lights that will be on the unit
  9. Be able to run high or low voltage motors
That should do it.  No tall order here.  Well, I have to be honest, I am cheating a bit, as I right this blog I am writing post development, so it will be easy to meet my spec list as it's already in prototype stage.  Thought I would come clean, don't want a James Fry/Oprah moment here. 

Here is what I have put together and am currently working on.  It's a micro controller based unit that is used to digitally synthesize two AC sine waves, the focus for the micro controller is that the sine waves are precise and stable and finely adjustable by digital means.  So there are no analog components used in the actual generation of the waves.  This is important to assure that there is no drift or alteration due to component drift or tolerances or heat etc.  The analog components only come in to play after the signals are generated and are for filtering and amplification of the sine waves.  The precision of the micro controller assures a stable and precise wave form.  The micro controller also serves to control the system and the user adjusts all parameters digitally with buttons via an LCD display (except for amplification calibration which is by potentiometers).

So I have prototyped a system with a micro controller unit, more on that later, a 16x2 LCD display and only four buttons to manage all the functions.  There will also be a power switch, a contrast control pot and maybe the odd switch to turn off LED's etc.  Oh, and a couple of LED's that display selected RPMs (45 or 33.3).  My analog circuits have filter stages and a cal pot that then feeds the power op amps.  If running a low power motor, it should be possible to drive it directly off the op amps but for 110V based motors I use step up transformers to bring the voltages up to the proper levels.

A first generation circuit board has already been designed ( and will already need to be modified! ) and is in prototype stage.  I will elaborate on some of my experiences with prototyping the unit in another blog, there is enough material there for it's own space. The software has been written that covers all the major functions and operations and seems to be working nicely.

Next I will be describing some of my experiences during the early design/prototyping stages.  Thanks for tuning in.


The Turntable Motor Controller Project - Part 2 - A Bit More About Synchronous Motors

Before describing my controller design goals let's talk a bit more about AC synchronous motors and what makes them spin.  The AC motor needs voltage delivered in alternating current but unlike a DC motor which only needs to be fed a single DC current into two wires, an AC motor needs multiple sets of wires (coils) to be fed the AC current, most AC synchronous motors have either 2 or 3 sets of coils, 2 phase and 3 phase respectively.  The thing is that these AC waveforms have to be fed into the motor out of phase from each other, ie, slightly shifted in time (technically in degrees) from each other in order for the motor to rotate.

3 Phase AC
Now in terms of pure performance, a 3 phase motor is better, it has smoother rotation if not a bit more torque.  The downside is mainly the cost of the motor and especially the complexity of driving the 3 separate AC phases.  Most turntables that use AC motors use 2 phase ones, they are cheaper and the two shifted phases are easily generated by simply adding a capacitor to the second coil which will phase shift the AC by the degrees needed for it to work (90 degrees, 3 phase motors require AC feeds each shifted by 120 degrees).  You can see the different waveforms in the pictures.  The thing about using a capacitor to introduce the phase shift is that it is cheap and simple to implement, but not likely very precise, usually close enough that the motor rotates as expected.  If the phase shift is not precisely 90 degrees the motor may be subject to increased vibration, so you want it as close as possible to 90 degrees. 
The motors used in turntables can be either low voltage (20-30V AC) or line power driven (110V) so this has to be considered when I design the controller.  The turntables I mentioned previously use line power level motors (110V here, 220V in other countries).

So I am going to be dealing with 2 phase motors for my project, they are easy to come by and are inexpensive and work well enough.  Interestingly, stepper motors are basically AC synchronous motors that if driven by AC waveforms as above will also work.  Stepper motors can be found in all kind of computer devices such as printers, scanners and some disk drives.  So it is conceivable, with a good controller, to scavenge some of these motors and use them to drive a turntable !  Nice and cheap (usually free if you hunt for discarded printers by the curbside as I have been known to do) but maybe we will see how that works out some other time.  Most of these steppers are low voltage ranging from 5-24V so that needs to be considered.

So this is not a very deep description on AC motors, but hopefully is enough to  understand where I am heading on this project.