Outputting 3.3 ADC V data to logs

I want to log the voltage readings from a alpha beta vane through the 3.3 ADC V port in a Pixhawk. The default code does not support this. What modifications would I need to make to have the voltages appear in the log files?

1 Like

Hi Deafro, did you find a solution to this? I am also interested in doing something similar

I’ve progressed on some leads, but have yet to get a optimal solution. The developers told me that adc_report collects this data. So to send it to sdlog requires just subscribing it to sdlog2.c. The guide to it is in the link below. You might have better luck than me getting it to work.
http://dev.px4.io/tutorial-hello-sky.html

Another way is to use pyulog and list the subscriptions you want in a text file on the SD card. The guide is in the link below.
http://dev.px4.io/advanced-logging.html

If you have better luck with these solutions please let me know.

I just discovered the solution. Here is the firmware that outputs the 3.3 ADC voltage to the log files.

1 Like

That’s great, thank you so much!
Is this firmware what you described in the previous post - subscribing adc_report to sdlog2?

It is the same. I only needed to modify the sdlog2.c and sdlog2_messages.h files. I added “// ADDED BY DEAFRO” to any lines I changed, so that should make finding them easy. You might also want to check adc.cpp, since that is where adc_report collects its data.

Awesome, thanks! :heart::heart::heart::heart::heart:

1 Like

Hi Deafro,

I have uploaded your firmware at https://github.com/Deafro/FirmwareAoASS1
but I don’t see any change to the log files. I have noticed that the firmware make files include all your changes, but after converting the px4log file to .csv using sdlog2_dump.py, and viewing it in Excel, there is no new topic. There should be AOAS_AOA and AOAS_SS after the last cell, PARM_Value, right?

I made some changes to the code recently to add parameter id capabilities, but that shouldn’t be affecting the logging. I tested it just yesterday and its logging the AOAS tree for me. It might be you haven’t asked sdlog2_dump.py to pull data from the AOAS tree.

You’re right, your code works great. I tried to change the name of the topic but I must have missed an instance somewhere, so it wasn’t working. When I upload your code completely unmodified, it’s fine.
Thanks heaps!

Did you make these sensors or purchase them? I’m very interested if you’re able to share details.

These sensors I made myself. I’m using a pair of rotary potentiates to measure the angle of attack and sideslip angle of aircraft in flight. I can’t say much more now, but I will be publishing a more detailed look at the probes construction in the near future.