pibeacon: 20 - NEO pixel thermometer

Posted on
Mon Oct 07, 2019 5:17 pm
kw123 offline
User avatar
Posts: 7036
Joined: May 12, 2013
Location: Dallas, TX

pibeacon: 20 - NEO pixel thermometer

1. create an output device neopixel with n LEDs (here 150)
Screen Shot 2019-10-07 at 18.45.54.png
Screen Shot 2019-10-07 at 18.45.54.png (73.4 KiB) Viewed 938 times


2. create an action that is triggered when temperature changes:
Code: Select all
##=======use this as a python script in an action group action :=====
import json

il = float(indigo.devices[393522233].states["illuminance"])
lightFactor = max( min(il/ 100., 1), 2./255. )

tO = (float(indigo.devices[1336842918].states["Temperature"]))

tRange = [-20,50] # -20C .. +50C

#  tscale is 0..140
termLen = 140

tOScale  = int( termLen*(tO -tRange[0])  /float(tRange[1]  -tRange[0])  )

# the elements in thermometer are:[ [col=0, led1, R G,B],  [col=0, led2, R,G,B],  [col=0, led3, R,G,B]...]
thermometer = []
for ii in range(termLen+3):# 142 pixels,  tscale is 0..140
   thermometer.append([0,ii+1,0,0,0])
   if tOScale > ii:
      thermometer[ii][2] = int(2)
   if tOScale == ii:
      thermometer[ii][2] = int(255* lightFactor)
   if ii%10 == 0:
      thermometer[ii][2] = 0
      thermometer[ii][3] = 0
      thermometer[ii][4] = 2
   if ii%20 == 0:
      thermometer[ii][0] = 0
      thermometer[ii][3] = 5
      thermometer[ii][4] = 5

plug = indigo.server.getPlugin("com.karlwachs.piBeacon")
plug.executeAction("Neopixel" , props ={
     "outputDev":"246403135"
    ,"device":"OUTPUT-neopixel"
    ,"restoreAfterBoot":"false"
    ,"intensity":100
    ,"repeat":1
    ,"resetInitial":"[0, 0, 0]"
    ,"command":json.dumps([     { "type": "points"
   , "position": thermometer
    }])
    })

3. connect the neopixel strip through a level shifter to pin# 18=digital PWN out, +5V GND -- and on the neopixel side GND,+5V, Di
The neo pixel strip is mounted on a plane long piece of wood
Screen Shot 2019-10-07 at 18.15.53.png
Screen Shot 2019-10-07 at 18.15.53.png (152.79 KiB) Viewed 950 times


Karl

Posted on
Thu Jan 16, 2020 10:03 pm
kw123 offline
User avatar
Posts: 7036
Joined: May 12, 2013
Location: Dallas, TX

Re: pibeacon: 20 - NEO pixel thermometer

The electronics in the back:
Screen Shot 2020-01-16 at 21.54.21.png
Screen Shot 2020-01-16 at 21.54.21.png (164.54 KiB) Viewed 471 times

from top to bottom:
1. light sensor (top) connected via i2c, the light sensor regulates the LED power. It "looks" through a small hole in the wood panel to the front
2. pi zero W
3.Signal level shifter 3.3V --> 5V. You only need to connect pi to (+5v, ground, signal) , and (+5V ground sig-out through 470Ohm resistor) to Neopixel chain
4. standard USB power supply


Mounted the whole panel (> 1m long) on the wall in the kitchen "outside temperature in ºC":
Screen Shot 2020-01-16 at 22.00.54.png
Screen Shot 2020-01-16 at 22.00.54.png (138.82 KiB) Viewed 471 times


Karl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron