I’m too impatient for Dallas Semi to send samples of the DS2408 so I implemented a switch using the parallel port on my FreeBSD server.
The idea is to use the DS2408 or parallel port to drive a relay to switch the HVAC “call for heat” line. This way I can cron my heating schedule.
Brian and Smart-Works were nice enough to loan me two temperature sensors and some space on their web server for the temperature log.
I thought I would be able to echo 1 > /dev/lpt0. Ha. No…
FreeBSD includes the ability to use the “geek” port. I wish I were making that up, but that’s what `man ppi` says. FreeBSD uses ioctl to access the parallel port interface. Here’s the sample from the ppi man page:
#include stdio .h
#include dev/ppbus/ppi.h
#include dev/ppbus/ppbconf.h
#include fcntl .h
//The includes above need less than greater than brackets.
int main (void)
{
int fd;
u_int8_t val;
fd = open (”/dev/ppi0″, O_RDWR);
val = 0×1;
ioctl (fd, PPISDATA, &val);
ioctl (fd, PPIGCTRL, &val);
val |= STROBE;
ioctl (fd, PPISCTRL, &val);
val &= ~STROBE;
ioctl (fd, PPISCTRL, &val);
}
I’m actually going to use some logic so that I can use more than eight devices connected to the parallel port.