-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using a Servo motor for Steering #123
Comments
Does the car move forward when you press left and right arrow keys? Or do the front wheels just turn? Have you defined |
@zfhall Just the front wheels turn, The only changes made were the declaration of the servo, the SetAngle function and setting the angles inside of the def's, as posted above. Thanks |
I have also had the humming-but-no-movement issue before, but it’s been awhile since I last had that problem so I don’t recall the fix off the top of my head. I’ll reply back here if I remember though. |
Actually, I had a temporary issue earlier today where I couldn’t turn but only move forward/backward, but that was due to crossed/touching wires (I did a poor job soldering and have exposed wire metal). As soon as I moved the wires apart from each other the car was able to turn again. Not sure if that’s your extact issue though. If it’s never worked for you I would also double check that you plugged the wires into the correct GPIO pins on the Pi. |
What motor control chip are you using? The L293D and L298N cannot handle high current DC motors. If you are using one of these chips, it's likely that the voltage drop across them is so large when a load is applied, that there is next to no voltage being sent the motor. Try the Cytron MD10C DC Motor Driver instead. |
@RyanZotti I doubled checked the wiring and I don't see any issues. I can try a deep check. @zfhall I am using the L293D motor contoller, but I don't know if thats the issue since the servo is connected to the RPI and there's only one motor being run from the controller. I think it might be an issue with the edited code because after some more testing it seems that with my servo code up top- I get really bad latency/performance issues with driving forward and back: I would press the up arrow and a few seconds later the motors would come on shortly and then full power for a few seconds. However, with servo steering there is a bit a latency at first but later little. I also tried running the servo code with servo unplugged and got same issues moving back and forth. |
@Charlieglider I may be missing something here, but if the motor connected to the L293D is used for forward/backward control, and you are having problems driving forward/backward, then the L293D could still be at fault. Does the forward/backward motor ever run continuously without cutting out? What car are you using? Does the DC motor (not servo) have a serial number? It sounds like you have the same setup as I do, and I had this exact problem until I switched to the MD10C. If you have a multimeter, try measuring the voltage sent to the motor when you tell it to drive forward/backward. If the voltage is lower than your battery voltage, you likely have a problem with the chip. |
@zfhall Apologies for any confusion, when I run the normal drive_api.py (no changes/servo added in) I get decent driving performance forward and back (no left and right capability because I am using a servo). However, when I run drive_api.py with my changes made above and the servo added in, I get the steering capabilities but get choppy driving or have the forward/back motor running continuously without cutting out. I can try measuring the voltage at the motor, I also think I'm losing power/performance somewhere, but it might be a separate issue to the one with the servo. |
@Charlieglider Ah OK, that makes sense now. I'll try and have another look at your issue when I next get the chance. But I'm going to quite busy over the next few days so hopefully, someone else can chime in with a solution. Good luck! |
@zfhall Ok, thank you. |
I know it has been a while since the last post on this issue. Nonetheless, any ideas for getting this car to work with the servo? |
I am attempting to implement a servo motor to steer the car.
This allows for more precise and variable turns, since the servo is able to turn to a specific angle instead of just switching directions (left or right in this case).
So far I have got the car to turn right and left when the corresponding arrow keys are pushed. However, when I press the up and down arrows the car doesn't move and the servo makes a slight hum, but doesn't move much.
These are the additions I made to the drive_api.py program, mostly found online.
Declaring the servo at the top of the program:
SetAngle function near the bottom of the program that handles servo movement and logic
Setting the angles for left, right and stop:
If anyone might know why I am getting the issues above, please comment.
Thanks.
The text was updated successfully, but these errors were encountered: