Proximity Sensor

Firmware/software/electronics/mechanics
Post Reply
cfusting
Beginner
Posts: 5
Joined: Mon May 20, 2013 7:48 pm

Proximity Sensor

Post by cfusting »

Hi everyone,

Recently I have been playing with the Maxbotix LV-EZ0 (http://maxbotix.com/documents/MB1000_Datasheet.pdf) proximity sensor with the hope of giving the crazflie the ability to detect objects. I'm new to mcu programming but have a pretty good understanding of how the ADC and its dependent components work at this point. Rather than try and fit my additional sensor into the current ADC1 and 2 implementation I've just mapped a GPIO pin from the expansion header to AIN and replaced the battery input channel to get some initial sensor readings.

I've been able to send readings (that appear to be sensing proximity :) ) to the client via consolePrintf but after 3 seconds or so the crazyflie shuts off without giving me any additional information. I've added some logging points throughout the code (in adcDecimate and pmBatteryUpdate for example) but have not found anything abnormal. Sensor readings come back up until shutdown. If I start the crazyflie without the proximity sensor analog output connected to the expansion header it gives me what I believe to be some other voltage readings (due to the open pin?) and will function properly. Its not until I connect the proximity sensor's analog output to the crazyflie that it takes readings for 3 seconds and then shuts down. It leads me to believe that the type of data being read by the crazyflie is causing a memory problem or an illegal math operation but I can't see why?

So I have a few questions:

1. Any ideas why the crazyflie might be shutting off?
2. Suggestions on integrating an additional analog input into the current ADC code?
3. Is it possible to get any additional debugging information without a JTAG dongle?

I'm going to find and buy a suitable JTAG dongle as I don't think programming without a debugger will work in the long term, but I thought I would see if anyone had a thought meanwhile.

Also I believe there is an error in the wiki that describes the Analog Channel mapping on the expansion header. At least in the case of pin 12 (MOSI) and 14 (MISO) these map to channels 7 and 6 respectively as described in the data sheet. It might be helpful for new users like myself if the wiki pointed out the GPIO pin # and channel (A) of the pins on the expansion header as well.

Cheers,

_Chris
DesTinY
Member
Posts: 97
Joined: Sat Feb 09, 2013 5:18 pm
Location: Bünde, Germany

Re: Proximity Sensor

Post by DesTinY »

Hi cfusting,

nice project! Maybe it is also good for the hover mode (sensor fusion with barometer MS5611).
I have mapped two dig. GPIO to the EXT Header as well. And noticed some FW shut downs, too. Due to the work of the Propeller balancing Project, now i remember that the task priority (watchdog) can course our problems. Maybe you can try to spend a extra task for the input readings like this.
If you are using printouts like DEBUG_PRINT() it costs much of the runtime. Tobias has Start of FreeRTOS debugg implementation to show memeory usage and cpu usage which maybe can show this in the future?!.
To show the values in the CF Client it is better to use the Logging function.

I hope that could help a little bit.
cfusting
Beginner
Posts: 5
Joined: Mon May 20, 2013 7:48 pm

Re: Proximity Sensor

Post by cfusting »

DesTinY wrote:Hi cfusting,

nice project! Maybe it is also good for the hover mode (sensor fusion with barometer MS5611).
I have mapped two dig. GPIO to the EXT Header as well. And noticed some FW shut downs, too. Due to the work of the Propeller balancing Project, now i remember that the task priority (watchdog) can course our problems. Maybe you can try to spend a extra task for the input readings like this.
If you are using printouts like DEBUG_PRINT() it costs much of the runtime. Tobias has Start of FreeRTOS debugg implementation to show memeory usage and cpu usage which maybe can show this in the future?!.
To show the values in the CF Client it is better to use the Logging function.

I hope that could help a little bit.
Thanks for your thoughts DesTinY :). I've just figured out that in this case the CF was shutting down because the proximity sensor readings were in the range of very low battery (you will recall that I simply replaced the battery channel with the sensor's channel). Now I can get back to properly integrating the sensor into the existing ADC code.

Tobias' work on the FreeRTOS looks interesting, I'll see how that works for me as well.

Cheers,

_Chris
n0n4m3
Beginner
Posts: 10
Joined: Fri Jun 14, 2013 3:25 pm
Contact:

Re: Proximity Sensor

Post by n0n4m3 »

Hi _Chris,

Keep us informed on your progress with that proximity sensor.
I'm very interested in putting one in my crazyflie but unfortunately I don't have much experience with electronics so it would be great if someone detailed the process of attaching one of these sensors to crazyflie.

Thanks and keep up the great work!
cfusting
Beginner
Posts: 5
Joined: Mon May 20, 2013 7:48 pm

Re: Proximity Sensor

Post by cfusting »

n0n4m3 wrote:Hi _Chris,

Keep us informed on your progress with that proximity sensor.
I'm very interested in putting one in my crazyflie but unfortunately I don't have much experience with electronics so it would be great if someone detailed the process of attaching one of these sensors to crazyflie.

Thanks and keep up the great work!
I've completed my work on the proximity sensor.

You can watch the video and read about it on my blog http://cfusting.wordpress.com/2013/07/2 ... tric-data/. Also you can take a look at the code diff on my fork https://bitbucket.org/cfusting/crazyfli ... c155602c1d.

Cheers,

_Chris
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Proximity Sensor

Post by tobias »

Great achievement and great blog! These kind of developments is why we created the Crazyflie in the first place, a big thanks for contributing!
Post Reply