Show Posts
Pages: [1] 2 3
1  Using Arduino / Project Guidance / Re: Home Security System Project – 60Hz Interference on: October 06, 2013, 01:27:21 pm
Hey everyone...sorry for the delay...family visiting.

Thanks for the awesome information!  So I guess "tylernt" was on to something.

When the loop is open, you had a wire connected to nothing other than the base of the transistor, literally an antenna.

Yep, I see this now.  Great point.  Live and learn.

...but I have suggested it be further rearranged according to sensible design principles; a protective resistor between the loop and pull-up resistor, and the transistor base and referencing the loop to ground rather than the supply voltage...

I don't follow.  Would you mind providing additional detail?  Also, I don't necessarily need to run the loops at 12v.  I just need 12v for the PIR supply.  The loops, including through the PIR, could most likely run at 5v just fine.  In v1.0 I chose to run them at 12v simply because I already had 12v headed through the walls for the PIR, there is a lot of distance to cover throughout the house, and I wanted to keep the draw on the 7805 to a minimum and keep it running as cool as possible.  If avoiding the 12v - 5v interface makes things easier, then so be it.  I'm glad I did use a 12v interface however, because the unexpected 9v Pk-Pk would have damaged my chip.

and using debounce code.

I've done software debouncing before, so no problem with the code.  But I'm not sure why this is necessary here.  Please explain.

2  Using Arduino / Project Guidance / Re: Home Security System Project – 60Hz Interference on: September 28, 2013, 09:27:07 am
I don't think that will work because the base-emitter junction will have lower resistance so any induced AC current will take that path instead of flowing through the pull down resistor.

Thanks for the idea though, I hadn't pondered that idea.
3  Using Arduino / Project Guidance / Re: Home Security System Project – 60Hz Interference on: September 26, 2013, 06:30:51 pm
All is quiet on the troubleshooting front...

Any ideas?
4  Using Arduino / Project Guidance / Re: Home Security System Project – 60Hz Interference on: September 24, 2013, 10:49:02 pm
Thanks for a couple quick inputs already...

Quote
To start with, I suggest you check that this noise isn't causing any transient voltages under 0V or over VCC on any of the I/O pins, because that can damage the microprocessor

I've looked elsewhere throughout the circuit but did not find anything unusual on the 12V or 5V portions.  I wondered if something was slowly being damaged since it worked at first, then gradually got worse.  I thought the AC on the base of the transistor may have damaged it.  I looked at the Vebo and found it to be 6v.  With 9v peak-peak, there should have only been about -4.5 ever applied to the emitter base junction.  Not good, but the transmitter should survive...right???

Quote
If that's all safe, screened cables or UTP should help, but might not be practical since the wiring is all already installed.

Yep, if I were installing the system from scratch, I'd do a lot of things differently.  I've got to work with what is here.

Quote
I get the impression that your inputs are connected so that they are pulled down to GND when the sensor is active and not pulled down when it is inactive - the internal pull-up being expected to hold the floating wire HIGH in that case.

Yes, I've got the analog pins pulling up the collector of a 2N3904.  The door/window sensors are a series of normally closed magnetic switches (normally open, but closed when the door is closed).  The route is 12V supply, through a 1k resistor, through the door/window switches, to the base of the 2N3904.  With all the doors/windows closed in that zone, a base current of about 2ma flows through each zones transistor base which keeps the I/O pin held LOW.  If a door/window is opened or a wire is cut, the base current stops, and the I/O pin goes HIGH.  I was going for a fail safe design.  Trouble is that, even though the base circuit is opened by the switch, there is apparently enough induced AC current passing through the base on the positive pulse to turn the transistor on.  This pulses the input at 60Hz.

Quote
The software option would be to debounce the signal in software i.e. wait for it to remain over/under the threshold continuously for some multiple of a 60Hz cycle before actioning the change.

Trouble is that the 60Hz pulse never stops.  My software fix for the moment has been to put a generic 15 second delay after the chime.  Usually that's long enough to get through the door and close it again.  Now the error is transparent, but I'd like a to solve the problem, if possible.

5  Using Arduino / Project Guidance / Home Security System Project – 60Hz Interference on: September 24, 2013, 07:08:48 pm
Hello everyone,

Sorry for the long post, hopefully someone can help out.

My home was prewired for a security system, but never had the control panel installed.  All of the door/window sensor wiring terminated in an empty box on the wall.  I’ve built an Arduino chip based home security system that worked fine for several weeks, but now has a bug in the hardware.

Project overview…

I use an Android phone to communicate various arming modes and disarm commands via a JY-MCU Bluetooth module to the standalone ATMega328P via serial relay.  I’ve configured analog pins A0 - A5 as inputs and digitally wrote them HIGH to enable the internal pull up resistor.  Each one monitor’s one of the six home zones.

The installed system had 1 PIR sensor which required 12V.  I’ve used a 12V regulated power supply to power it and each of the series wired door/window sensors.  From that, I’ve got a 7805 powering the ATMega328 and JY-MCU.

I’ve interfaced each of the 12V door/window and PIR sensor circuits with the ATMega328 via a 2N3904 transistor.  With the doors/windows closed, the series wired sensor circuits connect to the base of the 2N3904’s which pulls the respective analog pin LOW.  The code loop simply checks each zone pin and triggers if found to be HIGH.  I’ve set it up so that when the system is not armed, a door opening will produce a “chime” sound and hang in a while loop until the door closes.  This prevents endless chiming while the door is open and resets when it closes.

"One ping only!"  <---Movie reference anyone?

 
Code:
if (digitalRead(zoneOne) == HIGH)
  {
    if (systemArmed && !alarmTriggered)
    {
      alarm();
    }

    else if (!systemArmed && !alarmTriggered)
    {
      chime();
      while(digitalRead(zoneOne) == HIGH);
    }     
  }

The problem…

This was fine for a few weeks, but then, as the back door was opened, we would occasionally get two chimes.  A few days later, three or four chimes.  Eventually, the chiming would never stop.

I checked the pin for that zone with an o-scope and sure enough, when the door was opened, I could see the pin voltage bouncing HIGH and LOW endlessly.  I noticed it was not random at all, but very much consistent pattern.  I also noticed it was bouncing at exactly 60Hz.  Next, I checked the wire from the sensor circuit and sure enough, I found a 60Hz sine wave with about 9V Peak-Peak.  To confirm the source, I shut off all the circuit breakers to my home, except the one powering the room that the alarm is plugged into of course, and the AC wave dropped to about 6V Peak-Peak and the door chime worked fine.  Finally, I unplugged the entire unit, disconnected the sensor wiring running throughout the house from the control board, re-powered the house…and yep…still have a beautiful 60Hz induced AC wave.

So, I’ve obviously I’ve got sensor wiring running close to my household wiring throughout the house.  The door that is malfunctioning is right next to where the mains power enters the home.

There isn’t much I can do about any of that, so I’m looking for a way to filter the 60Hz AC interference.  I did a basic low pass filter setup on the breadboard and tested it with the function generator and scope.  I was able to reduce the AC signal to about 400mV on the output, but when I install it onto the malfunctioning zone, the problem still remains.

I’m currently designing v2.0 of this system which incorporates a DS1307 Real Time Clock, relocates the Bluetooth module off the board and outside the metal box for better signal strength and interference reduction, a 16x2 I2C LCD display and a couple buttons to allow interface without the phone, and an LM2674 based SMPS to handle the increased power demands without having to heat sink a 7805.  The LCD display and Bluetooth module are located off the board so the attached v2.0 schematic only shows attachment headers.  As part of this redesign, I need to address this EMI issue.  Any ideas?
 
I’ve attached the Eagle schematics of version 1.0 and 2.0.  Let the spear chucking commence!
6  Topics / Education and Teaching / Re: Looking for a degree... on: August 22, 2013, 01:27:13 pm
Thanks for the link. It looks like a treasure trove of useful information.
7  Topics / Education and Teaching / Looking for a degree... on: August 21, 2013, 08:11:04 am
Hey everyone,

I hope this question is appropriate in this forum.  I’ve searched around, but didn’t find any similar discussions.

So, I really enjoy engineering in general and have really taken to electronics in particular.  I’d like to pursue a formal education, but I’m not sure what direction to go.  I’m eligible to retire from the military in about 5 years and I’ve been a flight engineer most of that time.  I’ve also completed an AS degree in Professional Aeronautics, but I have lost interest in pursuing that any further.

Does anyone know of a good U.S. school program to look at and what careers those degrees could lead to?  Unfortunately, I’m mostly restricted to an online education which had caused me to hit a dead end so many times I’m ready to ask for help. It seems that any program that I could complete with my schedule turns out to have terrible reviews or the degree isn’t worth the paper it’s printed on.

Thanks in advance for any inputs.
8  Using Arduino / General Electronics / Re: Bluetooth Module for Arduino on: June 25, 2013, 06:47:44 pm
My module is powered at 5v, but communicates via 3.3v logic. I verified this by powering it up once, connecting to it with a generic bluetooth communication app on my phone, and sending a single character.  Measuring the output I found it to be 3.3v.  Most newer versions are 3.3v, but there are certainly 5v versions out there.

You can certainly get fancy and use a level shifter, but it's really not necessary if your simply learning or prototyping...or ever really.

If your module input requires 3.3v logic, simply use a voltage divider.  A 10k and 20k voltage divider works great.

If the module outputs 3.3v, just connect it up to your designated software serial input on your Arduino. The 3.3v logic high is sufficient for the 5v Arduino to see it as a logic high.

The first time I did this I was concerned about the reliability, but I've encountered zero problems with communication in either direction.
9  Using Arduino / General Electronics / Re: 15W Speaker Circuit Setup on: June 23, 2013, 07:00:34 pm
Nice and simple.  I like it!  What wattage are those resistors?  For a single 34 Ohm resister, my simple math works out to 350ma and 4.24W.  Where did you find them?
10  Using Arduino / General Electronics / Re: 15W Speaker Circuit Setup on: June 23, 2013, 04:09:19 pm
Hmm...I don't need quality sound, so I hoped there would be a simpler way to do it.

Sounds like I'll have to make room for an audio amp somehow.  Can anyone point me to a simple IC that uses minimal external components?

I just want to be able to feed it from the Arduino tone() function to generate a siren of respectable volume.
11  Using Arduino / General Electronics / Re: Bluetooth Module for Arduino on: June 22, 2013, 12:01:38 am
Hey there,

I've just finished my first project with Bluetooth.  The link below tells a little about the key pin, but it shouldn't be necessary for your project.  I've never seen your module before.  I used a dirt cheap JY-MCU module off e-bay.  Can't remember which version, but they are all similar.  The key pin is not needed for basic RX/TX serial communication.  Just hook up power, gnd, TX, and RX. 

You should look into the Software Serial library.  It will enable you to communicate via alternate pins while leaving the default serial pins available for debugging communication with your computer.  My default serial baud rate was 9600.  You may have to experiment if you don't have documentation.

Also, be sure to find out if the serial INPUT to the module is supposed to be 3.3 or 5 volts.  Many require 3.3v input and the Arduino will blast it with 5v which will cause damage.  If you do need 3.3 volts, a simple quick fix is a basic voltage divider.  Cut the voltage by 1/3 and your in business. The Arduino will work fine from 5v or 3.3v inputs from the module output.

http://diydrones.com/profiles/blogs/setup-bluetooth-jy-mcu-bt-board-v1-2

Good luck.
12  Using Arduino / General Electronics / 15W Speaker Circuit Setup on: June 21, 2013, 11:38:56 pm
Hey everyone,

I’ve been working on a standalone ATMega328 based home alarm project and I’ve got a question.  I’ve got everything working on the breadboard but up until now I’ve prototyped using a small 8 Ohm .2W speaker that is driven directly from the ATMega328 pin via a small resistor to keep the current under control.  Now I need to go full scale for the house installation which will use an 8 Ohm 15W speaker.

I’m using a 12v/1A power supply for the system so I would like to use that as the power source and switch a transistor with the ATMega328 output using the tone() function.  I’ve got a few IRF510 MOSFETs in my parts box.  Surely they can handle switching this speaker!?!?  I’ve checked the datasheet and these seem like overkill (which I’m fine with) but that’s what I have handy.

My problem is that I’m not sure how to calculate the basic Ohm’s law variety stuff when dealing with a speaker and the 50% duty square wave.  Only 8 Ohm’s of resistance isn’t much against the 12v.  Don’t I need to limit the current?  12v / 8 Ohms = 1.5A and 18W!  Yikes! There must be something more to it than just the basic N-MOSFET low side switching.  Isn’t this really impedance anyway, not resistance?  Does the 50% duty cycle change these values at all?  Ahhhh!?!

I’d like to target about .8A to keep a 20% safety margin against my 1A power supply.  That should be plenty loud enough.  The 12v supply also powers an IR sensor which it toggled on and off in different modes by the ATMega328 via a transistor.  It draws about 60ma.  The rest of the circuit is powered via a 7805 IC and draws only a few milliamps, so heat dissipation is not a problem.

I’ve searched the web, but I just haven’t found much help with determining the best setup to use and how to calculate various values.

I can't believe I've conquered designing my own Android app and Bluetooth communication...but speakers perplex me.  Just never worked with with them before and I want to get it right!

Eagle schematic is attached.

Thanks for any help you can provide!
13  Community / Local Groups / Re: San Antonio Group? on: March 22, 2013, 10:35:14 pm
Did you ever find any interest in a local group here is SA? I would be interested but I am a total Newb.. I haven't even ordered a kit or board yet but this is one reason a local group would be interesting.

Nope, I didn't hear from anyone.  Go buy one and start blinking an LED.  You'll be hooked!
14  Using Arduino / General Electronics / Re: High Side Switching on: March 02, 2013, 10:16:37 am
Hey everyone,

Thanks for the interest and the replies.  Sorry I took forever to get back on here myself. Life calls. :-(

I kept the diodes in the circuit just in case and it is working just fine.

Why even use high-side switching ? Why just not use a N-mosfet or NPN transistor - the outputs on the PCF8574 isn't Open-collector...

Easy answer there is that I sidnt have any N-MOSFETs in my box. As for the NPN BJT, when I noticed from the datasheet that the PCF8574 was designed to sink FAR more current than source, I just decided to play along with that concept. I guess it could work either way.

Have you made beer before ?

Don't most people use a 23 liter container,  will that fit in a "mini fridge"

Unless your climate is very bizarre,  it seems unlikely that you actually want to try and ferment beer in a fridge.

Yes, I'm an avid homebrewer. 

I have a 6 gallon (~23L) carboy for primary fermentation and a 5 gallon for secondary (if I even use a secondary).  I modified the fridge a bit to get it to fit.   The cooling plate was lowered and I swapped the low grade insulation in the door for some thin high grade stuff.  Adding a thin whiteboard on top of that still left just enough room for my largest carboy.

I just moved to south Texas and no longer have a basement.  For most of the year it is far to warm in the garage, so I've been designing this fermentation chamber.  Also, now I'll be able to try lagering!

Maybe he's doing the unthinkable and using the well insulated fridge with a small heating element to maintain a nice fermenting temperature with little or no heat loss through the side walls / door etc....

I've got spare pins available on the PCF8574.   When it cools off again I just may add another relay and a heating element of some kind :-)

15  Using Arduino / General Electronics / Re: High Side Switching on: February 19, 2013, 10:15:04 pm
I'd include the diodes, cheap insurance. The back-EMF is likely to be a relatively high voltage, so not something I'd want running around. Would hate to see hand-crafted beer ruined smiley-grin

I guess it's better safe than sorry, but I'm thinking they are not necessary when high side switching.  I'm going to do some testing this weekend to validate this...after I brew another batch of course.  :-)
Pages: [1] 2 3