Interrupts on OpenCR not reliable?


(ReN) #1

I want to add emergency stop button on my robot and my approach is to use Interrupts on OpenCR to stop motors.
But my problem is that interrupts are triggered randomly.
First I tried with internal pullup resistor and there were a lot of random triggering.
Then, I tried 10k external pull up resistor, it was slightly better but still unusable.
Replaced 10k with 1k pull up resistor. It is noticeable better but still have interrupts every 20-30 minutes.

Motors are off, should not be problem related to EMF.
Tried pins 2 and 3, got same results.

Anyone else experiencing these problems? Any idea how to fix this?


#2

I have not tried this yet with the OpenCR, but it might help to see things like pictures of your actual wiring as well as the code you are trying to use. LIkewise information on how you are programming your OpenCR. Arduino? Which version? Which version of OpenCR…

Then maybe some of us (especially someone from Robotis) could either maybe see what is going on and/or try to set this up on a board and see if we can reproduce it and hopefully find a solution.


(ReN) #3

Hi Kurt,

It is definitely not something related to wiring or code.
This problem mostly occurs when walking near robot and I finally found source of this. Looks like friction between my rubber boots and carpet is creating electrostatic charge.

I even used shielded cable where I connected shield to OpenCR’s ground. But even this did not help.
I’ll try to make RC filter and see if this solves this problem.


(Yang Hailei) #4

Obviously, you had meet a EMF problem.
First, check if your motors’ lines or the motor is near the mcu. If it is true, put them far away your mcu.
Secondly, you should use another power for your mcu. Absolutly a RC is a great way, but I’m afread that you can’t find correct value for the RC. So another power for mcu may be the better way.
My English is not good, hope you could understand what I had written.


(Yang Hailei) #5

When motor run, it can reduce a large voltage. Which could from wires into your power system, and from air into your interrupt lines

If you disconnected your switch and the line, then how about the interrupt, under this condition?

Is there a fan in your system or a huge power consumption sensor(lidar laser)?

Check all your connection about this interrupt, should help you.

If you have Ultrasonic in your system, and it work fine, I can’t figure out what it happened in your system.
Because The Ultrasonic is a voltage sensitive sensor, it should give out randomly data if there is a EMF issue.
You should find a Oscilloscope, to check what the wave like.


(ReN) #6

I tried disconnecting motors and it is now even more sensitive. As I said before, it happens when moving near robot, not when robot is moving. Also, when touching metal chassis of robot interrupts can trigger easily.

I tried filtering like this:
GTe0Z

I didn’t notice any improvements. hmmmm


#7

Sorry, again this is not an area that I am very experienced at…

But if it were me, I would try to eliminate all of the simple things first to again get an idea of what is going on.

My assumption is you already tried running the code without the cable plugged in and it does not reset like this?

Are you sure those connectors of your wires are making good contact with your openCM board?

Tried using something like cat6 cable and ground and use one wire of the twisted pairs and ground the other.

Play around with grounds. Either try to make sure that the grounds are completely isolated for the switch. That is, is the case of switch grounded? to the Chassis?

And if I could not completely eliminate the issue, I might see if I could make the code deal with it. That is have the ISR code, maybe look at the status of the IO pin for some period of time and see if it stays at the pushed status, before I acted on it.

Then again I would probably use something like the bounce library and maybe do this as being polled instead of ISR, but…

Good luck and sorry that I am probably not much help here.

Kurt


(ReN) #9

@Kurt, thank you for suggestions.
Everything is fine when button is not connected to OpenCR board.

I spent whole day finding solution to this problem and I think that I fixed it, but it was not related to one thing, I had to do few changes to fix this problem. I did following:

  • As chassis is powder coated some parts of chassis where not in contact. I scraped powder coating between connecting parts to make sure that all chassis is connected. (Making Faraday cage)

  • Connected negative lead of battery to chassis.

  • I cut wires of button to half size

  • Reduced value of pull-up resistor from 10K to 3.2K

  • Connected pull-up resistor to 5V of OpenCR. It was previously connected to 3.3V. (Pin3 that I’m using is 5V tolerant)

And if I could not completely eliminate the issue, I might see if I could make the code deal with it. That is have the ISR code, maybe look at the status of the IO pin for some period of time and see if it stays at the pushed status, before I acted on it.
Then again I would probably use something like the bounce library and maybe do this as being polled instead of ISR, but…

After doing modification from above I could not reproduce problem but it does not mean that it won’t happen. I’ll definitely modify code to ignore any quick transients and to react only on signals that are 50-150ms long (actual button press)
I could fix it in code at beginning but I wanted to fix root cause of problem. It may not only be switch that is causing a problems, but also all other sensors I connect in future.

Thank you all for you support.