Ok, there are a lot of posts regarding the Science / Invention Fair that Robbie participated in, with his very cool “Light Alarm” circuit. I wanted to post one final summary, a guided tour if you will, of all the previous posts. That way it should be easier for all of you readers to pick and choose what you want to learn about the project, and not have to dig through things as much.
First and foremost, you can see a demo and hear an explanation of the project in Robbie’s own words in the YouTube Video appropriately named “Light Alarm Invention Fair Project”. That summarizes things pretty well.
Beyond that, here are the posts about the project, in order, and following that, some pictures. I’ll also try to get the complete schematics uploaded soon too.
The Science Fair
More science fair news
555 timer circuit success!
Robbie has the “Magic Touch”!
First Real Test
DIY Logic Gates
A mistake fixed, and ultimate success!
Some pictures of the circuit:
Robbie still had a lot of work left to do even after the light alarm was built. Tri-fold displays to make, schematics to copy down, and finalize. Write-ups to do. (Should have been also, “Blog posts to write”).
While copying down a schematic from the picaxe.pdf circuit we had found online, he asked me which part of the one PNP transistor we used was the emitter and which was the collector. I gave him an answer according to the way we had wired the circuit, then realized that something wasn’t quite right about my explanation. Oops. Sure enough — I had put the transistor in backwards. I’ll blame it on the fact that I’ve been out of school for more than 10 years with not enough hardware work since then.
We rushed to the circuit, and pulled that transistor, reversing it (base was middle pin) and putting it back in. Well, what do you know? The circuit now worked even better — the potentiometer for the base output voltage seemed to have more effect. Yay!
Then, that evening, Robbie wanted to wire the whole thing up in his room. We replaced the light switch face plate with the one that had holes drilled in it for the mounting of the light alarm. With everything in place, we held his alarm near the mic and made it go off, not expecting anything to happen. To our great surprise, it worked! All of our disappointment of the alarm not triggering the circuit was gone.
It only worked if the alarm was quite close to the mic, so after some quick furniture rearranging and book stacking, we had a functioning system. The next morning Robbie reported success — the light alarm circuit had turned on his light, helping him to wake up! Just in time too, that day was when he had to bring it all to school.
So, after putting it all together and trying it with success several times, we realized it was time for the ultimate test — triggering it with Robbie’s actual alarm clock. Off Robbie ran to get the clock, and a few minutes later we had an alarm going off.
But not the circuit.
Talking loudly worked. Clapping worked, very well in fact. But the alarm did not. Even when held quite close to the condenser mic.
We have not created an wake-up alarm light trigger, but instead have created “The Clapper” Everybody join me for a chorus of “Clap on! *clap* *clap* Clap off! *clap* *clap* Clap on! Clap off! The Clapper!”.
Hmm, what to do about this though. Robbie decided he could simply talk about the invention at the fair and show them that it triggered by voice, and hope that is good enough. But it is a disappointment to not have it fully function as we wanted.
3 hours after fixing the circuits due to the Magic Smoke incident , we had the sound detector circuit up and working. I think we’ve learned a lot from the project so far because this part was relatively uneventful. We knew from doing circuit simulations using Qucs and LTSpice that this circuit was not going to be perfect, but we were just hoping it’d work more like the PDF said it would, and less like the simulations.
In the end, it performed ok, after we adjusted the potentiometers for sensitivity and base output voltage.
No electronics project is complete without Magic Smoke!
We realized we needed to build all of our logic gates by hand (reference the last post), so we got to work creating OR and NOT gates. We double and triple-checked our circuit, held our breath, and plugged in the batteries.
MAGIC SMOKE! I don’t recall if it happened immediately, or only after we triggered the circuit, but some transistor somewhere wasn’t happy.
After frantically pulling all power to the circuit, I had the presence of mind to test each transistor’s temperature. It was a transistor on one of the NOT gates. That didn’t make much sense, since that is the one circuit I had already built successfully.
Now you have to wonder — are all the circuits fried? What does and doesn’t work? We started pulling wires so that each individual circuit was isolated from others, testing each part along the way. 556 chip is still good (yay!) OR gates working. NOT gates are wired correctly according to everything I know and am reading about on the Internet. Hmm… In the end, we concluded that it was probably just a bad transistor, and rewired everything. I also got a working circuit (a NOT?) and tried each of my transistors in turn in that circuit, to make sure that there would be no surprises from any of the rest.
After putting it all back together and plugging in the batteries, we tried again. Trigger…click….2 second pause….click. Not only that but with repeated attempts at triggering the circuit were ignored for 10 seconds, one of our design goals (and the reason for the 2nd 555 circuit and most of the logic gates).
Now that we are high on magic smoke, we are ready to complete the circuit!
One huge problem we have with Robbie’s science / invention fair project is that we are relying on RadioShack for parts. Yeah. That one store that USED to be a good supplier of electronics. Now they have a small part of one row, and a few drawers with SOME components.
Unfortunately they lack the following:
- Any logic ICs
- A useful set of assorted capacitors (the one bunch we bought was almost useless!)
- Small potentiometers
- Employees who have any knowledge of what these components are.
We can deal with large pots, and change some circuit values to work around their meager capacitor supply. But, the first one was a real problem. We needed some AND, NOT, and OR chips 74LS chips for our circuit to be successful.
Fortunately it hit me at some point that these circuits should be easy to build with simple transistors. So, I looked them up on the Internet. Oh duh — dead simple. In fact, I had accidentally built a working NOT gate using a transistor while trying some stuff out.
There is a good article on Making Logic Gates with Transistors on Squidoo, so I won’t repeat it in depth here.
For an OR gate — two transistors in parallel (collectors are tied to each other and emitters are tied to each other). If either one is “on”, voltage follows through the transistor and to the output (taken at the emitter). Makes sense.
AND gate — Two transistors in series — the emitter of one is hooked to the collector of the next one. So, BOTH have to be “ON” (with a voltage on the base), for the voltage to flow through the circuit. Output is taken from the second transistor’s emitter.
NOT gate — one transistor, and a resistor between the emitter and ground. The “output” of the circuit is taken right from the collector, which is tied to VCC. So, basically that point drops to zero when the transistor is on, since all the voltage drop is across the resistor at that point.
It was kind of fun doing this ourselves, and used less room on the breadboard too. We WERE contemplating rigging our NAND 74LS20 chip to do the NOT function, but that would’ve been a huge waste of space. And, when we found we needed OR gates instead of AND gates (we had 74LS08 AND chips), we realized that transistor-based logic was inevitable.
After getting the relay triggering for the proper 2 second interval, it was time for the first real test.
We wired up our KNEX motor to the relay, connected it all to our light switch face plate, held our breaths, and pulled the trigger wire.
It worked! “Like a Charm”.
This project is going to work out.
This first test was really important, since it helped us realize that we would need to mount the motor to the breadboard, plus if we stuck the batteries underneath the breadboard, it would put the motor at the right angle (~30 degrees) so that it would actually reach the light switch.
We have neglected to post what was up with the science fair project on a daily basis. Sorry!
I’ll try a quick summary in several posts, of some of the key things we did and learned after that last post about the 555 timer chip:
For some reason, the relay didn’t always fire. We were really confused by this, and thought there was something majorly wrong. One thing unusual that we had done was use ten 0.1uf capacitors instead of one 0.01uf capacitor. After buying some assorted capacitors at the RadioShack, we tried to consolidate down the whole circuit, and replaced the ten caps with only the one. Could this be the problem? It sure didn’t seem like it.
Here is the odd thing — whenever I was measuring voltages in the circuit while Robbie triggered it (by pulling a wire out from Vcc), it seemed to work. I wondered if my testing was influencing the circuit.
After a while, I just concluded that Robbie had some sort of “Magic Touch”. He could even get it to work sometimes when I wasn’t measuring things in the circuit with my voltmeter. Hmmm…
Suddenly when it was my turn again to try to pull the trigger wire, I accidentally bumped this wire with my hand. The circuit triggered and the relay ran. Woah. I suddenly realized that what the circuit needed was a high resistance path to ground so that that input to the circuit would drain all of its voltage when not directly connected to Vcc.
In other words, Robbie really did have the “Magic Touch”. When he pulled the wire, he was not as careful as me and was constantly bumping the wire and creating a path to ground, whereas I was very carefully pulling the wire straight up, never contacting the metal.
It’s a good thing we are talking about low current and low voltage here, eh?
One large resistor later, the circuit was triggering every time we’d pull the wire!
Robbie has completed the first part of his project — wiring up a K’NEX motor so that there are wires sticking out that will work as a switch. Then that is mounted to a light switch face-plate. (with holes drilled at a 45 degree angle in the bottom of the faceplate). We verified that the motor was strong enough to turn on the light switch like this, and that it took about 2 seconds to rotate one full rotation.
Next we found a circuit on the web (listed in the first entry about this), that showed how to use a 555 chip to create a 2 second signal whenever it gets a small signal as an input. ( http://www.ecelab.com/circuit-monostable-555.htm ) Robbie’s is very similar but with one more 555 chip circuit added in to make sure that the signal only comes out one time for every 20 or so beeps of his alarm. I had to teach him about logic gates to design this. Luckily we had an AND and a NAND gate chip, since RadioShack does not carry any of those.
Hopefully tomorrow he can put together this part of the circuit. Then the only thing left is the sound detection circuit. We have a few different examples of those on the Internet. One with 3 transistors, and the other with an op-amp. The op-amp uses the lowest amount of battery power, but I’m not sure how well you can adjust the noise sensitivity. He will probably just have to build it and see.
Robbie has a science / invention fair on the 17th and 18th of March (2010). He has been coming up with a whole bunch of ideas, and finally settled on one — a gadget that turns on his light in his room when his alarm goes off. With this, he will be more likely to get up and not just go back to bed.
Now we are poring over schematics for a whole bunch of circuits — sound detection — signal latching — servo or motor control. We’re pondering a whole bunch of electronics questions — is a 2N3904 transistor close enough to a BC548B to work in his circuit? If not, how does one modify the circuit to make it fit? (Radio Shack only had one type of amplifying transistor — NPN or PNP, I do not recall which). How do you interpret the markings on a capacitor?
Putting it all together will be fun too.