LEGO Mindstorms EV3


The EV3 has four input ports for connecting sensors and other devices (like sensor multiplexers or motor controllers). If you are trying to use something that plugs into one of those ports, you are in the right place.

Types of Sensors
When dealing with sensors in ev3dev, it is useful to know how it communicates with the EV3 brick. There are four basic kinds of communication that the input ports can use to get information from the sensor: analog, NXT Color Sensor, I2C and UART.

Analog Sensors
These are the simplest type of sensor. The measured value is converted to a voltage (0-5VDC) that is read by the EV3. There are actually two types of analog sensors. We call the first EV3/Analog. These are sensors that were designed specifically for the EV3 and will not work on the NXT because the pinout is different. They contain an ID resistor so that the EV3 can tell different types of sensors apart. The second type is NXT/Analog. These sensors are designed for the NXT, but also work on the EV3. The EV3 cannot differentiate between most of these sensors though, so you have to tell it which one your have or just use the generic driver.

WeDo sensors, referred to as WeDo/Analog, are also analog sensors. They are actually electrically similar to EV3/Analog sensors (require 5V power and have ID resistor). Currently, we only support WeDo sensors attached to a WeDo hub, but if someone would like to design a cable and modify the wedo-sensor and lego-ports drivers, we could easily make them work with the input ports on the EV3.

RCX sensors also fall into this category, but do not work with the EV3 - at least not with the converter cable described in the NXT Hardware Developers kit. This is due to a difference in the input port pins between the EV3 and the NXT. If someone wants design a new converter cable, we could make them work.

LEGO NXT Color Sensor
The LEGO NXT Color Sensor is in a class of its own. It uses a hybrid of analog and (non-standard) digital communications. The NXT Color Sensor is not usable at this point in time. We can detect it with the auto-detect, but we don’t have a driver for it yet.

I2C Sensors
I2C sensors are sensors that communicate with the intelligent brick via the I2C protocol. In the NXT documentation, they are referred to a “digital” sensors. These sensors can be sorted into two categories as well: those that were designed using LEGO’s guidelines and those that use an off the shelf I2C chip. ev3dev supports both kind of sensors, but only the first type is auto-detected. We will refer to the former as NXT/I2C and the latter as Other/I2C

UART Sensors
These is a new type of sensor that is designed specifically for the EV3 (they don’t work with the NXT). They use an UART to send data to the brick. These sensors are a bit “smarter” in that in addition to sending the data of what they measure, they also send information about their capabilities. This means that any new EV3/UART sensors should “just work” without us having to write new drivers. Since the ‘U’ in UART means universal, this also means that EV3/UART sensors can connect to any UART device, not just the input ports.

Using Sensors
General resources:

Sensor Tutorial
The LEGO Sensor (lego-sensor) Class
EV3 Input Port Driver
I2C sensor resources (applies to both NXT/I2C and Other/I2C):

I2C Sensor Addressing
Using I2C Sensors
Sensor-specific resources:

Follow the links in the Supported Sensors table below
Unsupported Sensors
One of the goals of ev3dev is to support as many sensors as possible. In fact, even if a manufacturer’s documentation says that a device does not work with the EV3, chances are it will work with ev3dev.

If you have a sensor that is not supported let, let us know about it by opening an issue on GitHub. For many sensors adding a driver is trivial - even if you are not a “kernel hacker” or a “c programmer”. For the non-trivial sensors, see the contributing page for information on how to write a driver or how to donate hardware to someone who will.

Supported Sensors
This is a list of sensors that currently have drivers available in the ev3dev kernel.

Manufacturer P/N Name Connection Auto-
Driver (Module)
    Generic EV3 Analog Sensor Analog/EV3 Y ev3-analog-XX1 (ev3-analog-sensor)
    Generic NXT Analog Sensor Analog/NXT Y nxt-analog (nxt-analog-sensor)
Charmed Labs   Pixy (CMUcam5) for LEGO  I2C/NXT Y pixy-lego (nxt-i2c-sensor)
Dexter Industries   dFlex Analog/NXT N2 di-dflex (nxt-analog-sensor)
HiTechnic   NXT Color Sensor I2C/NXT Y ht-nxt-color (nxt-i2c-sensor)
NAA1030 NXT Angle Sensor I2C/NXT Y ht-nxt-angle (nxt-i2c-sensor)
NAC1040 NXT Acceleration / Tilt Sensor I2C/NXT Y ht-nxt-accel (nxt-i2c-sensor)
NBR1036 NXT Barometric Sensor I2C/NXT Y ht-nxt-barometric (nxt-i2c-sensor)
NCO1038 NXT Color Sensor V2 I2C/NXT Y ht-nxt-color-v2 (nxt-i2c-sensor)
NEO1048 NXT EOPD Analog/NXT N3 ht-nxt-eopd (nxt-analog-sensor)
NFS1074 NXT Force Sensor Analog/NXT N3 ht-nxt-force (nxt-analog-sensor)
NGY1044 NXT Gyro Sensor Analog/NXT N3 ht-nxt-gyro (nxt-analog-sensor)
NIL1046 NXT IRLink Sensor I2C/NXT Y ht-nxt-ir-link (nxt-i2c-sensor)
NIR1032 NXT IRReceiver Sensor I2C/NXT Y ht-nxt-ir-receiver (nxt-i2c-sensor)
NIS1070 NXT PIR Sensor I2C/NXT Y ht-nxt-pir (nxt-i2c-sensor)
NMC1034 NXT Magnetic Sensor I2C/NXT Y ht-nxt-compass (nxt-i2c-sensor)
NMS1035 NXT Magnetic Sensor Analog/NXT N3 ht-nxt-mag (nxt-analog-sensor)
NSK1042 NXT IRSeeker V2 I2C/NXT Y ht-nxt-ir-seek-v2 (nxt-i2c-sensor)
NSX2020 NXT Sensor Multiplexer I2C/NXT Y ht-nxt-smux (nxt-i2c-sensor)
SPR2010 NXT SuperPro Prototype Board I2C/NXT Y ht-super-pro (nxt-i2c-sensor)
LEGO 45504 EV3 Ultrasonic Sensor UART/EV3 Y lego-ev3-us (ev3-uart-sensor)
45505 EV3 Gyro Sensor UART/EV3 Y lego-ev3-gyro (ev3-uart-sensor)
45506 EV3 Color Sensor UART/EV3 Y lego-ev3-color (ev3-uart-sensor)
45507 EV3 Touch Sensor Analog/EV3 Y lego-ev3-touch (ev3-analog-sensor)
45509 EV3 Infrared Sensor UART/EV3 Y lego-ev3-ir (ev3-uart-sensor)
9581 WeDo USB Hub USB Y wedo-hub (wedo)
9583 WeDo Motion Sensor Analog/WeDo Y wedo-motion (wedo)
9584 WeDo Tilt Sensor Analog/WeDo Y wedo-tilt (wedo)
9668 Energy Display I2C/NXT Y lego-power-storage (nxt-i2c-sensor)
9749 NXT Temperature Sensor I2C/Other Y4 tmp275 (lm75)
9843 NXT Touch Sensor Analog/NXT Y5 lego-nxt-touch (nxt-analog-sensor)
9844 NXT Light Sensor Analog/NXT Y lego-nxt-light (nxt-analog-sensor)
9845 NXT Sound Sensor Analog/NXT N3 lego-nxt-sound (nxt-analog-sensor)
9846 NXT Ultrasonic Sensor I2C/NXT Y lego-nxt-us (nxt-i2c-sensor)
Microinfinity CruizCore XG 1300L Digital Gyroscope And Accelerometer I2C/NXT N6 mi-xg1300l (nxt-i2c-sensor)
mindsensors.com AbsoluteIMU(-A/C/G) Gyro, MultiSensitivity Accelerometer and Compass I2C/NXT Y ms-absolute-imu (nxt-i2c-sensor)

AngleSensor    GlideWheel-AS    I2C/NXT    Y    ms-angle (nxt-i2c-sensor)
EV3SensorMUX    EV3 Sensor Multiplexer    I2C/NXT    Y    ms-ev3-smux (nxt-i2c-sensor)
LightSensorArray    Light Sensor Array    I2C/NXT    Y    ms-light-array (nxt-i2c-sensor)
LineLeader    Line Follower Sensor    I2C/NXT    Y    ms-line-leader (nxt-i2c-sensor)
NXTCam-v4    Vision Subsystem v4 for NXT or EV3    I2C/NXT    Y    ms-nxtcam (nxt-i2c-sensor)
NXTMMX-v2    Multiplexer for NXT/EV3 Motors    I2C/NXT    Y    ms-nxtmmx (nxt-i2c-sensor)
NxtServo    8-channel Servo Controller    I2C/NXT    Y    ms-8ch-servo (nxt-i2c-sensor)
PCF8574-Nx    Sensor building kit for NXT with PCF8574 IC    I2C/Other    N7    pcf8574 (gpio-pcf857xr)
PCF8591-Nx    Sensor building kit for NXT with PCF8591 IC    I2C/Other    N7    pcf8591 (pcf8591)
PixyAdapter    Pixy Adapter for MINDSTORMS EV3 or NXT    I2C/NXT    Y    ms-pixy-adapter (nxt-i2c-sensor)
RTC-Nx-v3    Realtime Clock for NXT    I2C/Other    N7    ds1307 (rtc-ds1307)
TouchMux    Touch Sensor Multiplexer for NXT & EV3    Analog/NXT    N3    ms-nxt-touch-mux (nxt-analog-sensor)

The XX in ev3-analog-XX is replaced with the type id of the sensor (01 to 14). Type id 02 is the LEGO EV3 Touch sensor, so ev3-analog-02 does not exist.

The Dexter Industries dFlex sensor cannot be automatically detected (because pin 2 is not connected to pin 3). In order to use this sensor, you must manually set the port to nxt-analog mode and then set the driver to di-dflex.

The auto-detection algorithm detects this sensor as an NXT/Analog type sensor but it cannot determine the exact sensor type. The generic analog driver (nxt-analog) will be loaded by default for this sensor. See the lego-port class for information on how to manually load the correct driver.

Temperature sensors using the lm75 module can be auto-detected. You must run modprobe lm75 for this to happen. You can also make the lm75 module load automatically on boot by adding it to /etc/modules.

Only touch sensors that shipped with the NXT 2.0 set can be automatically detected. Older touch sensors that shipped with the original NXT sets are missing an electrical connection (pin 2 is not internally connected to pin 3).

The auto-detection algorithm detects this sensor as an I2C sensor and the port is automatically put into I2C mode. However, this sensor only partially follows the LEGO MINDSTORMS convention for I2C sensors, so the driver must be loaded manually. See the sensor’s page for more information.

The auto-detection algorithm detects this sensor as an I2C sensor and the port is automatically put into I2C mode. However, the sensor does not follow the LEGO MINDSTORMS convention for I2C sensors, so the exact type of sensor cannot be determined. See Using I2C Sensors for information on how to manually load the correct driver.