Additional sensor doesn't work during flight

Firmware/software/electronics/mechanics
Post Reply
rampudia
Beginner
Posts: 20
Joined: Fri Mar 26, 2021 4:21 pm

Additional sensor doesn't work during flight

Post by rampudia »

Hi!

I integrated an analog sensor (OPT101 photodiode) to a prototype deck on the bottom of the crazyflie and used it in combination with a lighthouse deck on top. I take several samples from the the sensor, process them internally and then retrieve the result by adding it to a log group. I first tested that the readings work well by creating a python program to log the information without flying (just me holding the CF) and it works as expected. However, when I run the same program with the crazyflie flying autonomously I notice that my sensor readings stop working and return what I believe is just noise.

I first suspected that this could be an electrical problem from the motors drawing power away from my sensor but I see that the photodiodes uses less than 15mA of current. Does this sound like a hardware problem? The analog sensor is connected to the VCC, GND and to the A0 pin (DECK_GPIO_TX2).

Otherwise, what could be changing when the drone is on flight that makes the sensor stop working properly.
rampudia
Beginner
Posts: 20
Joined: Fri Mar 26, 2021 4:21 pm

Re: Additional sensor doesn't work during flight

Post by rampudia »

I took a Task Dump to see that my task (PD-ADC) was not taking too much processing time but that doesn't seem to be the case:

Code: Select all

SYSLOAD: Task dump
SYSLOAD: Load	Stack left	Name
SYSLOAD: 1.18 	153 	Tmr Svc
SYSLOAD: 21.35 	123 	IDLE
SYSLOAD: 0.27 	206 	CRTP-RX
SYSLOAD: 0.01 	77 	PWRMGNT
SYSLOAD: 12.0 	143 	SENSORS
SYSLOAD: 4.98 	0 	PD-ADC
SYSLOAD: 0.0 	246 	LOG
SYSLOAD: 0.0 	195 	MEM
SYSLOAD: 0.0 	164 	CMDHL
SYSLOAD: 0.0 	91 	PARAM
SYSLOAD: 0.19 	55 	SYSTEM
SYSLOAD: 0.16 	57 	CRTP-TX
SYSLOAD: 0.54 	86 	LEDSEQCMD
SYSLOAD: 0.18 	93 	CRTP-SRV
SYSLOAD: 10.78 	57 	LH
SYSLOAD: 1.0 	163 	SYSLINK
SYSLOAD: 19.10 	228 	STABILIZE
SYSLOAD: 28.19 	260 	KALMAN
SYSLOAD: 0.0 	115 	USBLINK
SYSLOAD: 0.0 	105 	PLATFORM-
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Additional sensor doesn't work during flight

Post by tobias »

That sounds like a strange behavior. Can you try removing the Lighthouse deck and fly it manually and see if there is a difference? Does the sensor reading make sense before you take off and then stops working at take off?
rampudia
Beginner
Posts: 20
Joined: Fri Mar 26, 2021 4:21 pm

Re: Additional sensor doesn't work during flight

Post by rampudia »

I am sorry, I believe my problems were due to a hardware issue where one of the pins of the attached sensor floats due to vibrations. When I use a different pcb with the same configuration it seems to work fine.

Thank you :)
Post Reply