Zackbot
Posts: 3
Joined: Wed Jan 11, 2017 7:09 pm

Raspberry Pi 3 + steering servo

Fri Jan 13, 2017 5:27 pm

Hi,

I have a raspberry pi 3 with a L298N motor board. I am trying to control a steering servo of an RC truck (pic attached).

Is there a way to control that steering servo through the raspberry directly or through the L298N (GPIO ports)?

Otherwise, how can that motor be controlled?
Attachments
Steering_Servo.JPG
Steering_Servo.JPG (16.39 KiB) Viewed 2459 times

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Raspberry Pi 3 + steering servo

Fri Jan 13, 2017 5:39 pm

Do you know hoe servos work?
If not, I suggest you look that up.
Then look for a forum which talks about generating PWM signals on the GPIOs of the Raspberry-Pi.

mattmiller
Posts: 2243
Joined: Thu Feb 05, 2015 11:25 pm

Re: Raspberry Pi 3 + steering servo

Fri Jan 13, 2017 8:15 pm

Then look for a forum which talks about generating PWM signals on the GPIOs of the Raspberry-Pi.
em - I don't know how to directly help the OP but this IS a forum for discussing generating PWM signals on the GPIOs of the Raspberry-Pi. :)

Looks like 2 wires to control the motor - I'd try out wiring your motor controller to the GPIO pins and get it to to one way and then the other
(Many many examples to be found on this by searching this forum/internet)

Once you've got that going then you could investigate if the other wires are signalling the position/speed of the main shaft

pcmanbob
Posts: 9465
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Raspberry Pi 3 + steering servo

Fri Jan 13, 2017 8:35 pm

I would be careful just driving the motor using a motor driver board if this in fact is a servo and it does look like the mechanicals of a normal servo just bigger then you can only drive it about 120 deg maximum before you do damage to it both mechanically and probably electrically.

you will probably find the 3 extra wires are connected to a potentiometer which you can prove using a simple multi meter set to ohms, my guess is that the electronics normally found in a servo were on the circuit board of the original controls.

my advice proceed with caution make sure you know what you have before applying any power to the device or you may destroy it.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Zackbot
Posts: 3
Joined: Wed Jan 11, 2017 7:09 pm

Re: Raspberry Pi 3 + steering servo

Fri Jan 13, 2017 9:11 pm

Well the only part I am not sure of is what those 3 wires do, but from what I can see they most likely report the speed/rotation/location of the gears back to the small board (hence the total of the 5 wires).

There is a small board in the RC car which all those 5 wires connect to (as well as the rear DC motor, and the battery).

Ideally, if the raspberry pi can "communicate" with that board, that would be ideal, and the simplest, but I am not sure if that is even possible.

So in theory I could make the RC car move forward and backwards easily with the DC motor and the L298, but the front is proving to be more challenging for now. I would probably need a special board that would be able to interpret the 5 wires out of that servo, and have the Pi do the rest, but even then, the programming involved would be very tricky...

pcmanbob
Posts: 9465
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Raspberry Pi 3 + steering servo

Fri Jan 13, 2017 9:27 pm

Hi

As I said from the picture its probably a potentiometer you can just make it out in the picture, this is just a variable resistor and is used by the electronics normally associated with a servo to report its position.
its the electronics bit that you are missing which as you said is probably on the original circuit board, if you can workout which part of the circuit board controls the servo you may be able to inject signals from the Pi in to the circuit but I doubt it will be easy.

might be useful in explain how a servo works
http://www.seattlerobotics.org/guide/servos.html
https://www.youtube.com/watch?v=bu3SPwzcocU
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

pootle
Posts: 389
Joined: Wed Sep 04, 2013 10:20 am
Location: Staffordshire
Contact: Website

Re: Raspberry Pi 3 + steering servo

Sat Jan 14, 2017 9:33 am

a 'normal' radio control servo has 3 wires - ground, positive and signal, and can be driven directly from a raspberry pi GPIO port and power pins (for small to normal sized ones at least).

Internally they have a motor, a potentiometer and a small circuit board. The circuit board compares the actual position of the servo with the signal position and drives the motor accordingly.

In your case it would seem that the manufacturer has decided to put the control circuit elsewhere (probably so there is just one PCB for the whole toy). The LN298 will drive the motor but cannot be linked to the potentiometer, as this requires an analogue input which would need a separate board.

It would be quite complex to make a raspberry pi do the work of an rc control board - it would probably be much easier to buy a normal rc type servo with the same size / power motor, and either use that servo directly, or to strip the control board from the servo and use it for the servo you have - but the motor power and pot type would have to be close matches.

Zackbot
Posts: 3
Joined: Wed Jan 11, 2017 7:09 pm

Re: Raspberry Pi 3 + steering servo

Sun Jan 15, 2017 9:35 pm

Thanks for the replies.

pootle: I agree, it wont be easy unless I replace the entire servo or tap into the RC car's board, which is another story...

Return to “General discussion”