I am using Pololu’s SMC04b (electromate.com/db_support/d … 04S014.pdf) and I cannot understand from the manuals whether I can send tachometer feedback from the motor to my computer through the controller’s serial port. Is this even possible? Or was the controller built to that tacho feedback was only supposed to be read by the SMC04b and not by the computer that’s serially commanding the controller?
What I HAVE been able to do is look at the error feedback information (mentioned on page 13 of the SMC04b manual) by using the following commands in Python on Ubuntu 10.04 (running on an ASUS Eee PC EeeBox):
$ import serial
$ s = serial.Serial(port, baudrate)
The read() command gives me the two bytes of error data specified in the manual, but I’m more interested in inspecting the real-time tachometer feedback. I want to use this in my code to compare the actual speeds of two motors on two Pololu controllers, eventually setting up a differentially-driven robot that can drive in a straight line and correct for errors when turning. The EeeBox will be mounted on-board and will do all the controlling.
So to sum up: There is a tachometer signal coming from a wire at the bottom of my motor. I do not know how to connect a single wire to my computer’s serial port, so I want to know if the SMC04b already provides a way for me to connect my tacho wire to the controller so that I can access it through the controller’s serial port. If this is in the manual, I have not been able to find it.
Thanks, and please let me know if I need to elaborate.
Unfortunately, the feedback error information you are already reading is the only sensor reading you can get. By the way, the SMC04B is an old product we have not sold in a while. The Jrk 12v12 is its far superior replacement, but I think even that would not really work for your application. A tachometer ultimately is not enough for you to do position control on your differential-drive robot; you need encoders (which none of our motor controllers at this point support).
Thanks, Jan, that should save me a lot of time. So even though there is a rotary encoder built into the motor I am using (when I said “tachometer” in the first post I may have sloppily been referring to the encoder - I assumed they basically performed the same function and were interchangeable), the SMC04b wouldn’t be able to transmit any info from the encoder back to the computer that’s directing it? However, I gather the SMC04b does make use of encoder feedback to generate PID error messages for the computer. I’ve connected Ground, 5V, and the encoder output the the [GND Vcc Tachometer-In] pin group on the SMC04b, so the controller uses the tachometer information internally but cannot send it over the serial port. Is that right?
You need an encoder (both channels) to know which direction you are going, and you probably want to maintain cumulative counts for the two motors. The motor controller you have uses frequency only to do speed control, so it has no internal total count, and it assumes that the direction is correct based on the direction of the output. Here is a little more detail: if you tell the motor controller to go at some speed, it will compare that to how many counts it gets on the tachometer in a PID period, and that will be the error that is available over the serial line and which is used to update the power to the motor.
I know of some customers who used the controller to do closed-loop speed control but still kept track of the position info separately. So, for instance, your main controller could tell your motor to go at some speed, and not worry about maintaining that speed as your robot moves from tiles to carpet, but the main controller would still read the direct encoder outputs to calculate the robot’s position.