USB temperature Monitor
Our USB host controller (see the project here) has a couple of generic I/O pins, we added these for adding serial I/O at some point but they can be used for anything. Somebody at our office is always complaining about the heat so we set out to prove a point. The DS1820 temperature IC from Dallas is a one wire connected device that we can request the current temperature from, perfect for what we wanted to do.
USB temperature monitor hardware design
This is very straight forward. we are using one of the I/O pins to power the DS18S20 and the other to communicate with the DS18S20. The DS18S20 requires a pull up resistor on its data line, we used a 4k7. The Pic24 is capable of configuring its I/O pins as open collector but to allow for code reuse we emulate this so the one-wire driver can be used on devices that don't have this option.
We wired our DS18S20 into a molex connector, from the photo you can see left to right, OV - Data - Power, with the pull up resistor soldered between the power and data pins.
USB temperature monitor software design
The USB host controller come pre-loaded with all the one-wire and DS18S20 drivers, we added a command '*t*;' to allow you to request the current temperature, the command sets up the I/O pins every time and requests the current temperature from the DS18S20, the software does not address the DS18S20 but assumes its the only device on the one-wire bus.
The first time you request the temperature you will get 85DegC it's the default first read from the device, subsequent reading should return the true temperature.
We wrote a simple windows app to request this information and display it on a graph, you can download the app from here. The app is a simple example of how to get the temperature so you can modify it as you see fit.