Twitching Servos - PIC Red Light Battery Status

Hello everyone,

I am having problems with my PIC microcontroller. When a modular motor is plugged in, the code downloads and runs well.

However, when I 1) swap that modular motor for a servo motor

or

  1. add a servo motor into the code to run with the modular motor

The motor(s) begin to twitch and a red light flashes in the battery LED section. I’m also unable to download the code and get an error message saying “cannot change robot baud rate” or “can not communicate with microcontroller”. I’ve been stuck on this issue for a while. I don’t think it is the micro controller because I used a second one, and it has continued to do the same thing. I have also re-downloaded the master firmware and it briefly worked, but then it went back to not working.

Thanks for the help in advance.

Is this a three wire motor, or a two wire motor?

Three wires. It’s the motors that came with the starter kit. Thanks for the help!

OK… If it was a Two Wire Motor, I would have suspected the Motor Controller 29.

So far, I can not think of a reason why this would be an Issue… More Question in my next post…

A Single, Three Wire Motor, say in Port #3???

Remove Single, Three Wire Motor, Port #3, Replace with Servo???

or

A Single, Three Wire Motor, say in Port #3 and A Single, Servo, say in Port #5???

It sounds like a Massive Power Draw… I am assuming that the Motor(s) and Servo are mounted on your Robot??

If you plug a Motor and a Servo in, that are not Mounted to the Robot, just hold them in your Hand, do you get the same reaction from the Vex Controller?? Depending on your Mechanical Design, you might have a Motor and a Servo Fighting Each other…

Note that the Three Wire Motor is Continuous Motion and Rotates the Opposite Direction that the Servo Moves, which is not Continues Motion, but movies to a certain Position…

You might very well need to post your Code, or a Subset of it that represents the Problem, as well as a Diagram of your Motor(s) and Servo, and what they are attached to…

Thanks so much! I appreciate the help. I think it might be a power drawing problem because I’m using alkaline batteries (AA) and the manual the VEX kit came with said to use NiCd batteries instead.

Then again, I made a VEX robot 4 years ago with alkaline batteries that had 2 modular motors and a bumper sensor attached and it worked perfectly. Actually it still works and runs the code whenever I turn it on.

Perhaps there is something I am not setting up correctly in my RobotC code. I’ll post that code, a description of the robot, and what it’s goals are when I get to my lab in an hour.

Thanks!

All right so the main goal of the project is to create an animatronic mermaid. One servo motor will be used to modulate the tail up and down as long as the sonar sensor reads that it is further away from an object than 10 feet.

A second servo is mounted towards the front. This controls a horizontal turning rudder underneath the mermaid’s body. The plan is for this servo to work with two light sensors. When the the right light sensor receives more light than the left, the mermaid will turn right. Same case for the opposite direction.

I have 2 PIC microcontrollers that I can use so I was thinking about programming the light sensors and steering servo into one and the sonar and tail servo into the second one.

I just tried running a simple test and the robot wouldn’t cooperate. Originally it wouldn’t download the code and kept telling me that it “ROBOTC was unable to communicate with the VEX controller”. Then I got it to download this simple code to run one servo (on port 8) back and forth:

#pragma config(Motor, port8, port8, tmotorNormal, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{

motor[port8] = -40; //Set position backward
//motor[port1] = 100;
wait1Msec(500); //Wait for 0.5 second
motor[port8] = 40; //Set position forward
wait1Msec(500); //Wait 0.5 seconds

}

It worked with a modular motor. When I plugged in the servo motor in port 8 instead, the light in the battery power section flashed green and red back and forth and the servo twitched infinitely instead of performing the code. I just tried re-dowloading the code and got the error message that ROBOTC couldn’t communicate.

Is there something wrong with my coding? I’ve had this happen with multiple microcontrollers and servo/modular motors. I haven’t even gotten to plugging in the sonar and light sensors.
RedLight-VEX.jpg
mermaid1.jpg
mermaidtailmotor.jpg

Alkaline batteries, that is Very Likely the Problem…

From a Thread mentioned below: “**Alkaline batteries are not a good choice for driving the robot. Their high internal resistance will cause voltage drop-outs when the VEX motors draw large amounts of current. **”

See Threads, Batteries / Charger, is buying a power pack really a neccessity? and Batteries die quickly.

Yup that was it! I got a pack of rechargeable LiMH batteries and it worked fine after that. Thanks for the help!

Your Welcome… Good Luck on your Project…