I’m trying to build network controlled very simple 3D printed model radio telescope with PI zero and geared DC motors
I need board that read POT and drive motor base on PWM.from PI zero as picture below ( basically, board that inside servo motor)
Hi Kun
I can’t quite get my head around what exactly you are trying to do here.
It would appear like you are trying to make this motor act like a servo motor. If that is the case why not just use a servo. Much simpler
I assume the above as your sketch indicates the geared motor driving the potentiometer which in turn tells the “board” something which I assume modifies the motor drive from the Pi Zero. What tells the “board” what is required?
I think you need to have a close look at your description and sketch and try to be a bit clearer as to what you need to do please. Do you need something like a servo or a brushed speed controlled reversible motor.
Cheers Bob
The board would measure the pulse width from the Pi Zero and move the motor till the potentiometer matched. It could be done with discrete analog parts or a micro like the ATtiny85 (something I have been playing with recently)
Micro detects pulse high, starts timer, when pulse goes low it knows the angle to move to by the width of the pulse. It then reads the analog input voltage from the potentiometer and drives the motor till the voltage matches a predetermined value for the angle.
The board would have a mico, motor driver and some other components like voltage regulator etc.
Anyway, designs like this don’t happen without careful consideration of all aspects and heaps of testing.
Best of luck.
Jim
You haven’t indicated what problem you have run into with the project, but you might get some ideas for solving it with this description of how it has been done: Build a Custom Servo Motor with a DC Motor - YouTube
I’ve built a camera slider/pan/tilt platform for time-lapse photography and have used a Pi and a custom made board to do the same thing.
You dont actually need the custom board, you can run it from the Pi Zero easily, just with a motor driver H bridge and an encoder motor.
Im using these:
Basically you can read the A and B channels from the encoder as interrupts and determine the direction of travel and numbers of steps.
This will give you a feedback loop where you can direct the motor to turn for a certain number of steps and the encoder will report back on the progress.
You will need to keep in mind that these type of motors spin very fast and do have an over-run value, so that will determine the minimum number of steps that you will be able to command the motor to move.
ie on my setup I get about 30-40 steps over-run, so I cant tell the motor to move any less than say 50 steps. I log the over-run and take it off the next move so that everything lines up in the long run, but the best solution is that you gear everything down so much that 40 steps is very very small.
eg on my PAN axis the number of steps per degree movement is 1900 steps per degree, so I have a resolution of approx 0.02 degrees as the minimum movement.
Now you can, as said previously, use a Servo and Servo controller that is going to be plug and play, however you dont get the feedback loop and it isnt driven in the same way. ie you cant command a servo to go to a position, exactly, you tell it to move a certain amount and it will do what you say, but you dont know if it is there.
The whole design depends on your use case.
If you have an external feedback loop such as signal strength, then you can use that to tune the positioning, otherwise you will want to be hitting your calculated positions.
The DFRobot tiny little DC Encoder motors are excellent and Ive been using them for 3 years or so and had no issues with them and I am asking them to move large loads
Thanks for sharing your experience with your own build, that must have been quite a process to get it to the precision you needed when you can’t use the off-the-shelf solution of a basic servo and need closed-loop control.
Also thanks @Robert93820, @James46717 and @Jeff105671 for asking the right questions to get us to why it needs to be approached this way and seeing through the obvious answer to the crux of the problem.
As James has mentioned we have some servos with feedback, but if you’re after really high-resolution movement Andrew’s custom-built approach is likely the best path forward.
3 channel DC Motor control
3 channel encoder processing (processed before it gets to the Pi so that you just get a direction and steps # flag)
2 channel MOSFET switching for external devices
SPI breakout
RF24 wireless breakout
5v input for Pi
specific motor input so that you can run different voltage motor types
Piezo buzzer
Raspberry Pi GPIO header
3 x RJ45 headers for connection to the motors to have motor control and pass back the encoder data.