Shop OBEX P1 Docs P2 Docs Learn Events
Know initial position of servos through BS2e & PSCU — Parallax Forums

Know initial position of servos through BS2e & PSCU

bhaskarghsh4bhaskarghsh4 Posts: 20
edited 2013-11-01 14:12 in BASIC Stamp
Good morning every one.
Without any formality let me tell what for am I posting this .
Basically I need to know what is the servo positions at the very moment I turn on the whole System (servo system with PSCU & BS2e).
This is because I want to run the servos from the current position they each are holding but not with a preset value.
Thanks for showing attention to this matter.
:smile:

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-10-30 23:51
    The PSCU should initialize each output to 1.5 ms meaning that a continuous rotation servo will be stopped and a standard servo should be at its center position. I hope this helps.
  • bhaskarghsh4bhaskarghsh4 Posts: 20
    edited 2013-10-31 02:47
    Sorry sir! but my query wasn't about to reach to the center position but to take the last position of the servo when I turned off the device previously.
    Thanks by d by.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-10-31 10:45
    Well, to know the previous positions you would need to store them in non-volatile memory prior to shut-down, which means you would need a way to detect the shut-down and store the values first. Alternatively if you had NVSRAM (Battery-Backed SRAM) you could keep updating the values in SRAM every time you changed them. These values could be restored on startup. In any event if you power down the PSCU and back on it will send the servos to the center position first anyway.

    One other option I almost forgot about on this unit (Thanks ajward :thumb: ) is you could store the startup positions in EEPROM using the EDD command. Please see the documentation but please note that an error was discovered in the example for this command. The text explaining the command is correct, however the example code beneath sends the wrong command.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-10-31 11:29
    Just to make it clear ... The PSCU has no way to know or find out the actual position of the servos connected to it. It can only record the last position it sent to the servo. The RSP command returns this position information to the microcontroller or PC. The D command (!SCD) sets the custom default servo position sent at power up or reset and the EDD command (!SCEDD) enables this custom mode. You have to be careful about using these commands since they write to the EEPROM on the PSCU and there is a limit of around 100000 writes to the same locations in the EEPROM.
  • ercoerco Posts: 20,257
    edited 2013-11-01 14:12
    Analog servos (maybe digital too, IDK) always glitch a bit when you cycle the power. From my experience, they will move consistently (either CW or CCW, depends on the servo) a bit on powerup, and depending on how fast your controller initializes, it may take a second before everything returns to where you want it to.

    Normally, that's not a problem. But in my latest project, it was fairly critical, because the servos activated an aerosol can flamethrower. I clearly wanted avoid accidental "firing" on powerup. My cheapie 9-gram servos always glitch Clockwise on powerup, so I oriented the servos so that them turning Clockwise on powerup or reset would safely move more away from the firing position:

    http://www.youtube.com/watch?v=mHKNzyjM228
Sign In or Register to comment.