Pages: [1]   Go Down
Author Topic: Video Greeting Card - Arduino Style!  (Read 1007 times)
0 Members and 1 Guest are viewing this topic.
Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My wife is taking a short business trip this week, and to score points, I imported the tv_out library and connected up the output resistors into a plug for  a broken portable DVD player, which accepts NTSC video in, but disk transport is shot.  Happily it also runs on 9v, so I can run the whole rig from one adapter.  For the circuit, you simply need a 330 ohm resistor from d8 and 1k ohm resistor from d9- connect both of them to the center conductor, and the shell to ground, for most connectors to video displays.  For specific info, I'd recommend reading up on the actual library.  VERY nice, if a tiny bit twitchy

 smiley

In any case, left it running for her to find when she gets up in the morning... a cute sendoff that she'll get a kick out of and brag up to her office friends...I know what side my bread is buttered on!!  The whole thing takes all of five minutes to rig up-  score some spouse points (just remember to substitute your OWN NAME at least...)

Laugh all you want.. I'll get the payoff for the corniness of it...

smiley-wink

Code:
#include <TVout.h>

TVout TV;

void setup() {
 TV.start_render(_NTSC,128,96);
}

void loop() {
 
  TV.clear_screen();
  TV.print_str(0,0,"      Hi Honey! ");
  TV.print_str(0,16," I just wanted to ");
  TV.print_str(0,32,"Say that I Love You");
  TV.print_str(0,48," and that I'll miss");
  TV.print_str(0,64,"        you! ");
  
  TV.delay_frame(360);
  TV.clear_screen();
  TV.print_str(0,0,"      MWAH!!!");
  TV.print_str(0,16,"  (Smooches)...");
  TV.print_str(0,32,"  (Snuggles)...");
  
  TV.delay_frame(180);
  TV.clear_screen();
  TV.print_str(0,0,"    I Love You!");
  TV.print_str(0,16,"     @@@   @@@ ");
  TV.print_str(0,24,"    @@@@@ @@@@@ ");
  TV.print_str(0,32,"     @@@@@@@@@ ");
  TV.print_str(0,40,"      @@@@@@@  ");
  TV.print_str(0,48,"       @@@@@ ");
  TV.print_str(0,56,"        @@@");
  TV.print_str(0,64,"         @ ");
  TV.print_str(0,80,"    Love, Paul");
  TV.delay_frame(360);

}
 

Nite guys!
« Last Edit: September 15, 2010, 12:30:29 am by focalist » Logged

When the testing is complete there will be... cake.

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Laugh all you want.. I'll get the payoff for the corniness of it...
Seems like a great idea to me.

Mowcius
Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Awww... how sweet.

Normally I'd just say goodbye when she brings up my breakfast before leaving. smiley-wink
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Heheh.. worked perfectly.  She loved it.  She'll be back Friday night and has already texted that I should prepare for a romantic evening, so to speak..

 ;D

Since I'm using a BoArduino from adafruit, it's even smaller than a standard arduino.  Plugs directly into breadboard- though I plan to pick up an "actual" Arduino (and a Mega also) at some point when I've got a little play cash about, I'm loving the breadboarding ease of the BoArduino I must admit.  Less wires means less places to go wrong.  I'm using the AT328 version, no USB onboard (so you use serial/TTL converter)- draws very little power.

I power it with a 9v battery, when not plugged in, though for maximum duration I'd probably use 4xAA.  The BoArduino has a 7805 voltage regulator, so it'll be happy with anything from 5v to around 12v without too much worry.  If you used a Nano, the design would be even smaller, maybe you could power with lithium cells.

In any case, the little beast works with any NTSC input- so with some simple code you can have a little "teleprompter" or Ninja Video Feed Hijack for all of $15.. think walking into Best Buy, plugging it into a huge Plasma screen, and walking away while it cycles.

Someone set them up the bomb?  Let go every Zig. For great justice.

-focalist
« Last Edit: September 15, 2010, 08:11:21 am by focalist » Logged

When the testing is complete there will be... cake.

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Additional thought:  I may modify the code to make this a "real" project.  All I'd really need to add is Serial input (to "record" the message) and store the messages in flash so it retains the data during poweroff.  That way you could connect via serial (even terminal program or serial monitor in IDE), dump in your message, and be ready to go.

LED blinkies are popular in the colleges around here, I think making a simple NTSC video text generator that is essentially disposable might have some really cool Guerilla Art potential..  probably best to create a markup language for the input, so that delays could be set, inverts could be done for effect, and graphics could be incorporated.

Last but not least, as long it meets the memory required and can be clocked at a workable rate, I would assume this could be ported over to even smaller, cheaper Atmel chips like ATTINY.  Just how small a package could you fit 4x button cell, ATTINY, and a RCA plug into?
« Last Edit: September 15, 2010, 08:32:03 am by focalist » Logged

When the testing is complete there will be... cake.

0
Offline Offline
Newbie
*
Karma: 1
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cute!

Where did this TV library come from?  I do not see it listed on the Libraries page.

I suppose these days, as NTSC rides off into the sunset, we'll need one with HDMI output.  Is this feasible?  (I have no idea how HDMI works.)  Maybe with fancy 3D character renderings, too. :-)
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can find it in the "playground", under the Output section.

It's a very easy to use and cute library.  It does cause a few conflicts here and there, especially other libraries that want to have d8-d10 to themselves- but most things work great.  I'd recommend this mainly for AT328 if you are gong to have extensive code.. it does eat a bit of memory.

I'm currently working the interface for a camera controller using this, and switching back and forth between the arduino video and video the camera outputs (previews, etc) and piping that to the screen.

this is such a simple build that you can do it for a gag.. have fun!

By the way, this should also work for PAL, simply change it in code.. if the library supports it, which I think the current version does.
« Last Edit: September 16, 2010, 09:45:42 am by focalist » Logged

When the testing is complete there will be... cake.

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyway-- does anyone know where I can find the music (like notes..midi?) for the Zero Wing opening?  The first "text" sketch I did, which led to this "card", was the Zero Wing opening sequence, better known as "All Your Base Are Belong To Us."

I now feel the need to complete the thing, with music.  I've already discovered there is a conflict with the text-to-speech library (pin 10 output, but prolly could be remapped) which would give me CATS... but, what the hell... MAIN SCREEN TURN ON!

Ha ha ha ha ha!
« Last Edit: September 16, 2010, 10:19:56 am by focalist » Logged

When the testing is complete there will be... cake.

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a feeling this isn't going to be much fun.

You can download the Zero Wing music at
http://project2612.org/details.php?id=173

But that's VGM format. Maybe you could write a player for that... but if you must have MIDI then I've heard theres a VGM -> Midi converter out there. How good it is, I don't know.
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyway, gonna rewrite the sketch so it accepts text input from the serial port.. making it a nice little "teleprompter" or video dongle.   Once I started thinking about it, a barebones arduino (chip, regulator, resonator is pretty close to all that's needed) that functions as a serial-to-videotext generator/marqee for under $10 is a damn cute project..


I think it's already been done, but if not, I see a one-chip serial terminal with ntsc out in the not too far future...

Here's a gallery with the setup running...
http://www.facebook.com/album.php?aid=2090070&id=1467522154&l=f96ac27b05
« Last Edit: September 16, 2010, 04:13:34 pm by focalist » Logged

When the testing is complete there will be... cake.

Michigan, US
Offline Offline
Full Member
***
Karma: 3
Posts: 148
Go Huskies
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is a serial terminal demo sketch in the most recent version of the library(not released in a zip file, get it from the source section of the google code page).  If you want to use it please be aware of the fact the video pin changed to digital pin 7 for higher output resolution support; the sync pin stays the same and cannot be changed.
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, so now I am running into problems... it seems the TVout Library does not play nice with Serial communications, causing dropped characters from the input.  I assume this is because of an interrupt issue.

Once TV rendering has begun, serial data transfers become unreliable.  The idea was to accept data in via serial and display- but you can't do both.  Pausing the rendering does nothing to improve.

You said you had a term program working? what am I doing wrong here?

Code:
#include <TVout.h>

TVout TV;
char indata[256]="test";
int i,cnt,foo,t;

void setup()  {
//  TV.begin(_NTSC,128,96);
  Serial.begin(19200);
}

void loop()
{
  cnt=Serial.available();
  
  if (cnt>0) {
      delay(100);
      foo=Serial.available();
      for (t=0; t<=foo-1; t++) {
        indata[i]=Serial.read();
        i=i+1;
        };
  indata[i]=0;
  Serial.print(i);
  Serial.print(" bytes: ");
  Serial.println(indata);
  }
// TV.print_str(0,0,indata);
};


or is there something else going on?

If I remove the commented out render references, serial data gets garbled and lost.  pause_render() does not change anything.  Thoughts?

[UPDATE]

Looks like it is indeed a lib/serial conflcit involving interrupts.  However, the new version of the lib to be released will address these issues.  Since the lib isn't quite ready for "prime time" per the author, In the meantime, I'll work on a workaround.. which will be forward compatible.  Just know that the new lib will make my workaround kind of obsolete...
« Last Edit: September 17, 2010, 08:27:01 pm by focalist » Logged

When the testing is complete there will be... cake.

Pages: [1]   Go Up
Jump to: