SD Card Logger

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
dreadful
Posts: 2
Joined: Wed Aug 27, 2014 10:19 pm

Re: SD Card Logger

Post by dreadful »

(FYI, I am a newb)

I have an issue getting my FC to talk to my secondary controller.

My logging controller is connected to a microSD card. Every time I reset or power on the logging controller it makes a LOG_X directory, so I know it's talking to the SD card. When I look through the Arduino serial monitor it repeats "$M< 11$M< ff$M< jj$M< ii" repeatedly while the logging RX LED flashes. If I close the serial monitor then the blinking stops. I have a bluetooth module that plugs into the serial port that works just fine. I remove the bluetooth module when connecting my logging controller so I know my FC serial port is good. I have the logging controller RX to the FC TX and logging TX to FC RX (correct?).

So what am I missing? I'm like 90% there after a week of debugging other things. Any help would be appreciated.

EDIT:
helikalle wrote:... Because the logger prevents the flight controller to initialize correctly i have inserted a 3 second delay in the in the "void Setup ()" section of the code. Now all works perfectly. ...


I've solved it thanks to helikalle! I know I read that post first but it didn't click because my FC was working just fine. I took it one step further and instead of a delay I told it to wait indefinitely until it connects. I changed the code to:

Code: Select all

void setup()  
{
  Serial.begin(115200);
  while (!Serial) {} //wait to establish connection before proceeding
  logger.init();
}

renes
Posts: 26
Joined: Sat Mar 08, 2014 10:50 am

Re: SD Card Logger

Post by renes »

Often it was requested to actually show the flight log data somewhere

I created a new tool which is included in http://www.rcplaces.info/

you can upload the gps log created with the logger software and can view your data on google maps and get some metrics like top speed, distance, and so on and can archive your flight data to compare it later on. you have to create an account but its for free anyway.

for the other feature requests for the firmware itself I will hope to have some time in the upcoming weeks to include it if possible

best regards rene

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

Dear renes,

First of all thanks for your great work, I am using your datalogging code. I try to fix sampling time (I reached max. 34ms (30Hz)).When I analyze the data, " sampletime 'millis()' " is shifted periodically (like; 29ms , 30ms , 57ms, 29ms , 31ms , 57ms ... etc). Is there any idea to fix the sample time or there is a serial read buffer problem?.

Code: Select all


if (millis() - lastUpdate <20 )
         {

            uint8_t  datad = 0;
            uint8_t  *data = & datad;

            // If you dont need a certain log just comment out the two lines for sending and reading
            p.send_msp( MSP_ATTITUDE  ,data, 0);
            readData();
           
          // p.send_msp( MSP_RAW_IMU  ,data, 0);
          // readData();

          //  p.send_msp( MSP_RC  ,data, 0);
          //  readData();
 
           // p.send_msp( MSP_RAW_GPS ,data, 0);
           // readData();
       
 
}

  lastUpdate = millis();





Thanks for your time.

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

any idea?

renes
Posts: 26
Joined: Sat Mar 08, 2014 10:50 am

Re: SD Card Logger

Post by renes »

Right know i dont have any idea.
which hardware do you use?

I can try to reproduce it and then give it a try to fix it.

why is this a problem to you?

best regards rene

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

renes wrote:Right know i dont have any idea.
which hardware do you use?

I can try to reproduce it and then give it a try to fix it.

why is this a problem to you?

best regards rene



Dear renes,

I am using

Flight Controller - > Cruis SE V2.0 (Firmware V2.4)

Data Logging Hardware -> Arduino Duemilanove (Atmega328p) and Wireless SD Shield
Not: (I am not using Xbee for transmitting data , directly using cable)

If you checked millis() values , there is a periodical jump like (time differences -> 34 ms ; 35ms ; 57 ms; 34ms; 34ms ; 58ms,... etc) (Logging only attitude values)

renes
Posts: 26
Joined: Sat Mar 08, 2014 10:50 am

Re: SD Card Logger

Post by renes »

depending on your gps logger you dont even get data in that frequency

I have the same board somewhere I will give it a try. can you send me your code?

which gps are you using?

best regards
rene

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

Dear renes,

I am not using GPS , I just want to log ATTITUDE ,RAW IMU , MOTORS and ANALOG (Voltage , Amper).

My code is here

https://www.dropbox.com/s/w0x6iaur27vol9h/datalogger.zip?dl=0

renes
Posts: 26
Joined: Sat Mar 08, 2014 10:50 am

Re: SD Card Logger

Post by renes »

ah sry I read altitude.
ok I will see if I can check it out next weekend

best regards
rene

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

Thank you

Regards
Mehmet

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

Dear renes,

Do you have a chance to check code?

Thanks

renes
Posts: 26
Joined: Sat Mar 08, 2014 10:50 am

Re: SD Card Logger

Post by renes »

I tried but my Cruis does not work anymore I had to order a new one.
why is it a problem for you that these values are not logged at the exact millis difference?


best regards rene

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

I think , It is important for accurate data logging , and also there is a jumping problem in reading serial data. I am logging data with Processing GUI with 30Hz fix time (with cable, not Xbee), but the system is on test bench :D. Also , I want to try OpenLog firmware, you already mention about it (https://github.com/renes/multiwiiDataLogger#openlog), but I don't understand how will I apply that code in my datalogging hardware. Does OpenLOG firmware have MSP protocol ? Is there any config parameters to change ?

Thanks for your time

renes
Posts: 26
Joined: Sat Mar 08, 2014 10:50 am

Re: SD Card Logger

Post by renes »

the openlog software just logs the data it gets via serial. multiwii does not send any data via serial if you do not send the corresponding code to the control before. thats why my logging software does implement the mutliwii serial protocol. if you want to use the openlog, you have to change the multiwii code to send code on its own - or you make the openlog firmware to implement the multiwii protocol - for this you can acutally reuse parts of my code.

actually at this point i dont even know if its a problem of the logger or if the multiwii controller itself has this delay. because what you want is a real time system. even the multiwii software is near real time the cycle times ( as you can check out via the GUI) may change a view ms each cycle.

what you can to now is to narrow the probem down, e.g. comment out the code that actually does write the values to the SD card and just log what you get to the serial. if the ms still are not constant I really believe its a "problem" to be researched in the MW itself.

best regards
rene

User avatar
mehmetyld87
Posts: 25
Joined: Wed Feb 18, 2015 2:50 pm
Location: Ankara

Re: SD Card Logger

Post by mehmetyld87 »

Dear rene

Thanks for your help,I will try this weekend.

Regards
Mehmet

AdrianLand
Posts: 2
Joined: Sat Aug 29, 2015 1:23 am

Re: SD Card Logger

Post by AdrianLand »

Dear Rene (and the Log Squad)

(MultiWii Newbie alert) Many thanks for pulling together this capability - exactly what I need!

Unfortunately I'm running into a problem noted by some other posters:
directories are created on the SD card (e.g. LOG_1), but no data files logged.

Here's my bench set up:
Flight controller: Flip MWC 1.5
Code: MWC 2.3 MultiWii_Flip_Tri
Arduino Nano
Adafruit MicroSD
Flip MWC and Nano powered by battery, no USB cables attached

The Nano talks fine to the SD card, tested with SD example files. Blinking LEDs on boards show communication.

Hookups: Nano (TX1, RX0, Gnd) to Flip (RX, TX, Gnd)

I've tried adding in the suggested, wait loop, but no change

Code: Select all

    void setup() {
      Serial.begin(115200);
      while (!Serial) {} //wait to establish connection before proceeding
      logger.init();
    }


Any suggestions would be much appreciated,
Regards
Adrian

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: SD Card Logger

Post by Leo »

I have decided that I want to do my logging via SD card and have purchased this Openlog module:
Image

I have also downloaded "multiwiiDataLogger" but am getting compiler errors (fatal error: SPI.h: No such file or directory) with Arduino 1.6.5.

@Rene: Any chance of fixing the code to make it compile with 1.6.5?

Leo

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: SD Card Logger

Post by Leo »

Well, I'll reply to my own question.

Simple fix was to add

Code: Select all

#include <SPI.h>


to the top of the script "datalogger".

It now compiles without errors.

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: SD Card Logger

Post by Leo »

Well, I am having problems getting this to run.

Here is the way I've hooked it up:
Image

I've installed renes code. Baud is configured to 115200 on each side.
The led on the logger is on at start up and then turns off.
Nothing else happens (state seen in the picture) and no logs are written on the SD card.

What am I doing wrong?

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: SD Card Logger

Post by mahowik »

Leo wrote:What am I doing wrong?

Have you changed chipSelect to 10 as written here?
https://github.com/renes/multiwiiDataLogger#openlog

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: SD Card Logger

Post by Leo »

mahowik wrote:
Leo wrote:What am I doing wrong?

Have you changed chipSelect to 10 as written here?
https://github.com/renes/multiwiiDataLogger#openlog

I cannot believe I missed that in the Wiki! :evil:

Recompiled the code and gave it a short test.
ANGLE.CSV, GPS.CSV, IMU.CSV, RC.CSV have good data.

Thanks so much!

Leo

hyperlogos
Posts: 2
Joined: Tue Nov 17, 2015 1:47 am

I went the other way

Post by hyperlogos »

I did want to modify MultiWii code. And I wanted to have SD card logging. I am using an Arduino Mega (shrunken clone anyway) so I went ahead and slapped a SPI uSD interface on and hacked and bashed until I made it work.

viewtopic.php?f=8&t=6830

This way is cheaper, IF you are using a mega and have lots of headroom for doing this at the same time.

My code is based on wareck's code and I merged it into PatrikE's fixedwing fork because that's what I wanted it for. It would be easy enough to merge into the base code.

GPS logging is untested. Permanent logging works great.

Post Reply