Add Recording Indicator Light to NextPVR

by bm_00 in Circuits > Electronics

815 Views, 1 Favorites, 0 Comments

Add Recording Indicator Light to NextPVR

viewfile.jpg
viewfile (1).jpg

Many of us have a PVR/DVR/HTPC device for our personal media needs.

They usually tend to work great but are often missing a few elements to make it more like a commercially purchased product. An example of this is a Recording Indicator Light and/or Tuner Indicator Lights. These indicator lights can easily be added to any device running NextPVR as a PVR backend. All that's needed is a Serial COM port or an Arduino board.

Supplies

Required:

  • 1x PC running NextPVR as Backend
  • Various lengths of wire
  • LED Light Bulbs of desired color
  • Various 1KOHM resistors
  • Electrical Tape
  • Windows Notepad
  • (Optional) Soldering Iron
  • (Optional) Various DC Male Headers(Such as found on cordless phone batteries, Dupont headers)

If using RS-232 Serial Port (Max 3 LED):

1 x Rs-232 Serial port or Serial port Header or USB-Serial Adapter

1 x 1 KiloOhm Resistor per LED Desired.

1 x Slick Solutions LED Driver Software https://hveijk.home.xs4all.nl/slicksolutions/ledsd...

If using Arduino: (Max 19 LED):

1 x Arduino family board or clone. This Instructable will be using the Arduino Uno

1 x 220 Ohm or 1 x 1 KiloOhm resistor per LED Desired

1 x Arduino IDE or online IDE Environment

1 x free USB Port.

Determine Whether Your PC Has an Rs-232 Serial Port

3654423-closeup-of-pc-connection-ports-at-the-computer-rear-panel.jpg

If your computer has either an external RS-232 Com Port or an Internal header this is the easiest and cheapest method to add some LED Indicators to your PVR.

To determine if you have a physical port look on the back of your computer for a jack that has 9 pins and looks like the light blue port circled in the picture.

To determine whether your motherboard has an internal RS-232 Serial port header Google your motherboard model number and look at its specifications. Look for something called Serial Port/COM/Serial Header. If you find it then you have one, if not you will need a USB to Serial adapter.

If you have neither available on your computer then you can purchase a USB to Serial adapter from your favorite webstore. They typically can be found for around $10.

Once you have determined which type of Serial Port your have proceed to step 2. If you would rather use an Arduino skip to step 4.

Connect Wires to Serial (RS-232) Port

61mNLwtd08L._AC_SX679_.jpg
81eHa6LtvXL._AC_SL1500_.jpg
download.jpg

There are multiple ways to connect the wires to your physical RS-232 Serial port. The internal header method is preferred as it keeps all components inside of the case minimizing clutter. The options are as follow:


Physical Port

Purchase a Female Serial break out end such as This. Difficulty = Easy

Cut apart and splice an old serial cable from a device such as a modem or This. Difficulty = Medium

Wrap wire around pin and solder/tape in place. Difficulty= Hard

Use headers from old electronics such as Cordless Phone Batteries. Difficulty = Easy


Header

Purchase a Serial Header to Serial Port panel mount/pci expansion bracket such as This and use one of the methods from above. Difficulty= Easy

Purchase a Serial Header to Serial Port panel mount/pci expansion bracket such as This and splice the LED into the wire. Difficulty = Medium

Use headers from old electronics such as Cordless Phone Batteries*. Difficulty = Easy


After it is decided which method to use precede to step 3

Which Pins Do I Use? (Serial Port)

imgbin-rs-232-serial-port-pinout-wiring-diagram-rs-422-cable-harness-JP1EWb1qEttnyqDLPvAe5X4Cx.jpg
IQKwU.jpg
port1.png
s-l300.jpg
port1.png
11111.jpg

A single RS-232 Serial port can control 3 LED lights at a time. However, you can add more serial ports to the computer for more lights if needed.

In order to drive the three LED's the pins DTR, RTS, and RXD along with GND are needed to control the corresponding lights. Below is how to connect these your LED's. (LED 1= DTR, LED2=RTS, LED3 =TXD).


Physical Serial Port:

Consult the diagrams.

Using your desired method of connection(from step 2) to connect the wires to the corresponding pin

The positive leg of the LED(usually longer leg) connects to a 1 KiloOhm resistor(see image) then to the DTV, RTS, or TXD pin. The negative(Shorter leg) connects to the ground or GND.


Header:

Google *motherboard brand* serial port header pinout replacing *motherboard brand* with your brand or consult the users manual from the manufacture for a pinout. Different motherboards use different pin outs. The above diagram is the most common pinout.

Once the pin out is determined, connect the wires to the corresponding pin desired.

The positive leg of the LED(usually longer leg) connects to a 1 KiloOhm resistor(see image) then to the DTV, RTS, or TXD pin. The negative(Shorter leg) connects to the ground or GND.

NextPVR Scripts

In order to make NextPVR turn the LED Lights On & Off we need to create some files. There are 6 files to create. Each has a different purpose but all can control an LED light for a different function.


ParallelProcessing.bat Runs when a recording begins. (Will be used to turn on red LED)

PostProcessing.bat Runs when a recording ends. (Will be used to turn off red LED)

PostCancel.bat Runs when a recording is canceled (Will be used to turn off red LED)

UpdateEPG.bat Runs when EPG(Electronic Programing Guide update begins. (Will be used to turn on blue LED)

PostUpdateEPG.bat Runs when the EPG update completes. (Will be used to turn off blue LED)

Wakeup.bat Runs when PC is waken up from sleep (Not used in this Instructable).


For this Instructable we will be using the 5 scripts indicated above. The process is the exact same for the other scripts.

Configure LEDs Driver Software (Serial Port)

1) Once your LED is wired correctly download and install the Slick Solutions LED Driver software.

2) Once installed navigate to the task bar and look in the lower right hand corner of your screen for a green circle icon. If it is hidden click the upward facing arrow icon near clock and then the green circle should appear.

3) Right click on the green circle and select Configure.

4) Once opened click on the Device tab

5) Under the LED Device drop down menu select the corresponding COM Port to your serial port. It is typical COM 1 for a Physical Port/ Header and something in the COM 1-20 Range for a USB to Serial Adapter .

6) If using a Prolfic USB to Serial device select the Enable Prolfic PL-2303 USB-to-serial resume fix

7) Click on the LEDs tab

8) Click on each event there and select Delete until none are shown

9) Click Add

10) To control the 1st LED connected to the DTR pin select User Event 0 under Event

11) Select LED 1 under LED

12) Select OFF under State

13) Click Ok

14) Repeat steps 9-13 to set up the next two LEDs. Replace User Event 0 with User Event 1 & User Event 2.


For this Instructable User Event 0 will be the Red LED, User Event 1 the Blue LED, & User Event 3 will be the Green(Not used).


User Event 0 is the DTR pin. User Event 1 is the RTS pin. User Event 2 is the TXD pin.

Create a Script(nextPVR)

ParallelProcessing.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

@ echo off
cd /d "C:/Program Files (x86)\LEDSdriver"
LEDSdriver.exe USEREVENT0=1
exit

3) Replace the 0 in USEREVENT0 with the number of the LED you want to control. (What set up in Step 5)

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file ParallelProcessing.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


PostProcessing.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

@ echo off
cd /d "C:/Program Files (x86)\LEDSdriver"
LEDSdriver.exe USEREVENT0=0
exit

3) Replace the 0 in USEREVENT0 with the number of the LED you want to control. (What set up in Step 5)

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file PostProcessing.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


PostCancel.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

@ echo off
cd /d "C:/Program Files (x86)\LEDSdriver"
LEDSdriver.exe USEREVENT0=0
exit

3) Replace the 0 in USEREVENT0 with the number of the LED you want to control. (What set up in Step 5)

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) name the file PostCancel.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


UpdateEPG.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

@ echo off
cd /d "C:/Program Files (x86)\LEDSdriver"
LEDSdriver.exe USEREVENT1=1
exit

3) Replace the 1 in USEREVENT1 with the number of the LED you want to control. (What set up in Step 5)

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file UpdateEPGbat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


PostUpdateEPG.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

@ echo off
cd /d "C:/Program Files (x86)\LEDSdriver"
LEDSdriver.exe USEREVENT1=0
exit

3) Replace the 1 in USEREVENT1 with the number of the LED you want to control. (What set up in Step 5)

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file PostUpdateEPG.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad

Fix the Permissions....

Some issues sometimes arise when trying to use Slick Solutions LED Driver with NextPVR. These issues are fixable but can be frustrating. Here is how to fix them: part 1

1. Navigate into the C:/Users/Public/NPVR/Scripts folder

2. Right click on ParallelProcessing.bat and click Properties

3. Click Security

4. Click Edit

5. Click Add

6. Type in user account name into the Enter the object names to select box

7. Click OK

11. In permissions box click checkbox under Allow to left of Full Control

12. All items in list should become checked under Allow

13. Click Apply

14. Click OK

15. Click OK

16. Repeat same steps for PostPorocessing.bat and PostCancel.bat

17. If the recording LED still does not work continue onto the next step.

Fixing the Permissions Again...

In some instances the instructions from the previous step are not enough to get the recording LED operation. Below are the instructions on how to fix it:


1. Open services.msc by using either the run dialog or typing it into the Windows 10 start menu.

2. Scroll and find the line: NPVR Recording Service in the NAME: column.

3. Right click on the line and select Properties.

4. Click the Log On tab on the top of the new window.

5.Click the radio button next to the heading This Account.

6. Type your computer account username into the This Account box.

7. Type your computer account password into the Password: box.

8. Re-type your computer account password into the Confirm password: box.

9. Click Apply.

10. Click OK.

11. Exit the Services window. 


The recording LED should be fully functional! If not double check all the permissions and make sure you used the same, correct user account name for them all.

Connect Wires to Arduino

61M4O8TcN0L._AC_SL1466_.jpg
45040-dscn0624-400x300.jpg

There are multiple ways to connect wires to the Arduino. The following are the most common ways:

Purchase Arduino Jumper wires such as This and splice them. Difficulty = Easy

Purchase Arduino Terminal block connectors such as This. Difficulty = Easy

Stick wires directly into header or wrap around pin. Difficulty = Easy

Solder wires directly to Arduino. Difficulty = Hard

Which Pins Do I Use?

a000066_featured_4.jpg
Arduino LED wire.JPG

You can use any of the I/O pins available on the Arduino to control your lights. For this Instructable we will be using pins 8, 9, 10. You can swap these values for whatever ones work best for you.


See the above image for the wiring diagram of this Instructable.

Configure Arduino Sketch

arduino.JPG

1) Plug Arduino into computer via usb port

2) Download and install the Arduino IDE from Here. It is avalaible for Windows, Mac, and Linux.

3) Or Launch the Arduino web editor from Here which does not require installation. Requires an Arduino Account

4) Copy and paste the following code into the new blank document. Make sure to clear out all prior text in document.

int serialRead;       // Variable to hold data recieved from serial port
int LED1 = 8;         // LED #1 connected to pin #8
int LED2 = 9;         // LED #2 connected to pin #11
int LED3 =10;         // LED #3 connected to pin #10
int LED1status=0;     // Sets status for LED #1 to 0 or off
int LED2status=0;     // Sets status for LED #2 to 0 or off
int LED3status=0;     // Sets status for LED #3 to 0 or off


void setup() {
pinMode(8, OUTPUT);   // Sets LED #1 @ pin 8 pin as output
pinMode(9, OUTPUT);   // Sets LED #2 @ pin 9 pin as output
pinMode(10, OUTPUT);  // Sets LED #3 @ pin 10 pin as output
Serial.begin(9600); 
}


void loop() {
 if (Serial.available()) {          // Checks if Serial port is avalaible
    serialRead = Serial.read();     // Reads the value recieved on the serial port
     LEDLightControl();             // Calls the method which controls the LEDs
 }
}


void LEDLightControl() {                    // Method to control the LEDs
if (serialRead =='1') {                     // If the charecter 1 is recieved....
       if(LED1status == 0) {                // Checks if light is already ON or OFF
           Serial.println("Tuner 1 ON");
           digitalWrite(LED1, HIGH);        // If 1 is recieved and LED is OFF turns the LED ON
           LED1status=1; }                  // Sets the LED status to 1 or ON
else {
        Serial.println("Tuner 1 OFF");
        digitalWrite(LED1, LOW);            // If the LED status is 1 and 1 is recieved again, time to turn off the LED
        LED1status=0;                       // Changes the LED status back to 0 or off
      }
}
if (serialRead =='2') {                     // If the charecter 2 is recieved....       
       if(LED2status == 0) {                // Checks if light is already ON or OFF
           Serial.println("Tuner 2 ON");
           digitalWrite(LED2, HIGH);        // If 1 is recieved and LED is OFF turns the LED ON
           LED2status=1; }                  // Sets the LED status to 1 or ON
else {
        Serial.println("Tuner 2 OFF");
        digitalWrite(LED2, LOW);            // If the LED status is 1 and 1 is recieved again, time to turn off the LED
        LED2status=0;                       // Changes the LED status back to 0 or off
      }
}
if (serialRead =='3') {                     // If the charecter 3 is recieved....    
       if(LED3status == 0) {                // Checks if light is already ON or OFF 
           Serial.println("Tuner 3 ON");      
           digitalWrite(LED3, HIGH);        // If 1 is recieved and LED is OFF turns the LED ON
           LED3status=1; }                  // Sets the LED status to 1 or ON
else {
        Serial.println("Tuner 3 OFF");    
        digitalWrite(LED3, LOW);            // If the LED status is 1 and 1 is recieved again, time to turn off the LED
        LED3status=0;                       // Changes the LED status back to 0 or off
      }
}
  }
        

5) Replace the number inside the parentheses with the desired pin numbers you choose

6) Click Sketch --> Upload

7) Save file when prompted

8) Wait to upload. Text will say Done Uploading when complete.

9) Your all done with this part! Just remember to keep the Arduino Plugged into the computer

Create a Script(Arduino)

ParallelProcessing.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

mode COM14 BAUD=9600 PARITY=n DATA=8
set /p x="1" <nul >\\.\COM14

3) Replace "1" with the number of the LED you want to control(Remember your Arduino sketch from earlier?). Replace COM14 with the Serial port number of your Arduino.

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file ParallelProcessing.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


PostProcessing.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

mode COM14 BAUD=9600 PARITY=n DATA=8
set /p x="1" <nul >\\.\COM14

3) Replace "1" with the number of the LED you want to control(Remember your Arduino sketch from earlier?). Replace COM14 with the Serial port number of your Arduino.

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file PostProcessing.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


PostCancel.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

mode COM14 BAUD=9600 PARITY=n DATA=8
set /p x="1" <nul >\\.\COM14

3) Replace "1" with the number of the LED you want to control(Remember your Arduino sketch from earlier?). Replace COM14 with the Serial port number of your Arduino.

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file PostCancel.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


UpdateEPG.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

mode COM14 BAUD=9600 PARITY=n DATA=8
set /p x="2" <nul >\\.\COM14

3) Replace "2" with the number of the LED you want to control(Remember your Arduino sketch from earlier?). Replace COM14 with the Serial port number of your Arduino.

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4)Name the file UpdateEPG.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


PostUpdateEPG.bat

1) Open Notepad

2) Copy and Paste the following into the blank document

mode COM14 BAUD=9600 PARITY=n DATA=8
set /p x="2" <nul >\\.\COM14

3) Replace "2" with the number of the LED you want to control(Remember your Arduino sketch from earlier?). Replace COM14 with the Serial port number of your Arduino.

Click File--> Save and navigate to the Navigate to C:/Users/Public/NPVR/Scripts folder

4) Name the file PostUpdateEPG.bat Make sure to remove the .txt extension!!

5) If it prompts about changing extension select Yes/Ok

6) Exit notepad


NOTE: You may have to change permissions! See steps 7 & 8.

Test It Out!

Now go ahead and test out your new recording light! When you begin recording the light should go on. When the recording finishes or is canceled it should go off.


You an test out the LED's manually by running the corresponding .bat file that operates them. Just navigate to the C:/Users/Public/NPVR/Scripts folder and run ParrelProccessing.bat to turn on the first LED, PostProcessing.bat to turn it off, etc.


Now that you know how to connect the LED and code them go ahead and create some scripts for in use tuner indicators or specific tuner recording lights. I already have some of these scripts made. If you need any help leave a comment below.