Shop OBEX P1 Docs P2 Docs Learn Events
HM55B + Ping))) — Parallax Forums

HM55B + Ping)))

MichelBMichelB Posts: 154
edited 2011-06-10 15:21 in Robotics
Hi, where can I find schematic (and software.bs2) to connect the HM55B compass module with the Ping)))TM Bracket Kit? Thank you in advance.

Comments

  • dandreaedandreae Posts: 1,375
    edited 2009-06-22 13:50
    Here are two links for the mentioned components:

    http://www.parallax.com/Store/Sensors/CompassGPS/tabid/173/CategoryID/48/List/0/Level/a/ProductID/98/Default.aspx?SortField=ProductName%2cProductName


    http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx

    Each one will have a wiring diagram and sample code for the bS2.· You will· need to adjust the codes to make them work together.

    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • SRLMSRLM Posts: 5,045
    edited 2009-06-22 15:19
    Note that the compass does not connect electrically to the ping. Instead, you can connect them to the same microcontroller.
  • MichelBMichelB Posts: 154
    edited 2009-06-22 16:04
    Thank you Dave and SRLM.
    P.S.: I just remember that the use of compass is only for data-log.

    Post Edited (MichelB) : 6/22/2009 4:22:46 PM GMT
  • graffixgraffix Posts: 389
    edited 2011-03-29 20:30
    What happend with the HM55B? The first link has been removed?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-29 20:40
    Good question. The HM55B is discontinued in favor of a much better compass device, but Parallax usually keeps the webstore page available for reference. Attached is my copy of the HM55B documentation and sample programs.
  • graffixgraffix Posts: 389
    edited 2011-03-30 06:47
    Thank you Mike.
  • graffixgraffix Posts: 389
    edited 2011-05-20 11:06
    dandreae wrote: »
    Here are two links for the mentioned components:

    http://www.parallax.com/Store/Sensors/CompassGPS/tabid/173/CategoryID/48/List/0/Level/a/ProductID/98/Default.aspx?SortField=ProductName%2cProductName


    http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx


    Each one will have a wiring diagram and sample code for the bS2.· You will· need to adjust the codes to make them work together.

    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
    first attempt probably needs adjustment
    ' -----[ Title ]--------------------------------------------------------------
    ' Smart Sensors and Applications - Ping)))Dar.bs2
    ' Display radar style object distance measurements in the Debug Terminal.
    ' as the Boe-Bot sweeps the Ping))) Mounting Bracket servo from right
    ' (0-degrees) to left (180-degrees).
    
    ' {$STAMP BS2}                               ' Target device = BASIC Stamp 2
    ' {$PBASIC 2.5}                              ' Language = PBASIC 2.5
    
    ' -----[ I/O Definitions ]----------------------------------------------------
    
    PingServo      PIN     14                    ' Servo that directs Ping)))
    Ping           PIN     15                    ' Ping))) sensor signal pin
    DinDout        PIN      10                    ' P6 transceives to/from Din/Dout
    Clk            PIN      8                    ' P5 sends pulses to HM55B's Clk
    En             PIN      9                    ' P4 controls HM55B's /EN(ABLE)
    
    Reset          CON      %0000                ' Reset command for HM55B
    Measure        CON      %1000                ' Start measurement command
    Report         CON      %1100                ' Get status/axis values command
    Ready          CON      %1100                ' 11 -> Done, 00 -> no errors
    NegMask        CON      %1111100000000000    ' For 11-bit negative to 16-bits
    
    a              VAR      Word                 ' x-axis data
    b              VAR      Word                 ' y-axis data
    status         VAR      Nib                  ' Status flags
    degree          VAR      Word                 ' Store angle measurement
    
    ' -----[ Constants ]----------------------------------------------------------
    
    LimitLeft      CON     1250                  ' Bracket 90-degrees LimitLeft
    LimitRight     CON     250                   ' Bracket 90-degrees LimitRight
    PingDirToAngle CON     8454                  ' Servo pulse -> angle with **
    
    CmConstant     CON     2260                  ' Echo time -> cm with **
    SinCosTo256    CON     517                   ' For */ -127..127 -> -256..256
    Increment      CON     15                    ' Servo PULSOUT increment value
    Negative       CON     1                     ' Negative sign
    Positive       CON     0                     ' Positive sign
    
    ' -----[ Variables ]----------------------------------------------------------
    
    pingDir        VAR     Word                  ' Pulse duration -> direction
    time           VAR     Word                  ' Ping))) echo time
    distance       VAR     Time                  ' Object distance
    x              VAR     Word                  ' x Debug cursor coordinate
    y              VAR     Word                  ' y Debug cursor coordinate
    angle          VAR     Byte                  ' Angle from LimitRight in brads
    counter        VAR     angle                 ' Loop counter
    sweepInc       VAR     Nib                   ' Sweep increment
    sweepDir       VAR     Bit                   ' Increment/decrement pingDir
    xSign          VAR     Bit                   ' x variable sign
    ySign          VAR     xSign                 ' Stores sign of y variable
    nsign          VAR     Bit                   ' Numerator sign
    dsign          VAR     Bit                   ' Denominator sign
    
    ' -----[ Initialization ]-----------------------------------------------------
    
    pingDir = LimitRight                         ' Start servo at 0-degrees
    
    FOR counter = 1 TO 40                        ' Initialize servo position
      PULSOUT PingServo, pingDir
      PAUSE 20
    NEXT
    
    sweepInc = Increment                         ' Set the sweep increment
    
    ' -----[ Main Routine ]-------------------------------------------------------
    
    DO
    
      GOSUB Compass_Get_Axes                     ' Get x, and y values
    
      angle = x ATN -y                           ' Convert x and y to brads
      angle = angle */ 360                       ' Convert brads to degrees
    
      DEBUG HOME, "x-axis N(-S) = ",SDEC x,      ' Display axes and degrees
            CLREOL, CR, "y-axis W(-E) = ",
            SDEC y, CLREOL, CR, CR, "angle = ",
            DEC angle, " degrees", CLREOL
    
      PAUSE 150
    
      IF pingDir <= LimitRight THEN              ' Refresh display if far right
        DEBUG CLS, CRSRXY, 50, 25, "X"
      ENDIF
    
      GOSUB Sweep_Increment                      ' Move servo by sweepInc
    
      ' Calculate angle from far right in brads.
      angle = pingDir - LimitRight ** PingDirToAngle
    
      GOSUB Get_Ping_Cm                          ' Get cm measurement
      distance = distance MAX 100 / 4            ' Scale for Debug Terminal
    
      GOSUB Polar_To_Cartesian                   ' distnace @ angle -> (x, y)
    
      x = x * 2                                  ' 2 spaces for every 1 CR
    
      DEBUG CRSRXY, 50 + x, 25 - y, "*"          ' Display (x, y) coordinate
    
    LOOP
    
    ' -----[ Subroutine - Get_Ping_Cm ]-------------------------------------------
    
    ' Gets Ping))) rangefinder measurement and converts time to centimeters.
    ' Distance may be declared as time to save variable space.
    
    Get_Ping_Cm:
    
      PULSOUT Ping, 5
      PULSIN Ping, 1, time
      distance = time ** CmConstant
    
      RETURN
    
    ' -----[ Subroutine - Polar_To_Cartesian ]------------------------------------
    
    ' Calculates x and y (Cartesian coordinates) given distance and angle
    ' (polar coordinates).
    
    Polar_To_Cartesian:
    
      ' Calculate x coordinate.
      x = COS angle                              ' Polar to Cartesian
      xSign = x.BIT15                            ' Store sign bit
      x = ABS(x) */ SinCOsTo256                  ' Polar to Cartesian continued
      x = distance */ x
      IF xSign = negative THEN x = -x            ' Correct sign with sign bit
    
      ' Calculate y coordinate.
      y = SIN angle                              ' Polar to Cartesian
      ySign = y.BIT15                            ' Store sign bit
      y = ABS(y) */ SinCOsTo256                  ' Polar to Cartesian continued
      y = distance */ y
      IF ySign = negative THEN y = -y            ' Correct sign with sign bit
    
      RETURN
    
    ' -----[ Subroutine - Sweep_Increment ]---------------------------------------
    
    ' Increment/decrement the position of the servo that directs the Ping)))
    ' rangefinder. When pingDir goes outside either LimitRight or LimitLeft,
    ' the sweep direction toggles.
    
    Sweep_Increment:
    
      ' Change sweepDir for adding/subtracting increment if at rotation limit.
      IF pingDir <= LimitRight THEN
        sweepDir = Positive
      ELSEIF pingDir >= LimitLeft THEN
        sweepDir = Negative
      ENDIF
    
      ' Add/subtract increment to/from pingDir.
      IF sweepDir = negative THEN
        pingDir = pingDir - sweepInc
      ELSEIF sweepDir = Positive THEN
        pingDir = pingDir + sweepInc
      ENDIF
    
      ' Send positioning pulse to Ping))) Mounting Bracket servo.
      PULSOUT PingServo, pingDir
    
      RETURN
    ' -----[ Subroutines - get axis ]-----------------------------
    
    Compass_Get_Axes:                            ' Compass module subroutine
    
      HIGH En: LOW En                            ' Send reset command to HM55B
      SHIFTOUT DinDout,clk,MSBFIRST,[Reset\4]
    
      HIGH En: LOW En                            ' HM55B start measurement command
      SHIFTOUT DinDout,clk,MSBFIRST,[Measure\4]
      status = 0                                 ' Clear previous status flags
    
      DO                                         ' Status flag checking loop
        HIGH En: LOW En                          ' Measurement status command
        SHIFTOUT DinDout,clk,MSBFIRST,[Report\4]
        SHIFTIN  DinDout,clk,MSBPOST,[Status\4]  ' Get Status
      LOOP UNTIL status = Ready                  ' Exit loop when status is ready
    
      SHIFTIN  DinDout,clk,MSBPOST,[x\11,y\11]   ' Get x & y axis values
      HIGH En                                    ' Disable module
    
      IF (b.BIT10 = 1) THEN b = b | NegMask      ' Store 11-bits as signed word
      IF (a.BIT10 = 1) THEN a = a | NegMask      ' Repeat for other axis
    
      RETURN
    
  • SneakyeanSneakyean Posts: 6
    edited 2011-06-10 15:12
    Mike Green wrote: »
    Good question. The HM55B is discontinued in favor of a much better compass device, but Parallax usually keeps the webstore page available for reference. Attached is my copy of the HM55B documentation and sample programs.

    Howdy- what is this new compass device? Currently when I go to compass sensors absolutely none show up- it is all GPS. Can you direct me to this new compass? Thanks
  • schillschill Posts: 741
    edited 2011-06-10 15:21
    Sneakyean wrote: »
    Howdy- what is this new compass device? Currently when I go to compass sensors absolutely none show up- it is all GPS. Can you direct me to this new compass? Thanks
    According to this thread http://forums.parallax.com/showthread.php?131916-Coming-Soon-A-New-GPS-Receiver-Module!&p=1007645&viewfull=1#post1007645 it looks like the chip they were using has been discontinued.
Sign In or Register to comment.