Controlling a relay with the NXT

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

Moderators: imaqine, 99jonathan, roger

User avatar
MaR1oC
New User
Posts: 20
Joined: Thu Jul 05, 2012 8:14 am
Location: Athens, Greece

Controlling a relay with the NXT

Postby MaR1oC » Wed May 01, 2013 10:54 am

Which pins of the NXT do I have to connect my inductor (contained in the relay) in order to be able to control the relay via signals (written as software)?
The NXT Pinout (please note that the only available sensor port on my NXT is SensorPort.S4) :

ANALOG A0
GROUND
GROUND
I2C Clock
I2C Data



Any advice would be helpfull :)

User avatar
kirkpthompson
leJOS Team Member
Posts: 305
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA

Re: Controlling a relay with the NXT

Postby kirkpthompson » Wed May 01, 2013 1:23 pm

I'm not a hardware guy but do know the sensor ports do not source enough current to do what you desire and you may damage your brick if you try.

Best,
K
Leg Godt!

User avatar
MaR1oC
New User
Posts: 20
Joined: Thu Jul 05, 2012 8:14 am
Location: Athens, Greece

Re: Controlling a relay with the NXT

Postby MaR1oC » Thu May 02, 2013 8:58 am

The relay works perfectly if I connect pins 1 and 2 on the output ports. However, the problem is that there are no output ports left for my project, as well, I don't want to buy a multiplexer to extend my outputs
Robotic Platforms currently being used:
1. LEGO Mindstorms NXT v.2.0
2. Arduino Uno
Projects currently under development:
http://code.google.com/p/lego-mindstorms-3d-printing-machine/

OS: Linux (Ubuntu, Arch, Sabayon) | IDE: Eclipse (+LeJOS Plug-in)
Java: Amateur User :D :D

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

Re: Controlling a relay with the NXT

Postby gloomyandy » Thu May 02, 2013 9:14 am

The output ports are designed to drive the Lego motors and can drive a much higher current than is available via the sensor port pins (which are designed to drive sensor interfaces).

User avatar
MaR1oC
New User
Posts: 20
Joined: Thu Jul 05, 2012 8:14 am
Location: Athens, Greece

Re: Controlling a relay with the NXT

Postby MaR1oC » Thu May 02, 2013 9:18 am

gloomyandy wrote:The output ports are designed to drive the Lego motors and can drive a much higher current than is available via the sensor port pins (which are designed to drive sensor interfaces).


So, what do you propose me to do? :D
Robotic Platforms currently being used:
1. LEGO Mindstorms NXT v.2.0
2. Arduino Uno
Projects currently under development:
http://code.google.com/p/lego-mindstorms-3d-printing-machine/

OS: Linux (Ubuntu, Arch, Sabayon) | IDE: Eclipse (+LeJOS Plug-in)
Java: Amateur User :D :D

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

Re: Controlling a relay with the NXT

Postby gloomyandy » Sun May 12, 2013 4:52 pm

If the port can not sink the current then you will need to use some additional components and possibly an extra power supply. You will basically need some sort of driver for the relay (like a transistor). Depends on what relay you intend to use. What do you intend to control via the relay? You may be better off just using some sort of driver chip and switching whatever it is directly. There are lots of designs around for ways to do this using an i2c interface (which will also let you control multiple devices).

User avatar
MaR1oC
New User
Posts: 20
Joined: Thu Jul 05, 2012 8:14 am
Location: Athens, Greece

Re: Controlling a relay with the NXT

Postby MaR1oC » Sun May 12, 2013 8:32 pm

gloomyandy wrote:If the port can not sink the current then you will need to use some additional components and possibly an extra power supply. You will basically need some sort of driver for the relay (like a transistor). Depends on what relay you intend to use. What do you intend to control via the relay? You may be better off just using some sort of driver chip and switching whatever it is directly. There are lots of designs around for ways to do this using an i2c interface (which will also let you control multiple devices).


@gloomyandy I am intending to control a 5V DC Motor. I can also provide external power from a 5V AC/DC adapter.

As you've already mentioned, a second thought became the control of the relay over I2C interface. However, I am an I2C newbie and I will kindly request your help :)

Thanks in advance
Robotic Platforms currently being used:
1. LEGO Mindstorms NXT v.2.0
2. Arduino Uno
Projects currently under development:
http://code.google.com/p/lego-mindstorms-3d-printing-machine/

OS: Linux (Ubuntu, Arch, Sabayon) | IDE: Eclipse (+LeJOS Plug-in)
Java: Amateur User :D :D


Return to “NXJ Hardware”

Who is online

Users browsing this forum: No registered users and 1 guest