Home > Uncategorized > Thermometer exercise – CUI32/LED Strip – Martin Bach Nielsen

Thermometer exercise – CUI32/LED Strip – Martin Bach Nielsen

For this exercise, I decided to try and incorporate a thermometer with auditive and visual feedback into clothing. The idea being that people suffering from low tolerance to body temperature changes (a condition that I apparently totally made up), would be able to have a type of security everywhere they go.

The most obvious place to put a colored LED strip would be in the sleeves of a shirt, since it fits the length, and this part of your body is always within visual range. I used the CUI32 to control the LED’s and a small piezo speaker. The algorithm on the CUI is fairly simple, which I will try to outline here:

  • If body temperature is below the norm, the LED’s are green and no sound is played
  • If body temperature rises higher than the norm, the LED’s turn red and a warning note is played.
  • For every degree (this incrementation might need to be finer than 1 degree), the temperature rises, the note will also rise in pitch.
  • Warning note and sound will disappear if the temperature drops below normal again.

Below is the BASIC code that the CUI is running and after that, a demonstration video of how the concept prototype turned out

CODE

10 dim i, j
20 dim cmd as byte, rsp[2] as byte
30 dim temp
40 dim freq
50 dim audio as pin rd1 for frequency output
60 dim leds[20] as byte
70 dim latch as pin rg9 for digital output open_drain
80 dim sync as pin rg6 for digital output open_drain
90 let latch = 0, sync = 0
100 while 1 do
110   print temp
120   if temp>=25 then
130     let audio = temp*10
140     for i = 0 to leds#-1
150       let leds[i] = 0x80+0x6
160       sleep 5 ms
170     next
180   else
190     let audio = 0
200     for i = 0 to leds#-1
210       let leds[i] = 0x80+0x3
220     next
230   endif
240   qspi leds
250   let latch = 1, latch = 0
260   let cmd = 0
270   i2c start 0x48
280   i2c write cmd
290   i2c read rsp
300   let temp = rsp[0]
310   i2c stop
320 endwhile
END CODE

DEMO VIDEO


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment