Dexter Industries BrickPi/BrickPi+¶
This page describes the drivers that are specific to Dexter Industries BrickPi and BrickPi+ These controllers are LEGO MINDSTORMS compatible addon boards for Raspberry Pi.
BrickPi is identified by hardware v1.7.3 and BrickPi+ is identified as v2.8.
The BrickPi and BrickPi+ have 4 input ports that can be used with LEGO MINDSTORMS compatible sensors. It works with most sensors, but there are some exceptions. It only supports the LEGO brand EV3/UART Sensors and EV3/Analog Sensors. Also, there are currently some limitations on the supported NXT/I2C Sensors (See the I2C Sensor Driver). Any type of NXT/Analog Sensors will work.
Unlike the EV3, BrickPi cannot automatically detect sensors! You
must manually specify the type of sensor that is attached to the port
|Connection types||NXT/Analog, NXT/I2C, EV3/Analog, EV3/UART|
|Number of modes||6|
||LEGO NXT Color sensor|
|||The full port name includes the parent device
node. So, the |
|||No sensors are loaded by default. You must address manually specify the sensor that is connected and its by using the set_device attribute. This is equivalent to manually loading I2C devices. The sensor port address will be the BrickPi port address with “:i2c” and the decimal I2C address appended. The I2C Sensor Driver section has information regarding the use of sensors connected to a brickpi-in-port.|
|||Only the LEGO EV3 Touch sensor is supported.The driver will load by default.|
|||Only the LEGO EV3 Ultrasonic, Color,
Gyro, and Infrared sensors are supported. They cannot be
automatically detected, so you must specify the sensor
manually using the |
Input Port 5¶
Only the original BrickPi has an Input Port 5. BrickPi+ does not.
Input Port 5 on the BrickPi is physically wired to the I2C pins on the Raspberry
Pi and I2C is supported by the
i2c_bcm2708 kernel module (there is no
ev3dev-specific driver for this port).
Sensor types are listed in the Supported Sensors table.
For Input Port 5 to work with most LEGO compatible sensors, you have to make sure that correct baudrate for the sensor is set and load the driver manually. NXT/I2C Sensors should work with the slow 9600 baudrate used originally by LEGO MINDSTORMS NXT.
You can temporarily change the baudrate on a running system. This change will be reset after a reboot:
sudo modprobe -r i2c_bcm2708 # remove module sudo modprobe i2c_bcm2708 baudrate=9600 # load module specifying baudrate
Some devices behave erratically if baudrate is changed while they are plugged in. If needed unplug your sensor, change the baudrate and plug the sensor again.
Or, you can permanently change the baudrate by editing
with the following line (requires reboot to take effect):
To use a sensor, you have to tell the I2C adapter the driver and I2C address
to use. When you write this to
a new sensor device will appear in
/sys/class/lego-sensor/ which can be
used as you would any other sensor.
You can find the driver name and default I2C address in the sensor information pages.
Example: Loading Microinfinity CruizCore XG1300L driver manually:
sudo sh -c 'echo "mi-xg1300l 0x01" > /sys/bus/i2c/devices/i2c-1/new_device'
I2C Sensor Driver¶
There is currently not a standard I2C adapter driver for BrickPi/BrickPi+
(i.e. You will not find
/dev/i2c-X for the BrickPi input ports. Instead,
this driver is used for working with NXT/I2C Sensors.
To load this driver, set the BrickPi input port to
nxt-i2c mode and then
write the driver name and I2C address of the sensor to the
attribute. You can find the driver name and default I2C address on the
sensor’s information page.
echo "nxt-i2c" > /sys/class/lego-port/port0/mode echo "ht-angle 0x01" > /sys/class/lego-port/port0/set_device
Once the driver has been loaded, there will be a new sensor device node added in the The lego-sensor Subsytem.
Unfortunately, some sensors require special operations that are not currently
supported in this driver, so attempting to use one of those sensors will
dmesg). If you have a BrickPi, you can use Input
Port 5 instead.
BrickPi(+) has four output ports labeled M1, M2, M3 and M4. These ports are very similar to EV3 output ports with a motor controller and quadrature encoder feedback. However, they cannot automatically detected when a motor is attached or removed. By default, the NXT motor driver is already loaded for these ports, so you don’t have to set the mode unless you want to use a different type of driver.
|Connection types||tacho-motor, dc-motor, led|
|Number of modes||3|
||NXT/EV3 Large Motor|
||RCX/Power Functions motor|
||RCX/Power Functions LED|
The BrickPi+ battery driver is only available on BrickPi+ (HW v2.8), not the earlier BrickPi models.
- This driver is used to get information about the BrickPi+ battery.
- It uses the power_supply subsytem.
- It registers a sysfs device node at
This driver is enabled by the line
||Returns the battery voltage in microvolts.|