Mini Multi Function Expansion Board
The Mini Multi Function Expansion Board is a small device that provides 5
analog inputs and a 1-wire interface that can handle up to 64 temperature
sensors. On demand, the device will learn the serial numbers of all devices
present on the 1-wire bus. The board supports the DS1820, DS18S20, and
DS18B20 temperature sensors.
If the COUNTER symbol is defined when building the project, one of the analog
inputs is instead configured to count pulses using an 8-bit counter with an
optional 8-bit pre-scaler. With a small modification of the circuitry
(accompanied by the appropriate code changes) it is also possible to provide
an input that can count pulses using a full 16-bit counter.
One additional screw terminal, connected to another I/O pin of the PIC, has
already been provided in the design. This connection may be used by the
firmware as a method to put the device in self-program
Another option is to use it to accurately measure time intervals. For
example to measure the time between pulses of an electricity meter. Based on
the measured interval, the current power consumption can be calculated.
Click on the images below for the schematic and a proposed circuit board
layout that can easily be built on a piece of perf board.
Here's a picture of the finished device:
The device has I2C slave address 0x58. Using the HomeVisionXL I2C commands
the device can be configured and controlled. Configuring the device is done
by writing a byte with the two most significant bits set. The lower six bits
control which setting is being configured:
Writing other values selects which information will be returned when
subsequently reading a byte from the device:
- Discover 1-wire devices. This operation takes a few milliseconds for
each connected device. So allow some time before continuing to communicate
with the device.
- Enter program mode.
- Configure pulse counter, where:
The meaning of the status flags is as follows:
- Status flags. See below for the meaning of each individual flag.
- Temperature sensor group flags.
- Number of discovered 1-wire devices.
- Pulse count. Reset to 0 after reading the value.
- A/D Value (last 3 bits select the A/D port).
- Temp sensor flags (last 3 bits select the group).
- Temperature (last 6 bits select the sensor).
- Sensor family code (last 6 bits select the sensor). This will report 16
(0x10) for DS1820 and DS18S20 devices and 40 (0x28) for DS18B20 devices.
The status byte allows very efficient access to the device by the Homevision
controller. Your schedule would just regularly check the status byte. Only
if the bit for any of the used analog inputs is set, it should write a byte
selecting that input and reading the value. Similarly with the pulse count.
When bit 5 is set, you can read the temperature sensor group flags to find
which groups of 8 temperature sensors have detected a change. Next you read
the temperature sensor flags for those groups to determine which sensors
within the group have changed.
- bit 0
- Analog input 0 has changed. Reset after reading the status flags.
- bit 1
- Analog input 1 has changed. Reset after reading the status flags.
- bit 2
- Analog input 2 has changed. Reset after reading the status flags.
- bit 3
- Analog input 3 has changed. Reset after reading the status flags.
- bit 4
- Analog input 4 has changed. Reset after reading the status flags.
- bit 5
- Temperature has changed. Reset after reading the status flags.
- bit 6
- Pulse count has changed. Reset after reading the pulse count.
- bit 7
- 1-Wire devices detected on the bus.