Showing posts with label tv. Show all posts
Showing posts with label tv. Show all posts

Wednesday 4 January 2017

Archer and "The Last Leg"-inspired 'Phrasing' button


The inspiration

 

In some ways my workplace is very much like this - anything that could be misconstrued as an innuendo, even remotely, will inevitably have people calling out "hey, phrasing!", "That's what she said..." etc, etc.

Combining that with this "Bullshit button" from The Last Leg:


.. and I had an idea.


To cap it all off, at work we were having a clear out of some cupboards, and I found this:


It plays a dog-barking noise when pressed. I'm told it was used for some kind of team building thing long before I joined the company. Weird.
By this point it must be pretty obvious where this project is headed...

The teardown
First things first, see how much space in the button there is to work with, and what parts can be reused.

The single PCB contains a controller under a blob of epoxy, as was expected, so I'll need to replace that. However, the same PCB contains the actual button, so it'll need to stay in place. To allow that I just cut the traces connecting the button to the PCB, and scraped off some of the solder mask in order to provide connection points for my replacement controller.


The electronics

As this was intended to be a quick and easy project, I had to make do with what I could find in my electronics junk box. I couldn't use the same MP3 trick that I used in the Swear Jar project, as what I had available was too large for the buttons' case.

Whichever controller I used needed to have enough memory to store the audio data, which ruled out a lot of micros, so I ended up recycling an old arduino micro (ATMega328)

To make room for the arduino, the battery compartment had to be removed - I would instead use coin cell batteries. This would still work, but come at the cost of a reduced battery life.

The audio

To capture the original audio, I used the same technique I covered here to create a WAV file. After using Audacity to crop and edit down the relevant clip (Archer saying "Uh, Phrasing"), I used the EncodeAudio application from HiLoTech to turn it into a header file (sounddata.h in the code below)


The software
The code used on the arduino was based around the PCMAudio example, but I needed to modify it to incorporate some power saving - to account for the reduced capacity of the coin cell batteries. Code listed below:

#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/sleep.h>
#define SAMPLE_RATE 8000

#include "sounddata.h"

int ledPin = 13;
int speakerPin = 11;
volatile uint16_t sample;
byte lastSample;


void stopPlayback() {
    TIMSK1 &= ~_BV(OCIE1A);
    TCCR1B &= ~_BV(CS10);
    TCCR2B &= ~_BV(CS10);
    digitalWrite(speakerPin, LOW);
}

ISR(TIMER1_COMPA_vect) {
    if (sample >= sounddata_length) {
        if (sample == sounddata_length + lastSample) {
            stopPlayback();
        }
        else {
            if(speakerPin==11){
                OCR2A = sounddata_length + lastSample - sample;
            } else {
                OCR2B = sounddata_length + lastSample - sample;
            }
        }
    }
    else {
        if(speakerPin==11){
            OCR2A = pgm_read_byte(&sounddata_data[sample]);
        } else {
            OCR2B = pgm_read_byte(&sounddata_data[sample]);
        }
    }
    ++sample;
}

void startPlayback() {
    pinMode(speakerPin, OUTPUT);

    ASSR &= ~(_BV(EXCLK) | _BV(AS2));

    TCCR2A |= _BV(WGM21) | _BV(WGM20);
    TCCR2B &= ~_BV(WGM22);

    if(speakerPin==11){
        TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0);
        TCCR2A &= ~(_BV(COM2B1) | _BV(COM2B0));
        TCCR2B = (TCCR2B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);

        OCR2A = pgm_read_byte(&sounddata_data[0]);
    } else {
        TCCR2A = (TCCR2A | _BV(COM2B1)) & ~_BV(COM2B0);
        TCCR2A &= ~(_BV(COM2A1) | _BV(COM2A0));
        TCCR2B = (TCCR2B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);

        OCR2B = pgm_read_byte(&sounddata_data[0]);
    }

    cli();

    TCCR1B = (TCCR1B & ~_BV(WGM13)) | _BV(WGM12);
    TCCR1A = TCCR1A & ~(_BV(WGM11) | _BV(WGM10));

    TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);

    OCR1A = F_CPU / SAMPLE_RATE;

    TIMSK1 |= _BV(OCIE1A);

    lastSample = pgm_read_byte(&sounddata_data[sounddata_length-1]);
    sample = 0;
    sei();
}

int wakePin = 2;

void setup(){
    pinMode(wakePin, INPUT);
    pinMode(ledPin, OUTPUT);
    
    
    attachInterrupt(0, wakeUpNow, LOW);
    
    startPlayback();
}

void loop(){}
void wakeUpNow(){
    startPlayback();
    sleepNow();
}

void sleepNow() { 
    set_sleep_mode(SLEEP_MODE_PWR_DOWN); 
 
    sleep_enable();    
    attachInterrupt(0,wakeUpNow, LOW); 
    sleep_mode();            
    sleep_disable();
    detachInterrupt(0);
} 

The finish
Some finishing touches, and it's done!

Friday 7 October 2016

Oak Desk with Embedded TV/Monitor part 2


This is a continuation of my build of an oak and glass desk with a 32" TV & computer built into it. The first part of the build is here.

Step 3: Routing the back to fit the TV

Even with the plastic bezel removed from around the front of the TV, there's still a metal frame supporting the screen, which can't be removed.

Just sitting the TV against the back of the desktop would leave a gap of 28mm between the glass and the screen, which is enough to look a bit weird.

I routed the back of the desk to allow the TV to be positioned closer to the glass. This meant removing another 10mm from the desktop thickness, leaving the 'ledge' that the glass sits of at 18mm.

Step 4: Creating the legs

It made sense to use the section that had been removed from the middle of the desktop for the legs. However, I didn't want to just use the flat board, as it would just look lazy and reminiscent of flat-pack furniture, even when cut into 4 for the legs.

I also needed to give consideration to the cabling for the screen, which led me to the idea of splitting the wood into 8 pieces, and pairing them together to create the four legs. This would allow for the cabling to be integrated, and give a more solid leg aesthetic which better suited the style I was aiming for.
The 8 leg parts, ready to pair up and join



To allow for the cable to be run, before joining the last leg, I routed a groove in the joining sides. a hole was drilled through to the outer corner of the leg. This will be tidied up later to incorporate the hole in part of the design so it doesn't look too out of place.

A photo posted by Anthony (@darkmidnight_diy) on


Then the corners of the legs were shaped, and open mortises were cut to attach the desks skirt

A photo posted by Anthony (@darkmidnight_diy) on

A photo posted by Anthony (@darkmidnight_diy) on

A photo posted by Anthony (@darkmidnight_diy) on

With the legs done, I can move onto fitting the TV.

Friday 23 September 2016

Oak Desk with Embedded TV/Monitor

I've been after a new desk for a while, but never really been able to find one that fits the right combination of size, style and budget.

So I decided to build one myself, taking inspiration from a few videogames, where desks with built-in screens are commonplace:

In Splinter Cell: Blacklist (2013), the 'SMI' as it was known, was interactive and and provided a means of displaying menu systems to the player.
More recently, in Doom (2016),
the desk is merely part of the scenery.

The plan
As much as I like the look of the tables in the games, I decided to go with a more traditional look.

The TV (red) will be sunk into the table, with the electronics hidden by the apron (grey) part.

When the glass (blue) is added, it will line up with the table surface, creating a flush finish.
The underside - I envisage a frame, possibly a re-purposed wall mount (yellow/gray), supporting the TV. The pink block indicates where I will mount the computer.

I started with a block of oak kitchen counter top. The aim was to put the TV into the desk, then protect it with a glass worktop sunk into the wood.

Step 1: Routing the ledge for the glass

A photo posted by Anthony (@darkmidnight_diy) on
The counter-top is 38mm thick, and has substantial weight to it. The plan was to route 10mm deep into it so that the glass would sit flush with the rest of the wood.

The glass was centered on the table and marked up. I'd only be routing the ledge, I'd be cutting the middle part out entirely, to make room for the screen, so it didn't make sense to rout all that.


I also left the corners - once the middle was removed I'd use a forstner drill to do those, to ensure a nice round corner.


Step 2: Cutting out the middle

A photo posted by Anthony (@darkmidnight_diy) on
It would be a shame to waste the large chunk of wood from the middle, so I thought I'd use it to create the legs which meant I had to remove it intact.

I did this by using a circular saw to plunge-cut on each side, using the routed ledge as a guide, then using a jigsaw to finish the cuts on each side, allowing the middle to drop out (which of course had to be controlled, leaving it unsupported would likely have caused the wood to split when the majority of support was gone).


With the middle removed, I could finish the corners of the ledge using the forstner drill.


A photo posted by Anthony (@darkmidnight_diy) on

The next steps are to build the legs and mount the TV.