Asked — Edited

Mps Gas Cap Switch

Hey All,

Trying to work this MPS Gas Cap into my R2 project.

I want to use it as a fail safe switch in case R2 makes a break for it.

I want to use it in reverse of what it is advertised for. Basically I want R2's power to be on when the "plug" is in and shut off if the "plug" is pulled.

I've tossed it together on my bread board and it does run at 5V no problem.

I'm thinking of somehow linking it to the EZ-B ADC port. Somehow read the port to sense what state it is on (Plug in or out). From there I have a Dimension Engineering R/C relay that I can patch into my main power source for R2.

If R2 takes off I want to be able to grab and pull the plug triggering the relay open.

Does this sound doable?

Thoughts? Suggestions? Beer?

Kris :)

User-inserted image


Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.


If its a on off type operation you use that on a digital servo port not the adc , yes I believe that's possible if I understood you want a "all stop" switch.


Yes/no. It's an on/off type operation but requires voltage to operate.

It's got a +/- in and a +/- out.

Plug in = Power Off Plug out = Power On

So I'm looking to make it work in reverse.

Plug in = Power On Plug out = Power Off

To do this I'm looking simply to us the EZ-B to activate a R/C based relay.

So my thought (Just a thought for now) is to plug the feed side into D10 to supply +5V.

The opposite end I'm thinking of plugging into a ADC0 the Gnd to Gnd and the +5V to the signal port.

So when the plug in is it will detect 0V, with the plug removed it will detect +5V.

Then I can run a script to read that port and control the R/C relay.

Just need someone to say "Ya that will work" or "oh crap you'll release the magic blue smoke"

Or maybe I'm going at it all wrong?


The port can only support a little over 20ma , which is the average led , a a relay will draw more. There are switching transistors that can do that from the board. Specifically what are you turning on or off with this? Or do you.just want a command that tells everything to stop? If its just a pasa through switch like I'm thinking you could run ez b power through it and when pulled cuts the power which guarantees everything stops even if commands or script stopped running.


jstarne1 your not quite following what I'm putting down.

The switch runs at 5v and only draws 10ma. So that is fine.

Using a script to detect the state of the switch is what I want to do, once the state of the switch is known I want the script to perform a certain action via a R/C based relay. I have this one but I need to replace it with something a little bigger.

Based on the state of the switch it will turn on/off the R/C Relay physically cutting power to my motor drives and such.


To tell you what relay(s) & how I would wire it, I need to know: What voltage battery system are we running? What's your motor stall current? Do you need EZ-B to know when the power is cut? Do you want both the Cap in & EZ-B to say yes before you get power?


I'm running (2) seperate 12V battery systems in my droid. The first 12V (9ah) system runs all my non-drive related electronics and misc items. That also includes the EZ-B board.

The second system is 12V (18ah) as well but only feeds power to my Sabertooth 2x25 and Syren10 motor controllers to drive its motors.

I'd have to do some digging on the motor stall data.

I'd like to have basically the EZ-B determine the state of the switch and control power to the second 12V circuit accordingly.


Plug in - Power On at relay. Motor Power On Plug out - Power Off at relay Motor Power Off

This is purely an emergency shut off if my droid starts to run away.

If it's pulled the motor drive power is disconnected.

If the plug is returned back to it's original state power is returned to the motor controllers.

Hope this helps clarify.


Given those answers:

Assuming the Female plug on the gas cap is for the battery: I would splice the the red & black of the female connection to the red & black of a servo/peripheral cable, then the red of the male connection to the white or yellow signal wire of the servo/peripheral cable. Now you can plug this into any ADC or Digital port.

Then I would put one of these
Relay Module for Micro Controllers
on the electronics side hooked up to a digital port and use it activate a 40A automotive relay on the motor side. I'll draw up a wiring diagram of this if you need.

Just remember the gas cap switch is off with the cap in & on when pulled out... So in ARC, 0v on an ADC port or Off on a Digital port means the cap is in, while 5v or On means cap out.



Thanks for your help! It is greatly appreciated.

That sounds about pretty close to what I was thinking. Basically feed the switch 5v and read the opposite end via the ADC port (0v/5v). I'll go build a connector shortly and try.

I already have a R/C capable relay so I wouldn't need the microcontroller version. It simply can be turned on/off via servo position in EZ-B.

Sounds like I need the R/C relay to control a bigger relay? I assume this is because of the Amp rating on the R/C relay I have? Sounds fair.

I guess the big question is how much juice are my foot motors pulling and matching a relay capable of switching that amperage.


That's what I figured. I think I have some surplus relays with harnesses out in the garage. I take a looksie tonight.

So on the output side of the switch I'm left with a ground wire. What should I do with it?


Just tie it back til you know everything works.


Got Everything working last night.

Basically the MPS Gas Cap is powered and monitored by ADC0. Relay is controlled by D8.

ADC0 Port: 0V= Power On / Relay On 5V=Emergency Stop / Relay Off

(3) Scripts control the MPS Gas Cap for physical emergency shutdown and reset.

(2) Scripts are for voice command for emergency shutdown and reset.

Not sure if they are the most efficient scripts but it's working smoothly.

Critical Stop Main script monitors the ADC0 port. If the key is pulled it runs Critical Stop 1 script and ends. If all is well it continues to monitor and loop.

Critical Stop 1 changes the state of the relay and executes Critical Stop 2 script and ends.

Critical Stop 2 monitors the ADC0 port for the key to be replaced. Once the key is replaced it ends and re-starts Critical Stop Main script.

I have (2) voice commands setup to work as well.

R2 Emergency stop - Executes All Stop 1 script and turns relay off. It also shuts down Critical Stop Main script.

R2 Emergency Stop Reset is to re-activate. It then checks to make sure the physical key is in place, turns the relay back on, and starts up Critical Stop Main script. If no key is inserted it continues to loop and wait for its insertion.

Sorry to bore the hell out of you all with this. This is a crucial item for my 200+lb droid.

My file is now up on EZ-Cloud.

If anyone has any suggestions on merging / optimizing the scripts PLEASE let me know.


P.S. - I'm working on adding a video. Stand By!


A quick vid of the MPS Gas Cap in action!

You can see the relay in the middle green LED going on/off.


Thanks DJ!

I'm trying. Starting to learn the power of scripts. Next up will be the personality script.