Sensors

All Sensor Data

All sensor data can be seen live at any time by selecting "Remote Control" page from the coding editor menu as shown below.

Alternatively, all sensor data can be printed out to the console with code as below:

Syntax:

eBot.sensors

Example:

control.forever(function() {
    console.log(eBot.sensors)
    control.wait(1)
})

Line Sensors Analog

The line sensors are analog infrared and return a value between 0-100 where a white line returns a max of 100 and a black line returns a min of 0, however any value is possible depending on the reflectivity of the line surface.

Syntax:

eBot.sensors.line.analog.LHS|RHS

Example:

control.forever(function(){
    if (eBot.sensors.line.analog.LHS > 50) {
        console.log('I see white')
    }
})

Line Sensors Digital

The line sensors are analog infrared, however eBot also converts the analog value to a digital BW value i.e. either "black" or "white" using defined cutoffs. The default cutoffs are white: >70 and black: <50 but these can be changed on the config page of the coding editor. The digital line sensor values are booleans and thus return either "true" or "false". So if the LHS line sensor is over a white line then sensors.line.digital.LHSBlack = false and sensors.line.digital.LHSWhite = true.

Syntax:

eBot.sensors.line.digital.LHSBlack|LHSWhite|RHSBlack|RHSWhite

Example:

control.forever(function(){
        if (eBot.sensors.line.digital.LHSBlack) {
        console.log('I see black')
    }
})

Ultrasonic Distance Analog

The Ultrasonic Distance Sensors are analog and report back the distance values in centimeters (cm)

Syntax:

eBot.sensors.ultra.analog.LHS|RHS

Example:

control.forever(function(){
    if (eBot.sensors.ultra.analog.LHS < 20) {
        console.log('object close')
    }
})

Ultrasonic Sensors Digital

The Ultrasonic distance sensors are analog, however eBot also converts the analog value to a digital Min|Max value. The sensor values are booleans and thus return either "true" or "false". So if the eBot is 20cm infront of a wall and pointing straight at it then: sensors.ultra.digital.LHSMin = true, as does the RHS, but sensors.ultra.digital.LHSMax = false, as does the RHS. The default cutoffs are max: >60cm and min: <30cm but these can be changed on the config page of the coding editor.

Syntax:

eBot.sensors.ultra.digital.LHSMin|LHSMax|RHSMin|RHSMax

Example:

control.forever(function(){
    if (eBot.sensors.ultra.digital.LHSMin) {
        console.log('object close')
    }
})

Voltage and Current

The Voltage Sensor is analog and reports the battery voltage in Volts. The Current Sensor is analog and reports the current consumption from the battery in Amperes (Amps).

Syntax:

eBot.sensors.voltage
eBot.sensors.current

Example:

console.log('The Power consumption in Watts:')
console.log(eBot.sensors.voltage * eBot.sensors.current)

Colour Values

The Colour Sensor is Analog and reports back values for Red, Green, Blue, White and Colour Corrected Temperature (CCT).

Syntax:

eBot.sensors.colour.red
eBot.sensors.colour.green
eBot.sensors.colour.blue
eBot.sensors.colour.white
eBot.sensors.colour.CCT

Example:

control.forever(function(){
    console.log('Red Colour Sensor Value')
    console.log(eBot.sensors.colour.red)
    console.log('Green Colour Sensor Value')
    console.log(eBot.sensors.colour.green)
    console.log('Blue Colour Sensor Value')
    console.log(eBot.sensors.colour.blue)
    console.log('White or total light Colour Sensor Value')
    console.log(eBot.sensors.colour.white)
    console.log('Colour Corrected Temperature Colour Sensor Value')
    console.log(eBot.sensors.colour.CCT)
    control.wait(1)
})

Colour Guess

The Colour Guess system uses an algorithm to distinguish colours. We have calibrated it using Norton Bear brand Cloth tape of colours White, Red, Green, Blue, Black and Silver. So for best results use that tape. Our standard Colour Guess calibration returns the following colours: White, Red, Green, Blue, Black and Silver.

The inbuild colour algorithm can be calibrated using the config page in the coding editor. Just put eBot over the colour, select the appropriate colour and band (5 or 10 recommended) and then click "Set New Value". It is also possible for you to write your own colour detection code using raw analog RGB colour sensor values which is how our system works.

Syntax:

eBot.sensors.colour.guess

Example:

control.forever(function(){
    console.log('Colour Sensor Colour Guess')
    console.log(eBot.sensors.colour.guess)
    control.wait(1)
})

RFID

Syntax:

eBot.sensors.RFIDTagID
eBot.sensors.RFIDTagName

Example:

eventsEbot.addEventListener('RFID Read Differrent', function(){
    console.log('RFID CARD NAME')
    console.log(eBot.sensors.RFID.tagName)
    console.log('RFID CARD TAG ID')
    console.log(eBot.sensors.RFID.tagID)
})

Crane Proximity

Syntax:

eBot.sensors.proximityLHS
eBot.sensors.proximityRHS

Example:

control.forever(function(){
    if (eBot.sensors.craneProximity.LHS) {
        console.log('Crane Proximity LHS ON')
    } else {
        console.log('Crane Proximity LHS OFF')
    }
})

Wheel Distance

Note that this data is only available for 2WD eBots because they use stepper motors which provide accurate positional control.

Syntax:

eBot.sensors.wheelDistance.LHS|RHS
eBot.wheels.resetDistanceCmd()

Example:

eBot.wheels.resetDistanceCmd()
eBot.wheels.driveDirectionWordCmd('Forward',50)
control.forever(function(){
    if (eBot.sensors.wheelDistance.LHS > 500) {
        console.log('destination Reached')
        wheels.stopCmd('brake')
    } else {
        console.log('Not there yet')
    }
    control.wait(1)
})