This magnetic bit reader uses the PCF8574 I2C I/O chip and four reed switches. Reading the value of the PCF8574 will tell you which of the four reed switches has been activated by a magnet. I only had four reed switches – so the sensor has 16 combinations – using all eight pins on the PCF8574 will give you 256 combinations. The circuit for the sensor is shown below.
In the video you will hear the NXT saying numbers between 0 and 10 based on the input from the sensor. The program is written in NXC and includes easy to use functions to read and write to the PCF8574 chip. The program uses a set of sounds files which can also be downloaded. Be sure to check out Sivan Toledo’s websiteand The Extreme NXT website and book for more info on NXT I2C interfacing.