Video How To - Phoney TV
-
@Dave-Dan @petewill I use LMS as well, but mainly with the "official" hardware players. Still a large used market for those (search ebay for squeezebox). I have first gen Slim Devices players all the way to the latest ones released by Logitech. There's a great plugin for HomeSeer as well. We use them for automated alarm clocks (Squeezebox Radio's mainly), voice announcements, status displays and music of course :D.
Cheers
Al -
@petewill Have you, or anyone else for that matter, looked at upgrading this code to compile under MySensors ver 2.0? I've setup multiple versions of the library so I can get it compiled under 1.4, but would like to move all my sensors to 2.0, if possible. If not, I'll look at changing the code after I finish with the hardware build.
Thanks for your work on this, and thanks to @BulldogLowell for the great project, been wanting to do a faketv type setup for some time now.
P.S.) your fritzing layout is missing the ground connection on the Pro Mini.
Chief P
-
@petewill Have you, or anyone else for that matter, looked at upgrading this code to compile under MySensors ver 2.0? I've setup multiple versions of the library so I can get it compiled under 1.4, but would like to move all my sensors to 2.0, if possible. If not, I'll look at changing the code after I finish with the hardware build.
Thanks for your work on this, and thanks to @BulldogLowell for the great project, been wanting to do a faketv type setup for some time now.
P.S.) your fritzing layout is missing the ground connection on the Pro Mini.
Chief P
@chief I haven't upgraded to 2.0 yet. It's on the list but it will take me quite a while (I have a lot of sensors) so I need a good chunk of time to do it. I'll update the code then but if you get to it first please do share it :)
And, thanks for pointing out the missing ground! Good catch. I'll fix that now. -
@jimbolaya Something like this should work: http://www.digikey.com/products/en?keywords=IPP055N03LGXKSA1-ND.
-
Thx for the reply @Sparkman. The link you included brings me to a page that lists all their products. Could you please check and repost?
@jimbolaya Sorry, link is now fixed.
-
I had to update my firmware for MySensors version 2.0.0, I thought I would post it in case anyone comes across this post...
/* * PhoneyTV v3.2.0 * * This Sketch illuminates 6 sets of LED's in a random fashion as to mimic the * light eminating from a television. It is intended to make an empty home, * or an empty section of a home, appear to be occupied by someone watching * TV. As an alternative to a real television left on, this uses less than 1% * of the electrical energy. * * With the use of the MySensors plugin and gateway, PhoneyTV is intended to * be used with a controller (e.g. Vera or Raspberry PI). * * Sketch does not use any delays to create the random blinking as a way to * assure that communication back to the gateway is as unaffected as possible. * * You can adjust the length of the blink interval and its "twitchyness" by * modifying the random number generators, if you prefer more/less 'motion' in * in your unit. The lines are highlighted in the code, play around to create the * random effect you like. * * Sketch takes advantage of available PWM on pins 3, 5 & 6 using the white/blue LEDs * to allow fluctuations in the intensity of the light, enhancing the PhoneyTV's * realistic light effects. * * Created 12-APR-2014 * Free for distrubution * Credit should be given to MySensors.org for their base code for relay control * and for the radio configuration. Thanks Guys. * * 29-May-2014 * Version 2: Simplified the code, removing all redundant relay setup from original * code. Added an on/off momentary pushputton option to be set up on pin 2. Inproved * the dark dips for longer duration (can be configured) at intervals. * * 6-Jun-2015 * Version 3.1 * Updated for MySensors V1.4.1 * Contributed by Jim (BulldogLowell@gmail.com) Inspired by Josh >> Deltanu1142@gmail.com * * Version 3.2.0 updated for MySensors 2.0.0 by Jim (BulldogLowell@gmail.com) * How to video: https://youtu.be/p37qnl8Kjfc */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node //#define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #include <Bounce2.h> #define RADIO_RESET_DELAY_TIME 20 #define DEBUG_ON #ifdef DEBUG_ON #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #define SERIAL_START(x) Serial.begin(x) #else #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define SERIAL_START(x) #endif const byte buttonPin = 2; const byte ledPin3 = 3; // White using PWM const byte ledPin4 = 4; // Red const byte ledPin5 = 5; // Blue using PWM const byte ledPin6 = 6; // Blue using PWM const byte ledPin7 = 7; // Green const byte ledPin8 = 8; // White (No PWM) Bounce debouncer = Bounce(); byte oldValue = 0; boolean state = false; boolean oldState = false; int dipInterval = 10; unsigned int darkTime = 250; unsigned long currentDipTime; unsigned long dipStartTime; unsigned long currentMillis; byte ledState = LOW; unsigned long previousMillis = 0UL; byte led = 5; unsigned long interval = 2000UL; unsigned int twitch = 50; int dipCount = 0; int analogLevel = 100; boolean timeToDip = false; boolean gotAck=false; MyMessage msg(1,V_LIGHT); void before() { state = loadState(1)? 1 : 0; } void setup() { SERIAL_START(115200); pinMode(ledPin3, OUTPUT); pinMode(ledPin4, OUTPUT); pinMode(ledPin5, OUTPUT); pinMode(ledPin6, OUTPUT); pinMode(ledPin7, OUTPUT); pinMode(ledPin8, OUTPUT); pinMode(buttonPin, INPUT_PULLUP); // debouncer.attach(buttonPin); debouncer.interval(50); // DEBUG_PRINTLN(F("Sensor Presentation Complete")); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("PhoneyTV", "1.5"); present(1, S_LIGHT); } void loop() { debouncer.update(); byte value = debouncer.read(); if (value != oldValue && value == 0) { state = !state; send(msg.set(state ? 1 : 0)); // while(!gotAck) // { // gw.send(msg.set(state), true); // gw.wait(RADIO_RESET_DELAY_TIME); // } // gotAck = false; DEBUG_PRINT(F("State Changed to:")); DEBUG_PRINTLN(state? F("PhoneyTV ON") : F("PhoneyTV OFF")); } oldValue = value; if (state) { if (timeToDip == false) { currentMillis = millis(); if (currentMillis - previousMillis > interval) { previousMillis = currentMillis; interval = random(750, 4001); //Adjusts the interval for more/less frequent random light changes twitch = random(40, 100); // Twitch provides motion effect but can be a bit much if too high dipCount++; } if (currentMillis - previousMillis < twitch) { led = random(3, 9); analogLevel = random(50, 255); // set the range of the 3 pwm leds ledState = !ledState; switch (led) //for the three PWM pins { case 3: pwmWrite(); break; case 5: pwmWrite(); break; case 6: pwmWrite(); break; default: digitalWrite(led, ledState); } if (dipCount > dipInterval) { timeToDip = true; dipCount = 0; dipStartTime = millis(); darkTime = random(50, 150); dipInterval = random(5, 250); // cycles of flicker } } } else { DEBUG_PRINTLN(F("Dip Time")); currentDipTime = millis(); if (currentDipTime - dipStartTime < darkTime) { for (int i = 3; i < 9; i++) { digitalWrite(i, LOW); } } else { timeToDip = false; } } } else { if (state != oldState) { for (int i = 3; i < 9; i++) { digitalWrite(i, LOW); } } } oldState = state; } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { // Change relay state state = message.getBool()? 1 : 0; // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } } void pwmWrite() { if (ledState == HIGH) { analogWrite(led, analogLevel); } else { digitalWrite(led, LOW); } }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login