I am creating a thermometer app in android when I test on Galaxy S3 it shows that
TYPE_AMBIENT_TEMPERATURE NOT Available
TYPE_TEMPERATURE NOT Available
I want to know that Galaxy S3 has above sensors or not? or How I can solve this issue to get temperature ?
As Yohannes said in the comment you can only calculate standard atmospheric temperature which is not useful to for daily use mostly used in aviation.
Here is the temperature estimation vs barometric height. http://home.anadolu.edu.tr/~mcavcar/common/ISAweb.pdf (page 2).
It seems only way to use an external temperature sensor with bluetooth or similar stuff and require this sensor in your app promotion.
This is really cool one:
http://www.bee-wi.com/bbw200,us,4,BBW200-A1.cfm
An easy way to check if a sensor exists on a specific target phone is to install an app like AndroSensor. This will list all the available sensors.
I doubt if the underlying sensor is missing you'll be able to do much. You can use a weather service to get the current temperature of the device's location but that won't help with a thermometer.
Not sure if this also applies to the Galaxy S3, but you can try to look for sensors with a type value above TYPE_DEVICE_PRIVATE_BASE. Many phones (for example Nexus 5x and Pixel 3) have one or even multiple sensors that exhibit a temperature reading through this and you usually can tell by the name of the sensor (for example "BMI160 Temperature" or "BMP380 Temperature", both on a Pixel 3).
These "vendor defined sensors" are usually from sensors that require a temperature reading for compensation/calibration (BMI160 is the IMU and BMP380 the barometer of the Pixel 3). Especially barometers are very likely to have a temperature channel.
However, there is a good reason that the manufacturer does not offer these temperature readings through the official TYPE_AMBIENT_TEMPERATURE type:
Placing a thermometer inside an enclosed device that heats itself from the inside is not a good method to measure the ambient temperature. Especially if the temperature reading is only meant to compensate temperature drift of the sensor, you will not get anything useful as you mostly measure the temperature of the inside of your phone. Even if a phone officially measures ambient temperature, the results will not be very precise for the same reasons.
Related
I am using a old phone running android 4.0.4 that has the following sensors (printed by using TYPE_ALL in android studio):
Accelerometer Sensor
Magnetic Field Sensor
Proximity Sensor
Orientation Sensor
According to the android documentation on composite sensors this phone should be able to output linear acceleration, however when i ask for it, only null is returned. Other simple sensors such as accelerometer or magnetometer work fine (the basic sensors that are fused to obtain linear acceleration).
The code so far is pretty basic, it's just printing values.
Any idea why this happen? is this standard behavior? Are not all available sensors to a smartphone supposed to be implemented?
The sensors that are specified as hardware/software behave differently according to the sensors available. If https://developer.android.com/guide/topics/sensors/sensors_overview.html#sensors-identify says software, it is the developer responsibility to use the android API to fuse the right basic signals into the composite signal you are looking for.
I have seen this app, but how can I test the driver of the pressure sensor on Android ?
Depending on the resolution of your sensor you might see changes depending on the hight of meters above sea level. Try to put it on your desk and the floor, you should see small changes (or go some floors up in your building).
My experience with pressure sensors is, that they are quite inaccurate to measure the hight of the gadget in a small resolution.
To read the values of your sensor, you can also try to read the values from sysfs, if you have shell access.
So I have been searching for about 3 hours and I have not come up with a good answer/solution.
My Question is: Why am I getting a max acceleration value of only about 34 m/s^2 or about 3.5 Gs (34/9.81).
Is it because hardware restrictions or software restrictions? If it is hardware I know I can't do nothing about it(or at least not easily). If it is software restriction then how can I remove that restriction, is there any way of doing that? Like an API or something?
I would appreciate any help,
Thanks.
Note: I am using a Galaxy S, if that makes a difference. I have also taking a look at this question but that does not helps me: What is android accelerometer min and max range
Take a look at this:
https://electronics.stackexchange.com/questions/11372/samsung-galaxy-s-accelerometer-details
The question includes what appears to be the datasheet for the accelerometer used in the Galaxy S. Apparently there are three possible ranges +/-2g, +/-4g, and +/-8g. I'm not an electronics expert so won't provide any more interpretation than that.
According to developer.android.com, the accelerometer readings are hardware-dependent only:
developer.android.com/guide/topics/sensors/sensors_motion.html
Thus, you'd probably have a better shot at getting an expert answer on the Electrical Engineering stackexchange forum already referenced above: electronics.stackexchange.com.
Good luck with your project!
EDIT: In reference to comments on original question:
I see, because it says on the page you reference -
"My understanding is that the default for Android accelerometers is to
operate in a predefined range of +-2g. How can I programmatically
change this range via a public API? There is a getMaximumRange()
method, but no corresponding setMaximumRange() method."
You are wondering if there is a software-based method for changing the pre-selected range. Again, I would think that Android API docs would mention that. Try asking on electronics.stackexchange.com what "dynamically selectable ranges" are and if they are set by physical hardware switches (or something like that) or if they can be changed programmatically.
SECOND EDIT: I read the page I referred you to more thoroughly, and notice that the original questioner checked the Google API and concluded that it is not possible to change the range through it:
API dosen't allow to change them. I think that i can find this data in the api source, but it is not simple. Now i'll try. – MarcoBiagi Mar 13 '11 at 10:36
Given the max acceleration magnitude you are reading from your Galaxy S is 3.5 g, your Galaxy S accelerometer appears to be setup to have a per axis accelerometer range of +/- 2g (i.e., sqrt(2.0*2.0 + 2.0*2.0 + 2.0*2.0) = 3.5). For reference, here are the per axis accelerometer ranges of your Galaxy S, the Moto G, and the Nexus Android devices:
Galaxy S: +/- 2g
Moto G: +/- 2g
Nexus 1: +/- 2g
Nexus S: +/- 2g
Nexus 4: +/- 4g
Nexus 5: +/- 2g
The per axis accelerometer range is typically not given in a phone's specification sheet. Therefore, if other readers happen to know the max range of their phone's accelerometer, please feel free to add it to this list.
Unfortunately, the accelerometer Sensor.getMaximumRange() API is inconsistent: returns "zero to peak" values on most devices but "peak to peak" on some (e.g., the Moto G) as described in this tracked Android OS issue. One approach to knowing whether a particular device returns Sensor.getMaximumRange() as "zero to peak" or "peak to peak" is to run a free sensor data plot application like ftNote and vigorously shake the device to see where the accelerometer readings clip in the plotted sensor values.
I am a newbie in android.
Just wondered how gyroscope works in android . Is it any hardware that is mounted inside or what exactly it is ?
Also, would like to know if gyroscope and accelerometer sensor are in anyway related ??
Thanks in advance !!
As for your first question, Google "gyro MEMS". For example, you will find An Overview of MEMS Inertial Sensing Technology.
Your second question is answered here.
Gyroscopes is the device which measures the rate(angular speed) change and Accelerometer measure the change in speed in x,y and z directions.
These devices has internal mechanism(made up of capacitors,filters, ADC components and an interface(I2c, spi)) to carry these analog outputs to digital world where they are interpreted by the software(sensor fusion libraries).
In the device (phone or tablet) they may or may not be present as a separate module(chip) but sure they are connected to the MCU of the Phone either directly or Via some target MCU(to which they are connected via interface like I2C or SPI).
No Gyroscopes and Accelerometers are not related in any way but their data when combined together on the basis of certain algorithms(of what sensor fusion libraries are made up of) gives the orientation of the the device and may help to flip the screen owing to their output.
-Rp
I am trying to do an analysis which involves interpreting the results from the various sensors of the Android device. Right now I'm analyzing the magnetic field sensor which should tell me (according to this documentation page) the values of the ambient magnetic field in uT (micro Tesla). Everything is clear so far but on the 2 devices that I tested on (Galaxy S, Galaxy Gio) the results are different. And by different I mean very different.
For example having the same orientation on a table here's what those devices show (just one example):
S2: -2,12, 60 (approximate values on x,y,z accordingly)
Gio: -2,12,-36 (approximate values on x,y,z accordingly)
Even if I switch positions the results are the same. I also read on this page about the intensity of the magnetic field and I believe that I should have around 50uT given my geographical latitude.
Can someone explain what those sensors mean?
Does someone know how to explain this behavior?
Thank you,
Iulian
I just can confirm the problem.
As the author of the steady compass application, I have done many tests of magnetic field sensors with different devices. I have found that one of the devices reported an absolute value of mf about 2x the amount reported by other different device under the same conditions.
I have done a lot of test after phone calibration, and I even put the devices in "airplane mode" trying to minimize electromagnetic interferences coming from the own device. Another comment is that plugging the USB cable on some devices can create important magnetic field variations.
The worst results that I have seen on a given device (after calibration, airplane mode and USB disconnected) is this: Using a compass application with the device on horizontal plane, I take a reading, rotate phone 90 deg in the horizontal plane and take a new compass reading. Both readings differ in more than 15 degrees!
Fortunately, not all devices include such a bad sensors. Best devices have errors of about 2-3 degrees after a 90 degrees rotation.
The conclusion: Unless you are very confident on your magnetic field sensor because you have tested and certified a good behavior, you should give a limited reliability to the readings reported by such sensor.
I have also experienced these problems with the sensors. I believe the phones will give different sensor readings based on the hardware used by the manufacturer.
Try reading the accuracy of the sensor for SENSOR_STATUS_UNRELIABLE. You may have to recalibrate the magnetometer.