Adding an external sensor

Post Reply
Posts: 3
Joined: Tue Jul 17, 2018 12:32 pm

Adding an external sensor

Post by wannacrypt_ » Mon Aug 20, 2018 1:07 pm


I want to add to the CF, the following air quality sensor: ... r/overview.
Then I want to log the data from that sensor.

I'm new to writing a software to embedded processors (MPU).
I'd be happy if someone could explain in detail what changes(altering the makefile, drivers, etc.) should be done in the crazyflie-firmware.
The Adafruit CCS811 air quality sensor supports I2C, so the communication should not be a problem.

Another issue is, it seems Adafruit CCS811 library is written in C++, and to the best of my knowledge the crazyflie-firmware is written on C.
Will it cause a problem? If so, what change could be done in order to overcome this problem?

Thanks in advance!

Posts: 1939
Joined: Tue Feb 06, 2007 12:36 pm

Re: Adding an external sensor

Post by arnaud » Wed Aug 22, 2018 9:00 am

To get started you can look making a deck driver: ... mware:deck. Following the howto from the wiki should allow you to get your own code running in the Crazyflie.

As for the lib in C++ it is going to be a problem, it is not possible to use C++ in the crazyflie-firmware out of the box and even though in theory it should be possible to compile your C++ code independently and then link it with the Crazyflie firmware, last time I looked at that I ended up porting the driver I was interested in from C++ to C (this became libdw100).

If the chip is 'easy' to use, the easiest is to access it directly using the I2C bus. If you want an example of how to communicate with an I2C device you can look at this I2C GPIO driver: ... /pca9685.c.

Post Reply