Shop OBEX P1 Docs P2 Docs Learn Events
Servo Controller USB to Matlab - Page 2 — Parallax Forums

Servo Controller USB to Matlab

2»

Comments

  • Shawn LoweShawn Lowe Posts: 635
    edited 2011-09-22 12:50
    ewodul wrote: »
    I'm not sure what you mean; right now, the PSC is connected via USB to my PC, which should provide the power the PSC needs? Then the 3wire PWM cable is going to my ESC, and the ESC has 2 seperate power cables, which are connected to the + and - of my power supply

    It just occured to me that you posted this statement. If you look at the PSC on the bottom there is a terminal that has a + and -. You must supply 5V here for the PSC to work.

    I've never connected any power supply to the PSCU.

    Yeah, this is a problem :)
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2011-09-22 14:23
    The PSCU can get it's power from the USB.... see the entire schematic here...

    http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PSCUsb_A%20Schematic.pdf

    .. or the partial attached schematic. Vusb comes directly from the USB plug.
    643 x 436 - 31K
    PWR.JPG 31.5K
  • ewodulewodul Posts: 22
    edited 2011-09-23 05:09
    Doesn't work leaving the red connection out... Fwiw I have the PSCU 28830.

    Pics of my setup:

    overview - http://imageshack.us/f/690/image1oh.jpg/ (PSCU - ESC - Thruster)
    PSCU zoom - http://imageshack.us/f/705/image2sjv.jpg/
    Connector ESC zoom - http://imageshack.us/f/854/image3uv.jpg/

    I hope they are clear - I connected channel 1 (did try different channels) of the PSCU with the ESC; by connecting W on the PSCU to orange of the ESC and B on the PSCU to brown on the ESC. I also supplied a 24V to the ESC, using the power connection cables, this is to power the thruster as well.

    I also tried exact the same setup with the Dspace board (so leaving out the PSCU); this setup did work.

    Another strange thing: when I connect the PSCU to the ESC and turn the power supply on, the ESC doesn't make a beep (as it's supposed to do when turned on). When I disconnect the GND cable (so the B connector on the PSCU), the ESC suddenly beeps telling me it's ready.

    Normally, the ESC beeps when it's switched on.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2011-09-23 06:34
    Sounds like a ground loop between the ESC power supply and the power coming from the USB... Is there any way you can use a laptop (<-that is not plugged in to any AC) to temporarily power the PSCU?

    What happens to the ESC if you unplug the USB rather than disconnecting the ground?... does it beep when you do that?
  • ewodulewodul Posts: 22
    edited 2011-09-23 06:52
    Unplug USB also results in a beeping ESC, will try and find a laptop right now
  • edited 2011-09-23 07:25
    ewodul,

    To minimize your hunt for a Laptop with Matlab installed on it, you can run the code below.

    Be sure and use F10 to from the Propeller IDE to run the code to preserve the PSCU firmware.

    The Top File is ServoTest.spin and set for Servo Channel 'P0' with a width set to the center position 1500

    ServoTest.spin
    CON
        _clkmode = xtal1 + pll16x                           
        _xinfreq = 5_000_000                                'Note Clock Speed for your setup!!
    
        ServoCh1 = 0                                        'Select DEMO servo
    
    OBJ
      SERVO : "Servo32v8.spin"
    
    PUB Servo_Test
    
        SERVO.Start                    'Start Servo handler
        SERVO.Set(ServoCh1,1500)       'Move Servo to Center
    
        repeat
    
  • ewodulewodul Posts: 22
    edited 2011-09-23 07:56
    Sounds like a ground loop between the ESC power supply and the power coming from the USB... Is there any way you can use a laptop (<-that is not plugged in to any AC) to temporarily power the PSCU?

    Just tried running it with a laptop, but didn't work either. I even couldn't see a good PWM signal when I measured the signal from the PSCU with my scope. I both tried with and without AC plugged in, bot unfortunately no result. I will try your script now.
  • ewodulewodul Posts: 22
    edited 2011-09-23 08:19
    Ok I did run the code in the propeller tool, but I'm not sure what to do next? BTW you mentioned "set for Servo Channel 'P0' ", did you mean I had to change something in the code? (as there is a line with CH1: SERVO.Set(ServoCh1,1500) 'Move Servo to Center)
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2011-09-23 08:49
    "...did you mean I had to change something in the code?" - No... unless you wanted to move to a different channel, change the line that reads ...

    ServoCh1 = 0

    .. to something that corresponds.

    The value of 1500 is the default center position, where you can also change this value manually... I wouldn't exceed 2000 or go below 1000.


    I'm curios... what is the voltage level of the signal for the setup that works versus the setup that does not work?
  • ewodulewodul Posts: 22
    edited 2011-09-23 09:05
    4.66V for the PSCU (which didn't work)
    5.03V for the Dspace board (which worked)

    This was measured with my scope, the signals look similar except this small amplitude difference
  • ewodulewodul Posts: 22
    edited 2011-09-23 09:38
    After I ran the code, should I just try again if the setup works? What did I just do by running this code?
  • edited 2011-09-23 10:25
    "What did I just do by running this code" - Running that code just bypasses the need to run the MatLab software ...in case you couldn't fins a laptop with Matlab installed.

    Using a laptop in the first place (unplugged to the AC) is just a quick way to determine if there is a ground loop problem.

    At this point I'm not sure... the voltage difference should not be an issue. You could try powering with an external supply... not through the green connector, but through the connector just next to the jumper.

    Please refer to the "TTL Serial Connection" in the documentation here ... and omit the white signal wire... all you need with this connedtion is an external 5V supply on the RED and BLACK.
    http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/28830-PropServoControllerUSB-v1.0.pdf

    I E-mailed the company "castle creations" that sells the HYDRA120 to see if they could provide any more detailed technical specs on the input voltage thresholds, but I have not heard anything back from them .
  • ewodulewodul Posts: 22
    edited 2011-09-24 02:44
    Thanks again, Beau, I will also try that after the weekend. I've also contacted CastleCreations, and it might take a while for them to answer. I just saw a reply to a question I've posted on their forum a while ago, asking what the 3 coloured connection cables are:

    "The yellow wire is signal, red is +5 volts positive from onboard BEC and brown is signal and BEC ground"

    So no 24V will be passed through the red wire of the ESC but 5V.

    Another thin I noticed yesterday, was that I can't measure a proper PWM signal from the white wire on the PSCU when it was connected with the ESC. Without the ESC, I can measure a perfect PWM signal with my scope.

    I will also try and contact Castle as well; I really need the PSCU to work with the ESC as it's supposed to be part of the motion control of a quite large solar device project.
  • Kurt WeimerKurt Weimer Posts: 2
    edited 2013-01-30 18:34
    Did you ever get this to work? I am working on a similar project, same issues...
Sign In or Register to comment.