Posted on

A Marvel-ous POTS Alarm

ColorTempIndicatorIn playing with the MakeCode Interface last week to write some Javascript for the Decision Slug, I was excited to see that it also had an interface where code could be written with a block interface, instead of text.

I figured this was potentially helpful for two reasons:  1) it lowered the bar of entry for anyone who wanted to build with hardware, and 2) it was a great code learning exercise because you can build in blocks and then flip over to text.  For this week’s project, I wanted to work just in the Block interface and see if I could do some interesting things, and I wanted to play with the thermistor built into the Adafruit Circuit Playground Express (CPE) board I have been learning with.

For me, the Thermistor was interesting because one of the side impacts of my Ehlers Danlos is a solid case of NeuroCardio Syncope and POTS.

For me, this hits when the temperature rises. I get

iron-man-arc-reactor-shirthot and then I topple over- it is a grand adventure.  I thought.. what if we could have some visual feedback on the ambient temperature but still make it fun.   The neopixels on the CPE pretty instantly make you think of Tony Stark’s arc

20180815_165811.jpgreactor, so that seemed a place to start.


I found art of the arc reactor in the Cricut DesignCenter, cut some metallic red iron – on and prepped a shirt to receive the CPE.   You can see it here, with the CPE in place.  Because I am a human female, I chose to put it on the left side, over my heart rather than dead center  and buried in cleavage.   I measured out the CPE so that I knew the board would fit correctly in the middle of the iron on.  I attached a pin back to the board, so it was removeable ( I will try magents next time) and cut a small hole in the shirt under the board for the wire to the battery pack.  I used velcro to attach the battery pack to the inside of the shirt.

The code ended up being very simple – block image above is the actual code.  Here is the Javascript if you want a Cut/Paste, or you can download the utf file.


 

 

forever(function () {
if (input.temperature(TemperatureUnit.Fahrenheit) >= 80) {
light.showAnimation(light.theaterChaseAnimation, __internal.__timePicker(500))
light.setAll(0xff0000)
} else if (input.temperature(TemperatureUnit.Fahrenheit) <= 45) {
light.showAnimation(light.colorWipeAnimation, __internal.__timePicker(500))
light.setAll(0x0000ff)
} else {
light.setAll(0x00ff00)
}
})

The lights turn red if the temperature is 80 F, Blue if it is below 45F and green the rest of the time.  The picture above where the lights are green is after I had chilled it in a fridge to test the thermistor.   Here is the video of the final project:

As I was experimenting with outputs from the thermistor on the board, I also played with the graph() function, which allows us to map ranges of values to the neopixels built in. The block code for this is below, and you can download the utf file as well.

thermometerblocks.png

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.