Shop OBEX P1 Docs P2 Docs Learn Events
RPM/MPH help please — Parallax Forums

RPM/MPH help please

CapdiamontCapdiamont Posts: 218
edited 2009-09-21 04:40 in Propeller 1
I'm using the Melexis 90217 Hall-Effect Sensor, with the prop. I'm using the motor minder code. I've hooked it up per motor minder pin 7, and per the milling rpm basic stamp page. I've tried running pin1 of the sensor to 5v+ or the 3.3v+. I wasn't sure if the sensor's pin3 to pin7 of the prop should go through a resistor or not with using the 5v supply with the sensor. I'm running off a fresh 6v lantern battery. The capacitor is is the ceramic disk type 0.01uf. I did read earlier that someone was able to use it on 3.3v even though it like 3.5v, and increased the capacitor.

The problem I'm having is it showing rpms when it should be zero. I just swing the magnet when necessary to test.



Please see my last post for lastest code

Post Edited (Capdiamont) : 9/21/2009 12:11:33 AM GMT

Comments

  • RS_JimRS_Jim Posts: 1,768
    edited 2009-09-11 03:38
    I know this is not of much help but I experienced the same problem with the hall effect sensor and the SX. Had to return to an optical TAC.
    rs_jim
  • CapdiamontCapdiamont Posts: 218
    edited 2009-09-15 01:30
    hopefully the code is attached. I have viewport running. I've bypassed the sensor circuit, instead have 3.3v through a resistor to pin 7 of the prop. Note I have viewport objects/code installed. The problem is, although I have pin 7 in viewport showing steady as a rock, my Frpm won't go to zero, but will change by changing pin 7 state. revCount stays at 6424.
  • CapdiamontCapdiamont Posts: 218
    edited 2009-09-21 00:07
    My MPH variable is ended up in the thousands, yet by watching the input, it doesn't bounce. Can somebody please check the code to see if it is good? I've completely restarted from scratch. I'm slowly learning the prop. How long can the sensor be away from the prop/supporting cap/resistor circuit?

    {{
    
      header
          
          
    }}
          
    
    CON
    
      _CLKMODE = XTAL1 + PLL16X        ' 80 Mhz clock
      _XINFREQ = 5_000_000
    
      RPSPin   =  7                ' shaft encoder - Propeller pin
    
      ' F1 = 1.0                          ' floating point 1
      ' F60000 = 60_000.0                 ' floating point 60,000
      Diameter = 10.0                       ' diameter of wheel in inches
      Circumference = Diameter * PI        'result in inches
    
    OBJ
    
      num   : "simple_numbers"
      F     : "FloatMath"
      FS    : "FloatString"
      vp    : "Conduit"
    
    VAR
    
      long  RPS , RPM             ' rev per second, and minute indexes
      long  MPH, Odometer                 ' 
      long  IO                           ' to share io pin info
      byte  RPMArray[noparse][[/noparse]60] , RPMI , RPMI_B ', MPH
      
    PUB Init
    
      ctrb[noparse][[/noparse]30..26] := %01010 'ctrb module to POSEDGE detector
      ctrb[noparse][[/noparse]8..0] := RPSPin    'count revelutions per second
      frqb := 1 'Add 1 for each cycle
      vp.share(@RPS,@RPMI_B) 'allow sharing of first to last varable to viewpoint for debuging uses addresses of varables
      Odometer~
        
        
         repeat
           
           IO:=INA
           phsb~
           waitcnt(clkfreq + cnt)
           RPS := (phsb)
           Odometer += RPS
           RPMArray[noparse][[/noparse]RPMI++] :=  RPS    'store RPseconds in a different place each second
           If RPMI =>= 60
             RPMI~    '60 is above range of array, so reset to zero
           RPM~                        'zero out rpm before adding together array
           repeat RPMI_B from 0 to 59  add up all the revs that happned in the minute
             RPM += RPMArray[noparse][[/noparse]RPMI_B]
           MPH := Circumference * RPM 'calcuate MP
           MPH *= 60   'make it hour time
           MPH /= 63360   'convert to mile from inches
        
    
    

    Post Edited (Capdiamont) : 9/21/2009 12:13:44 AM GMT
  • CapdiamontCapdiamont Posts: 218
    edited 2009-09-21 04:40
    I think I messed up by not accounting for floating point math.

    I changed some of the code, hopefully it works, will have to test in the morning.
           MPH := f.FMul(Circumference, FFloat(RPM))'calcuate MP
           MPH := f.FMul(MPH, 60.0)   'make it hour time
           MPH := f.fDiv(MPH, 63360.0)   'convert to milePH from inchesPH
    
Sign In or Register to comment.