Teensy 3.2 Motorized Fader Controller

Status
Not open for further replies.

vince.cimo

Well-known member
Hello. I'd like to create a usb MIDI based motorized fader controller, using the Motofader 64 as a starting point. This unit is meant to be a controller for a EQ Station 8, and doesn't work on its own or output any MIDI in its current state. It communicates solely with the EQ 8 unit via DB9 serial cable.

The Motofader 64 features 29 motorized ALPS faders, controlled by 15 A3966 motor controllers. The fader levels are read by 4 MCP3008 A/D converters which communicate via SPI.

The unit has a large 7v DC power supply and does it's own I/O using 2 FPGA chips over an encrypted serial protocol.

Clearly, the easiest way to achieve my goal would be to hook into the serial port of the unit then translate the serial commands that move the faders into MIDI, but TC Electronics is not willing to provide me with a communication protocol guide, and the unit is in a 'disabled' state until it receives some encrypted handshake from the mother EQ unit. (I've tried hooking a logic analyzer up to see if anything was sent when I moved a fader, and there's nothing).

So, i'd like to hack a Teensy 3.2 onto the board, cut the connection to the FPGA chips and just utilize the rest of the board and components.

I'm not very familiar with motor control or SPI, and would love some help.

A few specific questions:

1. The A3966 (datasheet at this link) each control 2 motors. Does this mean I would need to dedicate two analog output pins on the teensy for each A3966?

2. While I could potentially figure out how to communicate with one of the MCP3008's (datasheet), I don't really know how to go about communication with all 4 at once. Since the
board is pre-made and I don't have a schematic, how do I find out which is the master and which are the slaves? I've read the PJRC guide on SPI, but I'm still kind of confused.

3. I don't really understand the A3966 datasheet. My best guess is that I hook up analog out pins from the teesny to pins 4/5 for motor 1 and 12/13 for motor 2, then leave the rest of the connections on the existing circuit board intact.

4. The open frame 7vdc power supply that powers this unit is kind of massive, and if possible, I'd like to replace it with something smaller. How can I go about measuring how much amperage the unit is drawing and if there's anything else I need to know before replacing the open frame supply with a small wall wart?

5. If I do need two analog outs per PWM, that puts me at 29 PWM outs, whereas the Teensy 3.2 only has 12. How can I reconcile this? Is there a multiplexer or something of the sort that would solve this problem? 20211125_110218_HDR (1).jpg

I've attached a photo of the PCB. Thanks in advance for your advice!
 
A few specific questions:

1. The A3966 (datasheet at this link) each control 2 motors. Does this mean I would need to dedicate two analog output pins on the teensy for each A3966?
Do you mean PWM pins?
Each H-bridge on the chip takes a direction (which they misleadingly call phase) and enable digital logic signals. You would
typically PWM only one of those pins, depending on the mode you want (PWM direction for a servo-motor/position control,
PWM enable for one-directional speed control)
2. While I could potentially figure out how to communicate with one of the MCP3008's (datasheet), I don't really know how to go about communication with all 4 at once. Since the
board is pre-made and I don't have a schematic, how do I find out which is the master and which are the slaves? I've read the PJRC guide on SPI, but I'm still kind of confused.
I guess you assume one is master the rest are slaves and drive the SPI bus appropriately (the datasheet should
explain how chaining works for the chip - figuring out which channel is which is experimentation by moving
the faders and seeing which channel responds.
3. I don't really understand the A3966 datasheet. My best guess is that I hook up analog out pins from the teesny to pins 4/5 for motor 1 and 12/13 for motor 2, then leave the rest of the connections on the existing circuit board intact.
Pins 2&3 for 1, pins 15&14 for 2.
see previous answer - if you don't know what an H-bridge is, or various H-bridge modes, now is probably
the time to learn :)
4. The open frame 7vdc power supply that powers this unit is kind of massive, and if possible, I'd like to replace it with something smaller. How can I go about measuring how much amperage the unit is drawing and if there's anything else I need to know before replacing the open frame supply with a small wall wart?
29 motors takes _lots_ of current, perhaps 15A to 30A peak in total, so no I doubt you can do anything about this. Even small motors
can pull 1 to 2A when suddenly reversing. If the supply can't take this all the motor drivers will drop out at once. People always seem
to underestimate the peak current requirements of even small motors (which consist of a metre or two of copper wire directly
between their terminals - the DC resistance is usually an ohm or two at most). Motors are very current/power hungry and a small
wall wart is completely out of the question.

However if you decide you can get away with not driving all the faders simultaneously (which is usually a hard requirement
for a auto-reconfiguring mixer desk BTW), you could maybe reduce the current requirement by some factor. The current pulled
by motors is likely to be very bursty in nature so it does seem wasteful to have to size the supply for the peak, but that's
what you need to have reliable operation, _unless_ you add a battery to the system. This is one way to provide high peak
current without needing such a large supply - in effect your battery (likely a 2S LiPo (7.4V) pack or 2S LiFePO4 (6.4V))
provides the current for the motors and a charging circuit replenishes it in the background. Its more complicated though,
and batteries don't last forever, and they need adequate protection circuits.
5. If I do need two analog outs per PWM, that puts me at 29 PWM outs, whereas the Teensy 3.2 only has 12. How can I reconcile this? Is there a multiplexer or something of the sort that would solve this problem.
As I said you'd normally PWM one of the two pins only once you've decided on the operating mode (fast decay v. synchronous rect.),
so 29 PWM pins and 29 standard GPIO (I/O extender chips for both PWM and simple GPIO are available).

I'd suggest getting a small gear-motor with reduction of 100 or so, a pot, and a simple H-bridge motor driver (L293D perhaps), and
experiment building one PID loop control system for that - you could even get a spare ALPS fader of the type in the unit for
close match in behaviour.

Conceptually its simple, you put setpoint and pot reading into the PID loop inputs, and convert the output into
a PWM value (zero maps to 50%), and PWM the direction pin with the output. The PWM needs to be high enough for
the inductance of the motor, try about 20kHz in the first instance (ultrasonic so shouldn't produce whining in the motor)
 
I'd like to extend a huge thank you! You've given me a wonderful starting point. I'll keep you posted on the progress.
 
Hello again! So I've made some progress on this, but have gotten a bit stumped.

I'm able to individually address the MCP3008's, but if I connect the MISO pins together, the circuit no longer seems to work. I can only address a single a/d at a time, and only if they're not physically connected to the same MISO pin. Any idea why this may be or how to start diagnosing this?

The MOSI, CLK, and power pins are all connected together with no issue, it's only the MISO pin for some reason.
 
Hello again! So I've made some progress on this, but have gotten a bit stumped.

I'm able to individually address the MCP3008's, but if I connect the MISO pins together, the circuit no longer seems to work. I can only address a single a/d at a time, and only if they're not physically connected to the same MISO pin. Any idea why this may be or how to start diagnosing this?

The MOSI, CLK, and power pins are all connected together with no issue, it's only the MISO pin for some reason.

Schematic?

For SPI, each slave device needs a unique chip select, see CS/SHDN on the MCP3008. Is it wired that way?
 
Got it! I just made a rookie move and didn't pull the CS pins all to high at the beginning of the script. I've now got all the faders reading values and am moving on to the motor control aspect of the project. Wish me luck!
 
Ok, i've got a motor moving around. It was actually quite a bit easier than I expected. I think now it's a question of software....

I'm not sure how best to translate fader position to PWM output.

Here's the issue:

The fader outputs a range of 0 to 1023, let's say the fader is in position 232 and I want to send a message to the servo to move to position 1023. How can I translate voltage to distance? The way this circuit works, I control the speed by changing voltage on the ENA pin, and direction by writing HIGH or LOW on the phase pin. If I do an analogWrite(255), the motor is off. If I do an analogWrite(0), the motor is crazy fast. I have tried a little script that polls values with a margin of error from the ADC, but the motor is much faster than the ADC can retrieve the value, and when I drop the speed, it seems to not have enough starting force to actually move the fader. How is this typically dealt with?

Currently, I'm thinking about polling the starting position, calculating the difference between the start and desired end position, and just setting a timer up with a known ms to distance constant, but that seems sloppy.
 
Ok, i've got a motor moving around. It was actually quite a bit easier than I expected. I think now it's a question of software....

I'm not sure how best to translate fader position to PWM output.

Here's the issue:

The fader outputs a range of 0 to 1023, let's say the fader is in position 232 and I want to send a message to the servo to move to position 1023. How can I translate voltage to distance? The way this circuit works, I control the speed by changing voltage on the ENA pin, and direction by writing HIGH or LOW on the phase pin. If I do an analogWrite(255), the motor is off. If I do an analogWrite(0), the motor is crazy fast. I have tried a little script that polls values with a margin of error from the ADC, but the motor is much faster than the ADC can retrieve the value, and when I drop the speed, it seems to not have enough starting force to actually move the fader. How is this typically dealt with?

Currently, I'm thinking about polling the starting position, calculating the difference between the start and desired end position, and just setting a timer up with a known ms to distance constant, but that seems sloppy.

As suggested earlier, you need a closed loop servo system. PID works pretty well here, see https://electricdiylab.com/arduino-pid-dc-motor-position-control-close-loop-system/

You don't have encoders, so you will have to use the ADC value as the feedback instead. You want to be servicing the loop at 200-1000 hz, so hopefully your ADC can be sampled that fast. Otherwise, you can look at adding encoders to your motor or sourcing a motor/encoder/gearhead setup.
 
Status
Not open for further replies.
Back
Top