MTRMX+Ultrasonic Sensor port splitter

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: imaqine, 99jonathan, roger

New User
Posts: 3
Joined: Thu Feb 17, 2011 6:46 pm

MTRMX+Ultrasonic Sensor port splitter

Postby nxthacker » Thu Feb 17, 2011 6:56 pm

For a while I'm trying to get a MTRMX and a Lego Ultrasonic Sensor to work with a portsplitter, but I didn't succeed.
I read the port splitter concerning threads, but it didn't help.
Here is my code:

Code: Select all

import lejos.nxt.*;
import lejos.nxt.addon.*;

public class MuxTest2 {

   public static void main(String[] args) throws InterruptedException {

      RCXMotorMultiplexer mux = new RCXMotorMultiplexer(SensorPort.S1);
      UltrasonicSensor ultrasonicSensor = new UltrasonicSensor(SensorPort.S1);
      while (!Button.ESCAPE.isPressed()) {
         LCD.drawString(ultrasonicSensor.getDistance()+"  ", 0, 4);



The Ultrasonicsensor works properly, but the MTRMX doesn't work, only if the US Sensor is disconnected.
I tried to turn APDA on, but it didn't work.
The two devices have different i2c adresses, I have checked this.

What can I do?

PS: Sorry for my bad English, I'm German.

User avatar
leJOS Team Member
Posts: 5622
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby gloomyandy » Thu Feb 17, 2011 7:01 pm

Does this work if you the Lego software? That would be the first place to start. This will tell you if there is a hardware or a leJOS problem. Also make sure the cables you are using are as short as possible...


New User
Posts: 3
Joined: Thu Feb 17, 2011 6:46 pm

Postby nxthacker » Thu Feb 17, 2011 7:15 pm

Same result:
It works when I disconnect the US Sensor, otherwise it doesen't work.

EDIT: I changed the nxt-g programm a bit, now it works sometimes and sometimes not.
Last edited by nxthacker on Thu Feb 17, 2011 7:21 pm, edited 1 time in total.

New User
Posts: 3
Joined: Thu Feb 17, 2011 6:46 pm

Postby nxthacker » Thu Feb 17, 2011 7:22 pm

I don't think so because the addresses are different (0x02 and 0xB4)

I have discovered something very interesting:
If you put your finger on the blue cable pin on the motormux, it works always, otherwise sometimes.
If you connect pin 6 (blue cable) with pin 2 or 3 (black, red cable) with a 10k resistor, it works, too.

I get the same result in lejos, so I will solder this resistor on the mtrmx.

Posts: 28
Joined: Thu Mar 03, 2011 7:45 am

Postby mattallen37 » Thu Mar 03, 2011 7:49 am

If you needed to add a pulldown resistor, that means the pullups that are included on the sensors must be too strong when in parallel. They are 82k, so in parallel (when you have the two sensors on one port), 41k.

A pulldown isn't really a good idea. It can be quite a headache later.

Return to “NXJ Hardware”

Who is online

Users browsing this forum: No registered users and 1 guest