Maker Pro
Maker Pro

Forward and Reverse MOSFET Switch Design.

modern_messiah

Dec 1, 2010
29
Joined
Dec 1, 2010
Messages
29
Hi all,

So I was asking around earlier about how a particular LED driver worked and I figured it out, so now I’m at point number 2 in my little project – the switch.

I want to get fancy and have drawn up the following circuit:



What it is intended to be is a momentary switch that has both a forward and a reverse momentary action. If I need to explain this a bit more I can happily do so.

Basically speaking the circuit is intended to function as follows:

1) The MC2A-1F switch is a double pole momentary switch. It’s similar to what is used in most modern digital cameras – half press for one latch, fully press to activate the second latch. It does not lock in place and releasing the switch fully will return it to no connection.

2) The MC2A-1F switch connects the 3V coin cell battery to the ATtiny4 micro-controller. When the switch is pressed, depending on how far it is pressed (half or full), the micro-controller reacts accordingly, and activates the MOSFET.

3) The N-channel MOSFET, now being activated, allows power to flow from the main battery to the LED driver.

4) Now depending on the code in the micro-controller, the MOSFET will be activated differently based on the previous state:

  • If the load is not running and the MOSFET is off (so the whole system is inactive). Half pressing the switch activates the MOSFET and hence the load, until the switch is released again at which point the MOSFET and load are turned off. (Momentary on).
  • Fully pressing the switch in the above situation activates the MOSFET and turns on the load permanently. So releasing the switch leaves the MOSFET on and the load running. (Permanently on)
  • If the system is in the permanent on state, and the switch is half pressed, the MOSFET is deactivated the load stops running. Releasing the switch during this state returns the MOSFET to the on state and the load begins running again. (Momentary off)
  • If the system is in the permanent on state, and the switch is fully pressed, the MOSFET is deactivated and the load stops running. Releasing the switch after this full press leaves the MOSFET and load off. (Permanently off).

I actually have a few of these switches with me and there is some bounce in the switch. For example when the switch is fully pressed and then fully released you can feel it switching through the half press state on its way to fully off. This would be corrected in code to prevent it seeing half presses when full presses are intended.

The microcontroller needs its own battery supply because it can’t get power from the main battery without the load being on and running, which you don’t want when the MOSFET (and hence load) should be off!

I feel this explanation is important in order to truly grasp what I am trying to do here. If it needs clarification please do not hesitate to ask.

Anyway – to the point of this post! I’m pretty set on the micro-controller half of the system. What I’m not 100% set on is the MOSFET side. The circuit diagram has been pieced together from various online sources so I’m not exactly sure of the circuit itself, or even the function of some components. I picked the MOSFET as I think it’s appropriate in this situation.

The diode is intended to provide reverse polarity protection to the micro-controller. Cpower is supposedly to provide the micro-controller with a bit of residual power after the switch is open circuit so the micro-controller can finish doing its business.

What is this circuit missing, or what does it have that should go? What is the purpose of Rin and the 1M resistors pulling the gate pin on the MOSFET to GND? What are appropriate values to use? Is the MOSFET set up correctly? Hell, is it even and appropriate MOSFET to use!

I tried working this out on my own (believe it or not) but while I can find plenty of theoretical examples, I can’t seem to find any practical ones that apply to my scenario.

Any insight or advice would be highly appreciated.

Thanks,

- Matt
 
Top