Ben Thompson – Digital Media

arduinotellymatevideoinremoteIR

28.05.2010 (11:31 am) – Filed under: doing - extensions of man

extensions of man….. so i have been thinking about this ‘brief’/'title’/'theme’ whatever we choose to call it… i have been dilly-dallying around with various ideas for inventions and over-technological product extensions (arduino controlled plectrum?), relating to extensions of man in the form of tools…. but i was getting nowhere on an ideas level… so i steadied myself and decided to somehow combine a television and an arduino… i haven’t looked back.

the television seemed the perfect response to extensions of man, as it is the medium in question in mcluhan’s theories, and the implications of information, interactivity, and other ‘extensions’. i looked into arduino controlled magnets, messing up the images produced by the CRT… this could’ve been cool but limited… anyhoo it didn’t seem to get going…. then i found this little beasty….

TellyMate Shield

it is a Batsocks TellyMate arduino shield… it turns the arduinos output into a video signal, i didn’t read much more but i liked it and bought it. a little time later the shield arrived and i had a little play with some example sketches… the tellymate basically outputs ascii code and the resolution on the screen is very low (38 x 25) so whatever is shown on screen text/symbols/images…. all is pretty limited. but i really like that aesthetic, (as seen in previous projects). heres a little demo of the manufacturers ‘random characters’ sketch with the code…

/* Example Sketch for a TellyMate Shield */
/* Random Characters */

/* Simple helper functions */
#define CHAR_ESC "\x1B"
void cursor_move( uint8_t row , uint8_t col )
{ // <ESC>Yrc
 Serial.print( CHAR_ESC "Y" ) ;
 Serial.print((unsigned char)(32 + row)) ;
 Serial.print((unsigned char)(32 + col)) ;
}

void cursor_show( bool show )
{ // <ESC>e or <ESC>f
 Serial.print( CHAR_ESC ) ;
 Serial.print( show?'e':'f' ) ;
}

void screen_clear( void )
{ // <ESC>E
 Serial.print( CHAR_ESC "E" );

}

/* The actual sketch */

void setup()
{
 Serial.begin( 57600 ) ; // set to 57600 baud
 screen_clear() ;
 cursor_show( false ) ; // turn the cursor off
}

void loop()
{
 //move the cursor to a random place on the screen.
 cursor_move( random( 25 ) , random( 38 ) ) ;

  Serial.print( (unsigned char) random( 32, 256 ) ) ;

}

so visually it is archaic, but it works as a standalone object (requires power) this i like as all focus remains on the television. So with the tellymate working i was left with the new problem of how to interact with it. i decided to use a tv remote to control the output of the arduino/tellymate.

i needed an IR receiver, and this proved tricky to purchase with time constraints… however. my broken robotic yoda had one inside! (see previous post) so he did not die in vain. bits and bobs of research led to me to hooking this receiver up to the arduino.

IR receiver

then came the problem with getting a remote control to communicate with the receiver… more research on forums and the like turned up some code that did just that…. sweeeeeet!

int ir_pin = 2;                //Sensor pin 1 wired through a 220 ohm resistor
int led_pin = 13;                //"Ready to Recieve" flag, not needed but nice
int debug = 0;                 //Serial connection must be started to debug
int start_bit = 2000;            //Start bit threshold (Microseconds)
int bin_1 = 1000;                //Binary 1 threshold (Microseconds)
int bin_0 = 400;                 //Binary 0 threshold (Microseconds)

void setup() {
 pinMode(led_pin, OUTPUT);        //This shows when we're ready to recieve
 pinMode(ir_pin, INPUT);
 digitalWrite(led_pin, LOW);        //not ready yet
 Serial.begin(9600);
}

void loop() {
 int key = getIRKey();            //Fetch the key
 Serial.print("Key Recieved: ");
 Serial.println(key);
}

int getIRKey() {
 int data[12];
 digitalWrite(led_pin, HIGH);       //Ok, i'm ready to recieve
 while(pulseIn(ir_pin, LOW) < 2200) { //Wait for a start bit
 }
 data[0] = pulseIn(ir_pin, LOW);    //Start measuring bits, I only want low pulses
 data[1] = pulseIn(ir_pin, LOW);
 data[2] = pulseIn(ir_pin, LOW);
 data[3] = pulseIn(ir_pin, LOW);
 data[4] = pulseIn(ir_pin, LOW);
 data[5] = pulseIn(ir_pin, LOW);
 data[6] = pulseIn(ir_pin, LOW);
 data[7] = pulseIn(ir_pin, LOW);
 data[8] = pulseIn(ir_pin, LOW);
 data[9] = pulseIn(ir_pin, LOW);
 data[10] = pulseIn(ir_pin, LOW);
 data[11] = pulseIn(ir_pin, LOW);
 digitalWrite(led_pin, LOW);

 if(debug == 1) {
 Serial.println("-----");
 }
 for(int i=0;i<11;i++) {          //Parse them
 if (debug == 1) {
 Serial.println(data[i]);
 }
 if(data[i] > bin_1) {          //is it a 1?
 data[i] = 1;
 }  else {
 if(data[i] > bin_0) {        //is it a 0?
 data[i] = 0;
 } else {
 data[i] = 2;              //Flag the data as invalid; I don't know what it is!
 }
 }
 }

 for(int i=0;i<11;i++) {          //Pre-check data for errors
 if(data[i] > 1) {
 return -1;                 //Return -1 on invalid data
 }
 }

 int result = 0;
 int seed = 1;
 for(int i=0;i<11;i++) {          //Convert bits to integer
 if(data[i] == 1) {
 result += seed;
 }
 seed = seed * 2;
 }
 return result;                 //Return key number
}

next step… getting a sony configured remote control… and joy of joys…. pondland to the rescue, bought my self a universal remote… and tuned it to the right frequency and i started receiving crazy numbers and alsorts of stuff….

ÛæÛæÛæÛæÛÛÛÛÛæùæÛæøæÛæûÛæÛæÛæÛæûæÛ&ÛæÛÛæÛÛæÛæÛæÛæÛfÛæûæ (real input example)

but, after toying with baud rate i got some useable numbers… wahooo!

Key Recieved: 128
Key Recieved: 128
Key Recieved: 128
Key Recieved: 128
Key Recieved: 129
Key Recieved: 129
Key Recieved: 129
Key Recieved: 149
Key Recieved: 149
Key Recieved: 149
Key Recieved: 148
Key Recieved: 148
Key Recieved: 148
Key Recieved: 148

IR detection accomplished… arduino video output success… having played around with the codes, smashing them together to create a mutant sonyremotetellymate sketch, and then identifying keypresses and such and other coding bits and bobs i have created a multichannel minimal tv digibox thing. each channel ‘shows’ a line of text which is cynical and very obvious anti-dross statements. but i like it…

more tinkering is needed if it was to ever be a ‘final’ finished piece, but for the purposes of arduino experimentation, i’m going to give myself a pat on the back!

peace