Shop OBEX P1 Docs P2 Docs Learn Events
Resetting Problem — Parallax Forums

Resetting Problem

musk022musk022 Posts: 8
edited 2006-03-03 15:23 in Robotics
Hi, my code is resetting everytime i transition my servos from forward to reverse.· I have 2 parallax continuous rotation servos for the drive wheels.· I'm using a BoE Rev C and I recently upgraded my chip to a BS2sx.· The code worked fine with the old chip, a BS2.· However, now anytime my robot changes from forward to reverse or viceversa it is causing my program to reset.· I know it is resetting because it re-initializes my variables at the top of the program.· In addition, when i operate my program in position 1 (when the servos are off) the program works as it should.· It only resets when it is in position 2 and the servos are on.· Here is a quick sample code to illustrate where it resets:

' {$STAMP BS2sx}
' {$PBASIC 2.5}

counter······· VAR··· Word
testVariable· VAR···· Byte

testVariable = 0

· FOR counter = 1 TO 100
··· PULSOUT 12, 2275
··· PULSOUT 13, 1502
··· PAUSE 10
··· testVariable = 1
· NEXT

· DO
····PULSOUT 12, 1500
··· PULSOUT 13, 2273
··· PAUSE 10
· LOOP
END

With this code, the robot goes forward for the FOR loop, when it gets to the pulses in the DO loop it resets to the top of the program.· Initializes testVariable to 0 and starts the FOR loop again.· It never gets to the infinite DO Loop.· I would greatly appreciate any help with this,· I have no idea why the program would reset.

Comments

  • neotericneoteric Posts: 144
    edited 2006-03-02 01:22
    I know this seems crazy, but I had a similar problem.· Step 1 - Make sure you have fresh batteries.· If you have a walwart, try that, see if it stops resetting.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-02 03:14
    neoteric is correct...9 out of 10 times it is low batteries causing the Stamp Module to brown out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • musk022musk022 Posts: 8
    edited 2006-03-02 03:27
    Good thoughts, but I have already tried that.· The batteries I had in it were fairly new to begin with.· But then I put completely new batteries in it to be absolutely sure and the problem persisted.· I also tested the servos in different ports as well as tried 2 other servos.· In all cases the same results occurred.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-02 03:33
    Okay, well another thing to consider is try to stop or ramp the servos and see if the problem persists.· Jumping from forward to reverse will draw a burst of current which seems to be resetting your Stamp Module.· I've never really seen it happen except in the case of low batteries, but you could be the first.· BTW, have you measured the voltage coming into the BOE with a meter?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • musk022musk022 Posts: 8
    edited 2006-03-02 03:38
    I have not tried to measure the voltage yet.· The weirdest thing is I can put a pause 2000 in between the forward and reverse pulses and it will still reset.· It will pause for that duration, and then reset once it tries to go backwards.·· Now if i just start the program in reverse.· It will run backwards as expected.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-02 04:06
    Again, this leads me to believe that your batteries are running low and that the initial running of the servos sags them, so that when they restart, they brown out the Stamp.· Try this...After your PAUSE, instead of going backward, try going forward again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • musk022musk022 Posts: 8
    edited 2006-03-02 04:09
    Alright, I will try as you suggested tomarrow.··My robot is at school.· Thank you Chris,·for replying thus far.
  • musk022musk022 Posts: 8
    edited 2006-03-03 03:36
    Well we were using some cheap Dynex batteries.· We switched to Duracells and the problem is no longer a problem.· So, you were right that it was brown-outs that caused the reset.· I think it may have reset another time with my full program; however im not convinced that that was not a programming error.· Right now I am using 4 AAs.· Would it be beneficial to use a supply voltage of 7.5V or 9V instead of 6V?· Thanks for the help.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-03 04:50
    There's something you're not taking into consideration with your change of BASIC Stamp.· The BS2 used only 3mA of current when running.· Not a big deal.· But you have switched to a BS2sx which has increased the current draw by a factor of 20 times (60mA).· That will cause your batteries to drain quicker.

    As for powering the servos from higher voltages.· They're rated at 6V.· Anything higher than that and you are reducing the life of the servo.· Once you pass 9V you risk popping the capacitor inside the servo and destroying them.· I would never recommend going above 7.2V.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • musk022musk022 Posts: 8
    edited 2006-03-03 06:07
    I guess I should rephrase my question.· I have the servos running off the +5 regulated voltage.· I am satisfied that I have solved my original problem.· I was talking about the power supply to the BoE.· I was just wondering what is the difference between using a 9V power supply or a 6V power supply to the BoE?· Are there advantages of using one·over the other?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-03 15:23
    Well if the 9V supply has the same current capacity as the 6V then the 9V would run longer before it's voltage sagged down below the minimum required for the regulator to function.· Eventually the Stamp will brown-out.· Bear in mind that a 9V battery will not suffice at all, since they wouldn't have enough current capacity for your BS2sx and servos.· Even for the servos alone.· A BOE-Bot with a BS2sx will eat 9V transistor batteries like they are candy.· You would need to use a 9V R/C Rechargeable battery pack.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.