lancaster-university / codal-circuit-playground

MIT License
4 stars 6 forks source link

issue with temperature readings #2

Closed pelikhan closed 7 years ago

pelikhan commented 7 years ago

https://github.com/lancaster-university/codal-circuit-playground/blob/c885ac2d0e7f09a957e647f4b8cd22149cf1a6a3/model/CircuitPlaygroundIO.cpp#L58

Does this SPEAKER value sound right here? We are having issues getting proper temp readings from the CPX. Is this something tested?

samelhusseini commented 7 years ago

Can someone that knows a little more about what these values mean, confirm that we've got the right configuration on the pin. This is the temperature sensor used on the board: http://www.murata.com/en-us/products/productdetail?partno=NCP15XH103F03RC

https://github.com/Microsoft/pxt-common-packages/blob/master/libs/thermometer/temperature.cpp#L27

jamesadevine commented 7 years ago

We will have a look into it soon.

jamesadevine commented 7 years ago

According to the pin mappings I did originally, this is wrong...

SOUND_SENSE = PA08,
TEMP_SENSE = PA09,
LIS_IRQ = PA10,
LIGHT = PA11,
MISO = PA12,

I'll have a quick chat to Joe, it could simply just be a typo, or it could be that something changed between board revisions.

pelikhan commented 7 years ago

We also use ``PA09```

https://github.com/Microsoft/pxt-common-packages/blob/master/libs/core/pins.h#L127

ladyada commented 7 years ago

SOUND_SENSE = PA08 - note analog mic does not exist anymore, use PDM :) TEMP_SENSE = PA09 - correct LIS_IRQ = PA10 - should be PA13 LIGHT = PA11 - correct MISO = PA12 - ? PA12 is the IR input pin

finneyj commented 7 years ago

:) indeed - thansk @ladyada . Looks like some out of date configs still in there (prob. from rev B). I'll patch those.

Something else afoot here though. Just testing with my trusty multimeter on various pins, and I think the analog read operation we're inheriting from mbed-classic is clipping. Pushing an analog pin HI or LO reads as rail to rail on analog, but a 50:50 potential divider reading 1.63v on a DMM is also clipping hi on an analog read... Probably has an incorrect gain setting or similar...

I'll investigate when I get my kids in bed. ;)

p.s. The signed CPlay you sent me finally made its way across the Atlantic @ladyada! Many thanks for that - most kind. :)

finneyj commented 7 years ago

OK folks... Like all the best bugs, this was actually two bug conspiring.

I've also updated the pin mappings we're using in the C++ reference model to match rev g.

Anyone testing will need to update to head revision of codal-circuit-playground, codal-core and our mbed-classic#new-build-system repos to get the changes.

I'll close this off now, but if anyone sees any issues with any of the above approaches, let me know.