quadcopter problem discussion notes

Viewed 3 times

Essentially the SDA/SCL reads the I2C values of the accelerometer perfectly fine when no other pin on the pi is active.

I have connected 4 drone propellers and whenever I give thrust to them by writing values to their pins (which have nothing to do with the SDA/SCL pins) for some reason the Gx/Gy values of the accelerometer get affected.

The values seem to have regular spikes in both positive and negative the more I increase the thrust values of the propellers.

I do not think this is a code related issue and more like electronic but just in case here is all the code:

– Main: https://github.com/bkstephen/drone_project_in_python/blob/master/droneLogic.py

– Gyro output: https://github.com/bkstephen/drone_project_in_python/blob/master/gyro.py

  • Hi @Stefanos, Nice to meet you again! (1) Your comment: “SDA/SCL reading I2C values of accelerometer” is a bit confusing. I would say it this way: “The I2C interfaced accelerometer’s readings Gx, Gy”…. – tlfong01 22 mins ago   
  • (2) Your comment: “Accelero working perfect if other GPIO pins not ‘active'” is a bit confusing for the following reason: If you set a GPIO pin to output mode, it is always ‘active” because it always output either High level signal (3V+), or Low level signal (1V-). So I would say something like this: If one or more GPIO pin is set to output mode, and sending out logical levels High level or Low lever’, … – tlfong01 13 mins ago   
  • (3) Let me describe your problem in more details. (a) I first setup and read the I2C interfaced accelerometer readings Gx, Gy with any problem. (b) Then I connect, say, 4 Rpi GPIO pins to input, say, PWM signal to 4 propeller controllers to adjust thrust. (c) NOW PROBLEM: if I change GPIO pin signal, say PWM duty cycle, then accelerometer readings are no longer stable, say, with some intermittently, unreasonably higher or lower than moving average readings, …. – tlfong01 17 secs ago   Edit   
  • (4) Let me know if I understanding your problem correctly. If not, please correct me, before I move on. Ah I need to leave now to meet a friend for Saturday brunch. See you later. Cheers. – tlfong01 just now   Edit   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: