Shop OBEX P1 Docs P2 Docs Learn Events
Problem with usings keyboard input and servos on BOE and PSC — Parallax Forums

Problem with usings keyboard input and servos on BOE and PSC

abdulsiddiquiabdulsiddiqui Posts: 4
edited 2012-12-14 11:50 in Robotics
Hi All,

This is a school project to help make a Robot arm with the parts from my old BOE Bot and a new PSC board.

The laptop keyboard is used to control the servos that are connected to the BOE and the PSC.

I have attached the bs2 file for review. The problems starts when we attach the second or third servo to the PSC

All the servos of the PSC start acting up and dont stay still when left idle.

Please help :smile:

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-12-13 09:48
    That sounds like a power problem rather than a programming problem. How do you have things connected and powered?

    I would also recommend trying a simple test program that moves one servo from one position to another and back with a 1-2 second pause. If that works, try two servos, first one, then the other, just moving back and forth. If that works, try moving two servos at the same time. If that works, try 3 servos.
  • abdulsiddiquiabdulsiddiqui Posts: 4
    edited 2012-12-13 10:12
    The BOE is powered using the 4 AA batries holder connected via the barel connector to the board. The PSC is powered with a 7.2 v rechargable battary connected to the power connector on the board.

    Please review the code to see if I need tofix the SIRIN command or add pauses or change the baud rates...
  • abdulsiddiquiabdulsiddiqui Posts: 4
    edited 2012-12-13 10:22
    Attached is the set up picture
    512 x 384 - 280K
  • Mike GreenMike Green Posts: 23,101
    edited 2012-12-13 10:50
    Since you have a servo controller, why are you explicitly controlling some of the servos with the Stamp (pins 12-14)? The delays caused by the SEROUT statements (for sending the characters) will prevent the servos connected to the Stamp from working properly since these need to have pulses sent about every 20ms and the SEROUT statements will take over 100ms to execute (32 bytes at 2400Baud).
  • abdulsiddiquiabdulsiddiqui Posts: 4
    edited 2012-12-13 16:58
    Mike .... I added the PAUSE 200 after each SEROUT but it did not help.

    I uploaded a vid of what is happning. Please advise with any other recommendations :)

    http://www.youtube.com/watch?v=nZvKt16XiKE
  • edited 2012-12-14 11:50
    Hello,

    Consider what Mike said about all the serial communication in your application making delays between control pulses to servos connected to the BASIC Stamp. He said those delays are too long. Servos need control pulses repeated 50 times per second to keep them steady. What can you do about that? Probably the best approach would be to control all the servos with the PSC. That way, the PSC does its job (controlling servos), and the BASIC Stamp is free to check for incoming serial messages from the terminal and send serial control messages to the PSC.

    Mike suggested that you try controlling one servo and make sure that works. Then, add a second one, and so on... That's definitely the right approach. Make sure to connect each servo to the PSC, not the BASIC Stamp. You might also want to use really simple code that's only for one servo to rule out program bugs too. Then, add a second servo to the PSC and expand your program for two servos. Keep going until you get them all running.

    Andy
Sign In or Register to comment.