The Mindstorms NXT is great, no doubt. However, sometimes you’d like to be able connect non-Lego items to it. The NXT’s ability to talk I2C, the industry standard protocol for interfacing electronic devices makes this an easy to achieve goal. Since this was my first time hooking up anything non-Lego to my NXT, you can imagine my hesitation. I procured one of the Mindsensors PCF8574A boards which comes complete with the chip, an NXT cable connector, the PC, various passive components (resistors, capacitors) and some pin headers. Pretty much everything you need to hook the whole thing up and start adding some of your own components to it is there.
When I first started experimenting with the IO board, I noticed that my LEDs would barely light up when one of the IO ports went up. I guess the PCF8574A just isn’t very good at providing current. However, it makes a good sink, so I just hooked up a 1K resistor to Vdd (5V, in this case). Now when a pin goes low, the LED lights up very nicely. 4 LEDs in all were connected in this fashion to port 0-3. I also hooked up a small microswitch with a pull-down resistor to port 7.
The program I wrote was mostly put together from other examples and helpful posts on the RobotC forums. It switches the LEDs on in a Knight Rider-like fashion. When the button is pressed, the direction is reversed. You can watch the whole thing in the little video below. The source code can be retrieved from here.
[…] under: Experiments, Sensors — Xander @ 20:40 If you’ve been reading my articles (1, 2) on the Mindsensors PCF8574A board but are unable to purchase one for any number of reasons, […]
The official story is, the PCF8574 and PCF8574A cannot source ANY current. One useful thing about this is that you can set a pin to HIGH and connect a switch between it and GND. If you press the switch…
The circiut DOESN’T blow up, and you can read the switch.
I tend not to use that chip at all anymore. I prefer to use the MCP23008, it has a lot more functionality.