Position sensor: Difference between revisions

From Smart Box
Jump to navigation Jump to search
(Created page with "The Smart Sense position sensor will indicate rotational movement over a 360° range. The sensor connects to any one of the analogue sensor inputs. Once connected the Smart Move software will display the name of the sensor and label the appropriate input ‘Position’. The screen will display the current reading from the sensor, a complete rotation of the spindle will cover the range from 0 to 255. The reading can be converted to degrees by multiplying by 1.41. i.e. PRI...")
 
(→‎Procedure: Pendulum: Added chart to show result of program)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:Sensor-Position.svg|right]]
The Smart Sense position sensor will indicate rotational movement over a 360° range.
The Smart Sense position sensor will indicate rotational movement over a 360° range.
The sensor connects to any one of the analogue sensor inputs.
The sensor connects to any one of the analogue sensor inputs.
Line 35: Line 37:


=== Procedure: Pendulum ===
=== Procedure: Pendulum ===
[[File:Chart-Position-Sensor-Pendulum.svg|frameless|right]]


  FILE 1,"data"
  FILE 1,"data"
Line 45: Line 49:


[[Category:Sensors]]
[[Category:Sensors]]
[[Category:Missing images]]

Latest revision as of 03:28, 21 October 2023

The Smart Sense position sensor will indicate rotational movement over a 360° range. The sensor connects to any one of the analogue sensor inputs. Once connected the Smart Move software will display the name of the sensor and label the appropriate input ‘Position’. The screen will display the current reading from the sensor, a complete rotation of the spindle will cover the range from 0 to 255. The reading can be converted to degrees by multiplying by 1.41. i.e. PRINT POSITION * 1.41

Responding to position[edit]

The sensor can be used as an input device to a system which responds to changes in position. The example procedure "Compass" uses the sensor to produce an electronic ‘compass’. One of the outputs will switch on as the sensor moves through each quarter of a turn.

Procedure: Compass[edit]

REPEAT
IF POSITION >= 0 AND POSITION <=63 THEN SWITCH ON 0 ELSE SWITCH OFF 0
IF POSITION >= 64 AND POSITION <=127 THEN SWITCH ON 1 ELSE SWITCH OFF 1
IF POSITION >= 128 AND POSITION <=191 THEN SWITCH ON 2 ELSE SWITCH OFF 2
IF POSITION >= 192 AND POSITION <=255 THEN SWITCH ON 3 ELSE SWITCH OFF 3
FOREVER

How it works[edit]

The first and last lines of the procedure form a loop which continues until the user escapes from the procedure. Each line within the loop checks if the sensor reading is within a certain range and switches on or off the appropriate output.

Measuring rotation[edit]

The second example uses the sensor to gather data as a pendulum swings. The procedure "Pendulum" will wait until the user presses the space bar. At this point the pendulum should be released and the readings from the sensor are stored to a disk file. Once the pendulum has come to rest the space bar is pressed and the readings are saved to disk. This file can then be used with a spreadsheet to produce results as in the figure. This example compares results from two pendulums of different length.

Procedure: Pendulum[edit]

FILE 1,"data"
WAIT UNTIL GET = 32
PRINT "sampling"
REPEAT
STORE 1,POSITION
UNTIL INKEY = 32
CLOSE 1