Author Topic: Pull-up resistors and weird noise spikes on interrupts?  (Read 3545 times)

0 Members and 1 Guest are viewing this topic.

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Pull-up resistors and weird noise spikes on interrupts?
« on: October 01, 2012, 09:39:41 AM »
Hi all,

Having a really interesting problem that I've managed to get around very badly.

We have a fairly simple setup: a hall-effect sensor is acting like an encoder, which is attached to an interrupt on a 32 bit PIC uC (It's one of those PIC32 based Arduino Mega lookalike boards, the Digilent Chipkit max32). The rest  of the circuit is set up exactly like the "connection diagram" part of this website: http://www.dfrobot.com/wiki/index.php?title=MD1.3_2A_Dual_Motor_Controller_(SKU:_DRI0002), with more or less all of the same components.

For some reason, sometimes, the interrupts will trigger the uC board to start rapidly oscillating voltage from on to off (Note: probably NOT "high to low".  I'll explain more below).  This caused a massive set of rising edges, and my interrupts would trigger thousands of times per second, essentially saying that the motors had turned around 30 times  and destroying the effectiveness of my PD controller.

Now, the reason I said on to off, and not high to low, is because once we put a pull-up resistor on the interrupts, the strange noise spikes never went away (although they are much harder to trigger now), but the interrupts stopped triggering when the noise was there.  I suspect that the board power is rapidly switching between on and off, so the circuit opens, and the pull-up keeps the interrupt pin at the HIGH level.   When the pullup wasn't there, the interrupt was floating, and we got the weird behaviour. 

Since this circuit is so simple, I don't understand how these noise spikes can happen.  Also interesting is, once the noise spikes occur, I just need to send the robot another command and they go away.  Probably resetting the uC, I don't know, but it doesn't take very long for that to happen.

Any thoughts?  There are no moving parts in the board, so it's not like we're physically breaking connections.  I've tried on multiple interrupts with multiple robots and things still spike.  When I am NOT using interrupts (ie: I'm just dumping PWM into a motor) nothing happens, no noise spikes or anything.

My solution (the pullups) is a bit of a hack: sure, we're supposed to pull up the inputs, so now I can at least USE the robot, but it's still not fixed since the noise spikes are still present. 

MIKE 
Current project: tactile sensing systems for multifingered robot hands

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: Pull-up resistors and weird noise spikes on interrupts?
« Reply #1 on: October 01, 2012, 03:49:33 PM »
It will take some troubleshooting on your part. My guess is:
1- the spikes are from the PWM frequency from the motor driver/motor.
 Use a separate power and ground from the battery to the motor drive circuits that is not common with the processor board.

2- A pull-up could be good. Also, a series resistor and a small cap to ground near the processor input could help. Select values to kill the spikes but not the maximum frequency you expect for the sensor.

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Pull-up resistors and weird noise spikes on interrupts?
« Reply #2 on: October 01, 2012, 06:00:09 PM »
Hm, yes, I suspect it has to do with the PWM, but why would the PWM only affect the board when the interrupts are enabled?  Also, wouldn't I need to tie the grounds together between the motor control board and the uC?  Otherwise I wouldn't be able to send them a reliable input signal, not so?

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Pull-up resistors and weird noise spikes on interrupts?
« Reply #3 on: October 01, 2012, 06:36:16 PM »
Hi,

Hm, yes, I suspect it has to do with the PWM, but why would the PWM only affect the board when the interrupts are enabled?
How do you verify there's noise?
Do you know how the noise is reaching the interrupt pins (via supply lines, inductively or capacitively coupled, radiated)?


Also, wouldn't I need to tie the grounds together between the motor control board and the uC?
They'd be joined at the battery (which gives you a low impedance to dampen noise on the wires).
If it's radiated noise OTOH... Photos of the board and the wiring would probably be helpful.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline cosminnci

  • Beginner
  • *
  • Posts: 1
  • Helpful? 1
Re: Pull-up resistors and weird noise spikes on interrupts?
« Reply #4 on: October 02, 2012, 05:52:40 AM »
Hi,

I had a similar problem with optical sensors, but my cable length was 1.5m and near the drive cables.
my fix was to use shielded utp cable.

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Pull-up resistors and weird noise spikes on interrupts?
« Reply #5 on: October 02, 2012, 06:42:41 AM »
Hm, yeah I'm thinking that cable length is also a possibility.  I'll have to scope the encoder inputs at the board, since I've been scoping them right at the encoders.  I'm using about 1m of ribbon cable, and I've been told that that can have some... repercussions :-P It's something to check today.

To Soeren: I verify there is noise by scoping the encoder output.  Strangely, it's not just that there is noise, but that the noise only shows up some of the time, and when it does it's really bad (0 - 3.3V, like it's turning on and off rapidly).  I'll try to post some pics today if shielding the wires doesn't work.

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Pull-up resistors and weird noise spikes on interrupts?
« Reply #6 on: October 02, 2012, 08:58:41 AM »
Wow, was it ever a problem with cable length!  We shortened the cables (from...uh...2m down to about 20cm...) and it works flawlessly.

Thanks everyone who replied!

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Pull-up resistors and weird noise spikes on interrupts?
« Reply #7 on: October 04, 2012, 05:20:03 PM »
Hi,

If you need to use flat cable and have noise issues due to the length, a few things that will help is running a ground wire every second wire and terminating the cable in a sensible way (passive/active - there's more than one way to shave that goat).
If the budget can handle it, you can get screened flat cable as well.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 


Get Your Ad Here