Close
0%
0%

TV-B-On(the box)

The thing you need when your TV remote power button fails.

Similar projects worth following
A while back the power button on my remote started to fail. It's become harder to get it to send the IR code to turn on the TV. The contact is likely dirty but didn't want to risk destroying the remote by the extreme violence it that would be required to get the shell open.

Frustrated, I threw together a quick and dirty solution using one of my Atmega328P Target boards, a AA battery pack, an IR LED, a transistor, a push button, an AMS sample box I had laying around, and the requisite wiring and rubber band to hold it all together. A bit on the crude side, but it works!

I'm planning to make a more-refined version.

The current version (the Attiny85 one is a bit more refined than my original, crude thrown together version.  It's designed to send the IR code on power on/reset and then go in a very low power sleep mode until the reset push button switch is pressed again.  An on-board push button switch or an external  push button switch wired to the J3 pin header can be used.  I added jumper J2 to allow the IR LED to be disconnected when uploading code to the Attiny85 to eliminate the risk of damaging the IR LED from being driven at too-high a duty cycle (it's perhaps a bit overkill. I also added an indicator LED to show when it's transmitting (surprisingly useful for debuting.)  I chose a red LED for the indicator due to the relatively low forward voltage it needs.

On the parts list there are some different values listed vs what's shown on the KiCad schematic.  This was due to me making some value adjustments after doing the schematic, and thus the values listed on the parts list are current. NOTE: The R2 and R4 values are based on the board being powered by 2xAA batteries. If you plan to use a higher voltage, the values may need to be increased.

t85irNEC.zip

sample code for transmitting NEC IR codes

x-zip-compressed - 6.80 kB - 07/03/2019 at 17:18

Download

t85irTVonDemo.zip

Code that I used to turn on my Insignia TV, of course not the finished product.

x-zip-compressed - 6.63 kB - 07/02/2019 at 22:24

Download

TV-B-On.zip

TV-B-On KiCad board files

x-zip-compressed - 104.74 kB - 04/03/2019 at 19:14

Download

  • 2 × 0805 10K resistor (R1 and R3)
  • 1 × 0805 150 ohm resistor(R2)
  • 2 × .100" 2 pin pin headers (J1 and J2, if soldering directly to the power header only 1 is needed) Batteries and Battery Accessories / Battery Holders, Snaps and Contacts
  • 1 × 6mm thu-hole 4-pin push button (not needed if using an external push button)
  • 1 × .100" 2x3 pin header or shrouded pin header (for ICSP, optional if not programming the attiny on the board)

View all 19 components

  • The fustrating journey of getting Lego power functions IR to work

    mcu_nerd01/29/2020 at 16:35 0 comments

    I had my Lego train out(that uses Lego power functions) and wanted to try controlling it using my TV-B-On remote.  I did a bit of googling and found the datasheet on the IR protocol.  I whipped up something quick and dirty. It didn't work.  What was it? Was it the fact that I didn't send the code 5 times as per the specification?  Do I actually need to count out 6 IR pulses (the stop/start bit, high and low bits all start with 6 IR pulses, it's just the delay after that differentiates them?) Do I need the send the 16 bits LSB first?

    I first grabbed my Arduino Uno and uploaded the IRdump sketch from IRremote library, but the output wasn't too useful in this instance.  I then pulled out my inexpensive logic analyzer and opened Pulseview(Sigrock.) I then proceeded down the rabbit hole of getting my code to count out exactly 6 IR pulses. Still not working.  I then tried sending the 16 bits LSB first. Nope. I also tried sending the code 5 times as per the specification and still nothing.  While I was at it, I hooked up my signal analyzer through a 3 pin IR receiver and discovered that per an IR burst it just shows up as one burst (the 6 IR pulses just shows up as a single large pulse.)  So it wasn't critical to count out 6 IR pulses.

    I then decided to find an Arduino Lego PF library, make up a sketch of the code that I was trying to send on my TV-B-On on my Uno, hook that up to my logic analyzer and examine the output. I found a working library here.  A ran everything and decoded the bits (the PWM decoder in Pulseview made it easy to tell the 0,1, and stop/start bits apart.)  I shortly discovered the problem. The problem was with the 4th nibble, the LRC data.  The datasheet states that the LRC is calculated by doing an xor operation on the first three numbers and the number 0xf.  I assumed that doing an xor operation on 4 numbers would work just like two numbers, is there is a single one bit in a particular position, the result is one, overwise it's zero like shown below:

    1111
    0100
    1000
    1000
    
    result
    0011

    The bits that I decoded from the known working code however gave me 1011 instead. I looked up the rules for more than 2 numbers and found this from this website "To find each bit of XOR just calculate number of 1’s in the corresponding bits. If it is even or zero then that XOR’ed bit is 0. If it is odd then that XOR’ed bit is 1."  I made the correction to my code and it worked.  I did find out for the mode I was using at the time at least that I don't need to send the code 5 times with the specified delays per the datasheet.   

    Here's a screenshot from pulseview of the generated output and I've also included my code that's still very much a work in progress.

    EDIT: I've also included the capture both at the pin and thru an IR receiver.  I'm not sure how to easily decode the capture thru the IR receiver.

    #include <avr/io.h>
    #include <avr/interrupt.h>
    #define F_CPU 8000000UL //8 MHz
    #include <util/delay.h>
    void start_stop_bit(void);
    void high_bit(void);
    void low_bit(void);
    void send_message(unsigned int mess);
    void send_combopwm(char nib2, char nib3, char nib1);//blue,red,channel
    void send_singleoutput(char mode, char output, char nib3, char nib1);//mode
    //zero for red channel 1 for blue, command,channel
    volatile int count=0;
    
    
    #define PWM_FLT 0x0
    #define PWM_FWD1 0x1
    #define PWM_FWD2 0x2
    #define PWM_FWD3 0x3
    #define PWM_FWD4 0x4
    #define PWM_FWD5 0x5
    #define PWM_FWD6 0x6
    #define PWM_FWD7 0x7
    #define PWM_BRK 0x8
    #define PWM_REV7 0x9
    #define PWM_REV6 0xA
    #define PWM_REV5 0xB
    #define PWM_REV4 0xC
    #define PWM_REV3 0xD
    #define PWM_REV2 0xE
    #define PWM_REV1 0xf
    
    
    int main(void)
    {
    cli();//disable gobal interrupts
    //pwm setup
    DDRB |= 0b00000011; //set pin 6 as output pb1 and xmit led indicator pb0
    //TCCR0A =0b00100011;//seting pwm clear and part of pwm mode
    //TCCR0B =0b0001001;//set prescaler to /1
    OCR0A = 212-1;
    OCR0B=21; //about 10 percent...
    Read more »

  • Well there appears to be a sign that I should get back to work

    mcu_nerd07/02/2019 at 22:22 0 comments

    I went on HaD today only to find an article on my project! Thanks for the article, Lewin Day.  I'm taking it as a sign that I should get back to work on the software side of things.  I've been holding off on the code until I got to a more finished product but I guess it wouldn't hurt to release the code for turning on the Insignia TV.  Be warned that it's far from polished.

    UPDATE: Today (7/3/2019) I just uploaded some code for transmitting NEC IR codes.

  • Been doing a bit more work on a more refined version

    mcu_nerd04/03/2019 at 19:09 0 comments

    I've been doing a bit more on it.  I still got a bit more work on the software side of things, but the hardware side of things didn't come out too bad. I did take some inspiration from the TV-B-Gone.  

    For the MCU I decided to use the Attiny85 (attiny85v-10pu variant as that can work down to 1.8V.)  I've added things such as a small 6 pin ICSP header, an indicator LED, both a PCB mounted push button switch and some pads to use an external push button switch (great if you want to put it in a box), and a space for an external crystal.

    The board can be easily put on top of a 2xAA battery back with some hot glue or mounted inside of something.

View all 3 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates