USB LCD Thermometer ATmega32u2

USB LCD Thermometer
ThermometerUSB LCD thermometer uses microcontroller ATmega32u2 (TQFP32).  ATmega16u2 can also be used, it is recommended  using microcontroller ATmega32u2 which has 32k Flash memory. USB (USB 2.0 Full-Speed) periphery is also used to programming, since the microcontroller is pre-loaded with DFU bootloader. It can be programmed with the FLIP. This means that AVR programmer  is not needed for programming . Microcontroller already has built USB peripherals, so does is does not need a USB-UART bridge integrated circuits (FTDI, etc.). It uses two digital temperature sensors DS18B20, for indoor and outdoor temperature sensing. On PCB there is also a voltage regulator LM1117-5V 800mA, which serves as external power supply (Max: 15V). The circuit operates with 16MHz clock (using an external crystal),  microcontroller which requires  to operate the USB communication. At the USB connection there must be 22ohm resistors values (+ / – 5%), to reduce interference. For proper operation of the USB communication we must not forget the Ucap 1μF ceramic capacitor (+ / – 10%) and electrolytic capacitor 22μF. The circuit has four buttons, HWB, the Reset button to start and stop the brightness of the LCD display and the button to turn on and off USB to Serial connection. To display the measurement is used 16×2 LCD display.

Download FLIP

ATmegaXu2 TQFP32

ATmegaXu2 pinout

Temperature measurement with sensor DS18B20:

To read the temperature is used sensor DS18B20 by company Dallas Semiconductors. Measurement of the temperature can be in the range from -55°C to +125°C with an accuracy of +/- 0.5°C (from -10°C to +85°C). Power supply is DC 3.0V – 5.5V. Communication with the sensor is “1-wire”, which means that sending data on one line (bus) with ground, in both directions, according to a certain protocol with one line or bus (and ground). Communication is asynchronous and a two-way. On line can be connect one or more devices at the same time. Line must be in the high logical state, so we use a resistor value of 4.7kOhm, which is connected to supply voltage VCC (pull-up). The sensor has a 64-bit serial number, which serves to be on the same line connect multiple sensors at the same time and then we know from which comes the data. Thermometer resolution is user selectable from 9 to 12 Bits. It also has an alarm function, which is activated (sensor sends its serial number) when the temperature gets outside predetermined limits. The sensor converts the temperature in the 12-bit digital word, every 750ms. We need to convert a word with a certain algorithm into a desired shape.

DS18B20 Temperature/Data Relationship

DS18B20 Block Diagram


Available in 8-Pin SO (150 mils), 8-Pin µSOP, and 3-Pin TO-92 Packages:

PIN Configurations



Bill of materials:

Ime Oznaka Oznaka v shemi Opis Število
LCD 16×2 LCD 16×2 LCD LCD 16×2 1
RAD-0.1 22uF C10 Electrolytic capacitor 2
0805 100nF C2,C3,C5,C6,C7 Ceramic capacitor 5
0805 1μF C4 Ceramic capacitor 1
0805 33pF C8,C9 Ceramic capacitor 2
0805 LED1 D1 RED LED 1
DC-Connector PWR2.5 J1 Power DC Connector 1
USB B-Connector 440247-2 J2 USB 2.0, Class B 1
HDR1x3 DS18b20 P1,P2 Header, 3 -pin 2
HDR1x2 Jumper P3 Header, 2-pin 1
SOT-23A BC817, 500mA Q1 NPN Transistor 1
0805 4k7 R1,R2 Resistor 2
0805 22R R6,R7 Resistor 2
SMD Trimmer 10k R8 Trimmer potentiometer 1
0805 10k R9,R10,R11,R14 Resistor 4
0805 1k R12 Resistor 1
0805 470R R13,R15 Resistor 2
Tactile Switch 90° HWB S1 Micro switch 6×6 90° 1
Tactile Switch 90° Reset S2 Micro switch 6×6 90° 1
Tactile Switch 90° Tipka2 S3 Micro switch 6×6 90° 1
Tactile Switch 90° Tipka1 S4 Micro switch 6×6 90° 1
SOT223 LM1117-5.0 U1 800mA Linear regulator 1




Printed circuit board:

The PCB is a double side and is the same size as LCD panel (37x80mm). It features all the elements involved with LCD display, buttons and connectors. The elements are arranged on the inner side of the circuit board covered with the USB and the power supply connector. The interior of the circuit is readily accessible, since unscrew 4 screws and recording LCD display.

TOP Layer

TOP Layer




TOP Layer 3D


Domestic production of printed circuit board is not anything special and is feasible. Vias is very little and is easy to solder.

The PCB is made in the Altium Designer 10.




First of all soldered smaller SMD components, resistors, capacitors, microcontroller and a voltage regulator. Only then tackle the major elements of soldering, USB connector, power connector, buttons and sticks. When soldering the microcontroller attention should be paid to the proper orientation, and that no short circuits. Care is also needed on the polarity of electrolytic capacitors.

Caution: a housing of the USB connector is conductive and has on it the mass (GND). Connector is required to affix insulating film, so it will not short-circuit the USB connector and the LCD display.

How to connect to a microcontroller (DFU mode)?

First connect the circuit (microcontroller) to the USB, we need to switch to programming mode via USB (DFU mode). This is done by pressing the HWB and briefly press the RESET button yet. Then HWB button down. The computer will recognize the microcontroller and install the drivers. Drivers for microcontroller can be downloaded below.

Once the drivers are installed in program Flip click on the icon icon-target and choose the microcontroller that we use. Connect by clicking the icon icon-usb and click Open. So we flip connect to the microcontroller.

By clicking Run pass the program a microcontroller. If the microcontroller is programmed correctly they shall appear green circle hooks.

That the program is started pressing and releasing the RESET button.


Backlight ON / OFF function:

On the circuit NPN transistor BC817 in SOT-23 chassis which controlled power supply for LCD backlight.


The button backlight turns on and switch off the LCD backlight.


USB to Serial ON / OFF function:

The PCB has the ability to stop and start the USB to Serial connection with USB switch.

USB Disconnected

USB Disconnected

USB Connected

USB Connected

Display on the screen:

LCD Display

The program for the microcontroller is written in the C programming language, the Programme for programming AVR Studio 4 The system is built from the main program, which is carried out in an endless loop display of the measured internal and external temperatures.

USBtoSerial and program:

When we programmed the microcontroller circuit connect to USB. The computer will automatically detect the USB device FlashElectronics necessary to install the driver FlashElectronics_DRIVER.inf. Once successfully installed you will vDevice Manager (Device Manager) showed the device FlashElectronics USB (COMx). Now just run the program and FlashElectronics.exe selected port.

USB COM Properties

The program works on Windows 7, Vista and XP. In the COMx port is selected and click the Open button to refresh the ports click the button R. The program shows the internal and external temperature, time and date, and the status of the LCD backlight. The program also stores the temperature in the folder temperatures, the program creates a folder itself. Temperatures begin to save when you click the Open button. To conclude store must click the Close button. Stores in 10 seconds. The recorded temperature with time every 10 seconds. The program is made in Visual Studio (


The final product / Images:



Final product

Final product

Final product

Article in magazine “Svet Elektronike”:

Article in book “”:

Article can be found on


USB LCD Thermometer SCH
USB LCD Thermometer SCH
Version: 1.0.0
423.3 KiB

USB LCD Thermometer Article SE
USB LCD Thermometer Article SE
Version: 1.0.0
1.1 MiB

18.3 MiB

USB LCD Thermometer Programs
USB LCD Thermometer Programs
Version: 1.0.0
1.7 MiB

USB LCD Thermometer PCB Altium 2.0.0
USB LCD Thermometer PCB Altium 2.0.0
Version: 2.0.0
890.5 KiB

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>