I’d like to be able to add an IR temperature sensor to my IRIS that would allow me to map ground temperature (such as one of these: mbed.org/users/4180_1/notebook/m … ermometer/). Ideally, I’d be able to add the read data from the IR sensor and add it into the flash datalog coming from ardupilot so I would have a record of temperature plus position, tilt, roll and so on (the latter needed so I can filter out readings pointed other than down). It would eliminate the need of having an additional gps, IMU just for the sensor.
What would be the best way, structurally speaking of doing this?. I saw that there are user functions that run at various times but are there existing “user” fields in the data logs that can be populated? Obviously, I’d like to make the addition in a way that would enable others to do the same and w/o breaking things. Any ideas or pointers?
I posted a similar question a week or so ago and haven’t heard back from anyone. I am interested in a very similar case as you, so here is what I have discovered so far.
To start, there are a couple of scheduler tasks that call the Log_Write_xxxx functions. These functions, along with the dataflash structures, are defined in the log.ino file. The log.ino file is most likely where you would want to create your own log structure and log_write function for your temperature sensor. There are a bunch of these already created, so its pretty easy to mimic the code.
At the bottom of the log.ino file is the LogStructure array for PROGMEM. You should be able to add your own structure into here (the structure definition is in Dataflash.h file.
The next thing that you should take a look at is the bit mask definition and the log message definition found in defines.h. You need to add your bit mask in at the bottom of the list and also add a log message to the bottom of that enumerated list. This tells the code what stuff it should be concerned with logging.
Lastly, take a look at the config.h file (I know your not supposed to edit this guy, but I’m pretty sure I’m not breaking anything with this modification). There is a DEFAULT_LOG_BITMASK definition that needs your mask_log added to the list.
Basically, what you are doing is telling the code about another data packet that needs to be written, setting up the data structure for the packet, and then calling the function so that data is written. So I have done all this, but I am still having issues getting my data to be written and recognized by GCS. So if any of the dev’s see this post, please help us both out! I hope this helps give you some basic direction, and let me know if you make any progress!
Also, check out DataFlash_test.ino example file.
In this post: diydrones.com/forum/topics/incpo … -log-files I have posted some code that reads sensor data from an external Arduino Nano via i2c and records the values to the APM log. This might provide some insight as to how you might achieve what you want. Feel free to ask any specific questions
can you explain how did u added the i2c sensor,
what did you had to change in the code.