Shop OBEX P1 Docs P2 Docs Learn Events
Arduino bot stops running after I unplug it from the PC — Parallax Forums

Arduino bot stops running after I unplug it from the PC

jemartin390jemartin390 Posts: 10
edited 2018-02-15 00:33 in General Discussion
My Arduino uno shield bot runs good and always have, until today. My robot will run while it's plugged up to the PC, but it completely stops once I unplug it. Power remains and sometimes the servos will twitch, but the uploaded program stops running. I use visual studio and never had this issue before. Suggestions?

Comments

  • Your post raises a nimber of questions. Are you running a propeller? If so have you saved your program to EPROM? Unplugging the USB often causes a processor reset. Need more details on your set up.
    Jim
  • H jemartin390,

    Did you get this resolved? How are the Shield-Bot batteries doing? Perhaps they are drained, and it has been running off of USB power. Remember, the Uno draws power if the battery pack is plugged into it, even if the power switch on the Board of Education shield is in position 0. So, I always turn off the switch and also unplug the battery pack from the Uno when I'm done with a session.
  • jemartin390jemartin390 Posts: 10
    edited 2018-02-13 18:39
    edit
  • jemartin390jemartin390 Posts: 10
    edited 2018-02-13 18:40
    Still having this issue Any other suggestions? I've already tried new batteries.
    H jemartin390,

    Did you get this resolved? How are the Shield-Bot batteries doing? Perhaps they are drained, and it has been running off of USB power. Remember, the Uno draws power if the battery pack is plugged into it, even if the power switch on the Board of Education shield is in position 0. So, I always turn off the switch and also unplug the battery pack from the Uno when I'm done with a session.

  • Post code so we can get a closer look. I've got a ShieldBot here and would be happy to run the same code.
  • jemartin390jemartin390 Posts: 10
    edited 2018-02-14 15:01
    Any code. I have several bots and they all end the same way. Robot works off USB, then after a week or so it will only work on USB. This has happened to three robots and the only fix is we move the code to a different robot.

    I have noticed that if I plug in different bots using the same USB cable, then the number of the serial port changes. Not sure if that has anything to do with it.
    Ken Gracey wrote: »
    Post code so we can get a closer look. I've got a ShieldBot here and would be happy to run the same code.


  • I have noticed that if I plug in different bots using the same USB cable, then the number of the serial port changes. Not sure if that has anything to do with it.

    That is the expected behaviour.
    Each robot usb interface has a unique serial number, and your computer will assign a new com port number to each different usb device it meets, each identified by that unique serial number.
  • Any code. I have several bots and they all end the same way. Robot works off USB, then after a week or so it will only work on USB.

    Are you using rechargeable or alkaline cells?

    Also... are you getting power to the parallax shield when the usb is unplugged? Is there some sort of indicator?

    Do you still lose total power if you unplug all but one servo?

  • VonSzarvas wrote: »
    Any code. I have several bots and they all end the same way. Robot works off USB, then after a week or so it will only work on USB.

    Are you using rechargeable or alkaline cells?

    Also... are you getting power to the parallax shield when the usb is unplugged? Is there some sort of indicator?

    Do you still lose total power if you unplug all but one servo?

    I've tried both types of batteries.

    The power remains on, and the light indicators are on. Sometimes the servo motors will randomly twitch, but the uploaded program stops running. If I plug it back up, then the program will resume.
  • Add a couple of flashes of the Pin13 LED in the setup() function. Flash it on, wait half a second, turn it off half a second, and repeat. Remove or comment out any LED code you may have in the loop() function.

    The LED flash can help tell you if the Arduino power is browning out for whatever reason. If so, there are more specific troubleshooting steps you can take. If the Arduino is getting insufficient battery voltage or current the sketch will repeatedly restart.
  • There are three things that haven't been mentioned.
    Try one at a time:
    Different USB cable
    Different Port
    Different Computer

    You must first eliminate secondary hardware issues.
Sign In or Register to comment.