Detect 12v 500mA

Allow me to apologize in advance. I am a programmer who is VERY new to the microcontroller world. I am starting out with the FEZ Spider Starter Kit (with a few additional modules) and will soon be working my way through basic electronics theory. However, as is typical for me, I am jumping the gun and working on a personal project for my stepson.

I am building a rocket launcher with all the appropriate safeguards. One of these safeguards is a physical switch that provides a 12V 500mA (Typical) 16V 2A (Maximum for 200mS) power source (separate from the microcontroller) to the relays (SRLAY-GM-327) that in turn launch the rocket.

*** Get ready to tell me just how WRONG I am :wink: ***

I want to be able to detect that the key has been inserted and turned on such that the launcher is now ARMED. My assumption (yes, I know what happens) is that the detection method should be physically isolated from microcontroller. It seems that something like the NTE Electronics NTE3090 (Optoisolator w/ Schmitt Trigger) would be a reasonable solution. It is physically isolated, could convert 12v to the 3.3 – 5v that the microcontroller needs and the Schmitt Trigger holds the state of the output voltage (Vo) either on or off for a GPIO pin based on the presence of voltage on the Anode and Cathode (pins 1 & 2).

I think that I just need to hookup the Anode and Cathode of the 12v power supply to pins 1, 2 on the NTE3090 and the 3.3V positive and ground from an Extender Module (XTNDR-GM-273) to pins 6, 5.

If I am correct, then when 12V is applied to pins 1, 2 then pins 4, 5 should be near 0V (backwards from what I would expect). When pins 1, 2 are near 0V, then pins 4,5 should be ~3.3V (near Vcc).

Am I on the right track? Am I connecting the NTE3090 correctly? Is there a better (i.e. easier) way to do this?

FYI… If easier is a little more expensive, thats okay 

Thanks to everyone in advance for your help!



Could you use a DPST key switch, something like this:

That way, one pole could be the 12V connection, and one could be the 3.3V for the MCU to sense. Other options are a voltage divider to reduce the 12V to something the MCU could work with safely, or, as you say, an optoisolator, though you wouldn’t need a schmitt trigger, as your input would be constantly on.

The easy way to do this, however, might be for the key switch to simply switch 3.3V, which triggers the MCU to operate the relay(s) via standard, cheap BJT transistors. This may not meet the “physical off” safety requirements, though.

Thanks! I was already using a key switch with a yellow 12V LED and a flashing red LED. I had not considered using the other pole as a 3.3V source for the microcontroller. Something to think about.

Also remember that a relay also provides isolation. Using the switched 12V to trigger a small relay would be cheap and simple. An opto-isolator like you have found serves the same purpose, has no moving parts and will likely use less current than a relay.

I found a double pole double throw relay that meets my needs perfectly. I can use one pole to turn on the 12v and the other to send 3.3v to the microcontroller indicating that the launcher is now armed :slight_smile: Thanks to all for your help!

Be sure to “debounce” the switch. From the MCU’s point of view, it’ll turn on and off many times when you turn the key. The first time it turns on, set a timer, and make sure it’s still on a few ms later.