Hi all, I have an interesting challenge for you.
I was recently approached by someone wanting to make a light map of an area. The light readings would be correlated with some sort of spatial data to ensure there is appropriate levels of light throughout the area. Some requirements are that the spatial data be accurate to +/- 1 foot, and the light reading (foot candle or some equivalent) be accurate to 5%. This would be driven manually at first, with automated pathing down the road.
I believe the easiest way to accomplish this is to use GPS, a few photodiodes which output an average value, and an Arduino with a USB for saving as the payload of a copter or rover. It would be preferable to output a reading every distance rather than time based.
Is there a way to integrate this into a Pixhawk system? The closest way I know would be to output a signal from the APM causing the Arduino to take and save a reading, or just trigger distance off of the Arduino GPS. If we could eliminate the Arduino GPS, and use the GPS on the copter that would be an added bonus. See the attached document for an example of the final product.
If any of you have seen similar projects, or have any cool ideas about how it could be done, leave me a reply!
Replies
A few thoughts.
Triggering based on distance or time is already implemented in the camera control features, this will also allow you to do automated path planning. You can read about that here http://copter.ardupilot.com/wiki/common-apm-to-chdk-camera-link-tut...
In this tutorial the camera is essentially connected to a digital output of the autopilot, and this output will go high to trigger the camera after the set distance or time has been passed, or it can be triggered at specific gps points.
The gps locations where the digital output was triggered are stored in the log files, so you can parse them after the flight and get the locations back. I also recommend that you get an sd card shield or similar to write your data onto so you can easily get it off of the aircraft.
Good luck!
Thanks Justin!
A few questions...
Is there an easy way to extract the GPS locations and use them for the camera locations? Or is this done manually?
Edit: Found this!
Yep it looks like you could use the location KML button to get a file with the positions. Co workers of mine have written scripts that go through the log file and pull them out, but if you can get the kml file out that would likely be easier for you..
Hi David,
I recently connected an Arduino to the Pixhawk using the TELEM2 serial port. The Arduino was setup to read sensors over i2c but could have been measuring a number of sensors on any of its other interfaces. In my case the Arduino just feed data to the Pixhawk at 10Hz where it was logged (dataflash) and feed back over the telemetry link for live viewing. Although I only implemented serial coms in one direction, there is no reason why you couldn't use the Pixhawk to send a command to take a reading at some specific point. I doubt that you need to do this though as it would be no big deal for the Pixhawk to log this data at even higher rates. You could then download the log and pinpoint the readings that match the locations you are interested in - I'm sure that the extra data would prove useful
Hi James, thanks for the reply!
Did you have to do anything other than plugging the Arduino into the Pixhawk TELEM2 port to get it to transmit back in the telemetry data (on the Pixhawk side, I know you have to output data to serial com from the Arduino)?
I'd love more information about your setup! It sounds like I'll need to do close to the same thing. If you followed any tutorials or anything, a link would be awesome.
David,
TELEM2 by default outputs Mavlink data. I had to alter the code to get the functionality I needed. The Pixhawk actually has a couple of spare ADC inputs that you could use instead - thus avoiding using a separate Arduino board. In my case I needed to potentially interface to multiple sensors using i2c so found using the seperate MCU easier (i2c on the Pixhawk is not so straight forward). I do not know of any tutorials as such but there is some information in this thread that should help:
http://diydrones.com/forum/topics/custom-sensors-and-real-time-logging
In your case, you should be able to put together your photodiode circuit to output an analog voltage and connect it straight to the Pixhawk. Following what Kate has done in the thread above, you should be able to log this data at some reasonable frequency. If I understand your requirements correctly, you can then fly a manual or auto mission making sure you are in the desired locations for long enough to catch some readings. You can then download your dataflash log and extract both the light sensor readings and corresponding GPS locations. The dataflsah log once downloaded using Mission Planner is a relatively simple text file and you can import it into Excel or parse it with your own code process the data. With this setup you will be recording much more data than is necessary but this should definitely include the points of interest as well. If you really need to only take readings at specific points then this is doable with a bit more effort.
I'm not sure how you are going to get ~1ft positional data but the standard GPS units we are using will not give you this. I have been testing the new Ublox M8 recently and have seen the best performance of any GPS unit I have tried to date. Recording data from a known location over a half hour period gave approx 95% of all points within 500mm of the actual location (a survey benchmark) . This was under very good conditions with up to 21 satellites in use (GPS/GLONASS/QZSS). In order to get better accuracy you would have to look at the likes of an RTK system such as the Piksi however the Pixhawk does not directly support this system currently and getting readings from the Piksi into the Pixhawk would require further custom development...
I am happy to help out if you get stuck.
Hi James,
You said you hooked up an arduino to the pixhawk. I'm trying to do the same, but when I plug the +5V output from the pixhwak telem port to the Vin of the Arduino and the GND to the GND of the arduino, Pixhawk doesn't even switch on, like if it goes in a safety mode. Am I doing something wrong?
If you can get the Arduino to do it, fly the arduino. You don't want too much other sensor code getting in the way of flying code.