Hi Kevin, very cool video, we’re glad you liked the LMT01! Would you be interested in receiving additional EVMs and connecting with one of our temperature sensor experts?
In getTemperature(), you should disable and then re-enable interrupts whenever you read or write the pulsecount variable. It is 16 bits, made up of two bytes, and one or the other of them may get changed by the interrupt handler simultaneously with your main loop access giving confounding results.
7:24 don't drive that pin low, set it to INPUT aka high impedance state. Datasheet specifically warns against setting GPIO pin to LOW if you are using it to power the LMT01, something about reverse-biasing damaging the sensor.
Thank you Kevin. Impressive on the math, and explanations of how it all works. This looks interesting to me from both the temp sensor and the wireless. Great video as usual. Thanks.
Not sure shy the math is 256 * pulses /4096... Left shifts the bits 8 places then right shifts them 12, you could just do pulses / 16 or a right shift of 4...
Thank you for sharing , it shows you,ve did a good amount research and testing on this and i’m sure it will help anyone trying out this sensor. Love your videos
There's a bug in your getTemperature code - if you fail, you return 1000 without disabling the interrupt handler. I don't know how the Arduino handles that, but I suspect it'll keep running and waste some power. You should disable the interrupt handler a couple of lines further up as soon you stop needing to count pulses.
I feel like the code is needlessly complicated (in the getTemperature function). Maybe something like this would be simpler (UNTESTED!!!): #define pulsePin 2 uint32_t last = 0; uint16_t pulses = 0; volatile uint16_t last_pulses = 0; void pulseDetect() { uint32_t now = millis(); if (now - last > 50) { last_pulses = pulses; pulses = 0; } ++pulses; } // This needs to be called only once! void startTemperatureConversion() { attachInterrupt(digitalPinToInterrupt(pulsePin), pulseDetect, FALLING); } // Returns temperature from last conversion float getTemperature() { return 256.0 * last_pulses / 4096.0 - 50; } void setup() { Serial.begin(115200); pinMode(pulsePin, INPUT); startTemperatureConversion(); } void loop() { Serial.print(getTemperature()); Serial.print("C"); delay(250); }
thanks for posting this. The sketch throws an odd error on last line (35). I've looked it up but can't fathom it. Code looks fine to me. LMT01_test:35: error: expected unqualified-id before '?' token }? ^ exit status 1 expected unqualified-id before '?' token
Thanks for this, Kevin. A really helpful tutorial. The code works fine on arduino uno and a cheap generic esp8266 (lolin NodeMcu v3) but curiously on my Wemos D1 R2 the serial monitor shows that it keeps on resetting every few seconds. With an error message that is well beyond me (runs out of memory?). ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x4010f000, len 1384, room 16 The LMT01 is a great little device and has confirmed what I suspected - that my ds3231 tend to read a couple of degrees high.
this project didn't need anything special, but the low current and conversion speed was very important. Nothing against the DS18B20, but a while back I bought a bunch of them from Amazon and pretty sure they were counterfeit.... so watch out for that. Again, buying from Digikey and you're good, but I think they are pricier than the LMT01
yes! that is true - I definitely could have explained that better. It clamps at ~0.7V, so really should have said the 1.25V will be enough for the BE junction to clamp - thus turn on
Well, precision at .5 (both have the same precision) is good enough, you can work with multiple buses of say 8 devices each and doesn't require processing power - I can use the micro for any other task. And of course, I can use it with an STM32 at 3.3 or 5Vcc nucleobytes.blogspot.ro/2017/01/the-wire-has-fever.html. But it is nice to know how to use the TI temperature sensor, without any other reason. Thank you for that!
I have a question about your use of an NPN transistor, Why? Doesn't an NPN's gate react to changes in the current flow between the Gate-Drain terminals? Not the voltage differential between the two (like a MOSFET). Also, wouldn't it be better to forego the 10k shunt resistor and just push the current flow through the sensor directly into the NPN transistor? It would introduce a 0.7 volt drop across the gate-drain terminal of the transistor but you can compensate that by pulling the voltage on the Vp pin to 4 volts, or add another diode in series with it and pull it up to 4.5-5 volts. This might just be a moot point since it obviously works for you, but I was just curious.
NPN transistors don't have gates or drains. Effectively they amplify the E-B current by approx 100. Voltages discussed here are inconsequential, it's more about current flow into the base (technically, out of the base). If you were to forego the base to ground resistor this would send all of the idle current (34uAmps) into the base, possibly biassing the transistor permanently on. The resistor has to be just the right value for the transistor to be biassed off between pulses and biassed on during a pulse. It actually should be closer to 6.8k not 10k.
Does the PUSH notification sent to my smart phone get mixed in with all the emails that i would get if i enabled getting emails on my phone? Thanks. Great design!
it's from a separate app - I use Pushbullet, but could reprogram to use Pushover or even Slack. You an turn off notifications for this though, if you don't want to be bothered.. like if you just want to check in and see if there was any activity
Why not set a flag in your interrupt code and in your loop, just test that flag. Keep resetting the flag back to zero, yield for 10ms, check the flag, and keep resetting it until it stays reset, then read your value.
I apologize. the question is about the TrgiBoard. Is the message sent from Pushbullet an email to get lost in alll my emails everyday, or a phone text message? I want a phone text message.
Sir I need to do the project of "Real time monitoring of transformer by using IoT"Can you help me? Please sir!! I want to submit project before February 5 ..I don't have enough knowledge please help regarding my project 🙏🙏🙏 I want to monitoring real time values of voltage, current, temperature,oil level and transfer these data by IoT . What can I do for that? Please suggest some helps 🙏
David Jackowski sir I'm also electrical engineering student sir. I want to do the project myself with the help of RUclipsrs .. That's why I'm asking his help..If you have an idea about my question please suggest some ideas..Thank you!!
Can you describe the steps you already took to accomplish your goals? I would start with a simple project rhat just monitors a temperature there are dozens of examples you can find by googling and expand from that.
ddjazz I have lot of confusion on which board can use for this project among (NodeMcu esp8266) or (aurdino uno+ wifi module) Due to this I don't start my project. Just collecting information regarding the project. can you provide links based on my questions...if you can 🙏 Thank you for your reply
Hi Kevin, very cool video, we’re glad you liked the LMT01! Would you be interested in receiving additional EVMs and connecting with one of our temperature sensor experts?
In getTemperature(), you should disable and then re-enable interrupts whenever you read or write the pulsecount variable. It is 16 bits, made up of two bytes, and one or the other of them may get changed by the interrupt handler simultaneously with your main loop access giving confounding results.
Thanks again for the interesting video and clear explanation! I love your trigboard with the ESP8266!
thanks!
7:24 don't drive that pin low, set it to INPUT aka high impedance state. Datasheet specifically warns against setting GPIO pin to LOW if you are using it to power the LMT01, something about reverse-biasing damaging the sensor.
Thank you Kevin. Impressive on the math, and explanations of how it all works. This looks interesting to me from both the temp sensor and the wireless. Great video as usual. Thanks.
Not sure shy the math is 256 * pulses /4096... Left shifts the bits 8 places then right shifts them 12, you could just do pulses / 16 or a right shift of 4...
Excellent video well explained and well documented. Thx. Happy (and creative) new year.
thanks! you too
Thank you for sharing , it shows you,ve did a good amount research and testing on this and i’m sure it will help anyone trying out this sensor. Love your videos
thanks
Nice video ! Looking for more !
I didn't know if this sensor. Like many my goto sensor is the DS18B20, but i may have some use for this one
There's a bug in your getTemperature code - if you fail, you return 1000 without disabling the interrupt handler. I don't know how the Arduino handles that, but I suspect it'll keep running and waste some power. You should disable the interrupt handler a couple of lines further up as soon you stop needing to count pulses.
i really wish there was a closeup of your 8266 with your "hacked-on parts".
Well done with these boards
thank you
Very nice ... your videos are always very clear & helpful !
Happy New Year to You
thanks man!
Thanks for sharing 😀👍 happy new year to you
I feel like the code is needlessly complicated (in the getTemperature function).
Maybe something like this would be simpler (UNTESTED!!!):
#define pulsePin 2
uint32_t last = 0;
uint16_t pulses = 0;
volatile uint16_t last_pulses = 0;
void pulseDetect()
{
uint32_t now = millis();
if (now - last > 50) {
last_pulses = pulses;
pulses = 0;
}
++pulses;
}
// This needs to be called only once!
void startTemperatureConversion() {
attachInterrupt(digitalPinToInterrupt(pulsePin), pulseDetect, FALLING);
}
// Returns temperature from last conversion
float getTemperature() {
return 256.0 * last_pulses / 4096.0 - 50;
}
void setup() {
Serial.begin(115200);
pinMode(pulsePin, INPUT);
startTemperatureConversion();
}
void loop() {
Serial.print(getTemperature());
Serial.print("C");
delay(250);
}
thanks for posting this. The sketch throws an odd error on last line (35). I've looked it up but can't fathom it. Code looks fine to me.
LMT01_test:35: error: expected unqualified-id before '?' token
}?
^
exit status 1
expected unqualified-id before '?' token
Thanks for this, Kevin. A really helpful tutorial. The code works fine on arduino uno and a cheap generic esp8266 (lolin NodeMcu v3) but curiously on my Wemos D1 R2 the serial monitor shows that it keeps on resetting every few seconds. With an error message that is well beyond me (runs out of memory?).
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
The LMT01 is a great little device and has confirmed what I suspected - that my ds3231 tend to read a couple of degrees high.
I've used -273C to indicate errors in temperature sensor readings.
nice
Sad But Mad Lad 0K
Thanks Kevin 👍👍👍
that was awesome. thanks for sharing
thanks!
can you help me with the reference to accurate where you take the measurement and compare it with a calibrated temperature sensor
We have used the DS18B20 on many projects..
What was the Temp range you needed for your project ??
this project didn't need anything special, but the low current and conversion speed was very important. Nothing against the DS18B20, but a while back I bought a bunch of them from Amazon and pretty sure they were counterfeit.... so watch out for that. Again, buying from Digikey and you're good, but I think they are pricier than the LMT01
you are never going to see 1.25V on that 10k resistor, it is shorted by the BE diode
yes! that is true - I definitely could have explained that better. It clamps at ~0.7V, so really should have said the 1.25V will be enough for the BE junction to clamp - thus turn on
Lol, I just went to the comments to find this as expected. :)
I was kind of hoping for more drama and controversy on this thread, with a math dispute.
why you had no luck lately with DS18B20? i'm using it with PIC, AVR, STM32 (5Vcc tolerant) micros.
peasant vasea so many reasons, .1 not .5 degree precision. The ESP has wifi and is fast and is 3.3v.
Well, precision at .5 (both have the same precision) is good enough, you can work with multiple buses of say 8 devices each and doesn't require processing power - I can use the micro for any other task. And of course, I can use it with an STM32 at 3.3 or 5Vcc nucleobytes.blogspot.ro/2017/01/the-wire-has-fever.html. But it is nice to know how to use the TI temperature sensor, without any other reason. Thank you for that!
where can I find a schematic TrigBoard? Very cool project.
I have a question about your use of an NPN transistor, Why? Doesn't an NPN's gate react to changes in the current flow between the Gate-Drain terminals? Not the voltage differential between the two (like a MOSFET).
Also, wouldn't it be better to forego the 10k shunt resistor and just push the current flow through the sensor directly into the NPN transistor? It would introduce a 0.7 volt drop across the gate-drain terminal of the transistor but you can compensate that by pulling the voltage on the Vp pin to 4 volts, or add another diode in series with it and pull it up to 4.5-5 volts.
This might just be a moot point since it obviously works for you, but I was just curious.
NPN transistors don't have gates or drains. Effectively they amplify the E-B current by approx 100. Voltages discussed here are inconsequential, it's more about current flow into the base (technically, out of the base). If you were to forego the base to ground resistor this would send all of the idle current (34uAmps) into the base, possibly biassing the transistor permanently on. The resistor has to be just the right value for the transistor to be biassed off between pulses and biassed on during a pulse. It actually should be closer to 6.8k not 10k.
Very cool. Do you have the schematic posted anywhere?
Does the PUSH notification sent to my smart phone get mixed in with all the emails that i would get if i enabled getting emails on my phone? Thanks. Great design!
it's from a separate app - I use Pushbullet, but could reprogram to use Pushover or even Slack. You an turn off notifications for this though, if you don't want to be bothered.. like if you just want to check in and see if there was any activity
Does your code work with mqtt I would like to get this working with hassio / homeassistant
Why not set a flag in your interrupt code and in your loop, just test that flag. Keep resetting the flag back to zero, yield for 10ms, check the flag, and keep resetting it until it stays reset, then read your value.
I apologize. the question is about the TrgiBoard. Is the message sent from Pushbullet an email to get lost in alll my emails everyday, or a phone text message? I want a phone text message.
SMS text is possible - haven't worked it yet though... coming soon
You could use a service like Twilio to do that.
Is it possible to add this temp sensor to a sonoff?
probably - stick around till the end where I go over the code changes to support the ESP8266
Where did you buy the Salae logic analyser?
Sparkfun - actually use it more than my scope these days.
Kevin Darrah thanks
delete the whole for-loop nonsense for the random timeout and instead do:
delay(random(50,200));
Sir I need to do the project of "Real time monitoring of transformer by using IoT"Can you help me? Please sir!! I want to submit project before February 5 ..I don't have enough knowledge please help regarding my project 🙏🙏🙏
I want to monitoring real time values of voltage, current, temperature,oil level and transfer these data by IoT . What can I do for that? Please suggest some helps 🙏
Hire an electrical engineer.
David Jackowski sir I'm also electrical engineering student sir. I want to do the project myself with the help of RUclipsrs .. That's why I'm asking his help..If you have an idea about my question please suggest some ideas..Thank you!!
Have a look at ruclips.net/video/fwb5YAPzPGk/видео.html
There are many other good videos on RUclips
Do the work yourself and learn!
Can you describe the steps you already took to accomplish your goals? I would start with a simple project rhat just monitors a temperature there are dozens of examples you can find by googling and expand from that.
ddjazz I have lot of confusion on which board can use for this project among (NodeMcu esp8266) or (aurdino uno+ wifi module) Due to this I don't start my project. Just collecting information regarding the project. can you provide links based on my questions...if you can 🙏 Thank you for your reply