CJMCU-75 temp module question
Moderator: Benj
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
CJMCU-75 temp module question
Is it possible to use CJMCU-75 temp module with LM75b component?
And if it is:
- how to configure the i2c pads on this module to get the i2c address correct?
And if it is:
- how to configure the i2c pads on this module to get the i2c address correct?
- Attachments
-
- vcjmcu75.jpg (70.12 KiB) Viewed 7482 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: CJMCU-75 temp module question
Hello,
I cannot say 100% as the module has a LM75A instead of the LM75B but it looks like it should be compatible and work correctly.
Currently the address should be:
A0 = VCC
A1 = GND
A2 = GND
Taken from this line of the C code.
I cannot say 100% as the module has a LM75A instead of the LM75B but it looks like it should be compatible and work correctly.
Currently the address should be:
A0 = VCC
A1 = GND
A2 = GND
Taken from this line of the C code.
Inside the Initialise function.FCR_RETVAL = FC_CAL_I2C_Transaction_Init_1(0x49);
We should be able to add a new property to the component to allow the user to control the address.MX_UINT8 FCD_0e021_LM75B_DigitalTemperature1__Initialise()
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: CJMCU-75 temp module question
Re: i2c address and pads
It works.
Re: temperature value
I used the code from the post of medelec35 » Wed Sep 16, 2015 (for DS18B20)
- Read Celsius as Int
- Celsius = Celsius * 49 / 10
- CelsiusString = ToString$ (Celsius)
- Length = Length$ (CelsiusString)
- TempString = Left$ (CelsiusString,Length - 1)
However the readings are wrong.
I cannot figure out how to change the 49 value to use it with CJmcu-75.
Any help?
It works.
Re: temperature value
I used the code from the post of medelec35 » Wed Sep 16, 2015 (for DS18B20)
- Read Celsius as Int
- Celsius = Celsius * 49 / 10
- CelsiusString = ToString$ (Celsius)
- Length = Length$ (CelsiusString)
- TempString = Left$ (CelsiusString,Length - 1)
However the readings are wrong.
I cannot figure out how to change the 49 value to use it with CJmcu-75.
Any help?
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: CJMCU-75 temp module question
Could you try divide by 2? (So celcius = celcius / 2)
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: CJMCU-75 temp module question
RE: Could you try divide by 2?
I did. Does not work. The result is apprx. 300C
---------------------------------------------------------------------
I did some simple calculations.
LM75 raw value was (apprx.) 6240 at room temp 25 deg C.
-----------------
6240 / 25 = 249.6 ->per 1 degree
6240 / 250 = 24.96
-----------------
FC8 calculation-> Celsius = Celsius / 250
----------------
Sensor shows 25 deg C.
??? I am not sure if this is a good way to calculate the value for that temp. module.
I did. Does not work. The result is apprx. 300C
---------------------------------------------------------------------
I did some simple calculations.
LM75 raw value was (apprx.) 6240 at room temp 25 deg C.
-----------------
6240 / 25 = 249.6 ->per 1 degree
6240 / 250 = 24.96
-----------------
FC8 calculation-> Celsius = Celsius / 250
----------------
Sensor shows 25 deg C.
??? I am not sure if this is a good way to calculate the value for that temp. module.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: CJMCU-75 temp module question
Hi
For example, the DS18B20 result is in BCD format so you need to convert the BCD to a temperature reading.
You can * 10 so If Raw = 345 then Temperature = 219, so you just divide by 10 = 21.9
you need to format strings to place d.p in the correct palce.
With LM75 s. Temperature data is represented by a 9-bit, two's complement
word with an LSB (Least Significant Bit) equal to 0.5°C:
So you will need to read two bytes first is MSB and second is LSB
Then I believe temperature (for 0C and above):
For temperatures below 0:
What you could do is if result > 125 then use temperatures below 0 calculation.
Not able to confirm at the time of writing if the above calculations are correct or not?
Why did you use the calculations for a component that produces completely different values for the same temperature?viktor_au wrote: I used the code from the post of medelec35 » Wed Sep 16, 2015 (for DS18B20)
- Read Celsius as Int
- Celsius = Celsius * 49 / 10
- CelsiusString = ToString$ (Celsius)
- Length = Length$ (CelsiusString)
- TempString = Left$ (CelsiusString,Length - 1)
However the readings are wrong.
For example, the DS18B20 result is in BCD format so you need to convert the BCD to a temperature reading.
You can * 10 so
Code: Select all
Temperature = (Raw >> 4) * 10 + (Raw & 15)
you need to format strings to place d.p in the correct palce.
With LM75 s. Temperature data is represented by a 9-bit, two's complement
word with an LSB (Least Significant Bit) equal to 0.5°C:
So you will need to read two bytes first is MSB and second is LSB
Then I believe temperature (for 0C and above):
Code: Select all
Temp = (((MSB << 8) | LSB) >> 7) * 0.5
Code: Select all
Temp =(((((MSB << 8) | LSB) >>7) * 0.5) -256)
Not able to confirm at the time of writing if the above calculations are correct or not?
Martin
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: CJMCU-75 temp module question
Thank you medelec35.
It works.
The temperature is a bit high (one-two degrees).
Should I change 0.5 to tune the temperature?
It works.
The temperature is a bit high (one-two degrees).
Should I change 0.5 to tune the temperature?
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: CJMCU-75 temp module question
Glad it works for you.
That would be normal as if you look at the datasheet
The accuracy is +/- 2C from -25 C to +100C
So you could have an offset.
What normally so is have a small offset e.g Temp = Temp + 1 or Temp = Temp - 1 depending on which way you need to go.
For greater accuracy just use floating point then you can use 1.2 etc. instead of an integer.
Don't forget the the measuring equipment also has an tolerance so that requires taking in to account as well.
That would be normal as if you look at the datasheet
The accuracy is +/- 2C from -25 C to +100C
So you could have an offset.
What normally so is have a small offset e.g Temp = Temp + 1 or Temp = Temp - 1 depending on which way you need to go.
For greater accuracy just use floating point then you can use 1.2 etc. instead of an integer.
Don't forget the the measuring equipment also has an tolerance so that requires taking in to account as well.
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: CJMCU-75 temp module question
Hi,
In my earlier post I stated: Since its two's complement the When reading temperatures below freezing, Temp result will read above 125 as MSB is set to 1 for negative numbers.
So your flowchart is wrong.
In my earlier post I stated:
So you will need a decision branchmedelec35 wrote:What you could do is if result > 125 then use temperatures below 0 calculation.
Code: Select all
If temp > 125 then Temp =(((((MSB << 8) | LSB) >>7) * 0.5) -256)
So your flowchart is wrong.
Martin
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: CJMCU-75 temp module question
By using medelec35 advice I have checked the LM75 datasheet.
The hard to understand part was about the two's complement format.
I need more time with that.
For now I have stopped at this diagram (please correct and add more info).
The hard to understand part was about the two's complement format.
I need more time with that.
For now I have stopped at this diagram (please correct and add more info).
- Attachments
-
- LM75_diagram1.jpg (65.46 KiB) Viewed 7387 times
Last edited by viktor_au on Sat Oct 13, 2018 1:13 am, edited 1 time in total.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: CJMCU-75 temp module question
Hi,
You edited your post as the post I'm referring to where the flowchart is wrong is just above this post.
refer to my post with date and time of:
You edited your post as the post I'm referring to where the flowchart is wrong is just above this post
Code: Select all
Fri Oct 12, 2018 11:14 pm
refer to my post with date and time of:
Code: Select all
Fri Oct 12, 2018 11:07 pm
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: CJMCU-75 temp module question
Hi,
Yes The flowchart now looks correct.
You have got TempInt >125 instead of TempInt <0
It would be better if corrections are on a new post.
Does it work now?
Yes The flowchart now looks correct.
You have got TempInt >125 instead of TempInt <0
It would be better if corrections are on a new post.
Does it work now?
Martin
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: CJMCU-75 temp module question
Thanks Martin.
All good.
I am not able to check the minus temperature (for now, will do it later), but the code works OK.
Appreciate your help.
P.S. I work with the DHT22 module now. A few days ago Benj has updated this component and I am able (now) to read the temp/hum without any problems. Well.. Only during the init stage the DHT22 shows 0 for success and 1 for error as well... Not sure why.
But this is another story...
Thanks again.
All good.
I am not able to check the minus temperature (for now, will do it later), but the code works OK.
Appreciate your help.
P.S. I work with the DHT22 module now. A few days ago Benj has updated this component and I am able (now) to read the temp/hum without any problems. Well.. Only during the init stage the DHT22 shows 0 for success and 1 for error as well... Not sure why.
But this is another story...
Thanks again.