Motor Minder Object and Hall effect question
dodger
Posts: 37
I am trying to use a hall effect sensor to measure Rpm.· I am using the motor minder object and debugging withe serial terminal. I am outputting a value of 5.452 e +38 while there is no motion.· Anyone have a similar problem before.· Voltage in is 3.3v, data sheet says 3.5-24v, I have tried 9v and 3.3 v and same output.
·· Motor_Minder_Test.spin
····· Tom Doyle
····· 6 March 2007
··· Motor_Minder monitors the speed and revolution count of a motor using a shaft encoder.
··· It was tested with the Melexis 90217 Hall-Effect Sensor (Parallax 605-00005) and a single
··· magnet mounted (Parallax 605-00006) on the shaft. It should work with any type of
··· sensor that puts out one pulse per revolution. The object runs in a new cog updating
··· varibles in the calling cogs address space. It has been tested with one motor. To clear
··· the revolution counter memory call the start procedure again.
·····
·····
}}
·····
CON
· _CLKMODE = XTAL1 + PLL16X······· ' 80 Mhz clock
· _XINFREQ = 5_000_000
· Encoder1pin·· =· 16··············· ' shaft encoder - Propeller pin
· F1 = 1.0························· ' floating point 1
· F60000 = 60_000.0················ ' floating point 60,000
OBJ
· mm··· : "Motor_Minder"
· 'lcd·· : "serial_lcd"
· num·· : "simple_numbers"
· F···· : "FloatMath"
· FS··· : "FloatString"
· Ext :·· "Extended_FDSerial_128ByteBuffers"
VAR
· long· period, revCount············ ' motor period and revCount updated by Motor_Minder.spin
· long· Fwidth, Frpm················ ' floating point variables for display
·
PUB Init
· 'if lcd.start(0, 9600, 4)
··· 'lcd.putc(lcd#LcdOn1)······························· ' no cursor
··· 'lcd.cls············································ ' setup screen
··· 'lcd.backlight(1)
··· 'lcd.str(string("Encoder"))
···mm.start(Encoder1pin, @period, @revCount)
···Ext.start (31,30,0,9600)
···
···· repeat
······ 'lcd.gotoxy(0,0)
·····
······ FS.setPrecision(4)
···
······ Fwidth := F.FFloat(period)
······ Fwidth := F.FDiv(F1, Fwidth)
······ Frpm := F.FMul(Fwidth, F60000)
······ Ext.str(string(" RPM"))
······ Ext.tx(13)
······ Ext.str(FS.FloatToString(Frpm))
······ 'lcd.str(FS.FloatToString(Frpm))
······ 'lcd.str(string(" RPM···· "))
·····
······ 'lcd.gotoxy(0,1)
······ 'lcd.str(num.dec(revCount))
·
·· Motor_Minder_Test.spin
····· Tom Doyle
····· 6 March 2007
··· Motor_Minder monitors the speed and revolution count of a motor using a shaft encoder.
··· It was tested with the Melexis 90217 Hall-Effect Sensor (Parallax 605-00005) and a single
··· magnet mounted (Parallax 605-00006) on the shaft. It should work with any type of
··· sensor that puts out one pulse per revolution. The object runs in a new cog updating
··· varibles in the calling cogs address space. It has been tested with one motor. To clear
··· the revolution counter memory call the start procedure again.
·····
·····
}}
·····
CON
· _CLKMODE = XTAL1 + PLL16X······· ' 80 Mhz clock
· _XINFREQ = 5_000_000
· Encoder1pin·· =· 16··············· ' shaft encoder - Propeller pin
· F1 = 1.0························· ' floating point 1
· F60000 = 60_000.0················ ' floating point 60,000
OBJ
· mm··· : "Motor_Minder"
· 'lcd·· : "serial_lcd"
· num·· : "simple_numbers"
· F···· : "FloatMath"
· FS··· : "FloatString"
· Ext :·· "Extended_FDSerial_128ByteBuffers"
VAR
· long· period, revCount············ ' motor period and revCount updated by Motor_Minder.spin
· long· Fwidth, Frpm················ ' floating point variables for display
·
PUB Init
· 'if lcd.start(0, 9600, 4)
··· 'lcd.putc(lcd#LcdOn1)······························· ' no cursor
··· 'lcd.cls············································ ' setup screen
··· 'lcd.backlight(1)
··· 'lcd.str(string("Encoder"))
···mm.start(Encoder1pin, @period, @revCount)
···Ext.start (31,30,0,9600)
···
···· repeat
······ 'lcd.gotoxy(0,0)
·····
······ FS.setPrecision(4)
···
······ Fwidth := F.FFloat(period)
······ Fwidth := F.FDiv(F1, Fwidth)
······ Frpm := F.FMul(Fwidth, F60000)
······ Ext.str(string(" RPM"))
······ Ext.tx(13)
······ Ext.str(FS.FloatToString(Frpm))
······ 'lcd.str(FS.FloatToString(Frpm))
······ 'lcd.str(string(" RPM···· "))
·····
······ 'lcd.gotoxy(0,1)
······ 'lcd.str(num.dec(revCount))
·
Comments
Ext.str(num.tostr(@revCount,Num#DDEC))··················· 'I was trying to see number in counter constant 4
Ext.str(FS.FloatToString(Frpm))···································'RPM
Ext.str(num.tostr(Frpm,Num#DDEC))·····························'RPM
When i pass a magnet across the hall effect sensor my program stops, and·I dont recieve anything on the serial term.
Any suggestions?
Post Edited (dodger) : 5/3/2009 5:43:18 PM GMT
Im not real sure if im setting up the circuit correctly. I have read the data sheet for the 90217 Hall Effect Sensor and it seems like the magnet should be attatched to the back of the sensor. But in the notes at the top of the Motor minder object it states they used the 90217 with a magnet mounted to the shaft. Do i need a magnet on both the hall effect sensor and the shaft? I've tried both ways and no luck.
I dont really have anything to rotate so i have just been passing a magnet or piece of metal in front of the sensor.·
Could someone please help..
Thanks
Post Edited (dodger) : 5/4/2009 6:23:54 AM GMT