PID Controller - I2C Bus Noise from ESC

Hi all,

I am working on developing a PID controller designed to hold a levered arm level by controlling an EFlite outrunner motor. The idea being if I can hold one hinged arm level than with 4x the hardware I could make a platform fly. I am using some OSEPP sensors I purchased from Frys: a gyroscope and accelerometer. I am controlling the thing with the Arduino Wire library. However, when I run the motor my sensor values go berserk, making all subsequent PID control meaningless.

3690936850?profile=original

How can I clean up the noise?

From what I have learned, using I2C is not ideal in noisy environments. I have already added two 1.5k pull-up resistors. I heard using a low-pass filter might help, based off an RC circuit, but I don't want to filter my sensor values.

 

Since I have an Arduino Mega, I was wondering if dedicating one board for the sensor reading, and another to the motor control would clear up my values. However, since it seems like the most intuitive to communicate between the boards would also be using the Wire library, I wonder if I would just be extending the problem.

3690937066?profile=original

Maybe I should just buy new sensors?

Any help would be much appreciated :)

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

Join diydrones

Email me when people reply –

Replies

  • Are you having I2C problems?  Doesn't sound like you understand the I2C bus at all.  It's a digital bus, it's going to either work perfectly or hang very quickly and give you nothing.  In many cases if you miss an ack the bus will hang until it's reset or times out.  If you're getting anything other than silence with intermittent garbage it's likely working just fine and you need to look elsewhere.

    If you're using wires longer than a few inches or nonstandard voltages you need to double check your pullup resistors and wire capacitance and/or reduce the speed as needed.

  • I don't think having a separate board would do anything much except make the software more complicated.

    It could be one or more of a number of things.  You might first want to temporarily mount the motor on a solid base away from the sensors and run it up to see whether it's mechanical or electrical noise that's causing the problem.

    Some possible causes:

    • Noise on the 5V supply from the ESC.  Add some capacitors (say 1000uF electrolytic and 0.1uF ceramic in parallel) across the wires from ESC to Uno and also across the wires from Uno to the sensors.  Ferrite chokes might also be a good idea.
    • Induced electrical noise from the motor / ESC into the sensors.  Make sure the ESC/Motor and sensor wires are spaced as far apart as possible.
    • Mechanical vibration from the motor.  The gyro and accel are quite sensistive and vibration can make them give crazy readings.  Make sure the motor and propellor are well balanced to minimise vibration.  Mount either the motor and/or the sensors on anti-vibration mounts.
This reply was deleted.

Activity

DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ : A Home-brew computer club* for Connected Autonomous Driving. talk at #piandmore ⁦@PiAndMore⁩ on Jan 23rd h…
21 hours ago
DIY Robocars via Twitter
RT @a1k0n: New blog post! Deep dive into my ceiling light based localization algorithm which runs in 1ms on a Raspberry Pi 3: https://t.co/…
21 hours ago
DIY Robocars via Twitter
Great new guide to using @donkey_car https://custom-build-robots.com/donkey-car-e-book-en
21 hours ago
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars virtual AI race is tomorrow morn at 9:00am PT. You can watch live on Twitch https://www.meetup.com/DIYRobocars/events/275268196/
yesterday
DIY Robocars via Twitter
New version of Intel OpenBot! This resolves many of the issues with the first version, including a much smoother tr… https://twitter.com/i/web/status/1352395636369313798
Thursday
DIY Drones via Twitter
Using ArduRover with an RTK GPS https://ift.tt/2N9I3RO
Tuesday
DIY Drones via Twitter
Monday
DIY Robocars via Twitter
Monday
DIY Robocars via Twitter
Jan 15
DIY Robocars via Twitter
Jan 15
DIY Drones via Twitter
Jan 14
DIY Robocars via Twitter
RT @Heavy02011: @diyrobocars : A Home-brew computer club* for Connected Autonomous Driving on Jan 23rd, 2021 https://www.meetup.com/Connected-Autonomous-Driving/events/275728684/ #Meetu…
Jan 14
DIY Robocars via Twitter
Jan 14
David Hori liked Isabella Domi's profile
Jan 12
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ Autonomous Driving Assembly at #rC3. join us at https://rc3.world/rc3/assembly/diyrobocars-f1tenth/ ⁦@f1tenth⁩ ⁦@DAVGtech⁩ ⁦@DWalmroth⁩…
Jan 11
DIY Robocars via Twitter
RT @chr1sa: New car designs coming for our next @DIYRobocars @donkey_car virtual race on the 23rd. Choose any one you want at race time Le…
Jan 11
More…