TV simulator with blinkstick square

There are some gadgets for sale with leds that simulate
a working TV to pretend someone is home watching TV
to discourage burglars.

I think the Square would be perfect to try this.
Did anyone else try this and has some sample code?

It is a great idea! Already got this idea but haven´t started yet.
Look at this link, it is a DIY FakeTV. Maybe you can get your example out of the Arduino code (in the first post under the building instructions).

will check it out thank you :smiley:

I have a first basic implementation for a fakeTV on a BS Square

# Import blinkstick module Compatible with square
# Displays 8 random colors emulating a television set
import time
from blinkstick import blinkstick
from random import randint,uniform
print "Requires mode 2"

bstick = blinkstick.find_first()
time.sleep(0.2)
print "Current mode={0}".format(bstick.get_mode())
time.sleep(0.2)
print "Start Time : ",time.strftime('%X')

tbl=["#FF0000","#00FF00","#0000FF","#FFFF00","#00FFFF","#FFFFFF","#000000"]

while(1):
    bstick.set_color(0, index=randint(0,7),hex=tbl[randint(0,6)])
    slice=uniform(0,1)
    time.sleep(slice)

This is my experiment (note: I´m not very familiar with python).

#Import blinkstick module
from blinkstick import blinkstick
from random import randint
from time import sleep
#Find the first BlinkStick
bstick = blinkstick.find_first()

try:
    while True:
	red = randint(40,100)
	green = randint(40,100)
	blue = randint(40,100)
	white = randint(40,100)
	delay = randint(1,10)
	bstick.set_color(0, 1, white, white, white) #white
	bstick.set_color(0, 2, red, 0, 0) #red
	bstick.set_color(0, 3, 0, 0, blue) #blue
	bstick.set_color(0, 4, 0, 0, blue) #blue
	bstick.set_color(0, 5, 0, green, 0) #green
	bstick.set_color(0, 6, white, white, white) #white
	sleep(3 / delay)  	
except KeyboardInterrupt:
    pass

Love this idea. Will add it as a pattern to the client application :smiley:

1 Like

If anyone is interested in simulating TV, I just modified the above to include a range of key colours from over the course of an actual film, I guess like how an ambilight system would take average colours, and had a look at creating a selection of delays that might more closely mirror shot changes in a film. Just an idea and might make the light look more realistic from outside a window. I’ve avoided very red / orange colours for obvious reasons…

from time import sleep         
from blinkstick import blinkstick
from random import randint,choice

bstick = blinkstick.find_first()
hextbl=["#996666",
        "#8c7765",
        "#84634c",
        "#b19072",
        "#4e3726",
        "#8b818b",
        "#998d8c",
        "#4f2e21",
        "#4a4040",
        "#564a4b",
        "#8a7e71",
        "#7e6c58",
        "#665039",
        "#e2c79c",
        "#e4c99e",
        "#cdb8a1",
        "#8b786b",
        "#af9465",
        "#555c8e",
        "#4b4e70",
        "#52555f",
        "#bcb29f",
        "#8c5043",
        "#a68874",
        "#6c5e6f",
        "#289f88",
        "#b488a4",
        "#996d6c",
        "#3c7882",
        "#7f8175",
        "#52486e",
        "#cdc1b4",
        "#4a5051",
        "#6c797d"]

while(1):
    bstick.set_color(0, hex=hextbl[randint(0,6)])
    sleep(choice([0, 0.5, 1, 1, 2, 2, 3, 4, 4, 5, 6]))

Note that the above is specifically for blinkstick 1.1, as that’s what I have… To make it work for the Square you would just need to change the set_color call to include the index parameter I think, and set the mode, as per the original code.