Emergency Stop Circuit

General discussion of using Roboclaw motor controllers
Post Reply
ecorrales
Posts: 33
Joined: Sun May 06, 2018 5:06 am
Emergency Stop Circuit

Post by ecorrales »

Hi,

I want to add an E-stop circuit to my robot that doesn't depend on any software or smarts to shutdown the Roboclaw. (a watchdog).

I didn't see any examples in these forums, or online (yet). How does this look?

https://github.com/elicorrales/roboclaw ... ircuit.jpg

My thinking is that the capacitor will eventually charge, forward-biasing the transistor, then the relay shuts (it just has to be momentary if I set up the Roboclaw for latching ?) . (I could also look for some momentary-pull or maybe double-throw relay?)

The Raspberry would have to consistently pulse-low the output GPIO pin to keep the capacitor from charging up to where it trips the relay. The high-pulse or just a high would have no effect due to the inline diode.

A pullup at the output of the GPIO in case it's just floating . Or maybe the pull up should be on the output of the comparator. (cathode of diode).

thank you.
cyberdemon
Posts: 10
Joined: Sun Oct 08, 2017 3:41 am
Re: Emergency Stop Circuit

Post by cyberdemon »

Hello,

My solution for this was to make a hardware watchdog out of an "Arduino Pro Micro" and a power mosfet driving a pair of large automotive relays.

The code is fairly simple; it waits for a character on the USB COM Port which switches on the relay and resets a timer. An interrupt routine increments the timer, and switches off the relay if it has expired.
This is a bit clunky, because it should be trivially easy for the roboClaw to have its own packet serial timeout feature.
IonMC (sorry, "basicmicro") are supposedly working on this. See thread 212: http://forums.basicmicro.com/viewtopic.php?t=212

Alternatively you could make a circuit like this and connect it to a relay or the RoboClaw's E-Stop input
https://hackaday.io/project/16698-discrete-watchdog
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Emergency Stop Circuit

Post by Basicmicro Support »

It is in our todo. Near the top of the list actually.
ecorrales
Posts: 33
Joined: Sun May 06, 2018 5:06 am
Re: Emergency Stop Circuit

Post by ecorrales »

hi, thanks!

I don't want to do the arduino - dont have one - dont want to get one.

But I like the circuit. however don't have the exact parts, thought I could tweak it with what I have..

..what do you think about this version:

https://github.com/elicorrales/roboclaw ... cuit-2.jpg
cyberdemon
Posts: 10
Joined: Sun Oct 08, 2017 3:41 am
Re: Emergency Stop Circuit

Post by cyberdemon »

Looks good although I suspect the 2n222 won't have a high-enough gain (hfe) which is why the original circuit used a mosfet. Unless you have a really low power reed relay I suppose.
Have you tried simulating it? "simetrix" is a useful program for this.
ecorrales
Posts: 33
Joined: Sun May 06, 2018 5:06 am
Re: Emergency Stop Circuit

Post by ecorrales »

just remembered I have some ULN2003s that will handle the relay. Can also just pair up 2 2N222s into a darlington pair..

thanks for tip on the simulator
ecorrales
Posts: 33
Joined: Sun May 06, 2018 5:06 am
Re: Emergency Stop Circuit

Post by ecorrales »

I was able to come up with a (siimple?) E-stop circuit.

https://github.com/elicorrales/roboclaw ... ircuit.png (schematic image).

https://github.com/elicorrales/roboclaw ... e-stop.asc(LTSpiceIV file).

The Raspberry's 3.3V GPIO output pin pulses at 7ms on / 7ms off, and that signal is buffered by a 3V-to-5V level shifter (see Amazon).

The circuit acts as a hardware watchdog, and as long as the pulses continue, they keep the relay from closing, and keep the E-Stop from going low.

I breadboarded it and it works as modeled.
ChrisA
Posts: 23
Joined: Mon May 22, 2017 4:32 pm
Re: Emergency Stop Circuit

Post by ChrisA »

What you are talking about is not an "E-Stop". It is a "Watch Dog". The different is that a watch dog has to kick some object periodically of the motors stop. An E-stop is a big red button about 1.5 inch diameter. You hit it and the machine stops. The button latches and must be rotated to un lock. The buttons typically are rated at only 10A so if you want it to disconnect a battery you need a relay or solid state switch

Typically this are used on lathes and milling machines and industrial robots. Think it is best to connect them physically close to the power supply The safest way to wire them is to use a small power supply to hold a normal open relay closed. hitting the switch removes power and the relay opens.

It is important to wire an E-stop so that a failure in the wire or a connector coming loose causes a stop condition..

As for a software watch dog on a robot notice that such is ALREADY present in the ROS none drive for roboclaw. If the driver fails to get a command for one second it stops the motors. I think this is better then using a second process to charge a capacitor. Why? the software loop that charges the cap might continue to work even if the motor control task is dead. Typically software developers will use multiple tasks that might be interrupt driven. It is common for one task to crash and the others continue to run. In fact that is a common case with motion control.

So you can detect failure of the motor control task by the fact that it stops sending commands. Deign your system so that a command is sent at a given rate then after some many missed commands the motor stops. Again this is how the rod node python scrip works

Here is a photo is an E-stop switch. they are cheap and all over eBay
Env-o-libre-interruptor-de-bot-n-de-parada-de-emergencia-16mm-para-maquinaria-o-equipo.jpg_640x640.jpg
Env-o-libre-interruptor-de-bot-n-de-parada-de-emergencia-16mm-para-maquinaria-o-equipo.jpg_640x640.jpg (52.51 KiB) Viewed 8711 times
ecorrales
Posts: 33
Joined: Sun May 06, 2018 5:06 am
Re: Emergency Stop Circuit

Post by ecorrales »

Hi, thanks for the suggestions.

I was using the term E-Stop to refer to that function on the Roboclaw via the S3,4,5 pins.

A physical button isn't much use to me since I can't be present at location of the robot if/when it crashes or control is lost at speed. That's why the circuit was made to force a stop (a LOW on the Roboclaw pin) unless there's a constant pulsing signal.

My only point was that it's simpler than having a separate microcontroller for the same purpose.

Yes, correct, if there are other failures and the signal continues, then nothing was solved.

I am not using Python. Not sure what you're referring to with
notice that such is ALREADY present in the ROS none drive for roboclaw.
Is that instrinsic to the Roboclaw, or external to it? If external to it, then I need to implement that myself, as I'm doing a combo of C/C+ and Bash shell.

As example, I've already noticed that sometimes the running program loses control (aborts) but the Roboclaw is still executing the last command. However, just re-starting the program re-gains control of it. Thus the bash script that wraps it all.

I also understand that the entire thing isn't really a fail-safe E-stop since the Roboclaw itself has to be programmed to have (example) S5 as the E-stop. This is an iterative effort.

As a next phase, I could use the very same circuit, but in that case, the relay would remove 12V main battery power. (the equivalent of having the button). I'm not ready to risk that yet as I don't want to test if my setup protections against EMF/EMI were sufficient, or if something will be damaged.
cyberdemon
Posts: 10
Joined: Sun Oct 08, 2017 3:41 am
Re: Emergency Stop Circuit

Post by cyberdemon »

Hi Chris,

While the ROS node has a watchdog function that will stop the roboclaw when it stops getting messages on its topic, it still has to send a command to do that. So if the serial/USB comms are broken between the roboclaw and the host PC, it will continue executing its last command forever. So it needs a hardware watchdog or 'dead-man's-handle'.

[strike]ION[/strike] BasicMicro are supposedly working on a firmware revision that will add a timeout into the roboclaw itself.

Post Reply