South Africa
Asked — Edited
Resolved Resolved by Rich!

Trying To Get The Esc Into Reverse (Tamiya 101Bk)

Hi,

I'am having trouble with my programming, I cant seem toe get the ESC to go into reverse. I'm a new user of the ARC software so it could just be me interpreting the code wrong but this is what I wrote to try and get the ESC into reverse.

Move(D0, "stop") Movement_Wait("stop") Move(D0, "reverse") Movement_Wait("reverse") Servo(D0, 100)

Every time i run the code it tells me that there is a problem with the word "stop".

Any help will be greatly appreciated.

(I'm using the key control to control the movements)


ARC Pro

Upgrade to ARC Pro

Synthiam ARC Pro is a new tool that will help unleash your creativity with programming robots in just seconds!

United Kingdom
#1  

First, the Move() command is for Modified Servos. Are you sure this is the correct command?

Second, you need to remove the quotes for the move commands. Edit: Quotes are needed.

Also, the Movement_Wait() commands are redundant in your code. It would act the same way with or without them.

your code should look like;

Move(D0, "stop")

Move(D0, "reverse")

Servo(D0, 100)
South Africa
#2  

I tried your code, but the ARC software tells me "Missing String Quotes or Invalid Expression: stop "

So I assume it has something to do with the word stop, but I don't know how to resolve the issue.

South Africa
#3  

And sorry, I'am not sure that the First, the Move() command is for Modified Servos. I'am new to all of this, trying to build my first robot.

#4  

Are you using modified servos or gear motors to drive your robot? The Move command is for servos that have been modified for 360 deg rotation... Geared motors are a whole different animal... You will need to use something like the Forward() command or the Serial command if using a Sabertooth motor controller or H-Bridge... If you don't know, maybe you can show us a picture of your robot and it's motors?

#6  

ESC as in a motor speed controller? What about your motors themselves? what are you using? PWM might work with the ESC then

South Africa
#7  

Oky, can you please give me an example of how the code would look.

#8  

Depends on the motors you are using... We really need to know what motors you are using... An ESC is a speed controller (for DC motors) that I used to use when I was into flying electric model planes... I didn't know they could be reversed other than swapping + and - wires around on the motors... Anyway PWM(D0,$duty) .. where the variable $duty can be any number from 0 - 100... 0 is stop and 100 is full power... But I am still struggling to understand how you would get ESC controller to go in reverse...

EDIT Looks like it can be reversed... my experience is limited when it comes to ESC as I only have used them for flying where there is no need for reverse... Anyway, try PWM and see if that will drive your ESC...

PWM(D0,$duty) # $duty is any number from 0 to 100 
United Kingdom
#9  

Sorry, my bad, you do need the quotes around the movement direction. I was responding without ARC or EZ-Script manual to hand.

That said, the original code works. I just tried it in ARC and the code runs without error.

As for controlling the ESC, what does it say in the datasheet?

United Kingdom
#10  

OK a quick google and on the Arduino forum it says that you control this ESC as you would a servo.

Not having any information on the ESC nor having ever used one I can't test it however if you follow the procedure for a Modified Servo, add the modified servo control and configure it for the correct port, provided the Arduino community are correct it should work.

If you can try that and let us know it'll save digging around for a decent datasheet on the ESC.

South Africa
#11  

My builder gives me an error message. I don't have a data sheet for the ESC, it came with a rc car that I bought 3 years ago.

As for the PWM it does not work that good and it would not go into reverse.

South Africa
#12  

The code runs now, but the motor keeps on going forward.

#13  

Rich, I think you're on to something... Since PWM doesn't work well, we need something in ARC that will mimic radio controller pulses... So shouldn't modified servo command work as you suggested?...

United Kingdom
#14  

What about using the Modified servo control?

If that doesn't work then the datasheet will be needed to see if we can figure out how the ESC is controlled.

As far as I can find out online from quick searches, PWM should work. Some experimentation may be needed to work out what PWM value do what to the ESC though. This is something you would have to do unless someone else on here also has the same ESC (which is doubtful).

To be honest, why use the ESC? Replace it with a H-Bridge and you will make everything so much simpler.

United Kingdom
#15  

OK, I stumbled upon something else...

Does your ESC have a button on it which is used to set the values for neutral, full acceleration and full reverse? According to one post online it does.

It runs from PWM. You will need to calibrate it to the specific PWM values. The you will use those PWM values to control it.

Before I go about explaining the best way to do that please tell us if there is a button on it for calibration.

PRO
Synthiam
#16  

PWM command is not a good idea because it is a modulation range between 0% and 100% . An ESC takes a similar PWM range as a servo. The PWM of a servo is not 0% to 100%. With the PWM command, it will be a lot of guess work to identify the PWM range of the ESC.

For reference, the PWM of a servo is different and explained in detail on the servo page for the v3: https://synthiam.com/Tutorials/EZBv3-Servo.aspx

Now, the question you are waiting for.. How do make the ESC work? Well, firstly if the ESC is your method of movement, then use the Modified servo Movement Panel. Therefore in EZ-Script, you would use the Stop(), Forward(), Left(), Right(), Reverse() commands.

If the ESC is not your method of movement, and perhaps used for controlling an ARM or something - then use the Servo() Control. This is because the ESC receives PWM similar to a servo. So, in this case you would need to identify what appropriate PWM commands work with the ESC.

On a v3, try this

Servo(d0, 10) <- that should move one direction Release(D0) <- that should stop the motor Servo(d0, 90) <- that should move the other direction

If those don't work, try changing the numbers like this...

Servo(d0, 11) <- that should move one direction Release(D0) <- that should stop the motor Servo(d0, 89) <- that should move the other direction

Servo(d0, 12) <- that should move one direction Release(D0) <- that should stop the motor Servo(d0, 88) <- that should move the other direction

Servo(d0, 13) <- that should move one direction Release(D0) <- that should stop the motor Servo(d0, 87) <- that should move the other direction

Etc... EZ-Robot did not make the ESC. And no ESC's or Servos follow any standard what so ever... So it's literally impossible for us to have a single parameter that works with all ESC's and Servos. The only way to make it work is to find the appropriate servo PWM value for your ESC.

South Africa
#17  

I tried the modified servo Panel, but it did not work. I live in a small town, so there is no chance that I would find a H-Bridge here, I would have to order it online.

United Kingdom
#18  

There is a set button on the Tamiya TEU-101BK.

To calibrate it follow these steps accurately and carefully.

When you first power the ESC up the LED should flash red once. Run the code Release(port) where port is the port it's connected to. Now press the set button. Now run the code Servo(Port,90) Now press the set button. Now run the code Servo(Port,10) Now press the set button.

It should now be calibrated and work like a modified servo. You will not have to calibrate it again once you do this once.

Note: The above is based on DJ's servo positioning code above. We may need to experiment a little still but I am sure we are heading in the right direction.

For more information on this ESC have a read of the manual

South Africa
#19  

FOUND IT!

The code that works for me is:

Move(D0, "reverse") PWM(D0, 8)

#20  

Just tested DJs suggestion... Servo(D19,90) and Servo(D19,12) works (full forward and full reverse) on a Vex single motor controller... And the closer I get to 50 on either 90 or 12 the slower the motor runs... Cool... Learned something new and now I can use more of the cheap Vex motor controllers in my projects instead buying and using the more expensive sabertooths... thanks...

PRO
Synthiam
#21  

@Bernard please re-read my post, please, please... Do not use the modified servo control. You must use the Modified servo Movement Panel. Notice the difference in words.

For example, the words "modified servo" are only 2 words. The words "Modified servo movement panel" is 4 words. Notice how they are different? :)

Your example code does not make sense. Using the Move() and PWM() functions together do not make sense.

Please re-read my last post. Have a cup of tea between reading it. Then read it again :)

United Kingdom
#22  

Throwing this out there as I think it may clear some things up, at least for us trying to help here.

The Tamiya TEU-101BK operates a single motor.

With that in mind, the Modified servo Movement Panel may not be the correct control for this operation. If it is only capable of moving an object in a forward or reverse direction then the Modified servo control, correctly configured for the forward and reverse servo values may be better suited.

To be honest, I would try the Modified servo control (not the Modified servo Movement Panel) first.

  1. Add the Modified servo control to the project
  2. Configure it for the correct port and desired servo positions for forward and reverse
  3. Power up the EZ-B and ESC
  4. Press the STOP button on the Modified servo control
  5. Press the SET button on the ESC (for longer than 0.5 seconds). The LED should flash
  6. Press the directional arrow on the Modified servo control for Forward
  7. Press the SET button on the ESC. The LED changes to a double flash
  8. Press the directional arrow on the Modified servo control for Reverse
  9. Press the SET button on the ESC. The LED should turn off

The ESC should now be calibrated to the Modified servo control.

Test it now by clicking on the Forward button on the Modified servo control or using the script command Move(D0, "Forward") - assumed it's connected to D0, change port to suit.

Now try the Reverse button on the Modified servo control or use the script command Move(D0,"Reverse") - assumed it's connected to D0, change port to suit.

Now try the STOP button on the Modified servo control or use the script command Move(D0,"Stop") - assumed it's connected to D0, change port to suit.

If the manual is correct this should have worked and now you can use the Move() command in EZ-Scripts or use the Modified servo control to have the motor move forwards, reverse or stop.

For more information on the ESC (however limited to calibration and fault finding) it is available here

For more about the Modified servo control click here

For more about the Modified servo Movement Panel click here

If your intention is to use it for movement of your robot then you will require the Custom Movement Panel plus some scripting or, if using 2 ESCs for movement the Modified servo Movement Panel and both ESCs correctly calibrated.

South Africa
#23  

Thank you for all your help, much appreciated.