Go Down

Topic: Arduino + MAX7456 OSD (Read 78504 times) previous topic - next topic


All the files and schematic you need are here:

Thanks to -dfraser-  


Hello everybody,

How difficult should be build this kind of device :
1 video input
1 video output that will dispaly the video input + some caption being sent by pc (RS232 or any other way) ??

Is anybody want to build it for me ? I need it ASAP. Here is my mail : ofer@987.co.il please let me know how much it will cost and how much it will take.

Thanks & regards,


Nov 17, 2010, 03:06 am Last Edit: Nov 17, 2010, 07:18 am by tonycc Reason: 1
First, I want to thank everyone for this thread.  I have an Uno and MAX7456 breakout and it is working fine for writing to the screen.

I am having a problem which I can not seem to figure out.
 I want to count the number of frames and display the frame count on the screen.  I am trying to use VSYNC as an interrupt, but I can't get it working.  

I am a rank novice at this type of work and I could use some help.

Here are my connections:

Uno / MAX Breakout
D13 -> SCK
D12 -> DOUT
D11 -> DIN
D10 -> CS
D6 -> 1kOhm -> RST
D3 -> 1kOhm -> +5v   (added to solve vsync problem)
+5v => +5v

I've also attached interrupt 0 (D3) => VSYNC through a 10kOhm as a debugging attempt.

Here is the sketch I have been working with:

Code: [Select]

// interrupt code based on work by Andrea Di Dato 2010
#include "MAX7456.h"
MAX7456 osd;

int enablePin = 6;                      // MAX7456 enable pin
volatile int VSYNC_count = 0;      // count VSYNC
int intPin = 0;                        // interrupt pin
char st1[] = "000000000000";     // string representing frame count

void setup() {
 // OSD  (osd.write(string, position, line)
 // hardware reset MAX7456
 pinMode(enablePin, OUTPUT);    // initialize enable pin of MAX7456
 digitalWrite(enablePin, LOW);     // disable chip
 delay(1000);                            // delay to see the reset happen
 digitalWrite(enablePin, HIGH);   // enable chip

 osd.begin();                            // initialize OSD routine
 osd.clear();                            // redundant memory clear

attachInterrupt(intPin, CountVSYNC, FALLING);  // attach interrupt

void loop() {

void PrintOSDFrame() {
 osd.write_to_screen("Hello World", 1, 1);   //write to row 1, column 1
 itoa(VSYNC_count, st1, 10);                 // convert int to char strng
 osd.write_to_screen(st1, 1, 10);           //write vsync count to row 10

void CountVSYNC() {        // Vsync interrupt function
 VSYNC_count++;               // increment vsync count
//  noInterrupts();
 PrintOSDFrame();              // call write to screen function
//  interrupts();

This appears to never detect the vsync interrupt since no display ever gets written to the screen. If I move the three PRINTOSDFRAME lines to  the loop, hello world and 0 are displayed.

I have tried a lot of different configurations, disconnected/reconnected, etc. and have gotten nowhere.  I feel like I am missing something silly.

UPDATE: I think I just found the something silly.  Looking at the MAX7456 datasheet it indicates the vsync signal needs to be pulled high through a 1kOhm resistor.  I'll give that a try tomorrow.  I'll leave this note in here in case anyone else is interested in using the vsync.

UPDATE: Connecting the VSYNC to +5v through a 1kOhm resistor did fix the problem.  I have updated the above note to indicate the problem was solved and to provide the correct connections for using vsync.


@kg4wsv, you may have overlooked these definitions but just minor things:

Code: [Select]
// background mode brightness (percent)


they are on bits 6, 5 & 4 according to the datasheet, should be:
Code: [Select]
// background mode brightness (percent)
#define BACKGROUND_BRIGHTNESS_14 0x20 //
#define BACKGROUND_BRIGHTNESS_21 0x30 //
#define BACKGROUND_BRIGHTNESS_28 0x40 //
#define BACKGROUND_BRIGHTNESS_35 0x50 //
#define BACKGROUND_BRIGHTNESS_42 0x60 //
#define BACKGROUND_BRIGHTNESS_49 0x70 //

#define BACKGROUND_MODE_GRAY 0x80 //


Thanks for the info.  Fixed!



Dec 13, 2010, 10:16 pm Last Edit: Dec 14, 2010, 05:14 pm by kyndal Reason: 1
im having a minor issue.

i am using an arduino Mini. an ssop adapter (dipmicro.com) + MAX7456.
have wired it up. and trying to upload the ascii_font_set.mcm file
from http://doofusdog.org/files/Arduino+MAX7456_OSD.zip

the "MAX7456_mcm_font.c"  compiles and uploads fine.

after reboot my NTSC LCD shows the full original "japaneese" charset

hyperterm connects fine (9600 8N1 )
and i get the "Ready for text file download"  message

i use "send text file"  to send the  ascii_font_set.mcm file

but then nothing "happens"..  i wait much longer than the 3 minutes mentioned in the code.  
and no "Done with file download"  ever shows..

after a reset.. its still just the original Charset.

have i missed a step ?  

no idea why it didn't work with hyperterm!..
but after re-re-reading this thread and disregarding all the
references to hyperterm.  i tried using teraterm as suggested elsewhere.   and had instant success!!..  

as mentioned above. im using the 28pin SSOP adapter from dipmicro.com
comes with little prototyping areas. i easily fitted all the supporting
components on there. except what is needed for video in & out
pretty neat package..

Thanks for the Great work everyone.



i also had a minor issue with the library posted by kg4wsv in Reply #97  example sketch:

when compiling using Ardiuno enviroment 0018
i was getting

In function 'void loop()':
error: 'class MAX7456' has no member named 'noblink

and same for noinvert

in MAX7456.h they are named with "capitals"

so i changed that in the example pde and all is good.



i also had a minor issue with the library posted by kg4wsv in Reply #97  example sketch:

Thanks.  The library is newer than the example.

I should fix that, and roll a real example or two into the library itself, like other Arduino libraries.



verywll explaind ,though I have a little difficulty in totally understanding,practice my English anyway.


Dec 15, 2010, 06:56 pm Last Edit: Dec 15, 2010, 07:01 pm by kyndal Reason: 1
So a quick question...

the project:  i am reading the date/time of a DS1307+ RTC via I2C
and feeding that to the MAX7456 so i have a timestamp on recorded video.

the problem is that i have 1 analog camera feeding two devices
a LCD and the  the MAX7456    (that feeds the recorder )
but when i attach two "loads" to the camera.
it cant keep up (impedance etc.)

what is the simplest way to make a video buffer / splitter
amplifier? so i can feed two "loads" from this one video source?

im not that good with analog circuitry
but im thinking a  matched impedance transistor circuit
or even high speed video opamps ?

have googled around. and tried a couple of "buffer designs"
but haven't found any that  isnt either overkill
or when tried.  just don't work....

anybody have a nice simple circuit that works?





You can just buy a composite video splitter on ebay they are really cheap.

If you really need to build one, it's just a simple opamp voltage follower. As long as the opamp can handle the current and frequency it'll be fine.


Dec 18, 2010, 09:55 pm Last Edit: Dec 19, 2010, 04:15 am by kyndal Reason: 1
i have used the folowing changes (addons) to get the library working with pal
taken from the max7456_code.c source

in MAX7456.h  add or substutute with the folowing
Code: [Select]

//#define MAX7456_RESET 0x02                  //NTSC
#define MAX7456_RESET 0x42                  //PAL

//#define OSD_ENABLE 0x08                     //NTSC
#define OSD_ENABLE 0x48                      //PAL

// with NTSC
//#define ENABLE_display 0x08
//#define ENABLE_display_vert 0x0c
//#define MAX7456_reset 0x02
//#define DISABLE_display 0x00

// with PAL
#define ENABLE_display 0x48
#define ENABLE_display_vert 0x4c
#define MAX7456_reset 0x42
#define DISABLE_display 0x40

// with NTSC
//#define MAX_screen_size 390
//#define MAX_screen_rows 13

// with PAL
#define MAX_screen_size 480
#define MAX_screen_rows 16

is it CRITICAL to use the arduino pins in the order
specified in the library?

board layout wise it would make it much easier for me to change
them around a bit or use other I/O's all together
i have tried  but with no luck so far ?



You can not change the order of the SPI pins.


To expand a bit on zitron's answer, the MAX7456 library uses hardware SPI, which is fixed on the particular lines indicated.

You could rewrite the library (or maybe only parts of it) so you can bit-bang SPI, in which case you could use any pins you want.



Dec 29, 2010, 12:09 am Last Edit: Dec 29, 2010, 01:22 am by kyndal Reason: 1
thanks for the reply guys..
i figured it might be something like that.
but for this rather simple. and now mostly finished project.
im going with what works  ;)

i have made a basic demo sketch that reads the time off a DS1307+ RTC and displays it on a LCD
using the custom ASCII charset by dfraser  
and the MAX7456 Library by kg4wsv.  


have included a PAL modified MAX7456.h in the zip


Go Up