Hi,
Often a digital censor is used to measure the temperature in a room.
On an ESP32 a NTC Thermistor is also a good alternative.
On 17/09/2022 1:33 am, Jos Ven wrote:
Hi,Don't know much about ESP32 but how is a thermistor a good alternative
Often a digital censor is used to measure the temperature in a room.
On an ESP32 a NTC Thermistor is also a good alternative.
to a LM35 etc for this particular application? I mention this as a
Rinnai heater owner who has struggled with its hopeless temperature
sensing ability.
Don't know much about ESP32 but how is a thermistor a good alternative to a LM35 etc.
Op zaterdag 17 september 2022 om 05:40:21 UTC+2 schreef dxforth:
...
Don't know much about ESP32 but how is a thermistor a good alternative to a LM35 etc.
Not always, a thermistor lacks a digital output.
The response of a thermistor is non-lineair.
One advantage of a thermistor is that it can be mounted to a plate.
Not sure if you can do so easy with a LM35.
Jos
On 17/09/2022 7:57 pm, Jos Ven wrote:
Op zaterdag 17 september 2022 om 05:40:21 UTC+2 schreef dxforth:
...
Don't know much about ESP32 but how is a thermistor a good alternative to a LM35 etc.
Not always, a thermistor lacks a digital output.LM35 is analog out (10mV/C). Flat-sided plastic pack makes mounting
The response of a thermistor is non-lineair.
One advantage of a thermistor is that it can be mounted to a plate.
Not sure if you can do so easy with a LM35.
Jos
easy (saddle clamp). Price difference for a few units is negligible.
Simpler software :)
Op zaterdag 17 september 2022 om 14:37:56 UTC+2 schreef dxforth:
On 17/09/2022 7:57 pm, Jos Ven wrote:
Op zaterdag 17 september 2022 om 05:40:21 UTC+2 schreef dxforth:LM35 is analog out (10mV/C). Flat-sided plastic pack makes mounting
...
Don't know much about ESP32 but how is a thermistor a good alternative to a LM35 etc.
Not always, a thermistor lacks a digital output.
The response of a thermistor is non-lineair.
One advantage of a thermistor is that it can be mounted to a plate.
Not sure if you can do so easy with a LM35.
Jos
easy (saddle clamp). Price difference for a few units is negligible.
Simpler software :)
Thank you.
It seems there is not much room for a thermistor.
Jos
There are several sensors in the range LM35, LM34, LM335. Shocked to
On 18/09/2022 2:57 am, Jos Ven wrote:
Op zaterdag 17 september 2022 om 14:37:56 UTC+2 schreef dxforth:
On 17/09/2022 7:57 pm, Jos Ven wrote:
Op zaterdag 17 september 2022 om 05:40:21 UTC+2 schreef dxforth:LM35 is analog out (10mV/C). Flat-sided plastic pack makes mounting
...
Don't know much about ESP32 but how is a thermistor a good alternative to a LM35 etc.
Not always, a thermistor lacks a digital output.
The response of a thermistor is non-lineair.
One advantage of a thermistor is that it can be mounted to a plate.
Not sure if you can do so easy with a LM35.
Jos
easy (saddle clamp). Price difference for a few units is negligible.
Simpler software :)
Thank you.There are several sensors in the range LM35, LM34, LM335. Shocked to
It seems there is not much room for a thermistor.
Jos
discover National Semiconductor had been taken over by Texas Instruments...
On Sunday, September 18, 2022 at 12:04:43 AM UTC-4, dxforth wrote:
On 18/09/2022 2:57 am, Jos Ven wrote:
Op zaterdag 17 september 2022 om 14:37:56 UTC+2 schreef dxforth:
On 17/09/2022 7:57 pm, Jos Ven wrote:
Op zaterdag 17 september 2022 om 05:40:21 UTC+2 schreef dxforth:LM35 is analog out (10mV/C). Flat-sided plastic pack makes mounting
...
Don't know much about ESP32 but how is a thermistor a good alternative to a LM35 etc.
Not always, a thermistor lacks a digital output.
The response of a thermistor is non-lineair.
One advantage of a thermistor is that it can be mounted to a plate.
Not sure if you can do so easy with a LM35.
Jos
easy (saddle clamp). Price difference for a few units is negligible.
Simpler software :)
??? Really? That happened, what 10, 15 years ago?Thank you.There are several sensors in the range LM35, LM34, LM335. Shocked to discover National Semiconductor had been taken over by Texas Instruments...
It seems there is not much room for a thermistor.
Jos
On Sunday, September 18, 2022 at 8:56:33 PM UTC+1, gnuarm.del...@gmail.com wrote:
On Sunday, September 18, 2022 at 12:04:43 AM UTC-4, dxforth wrote:
On 18/09/2022 2:57 am, Jos Ven wrote:
Op zaterdag 17 september 2022 om 14:37:56 UTC+2 schreef dxforth:
On 17/09/2022 7:57 pm, Jos Ven wrote:
Op zaterdag 17 september 2022 om 05:40:21 UTC+2 schreef dxforth:LM35 is analog out (10mV/C). Flat-sided plastic pack makes mounting >> easy (saddle clamp). Price difference for a few units is negligible. >> Simpler software :)
...
Don't know much about ESP32 but how is a thermistor a good alternative to a LM35 etc.
Not always, a thermistor lacks a digital output.
The response of a thermistor is non-lineair.
One advantage of a thermistor is that it can be mounted to a plate. >>> Not sure if you can do so easy with a LM35.
Jos
2011. I confess I thought it was earlier than that??? Really? That happened, what 10, 15 years ago?Thank you.There are several sensors in the range LM35, LM34, LM335. Shocked to discover National Semiconductor had been taken over by Texas Instruments...
It seems there is not much room for a thermistor.
Jos
On Sunday, September 18, 2022 at 12:04:43 AM UTC-4, dxforth wrote:
Shocked to
discover National Semiconductor had been taken over by Texas Instruments...
??? Really? That happened, what 10, 15 years ago?
It's always a shock to discover players which had such a large influence
in one's early years and career had gone the way of the dodo. I won't
ask for minute's silence instead leave folks to mourn in their own way.
On Sunday, September 18, 2022 at 9:18:59 PM UTC-5, dxforth wrote:
It's always a shock to discover players which had such a large influence
in one's early years and career had gone the way of the dodo. I won't
ask for minute's silence instead leave folks to mourn in their own way.
Updates for my Dell chromebook ended in July; it had reached its end-of-life date (AUE). I only had it for about three years. A purchaser needs to check the AUE before buying to see how long the particular chromebook will be supported.
On 19/09/2022 11:49 pm, S Jack wrote:
On Sunday, September 18, 2022 at 9:18:59 PM UTC-5, dxforth wrote:
It's always a shock to discover players which had such a large influence >> in one's early years and career had gone the way of the dodo. I won't
ask for minute's silence instead leave folks to mourn in their own way.
Updates for my Dell chromebook ended in July; it had reached its end-of-lifeCaveat emptor. Even so, there may be nothing from the manufacturer to indicate what support it will provide. Like you I got burned with a
date (AUE). I only had it for about three years. A purchaser needs to check the AUE before buying to see how long the particular chromebook will be supported.
Samsung phone that never received an Android update contrary to other
regions for the same model. For me the update was critical to run a
COVID check-in app. I now take the view anything requiring connection
to the internet is inherently obsolete. Brand loyalty - forget it.
The Steinhart-Hart equation should run on most ANSI Forth-systemsI ported it to 4tH. The only problems I found was:
with a floating point extension.
(tested under Cforth, Gforth and Win32forth)
To monitor the NTC you need to add some ADC words ifI faked those sensors with a bit of S/W. 1500 mV gave me about room temperature. And then let it run and see the temperature slowly sway ;-)
you do not use cforth (LWIP branch).
On Friday, September 16, 2022 at 5:33:57 PM UTC+2, Jos Ven wrote:
The Steinhart-Hart equation should run on most ANSI Forth-systemsI ported it to 4tH. The only problems I found was:
with a floating point extension.
(tested under Cforth, Gforth and Win32forth)
- A separate FP stack (not a problem - I got both);
- The use of FVALUE - I had to replace that one;
- You can't erase FLOATs (or any other non-character datatype). So I made a replacement. It's not required, since all 4tH memory is zeroed on startup - but still.
The rest was quietly handled by some stubs (KEY) and the preprocessor.
To monitor the NTC you need to add some ADC words ifI faked those sensors with a bit of S/W. 1500 mV gave me about room temperature. And then let it run and see the temperature slowly sway ;-)
you do not use cforth (LWIP branch).
Hans Bezemer
On Friday, September 16, 2022 at 5:33:57 PM UTC+2, Jos Ven wrote:
The Steinhart-Hart equation should run on most ANSI Forth-systemsI ported it to 4tH. The only problems I found was:
with a floating point extension.
(tested under Cforth, Gforth and Win32forth)
- A separate FP stack (not a problem - I got both);
- The use of FVALUE - I had to replace that one;
- You can't erase FLOATs (or any other non-character datatype). So I made a replacement. It's not required, since all 4tH memory is zeroed on startup - but still.
The rest was quietly handled by some stubs (KEY) and the preprocessor.
To monitor the NTC you need to add some ADC words ifI faked those sensors with a bit of S/W. 1500 mV gave me about room temperature. And then let it run and see the temperature slowly sway ;-)
you do not use cforth (LWIP branch).
Hans Bezemer
Thank you for looking so close to my source.I should thank you! It was a an entertaining and satisfying exercise.
In the other Forth systems, I got the following:Guilty on both. I used [DEFINED] for it. I don't have F# either (name clash), but its equivalent is F%.
For Cforth:
- Has no find
- Must use f# to get a float on the stack
What happens in your Forth when you use:create &buf
&buf f@ f.No problem. It will work as intended.
cr decimal fclearFCLEAR initializes floating point properly
f% 3300 fvariable Vs latest f! \ In mV, measure itObviously due to the use of F% and FVALUE conversion
f% 10000 fvariable R0 latest f! \ 10K
f% 298.15e0 fconstant T0 \ Temperature in Kelvin at 25C
f% 273.15e0 fconstant 0C \ Temperature in Kelvin at 0C
f% 0.7556958984e-3 fvariable A_sh latest f!
f% 2.334204104e-4 fvariable B_sh latest f!
f% 0.6102744539e-7 fvariable C_sh latest f!
: 1/f ( F: f - 1/f ) f% 1 fswap f/ ;
Vs f@ s>f f- ;Obviously to the conversion of FVALUE to FVARIABLE
fdup R0 f@ f* Vs f@ frot f- f/ ;
fln fdup fdup fdup f* f* C_sh f@ f* \ C*(ln(Rnct))^3
fswap B_sh f@ f* f+
A_sh f@ f+ \ 1/T
cr .( A: ) A_sh f@ f.
cr .( B: ) B_sh f@ f.
cr .( C: ) C_sh f@ f.
cr .( Vs: ) Vs f@ f. ( mV )
cr .( Resistor R0:) R0 f@ f.
cr .( Rt:) f% 29456 fdup f>s . ntc-shAnother due to the use of F%
[defined] adc-mv [if] \ For Cforth on a ESP32:Here you got your FIND
32 constant /adc_charsI don't do prefixed numbers
/adc_chars floats array &adc_charsHere you got my ARRAY
1500000 value Mv \ fake sensor readingThis is my fake sensor
: read-adc-mv drop Mv 1000 / 10001 choose 5000 - +to Mv ;
: init-adc drop drop drop ;
cr .( to monitor the NTC.) cr crObviously - I can't QUIT here
[then]
f% 1.292290081e-3 A_sh f!More FVALUE and F% stuff
f% 2.164041451e-4 B_sh f!
f% 0.8776278596e-7 C_sh f!
f% 0 fvariable av-trim latest f! \ if needed
cr .( A ) A_sh f@ f.
cr .( B ) B_sh f@ f.
cr .( C ) C_sh f@ f.
cr .( av-trim :) av-trim f@ f.
cr .( Vs :) Vs f@ f.
cr .( Resistor R0:) R0 f@ f.
10 constant #samplesI don't do prefixed numbers
60 constant /ring-buf \ To reduce the ADC noise furtherIn 4tH, you can't initialize with a VALUE
/ring-buf floats array &ring-bufHere you got my ARRAY again
f% 0 ring-buf-count /ring-buf min dup 0Obviously due to the use of F%
dup 3 3 init-adc 3 set-precisionI just liked a slightly higher precision ;-)
0 to ring-buf-countI split this line in two lines
/ring-buf 0 ?do f% 0 &ring-buf i floats + f! loop \ eraseAll memory is zero-ed at startup, but let's stay in the spirit ;-)
ring-buf-count . av-ntc av-trim f@ f+ f.Another victim of FVALUE
5 monitor-ntcIn 4tH, you have to start something. If not, it just compiles it
On Sunday, September 25, 2022 at 12:01:57 PM UTC+2, Jos Ven wrote:
Thank you for looking so close to my source.I should thank you! It was a an entertaining and satisfying exercise.
In the other Forth systems, I got the following:Guilty on both. I used [DEFINED] for it. I don't have F# either (name clash), but its equivalent is F%.
For Cforth:
- Has no find
- Must use f# to get a float on the stack
And as I said: I don't have FVALUE or a "true" KEY? The latter is an alias for FALSE. And finally: MS has a resolution of 1000 MS ;-)
What happens in your Forth when you use:create &buf
Creates a table for R/O integer constants;
4 floats
Throws the size for 4 floating points numbers on the stack (not
quite - but let's not go into detail);
allot
Syntax error: No such word. In order to do what you want to do
I have to write:
4 FLOATS ARRAY &BUF
That does it.
&buf f@ f.No problem. It will work as intended.
Hans Bezemer
BTW, here is a list of changes to your code:
cr decimal fclearFCLEAR initializes floating point properly
f% 3300 fvariable Vs latest f! \ In mV, measure itObviously due to the use of F% and FVALUE conversion
f% 10000 fvariable R0 latest f! \ 10K
f% 298.15e0 fconstant T0 \ Temperature in Kelvin at 25C
f% 273.15e0 fconstant 0C \ Temperature in Kelvin at 0C
f% 0.7556958984e-3 fvariable A_sh latest f!
f% 2.334204104e-4 fvariable B_sh latest f!
f% 0.6102744539e-7 fvariable C_sh latest f!
: 1/f ( F: f - 1/f ) f% 1 fswap f/ ;
Vs f@ s>f f- ;Obviously to the conversion of FVALUE to FVARIABLE
fdup R0 f@ f* Vs f@ frot f- f/ ;
fln fdup fdup fdup f* f* C_sh f@ f* \ C*(ln(Rnct))^3
fswap B_sh f@ f* f+
A_sh f@ f+ \ 1/T
cr .( A: ) A_sh f@ f.
cr .( B: ) B_sh f@ f.
cr .( C: ) C_sh f@ f.
cr .( Vs: ) Vs f@ f. ( mV )
cr .( Resistor R0:) R0 f@ f.
cr .( Rt:) f% 29456 fdup f>s . ntc-shAnother due to the use of F%
[defined] adc-mv [if] \ For Cforth on a ESP32:Here you got your FIND
32 constant /adc_charsI don't do prefixed numbers
/adc_chars floats array &adc_charsHere you got my ARRAY
1500000 value Mv \ fake sensor readingThis is my fake sensor
: read-adc-mv drop Mv 1000 / 10001 choose 5000 - +to Mv ;
: init-adc drop drop drop ;
cr .( to monitor the NTC.) cr crObviously - I can't QUIT here
[then]
f% 1.292290081e-3 A_sh f!More FVALUE and F% stuff
f% 2.164041451e-4 B_sh f!
f% 0.8776278596e-7 C_sh f!
f% 0 fvariable av-trim latest f! \ if needed
cr .( A ) A_sh f@ f.
cr .( B ) B_sh f@ f.
cr .( C ) C_sh f@ f.
cr .( av-trim :) av-trim f@ f.
cr .( Vs :) Vs f@ f.
cr .( Resistor R0:) R0 f@ f.
10 constant #samplesI don't do prefixed numbers
60 constant /ring-buf \ To reduce the ADC noise furtherIn 4tH, you can't initialize with a VALUE
/ring-buf floats array &ring-bufHere you got my ARRAY again
f% 0 ring-buf-count /ring-buf min dup 0Obviously due to the use of F%
dup 3 3 init-adc 3 set-precisionI just liked a slightly higher precision ;-)
0 to ring-buf-countI split this line in two lines
/ring-buf 0 ?do f% 0 &ring-buf i floats + f! loop \ eraseAll memory is zero-ed at startup, but let's stay in the spirit ;-)
ring-buf-count . av-ntc av-trim f@ f+ f.Another victim of FVALUE
5 monitor-ntcIn 4tH, you have to start something. If not, it just compiles it
and quits immediately.
Running your program (first 12 "measurements"):
$ pp4th -x ntc_sh.4pp
ntc_sh.fth the Steinhart-Hart equation.
ntc-sh ( Rt - Celsius ) can be used.
adc-mv ( adc_chars reading - mV ) is missing.
See: https://github.com/MitchBradley/cforth/tree/WIP
Or define your own accurate read-adc-mv and init-adc here
to monitor the NTC.
Parameters for NTC B57164K0103:That was an extra problem under Cforth.
A 0.0012922900810
B 0.0002164041451
C 0.0000000877627
av-trim :0.00
Vs :33
Resistor R0:10
To monitor the NTC on adc-channel 5 enter: 5 monitor-ntc
Sec C
1 21.0
2 21.0
3 21.0
4 21.1
5 21.2
6 21.2
7 21.2
8 21.2
9 21.2
10 21.2
11 21.2
12 21.2
I used [DEFINED] for it.
That was an extra problem under Cforth.
Cforth has no [DEFINED].
In the end I was forced to use catch.
On Sunday, September 25, 2022 at 2:42:20 PM UTC+2, Jos Ven wrote:
That was an extra problem under Cforth.Well, you won't be able to completely discard that CForth solution,
Cforth has no [DEFINED].
In the end I was forced to use catch.
but according to your own stack comments and those I retrieved
from CForths Github, may be this helps?
: (defined) parse-word $find nip ;
: [defined] (defined) ; immediate
: [undefined] (defined) 0= ; immediate
Unfortunately, I couldn't find any documentation there, so it's
still a guess.
Hans Bezemer
On Sunday, September 25, 2022 at 2:42:20 PM UTC+2, Jos Ven wrote:
That was an extra problem under Cforth.
Cforth has no [DEFINED].
In the end I was forced to use catch.
Well, you won't be able to completely discard that CForth solution,
but according to your own stack comments and those I retrieved
from CForths Github, may be this helps?
: (defined) parse-word $find nip ;
: [defined] (defined) ; immediate
: [undefined] (defined) 0= ; immediate
Unfortunately, I couldn't find any documentation there, so it's
still a guess.
This def from Cforth indicates $find has unbalanced output:
: $defined ( "name" -- adr len 0 | xt +-1 ) safe-parse-word $find ;
I doubt Cforth was ever intended to be standard.I doubt it too. On the other hand, I had little trouble with the rest of it.
On Monday, September 26, 2022 at 7:18:06 PM UTC+2, dxforth wrote:
This def from Cforth indicates $find has unbalanced output:
: $defined ( "name" -- adr len 0 | xt +-1 ) safe-parse-word $find ;
Not according to this definition (or the stack comment must be wrong):
: $find ( str cnt -- str 0 | cfa flag ) pad place pad find ;
I can only do a proper job when the documentation is correct ;-)
On Monday, September 26, 2022 at 7:18:06 PM UTC+2, dxforth wrote:
I doubt Cforth was ever intended to be standard.
I doubt it too. On the other hand, I had little trouble with the rest of it. I have little trouble with $FIND as well - although I do find its use in conditional compilation butt ugly.
...
And sure - in the Forth world is not a major sin to make something that
is non-standard.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 53:54:57 |
Calls: | 6,712 |
Files: | 12,243 |
Messages: | 5,355,274 |