Auto Turn Off Your TV - Hackster.io

Auto Turn Off Your TV – Hackster.io

I often get tired when I sit down to watch TV at the end of the day, so I want the experience to be as easy as possible. One minor improvement I’ve dreamed of is getting the TV’s notification when I wake up so it can pause the current show, then resume it when I return. I decided to prototype this using one of my person sensorsalong with A.J Quick circuit playground board from Adafruit. This instructable will show you how to build one too, no soldering required!

The video above shows how the final device works. When no face is detected for five seconds, an infrared signal is sent to the TV to simulate pressing the pause button on the remote control. When a face is detected again for at least 1 second, a play token is sent. Granted, it’s still a prototype, with a lot of rough edges to smooth out, but I had fun playing with it myself and showing it to other people. I’d like to see a commercial product like this, so I hope it sparks someone’s imagination.

equipment

You need to make sure you get the “Express” version of the Circuit Playground board, as this is the only version that has a built-in IR transceiver. You could probably adapt this to other boards with external IR modules, but you’ll need to know how to interact with it with the Arduino IDE. a little more expensive Base kit It includes a CPX board, as well as some nice extras like a battery pack and cable. I like too The official transparent caseYou can see it in photos and videos.

to gather

Connecting the sensor requires connecting a cable that has a Qwiic/Stemma QT connector on one end, and four alligator clips on the other. These segments connect VDD, GND, SDA, and SCL from the sensor to the board. First connect the connector to the sensor. This should only be attached in one direction, with the exposed metal facing the plate.

The alligator clips are then attached to the Circuit Playground’s four tabs. If the side with the buttons and components is facing you, you would start at the 11 o’clock position with GND (black), counterclockwise with SDC (yellow), then SDA (blue), and finally 3.3V (red). Below is the wiring diagram:

Once the Circuit Playground is connected to the USB port, you should see the green light on the person sensor glow when the face is visible.

mounting

The person sensor should be mounted on the back of the panel, on the side opposite the buttons. This will look at you on the couch, while the infrared transmitter on the other side will send commands to the TV to turn it on or off depending on whether you are nearby. I bought container And I used a Blu Tack to mount the sensor in the correct position, but I’m sure those more skilled can come up with a more elegant solution.

Arduino setup

We will be using the Arduino IDE to build and flash our software. Download the version for the operating system to get started. there The official Adafruit guide To install you need Circuit Playground Express, however dont followHe. She! It uses the Arduino limited edition of the board package, which doesn’t support a lot of CPX features. Instead, you will need to install the Adafruit version of the board package.

To do this, you will first need to add https://adafruit.github.io/arduino-board-index/package_adafruit_index.json to me Additional Boards Manager URLs in the Arduino Preferences window.

Once this is set, go to Tools->Board->Boards Manager... In the Arduino IDE and search for “Adafruit SAMD”. You should see a package called “Adafruit SAMD Boards” which includes Circuit Playground Express in its description.

Make sure to install adafruit version, not the default Arduino package, since only Adafruit’s board library has full support for all CPX peripherals.

Next, we’ll need to install a library to store information about any IR codes registered even when the board is turned off. go to the Tools->Manage Libraries And add “FlashStorage” to the Arduino libraries.

code flashing

If you are used to git You can download the code in this repository from github.com/usefulsensors/person_sensor_tv_remote But don’t worry if it isn’t, you can get it All as a ZIP file very. Once you have the code on your local machine, open the person_sensor_tv_remote.ino File in Arduino IDE. Ensure that the Circuit Playground Express board is connected to your computer via USB, and that you have selected the correct port from the Tools->Port menu, and you have selected “Adafruit Circuit Playground Express” as the board. Once you’ve finished setting up, hit the upload button (right-pointing arrow in the top left of the IDE) to compile and flash the program.

Board creation

The system is designed to send the same infrared code as the power button when it detects someone nearby, and the infrared code to pause when no one appears to be around. Since different TVs use different codes, you will probably need to tell the device the codes for your model. The graphic defaults to icons that work with most Samsung TVs when you first flash the panel, but you can register new ones from your remote.

board test

Before trying it on TV, it’s best to make sure that the basic functions work. You do this by pointing the person sensor at your face, and making sure the green light on the board is lit. Then point the sensor away from you or cover the lens, watch the green light go out, and wait a few seconds. You should hear the speaker on the board say “Pause,” though they are very quiet and can be hard to understand. If you then point the sensor at your face for a second or so, you should hear “turn on.” This shows that the instrument pauses properly when no one is around, and plays when they return.

Register your remote

If you are not using a Samsung TV, you will need to register the correct IR codes for your brand from your existing remote control. These days a lot of high-end models are moving towards Bluetooth connections, which I’ll cover in a future project, but at least you still understand infrared codes. If you find that you cannot register, it is possible to update the chart to the correct symbols by default, if you can find information about them online. The search can be confusing, since the codes are not the same as those used to program universal remotes.

If you have an infrared remote control, you can start by pressing the left button on the board. You have to “record, hit play,” and see the board LEDs light up in a counterclockwise pattern. Point the remote control at the front of the board and press the power button. Once the board recognizes it, the speaker will say “Press pause,” and the LEDs will rotate clockwise. When this symbol is recognized, the board will say “Done”. These values ​​will be saved in flash, so if you turn the board off and back on, it will be remembered. It resets to default values ​​if you flash it again though.

Auto turn off your TV

Now that everything is set up you can sit back, relax and let the board take over your TV! The person sensor has a useful range of about two meters, or six feet, so make sure the sensor is facing you somewhere like a coffee table, with the front of the panel (which has an infrared transceiver) pointed at the screen. You should see the green LED on the sensor light up when it sees you, and if no face has been seen for five seconds, it will send an IR code to pause. Then, when a face is seen continuously for at least a second, the trigger code will be sent. The idea is that it should stop when you get off the couch, and play again once you’ve settled down again.

This is definitely still a prototype although both the sensor and this sketch have a lot going for it, so you might want to tweak the code to make it a better fit for you. If you look at the graphic, you can change the constants like pauseDelaySeconds And the playDelaySeconds To adjust the timing, or get more advanced by changing the logic about what it takes to trigger and pause play.

You can also learn more information about how the people sensor works Developer guideincluding facial recognition features, which may be useful for improving how this project works.

#Auto #Turn #Hacksterio

Leave a Comment

Your email address will not be published. Required fields are marked *