Naze32 flight cotroller

Hi,

I was wondering if it is possible to "interface" the naze32 (flight controller with an arduino to be able to read data from the flight controller (like telemetry etc). Has anyone have ever tried to do something similar?

I have not tried it myself, but the telemetry data comes out of the Naze 32 as a serial stream. Have you tried reading the output using the serial input of the Arduino ?

Hi,

no I have not. Do you mean just write a simple program that prints what ever come "into" the arduino using the serial port ?

Do you mean just write a simple program that prints what ever come "into" the arduino using the serial port ?

Yes, that's what I had in mind. I use a Naze32 with a D4R II receiver and the telemetry data goes into the serial input of the receiver so it's a fair bet that you could read the serial output of the Naze with an Arduino.

I know this is an older topic, but I was curious if the OP or anyone else has had any success with this? I'm working on an autopilot project that will take in telemetry from the Naze32, do calculations based on that and provide PWM back to the Naze to control the quads actions.

I've managed to get a Mega 2560 softwareserial linked on pin 6 of my Naze32, but I'm having a heck of a time deciphering what the Naze32 is transmitting to the Arduino. In decimal, HEX, and ASCII, it makes no sense.

You may need to invert the output of the Naze to make sense of the data but I have not tried it myself. If you are using Cleanflight on the Naze then try

set telemetry_inversion = ON

from the Cleanflight CLI prompt. Which telemetry format have you got set on the Naze ?

If I get the chance I will try it myself, assuming I can find my spare Naze32 board that is. What baud rate are you using ?

UKHeliBob:
You may need to invert the output of the Naze to make sense of the data but I have not tried it myself. If you are using Cleanflight on the Naze then try

set telemetry_inversion = ON

from the Cleanflight CLI prompt. Which telemetry format have you got set on the Naze ?

If I get the chance I will try it myself, assuming I can find my spare Naze32 board that is. What baud rate are you using ?

I've tried both invert settings and it looks garbled both directions. I've got it set at 19200 on both ends. I'm wondering if maybe the issue is that I'm using hardware serial on the Mega and software serial on the Naze. I'd like to use UART1 on the Naze for telemetry, but I've not been able to make that work as of yet.

I'm still pretty fresh on this. So, I'm not even sure what it should look like compared to what I'm seeing.

I am using SoftwareSerial on the Naze to feed inverted FrSky telemetry to a D4RII receiver and hence to a Taranis transmitter and it works.

Information on the actual FrSky data protocol seems to be either difficult to find and/or difficult to understand.

So.... I'm definitely running in to an issue. For reference, the code is listed below.

Here's the weird bit.... If I have a wire plugged in to RX1 on the Mega, I get Serial output on the console. After testing, I've discovered that the wire doesn't even have to be plugged in to the Naze or anything else for that matter; just so long as there's a wire connected to RX1. I've never seen this type of behavior from my Mega before. Obviously, there's no wire connecting TX1 to the Naze because it's a 1 way Serial stream.

I don't understand how I'm getting console output though. The Serial.println is only supposed to trigger in the case of Serial1.available, but with the wire not connected to anything, how can I possibly have the Serial1.available condition met? I'm going to have to get this bit worked out before I can proceed any further.

I'm guessing this is what the garbled junk I'm seeing is and that I'm only getting telemetry bits in between. Ideas on why I'm seeing this odd behavior from the Mega?

#include <FrSky.h>

FrSky frsky;

void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  if (Serial1.available()) {
    char c = Serial1.read();
    Serial.println(c);
    if (frsky.update(c)) { // frsky_update() returns 1 if a complete packet was successfully decoded, otherwise 0
      Serial.print("TX RSSI: ");
      Serial.println(frsky.getLink_up());
      Serial.print("Telemetry RSSI: ");
      Serial.println(frsky.getLink_dn());
      Serial.print("RX Voltage: ");
      Serial.println(frsky.getRX_a1()*0.0517647058824); // The internal sensor has a 4:1 divider, so the value is 0-13,2V in 255 steps or 0,052V per step
      Serial.print("A2 Voltage: ");
      Serial.println(frsky.getRX_a2()*0.0129411764706); // A2 without divider is 0-3,3V in 255 steps or 0,013V per step
    }
  }
}

I made a project using the naze.

It was an anticollisionsystem for the drone using supersonic sensors. Therefore I was overwriting the receivers signal with the data I wanted. Depending on what you want to read, just read the serial port. I used pulseIn(), but I've heared there are better options, which I haven't tried yet.

If you just want to read the data and don't overwrite it pulseIn should be good enough.

Best regards
MajorProb

It doesn't sound like what you were doing involved the telemetry output of the Naze, which is where the problem is arising, but maybe I am wrong. If you were using it, can you please explain how you read and interpreted the telemetry data ?

MajorProb:
I made a project using the naze.

It was an anticollisionsystem for the drone using supersonic sensors. Therefore I was overwriting the receivers signal with the data I wanted. Depending on what you want to read, just read the serial port. I used pulseIn(), but I've heared there are better options, which I haven't tried yet.

If you just want to read the data and don't overwrite it pulseIn should be good enough.

Best regards
MajorProb

I am attempting to read the Serial port on the Naze for telemetry data. Unfortunately, it looks like I'm not getting anything at the moment. I did figure out my garbled data issue. I had to run ground from the Naze to the Arduino to get the garbled input on RX1 to stop. Now I'm getting nothing at all, though. Not sure if I need to put the Naze in Armed mode or not to start telemetry. I'm still experimenting. Progress is just slow.

EDIT: I used option 1 on this website to enable telemetry for the FrSky UART port just to the right of the USB port on the Naze:

http://www.netraam.eu/nazewiki/pmwiki.php?n=Howto.FrskyTelemetry

UKHeli no I didn't read the telemetrie data. As described I was reading the receiver and modded that signal. It was ment to be as a side input.

Depending on what the telemetry gives as an output signal you can try it with pulseIn() (that is more what I intended to say :wink:

How did that work with the ground of the naze?? Do you power your arduino via the naze or the naze via the arduino? (or 2 sources?)

I can only refer to what I did myself, which was writing instead of reading (unfortunately for this project).
The naze can be quite picky. Once I was writing a wrong value to the naze and it completly shutted down. Maybe the naze don't like the way of writing to the arduino.

Have you tried to just read the string?

MajorProb:
UKHeli no I didn't read the telemetrie data. As described I was reading the receiver and modded that signal. It was ment to be as a side input.

Depending on what the telemetry gives as an output signal you can try it with pulseIn() (that is more what I intended to say :wink:

How did that work with the ground of the naze?? Do you power your arduino via the naze or the naze via the arduino? (or 2 sources?)

I can only refer to what I did myself, which was writing instead of reading (unfortunately for this project).
The naze can be quite picky. Once I was writing a wrong value to the naze and it completly shutted down. Maybe the naze don't like the way of writing to the arduino.

Have you tried to just read the string?

I did try readString with no success either. I'm watching the RX/TX lights on both devices and not seeing any communication; one way or otherwise.

Since this is over UART, I don't think pulseIn is going to do me much good. To be honest, I'm not sure that the instructions in the link on my last post have actually enabled telemetry on that UART port. I'm going to reconfigure for softserial on the Naze again and try from port 6 like I was before.

As far as power, they're powered separately at the moment. I decided to try and run ground from the Naze to the Mega to rule out noise as my issue on RX1. I'm only using the Mega for functionality testing. Ultimately, it will be a Feather M0 doing the telemetry read, calculations and PWM out back to the Naze. I've not yet decided on power solutions for that.

UPDATE:
I switched back to softserial and left the naze grounded to the Mega. Success! Well, kind of anyway. Here's what I'm seeing now:

£
"
(
6

~
(
Æ
ü
1
ñ
Ç
ü

Ñ
ã
ü

q
G
ü

q
ü
ü

1
±
ü
ü

±
ü
ü


¬
ü

1
ä
L

ñ
ã
ü

q
ü
ü

1

Ç
ü

ñ
Ì
ü


(
e
e

Q
£
"
(
6

~
(
Æ
ü


(
e
e

Q
£
"
(
6

~
(
Æ
ü

Well if you have a logic analyser you can find out if these are actual values you get or random values. I used one to find out what to look for.

MajorProb:
Well if you have a logic analyser you can find out if these are actual values you get or random values. I used one to find out what to look for.

Unfortunately, no. I don't have a logic analyzer. You've given me an idea regarding serial communications though. I'm going to continue experimenting and I'll post back when I have more.

I feel like a knuckle head. Why on earth am I trying to decode FrSky telemetry when the Naze32 still supports MSP? I found some excellent Arduino code here:

http://www.multiwii.com/forum/viewtopic.php?f=15&t=6570

I'm reading it right now and it makes sense. I won't be able to do testing until later tonight though when I can get access to a soldering iron again. Hopefully this works out. If I can't get telemetry from the Naze, I'm just going to have to mount a separate I2C IMU to pull readings from instead. Ugh... one more piece of equipment I don't want to add.

Okay.... I used the test code from the link above against UART2 on the Naze32 and it works! I'm getting back reliable attitude data for x,y,z to the Arduino.

It took quite a bit of time to figure out how exactly the code works because it's not commented well, but I've got it down pat and I'm working on hacking it up a bit so I can get back altitude data as well. Once I've got that tested, I'll be trimming it up a bit to get the size down and it'll be on to the next part of the project.

Thanks again guys for helping me bounce ideas around.

Can you please post your working code.

What firmware are you running? The cleanflight firmware supports a variety of telemetry formats:

1 Like