What happened before:

 

For almost a year I have a vintage turntable from Perpetuum Ebner at home.

It's not mine. It belongs to someone that asked me to fix it. And it turned out that fixing the motor would cost too much.

I asked the owner to collect the tt. That hasn't happened yet and the machine is collecting dust at my home.

 

So I'll take the freedom to attempt a non-intrusive repair with modern components. I'm also thinking about making it an Enchanted Objects Design Challenge.

 

In post 1 I present the turntable, talk about my previous repair attempts and brainstorm on some modding ideas.
In post 2 I'm measuring up the different gears, pulleys and wheels, and I calculate the speed of the original motor.

Post 3 is the first post on motor control. I'm reviewing the operation of the Infineon DC Motor Control Shield.

 

In this post I'm using the enhanced PWM module of my The specified item was not found. Hercules LaunchPad to test drive the motor.

 

Photo 25-02-15 14 16 34.jpg

 

Enhanced PWM module

This module on the Hercules microcontroller is new to me. My previous one didn't have it.

And that's why I'm using it here to drive the motor shield: for my own education and entertainment.

 

 

I'm going to use the module as a straightforward PWM generator running at a fixed frequency. The only thing I want to drive from my code is the duty cycle.

I'm going to use that mechanism later to control the motor speed of my turntable.

I first studied the example that's available in the help files of the Hercules configuration application HALCoGen (covered in the video above).

Once I understood that, I as ready to choose my own signal frequency. And I knew how to manipulate the duty cycle from within the firmware.

 

When you use HALCoGen to configure the PWM module, it generates the correct registry initialization code for you.The only thing you have to do in firmware is call that initialization.

The controller will immediately start generating the PWM as defined in the configuration.

At run-time, you can then change the duty cycle  with another single line of code.

 

HALCoGen initialization

 

All configuration is done by selecting the right properties for the ePWM module.

I'm configuring a 25 kHz (40000ns) signal with 80% duty cycle in the screen captures below.

 

First step is to enable it:

hcg1.jpg

Next, we configure the settings of our PWM channel:

hcg2.jpg

hcg5.jpg

 

 

And finally, pin-multiplexing and clock synchronisation:

hcg4.jpg

 

 

 

That's it. HALCoGen creates your application framework, the APIs for the activated modules, and the initialization code based on these settings.

 

Start PWM and change Duty Cycle from Firmware

 

The source code for the firmware is extremely simple. The first call starts PWM as defined by HALCoGen.
The second call immediately switches the duty cycle to 40%.

void main(void)
{
/* USER CODE BEGIN (3) */
  etpwmInit();
etpwmSetCmpA(etpwmREG1, 1600); // set duty cycle to 40%


    while(1);
/* USER CODE END */
}









 

Hardware setup

The setup is straightforward. The only 'smart' connection is the PWM signal. It's going from the PMW output LaunchPad to the input of the first half H-bridge on the infineon shield.

There's also a semi-smart output in my demo setup: the inhibit pin of the firts half H-bridge is pulled high to make it active.

pwmsetup.jpg

The motor is wired between the output of that first half H-bridge and ground (I'm only controlling the speed in this demo, not the direction).

The Hercules LaunchPad only needs a 5V dc supply, I'm using the USB connector for that. The motor driver is powered by my bench power supply at 12V.

 

signalLaunchPadMotor ShieldMotor
groundJ11.2 (GND)GND (any)
half H-bridge 1 InhibitJ11.3 (+3.3V)DIGITAL 12 (INH_1)
PWM control signalJ11.16 (EPWM1A)DIGITAL 3 (IN_1)
motor PWM signalOUT1motor wire 1
motor groundGNDmotor wire 2
motor power supply +12V from desk power supplyVBAT
motor power supply ground from desk power supplyGND
LaunchPad power supply 5V from computer USBUSB

 

Photo 25-02-15 20 01 00.jpg

I've recorded the PWM input and motor output signal for 25%, 50% and 75% duty cycle at 25 kHz.

25khz_25pct.bmp 25khz_50pct.bmp 25khz_75pct.bmp

I'm still worried about noise in the audio range. The FFT analysis of the motor signal shows that there's things happening under the 20 kHz range.

Tests will have to show if there is audible interference on the turntable's output.

fft.bmp

I don't know yet what the subject of the next blog post is going to be.

 

 

Related posts
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 1
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 2 - Calculating the Motor Speed
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 3 - Infineon Motor Driver shield
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 5 - Yes I Can
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 6 - Speed Adjustment with Variable Duty Cycle
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 7 - Make Speed Sensor from Scrap Parts
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 8 - Sample the Motor Speed with Microcontroller