long time consuming process in main loop()

Hi,

I would like to get the values from a digital sensor DHT connected to A0 pin. I want to perfom this in the Arducopter main loop: certainly I will implement it in fast_loop()  every 2 seconds (using a counter: fast-loop is 100Hz so every 200 fast_loop() call).

The problem is that  the process takes around 4ms and must be  performed in a very strict timing to get the values. The process is 4 milliseconds every 2 seconds.

My question is : will I have problem ? I need to keep all flying process available (IMU, GPS, RC commands...)

Thanks for your replies

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

Join diydrones

Email me when people reply –

Replies

  • Thanks all for the replies.

    I started from the arducopter programm and could do an acquisition but I am disapointed: the library provided by adafruit to use its sensor doesn't work with the ATMEGA 2560 (I suppose), I could do an acquisition about 1 time on 100, all the other acquisitions provided bad values with bad checksum. I used the fastloop and removed all the arducopter functionnalities so that the Atmega can be fully operationnal for this sensor....:-( I continue on the other part of the project, the most difficult : climb to 3000/4000 meters QNH for measuring atmospherics conditions (temp-humidity and wind). I am just finishing to build the octo-copter (quad octo).

  • Developer

    4ms is very long so it will certainly disrupt the main loop.  Even in stabilize mode about 75% of the AVR's CPU is consumed.  Once in Loiter, RTL, Auto it jumps to nearly 100%.  If you use a Pixhawk or PX4 you won't have any problems of course because only 11% of the CPU is used.  Of course because it's only running at 0.5hz I suspect the impact on the main loop won't be visible to a human, it'll probably only be visible in the logs.

    What does "DHT" stand for?

    By the way, it looks like this discussion is in the ArduPlane category..I saw it anyway but..

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…