Crash T-REX 450

Hi all ! As we're enjoying a very bad weather for a few weeks now, i'll use this time to share some pictures of my first crash with the T-REX 450. This one was due to the big distance of the heli and a grey sky (I lost the orientation). The crash were pretty bad mostly because I panicked and forgot to stop the engine.. Any way 40€ latter it was back in the sky !

2012-09-27 18.06.35 2012-09-27 18.06.45

2012-09-27 20.02.17

As you can see, the main shaft was bent pretty hard..

2012-09-27 20.02.29 2012-09-27 22.09.18 2012-09-27 21.44.03

All the broken parts..2012-09-27 20.02.39

Stay tuned !

A max7456 library for Arduino

It's been a while since we published the last article.. Well we've been pretty busy those days but as a gift in this article I'll present you some of our lattest work : A library for the well known max7456 chip by Maxim.

As famous as it is, a little reminder won't be too much. max7456 is basically used to insert customized information in a given analogic video stream. This manip is called "OSD" (for On-Screen Display). A little picture to explain it :

explainationOSD

We recently bought a wireless video system in order to do FPV (First Person Flying, you only look on a video send by a camera installed on the drone/plane). And the problem is that it's quite hard to pilot this way without additional informations about the flight. So we decided to make our own OSD system.

We decided to make a library for the max7456 because we didn't found one that fitted our needs. This library is pretty simple to use and comes with a complete documentation and example programs. This has been used with a PAL system, but the differences with NTSC are not really big (you have to init it an other way, refer to the datasheed of max7456 if you need to).

Here is the Hello World ! code :

#include "SPI.h"
#include "max7456.h"

Max7456 osd;

void setup()
{
  SPI.begin(); //to be called before osd.init
  osd.init(10); //CS on port 10
  osd.setDisplayOffsets(60,18);
  osd.setBlinkParams(_8fields, _BT_BT);

  osd.activateOSD();
  osd.print("Hello world : )",1,3);
}

void loop()
{
}

In order to make easier the process of entering new characters in the NVM (non-volatile memory) of the OSD, I made an program used to transform a bmp picture representing the OSD characters table into a single array you can use with the library (there is an example that shows the use of this array). Just lauch the executable with the options :

[source lang="shell"]convertOSD.exe -i ".bmp picture" -head ".h containing array"[/source]

The bmp picture looks like this :

tableOSD

This represents the 256 characters to be insered into the NVM. So here's the deal : when you want to put your customized characters table into the NVM, you must write on a register in the max7456. The values to write on this special register are directly related to the character. To be quick, each pixel of a character is 2-bits coded, and the character is 12x18 pixels you'll need 54 bytes of data. There are 256 characters in the table so the array returned by the program is 13824 bytes long (approx. 13.5k) . This is much more than the Arduino's flash memory can handle (2k). But the program memory is sufficient to store such an array. Then we used a little trick to program the max7456 in one single operation : we simple store the array in the program memory with the instruction :

const prog_uchar tableOfAllCharacters[13824] PROGMEM = {0x55,0x55,0x55,0 // ....

Nothing really hard here : character at address 0x00  is represented by the 54 first bytes, character at address i is represented by the (54*i) next 54 characters. Note that all the 0xFF value has been replaced by "0x55". This is because af a tricky bug in the Arduino bootloader that causes the Arduino to be corrupted if too many 0xFF are sent on a row to the program memory. Therefore, this is the method to get the character i in the table "table" (we fill a special type "charact" which is in fact a 54 bytes array.


//-----------------------------------------------------------------------------
// Implements Max7456::getCARACFromProgMem
//-----------------------------------------------------------------------------
void Max7456::getCARACFromProgMem(const prog_uchar *table, byte i, charact car)
{
	unsigned long index;
	byte read;
	index = i*54;
	for(unsigned long j = 0 ; j < 54 ; j++)
	{
		read = pgm_read_byte_near(table +index+j );
		car[j] = read;
		if (car[j] == 0x55)
			car[j] = 0xff;
	}
}

Note that we experienced problems with the sparkfun max7456 package. This was caused by a chip overheat dued to insuficient copper pad under it. We solved the problem by adding a tiny RAM heat dissipator on it.

Ok, most important part now : the sources !

Character array generator

Max7456 Library