Connecting, Calibrating, and Coding Arbitrary Sensors

Hello, I am interested in installing any type of sensor to be used (or simply logged) by the APM system.  I'm having difficulties sifting through all this information and finding a good example to follow about how the code is written and implemented as well as physical constraints like voltages, digital vs. analog, which pins and so on.

A concrete example that may open door to understanding would be installing both a sonar unit and pitot tube with differential pressure sensor onto a quadrotor which has front assigned to it.  Currently, Mission Planner identifies the signals from pins at A0 to be used only for sonar.

3691091301?profile=original

This is the airframe I'm currently working with; it has pretty beefy suspension but I'm comfortable from dropping it from waist height without worrying about damage.

A later challenge after getting both the sonar and pitot working will be finding or implementing code that automatically controls yaw to forward face when in simple flight mode because I want to reassign that channel for other uses.

Any thoughts, advice, tutorials would be greatly appreciated.

Thanks, MCB

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

Join diydrones

Email me when people reply –

Replies

  • Hi Martin,

    In response to Adams post here: http://diydrones.com/forum/topics/incporating-sensor-data-into-the-..., I recently wrote some code that allowed me to connect up an external Adruino (Nano) and attached sensors and to send the sensor output values over i2c to log them on the APM. The code pretty simple but it may serve as an example that assists you in your endeavours... Using an external device to monitor (and potentially process) sensor output makes sense when using the APM since it is lacking capacity and you wouldn't want to compromise the flight controller but direct sensor connection should not be a problem on the Pixhawk

    James

    • Thanks for all the input and insights, I look forward to putting them into action.

      MCB

  • Thanks Micheal but I'm not quite there yet. I just got done building a controller for a camera gimbal and am wanting to put light bars on my toy and really didn't want to modify or construct a whole new power system, but then it hit me... Dummy why don't you just use all those inputs and outputs on the existing Arduino compatible 2.6 board. With a bit more digging I found the solution to the multiple sensor and output problem that started this discussion.
    These two links were invaluable:

    http://copter.ardupilot.com/wiki/programming-arducopter-with-arduino/

    http://firmware.diydrones.com/Tools/Arduino/How%20to%20Build%20Ardu...
  • Moderator
    For developing towards generic sensor support, I'd recommends taking it up the abstraction layer some. Why stop with just analog sensors? I recommend looking at generic ways to adapt all types of sensors (analog, digital, ttl) that one might find in raw form, and creating some tiny CAN, i2c, spi, or other translator. I lean towards CAN. I think it's a better fit, but the pixhawk has no shortage of data busses. Just a suggestion. You may want to talk to nicadrones, the guy behind opengrab, as he'll be releasing a tiny daughter board that converts his v2 opengrab board to CAN in a couple of months.
This reply was deleted.

Activity