Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Climate_Watcher Built....Now Help For Data Logger

Status
Not open for further replies.

theo92

New Member
This is my first large scale PIC mcu project.
I 've made a stuff; which will show the current temp and barometric pressure on a 16x2 LCD.The pressure sensor has not arrived to me. Fed-Ex saying 'Init'l shipment release' and showing estimed delivery date 10th Dec.....hope I can add the pressure sensor then.

But I've programmed for that.
I used a 18F2550 at 20MHz.And DS1620 give the digital temp data. ADC left for the pressure sensor MPX6115 which is a absolute pressure sensor from freescale semiconductor.

The code:
Code:
{
*****************************************************************************
*  Name    : Climate_Watcher.BAS                                            *      
*  Author  : Main DS1620 program by David John Barker,                      *
*            Modified by Theo, Helped from Spency's PIC Tutorials           *
*            www.digital-diy.net                                            *
*            Thanks to www.electro-tech-online.com                          *       
*  Date    : 12/2/2008                                                      *
*  Version : 1.0....the basic version with temperature and pressure viewer  *                                                          *
*  Notes   : v1.2 will be eqiped with data logging to SD card and RTC       *                                                       *
*          : v2.0 will use a Sensirion SHT11 + all v1.2 features            *                                                   *
*****************************************************************************
}

Device = 18F2550
Clock = 20


// some LCD options...
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.3
#option LCD_EN = PORTC.1
#option LCD_TYPE = ALPHA

// import LCD and shift libraries...
Include "LCD.bas"
Include "shift.bas"
Include "convert.bas"
Include "ADC.bas"
Include "usart.bas" 

// data, clock and reset pins...
Dim DataPin As PORTB.0   
Dim ClockPin As PORTB.1
Dim ResetPin As PORTB.2 
Dim ADVal As Word
// Read the AD port and scale for 0.00 - 5.00 volts...
Function ADInAsVolt() As Word
    result = (ADC.Read(0) + 1) * 500 / 1024
End Function
Dim S1 As PORTA.5


// start conversion from DS1620

Sub StartConversion()
    ResetPin = 1
    Shift.Out(LSB_FIRST, $EE, 8)
    ResetPin = 0
End Sub

// ADC config 

Sub ADC()
ADCON1 = %10000000
ADCON0.7 = 1
ADCON0.6 = 1

End Sub
 
// read temperature...      
Function ReadTemperature() As Word       
    ResetPin = 1
    Shift.Out(LSB_FIRST, $AA, 8)
    Result = Shift.In(LSB_PRE, 9)
    ResetPin = 0
End Function


// display the temperature on LCD...
Sub DisplayTemperature(pValue As Word)
    LCD.MoveCursor(1,1)
    LCD.Write("***T=",DecToStr(pValue >> 1), ".", DecToStr(pValue.0 * 5), $DF, "C**")
    ADVal=ADInAsVolt
    LCD.MoveCursor(2,1)
    LCD.Write("***P= ", DecToStr(ADVal / 100), ".", DecToStr(ADVal, 2), "KPa* ")
End Sub

// set clock and reset pin to output...
Shift.SetInput(DataPin)
Shift.SetOutput(DataPin)
Shift.SetClock(ClockPin)
Output(ResetPin)

// main program loop...
StartConversion
While true
    DisplayTemperature(ReadTemperature)
    DelayMS(500)
Wend

Now I need your help. I want to convert it a full data logger which will bring the nearby weather station to my home.
I've a plan to log to a SD card.Everyhing's seems to be OK,,,that I need a 3.3V converter, pullups for the data lines....all right..but

I'm using SwordFish IDE SE version...which doesn't include the SDFileSystem library. the libary version 3.xx and 4.11 is available for download from their website and I've downloaded 'em.

But the limitation here that, I can't use more than 200bytes of RAM....whuch is simply not sufficient for SD applications.

Will anybody, Swordfish full version user, compile the .bas file if I post it here, after I managed to write the code?

And It's not for commercial purpose only for my 'big dream to bring the weather station to my home' and for my friends to show in my school science project show.

WIll somebody help regarding that, please?
unless my long effort will go in vain.

does anybody have any other type of think 'bout data logging?
any comments for improving the code?
any comments about sdfilesystem?


Did anybody buy a Sensirion SHT11 or SHT71 sensor from india?
if yes, from where did you buy?
indian distributor of sensirion just looks a bit unresponsive....they told the price of SHT11 that is 875/- they wanted my address...I gave him....but no response...

I think there must be someone to raise helping hands...not that?:)
 
here are some pics

**broken link removed**
**broken link removed**
**broken link removed**
**broken link removed**
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top