Shop OBEX P1 Docs P2 Docs Learn Events
Using PINK to control the propeller chip — Parallax Forums

Using PINK to control the propeller chip

sciguysciguy Posts: 48
edited 2009-01-14 02:07 in Propeller 1
Hello all!

So I have this neat little robotic claw that I've wired into the propeller chip. Using some solid-state relays, and some programming, I'm able to make it move around, etc.

I ordered the PINK device to interface with the configuration. My end goal is to be able to Control the Claw over the internet, and I'll probably put a webcam on top of it.

So, I've started to configure the PINK, but I'm having some issues... Firstly, I'd like to connect to it through my home's network (through a router). This will eventually be via port-forwarding from the web, but for now I just want it working locally. However, the instruction manual it says it uses a UDP broadcast that won't work through a router? Isn't that a bit odd? Anyways, I've tried hooking it up with a crossover cable, or over the network and I still can't see it. What's the best way to see this thing from teh configuration software??

I have it pulling power directly from my propeller's 3.3V rail...is it possible that 3.3V isn't enough to power the PINK? The green LED is on on both the propeller board and the PINK board.

Any help or suggestions would be great! Thanks in advance [noparse];)[/noparse]

Comments

  • DgswanerDgswaner Posts: 795
    edited 2009-01-02 06:04
    The Pink is a 5v Device, so no 3.3v isn't enough. I would also ensure that when you provide a 5v source to it that you provide the proper mA to it. the best way to see it on your network is through configuration software.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DGSwaner

    "When in doubt, use C4" - Jamie Hyneman, Myth Buster
  • sciguysciguy Posts: 48
    edited 2009-01-02 06:11
    Ok thanks, I'll try using a 5V source and see if I can get a connection.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • Tom CTom C Posts: 461
    edited 2009-01-02 16:25
    sciguy,

    Here is a link to Steve Norris' Lab website where he has a PINK attached to a Propeller: http://www.norrislabs.com/Projects/RoboCam/index.html

    Check out the circuit diagrams and Spin code for examples of how Steve interfaced the PINK and Propeller.

    Regards,
    TCIII

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!
  • sciguysciguy Posts: 48
    edited 2009-01-04 02:20
    Ok, I gave it 5V and I can access it fine now. Thanks. I'm going to check out that website as well. THanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • sciguysciguy Posts: 48
    edited 2009-01-04 04:49
    Ok, onto the next problem. I'm just trying to do some LED debugging to ensure that the prop can communicate with PINK. Here is my code so far:
    CON
    
    {FREQUENCY SETTINGS}
      _clkmode        = xtal1+pll8x                            '18x multiplier
      _xinfreq        = 10_000_000                             '10 mhz Crystal Speed
      
    {NETBURNER SERIAL INPUT PIN}
      netTXinput      =16                                      'Input PIN from NetBurner (TX)
    
    {NETBURNER SERIAL OUTPUT PIN}  
      netRXoutput     =17                                      'Output PIN to NetBurner (RX)
    
    {RELAY OUTPUT PINS}
      ClawClose       =0                                       'Output PIN to Close Claw
      ClawOpen        =8                                       'Output PIN to Open Claw 
      WristUp         =1                                       'Output PIN to Tilt Wrist Up
      WristDown       =9                                       'Output PIN to Tilt Wrist Down
      ElbowUp         =2                                       'Output PIN to Bend Elbow Up
      ElbowDown       =10                                      'Output PIN to Bend Elbow Down
      ArmUp           =3                                       'Output PIN to Swing Arm Up
      ArmDown         =11                                      'Output PIN to Swing Arm Down
      SwivelLeft      =4                                       'Output PIN to Swivel Arm to Left (Counterclockwise)
      SwivelRight     =12                                      'Output PIN to Swivel Arm to Right (Clockwise) 
    
    {LED DEBUG OUTPUT PINS}                                    'Output PIN for PINK connect fail
      ConnectFail     =15                                      'Output PIN for PINK connect pass                    
      ConnectPass     =14
      
    {PIN MODE}
      IOpins          =%00000000000000101101111100011111       'Sets the direction for each of the IO Pins (1=out, 0=in)                          
    
    OBJ
      myPink:  "PinkV2"                                        'Pink declaration  
    VAR
       long stack1 [noparse][[/noparse]50]                                        'Stack for Cog 1 (Pink Connect Debug)
    PUB main  
    
      DIRA:=IOpins                                             'Properly sets Directions for each IO pin                                                     
    
      cognew(connect, @stack1)                                 'Initializes a new cog to connect to PINK
    
    PUB connect
    
      DIRA:=IOpins                                             'Properly sets Directions for each IO pin 
    
      
      myPink.PinkV2("0",netTXinput,netRXoutput)                'initializes the PINK device
    
    
    'checks to ensure that prop is connected to PINK
    repeat
      myPink.getStatus
      if myPink.noResponse
        OUTA[noparse][[/noparse]ConnectFail]~~
      else
        if myPink.isConnected
          OUTA[noparse][[/noparse]ConnectPass]~~
    until myPink.isConnected
    
    repeat
      OUTA[noparse][[/noparse]ConnectPass]~~  
    
    



    The connectFail and ConnectPass outputs are just Red and green LEDs that should illuminate based on whether contact is established. Neither do. I've been able to determine that the myPink commands are not working for some reason...I'm not sure why though, those commands are right out the PINK propeller object source code.

    -Jeremy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • sciguysciguy Posts: 48
    edited 2009-01-12 06:01
    Does anybody have any idea of how I can fix this? I can't seem to get the propeller and PINK to communicate. The serial Port settings for the Pink are:
    Baud Rate - 9600
    Data Bits - 8
    Data Parity - None
    Stop Bits - 1

    Here is another thing I thought of... The pink operates on 5V, so I hooked it into 5V power, and I was able to communicate with it over Ethernet. But does this mean that the serial communications must also occur at 5V? Because at the moment, the TX and RX are just hooked right up to the propeller's 3.3V I/O pins.

    If so, how should I go about cranking up the voltage between the prop and the PINK?

    thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?

    Post Edited (sciguy) : 1/12/2009 6:52:34 AM GMT
  • Tom CTom C Posts: 461
    edited 2009-01-12 14:09
    sciguy,

    Hooking a +5 V level signal directly into a Propeller input is a real no no!

    I suggest that you use at least a 1K current limiting resistor anytime that you need to interface a +5V level signal to a Propeller input.

    Regards,
    TCIII

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!
  • sciguysciguy Posts: 48
    edited 2009-01-12 15:44
    I wasn't suggesting hooking a 5V right up. I am using a 10K resistor on the input. Should it be less? Do I need one on the output as well?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • DgswanerDgswaner Posts: 795
    edited 2009-01-12 16:11
    yes I do believe 10K is too high, I forget the suggested value but I think it's around 220Ohm. see link below Except for the resisters on the I/o lines it's a direct connection to the Propeller. I'd use the Pink V2 example program to test your connection then work on customizing. looking at your code

    shouldn't
    _clkmode = xtal1+pll8x '18x multiplier
    _xinfreq = 10_000_000 '10 mhz Crystal Speed

    be:

    _clkmode = xtal1+pll16x
    _xinfreq = 10_000_000

    depending on the board/chip your using, also on the Pink V2 test be sure to set this correctly as it defaults to 5mhz

    good luck

    Added: check out this thread for connecting 3.3v to 5v
    http://forums.parallax.com/forums/default.aspx?f=25&m=124837

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DGSwaner

    "When in doubt, use C4" - Jamie Hyneman, Myth Buster

    Post Edited (Dgswaner) : 1/12/2009 4:19:20 PM GMT
  • sciguysciguy Posts: 48
    edited 2009-01-12 19:17
    I tried with a 1k resistor in series on the input from the PINK, but I'm still not getting anything...

    Thanks for the link though, it was very informative. I'm thinking that it is something with the output to the pink. If I were to monitor the output pin with a multimeter, I presume I should see it alternating between 0 and 3.3V as it sends the serial signal, correct? I'll have to try that. Perhaps the pin is bad?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • sciguysciguy Posts: 48
    edited 2009-01-12 23:22
    why did you post that in this thread? please don't hijack my thread.

    edit: no worries - thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?

    Post Edited (sciguy) : 1/12/2009 11:36:39 PM GMT
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-01-12 23:36
    Just FYI, a 10K series resistor is just fine... Heck, I've used a 20K before, because that's all I had laying in front of me and didn't have any trouble. The only thing the resistor does, is limit the current that the clamping diodes sink/source. These diodes are set to keep the voltage at the input at 3.3V, so if you have a 5V source through a series resistor, into the input pin, you'll be dropping 1.7V and 1.7mA will be flowing. The inputs barely take any current at all, so even 17uA into the prop input is still going to give you a high/low value(i.e. a 100k resistor).

    Correct me if I'm wrong...
  • sciguysciguy Posts: 48
    edited 2009-01-13 04:02
    Right I know, and that's why I don't understand why this still isn't working...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-01-13 07:49
    Have you set the clock right, as Dgswaner said:

    For spin stamp
    {FREQUENCY·SETTINGS}
    ··_clkmode········=·xtal1+pll8x···························· '8x·multiplier
    ··_xinfreq········ ·=·10_000_000···························'10·mhz·Crystal·Speed

    For propeller demoboard
    {FREQUENCY·SETTINGS}
    ··_clkmode········=·xtal1+pll16x··························· '16x·multiplier
    ··_xinfreq········· =·5_000_000·····························'5·mhz·Crystal·Speed

    Also, are you sure the TX and RX pins are not swapped?
    Your netTXinput must connect to the pink rx input
    Your netRXoutput must conect to the pink tx output
    according·to your statement
    ··myPink.PinkV2("0",netTXinput,netRXoutput)················'initializes·the·PINK·device

    You just need 1k resistors between prop pins and pink pins.
    (and a common GND of course)


    regards peter
    ·
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2009-01-13 08:34
    Attached is a test setup which I had sucess with.

    Hope this might help
  • sciguysciguy Posts: 48
    edited 2009-01-13 16:11
    I've changed the frequency settings as you've specified, and I've made sure that my pins aren't switched...
    I've also already tried using the test pink code with the same result.
    I've attached a schematic of the setup. Maybe I'm just doing something very dumb...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
    1116 x 598 - 209K
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2009-01-13 17:48
    sciguy

    Looking at your schematic I guess you have the TX/RX swapped (I assume you have a ground between the 2)
    {NETBURNER·SERIAL·INPUT·PIN}
    ··netTXinput······=16······································'Input·PIN·from·NetBurner·(TX)
    {NETBURNER·SERIAL·OUTPUT·PIN}
    ··netRXoutput·····=17······································'Output·PIN·to·NetBurner·(RX)
    In your code:myPink.PinkV2("0",netTXinput,netRXoutput)················'initializes·the·PINK·device
    ············································ Pin 16······· Pin 17
    Looking at the PinkV2 start: PUB PinkV2(id,tx· ,·· rx)
    ···················································· Pin 16, Pin 17
    ************************************************************************

    In my example which works OK:

    · Pin_PinkTX··· = 2············ 'tx pink··· 2,2K in series with port 2 on Prop demoboard
    · Pin_PinkRX··· = 4············ 'rx pink··· 2,2K in series with port 2 on Prop demoboard
    · Pink.PinkV2("0", Pin_PinkRX, Pin_PinkTX)············· 'Pink Baud 9600
    ··························Pin 4········ Pin 2

    Looking at the PinkV2 start: PUB PinkV2(id,tx· ,·· rx)
    ···················································· Pin 4, Pin 2

    Hope I not messed up now
  • sciguysciguy Posts: 48
    edited 2009-01-13 22:34
    Hmm... I think you may be right. I switched them in my code as you suggested and now my ConnectFail LED illuminates. Before neither of the Pass or Fail LED illuminated, so at least we're making progress. Now it looks like it can communicate, but it isn't....

    ideas?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • sciguysciguy Posts: 48
    edited 2009-01-13 22:39
    So I tested the pins with a multimeter while my program was looping. Pin 16 is running at 3.3v and Pin 17 at 1.5v? What's going on there? Is that right?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2009-01-13 22:42
    sciguy

    Try to use the "Pinktest" I attached, with all do not change anything.

    Replace the PINs on your board to match the one in the file I attached.

    Then it might work!!!

    Regards/Goran
  • sciguysciguy Posts: 48
    edited 2009-01-14 02:07
    good news! It appears to be fixed! I think there were two issues.

    One, in the VAR area I didn't have "byte buf[noparse][[/noparse]64]". I don't know if that made a difference...but whatever.

    But, I didn't have the PINK plugged into a live ethernet cable. I assumed the test was just testing serial connectivity, but I guess it also requires that ethernet be plugged in! Hmm.. OK well now I need to get it to control my robot claw. I'm sure I'll be back with more questions. Thanks for the great help everybody!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I can haz propeller chip?
Sign In or Register to comment.