Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to throttle updates? #1

Open
joreilly opened this issue Dec 17, 2016 · 6 comments
Open

Need to throttle updates? #1

joreilly opened this issue Dec 17, 2016 · 6 comments
Labels

Comments

@joreilly
Copy link

I'm using this with Raspberry Pi and Rainbow HAT. If I leave it running the temperature shown steadily increases. It might be case that I need to add heatsink to the processor but wondering if perhaps the code should throttle number of updates it does. Not a big issue in the scheme of things (realise this is just a demo).

@joreilly joreilly changed the title Need to throttle updates Need to throttle updates? Dec 17, 2016
@proppy
Copy link
Contributor

proppy commented Dec 18, 2016

@joreilly I think this is coming from the apa102 RGB LED that are just above the temperature sensor.

You could try to dim them off and see if it affect the temperature.

@joreilly
Copy link
Author

I commented out code to set LEDs but still seeing temperature steadily going up. I also tried passing in my longer delay (1000000 microseconds for example) to mSensorManager.registerListener() but it didn't seem to take effect.

@proppy
Copy link
Contributor

proppy commented Jan 9, 2017

Pimoroni recently added the following note to the product page

Temperature readings are affected by heat radiated from your Pi’s CPU and the onboard LEDs; calibration can help to correct temperature readings. bstrobl, on the Raspberry Pi forums, suggests to use the formula: corrected temp. = measured temp. - (CPU temp. - measured temp.) / 2. Using a Mini Black HAT Hack3r can also help.

Maybe we could implement that as an helper function in the Rainbow Hat driver

/cc @gguuss

@Emeritus-DarranKelinske
Copy link

Emeritus-DarranKelinske commented Jun 29, 2017

Here is something to keep the display from flickering with each change. It also converts to Fahrenheit:

private SensorEventListener mTemperatureListener = new SensorEventListener() {
    @Override
    public void onSensorChanged(SensorEvent event) {
        float newTemperature = event.values[0];
        if (Math.abs(newTemperature - mLastTemperature) > 1) {
            mLastTemperature = event.values[0];
            Log.d(TAG, "sensor changed: " + mLastTemperature);
            if (mDisplayMode == DisplayMode.TEMPERATURE) {
                float fahrenheit = 32 + (mLastTemperature * 9 / 5);
                updateDisplay(fahrenheit);
            }
        }
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
        Log.d(TAG, "accuracy changed: " + accuracy);
    }
};

@Emeritus-DarranKelinske

did anyone try the pimoroni suggestion? what were the results?

@msagi
Copy link

msagi commented Mar 6, 2019

Pimoroni recently added the following note to the product page

Temperature readings are affected by heat radiated from your Pi’s CPU and the onboard LEDs; calibration can help to correct temperature readings. bstrobl, on the Raspberry Pi forums, suggests to use the formula: corrected temp. = measured temp. - (CPU temp. - measured temp.) / 2. Using a Mini Black HAT Hack3r can also help.

Maybe we could implement that as an helper function in the Rainbow Hat driver

/cc @gguuss

You cannot read the CPU temp on Android Things but even if you could this would not work. I have tried to move the Rainbow Hat away from the Android Things board via a 20cm long 2x20 GPIO cable. The temp sensor still measures data from another reality, e.g. 30C+ at normal room temp. This is a design flaw in the Rainbow Hat itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants