thermometer dengan avr

Not rated 16,479

Circuit Image

The module provides a pre-wired multiplex of a 4-digit common anode LED, which is quite useful. The soldering pad for these signals is shown in the first picture below. A friend provided an AT90S2313 chip, along with a simple homemade ISP cable and free software AVR ISP downloader, eliminating the need for a device programmer. Additionally, a DS1820 temperature sensor was acquired from the same friend. During the weekend, the project was assembled, resulting in "the AVR Thermometer." The second picture displays a sample circuit using a universal PCB, with a 10-pin header for STK200 compatible downloader located in the upper right corner. The LED module was designed for CLOCK display, suggesting the possibility of writing a C program for both Clock and Temperature display after completing the project. The circuit diagram is straightforward and resembles the 89C2051 Clock Circuit. PORTB sinks forward current for each LED segment through a 220 Ohm resistor. The common anode pin for each digit is controlled by PORTD, specifically PD2-PD5. A PNP transistor, which can be any type of small signal transistor, is used. S1-S4 serve as optional keypads, while PD6 is an optional output. All LEDs are driven with sink current. The DS1820 temperature sensor is connected to PD1 with a 4.7k pull-up resistor. The example circuit utilizes only one sensor, but multiple sensors can be connected on the same line, and the program can be modified to read them using the internal chip ID. The source program is written in C language and compiled using the AVR CodeVision C compiler. Initially, the AT90S8535 was used, but the C code was later transferred to the 2313 with slight modifications. A for-loop statement enables 4-cycle scanning from digit 0 to digit 3. The digit control line is activated by sending the complement of the digit variable, followed by segment data from the heat[i] array. A 1ms delay allows sufficient time for electrons to return to their ground state, converting to electromagnetic radiation before turning off the digit and changing to the next one. The digit data is then shifted right by one bit for the subsequent digit. A foreground task is triggered by a timer0 interrupt every 1/15 seconds. Timer0 receives its internal clock from 4MHz/1024 or 3906Hz. With an 8-bit timer0 counting from 0 to 255 and setting the interrupt flag from the transition of 255 to 0, the interrupt rate becomes 3906Hz/256 or 15Hz. A global variable "tick" is used to count the number of interrupts. When the tick reaches 15, indicating that one second has passed, the function read_temp() is executed.

The AVR Thermometer circuit employs a 4-digit common anode LED display, allowing for simultaneous visualization of temperature and time. The multiplexing technique used in this design ensures that each digit is activated in a sequential manner, minimizing the number of required microcontroller pins while maximizing display efficiency. The AT90S2313 microcontroller serves as the central processing unit, managing both the LED display and the DS1820 temperature sensor.

The LED segments are driven by PORTB, where each segment of the display is connected through a 220 Ohm resistor to limit current and prevent damage to the LEDs. The common anode setup requires the microcontroller to sink current, which is achieved through PORTD pins PD2 to PD5. The use of a PNP transistor allows for further control of the display, enabling more extensive interfacing options.

The DS1820 temperature sensor provides a digital temperature reading, which is connected to PD1 with a 4.7k pull-up resistor. This configuration ensures reliable communication between the sensor and the microcontroller. The program logic accommodates the potential for multiple DS1820 sensors to be connected in parallel, leveraging the unique chip ID to differentiate between sensors.

The timing mechanism in this circuit is critical for achieving accurate temperature readings and display updates. The timer0 interrupt, triggered every 1/15 seconds, allows for regular updates to the display while maintaining responsiveness to temperature changes. The use of a global variable for counting interrupts facilitates the execution of the temperature reading function at precise intervals.

Overall, this AVR Thermometer project exemplifies efficient microcontroller programming and circuit design, integrating display technology with temperature sensing to create a functional and user-friendly device. The modular nature of the design allows for future enhancements, such as additional sensors or features, making it a versatile platform for experimentation and learning in electronics.The module provide a pre wired multiplex of 4-digit common anode LED, that`s great. See the soldering pad of these signal in the 1st picture below. I thought, my friend gave me the AT90S2313 chip, and with a simple homemade ISP cableand a free software AVR ISP downloader, so we don`t need the device programmer. Also I got the DS1820 from my friend. So I spent my freetime weekend puttingthem together, "the AVR Thermometer". The 2nd picture shows a samplecircuit using universal PCB, see the upper right, it was 10-pin headerfor STK200 compatible downloader. Of course the LED module was designedfor CLOCK display, so you may interested in writing C program for bothClock and Temperature display after built this project.

The circuit diagram is straight forward, similar to 89C2051Clock Circuit. PORTB sinks forward current of each LED segmentthrough a 220 Ohms resistor. The common anode pin for each digit is controlledby PORTD, i. e. , PD2-PD5. The PNP transistor can be any types of small signaltransistor. S1-S4 are optional keypad. Also PD6 is optional output. Allof LEDs are driven with sink current. The temperature sensor chip, DS1820 is connected to PD1 with a 4. 7kpull-up resistor. The example of circuit uses only one sensor, you maytie multiple sensors on the same line and modify the program to read itwith the help of internal chip ID. The source porgram was written in C language and compiled with AVR CodeVisionC compiler. Actually my first try used the AT90S8535, then I moved theC code from 8535 to 2313 with a bit modification.

for-loop statement provides 4-cycle scanning from digit0 to digit3. First we activate digit control line by sending complement of digit variable. Follow with segment data from heat[i] array. The delay 1ms provides enoughtime for electron to jump back to ground state converting to electromagneticradiation. Then turn off before changing digit. The digit data is thenshifted to the right one bit. Similarly for the next digit. The foreground task is entered by timer0 interrupt every 1/15 s. Timer0get the internal clock from 4MHz/1024 or 3906Hz. So with an 8-bit timer0counting up from 0 to 255 and set interrupt flag from 255 to 0 transition, the rate of interrupt will be 3906Hz/256 or 15Hz.

I used a global variable "tick" for counting a number of interrupt entering. See below, when tick equal to 15 or one second has elapsed then functionread_temp() will be executed. 🔗 External reference




Warning: include(partials/cookie-banner.php): Failed to open stream: Permission denied in /var/www/html/nextgr/view-circuit.php on line 713

Warning: include(): Failed opening 'partials/cookie-banner.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nextgr/view-circuit.php on line 713