I2C comunication Arduino - NXT

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
nxcnewbe
Posts: 2
Joined: 25 May 2011, 13:52

I2C comunication Arduino - NXT

Post by nxcnewbe »

Hi

Not sure, if I can get any help, but at school I’m developing kind a sensor for my NXT, and I have an arduino UNO, and I have already capture the sensor data from the sensor to my arduino, othe idea is to send the "data" which is basically some strings of text to the NXT via i2C.


but I’m struggling in to send this data to the NXT via NXT-G, How can I do that?

I know that will be two parts,

1.) from arduino to NXT using i2C, but my code doesn’t do that, I did try to write the code but it doesn't work, and I would like to know if there any really good sample fo code I can use to guide me

2.) the second part a NXT-G block to capture my sensor output, I'm trying to use:

NXC but the code I wrote also doesn't work and I’m trying LabView but I can’t find any good easy guide or samples to use

I have been looking across the internet and can't find good documentation to allow me doing that

I have LabView 7.1 and 30 days for LabView 2010

can anyone help me please!!

Thanks
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: I2C comunication Arduino - NXT

Post by mattallen37 »

I haven't tried using Arduino with the NXT, but here are several things I know you need to comply with:
  • The Arduino must be a slave (the NXT must ask for the data).
  • You need to have pullups that are around 82k. Any from about 47k to 100k should work just fine.
  • The Arduino must support very slow I2C speeds (without timing out...). The standard NXT FW runs the I2C at ~9600bps (which is about 10% of the standard "slow").
I've interfaced a PICAXE 20X2 with the NXT, and used it for several sensors/controllers.

I mostly just use NXC for the NXT, but the I2C NXT-G blocks should allow you to use custom I2C devices. I made a PoC NXT-G program to interface with a PICAXE, and it did work (even without arrays).

I really suggest you use NXC for it. This forum is a great place to get help with specific NXC issues. As far as help specific to Arduino, I know that both Xander and I each have an Arduino, and we are both familiar with NXC (not necessarily mixing them though).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
timpattinson
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1
Contact:

Re: I2C comunication Arduino - NXT

Post by timpattinson »

You may also want to try RS-485 - built into sensor port 4, You get much faster speeds ;)
http://rostrich.wordpress.com/2010/05/1 ... ng-rs-485/
-tim
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
nxcnewbe
Posts: 2
Joined: 25 May 2011, 13:52

Re: I2C comunication Arduino - NXT

Post by nxcnewbe »

Thanks

my code in arduino has been defined as slave with low speeds but apparenlty is not working, an I would like to know if there any samples that really work that I can use as template or guide to help in my quest to create a NXT sensor

my HW already have the 82K resistors

Thanks for any advice or help
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests