2
  • ev3dev version: 4.14.117-ev3dev-2.3.5-ev3
  • ev3dev-lang-python version: All output of dpkg-query -l {python3,micropython}-ev3dev*:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                   Version          Architecture     Description
+++-======================-================-================-=================================================
ii  micropython-ev3dev2    2.1.0            all              Python language bindings for ev3dev for MicroPyth
ii  python3-ev3dev         1.2.0            all              Python language bindings for ev3dev
ii  python3-ev3dev2        2.1.0            all              Python language bindings for ev3dev

Problem

I am trying to somehow connect the old version of the HiTechnic NXT Infrared Seeker, part number MS1042. I have been able to find vanishingly little information on this module.

Background Info: Device Browser -> Sensors reveals just one sensor connected (a LEGO Ultrasonic Sensor), when this IR seeker is fully and securely plugged in. Device Browser -> Ports -> ev3-ports:in1 (where the ultrasonic sensor is connected) shows ev3-input-port as driver name, ev3-uart as status. Device Browser -> Ports -> ev3-ports:in2 (where this IR seeker is connected) shows ev3-input-port as driver name, nxt-i2c as status, which looking at the documentation for the new IR seeker, seems correct.

Code:

#!/usr/bin/env python3

###############
### IMPORTS ###
###############

from ev3dev2.sensor import Sensor
from ev3dev2.motor import LargeMotor, OUTPUT_A, OUTPUT_B, SpeedPercent, MoveTank
from ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4, Sensor
from ev3dev2.sensor.lego import UltrasonicSensor
from ev3dev2.led import Leds

left_motor  = LargeMotor(OUTPUT_A)
right_motor = LargeMotor(OUTPUT_B)
us = UltrasonicSensor(INPUT_1)
ir = Sensor(INPUT_2, driver_name='ht-nxt-ir-seek-v2')
ir.mode = 'DC'
us.MODE_US_DIST_CM = 'US_DIST_CM'

while True:
    print(ir.value(0))
    # print( str(us.value()) + " mm")

Error:

Traceback (most recent call last):
  File "/home/robot/Project_3/main.py", line 16, in <module>
    ir = Sensor(INPUT_2, driver_name='ht-nxt-ir-seek-v2')
  File "/usr/lib/python3/dist-packages/ev3dev2/sensor/__init__.py", line 78, in __init__
    super(Sensor, self).__init__(self.SYSTEM_CLASS_NAME, name_pattern, name_exact, **kwargs)
  File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 223, in __init__
    chain_exception(DeviceNotFound("%s is not connected." % self), None)
  File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 54, in chain_exception
    raise exception from cause
ev3dev2.DeviceNotFound: Sensor(ev3-ports:in2) is not connected.

Variations of 'ht-nxt-ir-seek-v2' such as v1, removing the v2, seek -> seeker, do nothing for me. Fundamentally, it is failing to recognize the device as connected. I'm not sure where to go from here. Writing my own driver seems daunting, and hopefully unnecessary given that this device has been in wide use before - I'm just not certain how to find such a driver, or integrate it into ev3dev/micropython.

EDIT: This seems similar to an issue discussed on the ev3dev GitHub page concerning UART rather than i2c. However, my expertise is not advanced enough to really understand what's going on.

EDIT 2: You can see the solution to this problem at the end of the GitHub issue I opened.

Michael Bonnet
  • 111
  • 2
  • 11
  • 1
    I assume you are confident the sensor actually works, from the Device Browser results. Have you been able to get other sensors to work? In particular the new one? At any rate, it seems like you want the help of a very specialized discussion forum, not Stack Overflow. – Karl Knechtel Dec 12 '21 at 18:46
  • As a quick check, though, does it work if you specifically use `InfraredSensor` rather than `Sensor`? – Karl Knechtel Dec 12 '21 at 18:49
  • I am confident the infrared sensor works, as when looking at Ports rather than Sensors under Device Browser on the ev3, it shows that a device with status `nxt-i2c` is there, but when looking at Sensors, it shows just one sensor being plugged into port 1, where I would expect the ultrasonic sensor. Other sensors do work, like the ultrasonic sensor. I'm sure the device works - it has worked in previous projects done by others using the same kits. It does not work when using `InfraredSensor` either - the issue continues to appear to be the ev3 not detecting anything plugged in *as a sensor*. – Michael Bonnet Dec 12 '21 at 20:17

0 Answers0