NXT reading speed
NXT reading speed
hi,
I try to read values as fast as possible with the nxt.
I saw that I2C bus work at 9600 bps with standard firmware although standard i2c speed is 100kHz.
What about enhanced firmware ?
Lejos apparently permit to have 100kHz speed on this bus ?
With analaog reading values ( RCX type mode ), what is the reading speed ?
Can I get a speed in some way like 10 reading in 1 ms ?
Thanks in advance for your response.
I try to read values as fast as possible with the nxt.
I saw that I2C bus work at 9600 bps with standard firmware although standard i2c speed is 100kHz.
What about enhanced firmware ?
Lejos apparently permit to have 100kHz speed on this bus ?
With analaog reading values ( RCX type mode ), what is the reading speed ?
Can I get a speed in some way like 10 reading in 1 ms ?
Thanks in advance for your response.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT reading speed
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.
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.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXT reading speed
I do some research and I learned that there is a RS485 bus on Input 4 of the NXT, but I don't find cheap ic ( like PCF8574,PCF8591) to read analog values ! ( or cheap RS485 to I2c transceiver to use the pcf I have ).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.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT reading speed
RS485 is UART, which is a serial stream (like RS232 or TTL UART). In order to "interface" I2C and RS485, you would need a uC, such as an Arduino. Although at that point, you might as well just use the IOs of the uC.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXT reading speed
is the maximum i2c "faster than paralyzed speed" 30kbps a limitation of NXC/EFW or of the NXT hardware?
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT reading speed
The HW requires that the four external I2C buses be bit-banged, so that means it's all SW run. Perhaps a more efficient I2C bit-bang engine could yield faster communication speeds, but that would be a matter of low level FW modifications.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXT reading speed
It seems the NXT was not intended to do all what I want !
Two solutions :
- not asking so much to NXT
- adding an external microcontroller ( arduino one ? )
I think I will buy an arduino and a max 485 chip for fast communication with nxt, it will make another "Toy" to play with
Two solutions :
- not asking so much to NXT
- adding an external microcontroller ( arduino one ? )
I think I will buy an arduino and a max 485 chip for fast communication with nxt, it will make another "Toy" to play with
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT reading speed
NXT + Arduino is a ton of fun! I have I2C, and also RS485 libraries for the NXT (in NXC) and the Arduino.
AtMega328 Arduinos are really nice, but they only have one UART. Arduinos use UART for programming (and any debugging you might want to do), so it can be a bit inconvenient to try using the UART for RS485 as well.
If you get an AtMega32U4 based Arduino, you can have even more fun! The AtMega32U4 uC supports USB (slave), so when you plug it into the computer, it can appear as a COM port and a HID (Human Interface Device). By default it appears as a keyboard and mouse, but I've modified some files to make it appear as a joystick and consumer device as well (at the same time!). The "UART" used to upload the program is completely virtual (CDC through USB), so the HW UART can easily be used for RS485. There isn't as much support yet for the AtMega32U4 boards, but they are getting more popular. Such boards are the Leonardo (actual Arduino board), the Pro Micro (by Sparkfun, and also in a 3.3 volt version), and the LeoStick (by freetronics). I personally have a 5v Pro Micro, and have been really enjoying it!
Do note, that UART with the Arduinos seems to be limited to 115200 baud (bits per second on the bus). It is however still much faster than I2C. There is no way you will get 10000Hz updates being streamed in real time to the NXT, but if it doesn't need to be real time, the Arduino can take digital samples really quickly, and then send them later.
What exactly are you trying to do?
AtMega328 Arduinos are really nice, but they only have one UART. Arduinos use UART for programming (and any debugging you might want to do), so it can be a bit inconvenient to try using the UART for RS485 as well.
If you get an AtMega32U4 based Arduino, you can have even more fun! The AtMega32U4 uC supports USB (slave), so when you plug it into the computer, it can appear as a COM port and a HID (Human Interface Device). By default it appears as a keyboard and mouse, but I've modified some files to make it appear as a joystick and consumer device as well (at the same time!). The "UART" used to upload the program is completely virtual (CDC through USB), so the HW UART can easily be used for RS485. There isn't as much support yet for the AtMega32U4 boards, but they are getting more popular. Such boards are the Leonardo (actual Arduino board), the Pro Micro (by Sparkfun, and also in a 3.3 volt version), and the LeoStick (by freetronics). I personally have a 5v Pro Micro, and have been really enjoying it!
Do note, that UART with the Arduinos seems to be limited to 115200 baud (bits per second on the bus). It is however still much faster than I2C. There is no way you will get 10000Hz updates being streamed in real time to the NXT, but if it doesn't need to be real time, the Arduino can take digital samples really quickly, and then send them later.
What exactly are you trying to do?
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXT reading speed
Thanks for all these advices, i do not know which version to buy, RS485 is not a priority. The microcontroller can do the job and transmit it to the NXT with I2C.mattallen37 wrote:NXT + Arduino is a ton of fun! I have I2C, and also RS485 libraries for the NXT (in NXC) and the Arduino.
AtMega328 Arduinos are really nice, but they only have one UART. Arduinos use UART for programming (and any debugging you might want to do), so it can be a bit inconvenient to try using the UART for RS485 as well.
If you get an AtMega32U4 based Arduino, you can have even more fun! The AtMega32U4 uC supports USB (slave), so when you plug it into the computer, it can appear as a COM port and a HID (Human Interface Device). By default it appears as a keyboard and mouse, but I've modified some files to make it appear as a joystick and consumer device as well (at the same time!). The "UART" used to upload the program is completely virtual (CDC through USB), so the HW UART can easily be used for RS485. There isn't as much support yet for the AtMega32U4 boards, but they are getting more popular. Such boards are the Leonardo (actual Arduino board), the Pro Micro (by Sparkfun, and also in a 3.3 volt version), and the LeoStick (by freetronics). I personally have a 5v Pro Micro, and have been really enjoying it!
I would prefer to have much ressources on the net, so arduino one would be good for me.
But AtMega32U4 is state of the art arduino, and wonder which one i prefer !
[
I have a IR receiver, and my actual idea was to connect to the nxt so that it can be controlled by a remote, but signal frequency is too high for the NXT I2C. That was an idea, but I find another way to control my NXT. I've got a tiny remote controlled car bought for 5€, I plug the output to a PCF8574, put all in a small box ( size of an egg ). And that was done !mattallen37 wrote:Do note, that UART with the Arduinos seems to be limited to 115200 baud (bits per second on the bus). It is however still much faster than I2C. There is no way you will get 10000Hz updates being streamed in real time to the NXT, but if it doesn't need to be real time, the Arduino can take digital samples really quickly, and then send them later.
What exactly are you trying to do?
But I'm really intersted in arduino board, for other project, to be not limited...
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT reading speed
The Arduino works very well for receiving IR messages (in fact, at this very moment, I happen to be working on an Arduino library for IR).
I don't know if external interrupts have been made accessible to the user on AtMega32U4 based boards yet, but I know they have been on the AtMega328 boards.
I don't know if external interrupts have been made accessible to the user on AtMega32U4 based boards yet, but I know they have been on the AtMega328 boards.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Who is online
Users browsing this forum: No registered users and 2 guests