Category Archives: Copters


I just published updated project on GitHub


It is Arduino based converter for processing Mavlink telemetry data and send them in Duplex format (Ex but also old text one) into your receiver (and down to earth)


Features :

- sending data over Ex protocol

- sending data as text to even old Jetiboxes (include messages)

- Alarms


Here is wiring, it is really simple : Mav2DuplexWiring   Code using one hardware serial for reading telemetry from Mavlink board (ArduCopter or MegaPirateNG) and output data into Jeti as software serial.   Here is video to show Alarms

Datalog with MegaPirateNG 3.0.1 R4

As new MPNG 3.0.1 R4 have completely overhauled structure there is needed also do code changes in different way. Here is how to make it work. Sample uses pin 33 (Arduino notation) which is PortC , Pin 4 in ATMega notation.

What you need to update :


#define SPI0_SCK_PIN SCK
#define SPI0_SS_PIN SS  //add this

AVRSemaphore AVRSPI0DeviceDriver::_semaphore;

static volatile bool spi0_transferflag = false;

void AVRSPI0DeviceDriver::init() {
hal.gpio->pinMode(SPI0_MISO_PIN, GPIO_INPUT);
hal.gpio->pinMode(SPI0_MOSI_PIN, GPIO_OUTPUT);
hal.gpio->pinMode(SPI0_SCK_PIN, GPIO_OUTPUT);
hal.gpio->pinMode(SPI0_SS_PIN, GPIO_OUTPUT); //and add this


Default SS pin have to be defined, set on output even if you are using different pin for slave CS. Reason is simple – if SS is not on output, SPI in AtMega resetting Master mode during operation and communication doesn’t work.


/* dataflow cs is on arduino pin 53, PORTB0 */
AVRDigitalSource* df_cs = new AVRDigitalSource(_BV(4), PC);  //change this
/* dataflash: divide clock by 2 to 8Mhz, set SPI_MODE_3

Pin have to be changed. Use “PC”/”PB” convention instead of “PORTC”. Maybe there is not difference but PORTC doesn’t worked for me.

If anybody can confirm it to me, it will be great :-) After couple of tests I am little bit out and not sure if I covered everything.

Datalog memory for AIO boards (or any Arduino board with ISP)

Following board can be used for any board with working SPI on ISP connector but is primary targeted for copters.

Biggest difference between Crius AIOP v.1 and v.2 is 16Mb dataflash on board. ArduCopter have same capability but Crius v.1 or Hobby King clone AIO clone don’t.

Dataflash logs can be really useful during tuning of your copter so I decide to extend standard boards with this new capability.

Result is small PCB board with LE33 voltage regulator (and two capacitors) to provide 3.3V VCC voltage for memory and Atmel AT45DB161D memory with 2MB (or 16Mb) capacity. Memory is SPI so we can create board as attachment to ISP connector on AIO board.

There is also one more wire needed for CS – I used pin 33 (originally used for camera trigger from RC receiver, not used in most cases) which is connected by wire with board.

How it looks can be seen here :

Result attached to Multiwii Pro with Mega 2560 XCopter board

Result attached to Multiwii Pro with Mega 2560 XCopter board

It is my first SMD so sorry for quality. Fortunately, SOIC 8 and 1206 sized parts can be soldered at home with reasonable soldering stuff without major problem. Also DPS can be done by photo etching easily (see other blog post for detail).

So here is schematic, board and pdf for your DPS :

ISP Memory Schematic

ISP Memory Schematic



ISP Memory DSP

Also you need short update in your MegaPirate NG code (for arduino look for standard DataFlash library)

1. locate Dataflash folder in Libraries

2. change pins settings in DataFlash_CRIUS_AIOP2.cpp  code

// arduino mega SPI pins
#define DF_SLAVESELECT 33 // SS (PB0)
#define DF_RESET 32 // RESET (PG0)

where DF_SLAVESELECT is your chosen pin on board. DF_RESET should lead to unused pin although is not used for board.

3. set your config to Crius V2



Compile code, put your board on your copter and done.

Now you have dataflash logs capabilities and you can measure your vibrations or other stuff on copter.