Help with switching PWM signals - Page 1
Forum section: electronics / projects

author: SethGI
author_rank: Regular Contributor
timestamp: May 20, 2017, 07:01:54 pm
content: Hello,I am working on a robot which is driven by 4 brushless motors controlled by ESCs. A pwm signal is sent to the ESCs by an arduino. We need to have a kill switch to immediately shut off power to the motors. We have a kill switch which is at 5v when activated. Since we don't have space to have large relays to switch all the power, the idea is to instead have some circuit (?) which switches the ESC from receiving the PWM from the main arduino to a secondary arduino which generates a constant 1500hz signal (the don't move one). I've had a few ideas for how to do this (Mosfets,BJTs, mux ics, Tri-state buffers), but really have no clue of how to go about actually executing. I attached a screenshot of one simulation which ~works~, but I'm not sure if it would be the best solution. In this case, the top (40hz) signal represents normal operation and the bottom is the kill state. The switch in the middle is the kill switch.Thanks for the help!

author: FreddyVictor
author_rank: Regular Contributor
timestamp: May 20, 2017, 09:47:14 pm
content: what's stopping you from just having a kill switch on the main arduino which immediately sets pwm to 'stop' ?I'm not sure that I see any point in the idea of switching to a secondary pwm generatoryou're refering to hz all the time but that is just the pwm frequency and doesnotcontrol the motor speedif this is normal radio-control rc pwm signals, then pwm pulse length is 1->2msWith the motors being reversible, this would mean 1.5ms (or 1500us) is the 'stop' positionsome ESC's will automatically stop if they don't receive any pwm signal after a short whileyou can use watchdog timer to force stop should your code get stuck in a loop

author: SethGI
author_rank: Regular Contributor
timestamp: May 21, 2017, 02:32:02 am
content: It's a requirement that there is a hardware level kill. That's why we need the secondary pwm generator.

author: Ian.M
author_rank: Super Contributor
timestamp: May 21, 2017, 03:35:24 am
content: I would not call substituting a control pulse requesting zero speed a hardware level kill. Adding another MCU to generate it is crazy. Do you then add yet another MCU to supervise the zero speed pulse one? Turtles all the way down . . . .Look carefully at the ESC design. Configurable behaviour on loss of control pulse may be an existing firmware option - obviously you want motor shutdown as fast as possible, but again I wouldn't care to rely on that to implement a HARDWARE kill switch.It may well be possible to reset the ESC's MCU and hold it in reset. You'll have to be absolutely certain that the MOSFETs in the three phase H-bridge have gate bias resistors that will hold them in the off state or bad things will happen.Otherwise review your design - you only need ONE relay to disconnect the motor supply battery, or possibly a beefy TRIAC crowbar circuit to blow the battery fuse.

author: orin
author_rank: Frequent Contributor
timestamp: May 21, 2017, 04:54:45 am
content: At least in the robotics competitions that I've done tech inspection, a kill switch is literally a physical switch between the battery and the motor(s).What _exactly_ do the rules say?In our case, I'd probably let a software PWM modulation scheme through for a league competition with a warning that it would probably be disallowed at any higher level.Edit: Remember, the purpose of a kill switch is to immediately stop a robot that's run amok. There's no better way than mechanically removing the power with a good old fashioned switch.

author: SethGI
author_rank: Regular Contributor
timestamp: May 24, 2017, 11:16:02 am
content: So it's a small competition and the rules are pretty vague, but this would be allowed.A physical switch is kinda hard because it's an autonomous underwater competition so just jamming a switch in the middle doesn't help unless it's waterproof, which is super expensive.

author: Ian.M
author_rank: Super Contributor
timestamp: May 24, 2017, 11:48:53 am
content: Waterproof is *NOT* super-expensive. Use a reed switch to supply the gate of a suitable power MOSFET, with a resistor gate-source to bleed off the gate charge if the reed switch is open. Locate the reed switch next to your enclosure wall (which must be non-ferrous at that point), and use a high power magnet to actuate it. How you attach the magnet is up to you - 3M do some industrial hook and loop fasteners that are basically Velcro on steroids. Its worth epoxy dipping the magnet before attaching the hook & loop tape so it doesn't corrode.You can also do it the other way round - attach magnet to short the MOSFET gate to source to disconnect the load, but that is far more likely to fail ON