Attaching LED's to CrazyFlie 2.0 and OpenCV

Firmware/software/electronics/mechanics
Post Reply
nursy123
Beginner
Posts: 1
Joined: Thu Aug 17, 2017 3:24 pm

Attaching LED's to CrazyFlie 2.0 and OpenCV

Post by nursy123 »

Hello,
I am required to find the position of crazyflie 2.0 using my laptops camera in 3D space and then control it later on.
I have thought of attaching small LED's on each rotor and using OpenCV to detect the LEDs. How can I connect LEDs to the crazyflie using the power supply from its own battery? I have purchased the breakout expansion board.. any help welcome!

Also anyone have experience in OpenCV who can help me with a few problems ? thanks!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Attaching LED's to CrazyFlie 2.0 and OpenCV

Post by arnaud »

Hi,
You have both the battery voltage (VCOM) and a 3V regulated voltage (VCC) accessible on the breakout deck. Your question is quite wide so I am precising: you must put a resistor in serie with the LED to limit the current. The max current you can pull on VCC is 100mA.

If you want to be able to switch on and off the LED from the Crazyflie you can look at this hackster project that documents how to connect 3 LEDs on GPIO: https://www.hackster.io/evoggy/flying-t ... ght-8be87d.

A while ago I made a Crazyflie detector with OpenCV that detects the LED ring: viewtopic.php?f=6&t=1193&p=12232#p12232. It worked very well and it uses the pose estimation capabilities of OpenCV. You can also look at the AR detector that was done a bit before the led ring detector: https://www.bitcraze.io/2017/04/updated ... an-filter/

One key thing I found for detecting LED is to set the webcam exposure time to the minimum possible: It allows to very easily detect the LED (the led will be the only bright point) and it removes almost completely motion blur.
Astrobiologist
Beginner
Posts: 25
Joined: Fri Jan 19, 2018 10:35 pm

Re: Attaching LED's to CrazyFlie 2.0 and OpenCV

Post by Astrobiologist »

This has the potential to be an excellent first project for basic IO off the pins (turning GPIO pins on and off, by extension using them as input pins, etc) but I really can't make out the C at all. I suppose there's not much you can say except that I should study C hard....
I have coded for Arduino a bit, usually turning pins on and off etc has rather fewer steps. Is some of this unique to the CrazyFlie somehow?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Attaching LED's to CrazyFlie 2.0 and OpenCV

Post by arnaud »

For GPIOs, there is an API very similar to Arduino.

You can follow this hackster project that shows how to mount a couple of LEDs on the CF and interface is with a deck driver: https://www.hackster.io/evoggy/flying-t ... ght-8be87d. It is not as easy as Arduino but we have put some work at making the deck driver easy to write. There is some doc on the wiki: https://wiki.bitcraze.io/doc:crazyflie: ... mware:deck
Post Reply