SparkFun Forums 

Where electronics enthusiasts find answers.

Hardware or product specific questions are best asked here.
User avatar
By Max.P
#218653
Good day
I`ve ordered SparkFun OpenLog Artemis to use in my project with DSLR camera.
My goal is to catch precise timestamps of camera´s shutter events on OpenLog´s SD card, along with precisely time stamped IMU data for further processing in 3D reconstruction software. The main thing is to associate IMU XYZ data with photos.

It is theoretically possible when using a Hot Shoe adapter like this.
https://www.seagulluav.com/manuals/Seag ... Manual.pdf
https://www.3dxr.co.uk/product/1776/

When DSLR camera takes a picture, at the exact moment when the shutter is fully opened, it shorts the central pin on the Hot Shoe to ground (the sides of the hot shoe).
Normally when external flash is installed on top of the camera, the flash itself supplies voltage to the central pin. When the camera shortens central pin to the ground, it lets current flow through the camera back to the flash, which triggers the flash´s discharge circuit.
All the process takes 1/250 of a second.

What I want to do is somehow connect the mentioned above Hot Shoe adapter to my SparkFun OpenLog Artemis´s AD input and get the timestamp in the log file.
This Hot Shoe adapter is designed to work with AD inputs of Pixhawk controller.
https://ardupilot.org/copter/docs/commo ... rview.html
It has 3 wires: ground, power and signal that connect to one of Pixhawk´s configurable AD inputs/outputs (each one is 3pin, numbered from 1 to 6).

Hot Shoe adapter manual says the Pixhawk must be configured to register Trigger LOW events. See https://www.seagulluav.com/manuals/Seag ... Manual.pdf
I´m not 100% sure but seems that this Hot Shoe adapter constantly passes through itself input voltage from Pixhawk´s power pin back to Pixhawk´s signal pin. And when camera triggers it briefly shortens signal to ground and Pixhawk registers Trigger Low event.

OK, that´s fine. Now I have to somehow register this event using AD input of OpenLog Artemis.
OpenLog´s datasheet does not provide much information about configurability of AD ports.

All I know is:
• Supported voltages 0-2v (to register value with AD), 3.3v limit not to burn something
• Supported refresh rate 1000Hz and above
• Configurability: only to turn on/off registering AD input

Knowing that I see two global ways to register Hot Shoe data:
1. Inefficient. Pass through Hot Shoe adapter VCC voltage from OpenLog Artemis back to OLA AD pin. Constantly register voltage values (99,97% will be 3.3v). Register voltage drops (0,03% will be ~0v). Photo session duration time will be 10-30 minutes (with 1000Hz that’s a lot of data). After that process all data with Python script to filter out 3.3v and get only voltage drop events
2. Efficient (maybe). Make some circuit that will output 2v square signal to OpenLog Artemis every time the Hot Shoe triggers low. Log file gets only events´ data. This approach assumes that OpenLog Artemis does not register 0v values.
Which one is better, what do you think?

Or maybe it is possible to open a new feature request (would be awesome!)
I mean somehow modify behavior of the OpenLog Artemis AD input logger through firmware or configuration. Add functionality to trigger low, trigger high and also add a way to set voltage filter, in order to register only needed levels.
If it´s possible, I kindly ask to create a new feature request.
I´m ready to participate in implementing and testing this feature and share my results here.

Additional questions:
• If input voltage is 0v does the OpenLog Artemis continue to write zeroes to SD card? Or it logs data only if voltage is above 0v?
• Will the OpenLog Artemis be capable of registering high rate IMU data (200Hz), along with high rate AD input data (1000Hz) and along with other sensors (GPS, etc.)? What SD card will you recommend to eliminate possible bottle neck? Or it writes to some RAM buffer and only periodically saves data on SD card?
• What are the input current limitations of AD pins of OpenLog Artemis. Obviously I have to protect them from overcurrent and overvoltage events. I also consider buy something like this adapter https://www.amazon.com/Vello-TTL-Off-Ca ... B005GMWEI8 and cut down the wire to use it as a Hot Shoe adapter. I´m a network engineer and junior level Python programmer with limited knowledge in electronic engineering. Would appreciate any advice on creating custom cable using this and protecting it with additional circuit (Zener diode etc.)
• From what pin it´s better to take voltage from the OpenLog Artemis board to power Hot Shoe adapter in order not to burn anything

P.S. Sorry if my English is not perfect, this is my 3-rd language

Thank you
Regards
Max P.
User avatar
By PaulZC
#218673
Hi @Max.P,
Thank you for your message. (Don't worry - I think your English is very good!)
Correct, you can configure the OLA so it will log analog readings from any of the four breakout pins (11/TX/RX/32).
These will be logged with the sensor data at whatever rate you have selected using Menu 1 Option 4 or 5.
The pins can measure analog voltages between 0V and 2.0V. The pins can accept voltages up to 3.3V, but you will see 2.0V as the logged voltage. Voltages higher than 3.3V will damage the Artemis.
You can use a voltage-level translator to convert (e.g.) 5V signals down to 3.3V:
https://www.sparkfun.com/products/11771
Yes, the OLA will log the voltage every reading, even if it is zero. So, yes, you will need to log a lot of data to capture these events.
It would be possible to design a circuit that would convert the quick shutter signal into a much longer pulse. Then you could log data at say 1Hz and still capture your shutter events. It _might_ be possible to do it with this product:
https://www.sparkfun.com/products/15353
but I see that it is out of stock at the moment.
Another user has asked for a "trigger function" to be added to the OLA, and I think this may be exactly what you need:
https://github.com/sparkfun/OpenLog_Artemis/issues/36
With this new feature, you could connect the shutter signal to pin 11. The OLA could be triggered on the rising edge of the signal and would log the sensor data once, before waiting for the next pulse. You must still make sure that the voltage is no higher than 3.3V.
The new trigger feature should be available this week. You can "watch" the issue on GitHub and we will notify you when the new version of the OLA firmware is available. You can then upgrade by following these instructions:
https://github.com/sparkfun/OpenLog_Art ... UPGRADE.md
Very best wishes,
Paul
User avatar
By Max.P
#218679
Hi Paul!
Thank you for detailed response!

I think this new "trigger function" feature will possibly solve the problem. I will try to make an external circuit that would be able to start/stop logging using pins 11 and 32.
As I understood, this new feature only permit start logging process, and I have to take care of stopping it after every shutter event using pin 32.
Am I right?

Anyway, I always have option to extract all data and post-process it with python script.

I still have some questions, kindly ask you to clarify them:

1.
Overvoltage is not an issue as I will source input voltage from OLA board itself from 3.3v rail.
This Hot Shoe board https://www.3dxr.co.uk/product/1776/ passes the voltage that I give to it (from OLA´s VCC pin for example) back to OLA´s AD input (pin 11) effectively creating alternative “power” circuit (correct me if I´m wrong). And I´m concerned about overcurrent-ing the AD input and burn it.

I think this Hot Shoe adapter has some kind of protection but I don´t want to rely on it.
I would like to know what are the OLA´s AD input max current capabilities (and also current requirements for reliable signal reading) to add some input protection (resistor and Zener diode). Would be awesome if you can recommend me this resistor value for 3.3v.

I´m asking this because I´ve already burnt various equipment (including expensive boards :))) ) during my 20 years of network engineer´s field experience , and I don´t want to burn OLA either, especially because it takes several weeks to get it here in Portugal.

2.
Will OLA be capable of simultaneously writing data streams to SD card form AD at 1000Hz, internal IMU at 200Hz and external Sparkfun F9P GPS at 10-20Hz? I mean, I understand that data speed is not an issue (modern SD cards are pretty fast), but latency can be prohibitive. What do you think?

P.S. If I will be able to reliably log Hot Shoe events I will definitely buy Sparkfun GPS F9P board to integrate in my project. By price compared to functions this Sparkfun kit will be an excellent choice.

P.S.2 It´s already clear that Sparkfun team is very professional, I´m glad that I´ve found your site.

Thank you!
Max
User avatar
By PaulZC
#218689
Hi Max,
Version 1.6 of the OLA firmware has just gone live. You can upgrade your OLA by following the instructions here:
https://github.com/sparkfun/OpenLog_Art ... UPGRADE.md
The release notes are here:
https://github.com/sparkfun/OpenLog_Artemis/releases
The new trigger function allows Pin 11 to act as an interrupt source. Once enabled (see the release notes), a falling or rising edge on Pin 11 will trigger a sensor reading. The OLA will log data on every rising or falling edge, depending on which you have selected. I think this does exactly what you need - but I might be misunderstanding your project?
I am not able to find a schematic for the hotshoe adapter. But, yes, if the adapter is powered from the OLA's 3.3V pin, then there should be no risk of damaging Pin 11. You can find the pin current capabilities in the Apollo3 datasheet (https://cdn.sparkfun.com/assets/d/a/7/c ... v0_9_1.pdf). See Section 21.1.
Please be aware that you will really be pushing the limits if you want to log fast analog, IMU and GPS data simultaneously. You may need to use multiple OLAs to be able to do this. You will need to try some tests and experiments!
Good luck with your project. I hope V1.6 does what you need it to do.
Very best wishes,
Paul
User avatar
By Max.P
#219951
Hi Paul!

I've finally got the OLA board and already tested it and it is awesome

Falling edge signal registration on pin 11 works perfectly with 1/100 second accuracy
I've connected it to my DSLR's hotshoe and got IMU data with precise timestamps for shutter events
DataLog file receives only the events’ data, no unnecessary dummy load in file

I’ve had some issues and I’m not sure what caused them. Sometimes corrupted file appear on flash card with name including symbols @ and others. It’s not possible to delete it, only format SD card. But for now it is ok.

I’m using OLA with Ardusimple Ublox F9P, registering UBX RAW data over serial port with additional UBX-TIM-TM2 messages, containing shutter events with precise GPS time marks
I’m using “normal” OLA firmware version v1.6, not GNSS because it has no trigger on pin 11 functionality and I use serial port to send UBX messages
UBX data gets written on low latency SD card in SerialLog.TXT file and RTKLIB is able to post process it
I’ve attached OLA to my camera and connected hotshoe signal in parallel to OLA (pin 11) and Ublox F9P (EXTINT pin)
With some post processing I was able to join GPS shutter events log with OLA IMU shutter events log
Even that each log file has different time marks, it is possible to manually match shutter events and get GPS+IMU data in one file

Now with practice appeared some «feature requests», if I can call them so:
1. Add 3rd (4th, 5th, 6th!!! more is better) digit after decimal point for OLA IMU time marks, making event logging with millisecond resolution (as UBX messages normally contain GPS time with millisecond accuracy, and even with nanosecond precision considering UBX-NAV-TIMEGPS message)

2. Make OLA synchronize onboard RTC clock with GPS time using SERIAL port
I’ve seen in OLA’s description following information:
“If you have a u-blox Global Navigation Satellite System (GNSS) module attached, you will see an extra option “8” which allows you to set the time to Universal Time Coordinate (UTC) using GNSS.”
But I do not see any option “8” in my OLA menu
And I also found “getRTCfromGPS=0” parameter in OLA configuration file, changed it to 1 but with no result
Seems that this information is only applicable to I2C Qwiic connected Ublox F9Ps
I have first revision of Ardusimple SimpleRTK2B board, which does not have I2C Qwiic ports – only UART
So I kindly ask to add a function which can read GPS time from SERIAL port. If it will be able to constantly update OLA’s RTC time with f.ex. 10 second interval from UBX-NAV-PVT message – would be awesome
If it’s hard I will accept and will say “big thank you!” if you add a “one time” on demand RTC sync function to manually sync over serial port
If UBX messages are hard to parse – we can use NMEA GGA or NMEA PUBX text messages to get time data, but NMEA has only 2 digit precision, and UBX has 3 or more

3. Add AHRS output option for IMU
Now IMU outputs “raw” sensors data: rtcDate,rtcTime,aX,aY,aZ,gX,gY,gZ,mX,mY,mZ,imu_degC
Photogrammetry software accepts degree values: Euler Angles - Roll (x), Pitch (y) and Yaw (z)
For me it is pain to convert the IMU data, I need to somehow adopt MahonyAHRS and MadgwickAHRS Libraries or other instruments to post process IMU data. These libraries are written for Arduino and I work with Python.
Maybe you can integrate this option in OLA’s menu to give user a choice – what format he wants to see “RAW” or “AHRS”
If it is not possible, please give me an advice – what instrument should I use to post process IMU data to get Euler Angles
I’m new to this field. I’ve read some about these algorithms. Many questions arise: what about sensors calibration? What about quantity of data, will shutter events only be enough for calculating Euler Angles or I have to write IMU log continuously?

Thank you

Regards

Max
User avatar
By Max.P
#219952
Maybe this will help, I’ve found in datasheet here https://cdn.sparkfun.com/assets/7/f/e/c ... 8-v1.3.pdf :

“2.4 DMP FEATURES
The DMP in ICM-20948 includes the following capabilities:
• Offloads computation of motion processing algorithms from the host processor. The DMP can be used to minimize power, simplify timing, simplify the software architecture, and save valuable MIPS on the host processor for use in applications.
• The DMP enables ultra-low power run-time and background calibration of the accelerometer, gyroscope, and compass, maintaining optimal performance of the sensor data for both physical and virtual sensors generated through sensor fusion. This enables the best user experience for all sensor enabled applications for the lifetime of the device.
• DMP features simplify the software architecture resulting in quicker time to market…”

And here https://invensense.tdk.com/developers/s ... enter-faq/ :

“Euler angles are a representation of an angular frame, as are quaternions and rotation matrices.
Euler angles are a set of three angles, corresponding to pitch, roll, and yaw.
Euler angles may be constructed according to many conventions. The axes of and ordering of ordering of pitch, roll, and yaw vary by convention. The Embedded MotionApps Platform makes Euler angles available in the three most common conventions with MLGetEulerAnglesX, MLGetEulerAnglesY, and MLGetEulerAnglesZ. See the Embedded MotionApps Platform Functional Specification for specific details on the definition of these conventions…”


Seems that ICM-20948 provide:
- Getters for Euler Angles
- Self calibration

If I understand this right, it will be relatively easy to add pitch, roll, and yaw data output

Thank you

Regards
User avatar
By Max.P
#219953
https://github.com/sparkfun/SparkFun_IC ... y/issues/1

Here the DMP question seems to be solved (40Hz yaw/pitch/roll over i2c)


https://github.com/micropython-IMU/micropython-fusion

Here "fusion.py" file contains all the math magic to convert RAW to AHRS
But it's not that useful since ICM-20948's DMP is able to provide yaw/pitch/roll


Maybe all this helps

Thank you

Regards

Max
User avatar
By PaulZC
#219961
Hi Max,
I am very glad the trigger function is working for you.
Can you please raise two "feature request" issues on GitHub?
One called "Feature Request: Add milliseconds to time stamp" and a second, separate one called "Feature Request: Add IMU Euler Angles".
Here is the issues page:
https://github.com/sparkfun/OpenLog_Artemis/issues
Here is an example:
https://github.com/sparkfun/OpenLog_Artemis/issues/42
Please provide as much information as you can about how each feature should work. You can just add a link to this discussion if you wish.
Please note that the DMP is not currently supported by the IMU library, so it may take a long time before we can implement the Euler angles.
I'm afraid there is really no way we can add the "sync to GPS time over serial" feature. You will need to connect a sensor via I2C if you want to do that. Or write your own code? :D
Best wishes,
Paul
User avatar
By uygarkuzuoglu
#226690
Hi. Can ı learn how to log yaw pitch roll to SD card. I'm trying to make my mobile mapping system too. I will use 4 camera . I have Tersus BX316 Multiband GNSS receiver ( there is no IMU inside of tersus ) . I want to log yaw pitch roll of each camera . I upload this library (https://github.com/sparkfun/OpenLog_Art ... _DMP_Quat9 ) to openlog artemis board. İt is work but it is not logging to sd card , for this, I had to write code myself, but I do not have software knowledge.

And , did you connect hotshoe signal cable to pin 11 ? without any electronic parts ?
You do not have the required permissions to view the files attached to this post.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]