I am using the Bosch Seat Motor accompanied with its DIO Kit for encoder input and hooked up to a Victor SPX motor controller plus two limit switches (min and max position). I am having trouble approaching how I would control the motor with fine precision so that I can set a range that the motor can rotate in and set a position to rotate to move a component. Similar to how an axis would move and home on a 3D printer.
Basically I want to know how to move the motor a certain amount of armature rotations and have presets for the motor to rotate to.
Currently I have looked at WPILib’s Counter class and gotten it to record armature rotations. However accurately reporting its rotations is not working. I do ask for people who have used this motor to share code samples for precise motor control.
We tried using these last year. Please don’t do it. Whenever we tried to get any usable data from the motor or adapter, we got super messy signals (viewed on oscilloscope) and no usable data. If you want to use this motor, I would find a way to use the Rev through-bore encoder or a CTRE mag encoder.
I’m almost certain this isn’t possible to do accurately onboard any motor controller. You could try plugging it into the Rio and using one of the encoder classes.
We tried plugging this into a talon last year and couldn’t get it to work. I believe we tried to do it manually with one of the pins on our breakout board with no luck. I don’t have any experience plugging it into the Rio.
The Talon requires Quadrature encoder the Bosh is not a quadrature encoder. I think about 5 or 6 years ago we used it and made a board like this (was published on CD back then)
It uses 1 half of an opamp for getting a direction signal (fwd/rev = High/low) by comparing the 2 motor leads. and a 2nd comparator and capacitor to turn the signal from the encoder into a clean ttl signal. Then 2 flipflops with some inverters and gate logic turn it into a quadrature signal. R1 is a pulup as the output of the encoder is open collector if memory serves correctly and Vref between r2 and r3 supplies a reference voltage between the H/L of that encoder which I think (its 5 years was about 3.something Volts. R7 and R5 and R6 and R4 are voltage dividers and connected to the motor leads (to turn a potential 12 V into less than 5 to not blow the op amp that runs at 5 V VCC to give a nice TTL signal for the 7LSxxx circuit I think at a later version we added a capacitor there to get rid of some of the noise but i could not find the latest version ATM. Next year we might include a circuit like this more generalized (with trim pots) on our Talon SRX and maybe SPARk interface boards to allow the use of regular (non quadrature) encoder with those motor controllers. Well If I find a student willing to dive into that