sensor

What is the size of CoAP packet?

感情迁移 提交于 2019-12-03 07:41:36
I'm new for this technology, can somebody help me to know about some doubt? Q-1. What is the size of CoAP packet? (I know there is 4 byte fixed header, but what is the maximum size limit including header, option and payload?) Q-2. Is there any concept for Keep Alive like MQTT? (It works on UDP for how much time it keeps open the connection, is there any default time or it keeps open every time when we send packet?) Q-3. Can we use CoAP with TCP? (Main problem with it CoAP is it works on UDP, is there any concept like MQTT QoS? Let's say a sensor publishes some data every one second, if

Getting Light Sensor Value

安稳与你 提交于 2019-12-03 07:39:32
So I'm looking for a way to get the current value of the Light Sensor (in Lux obviously) on a button press. Here is the code I'm using to implement control of the light sensor public class SensorActivity extends Activity implements SensorEventListener { private final SensorManager mSensorManager; private final Sensor mLight; int minLux = 0; int currentLux = 0; int maxLux; public SensorActivity() { mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); } protected void onResume() { super.onResume(); mSensorManager

Reading temperature through DHT11 using Android Things

泄露秘密 提交于 2019-12-03 07:22:51
I am using Raspberry pi3 and DHT11 sensor for temperature monitoring project. I have following pin positions VCC to pin no : 2 Ground to pin no : 6 Output to GPIO : BCM22 i.e pin no 15 Code that I have used: public class WeatherStationActivity extends Activity { private Handler mHandler = new Handler(); private TextView mTxtStatus; private PeripheralManagerService service = new PeripheralManagerService(); private Gpio tempGpio; private int i = 0; int[] dht11_dat = {0, 0, 0, 0, 0}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("Weather

Sensor fusion implemented on Android?

妖精的绣舞 提交于 2019-12-03 06:18:38
问题 I listened to this talk: http://www.youtube.com/watch?v=C7JQ7Rpwn2k which is Invensense Inc prototyping their "Sensor fusion" system, which is where they combine gyro, accelerometer, compass measurements in Android, to get better results. Is this currently implemented in any version of Android? The reason I ask is, part of sensor fusion is the "Gravity" sensor and the "Linear Acceleration" sensor, which ARE implemented in Android ever since API Level 9... makes me think that either 1) sensor

Need to calculate rotation-vector from Sensor.TYPE_ORIENTATION data

二次信任 提交于 2019-12-03 06:02:46
问题 I need to calculate a rotation vector out of the data i get from Sensor.TYPE_ORIENTATION. The sensor data is defined like this: the values have to be recalculated to become a correct 3d position: values[0]: Azimuth, angle between the magnetic north direction and the Y axis, around the Z axis (0 to 359). 0=North, 90=East, 180=South, 270=West values1: Pitch, rotation around X axis (-180 to 180), with positive values when the z-axis moves toward the y-axis. values[2]: Roll, rotation around Y

how to measure HeartBeat using an android device [closed]

浪子不回头ぞ 提交于 2019-12-03 05:48:22
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center . My question is very simple and straight forward. Is there any technique through which i can calculate the heartbeat of a person using android device. I googled it and found some results in which they implemented it using camera. Any other idea or help will be highly appreciated. Thanks. I suppose in order to measure heartbeat you

Display an Android Sensors List

大城市里の小女人 提交于 2019-12-03 05:46:30
问题 I'm trying to display a list of available sensors but it's like there are not! I was thinking that it was because of the emulator, but i tried it on the phone and the result is the same. private SensorManager mSensorManager; TextView mSensorsTot,mSensorAvailables; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the texts fields of the layout and setup to invisible mSensorsTot = (TextView) findViewById(R.id.sensoritot)

How can I rotate display only in landscape mode in android?

大兔子大兔子 提交于 2019-12-03 04:32:48
I want that my View rotates only in landscape mode, clockwise and counterclockwise. I read about the only counterclockwise for android < 2.2 and that's not a problem, my App will be +2.2 for now. I modify my manifest to catch Configuration Changes android:configChanges="keyboardHidden|orientation" I override my activity to catch Configuration Changes @Override public void onConfigurationChanged(Configuration newConfig) { and I know how to catch orientation Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); int rot = display.getRotation(); but... I don't

How to get Android phone orientation matching human orientation?

寵の児 提交于 2019-12-03 04:14:55
问题 I'm making a map app, including the location arrow that shows you which way you're facing, like so: I get the orientation directly from SensorManager.getOrientation() , using the first returned value: azimuth. When the phone is held so that the screen is pointing above the horizon, and in portrait, the arrow works fine. However: When the phone is held so the screen is pointing below the horizon, the arrow points 180 degrees away from the direction the user is facing. When the phone is held so

read temperature from DHT11, using pi4j

爱⌒轻易说出口 提交于 2019-12-03 03:47:28
I'm trying to read temperature data from a DHT11 temperature sensor, using pi4j. I followed the code written in c and python in this site: http://www.uugear.com/portfolio/dht11-h ... or-module/ But it's not working. when I test the instruction 'dht11Pin.getState()' it's always in HIGH state, never changing. Is there anything wrong in my code? Below is my code: import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.pi4j.component.ObserveableComponentBase; import com.pi4j.io.gpio.GpioController; import com.pi4j.io.gpio