AC Servo Torque VU Meter?

Hi all im trying to make a 10 segment LED VU meter that will output the min and max torque from this servo motor, this will be a spindle load meter for my CNC Lathe, i have searched around but cannot seem to find a noob friendly tutorial about interfacing arduino with an AC servo drive, the drive has Quadrature encoder Signals A B and Z out from the encoder of the motor it also has an analog speed output, is there anyway i can make this output torque, i want this to run on an arduino nano v3.0 if there is enough pins if not then it can be a larger one, i was maybe thinking some kind of LM series driver for the display which i have uploaded a pic of the ones im using, just added schematics of servo drive outputs.

For electric motors, there's a relationship between load and current: the greater the load, and the greater the torque the motor supplies, the greater the current is. So if you have a way of measuring the current, you would have a measure for the amount of power the motor demands, and with it the work it puts out.

Encoders are no use for this application as it shows you the movement of the motor (every state change of an encoder is a certain amount of movement; the order of the changes gives you the direction it's moving in; the time between changes gives the speed at which it's moving).

I’m not sure what sort of servo you’re using (obviously not a regular hobby RC type servo), but as wvmarle said, you can estimate servo torque based on average current drawn. I’ve done this for a University Research project with a robotic fish here at VT. It’s not too complicated and works like a charm. My torque circuit consists of a Hall Effect current sensor (+- 5A), a difference opamp circuit (to get rid of signal bias), low pass filter (to prevent aliasing and noise), and a 16 bit ADC. The only thing you need to worry about is accurately calibrating your system. We had to run several tests to make sure the servo’s torque vs current relationship was accurately defined. One interesting finding was that some low end servos exhibit a nonlinear relationship between torque and current at low torques. High end servos (on the other hand) generally have a linear relationship between torque and current draw. Probably TMI, but I hope it helps.

Okay cool I shall look into it, these are high end AC servos i have one panasonic one that has an analog torque output signal on the drive connector, i would assume this would be quite simple to use would i just use an LM3914 and use the arduino to measure the analog signal to drive the bargraph?, the other two servos dont have a torque output only ABZ quad encoder and analog speed ref, would some kind of hall effect sensor obviously non contact on the motor supply wires (3phase) and use this signal as a reference for the circuit, the motors are 750W X axis - 1.2KW Z axis - 3.8KW Spindle 50Amp full draw on this beast at 2500RPM when loaded up to the max will also push to 70Amp at 30NM aslong as i dont overdo it lol.

the motors are 750W X axis - 1.2KW Z axis - 3.8KW Spindle 50Amp full draw on this beast at 2500RPM when loaded up to the max will also push to 70Amp at 30NM aslong as i dont overdo it lol.

(obviously not a regular hobby RC type servo)

That sounds quite right :slight_smile:

The analog output can be read by the Arduino - mind that you get the voltages in range!

You will get a pretty good result if you bring the analog signal to 0-5V, and supply a constant 5V power to your Arduino. Possibly better (more stable) results by bringing the signal down to 0-1V and using the internal 1.1V reference.

Basically as soon as you have an analog signal it becomes trivial to drive those LEDs. Your other challenge may be the number of pins required - I guess that's 10 pins for 10 individual LEDs, so 30 outputs for three such displays. Maybe you need to get a Mega instead (then you also have a 2.5V fixed reference to choose from for your analog input), otherwise you'll need a port extender.

Code for this is going to be dead simple. Read the analog value, based on the levels switch on/off the LEDs. That's it.

Excellent thanks for the help i shall get a prototype going on monday, for now can someone help me with this side project, im trying to use the A and B Quad encoder phases to print RPM to a 4 digit 7 Segment display over SPI on a MAX 7219, got a prototype here using a 600P/R Quad Encoder as a substitute for the servo till its working, got the 7Seg display connected to the MAX7219 all seems good, i just need help with the arduino code, dont want to be spoonfed i just have never had the time to learn coding (i think i should its kinda interesting), if someone can help me out a little that would be amazing :smiley:

Sorry for double post the website kept timing out when i tried to upload a pic and update my post with pinout :roll_eyes:

Connections to arduino are:- (Max7219) 5 csload 6 clk 7 din (Encoder) 11 white 12 green

Edit:- just had a root around i have a couple of LM3914s maybe these could work for the bargraph display? or failing that could i just use the MAX7219 chips and wire them up as follows - 7 segs + dp = 8 segs i need 30 for the 3 bargraphs so in theory i could drive 3 loadmeter bargraphs for all axes with 1 chip (max 64 LEDs) all with 3 SPI connections?, that would definetly save on pinouts from the arduino could probably fit my tachometer on the same arduino if some coding wizard could teach me the ways ;D

The LM3914 looks suitable for your VU display. It's designed for just that kind of application. If you use those, you don't need the Arduino for the VU displays as the LM3914 takes care of it all (it takes an analog input, and shows a number of LEDs based on that).

That MAX7219 chip is designed to drive a single 8-digit 7-segment display, as it's multiplexing. It has 8x enable outputs, scanning the displays, and 7 (or 8, for the d.p.) output lines to drive the actual LEDs. So your display must have those enable inputs. I don't think you can get them to do the VU graph, as you provide the number for the MAX7219 to display, not which exact LEDs.

You can for sure use the encoders to measure RPM, that's a bit more tricky to code but you can likely find examples all over the place. You'll most likely need to use interrupts to catch all the encoder pulses.

Spent a couple of hours last night trying to get it to work, altering code to do what i want however i could never get it to work, tried using the led.control.h with a sketch for rotary encoders but no luck, i havent done any arduino code before so am a bit out of depth, could someone please help with the code, maybe label each part with its function?

could someone please help with the code

What code?

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :slight_smile:

Yes no problem i shall upload a circuit diagram when i get home from work, the code was random examples of different 7 seg max7219 sketches bodged together with rotary encoder sketches, its probably best if someone could help me start from scratch as i might aswell be blind when it comes to coding, i can alter basic sketched pinouts etc, dont know how you interface 2 devices or write from scratch.

Okay the circuit pins are arduino:- 5>(cs load) 6>(clk) 7>(din) 11>(encoderA) 12>(encoderB) , max7219 is wired as per datasheet for common cathode displays, the display is a 4 Digit 7 segment display with 12 pins, digits cathodes are connected to dig 0123 of the driver, anodes are wired to the segment pins - i used a small power source to figure out the correct segments and digits as i bought these awhile ago and model number has rubbed off, tested with an ledcontrol.h example that scrolls the letters > arduino123456789. All segs digits work perfectly just need help writing code from scratch as im clueless, tried editing other peoples examples and mixing parts together but nothing worked, also had extreme difficulty finding an RPM digital tachometer 7 segment display example that uses AB quadrature encoder signals, if theres a coding wizz that can help me out maybe explain what parts of the code does what and what works i would be happy to learn, Thanks.

There are two parts to your code.

  1. displaying a message on a display (you apparently have that one under control).
  2. reading the speed from a tachometer (I'm sure there are lots of examples for that).

Get each working separately; put them each in their own function; merge the two sketches; then you can read the speed and display the value.