sensor

How to read & accumulate sensor values at high frequency, without constantly writing to disk (RPi 2 b+, MCP3304, Python)

六眼飞鱼酱① 提交于 2019-12-12 08:54:56
问题 I am attempting to use a Raspberry Pi 2 Model B+ to read analog data on IR intensity from a photodiode via an MCP3304 (5v VDD) at a rate of ~ 10kHz three times in a row (0.1 ms between readings, or a rate of 10 ksps) once every second based on an external stimulus, average those values, then write them to a text file along with the current datetime. The photodiode is simply reading out data to an amplifier, which then feeds into the MCP3304, which, via SPI, feeds data into the RPi. (In

Getting Light Sensor Value

有些话、适合烂在心里 提交于 2019-12-12 07:36:11
问题 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

Android linear acceleration accuracy

倾然丶 夕夏残阳落幕 提交于 2019-12-12 04:07:16
问题 I have an app where I poll the sensors for acceleration data and save the XYZ values to a SQL DB. Codewise it is pretty simple: public void onSensorChanged(SensorEvent event) { sensor = event.sensor; int i = sensor.getType(); if (i == MainActivity.TYPE_ACCELEROMETER) { accelerometerMatrix = event.values; } else if (i == MainActivity.TYPE_GYROSCOPE) { gyroscopeMatrix = event.values; } else if (i == MainActivity.TYPE_GRAVITY) { gravityMatrix = event.values; } else if (i == MainActivity.TYPE

Simultaneous write to multiple files

笑着哭i 提交于 2019-12-12 01:38:09
问题 I'm working on a project involving using a Beaglebone to read from multiple sensors and then pass that data into a text file.I'm monitoring six different muscles, so I have the files correspond to each. Right now, there are 6 sensors feeding into the Beaglebone Black's ADC pins and my code instructs the Beaglebone to create 1 separate file for each pin. Whenever I run the below code, I only get the one file (the first function runs). Previously I had not included the "while True:" statements

Converting angular velocities to orientation Wii Motionplus

瘦欲@ 提交于 2019-12-12 01:27:57
问题 I'm working on the Wii Motionplus and I've extracted the raw values using WiimoteLib Library. However, when I normalize it, I get random values that don't tally with what is actually happening. This is how I'm normalizing: Calibrate the Motionplus (i.e. Find the raw value that corresponds to zero; I do this by holding it stationary for a point of time) For every subsequent raw value read, I subtract the zero value from it to get the "relative" raw value. Then, I scale this value using http:/

Detect mobile device rotation with jQuery

房东的猫 提交于 2019-12-12 01:04:37
问题 I am searching for a jQuery-plugin or Javascript-library that detects the rotation of a device in degrees, not just orientation, using the G-sensor. I know it can be done - check http://wagerfield.github.io/parallax/ - but I haven't managed to find something like this yet. It would be great if it created a kind of global that updates realtime. Thanks! 回答1: you can use jquery mobile lib orientationchange event. $(window).on("orientationchange",function(event){ var x = event.beta, // -180 to

Pass value from Activity to custom View

青春壹個敷衍的年華 提交于 2019-12-11 18:15:53
问题 I need to pass a value from my main Activity to a custom View. In the main activity I have a SensorEventListener so I'm continuosly listening to the light sensor. In the onSensorChanged() method I read the value, and I need to send this value every time it changes to my custom View. I don't know which is the best way to achive this. UPDATE -- Method refered to SensorEventListener on main activity: @Override public void onSensorChanged(SensorEvent event) { float lumnes = event.values[0];

Develop a Windows Location Sensor in C#

浪尽此生 提交于 2019-12-11 17:45:34
问题 Hello fellow developpers, I need to develop an application that would get geographical coordinates from different sources and then update the Windows system location with these. (These sources could be NMEA streams, web service, or even manual inputs). If I understood correctly, based on what I read on the Microsoft website (here and here) and over the Internet, I would need to develop my own Windows sensor driver to update this location of the system. The goal is then to use the very simple

2 sensor readings fusion (Yaw, pitch)

房东的猫 提交于 2019-12-11 17:32:53
问题 Currently I am implementing a head tracking solution that takes yaw and pitch from 2 difference sources; a gyro and a magnetic field sensor. I have both the values passed into my program and now I am attempting to determine the best way to keep the precision of the gyro with the lossless nature of a fixed emitter mf sensor. Currently I am using newYaw = currentGyroYaw + 0.05*(difference between) to slowly drag the gyro to anchor to the mf, but it has some fairly constant movement. It has been

SensorEventListener not unregistering itself

[亡魂溺海] 提交于 2019-12-11 16:35:52
问题 I have been developing an application which needs to perform accelerometer calibration in several steps. What I have done, is create a SensorEventListener that gets a certain amount of readings, and after that amount is reached, I call 'sensorManager().unregisterListener(eventListener)'. However, I think this line is not unregistering the listener, since immediately afterwards, the same line is called, as a result of continuing to run. Question: am I doing things properly this way, or should