Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - AndrewPratt

Pages: [1]
1
mc-Demo205 / Re: Water temperatures
« on: December 31, 2017, 11:18:07 am »
As a follow up update we have now had the 205 outside during this bitterly cold stretch over Christmas and it has continued to push out hourly updates without issue. Yesterday we hit -33C and it still worked fine. One thing I have seen consistently though is that with the clear front on the 205 unit it acts like a greenhouse when the sun shines directly on it so despite it been very cold I see a rise in day time temps around 1pm to well above zero for an hour or so before it plummets back to ambient temp. When I'm back in the office next week I will see about adding some sort of shade device to minimize that effect.

2
mc-Demo205 / Water temperatures
« on: December 14, 2017, 12:34:13 pm »
Thanks to Josh's help we've now deployed our Demo 205 with the thermistor outside our office here to see how well it stands up to winter temperatures. I've installed lithium batteries but am curious what other people's experience has been with these when left outside?

3
mc-Module / Re: NTC Thermistor Demo
« on: December 13, 2017, 10:19:07 am »
Quote
That is great, what was the root of the problem?

An idIOT error ;) When I copied the code from the 120 to the 205 I originally left the resistor value at 100k not 10k ::)

4
mc-Module / Re: NTC Thermistor Demo
« on: December 12, 2017, 02:45:10 pm »
Thanks Josh I now have it working on the Demo 205 as well using the following.


Define PinMode Pin0 As AnalogInput Alias USP10972_VOLTAGE
Define PinMode Pin6 As DigitalOutput Alias USP10972_DIVIDER_ENABLE

Class ThermistorTheThings
   
    Const USP10972_BETA As Integer = 3892
    Const USP10972_R25 As Integer = 10000 '10kOhm
    Const USP10972_DIVIDER_R1 As Integer = 10000 '10kOhm
   
    Shared USP10972 As NTCTermistor
   
    Shared Event Boot()
        USP10972_DIVIDER_ENABLE = False
        USP10972 = New NTCTermistor(USP10972_BETA, USP10972_R25)
    End Event
   
    Shared Event measureTemperature() RaiseEvent Every 1 Hours
        USP10972_DIVIDER_ENABLE = True
        Device.EnableOpamp()
        Thread.Sleep(10000) 
        Dim thermistorResistance As Float = USP10972_DIVIDER_R1 * (1 / ((Device.BatteryVoltage().ToFloat/ USP10972_VOLTAGE.ToFloat) - 1))
        USP10972_DIVIDER_ENABLE = False
        Device.DisableOpamp()
       
        Dim battShort As Short = Device.BatteryVoltage()
        Dim battFloat As Float = battShort / 1000
        Dim battString As String = battFloat.ToString()
        Dim tempTMP102string As String = Temperature.GetTemp().ToString
        Dim tempPstring As String = USP10972.TemperatureCFromResistance(thermistorResistance).ToString         
       
        Dim LosantTopic As String = "losant/myDeviceID/state"
        Dim losantPayload As Json = New Json       
        Dim mcJson As Json = New Json
       
        mcJson.Add("probeTemp", tempPstring)
        mcJson.Add("temperature", tempTMP102string)
        mcJson.Add("batteryVoltage", battString)
       
        losantPayload.Add("data", mcJson)
        Lplan.Publish(LosantTopic, losantPayload.ToListOfByte)
    End Event
End Class

5
mc-Module / Re: NTC Thermistor Demo
« on: December 12, 2017, 11:14:04 am »
Now that I have it working on the mc120 how do you suggest I port it to the 205 given that the 205 doesn't seem to support the AnalogInputPullUp?

6
mc-Module / Re: NTC Thermistor Demo
« on: December 12, 2017, 11:09:59 am »
Update. I decided that since I only had 1 temp probe attached to the 120 I didn't need to use the resistor and pin's 0 & 6 so I swapped it over to the ground and pin7 approach with the internal pullup and it now works perfectly. This is the new code.

Define PinMode Pin7 As AnalogInputPullUp Alias USP10972_VOLTAGE

Class ThermistorTheThings
   
    Const USP10972_BETA As Integer = 3892
    Const USP10972_R25 As Integer = 10000 '10kOhm
    Const USP10972_DIVIDER_R1 As Integer = 100000 '100kOhm
   
    Shared USP10972 As NTCTermistor
   
    Shared Event Boot() 
        USP10972 = New NTCTermistor(USP10972_BETA, USP10972_R25)
    End Event
   
    Shared Event measureTemperature() RaiseEvent Every 10 Seconds
        Device.EnableOpamp()
        Thread.Sleep(10000) 
        Dim thermistorResistance As Float = USP10972_DIVIDER_R1 * (1 / ((Device.BatteryVoltage().ToFloat/ USP10972_VOLTAGE.ToFloat) - 1)) 
        Device.DisableOpamp()
       
        Dim battShort As Short = Device.BatteryVoltage()
        Dim battFloat As Float = battShort / 1000
        Dim battString As String = battFloat.ToString()
        Dim tempTMP102string As String = Temperature.GetTemp().ToString
        Dim tempPstring As String = USP10972.TemperatureCFromResistance(thermistorResistance).ToString         
       
        Dim LosantTopic As String = "losant/myDeviceID/state"
        Dim losantPayload As Json = New Json       
        Dim mcJson As Json = New Json
       
        mcJson.Add("probeTemp", tempPstring)
        mcJson.Add("temperature", tempTMP102string)
        mcJson.Add("batteryVoltage", battString)
       
        losantPayload.Add("data", mcJson)
        Lplan.Publish(LosantTopic, losantPayload.ToListOfByte)
    End Event
End Class

7
mc-Module / Re: NTC Thermistor Demo
« on: December 11, 2017, 04:23:01 pm »
So when I measure the 0 and 6 pin's and measure the voltage as I dip the probe in hot and cold water it does change as you'd expect it would.

This is the tempprobe code that I added to the project...

Class NTCTermistor
    Private beta As Integer
    Private R25 As Integer
    Public Sub New(betaIn As Integer, R25In As Integer)
        'set Beta value
        beta = betaIn
        'Set R25 resistance value
        R25 = R25In
    End Sub
    Public Function TemperatureFromResistance(resistance As Float) As Float
        'returns temperature in Kelvin from resistance of thermistor using Beta parameter equation
        Dim temp1 As Float = -1 * beta.ToFloat() / 298.15
        Dim temp2 As Float = resistance / (R25.ToFloat() * temp1.Exp())
        Return (beta / temp2.Log())
    End Function
    Public Function TemperatureFFromResistance(resistance As Float) As Float
        'returns temperature in Fahrenheit from resistance of thermistor
        Return (TemperatureFromResistance(resistance) * (9 / 5)) - 459.67
    End Function
    Public Function TemperatureCFromResistance(resistance As Float) As Float
        'returns temperature in Celcuis from resistance of thermistor
        Return TemperatureFromResistance(resistance) - 273.15
    End Function
End Class

8
mc-Module / Re: NTC Thermistor Demo
« on: December 11, 2017, 03:54:57 pm »
sorry I thought I'd included those. The wiring is the same as the demo only I had wire leads added to the mc120 so that we could prototype other things more easily.


Define PinMode Pin0 As AnalogInput Alias USP10972_VOLTAGE
Define PinMode Pin6 As DigitalOutput Alias USP10972_DIVIDER_ENABLE

9
mc-Module / NTC Thermistor Demo
« on: December 11, 2017, 01:32:21 pm »
I am having a problem trying to get the Hackster thermistor demo working that is outlined here (https://www.hackster.io/mc-Things/iot-ntc-thermistor-temps-using-thethings-io-7f6934)

I ordered the same USP10972 thermistor and believe i have the wiring correct but the values I'm getting out fluctuate a lot and are never anywhere near valid. I also get a lot of not a number errors so there's obviously something wrong! The hackster description calls for a 100 ohm resistor but the one used in the image is a 10k...I've tried both but neither solves the issue.

Ultimately I want to get it working on the 120 and then port it to the 205 so that I can read water temp's outside under the ice.

Here's the code I'm using to push the data to Losant. I also have the onboard temp and battery being pushed as well but I've remove that from the code below to keep it on topic.


Class Thermistor
   
    Const USP10972_BETA As Integer = 3892
    Const USP10972_R25 As Integer = 10000 '10kOhm
    Const USP10972_DIVIDER_R1 As Integer = 10000 '10kOhm
   
    Shared USP10972 As NTCTermistor
   
    Shared Event Boot()
        USP10972_DIVIDER_ENABLE = False
        USP10972 = New NTCTermistor(USP10972_BETA, USP10972_R25)               
    End Event
   
    Shared Event measureTemperature() RaiseEvent Every 10 Seconds         
        Dim LosantTopic As String = "losant/deviceID/state"
        Dim losantPayload As Json = New Json
       
        USP10972_DIVIDER_ENABLE = True
       
        Device.EnableOpamp()
       
        Thread.Sleep(10000)
       
        Dim thermistorResistance As Float = USP10972_DIVIDER_R1 * (1 / ((Device.BatteryVoltage().ToFloat/ USP10972_VOLTAGE.ToFloat) - 1))
       
        USP10972_DIVIDER_ENABLE = False
       
        Device.DisableOpamp()
       
        Dim tempPstring As String = USP10972.TemperatureCFromResistance(thermistorResistance).ToString
       
        Dim tempPJson As Json = New Json
        tempPJson.Add("probeTemp", tempPstring)
       
        losantPayload.Add("data", tempPJson)
       
        Lplan.Publish(LosantTopic, losantPayload.ToListOfByte)       
    End Event
End Class

Pages: [1]