Page 2 of 3

Re: NXT reading speed

Posted: 26 Sep 2012, 22:13
by aswin0
mattallen37 wrote:If you use the fast mode (exclusive to the later versions of the EFW), I think the bus runs at about 30kbps instead of 9.6kbps.

The analog values are updated at 300Hz.

For I2C, I think you would need 400kbps in order to get readings every 0.1ms, and even then you would be really pushing it. Even 1ms read intervals is probably not possible. Based on testing I have done, it seems that using fast mode with the EFW, the read time is like 2 to 3ms.
Might I ask why you would need such speeds? There are not much sensors that can update so fast. There Is no use in querying a sensor faster than it updates nor faster then you can process it.

Re: NXT reading speed

Posted: 26 Sep 2012, 22:33
by mattallen37
He wanted to read something like a TSOP (IR receiver) through an I2C IO expander. In that case, you would need to have super high speed updates.

Re: NXT reading speed

Posted: 27 Sep 2012, 18:38
by floppi
I finally prefer buying an arduino one, i wil buy another one later if really i need.

I thought of something else : Is it possible to use A pcf8574 to make a bit-banged rs232 emulation at 9600bps ?

Re: NXT reading speed

Posted: 27 Sep 2012, 19:20
by mattallen37
floppi wrote:I finally prefer buying an arduino one, i wil buy another one later if really i need.

I thought of something else : Is it possible to use A pcf8574 to make a bit-banged rs232 emulation at 9600bps ?
An Arduino one? Do you mean Uno? "Uno" in Spanish means one, but "Uno" is also the name of an Arduino.

Possibly, but you would need super fast I2C to make that work (like maybe 400kbps).

UART with an Arduino is easy, but it's TTL levels, not RS232. You would need a MAX232 (or similar) IC to make the signals RS232 levels.

Re: NXT reading speed

Posted: 27 Sep 2012, 21:40
by floppi
yes, i was speaking of an arduino uno ( translating to english permanently causes me to make this error :lol: )

Concerning RS232, the idea was to try with the NXT using this ( charge pump ) :

Image

essentially for the fun, because there is less of rs232 peripheral. ( a mouse ?)

at 2400bps ?

Re: NXT reading speed

Posted: 27 Sep 2012, 22:07
by mattallen37
If half duplex is fine, then you can use the RS485 UART.

Re: NXT reading speed

Posted: 28 Sep 2012, 06:28
by floppi
The arduino has been shipped to me, just for the week-end......

My wife will not be happy :lol:

Re: NXT reading speed

Posted: 02 Oct 2012, 11:12
by gloomyandy
If what you need is access to analogue data then you can use the A/D ports on the AT91. Basically you make use of one of the NXT sensor port digital pins as an analogue input (see the Lego hardware doc for the details). This is what is used by the Lego Color sensor. I'm not sure if the standard or enhanced firmware allows you to switch the pins into A/D mode and access to the resulting values. certainly leJOS does (our Lego color sensor driver is written in Java and runs as standard user code). Using this interface you can sample the analogue values very fast. If you setup the hardware correctly you can basically sample the A/D values using hardware, and once you do this obtaining a value is essentially the same as reading a memory address. In leJOS we have the hardware sample rate set to 4MHz, which is faster then a leJOS program can actually make a call to read a new value and do anything useful with it.

Having said all of that, for your application it probably makes more sense to go the route you are currently going and have an additional microcontroller do all of the low level stuff...

Andy

Re: NXT reading speed

Posted: 10 Oct 2012, 18:23
by floppi
So,

NXT, Arduino and PCF8591 on I2C bus works well. ( thanks to mattallen37 ! )

Arduino is used to

- have a 1024bit analog input ( more precise than NXT ) to detect resistive value of conductive foam.
- manage IR LED to drive Lego PF motor.
- manage PCF8591 to add more analog input. ( sound detector, photoresistor, motion detector )

So the the NXT will be quiet to drive his ultrasonic sensor and motors.

Re: NXT reading speed

Posted: 10 Oct 2012, 18:30
by mattallen37
You mean 10 bit? A 10 bit number is a number between 0 and 1023. The NXT and Arduino both have 10 bit ADCs (although the analog inputs on the NXT have permanent 10k pullup resistors).

How are you controlling the IR LED? I wrote an Arduino library for that as well, in case you're interested.