SuperPro Prototype Board - Lego EV3

I recently got one of the HiTechnic NXT SuperPro Prototype Board to use with my Lego EV3 kit.

I wanted to add some analog voltage inputs to my EV3 brick and this was the best off the shelf option I could find.

Once it arrived, I plugged it in and powered up my EV3. I’m running Ev3dev Linux, so the first thing I did was to check dmesg for any kernel messages. Ev3dev claims to have drivers to support this sensor, so here's hoping I won't need to compile any code :).

[ 809.293715] lego-sensor sensor1: Registered 'ht-super-pro' on 'ev3-ports:in1:i2c8'.
[ 809.595076] lego-port port0: Added new device 'ev3-ports:in1:nxt-i2c-host'

Woooo. I see the I2C device.

It’s exposed via sysfs as shown below:

Using the code snippet below, I was able to read an accurate voltage from the analog input zero!


import time
from ev3dev2.sensor.lego import Sensor

sensor = Sensor(address='ev3-ports:in1:i2c8')

sensor.mode = 'AIN'
print('---- AIN Info ----')
print('address: ', sensor.address)
print('driver_name: ', sensor.driver_name)
print('num_values: ', sensor.num_values)
print('commands: ', sensor.commands)
print('value0: ', sensor.value(0))
print('value1: ', sensor.value(1))
print('value2: ', sensor.value(2))
print('value3: ', sensor.value(3))
print('units: ', sensor.units)
print('mode: ', sensor.mode)
print('modes: ', sensor.modes)
print('decimals: ', sensor.decimals)
print('bin_data_format: ', sensor.bin_data_format)

while(True):
    # Scaling 0 -> 1023 counts : 0 -> 3.3V
    # 310 counts per Volt
    print('Input 0 Voltage: ', sensor.value(0) / 310)
    time.sleep(1)

After reading the driver source, I think I found a mistake in enumerating all the different modes that allow control of the analog outputs and LED and such.

I submitted a pull request here, so hopefully that will be fixed soon :)

Keenan Johnson