Description of the device
The main element is Atmega128 microcontroller. The program takes almost all available memory (about 120kB). The device is also equipped with simplified RS232 port and Bluetooth module (BTM-112), which is responsible for wireless data sending, e.g. to a computer. A simple program on HTC M3100 (Windows Mobile 6) was made while working on this station. The program received the sent data and controlled the relay which was connected for tests. The station records data continuously, so it was equipped with SD card, which stores all measurements. Microcontroller is responsible for readout of resistive touch. Backlight and contrast control is made by the PWM signals generated by the processor. RTC system is DS1307, which also serves as an emergency memory. Popular DS18B20 were used as temperature sensors. Three such sensors can be connected. Humidity measurement is done by SHT11 sensor (a special library to handle this sensor taking in to account calculating the control CRC sum can be written). As a pressure sensor, MPXA6115 component was used. It is supported by the internal ADC in tests, but ultimately its measurement would be made by the external transducer (it is more accurate). A simple pulse converter LM2675 with high sufficiency, acts as the power supply. Voltage of 3,3V is taken from LM1117-3.3 stabilizer. The whole is powered from a small plug power supply.
Program
Was made in WinAVR environment. While working on the project, the device sometimes lost support of the pressed point. This problem was solved by adding 'messages' queue. The entire handling of the touch panel is in an interruption. Is the microcontroller is busy (e.g. drawing an image on the screen) and at that time we press a point on the screen, that event will be saved and put in the queue despite a busy. After finishing the task, the queue content is checked and if necessary, appropriate actions are performed. Screen calibration is carried out in four points, which should be pressed quite precisely. Measured settings are averaged and calibration settings are calculated. Calibration accuracy is about 1px. In addition, median filters which improve the accuracy, were used for measuring the position. Saving to the card is done each 6 minutes. During this time, all measurements are saved to separate accumulators and the number of measurements is stored. While saving, the arithmetic mean is calculated and the record is made on the card. In the absence of the card, data are saved to NVRAM of DS1307 system. As soon as the card arrives in the device, the record is made. This memory holds up to three measurements. In the absence of the card, any attempt to read the chart finishes with the information 'No SD Card' or 'No file' when there is no appropriate file. There is also an option that allows to view the previous records, send them via RS232, Bluetooth or save them on the card as BMP file. There is a possibility of changing the initial logo by saving LOGO.BMP file of a suitable size and in monochromatic mode on the card and restart the device. During the start, the image will be saved to the EEPROM. With the onscreen keyboard, you can also sign each of the sensors, so that when you turn the chart was known, which sensor we have. Software was made in English.
Link to original thread –
Stacja Meteorologiczna