View unanswered posts | View active topics It is currently Mon Sep 01, 2014 11:15 pm






Reply to topic  [ 14 posts ] 
NXT Laser Range Finder 
Author Message
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post NXT Laser Range Finder
I'm a software guy that can, but hates to solder. But I've decided to dabble a tad.

I just wanted to check in with the experts and ask if I am on the right track here?

I am trying to get this; http://www.parallax.com/Store/Sensors/A ... roductName

to work with an NXT via this; http://www.sparkfun.com/products/9745

And I guess I am also wondering what kind of thing I need to do in RobotC.

Hopefully I just leave it on my table and it assembles itself, then all I have to do is the software part.

Comments?

Mike

_________________
Mike aka Spiked3
http://www.spiked3.com


Fri Mar 23, 2012 1:37 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: NXT Laser Range Finder
Spiked3,

That is a pretty cool sensor. Parallax make some very nice things. As for hooking up the breakout board and the LRF would seem like a pretty simple excercise. I would recommend you get a small breadboard, that will make your life a LOT easier. Then can fiddle with things and not solder :)
You will need an external power supply that can do 5V for the LRF and board. The NXT certainly won't be able to supply the 150mA necessary for the LRF.
You will need 2x83K Ohm resistors on SDA and SCL to pull up to the 4.8-5V of the NXT's power rail on the sensor port.
What I'd like you to do is draw how *you* think the circuit should look and post it here so we can take a look at it.

Here's a link to the NXT's sensor port pinout: http://en.wikipedia.org/wiki/Lego_Mindstorms_NXT (scroll a little bit down)

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Mar 23, 2012 4:13 pm
Profile WWW
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: NXT Laser Range Finder
Thanks so much for that. That was exactly the kind of info I was hoping for, and I may ask for clarification soon :) I already have the laser, and I just order the uart thing, with a small breadboard (I already have a bigger one but wanted this to be on the nxt bot) but I know I will at least have to solder on the header pins. I also ordered a 4 AA battery holder, but have a big supply for R/C that has a 5v out for initial work. Eventually I will glue (sticky tape) the little breadboard to the 4 AA holder and mount it all on the bot - in theory.

The pull up thing is something I never took the time to learn - I guess now is the time. Other than that - seemed pretty simple.

Thanks.

_________________
Mike aka Spiked3
http://www.spiked3.com


Fri Mar 23, 2012 5:15 pm
Profile
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: NXT Laser Range Finder
Instead of the I2C to UART adapter, can you use the RS485 UART port of the NXT? I know you would need something like a max485, and it would be limited by half-duplex.

_________________
Matt


Fri Mar 23, 2012 6:54 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: NXT Laser Range Finder
Matt, the sensor is pretty much one way traffic :) Remember KISS!

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Mar 24, 2012 1:20 am
Profile WWW
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: NXT Laser Range Finder
Okay, then using the NXT's RS485 would probably be a lot more simple than using an I2C -> UART adapter.

_________________
Matt


Sat Mar 24, 2012 3:56 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: NXT Laser Range Finder
Then I would suggest you find a good alternative breakout board for the max485 that would be easy to use :)

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Mar 24, 2012 4:02 pm
Profile WWW
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: NXT Laser Range Finder
Last I checked, they make it in a DIP package.

Edit see here.

_________________
Matt


Sat Mar 24, 2012 4:18 pm
Profile WWW
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: NXT Laser Range Finder
OK again apologize for the hardware newbness, but

Its not one way communication, it is two way, you have to send it a 'command' to get a reply back 'distance'. I'm not sure that makes any difference though.

The second question is what is the advantage of replacing one chip with one chip? how would that make it simpler? and if rs-485 would work why does it need any chips? I was under the impression rs-485 was more like ethernet than rs-232, so I didn't even think it would work at all.

_________________
Mike aka Spiked3
http://www.spiked3.com


Sun Mar 25, 2012 1:27 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: NXT Laser Range Finder
The LRF uses serial communications but it's at the wrong logic level. The NXT uses RS485 to communicate serially. So if you want to connect the LRF to the NXT, you need the MAX485 to translate the levels.
The NXT's RS485 port is half-duplex, which means only one device can talk on the bus at any given time. In this case that is not such an issue because the NXT does a request and will then wait for an answer. If the LRF gives unsolicited data on the bus and the NXT happens to send something at the same time, you'd have a garbled message.
RS485 is not like Ethernet, it's simply a serial communications protocol :)

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Mar 25, 2012 3:57 am
Profile WWW
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: NXT Laser Range Finder
mightor wrote:
The LRF uses serial communications but it's at the wrong logic level. The NXT uses RS485 to communicate serially. So if you want to connect the LRF to the NXT, you need the MAX485 to translate the levels.
The NXT's RS485 port is half-duplex, which means only one device can talk on the bus at any given time. In this case that is not such an issue because the NXT does a request and will then wait for an answer. If the LRF gives unsolicited data on the bus and the NXT happens to send something at the same time, you'd have a garbled message.
RS485 is not like Ethernet, it's simply a serial communications protocol :)

- Xander


So am I right about 1 chip vs 1 chip - it doesn't really simplify anything? and the half duplex issue might actually add problems?

I still don't quite understand why levels make a difference - the LRF never really mentions anything other than TTL 'levels', it doesn't say 232 or 422 or 485 that I have seen. I am still looking.....



edit: ok - read a bit more. 485 is just a balanced serial, like 422 is, but 422 is multi-point, and 485 is multi-drop (or the other way around, i forget already).

_________________
Mike aka Spiked3
http://www.spiked3.com


Last edited by Spiked3 on Sun Mar 25, 2012 4:55 am, edited 1 time in total.



Sun Mar 25, 2012 4:30 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: NXT Laser Range Finder
The half duplex thing wouldn't really matter in this case. I2C is reuqest-reply based, too and only the master may dictate when the slave speaks. If you already have the IC2 to UART bridge I would just stick with that. If you haven't purchased it yet, you may consider getting the MAX485 chip.
The NXT is RS485 and if the other side is not then it's pretty much on the wrong logic level. You should always match serial logic levels. If the device is TTL then both sides need to talk at that level, if both sides are RS232 then both sides need to speak that protocol. Think of it as two people, one speaking Mandarin and the other English; if they want to communicate, you need to either both speak Mandarin or English, alternatively, they can use an interpreter (the MAX485 chip).

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Mar 25, 2012 4:53 am
Profile WWW
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: NXT Laser Range Finder
mightor wrote:
The half duplex thing wouldn't really matter in this case. I2C is reuqest-reply based, too and only the master may dictate when the slave speaks. If you already have the IC2 to UART bridge I would just stick with that. If you haven't purchased it yet, you may consider getting the MAX485 chip.
The NXT is RS485 and if the other side is not then it's pretty much on the wrong logic level. You should always match serial logic levels. If the device is TTL then both sides need to talk at that level, if both sides are RS232 then both sides need to speak that protocol. Think of it as two people, one speaking Mandarin and the other English; if they want to communicate, you need to either both speak Mandarin or English, alternatively, they can use an interpreter (the MAX485 chip).

- Xander


I picked the i2c chip because I had seen quite a few mentions on the NXT about it, including its use by a lot of sensors. I have seen 0 about rs-485 other than 'its there'. Is any product using it? or even any projects? I guess high speed brick to brick is the one example i've heard of, as an alternative to bluetooth. not much in terms of sensors though.

_________________
Mike aka Spiked3
http://www.spiked3.com


Sun Mar 25, 2012 5:06 am
Profile
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: NXT Laser Range Finder
Xander, using that I2C chip would sort of make the communication full duplex, because it does have an Rx buffer that (I assume) can be written to at any time, regardless of any other communications.

You are kinda right about RS485 being like ethernet. The low level electrical signals do look similar to ethernet (an electrical differential).

RS485 is being used more and more these days. The DI NXTBees use it, as well as the DIWIFI. I personally have used RS485 for NXT -> NXT communication on several projects, as well as using it with the DIWIFI.

_________________
Matt


Sun Mar 25, 2012 8:45 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.