|Serial Tempsensor Board|
|Initial Release||June 2011|
|Last Modified||April 2014|
DS1820 tempsensor via serial (or USB)
This project is an updated version of one of my earlier PIC-based serial port temperature sensor. The original PIC version only supported one sensor per data pin whereas this version uses the OneWire bus protocol to discover and read data from multiple sensors on a single bus line.
Since more and more computers don't have a serial port anymore I designed an add-on board to fit a cheap and simple 9600bps USB-to-UART Bridge (based on the CP2102 chip). I found some complete boards on Ebay for just AUD $2.95. Best of all, under Linux they don't require any additional drivers. For Windows drivers are required though (see links section below).
Once the code has been uploaded into the ATtiny85 it's simply a matter of attaching it to the serial port. Set up comms on the PC as 9600-8N1 (all flow control set to OFF). When a key is pressed the sensorboard will start querying all the sensors it finds on the OneWire bus and send out the acquired temperature back over serial.
- 2014-04-25 Added support for DS18B20 sensors as the older DS1820 and DS18S20 are end of life.
- 2011-11-27 Ordered 3x PCB's with BatchPCB. Only after the boards have arrived, built up and tested I will post relevant firmware on this page. Until then!
- November 2011 Finalised schematic and pcb design. Removed the on-board DS1820 as it was heating up too much from the ftdi chip to give accurate readings and added pads for a second pull-up resistor to cater for more devices on the line.
- September 2011 Designing a circuit board for external production. Once the boards are complete you should see them appear on this page.
- June 2011 created a first prototype version. Hooked up 4 sensors tought me that the 5k pull-up resisistor for the DS18S20 is not always enough. Perhaps because I used a long (about 6m flat-ribbon) cable to connect the sensors. I added another 5k pull-up resistor and put it parallel across the existing resistor and therefore halving the resistance to 2.5k. That made it behave as expected again.
The next step will be to design (have manufactured) a custom circuit board for this project. I have a few other projects that I would like to make PCB's for so I will continue with some other projects until I have several boards I can have manufactured all in one go.
Download schematic as pdf: File:0055-sch-v1.0.pdf
The current schematic
Attaching multiple sensors
Maxim has released Application Note 148, a tutorial which mentions several techniques for attaching multple sensors to a microcontroller. The easiest and most reliable method is a linear topology where all sensors are fed from the same line.
More information here:
Guidelines for Reliable Long Line 1-Wire Networks
The Pull-Up resistor
The DS1820 (DS18B20, DS18S20, DS1820) datasheet states a maximum current drain through parasitic power of 4mW. At 5V supply that means a pull-up resistor of 1.2k is as low as you can go. For short runs you should be fine with a 4.7k pull-up resistor.
The PCB layout
Other boards I'm currently designing: Pending_PCB_manufacturing
Latest source code: File:0055-rs232-tempsensor v2.zip
Version 1: File:0055-rs232-tempsensor.zip
- client-side polling software
All this does is send out a CRLF over the serial port and then listens for any incoming replies on same serial port.
For Windows: File:Gettemp vb-express-2005 V8.zip (grab the exe from the bin/Release/ folder)
For Linux: File:Gettemps linux.tar.gz
This is a screenshot of the temperature graphs of some sensors around my house. They are all connected to a single board with about 15m of cable connecting them.
Here are some pictures of the prototype made on vero-board. A customised board will be designed at some stage. I will announce it here when that's ready.
This is the top of the board. I'm using the Atmel ATtiny85 microcontroller for this. Adding a second resistor was a quick hack to lower the total resistance as I didn't get proper readings over 8m of flat ribbon cable with three sensors attached. The 6-pin female header strip fits directly over the serial-to-usb board. I also fitted one DS18S20 temperature sensor on-board but I noticed that the serial-to-usb chip is getting a little warm and it affects reading the correct ambient temperature. On the customised pcb I will remove this and only have the edge connector available for connecting temperature sensors.
This is the copper side of the board. As you can see there's very little to it. NOTE: This board has a USB connector on it. That was the original idea, but since the adding of the USB code was probably going to be too big to fit all in the memory of the t85 I decided to use an external USB-to-Serial converter board.
Side view of just the add-on board.
Custom PCB final layout.
The serial-to-usb board was picked up cheaply from eBay. Here is a top-view of the board and it's main features.
This board just plugs in to a standard USB port and presents itself as a virtual COM-port. It has a fixed transmission speed of 9600bps which is more than adequate for our purposes with this project.
My add-on board upside-down on the serial-to-usb board. The thin strip of black insulation tape was put on to block the light of two bright LED's.
Silicon Labs page on the CP2102 http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
Drivers: (locally hosted) File:CP210x VCP Win XP S2K3 Vista 7.zip