Go Down

Topic: Advice and guidance needed on my RC project (Read 5080 times) previous topic - next topic

gunnlaugursig

I went and bought the parts I need to build the L293 H-bridge.

But I have three question,

  • What's the purpose of the potentiometer in my steering servo?

  • Should I continue to use it in my set-up?

  • How do I connect it?



Thank you.

gunnlaugursig

Hi Chagrin

I created the H-bridge in the link you shared with me but found out afterwards that the wiring was incorrect. This link/picture should be taken down to prevent confusion. I went for this VIN set-up instead and it worked as intended.

I still have three questions and would be very pleased if you could help me and answer them if you can,

  • What's the purpose of the potentiometer in my steering servo?

  • Should I continue to use it in my set-up?

  • How do I connect it?



Thank you again.

Chagrin

I stated that earlier:


The light green, white, and yellow wire are attached to a potentiometer. Green to 5V, white to analog pin, yellow to GND should do it. The analog reading should tell you the steering position -- see the potentiometer example for more help.


Assuming you've got your H bridge connected to your steering motor and have managed to get the wheels to turn in either direction, what you need to do now is create an algorithm to take readings from the potentiometer and also drive the motor until the desired reading is reached.

gunnlaugursig

Ahh...sorry I missed this part
Quote
the analog reading should tell you the steering position

gunnlaugursig

#19
Jul 26, 2013, 03:43 pm Last Edit: Jul 26, 2013, 03:46 pm by gunnlaugursig Reason: 1
Hi Chagrin

I hooked up my dc motor potentiometer and got the reading 0-63 which is 1/16th of a potentiometer 0-1023 range if I understand this correctly. I also know I need to do some sort of calibration to find the max-left and max-right values to make sure my motor wont move beyond my chassis maximum steering angle which I think is around 90o.

I've searched this forum and googled this subject but not found anything that matches my scenario. I know how to achieve this with a regular servo using the servo library but I must admit that I'm totally lost when it comes to my dc motor/potentiometer. Any help would be greatly appreciated.

Thank you.

spruce_m00se

Hi
What voltage are you feeding into the potentiometer? maybe the max voltage out is too low and thats why you only get the reading of 63?
I would check that the poteniometer can handle the voltage you need to put into it before you increase voltage if thats what you plan to do.
If not, and assuming you can afford to lose the resolution by dropping to onyl 64 steps then you can just turn the wheels manually, and read the pot at each extreme, then treat those as your limits,

I would also write a line to take car of limits beyond those extremes, it is feasable that the car could get a knock on full turn and force the wheels a little over the limit, which if not dealt with could cause your sketch to freeze.

How easy was the h bridge to build? I thought about making one in the past, but i just purchased one pre made, I have only used a single transistor for one driectional movement so far,

gunnlaugursig

Hi spruce_m00se,

I'm feeding 5V from the UNO while it's connected to a 9V box battery. I don't think the voltage is the problem because if I rotated the 5V and GND on the potentiometer I get 959-1023.
There are no markings on the potentiometer as to how many ohms it is. How can I check how many volts it can handle?

If you look at the pictures in my first post you see my steering housing with the build in potentiometer and dc motor. There is an arm on the potentiometer to move it back and forth and when done it gives the readings I've described. I would think that reading of 0 is max-left and then 63 max-right but I might be wrong here. What do you think?

When I have something to work with and understand the relations between the potentiometer readings and how to make sure the motor only turns, let's say 45o left and 45o right, I'll add code to my sketch to make sure it won't try to go beyond these angles.

The h-bridge was fairly easy to build. I bought L293D and followed this tutorial and went for the VIN setup.

Any idea or hints how you would handle my situation in a sketch would be greatly appreciated.

Thank you.

andsetinn

I would replace the servo with a standard RC servo and use one of many RC servo libraries to control it.
If you want to use the mechanical parts from this servo, it might be enough to get the control board from (almost any regular) servo, connect that to your servo and then use the servo libraries. It saves you many hours of designing circuits and writing code.
Smabilar.is and Tómstundahúsið both have selections of standard servos (located at Bíldshöfða 16 and 18, same street as Húsgagnahöllin). sbki.is and frettavefur.net are nice Icelandic RC forums where members might have old servos for low price.

gunnlaugursig

Hi andsetinn,

Thank you for your information about the Icelandic shops and forums.

I've already bought a standard servo and it's shipping when this is being written, but I want to understand the function of my servo and the relations between the potentiometer and the dc motor in it.

I have no problem building these circuits or writing code since my profession is programming but the understanding of the parts must be there before I can do any coding.

andsetinn

In short you need to read the potentiometer (analog position sensor) and then you switch polarity on the motor to have it turn in one direction until the potentiometer reaches desired value (position).

If you use servo circuit: You send pulse to the circuit to tell it what position it should be in, the circuit reads the potentiometer and drives the motor until the servo reaches the correct position.
The length of the pulse tells the servo what position it should seek. if I remember correctly 1 ms is all the way to the left and 2 ms is all the way to the right.

I'm sure someone in the icelandic forums has servo with broken gears that you can get and use its circuit with your servo. Have a chat with Pálma at Smábílar.

gunnlaugursig

If I understand the function of the build-in potentiometer correctly it only serves as some sort of calibration mechanism for the steering to make sure it wont go beyond what the steering mechanism can handle. How I use it to handle this limitation is what I find hard to understand. I.e. the translation from the remote control readings to the actual turning of the steering wheel.

andsetinn

Strictly no, you're thinking of this as being complicated. A mistake I do too often myself and end up going in circles :smiley-red:.
The potentiometer is not for calibration and by itself does not limit anything. It is a passive analog position sensor of the servo output gear. It just sits there and quietly changes its value when the servo output gear moves. It does not tell anyone and no-one knows it's value (servo position) until the controller reads it. The controller reads the value and depending on parameters does nothing, drives the motor clockwise or counterclockwise (also turning the potentiometer) until the potentiometer has the value that fits the programming of the controller.

The motor turns the servo output through gears, the controller limits the turning of it and the potentiometer shows its position.

One thing to keep in mind is that if the controller does not read the potentiometers value with enough frequency, the servo may be constantly overshooting its intended position so it's jittering back and forth which can drastically reduce the life of the servomotor. Other thing is that if you use Arduino to control the servo motor directly plus reading the potentiometer for its position. Then, when the Arduino is turning the servo in one direction but gets stuck in a loop, the servo will continue to turn until it has reached the limits of the mechanical equipment and gets stuck. Then it will either break some part or the magic smoke will be released. That is why I recommend that you use dedicated servo control circuit and send the required position signal to it.

Go Up