Show Posts
Pages: 1 [2] 3 4 ... 8
16  Using Arduino / Sensors / Re: sensing mains power on: July 18, 2012, 10:56:04 am
Oh, and these caps should be ok?
http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=160816947443&fromMakeTrack=true&ssPageName=VIP:watchlink:top:en
17  Using Arduino / Sensors / Re: sensing mains power on: July 18, 2012, 10:54:12 am
I quickly made a schematic diagram of what I had in mind. Does this look OK?
18  Using Arduino / Sensors / Re: sensing mains power on: July 18, 2012, 09:33:04 am
The arduino will be powered from the permanent mains (it has to be always on) via a small 5V PSU (one of those USB chargers). The arduino will control the lamp / LED and will be hidden in the ceiling rose or similar. It will be sent commands via a RF module. The idea is that the light switch on the wall can also be used to switch the lamp on and off so that "she" does not notice the difference but I can still control the lamp remotely.. ;-)
19  Using Arduino / Sensors / sensing mains power on: July 18, 2012, 06:40:30 am
Hi,
I'm looking for the easiest (i.e. smallest) way of sensing whether mains power is on or off with an Arduino input pin.

My first thought was to use a circuit that drives a LED from 240V mains power and substitute the LED with an opto-coupler (a 4N25 for example).
There are some circuit diagrams on this page: http://www.marcspages.co.uk/tech/6103.htm

My worry with that is that the LED would "blink" at the mains 50Hz. This is not a problem with a visual-only LED indicator but will give false readings when read at intervals with the Arduino. I could add another capacitor parallel to the LED as shown in the diagram for the blinking LED on the website above. But I was wondering if there are any simpler and smaller ways of doing this?

The idea is to replace a ceiling lamp with an Arduino controlled LED lamp and to use the existing cabling and wall switch. There is a 3 core cable going to the ceiling lamp, so I could have permanent mains plus switched mains from the wall switch.
20  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 06, 2012, 09:06:16 am
I've managed to solder this on a rather small footprint last night.. ;-)
Not tested yet, will report back how it works.

Thanks again for all your help! Much appreciated. smiley
21  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 05, 2012, 10:10:06 am
Thanks for that. I'll use 16x 4k7 then, that adds up to 17mA.
22  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 05, 2012, 09:50:14 am
regarding pin13 as pull-up, I should probably wait a while between setting pin13 HIGH and reading the switches for the capacitors to charge?
23  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 05, 2012, 09:45:50 am
yup...

and MarkT recommended a 10kOhm protection-resistor instead of the 220Ohm resistor...

I assumed that was if I kept the UDNs. So you would also recommend going for a higher value on the series resistors?
24  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 05, 2012, 09:39:24 am
So this would be the final version?

Quick question on the Zeners, just so I understand this right... They prevent the voltage on the input pins from rising above the Zener voltage, right?
25  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 05, 2012, 08:13:41 am
Ah, you mean connect the common side of the pull-ups to pin 13 instead of +5V, set pin 13 as output and normally on LOW. Then, before I  check the switch states, set pin 13 HIGH, read the switches, then set pin 13 LOW again? That sounds like an excellent idea. Thanks !
26  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 05, 2012, 06:11:01 am
Oh, and I will have a look at your debounce library, thanks for that!
27  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 05, 2012, 06:00:22 am
You could test at your place easily enough. I'd start with a circuit like the attached. I'd definitely use software debounce as well, probably for some ridiculously long time like 100ms. There are several debounce libraries out there. My favorite is the one I wrote smiley-grin https://github.com/JChristensen/Button

Thanks a lot for that circuit. I have modified my schematics and attached it again. I take it that Zener can be any 5V Zener? Or is there any particular reason why you chose that model?

Just after I posted my previous reply I did realise that I could test at my place with a 20m cable. smiley
What I couldn't test is any potential interference caused by specific wiring at my friend's house. But he assures me that these cables do not run parallel to mains cables. In fact, the window contact cables go through the ceiling while mains power is wired through the floor. This is a single storey house (i.e. a bungalow).

Sorry about the capacitors...

Apology accepted... smiley-grin
28  Using Arduino / Sensors / Re: Can I connect input pins directly to +5V? on: July 04, 2012, 01:34:09 pm
Thanks for your replies.

So I understand that in theory my circuit would work (phew) but it's not ideal. I need better protection.

I haven't seen the wires installed in his house myself. He is in Germany and I'm in the UK. This is also why trial and error is not very practical in this case. I'm building this for him and it should then work at his place when I post it to him. So I rather over-engineer it a little. smiley-wink

From what he tells me these are single pair wires connected to the reed switch on each window. Not sure what type of cable they used. Will ask. I doubt it's shielded.

There is also no power by the windows, just the reed switch. So running anything active near the window (like the suggested ATtiny) is out of the question. Also, for the same reason and because the cables are already installed, fibre-optics are ruled out too. smiley

I'll edit the schematics with the suggestions made here and post it again.

You will need good protection circuitry if the cables run alongside mains cables (these can have kV level spikes on them which would induce crosstalk voltages easily capable of frying the Arduino.

I'd suggest for protection using a 10k resistor in series with the cable at the Arduino end and a 100pF to 1nF capacitor to ground on the input pin.  The chip's protection diodes ought to do the rest (adding schottky diodes will be more rugged).  Since the application doesn't require high speed operation the low-pass filter formed by the resistor and capacitor won't be an issue.

You will need to debounce the signal since it comes from a relay.

Do you mean I should get rid of the UDNs alltogether or add the resistors and capacitors to the circuit with the UDNs still there? I wish there were capacitor arrays just like the resistor arrays. 16 capacitors to GND is going to be a nightmare on Vero board. smiley-grin

Regarding debounce, the idea was to read the switches every 10 seconds or so, not continuously. I was hoping that I wouldn't need debouncing in that case. Even if one read-out was wrong, 10 seconds later I would have the correct state.
29  Using Arduino / Sensors / Re: DS18B20 parasite power mode, output to common anode RGB LED. on: July 04, 2012, 05:15:21 am
I have recently used quite a few DS18B20's in various projects. I'm using the DallasTemperature library on top of the OneWire library. This makes reading the DS18B20 sensors a lot easier.

http://www.milesburton.com/Main_Page?title=Dallas_Temperature_Control_Library
30  Using Arduino / Sensors / Can I connect input pins directly to +5V? on: July 04, 2012, 05:05:58 am
I've got quite some experience with Arduinos now but a doubt is growing in my head about this latest project.
The idea is for the Arduino to read the state of up to 16 reed switches.

The reed switches are in fact "window open/closed sensors" at a friend's house. As such they are on relatively long cables going through the house (estimated up to 20 metres). That's why I don't want to connect these cables/sensors directly to the Arduino but use some sort of driver to protect the Arduino from any spikes that might come from these long cables.

Now, I could use 16 transistors but I have quite a few UDN2981 (8 source drivers) lying around and was going to use these with some pull-up and pull-down resistor arrays.

The UDN2981 would basically switch +5V to the Arduino input pins when the remote reed switch is open. When the reed switch is closed (to GND) the UDN output would be open and the pull-downs would pull the Arduino input low.

I would of course need to disable the internal pull-ups.

That's the theory in my head. Would it work this way or is this a bad idea? Should I rather put limiting resistors in-line between the UDN and the Arduino?
Pages: 1 [2] 3 4 ... 8