SD CARD TEMPERATURE / VOLTAGE LOGGING
Logging temperature from sensor DS18B20 -55 to 125 deg C or 5VDC input to the PIC's ADC. Logs up to 65,000 readings to a TXT file on a CD Card formatted FAT32, cards can be SD or SDHC (up to 32GB). PIC16F is short on RAM to write 512 bytes (full sector) to the card, so it cannot create a file, instead it modifies a file on the disk. The code finds the file reads the name and uses it to set the log interval time.
To create a text file take any file (for example mp3 file) the size needed or larger and change the extention to TXT by renaming it. Text (TXT) file has to be 910KB in size to contain 65,000 readings, if less than 65,000 readings needed the file can be smaller, for each line of reading 14 bytes are needed.
After the code reads 72 bytes of 36 temperature/voltage readings it calculates the temperature/voltage and convert it to text and writes it into single sector on the card. It repeated for 65,000 readings. The SD card is written every 36 readings so when power is off or STOP is pressed while logging up to 36 last readings are lost, make sure to stop logging 36*interval time longer than needed.
Button LOG starts the logging and STOP resets the logging. Interval time is 2 to 255 seconds, it is set by the text file name. The name must have 3 numbers i.e. 031 (31 seconds) and TXT extension in upper case.
For more accurate voltage reading 1K resistor can be shorten but make sure voltage doesn't exceed 5V.
TO SETUP THE CARD
Format the card with FAT32.
Use PC to create a text file. The name must have 3 numbers i.e. 031 (31 seconds) and TXT extension in upper case i.e. 031.TXT.
Copy the file to the card with no other files added.
Sample file is included.
SD CARD VOLTAGE LOGGING ATtiny85/45
Logging 5VDC input to the ATtiny ADC. Logs up to 65,000 readings to a TXT file on a CD Card formatted FAT32, cards can be SD or SDHC (up to 32GB). ATtiny is short on RAM to write 512 bytes (full sector) to the card, so it cannot create a file, instead it modifies a file on the disk. The code finds the file reads the name and uses it to set the log interval time. After the code reads 72 bytes of 36 voltage readings it calculates the voltage and convert it to text and writes it into single sector on the card. It repeated for 65,000 readings. The SD card is written every 36 readings so when power is off while logging up to 36 last readings are lost, make sure to stop logging 36*interval time longer than needed.
To create a text file take any file (for example mp3 file) the size needed or larger and change the extention to TXT by renaming it. Text (TXT) file has to be 910KB in size to contain 65,000 readings, if less than 65,000 readings needed the file can be smaller, for each line of reading 14 bytes are needed.
Power on starts the logging. Interval time is 2 to 255 seconds, it is set by the text file name. The name must have 3 numbers i.e. 031 (31 seconds) and TXT extension in upper case.
For more accurate voltage reading 1K resistor can be shorten, make sure voltage doesn't exceed 5V.
ATtiny is programmed using Arduino IDE and Arduino as ISP. Use these instructions https://gist.github.com/ij96/804e731bd31dbb95b2b043e93c79ceab with the difference of burning bootloader with setting "Clock Source 4MHz(internal)". ATtiny85 or ATtiny45 can be used.
TO SETUP THE CARD
Format the card with FAT32.
Use PC to create a text file. The name must have 3 numbers i.e. 031 (31 seconds) and TXT extension in upper case i.e. 031.TXT.
Copy the file to the card with no other files added.
Sample file is included.
OLED TEMPERATURE LOGGING USING DS18B20 SENSOR
Logging temperature from sensor DS18B20 -55 to 125 deg C. OLED display, 128x64, 0.96", SSD1306, I2C. Up to 96 (48 for PIC16F628A) temperiture readings can be logged, 16 per page. Each reading is stored in 2 bytes in the EEPROM of the PIC. Each log is displayed with number of log followed by temperature. PIC16F628A drives the OLED by software I2C.
On power up the interval time of logging is displayed in seconds, press button Stop/Inc to increase the time, 255 seconds max. To start logging press Log button and Stop/Inc to stop logging. Pressing Read button displays 16 readings, press Read to read next page.
OLED VOLTAGE LOGGING ATtiny85/45
Logging voltage 0-5.115V at 5V supply. OLED display, 128x64, 0.96", SSD1306, I2C. Up to 96 temperiture readings can be logged, 16 per page. Each reading is stored in 2 bytes in the EEPROM. Each log is displayed with number of log followed by voltage.
On power up the interval time of logging is displayed in seconds, press button READ to increase the time, 255 seconds max. To start logging press LOG button. Pressing READ button displays 16 readings, press Read to read next page.
Sketch includes a lib tinyI2C that can be downloaded from GitHub: https://github.com/technoblogy/tiny-i2c/tree/master
ATtiny is programmed using Arduino IDE and Arduino as ISP. Use these instructions https://gist.github.com/ij96/804e731bd31dbb95b2b043e93c79ceab with the difference of burning bootloader with setting "Clock Source 4MHz(internal)". ATtiny85 or ATtiny45 can be used.
PC TEMPERATURE LOGGING USING DS18B20 SENSOR
Visual Studio app logging temperature from sensor DS18B20 -55 to 125 deg C. The PIC connects to the PC using USB to Serial converter module. The port number can be found in DEVICE MANAGER. App code and EXE file are included. Sampling time can be set up to 2 million seconds. SAVE button saves the reading to a file log.txt in the folder of the app. COPY button copy the log text to the clipboard.
5V supply to the sensor and the PIC are from the 5V output of the USB to Serial module.
USB to Serial from eBay: https://www.ebay.co.uk/
|