External memory for NXT

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc

Moderators: roger, 99jonathan, imaqine

External memory for NXT

Postby Rickz2020 » Tue Oct 25, 2011 12:26 am

Hey guys,

I was wondering if anyone has heard of, knows where to buy, or knows if it is possible to connect a small external memory bank such as a memory stick to the NXT via sensor port.
The reason I ask is because at some stage I might like to store sensor data in a memory bank for generating models or just general analysis.

A USB memory stick would be ideal because it's light, cheap, small and has a high capacity.

What do you guys think? Any ideas?

Rich.
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.

Re: External memory for NXT

Postby s.frings » Tue Oct 25, 2011 4:54 pm

Sure, thats really easy. There are lots of serial EEPROM and FLASH memory chips available, some of them have an I2C interface, so they can be directly connected to the sensor port. And you can connect them to the PC using an USB-to-I2C adpater.

Example: AT24C256BN-10SU (32kBytes)

Checkout this website: http://ramtron.com/products/nonvolatile ... erial.aspx

If you need larger memory, you need to build an I2C to SPI adapter, because the larger chips have SPI interfaces.

Be aware that EEPROM and also FLASH memory chips allow only a very limited number of write cycles. Therefore a memory controller that distibutes data equally is higly recommended (as included in every USB memory stick and SSD harddisk).
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm

Re: External memory for NXT

Postby Rickz2020 » Tue Oct 25, 2011 7:02 pm

Brilliant!

So, say I want the 1mb chip... I guess I need an IC holder and then just connect the pins to an NXT male-cable and I'm ready to go - or is there something more than that?

Oh, and regarding the memory controller, can you recommend one?
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.

Re: External memory for NXT

Postby gloomyandy » Tue Oct 25, 2011 7:18 pm

Hi, without knowing your electronics background it is hard to say how easy this will be for you, but here are a few pointers...

You will almost certainly need a pull up resistor on both the i2c lines. You will also need to sort out the supply voltage. This chip needs 3.2 or below, the NXT will be supplying approx 5V, a couple of diodes may be needed to drop the voltage (possibly three). You may run into problems with the voltages on the i2c lines (should the pull up go the 3.2V or 5V, I would say 3.2 but this may cause problems). Mounting these devices can be tricky (they are pretty small). Then you need to get it all to work (having an i2c analyser or a scope would be a good thing). You may get lucky and everything will just work, but don't count on it. Check out the problems that the user Aswin had with trying to get a custom IMU sensor working. I'm not sure I would recommend the solution he finally ended up using!
https://sourceforge.net/apps/phpbb/mind ... ilit=aswin

So by all means go for it but make sure you know what you are getting in to. I'd certainly recommend buying more than one chip just in case you damage it when trying to get things sorted out.... Make sure you let us know how you get on...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: External memory for NXT

Postby Rickz2020 » Tue Oct 25, 2011 8:26 pm

This sounds pretty interesting.

I've done some basic electrical engineering and have built project circuits in the past so I know how to read diagrams and are familiar with the components and their functions, so at least I won't be going in "blind". I think I will wait a bit before I start this as I am still busy with some other projects, but at least I now know it's possible and not overly complicated.

Thanks.
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.

Re: External memory for NXT

Postby s.frings » Tue Oct 25, 2011 8:40 pm

The NXT has 5 level on its I2C bus, while most current chips use a lower level. This application note describes how to build a level shifter using MOSFET transistors:
http://ics.nxp.com/support/documents/in ... n97055.pdf
See als: http://delphys.net/d.holmes/hardware/levelshift.html

The memory controller is a software thing. You need to think how you can distribute data so that all memory cells age at the same rate. This can be written in Java, or you can build your own external memory controller using a microcontroller - if you know how to do that. If not, then write it in Java in the NXT.
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm

Re: External memory for NXT

Postby gloomyandy » Tue Oct 25, 2011 9:54 pm

Actually the digital I/O pins operate off the 3V power of the Arm chip (the Lego doc is a little ambiguous about this in places it claims 3.3V). One possible exception is the pins on port 4 which has the extra RS485 hardware. The lines are protected internally to allow for external pull ups to 5V which means that they will normally operate with 5v devices happily. However the various protection resistors and diodes can mean that when the NXT attempts to drive the I/O lines to logic 0 a voltage above 0 is seen. For some low voltage devices (like 2V and lower logic) this value may be too high to be recognised as 0V. This was the problem seen by Aswin in the thread I pointed to earlier. He fixed the problem by bypasing one of the protection resistors in the NXT. For 3.2V logic things should be fine and no level shifter should be required. Certainly I've built a number of devices that use 3.2V chips (including a 3 axis gyro based on the WII MotionPlus device), which do not have level shifters... The following link gives details of the MotionPlus project and you may find this of some interest:
http://www.gloomy-place.com/wiigyro.htm


Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: External memory for NXT

Postby Rickz2020 » Tue Oct 25, 2011 10:50 pm

Crazy how aswin had to actually modify the NXT :)

Hopefully, if I decide to attempt this, I will have better luck. I'm a bit scared I'll blow my NXT :)

Oh and @ Andy,
a couple of diodes may be needed to drop the voltage (possibly three).


Don't you mean resistors? I think if I were to attempt this, I would use some variable resistors so save the frustration of soldering all the time :P
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.

Re: External memory for NXT

Postby s.frings » Wed Oct 26, 2011 9:29 am

Oh, I did not notice that the digital lines are at 3,3v level. That's interesting because the analog inputs have pull-ups at 5V level. But 3.3v is good, that makes connecting I2C chips much easier.

I'm currently thinking whether I should buy gyro, accelerometer and magneto sensor chips for experimenting.

The next is very well protected. As long you do not push power from an external power sullpy into the pins, it's nearly impossible to break the NXT.
Last edited by s.frings on Wed Oct 26, 2011 6:30 pm, edited 1 time in total.
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm

Re: External memory for NXT

Postby gloomyandy » Wed Oct 26, 2011 12:12 pm

Rickz2020 wrote:Don't you mean resistors? I think if I were to attempt this, I would use some variable resistors so save the frustration of soldering all the time :P


No I really do mean diodes. The voltage drop over a normal diode is approx 0.7V. Using one or more diodes to provide a voltage drop is a pretty standard way of handling this process... One of the differences is that the voltage drop provided by a resistor is dependant upon the current flowing to it. With a diode the drop is much less current dependant... Google around and you will see this is a pretty common cheap alternative to using a voltage regulator (which is probably the best way of doing this, but total overkill in this situation)...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: External memory for NXT

Postby Rickz2020 » Wed Oct 26, 2011 11:38 pm

Ah, right, thanks Andy - I had no idea. I'll have to keep this in mind.
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff