Page 1 of 1

I2C comunication Arduino - NXT

Posted: 25 May 2011, 13:59
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

Re: I2C comunication Arduino - NXT

Posted: 25 May 2011, 22:38
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).

Re: I2C comunication Arduino - NXT

Posted: 26 May 2011, 08:10
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

Re: I2C comunication Arduino - NXT

Posted: 26 May 2011, 12:54
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