Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

CR1000 upload to Weather Underground


cellectronic Dec 12, 2014 05:33 PM

Hi All
I am trying to get a CR1000 logger to upload the data directly to weather-underground.
My program is attached for your perusal, I would be very grateful if you could point out any obvious mistakes, There must be some because it is not uploading the data.
I have blanked the password here for my security.
The program was created with shortcut and the Wunderground code (from the forum) added and modified
Many thanks for any help.


'Declare Variables and Units
Public Batt_Volt
Public BP_mbar
Public Rain_mm
Public AirTC
Public RH
Public WindDir
Public WS_ms

Units Batt_Volt=Volts
Units BP_mbar=mbar
Units Rain_mm=mm
Units AirTC=Deg C
Units RH=%
Units WindDir=degrees
Units WS_ms=meters/second

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,60,Min,10)
Average(1,BP_mbar,FP2,False)
Totalize(1,Rain_mm,FP2,False)
Average(1,AirTC,FP2,False)
Sample(1,RH,FP2)
Sample(1,WindDir,FP2)
Average(1,WS_ms,FP2,False)
EndTable

DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,Batt_Volt,FP2,False,False)
EndTable

'Main Program
BeginProg
Scan(10,Sec,1,0)
'Default Datalogger Battery Voltage measurement Batt_Volt:
Battery(Batt_Volt)
'CS100 Barometric Pressure Sensor measurement BP_mbar:
If IfTime(59,60,Min) Then PortSet(1,1)
If IfTime(0,60,Min) Then
VoltSE(BP_mbar,1,mV2500,1,1,0,_50Hz,0.2,600.0)
BP_mbar=BP_mbar*1.0
PortSet(1,0)
EndIf
'Generic Tipping Bucket Rain Gauge measurement Rain_mm:
PulseCount(Rain_mm,1,1,2,0,0.2,0)
'HMP45C (6-wire) Temperature & Relative Humidity Sensor measurements AirTC and RH:
PortSet(9,1)
Delay(0,150,mSec)
VoltSE(AirTC,1,mV2500,2,0,0,_50Hz,0.1,-40.0)
VoltSE(RH,1,mV2500,3,0,0,_50Hz,0.1,0)
PortSet(9,0)
If RH>100 And RH<108 Then RH=100
'NRG #200P Wind Direction Sensor measurements WindDir:
BrHalf(WindDir,1,mV2500,4,1,1,2500,True,0,_50Hz,360.0,0)
If WindDir>=360 Then WindDir=0
'NRG #40 Wind Speed Sensor measurements WS_ms:
PulseCount(WS_ms,1,2,1,1,0.765,0.35)
If WS_ms<0.36 Then WS_ms=0
'Call Data Tables and Store Data
CallTable(Table1)
CallTable(Table2)

'Wunderground

'Declare Public Variables
'Public PTemp_C
'Public ATemp_F
'Public wind_direction
'Public wind_speed_mph
'Public air_temperature_f
'Public dew_point
'Public relative_humidity
'Public slrw
'Public pressure_inches


'Wunderground
Public http_get_socket
Public http_get_header As String * 23
Public http_get_response As String * 23
Dim http_get_uri As String * 500
'UTC TIme Variables
Dim SS1990 As Long
Public UTCTime As String * 30
Const UTC_OFFSET = -0*3600 '- 0 Hours GMT (Adjust for your time zone)
Const WUNDERGROUND_ID = "I90579427"
Const WUNDERGROUND_PASSWORD = "xxxxxxxxx"
'BeginProg
'Scan(10, Min, 3, 0)
'create wunderground timestamp
SS1990 = Public.Timestamp(1,1)
SS1990 = SS1990 + UTC_OFFSET
UTCTime = SecsSince1990 (SS1990,4)
UTCTime = Left(UTCTime,19)
UTCTime = Replace(UTCTime," ","+")
UTCTime = Replace(UTCTime,":","%3A")
'HTTPGet information to wunderground.com
http_get_header = ""
http_get_response = ""
http_get_uri = "http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?action=updateraw"
http_get_uri = http_get_uri & "&ID=" & WUNDERGROUND_ID & "&PASSWORD=" & WUNDERGROUND_PASSWORD
http_get_uri = http_get_uri & "&dateutc=" & UTCTime
http_get_uri = http_get_uri & "&winddir=" & Round(WindDir,0)
http_get_uri = http_get_uri & "&windspeedms=" & Round(WS_ms,1)
http_get_uri = http_get_uri & "&tempc=" & Round(AirTC,1)
'http_get_uri = http_get_uri & "&dewptf=" & Round(dew_point,1)
http_get_uri = http_get_uri & "&humidity=" & Round(RH,0)
'http_get_uri = http_get_uri & "&solarradiation=" & Round(slrw,1)
http_get_uri = http_get_uri & "&barommbar=" & Round(BP_mbar,1)
http_get_uri = http_get_uri & "&softwaretype=cr1000"
http_get_socket = HTTPGet(http_get_uri, http_get_response, http_get_header)

'TCPClose(http_get_socket)

NextScan
EndProg

* Last updated by: cellectronic on 12/12/2014 @ 10:34 AM *


cellectronic Dec 15, 2014 07:22 PM

Hi All
I am still struggling away to get this sorted .
Reading through the code which I don't fully understand yet.I don't see how the CR1000 makes contact with Weather Underground.
Do I need to configure the CR1000 FTP,PPP params from device configuration utility ?
One more point , The CR1000 is on my local network, not using a C/S NL100 but a third party serial/ethernet device but the logger is reachable via Loggernet and Dev.Config Utility.
Any help would be extremly appreciated. Thankyou.


jtrauntvein Dec 15, 2014 09:21 PM

In order to perform any internet protocols, the datalogger's IP stack MUST be connected to the internet. If you are connecting the datalogger to a network connection using a serial server, including a cell modem configured as a serial server), the datalogger's TCP/IP stack will not be active an no attempt to use internet protocols such as FTP or HTTP will work. On the CR1000, this translates to using an NL115, an NL201 or NL240 in bridge mode, or a PPP device on one of the logger's ports.

Log in or register to post/reply in the forum.