First non-trivial circuit is working, seeking critique - one button soft latch for Arduino

Thread Starter

gmhoovler

Joined Mar 11, 2016
4
Hi - I've spent the last 2 months learning, new to the hobby. I had some EE classes back in college - but that was a long time ago, and my math skills have long since rusted.

After a lot of online research and trial-and-error, this circuit is working, and I'm really looking for a "review" and some feedback from anyone interested in helping me out.

The requirements I worked off of:
* power source is a 1s 3.7v LIPO - so I need low-voltage shutoff and a 3.7 to 5V boost to power the Arduino
* need to use one momentary switch for both power on, arduino signaling, and power off

I solved the first requirement, after a lot of research, with three small devices I bought. They are labeled in detail in the attached diagram. One is a low voltage protection circuit from Turnigy. The second is a soft-latch switch from Pololu - which I didn't find until after I had learned how to create my own, this one is much better. The third is a simple 5V step-up that I also got from Pololu.

So, yes, so far I've only stood on the backs of others more intelligent than me. What I had to do myself was create a circuit to use the single button in the circuit to signal the soft-latch switch to power on when the device was off, but when the device was on I wanted the same button to be tied to the Arduino for digital signaling to my program.

After reading a number of other posts, I got the attached circuit working, using a PNP transistor to "disconnect" the button from the soft-latch once the arduino was powered on. I can then use logic in the arduino to signal the soft-latch to turn off through pin D3, and I coded it to do this when the same button is pressed and held for 2 seconds.

I forgot to label the resistors - they are 100K. I added the diodes based on some other implementations I'd looked at, to prevent any reverse current through the two circuits using the switch.

Thank you for taking the time to read this far - I'm trying to learn and I'm open to any and all feedback.

Modified soft latch.png
 

Dodgydave

Joined Jun 22, 2012
11,302
Nothing labelled up, can't see the point of the transistor, as the diode blocks the signal to the chip, or have you drawn it wrong??
 

Thread Starter

gmhoovler

Joined Mar 11, 2016
4
Thanks for taking a look Dodgydave!

The point of the transistor is to break the circuit to sw+ on the soft latch after the arduino powers up, so that pressing the button again won't power the soft latch down - I wasn't clear about that in my original description.

The line to pin D2 on the Arduino is being pulled up to 5V with the Arduino's built-in pull-up resistor function. When the circuit is on and the switch is pressed, the circuit from D2 grounds to D6 and D2 goes low, allowing me to read that in the program. The diode (labeled D2 in the new diagram) prevents any voltage from the soft-latch switch from moving up into the Arduino when the device is in the off and just being powered on state.Modified soft latch.png

I wasn't sure what you meant by "nothing labeled up", I added some additional labels to the diagram and attached a slightly larger version of it that was easier for my old eyes anyway.
 

Thread Starter

gmhoovler

Joined Mar 11, 2016
4
Stiil don't see what the transistor is doing, the base is at ground permanently, so its always on???
Yeah you've got a point.. now I'm wondering why it's working. Let me go back through it and see if I drew everything right - I'm still in "prototype first then figure out how to draw the circuit" mode, and I'm inexperienced at translating all the wires on my breadboard into the circuit diagram. I'll come back with an update later tonight after I get a chance to go through it all and test a bit.

Thanks again!
 

Thread Starter

gmhoovler

Joined Mar 11, 2016
4
Based on your observation I ran a couple quick experiments and I think I got to the heart of it. Embarrassingly, the transistor WAS doing nothing, and it was just the placement of the diodes and the fact that when the Arduino is off, the switch is grounding from SW+ to SW-, and when the Arduino is on I think the switch is grounding from SW+ to the ground on pin D6 on the Arduino - effectively "switching" the switch so it triggers the soft latch when the Arduino is off, and it triggers only the Arduino when it is on. Does that seem possible to you?

I did a quick update to the diagram to match the changes I made.
Modified soft latch ver 2.png
 
Top