CHDK, KAP Script and accurate timestamping

I've been trying to improve the accuracy of the geotagging of images produced using a Canon S100 running CHDK and the KAP lua script, shutter triggered by Pixhawk via a CamRemote device.

I've been getting good results, but the accuracy of the geotagging is limited by the 1 second resolution of the timestamps for the images. Clock on the camera is synced via GPS time.

The KAP script, however, is able to log the shutter release time to ~10ms precison, which should be good enough for quite accurate geotagging.

Can anyone tell me how to incorporate the accurate time information into a geotagging procedure? Editing the exif data on the images doesn't work as the datetimeoriginal value can only be defined down to a second.

The ideal would be to add the geolocation data to the images using the flight logs and the KAP script log, but any reasonably streamlined way to produce a geolocation file for the images which could then be imported to Pix4d etc. would do the trick.

KAP log file attached in case of any use/interest to anyone.

Thanks very much...


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Hi – Can anyone help with getting the settings correct for the inclusion of the GPS data on a Canon S100. I have been using a series of Canons with good success but picked up a S100 on ebay the other day.

    I have loaded CHDK 1.4 and am using KAP 3.7 HERE.

    I would prefer to operate with a USB trigger which I have set up and working with setting ok in Pixhawk. Have been successfully triggering A2300's.

    How long do you give the camera to get GPS registering - how far in advance should I turn the camera on?

    These are the settings I am quering: (there may be something I have missed)

    In the CHDK > GPS settings>Tagging – settings>

    Save waypoint to each JPG                        [0]

    Waiting Time for GPS-Signal                      [60]

    Time to change to play-mode                     [1]

    Shutdown backlight                                   [ ]

    Time to deactivate backlight                       [ ]

    Delayed Tagging – Short string                   [ ]


    Also on the Script menu:

    Shot Interval (sec)                                    [Fast]

    USB Shot Control                                     [Oneshot]

    Logging                                                   [SDCard]

    Hope you can help



    • Hi there, the canon OSD (as opposed to the CHDK one) has a satellite symbol which tells you when the camera has locked on. It's usually pretty quick.

      I've never changed any of the CHDK GPS settings from default, just enable GPS in the camera menus and it will geotag, likewise enable auto time update.

      Triggering reliably is a bit of an issue - best results I have achieved are with a vp systems cam remote and KAP set to oneshot, but this will only trigger every couple of seconds reliably. I've more or less dropped it if the required image rate is anywhere near that, the built in KAP intervalometer is more reliable. In theory setting KAP script to Pixhawk mode should set focus, exposure etc. on the first trigger then subsequent triggers will be able to fire up to every half second or so I think, but not spent much time trying to get that working. Triggering directly from the aux pins on the pixhawk doesn't work as the camera needs to see 5v for the usb to register.

      • Thanks Charlie – what is canon OSD?

        I have managed to trigger quite successfully in the past using A2300’s but get intermittent image quality. When surveying over areas on the coast where there are dramatic contrast changes, the images are too dissimilar and although I can mosaic them the composite looks wrong. I got the S100 in the hope that it would give better results as well as the added GPS.

        I have sorted the 5v issue with the addition of a 5v BEC but would like advice on the settings in my post above.


        • I just mean the standard canon on screen display, top left corner of the screen is a sat icon, seen in the screnshot here showing no lock.

          on the script menu, try setting shot interval to burst and usb shot control to Pixhawk, that should enable a decent shot rate, but the camera settings will be locked by the first image so might not be ideal for the case you describe above. I tend to just fly slower if flight endurance permits, sometimes as slow as 1m/s. I found the KAP focus at infinity setting did not work on my camera  Image quality/consistency does improve significantly flying at a snails pace.

          • Thanks I'll give it a go


  • I'm struggling with this as well. I'm using a Sony A5100 for mapping and taking a picture every 0.7 seconds. My thought was I could solder leads to the flash, but the voltage is crazy high (I know because it hurts, haha). Surely the must be a board that will take whatever voltage and send a signal. A relay in reverse I guess. In reading the threads concerning the pixhawk integration there are discrepancies between the signals sent to the flash by the different kinds of cameras. The signals would be better from a voltage standpoint but more difficult to hack.

    In the meantime I take the first image and line them up with the cam messages. Mission Planner's tool does the same, but then if there is a discrepancy between the time of the picture and Gps log (I.e. A missed picture) then it accounts for it and keeps going instead of failing.

    Sounds like you've already got the timing figured out. I use a script in c# or python to change the exif to match the Gps. I could adjust it to use what you have in your KAPscript instead of the pixhawk log. if the script has the image name and the accurate time it sounds straightforward to then match it with the Gps log.

    Others probably have better solutions, and I'm looking forward to hear how they would do it.
    • So you can define the exif data down to millisecond resolution? When I have used exiftool to change the timestamp it doesn't save the extra decimal places, and so I had thought that route wouldn't work...?

      I've been looking at upgrading the camera - the Sony A6300 looks promising, with the hotshoe it will soon be possible to have the cam_trig message accurately stamped via feedback from the camera I think (

      But it would still be good to get everything working with the S100, the Emlid Reach RTK kit will hopefully soon be working with apm so that in combination with the KAP script timings should be a simple testbed for GCP free mapping.

      Anyway, thanks for your reply, and likewise interested to hear what people have come up with...

      • I don't bother putting the time into the exif data, just the Gps coordinate. The program just has to match the image with the right coordinate. Matching the times is the easiest if you have accurate enough time which it sounds like you do. I have to resort to some pattern matching.

        I agree, the A6300 looks perfect for our purposes.
        • Would it be possible for you to share your method for tagging the images?

          I'm afraid I have no coding knowledge - how straightforward would it be to make a script to do as you describe above?

          QX1 announcement was interesting...

          • I have to do a bit more testing and integrating of the sript with our method. Tell me a bit about your computers and workflow and I think it will be a simple thing to integrate your scripts into what I have. If not, I'll let you know and give you what I have. Here's what I need to know: - Your operating system (Windows, Linux, Mac) - Copies of what GPS data you are working with. - A copy of the KAP Script and an explanation of how it's used. My script will take a folder of pictures and a data flash log out of the Pixhawk, parse through it, ask you to match the first cam message with the first picture, and then put the GPS data into the picture EXIF. There's more I want to do with it, but that's what it does at the moment. It's supposed to be robust enough to handle if a Cam message was sent, but no picture was taken, but that's not guaranteed (not enough testing, especially when the pictures are taken less than a second apart, so the timestamp on the picture is the same). It sounds like the KAP script gives you a definite GPS Coordinate to Picture ratio, so I think it will be a simple process since I already have the EXIF writer working.

This reply was deleted.


sam liked Jimmy Oliver's profile
Aug 25
Mike Whitney liked Mike Whitney's profile
Jul 19