Overview


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. In the video below 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 in the source-code you will find easy to use NXC functions to read and write to the PCF8574 chip. The program uses these sound-files. Also be sure to check out Sivan Toledo’s website and The Extreme NXT website and book for more info on NXT I2C interfacing.

Pictures and video

 

The sensor build into
a LEGO construction
Circuit - click to enlarge
Top view
A 16 pin DIP socket and
some extra holes will
make the IC fit into a LEGO brick
Bottom view. Here you can
see the reed switches
glued into the drilled holes