THERMOMETER for digital sensor see USB DS18B20
Revised on 20/06/2015
USB thermometer using
diodes as a temperature sensor. Included
VS2005 C# code, PIC ASM code, PIC C code
and a circuit diagram. The PIC microcontroller has 10 bit analogue
to digital converter. The circuit is powered by the USB. The interface
to the PC is HID class.
Diode make linear temperature
sensor, the junction voltage changes at about 2.32mV/centigrade. The sensor is 4 diodes 1N4148 in series.
CALIBRATION: The calibration of the sensor and
other components in the circuit is done in the PC application. When you start the application for the first time it creates a file 'cal.dat' in the same folder. The file has the actual temp entered by the user. Type the actual temp from another thermometer that you know reads correctly and press 'Calibrate'.
HID class (human interface
device) is a class of devices like the mouse and the keyboard, the
data transfer rate is limited to 64KB/S.
C# code is modified Microchip code from the USB framework, Microchip Solutions v2012-04-03.
The source code is derived from freeware from these sources: http://janaxelson.com/usb.htm , http://openprog.altervista.org/USB_firm_eng.html
Code was written on MPLAB 8x and compiled with C18 ver 3.30. PIC18F2550 was programmed using Velleman K8076.
Software includes PIC code and C# code. You are free to use the circuit diagram and the C# with no
The C# application is a combined digital and analogue
See also Technical Tips
Pin 3 is the analogue input. Input voltage range is +Vref minus
Pin 4 is the -Vref, Pin 5 is the +Vref, at 2.5V .
LM385 2.5 is a precision zener, equivalent can be used.
Pin 14 is 3.3V internal supply for the USB transceiver.
Pins 15,16 are the data lines to the USB connector on the PC.
Pin 20 is the PC 5V powering the PIC. It is limited to 100mA by
the PC. 0.47uF is for decoupling.
For USB wiring info: http://www.interfacebus.com/Design_Connector_USB.html
4 of 1N4148 diodes in series. When soldered with the diodes body next to each other you get small size sensor.