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: 99jonathan, roger, imaqine

MTRMX+Ultrasonic Sensor port splitter

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

Hello!
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()) {
         mux.setDirection(1,3);
         Thread.sleep(10);
         LCD.drawString(ultrasonicSensor.getDistance()+"  ", 0, 4);
         Thread.sleep(10);
      }

   }

}


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.
nxthacker
New User
 
Posts: 3
Joined: Thu Feb 17, 2011 6:46 pm

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

Hi,
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...

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

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.
nxthacker
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)

EDIT:
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.

EDIT2:
I get the same result in lejos, so I will solder this resistor on the mtrmx.
nxthacker
New User
 
Posts: 3
Joined: Thu Feb 17, 2011 6:46 pm

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.
Matt
mattallen37
Novice
 
Posts: 28
Joined: Thu Mar 03, 2011 7:45 am


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff