- touch (on off switch)
- sound (sound level reading)
- sonar (distance reading between 7 cm and 255 cm), see mapping radar blog
- light (difficult to give a scale here,
- fast sensor
- important is (in lejos) to use readNormalizedValue() method for values between 0 and 1023)
- on sensor port 4 the floodlight does not function (on my brick)
- motor, the degrees of turning can be measured
Other sensors can be bought, i bought them here: http://www.mindsensors.com/
These are I2C sensors, so they are much slower than the custom sensors. Also reading these sensors in one loop is a good test of the software you use: reading multiple I2C sensors poses a problem for the fantom lib and NEC. The C++ lib of Anders gives the right values, but is very slow: 3 sensor readings in 2 sec., for instance clock, compass, distance.
- compass (one readout raw: 0 - 512, in Anders Lib two precisions degree of half degree)
- watch it: if the compass sensor too close to the brick it gives garbage! (10 cm is ok)
- I2C sensor: not fast
- this sensor has to be as horizontal as possible otherwise the degrees measured will not cover the circle evenly, or even stay at one side of the center, this was discovered in the radar experiments.
- acceleration (6 readouts, tilt an accelaration, this can be used as a compass too?)
- I2C sensor: not fast
- camera (can follow objects, see camera blog)
- quite a lot of basic documentation: and the texts on www.mindsensors.com
- it helps a bit to know about DIRECT COMMANDS
- clock (giving a time readout, blocks available for FIRMWARE; made ourselves classes for C++ and Lejos
- has free memory available, non volatile, 56 bytes!
- homebrew classes for Dev-Cpp Lejos and fantom lib
- PSP-NX this is not really a sensor, but a digital interface to the playstation controller, we made the Lejos JAVA class for this I2C sensor
see classes for lejos written out:
http://www.koders.com/info.aspx?c=ProjectInfo&pid=RHGY8H3PWYCG28MNNNS8V1BLGC)
For these extra sensors special blocks can be downloaded for use in the FIRMWARE.
examples: http://www.teamhassenplug.org/NXT/
Then testing the time the sensors use to measure: (quite neccesary, sometimes performance depends on speed.)
- the light sensor works fast, being in the core of the NXT
- the acceleration sensor is lowspeed, (I2C) this makes a big difference!
- the compass is low speed, so stopping motors on a certain heading can be not too precise
Measurements (first on my laptop, using bluetooth connection, and then a lejos JAVA prog on brick)
comparing the times the different sensors react in combination with the software and the bluetooth.
//--------------------------------------------------------------------------------------------------------------------------
// DevCpp (small standard console prog with lib of Anders)
//--------------------------------------------------------------------------------------------------------------------------
(using the fastest possible while statement, without sleep or thread)
lightsensor: 1000 times (included readout in console) 22 sec
acceleration sensor: 1000 times (included readout in console) 273 sec (reading only the xTilt)
1000 times all six values 1640 sec (wow!)
(I wrote the accel class like the other sensor classes)
compass: 1000 times (included readout in console) 273 sec (exactly the same as the low speed acceleration sensor.)
So with this knowledge, for instance making a balancing robot, the lightsensor should be used.
//--------------------------------------------------------------------------------------------------------------------------
// C#, using bluetooth connection.
//--------------------------------------------------------------------------------------------------------------------------
I used my example prog TryoutClasses, since this is a minimum setting, without having installed all kinds of sensors at the same time nor polling time
lightsensor 1000 times 22220 milliseconds (you would not believe this!) = 22 sec, exactly the DevCpp value
compass sensor 1000 times 66697 milliseconds, which is faster than the DevCpp, why? Reading at double degree?
accelleration sensor 100 times 6688 milliseconds for one reading xTilt
accelleration sensor 100 times 40178 milliseconds for six readings 3 tilts and three accelerations
So in the C#, the readings of the low speed sensors seem to be faster!
//--------------------------------------------------------------------------------------------------------------------------
// comparing this with reading sensors in a lejos program on the brick
//--------------------------------------------------------------------------------------------------------------------------
for a prog on the brick how is this to know the elapsed time?
The clock sensor! (This is one way)
The internal clock. (This is another)
The internal clock gives a long, which has to be cast to an int or double:
double nowTime = (double)System.currentTimeMillis() ;
because this Lejos JAVA doesn't operate on long's
tiltsensor xTilt() : 1000 measurements 26 sec (included displaying currentTimeMillis())
tiltsensor 3 times xTilt, yTilt, zTilt, without displaying the elapsed time, or anything: 13 sec!
lightsensor 10000 times (yes) in 4 sec
lightsensor with displaying the value and the time on the LCD 1000 measurements: 22 sec!
Conclusion: the readings of the sensors is much faster when on the brick, and the lightsensor is always faster then the tilt, other I2C sensors, like compass.
Sonar is I2C too, but has a special connection to the ARM7 Brick processor.
//--------------------------------------------------------------------------------------------------------------------------
// putting sensors together
//--------------------------------------------------------------------------------------------------------------------------
One of the goals is a radar device, scanning the environment and making a map, eventually following intruders in the environment he scanned.For this sensors had to be put together.
The compass and the motor-degrees can be compared.
The image shows a brick which is only built to trun around its axis and giving measurements. When polling this array of I2C sensors, time must be given for each measurement, as described above.
(Using the bluetooth and some language on the laptop, data can be analysed easily, using the JAVA lejos, everything has to be done on the brick itself.)
(In principle, when always orientating the brick to some main wall, the motor-degrees can be used replacing the compass. So the radar device can be made with the motor and the sonar-distance sensor.)
The compass and the motor-degrees were behaving (aren't we lucky!) linearly.
The RAM of the clock can be made useful too, storing the information gathered.
ok to be continued................
0 comments:
Post a Comment