0

Circuit Playground Express Thermistor Values
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuit Playground Express Thermistor Values

by phi_fibonacci on Wed Jun 14, 2017 9:19 pm

I'm playing around with the Circuit Playground Express and CircuitPython and having a bunch of fun and so far everything has been straightforward. I do have a question about the thermistor values though. I'm attempting to read the temperature using the driver posted here: https://github.com/adafruit/Adafruit_Ci ... rmistor.py

To instantiate a Thermistor object I need to pass a few arguments relating to the hardware.

def __init__(self, pin, series_resistor, nominal_resistance, nominal_temperature, b_coefficient):

I've poked around for an hour or so looking for the data sheet or some other reference. I know the pin will be board.TEMPERATURE. Does anyone know where I can find the values for series_resistor, nominal_resistance, nominal_temperature, & b_coefficient?

No worries if that's not readily at hand. I know you guys are quite busy working on the production version of the software.

I do have to say that the Circuit Playground Express is amazing and I'm hoping to incorporate it into some of the tech lessons I volunteer teach at my son's elementary school! Keep up the good work!

phi_fibonacci
 
Posts: 15
Joined: Wed Jun 04, 2014 9:15 pm

Re: Circuit Playground Express Thermistor Values

by adafruit_support_mike on Thu Jun 15, 2017 1:54 am

The values are in the file Adafruit_CircuitPlayground.h

It's a 10k thermistor, the nominal temperature is 25C (it almost always is), and the beta coefficient is 3380 (usually somewhere between 3000 and 4000).

adafruit_support_mike
 
Posts: 42178
Joined: Thu Feb 11, 2010 2:51 pm

Re: Circuit Playground Express Thermistor Values

by phi_fibonacci on Thu Jun 15, 2017 12:28 pm

Great! Thank you. (And sorry, I should have thought of checking the CP header file.)

For anyone reading the thread.... this works.

#return the temperature in Celsius
import board
import adafruit_thermistor

therm = adafruit_thermistor.Thermistor(board.TEMPERATURE, 10000, 10000, 25, 3380)
print(therm.temperature)

phi_fibonacci
 
Posts: 15
Joined: Wed Jun 04, 2014 9:15 pm

Re: Circuit Playground Express Thermistor Values

by adafruit_support_mike on Fri Jun 16, 2017 12:21 am

Nah.. that's one of those things that only seems obvious *after* you hear the answer. ;-)

Happy hacking!

adafruit_support_mike
 
Posts: 42178
Joined: Thu Feb 11, 2010 2:51 pm

Re: Circuit Playground Express Thermistor Values

by RonJeffries on Fri Aug 11, 2017 9:15 pm

I've got this little program:

Code: Select all | TOGGLE FULL SIZE
let temp = 0
let tens = 0
let ones = 0
loops.forever(function () {
    light.pixels.setAll(Colors.Black)
    temp = input.temperature(TemperatureUnit.Fahrenheit)
    tens = Math.floor(temp / 10)
    light.pixels.setPixelColor(tens, Colors.Red)
    ones = temp - (tens * 10)
    light.pixels.setPixelColor(ones, Colors.Yellow)
    loops.pause(1000)
})


It lights the tens digit of the temperature red and the units digit yellow, assuming it works, and it seems to in the simulator.

However the temperature seems always to be around 86 to 87 F, which seems high, even when the playground has only been on for moments. I'd kind of expect it to be near room temperature, which is much lower. What am I missing please? Thanks!

RonJeffries
 
Posts: 7
Joined: Thu Aug 03, 2017 2:18 pm

Re: Circuit Playground Express Thermistor Values

by phi_fibonacci on Sat Aug 12, 2017 4:17 pm

Hi Ron,

Just some thoughts.

Might be a good idea to check the output of the sensor. What happens if you write the temperature value to serial? Is the number always 87º? With the code running you could put an ice cube (wrapped in a plastic bag) on the sensor or try to warm it with your fingers. Does the value change?

Also, you could try running the Hello_Temperature example sketch from Arduino IDE and see if you get the same temperature reading.

I did run the code you posted in the simulator and it's working for me too. Alas, I don't have my Express board with me at the moment so I can test on the physical hardware but will give it a shot when I have the opportunity. Normally I code in Python or C so there might be something about the Javascript code that I'm missing.

Dave

phi_fibonacci
 
Posts: 15
Joined: Wed Jun 04, 2014 9:15 pm

Re: Circuit Playground Express Thermistor Values

by RonJeffries on Sat Aug 12, 2017 8:37 pm

Hi Dave,

I've had trouble getting the Arduino IDE to hook up for some reason, moved to the makecode thing for that reason. I'll give it another go.

I don't know how to read out the serial, have you a link I could peek at? But I'm quite sure the reading is only changing between like 86 to 87.

The ice thing sounds fun, I'll give that a go. I tried blowing on it and holding fingers, didn't make much notable diff.

My main concern is it may be biased wrong, I gather there is some biasing value somewhere one can set.

I'll keep playing ... thanks!

RonJeffries
 
Posts: 7
Joined: Thu Aug 03, 2017 2:18 pm

Re: Circuit Playground Express Thermistor Values

by RonJeffries on Sun Aug 13, 2017 12:38 am

Dave,

I've still not been able to get the Arduino app to work with the Circuit Playground Express, and I note that the page selling it says it doesn't work:

Please note: We're still adding full support for all of the cool sensors to MakeCode/CircuitPython/Arduino. We recommend using the CPX with MakeCode only at this time (it does work very well though!) In particular Arduino support is not ready yet, and we're still working on full CircuitPython support.


But you seemed to have it working. I've not been able to find a setup for it for Arduino. Can you point me in the right direction, please? For now I uninstalled Arduino App on my Mac and deleted all the folders.

Thanks!

RonJeffries
 
Posts: 7
Joined: Thu Aug 03, 2017 2:18 pm

Re: Circuit Playground Express Thermistor Values

by phi_fibonacci on Mon Aug 14, 2017 2:59 pm

Hi Ron,

Circuit Playground Express can run the same code as Circuit Playground. : ) Everything is definitely "developer" edition and I've hit a few snags here and there but thankfully I've confirmed the Hello_Temperature sketch works. You can set up the Arduino IDE using the instructions from Adafruit here:

https://learn.adafruit.com/introducing- ... ot-6-x-ide

Once you have everything set up, start Arduino and go to File | Examples | Adafruit Circuit Playground | Hello_Circuit Playground and open Hello_Temperature. Plug your CPX into USB and make sure that you have the proper hardware and port selected (I added a screenshot to show my settings), Once the sketch is open double-click the hardware reset button on the Circuit Playground Board (all the lights should go green). Upload the sketch. You can then open the serial monitor and you should see something like...

tempC: 24.85 tempF: 76.54
tempC: 24.74 tempF: 76.91
tempC: 24.95 tempF: 76.91
tempC: 24.85 tempF: 76.72
...

You can then run the same tests (ice, heat) to make sure your sensor is responding properly.

Let me know if you get stuck. Glad to help a fellow maker out.

Screenshot of settings
Screen Shot 2017-08-14 at 11.49.29 AM.png
Screen Shot 2017-08-14 at 11.49.29 AM.png (199.47 KiB) Viewed 99 times


Dave

phi_fibonacci
 
Posts: 15
Joined: Wed Jun 04, 2014 9:15 pm

Re: Circuit Playground Express Thermistor Values

by RonJeffries on Mon Aug 14, 2017 4:02 pm

Hi Dave, thanks ...

I'm getting this error:

Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.3 (Mac OS X), Board: "Adafruit Circuit Playground Express"

In file included from /Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/utility/CP_Firmata.h:17:0,
                 from /Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/Adafruit_CircuitPlayground.h:23,
                 from /Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/examples/Hello_CircuitPlayground/Hello_Temperature/Hello_Temperature.ino:1:
/Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/utility/CP_Boards.h:708:2: error: #error "Please edit Boards.h with a hardware abstraction for this board"
 #error "Please edit Boards.h with a hardware abstraction for this board"
  ^
exit status 1
Error compiling for board Adafruit Circuit Playground Express.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


I had uninstalled the Arduino IDE and removed its folders (the ones I found anyway) and reinstalled. I can't find a Boards.h file anywhere and don't know what to put in in if I can find it. As you'd expect, I get the same error on other examples.

In case it's important, I have installed:
  • Arduino AVR Boards Built-In by Arduino version 1.6.19
  • Arduino SAMD Boards (32-bits ARM Cortex-m0+) by Arduino version 1.6.15
  • Adafruit AVR Boards by Adafruit version 1.4.9

Ideas welcome. Search on Google didn't find anything useful.

Thanks!

RonJeffries
 
Posts: 7
Joined: Thu Aug 03, 2017 2:18 pm

Re: Circuit Playground Express Thermistor Values

by RonJeffries on Mon Aug 14, 2017 4:19 pm

Further to this, I found something about DLing a GitHub thing: https://forums.adafruit.com/viewtopic.php?f=58&t=120193&p=600314&hilit=hardware+abstraction#p600314

So maybe I'll try that.

Trying to tell it it's a Circuit Playground and at least that compiles but it doesn't find the board. I'm not sure how to tell what address should be used. It's using dev/cu.usbmodem1411

Messages included:
Code: Select all | TOGGLE FULL SIZE
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?


I guess I'll try the GitHub DL and see what happens with that ...

OK, except that I don't see instructions on where to clone that repo or how to install it ... I feel like there should be some basic manual somewhere that I've not read.

Mmm, I love being ignorant. :). Thanks!

RonJeffries
 
Posts: 7
Joined: Thu Aug 03, 2017 2:18 pm

Re: Circuit Playground Express Thermistor Values

by RonJeffries on Mon Aug 14, 2017 4:58 pm

Tried the ice in a bag on the thermistor area. Got discernibly cold, but the values continued to be 87 or 86. Something odd is going on.

Would still like to get Arduino IDE running on it tho. Or should I give up on express and just get playground?

RonJeffries
 
Posts: 7
Joined: Thu Aug 03, 2017 2:18 pm

Re: Circuit Playground Express Thermistor Values

by phi_fibonacci on Mon Aug 14, 2017 5:27 pm

This might be difficult to troubleshoot remotely but I have a CP_Boards.h file in my Arduino/libraries/Adafruit_Circuit_Playground/utility folder. The CP_Boards.h file has the board definition. You could search your computer (with Spotlight) to see if you have the CP_Boards.h file.

In Arduino preferences you can enable verbose output. If you enable that does it give you any additional information?

Also, for reference, I have the 1.6.6 version of the Adafruit Circuit Playground library installed, as well as version Arduino AVR Boards v 1.6.19 and Arduino SAMD Boards (32-bits ARM Cortex-M0+) v 1.6.15 installed.

Hope this info helps with troubleshooting.

phi_fibonacci
 
Posts: 15
Joined: Wed Jun 04, 2014 9:15 pm

Re: Circuit Playground Express Thermistor Values

by phi_fibonacci on Mon Aug 14, 2017 5:34 pm

Hey Ron,

Also see this post. Some other folks were having difficulty and managed to work it out. ENCOURAGEMENT!!

viewtopic.php?f=58&t=121183

I think it's just the developer nature of this board. It's really cool but the owner should be prepared for the occasional head scratcher.

Dave

phi_fibonacci
 
Posts: 15
Joined: Wed Jun 04, 2014 9:15 pm

Re: Circuit Playground Express Thermistor Values

by RonJeffries on Mon Aug 14, 2017 6:32 pm

Well I unzipped some stuff in the /Arduino15 folder and found a CP_Boards.h, and inside it there's this:

Code: Select all | TOGGLE FULL SIZE
// Circuit Playground Express
#elif defined(__SAMD21G18A__)
#define TOTAL_ANALOG_PINS       6
#define TOTAL_PINS              25 // 14 digital + 6 analog + 2 i2c + 3 spi
#define TOTAL_PORTS             3  // set when TOTAL_PINS > num digitial I/O pins
#define VERSION_BLINK_PIN       LED_BUILTIN
//#define PIN_SERIAL1_RX          0 // already defined in zero core variant.h
//#define PIN_SERIAL1_TX          1 // already defined in zero core variant.h
#define IS_PIN_DIGITAL(p)       ((p) >= 0 && (p) <= 19)
#define IS_PIN_ANALOG(p)        ((p) >= 14 && (p) < 14 + TOTAL_ANALOG_PINS)
#define IS_PIN_PWM(p)           digitalPinHasPWM(p)
#define IS_PIN_SERVO(p)         (IS_PIN_DIGITAL(p) && (p) < MAX_SERVOS) // deprecated since v2.4
#define IS_PIN_I2C(p)           ((p) == 20 || (p) == 21) // SDA = 20, SCL = 21
#define IS_PIN_SPI(p)           ((p) == SS || (p) == MOSI || (p) == MISO || (p) == SCK) // SS = A2
#define IS_PIN_SERIAL(p)        ((p) == 0 || (p) == 1)
#define PIN_TO_DIGITAL(p)       (p)
#define PIN_TO_ANALOG(p)        ((p) - 14)
#define PIN_TO_PWM(p)           PIN_TO_DIGITAL(p)


// anything else
#else
#error "Please edit CP_Boards.h with a hardware abstraction for this board"
#endif


The verbose error in compile is:

Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.3 (Mac OS X), Board: "Adafruit Circuit Playground Express"
.. lots deleted ...
I/Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground" "-I/Users/ron/Library/Arduino15/packages/arduino/hardware/samd/1.6.15/libraries/Wire" "-I/Users/ron/Library/Arduino15/packages/arduino/hardware/samd/1.6.15/libraries/SPI" "/var/folders/q5/_ymlkbf55j5_qglm4g536mlm0000gn/T/arduino_build_831625/sketch/Hello_Blink.ino.cpp" -o "/var/folders/q5/_ymlkbf55j5_qglm4g536mlm0000gn/T/arduino_build_831625/preproc/ctags_target_for_gcc_minus_e.cpp"
In file included from /Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/utility/CP_Firmata.h:17:0,
                 from /Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/Adafruit_CircuitPlayground.h:23,
                 from /Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/examples/Hello_CircuitPlayground/Hello_Blink/Hello_Blink.ino:1:
/Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground/utility/CP_Boards.h:708:2: error: #error "Please edit Boards.h with a hardware abstraction for this board"
 #error "Please edit Boards.h with a hardware abstraction for this board"
  ^
Using library Adafruit_CircuitPlayground at version 1.6.4 in folder: /Applications/Arduino.app/Contents/Java/libraries/Adafruit_CircuitPlayground
Using library Wire at version 1.0 in folder: /Users/ron/Library/Arduino15/packages/arduino/hardware/samd/1.6.15/libraries/Wire
Using library SPI at version 1.0 in folder: /Users/ron/Library/Arduino15/packages/arduino/hardware/samd/1.6.15/libraries/SPI
exit status 1
Error compiling for board Adafruit Circuit Playground Express.


I went into the Arduino.app content folders mentioned there, and found another CP_Boards.h, without CPX defined. So I added the CPX definition from the other file right ahead of the error line (708).

That produced a whole raft of other errors, which were assembler errors. So I guess there's some other issues. This is beyond my understanding. I should have read the fine print to the effect that the CPX isn't ready for prime time, I guess.

Maybe I'll try the regular CP or maybe I should just try something else entirely. I'm out of ideas for now and with no real docs or support available, I'm daunted.

Thank you for your attention and excellent ideas!

RonJeffries
 
Posts: 7
Joined: Thu Aug 03, 2017 2:18 pm

Please be positive and constructive with your questions and comments.