Closed pelikhan closed 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
We will have a look into it soon.
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.
We also use ``PA09```
https://github.com/Microsoft/pxt-common-packages/blob/master/libs/core/pins.h#L127
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
:) 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. :)
OK folks... Like all the best bugs, this was actually two bug conspiring.
The main issue was that we were running the ADC with an unscaled 1V reference source, so any voltages above 1V were clipped. Not very useful when the temperature sensor floats at 1.65V. :) I've changes our default ADC mode to run rail to rail 0V to the supply voltage (VCC). This is most useful in the general case anyhow (kids tend to build proportional inputs based on the power supply too) and this is also how we run micro:bit, so has some consistency. When I have a moment I'll also bring up an API so we can configure the ADC input mode dynamically.
There was also a bug in the decay average calculation for non-linear sensors like this, that was giving wildly inaccurate results.
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.
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?