
\documentclass[11pt]{article}
%Gummi|065|=)
\usepackage{graphicx}
\usepackage{caption}
\usepackage{xcolor}
\usepackage[vcentering,dvips]{geometry}
\geometry{papersize={6in,9in},total={4.5in,6.8in}}
\title{\textbf{Door Alarm}}
\author{Steak Electronics}
\date{}
\begin{document}

\maketitle

\tableofcontents
\textcolor{green!60!blue!70}{
\section{Overview}}
Client wants a door alarm. Let's do a few transistors, an audio amplifier board, a magnet and magnetic reed switch, along with a light switch.

Functionality req'd:
\\
\\
Makes noise when door opened.
\\
\\
Able to be shut off with light switch.

\textcolor{green!60!blue!70}{
\section{BOM}}
Any audio amplifier loud enough will work. I'm going to use this one:
\\
\\
IS31AP4088A-QFLS2-EB 
\\
\\
I think I have speakers and transistors. I'll need a magnetic reed switch and magnet. They should be black, as the door is black.
\\
\\
MS-324-3-3-0500
\\
\\
let's also try 59140-1-S-03-A,\footnote{A and F ending letters on this, A is tinned, F untinned leads} as first co. doesn't make the matched magnets...
\\
\\
and the magnet,

57140-000

A speaker, although I have plenty in my junk bin. 
AS07708PS-2-WR-R
\\
\\
That's a start.

\textcolor{green!60!blue!70}{
\section{Work Log: LM324, LM555, TIP120,125}}
I spent a bit on this during the evening. I tried first with a LM324, in falstad (sim software) to see if I could make a function gen, out of 3 op amps. I was unable to get the sim to work, although reportedly the circuit works online (ref: https://www.eevblog.com/forum/beginners/simple-analog-function-generator-design/msg1174548/\#msg1174548)

I decided instead, to simulate a triple 5 with a LM324, to finally a transistor output, and this worked in sim. I breadboarded the circuit however, the output was not switching correctly. It turned out later, that I had not read my TIP125 close enough - it is a PNP. Oops.

Before realizing this error, I breadboarded two op amps, (ref: https://electronics.stackexchange.com/questions/311648/obtaining-a-triangle-wave-from-a-square-wave-using-a-lm324n-op-amp) and these were able to make the square / triangle wave without issue. Not practical in this situation however, as the freq. is low. I tried adjusting via the R between output 1 and inverting input for op amp 2, but this did not work as expected. I had long leads with a variable resistance box. Most likely, the issue.

Next, I will breadboard the triple 5 with the LM324 (which may be optional) and use that. I will throw in an Arduino to switch the triple 5 on/off via the RST pin. This will allow for some adjustment of tone.\footnote{I could just use the tone() function on the Uno, and have a transistor handle the output, but the goal of this project was to lean more towards the analog.} Future improvements would be to get some way of removing the Arduino from the project. I would need a solution that will adjust how often the RST pin is switched, for some short period of time while the door magnet switch is active.

I might end up just using tone, if the 555 doesn't sound good.

\section{Door Magnet Reed Sensor}
I tried buying one from mouser,digikey but they are all small. Seems the standard is 28mm by 10mm or so. I didn't realize it until I purchased it, but it looks quite a bit smaller than I am used to. Not acceptable.

I spent some time looking at all the options. I was unable to find the bigger size. Even the imports from Sparkfun and Adafruit were small. There was a nice screw terminal omrom option but it was \$30. I opted for ebay where there were some used, brand name, sensors in the US. I found some for about \$5 each, including magnet AND the sensor (on mouser/digikey, you often have to get them separately).

\subsection{Buzzer or Bell}
I thought about a buzzer. Like, a ringer from a telephone. I didn't find them on mouser/digikey, but I did see a lot of piezo buzzers. Need to look again. Even better would be a bell, but that requires an actuator or a motor. I don't want to deal with moving parts, it will be more likely to break. Let's put that idea aside for another day.

Still, I like the idea of a bell, and an actuator to ring it...

I tried one on ebay. If that doesn't work there is this one:
https://www.allelectronics.com/item/sol-154/12vdc-push-type-solenoid/1.html
per this discussion: https://forum.sparkfun.com/viewtopic.php?t=10308

As for the bell, I will hold off until I know how the solenoid works.
\footnote{I decided that the sound of the bell is worth the risk of using moving parts.}

\subsection{Signal Mosfets for Actuator}
I have a solenoid, from ebay (actuator) and I've got a bell\footnote{I ring it in the morning... I ring it in the evening...}.

I tried some 2n7000 signal mosfets (to-92), and I am unable to get it to work. I think it's due to current limits (200mA). These, the 2n7000 have protection diodes built in, according to data sheet image.

In any case, I set up the small npn transistor with 1k to base (grounded) and a 12V battery, with the motor on the collector/drain side. What happens is that it doesn't switch (as it shouldn't) when base is grounded, but float the base, and it switches on, sometimes. Eventually, it will just turn on no matter what, whether base is grounded or not. As I mentioned, these to-92's can't handle the actuator.

I could always use a relay, but that wasn't the point. I'm trying to get the transistors to work. I also tried a TIP120, NPN, darlington mosfet, but this didn't work on the perf board, and I moved to the 2n7000.

EDIT: I was able to get expected results from the 2N7000, by not forgetting the diode across the motor. Put gate low, it is off. Put gate high, it is on. However, it latches. I have to put the gate low again in order to get it to turn off...

A solution to rememdy this is to hold the base/gate at ground with a 2.2K R, then short the base HI (12V here) to turn it on (quickly, and shortly) before letting it go back to ground. Seems to work with no ringing at GND after coil is off. Or, just use an arduino and wire to IO.

Also, I definitely did blow some of the Mosfets, without the diode on the motor. They have their own protection, but that isn't enough by itself.

In other news, the bell is looking like a better solution than the speaker I considered before. More moving parts, but worth it.



\end{document}

