Pages: [1]   Go Down
Author Topic: Converting 6v AC to arduino input  (Read 832 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.
I have a project where I need to convert 10 6V AC switches into signals to the arduino. I only need to know if the switch is open or closed.  I want to do this for under say $5.

What would I use?

Thanks
Ben
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm working on a project where I need to sense when a 240VAC source is on.  I found this AC input optoisolator useful.

-j

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Somebody was supposed to say 6 Vac, how do you have 6V ac?? Then of course I would have looked at the schematic and seen the transformer that is putting out 6V DC...heh.

Sorry,
Ben
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use a diode to rectify the AC voltage to pulsating DC and then a capacitor to smooth out the pulsation and then possibly a resistor divider to scale the voltage to 5vdc. The result will be 5vdc when the AC is present and 0vdc when it is not, easily read from the A/D input or even a digital input. Should cost under a dollar per channel.

Lefty
« Last Edit: December 02, 2008, 06:28:58 pm by retrolefty » Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, if it's 6VDC, I'd probably use a voltage divider network (i.e. two resistors). 1k or 2.2k and 4.7k seem likely candidates.  A transistor or optoisolator would probably work, too, if you have them handy.

-j

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, sorry I made an optimistic mistake, it IS 6v AC.
So the diode, cap smoothing seems the way to go.
 Then I am thinking to use a 16 way multiplexer which will allow me to
use 4 digital pins from the arduino to select which switch to poll, then another pin for the actual read...so 5 pins total for 10 inputs (actually I have an idea to use a few more switches so that is perfect)


So what size cap would I use? 10v 1000uF
And the diodes could be 1N4004s?


Thanks all,
Ben
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"So what size cap would I use? 10v 1000uF
And the diodes could be 1N4004s?"

Any 1N400x diode would be fine. Cap is kind of too big in that it will be slow to charge and discharge. I would try something small say 1mfd to start and experimate with the time lag to detect high to low and low to high. There will be a time constant (RC) developed by the cap and the input resistance of the I/O pin plus any pull down resistance. A lot depends on how 'fast' you want to be able to detect a change of state on a switch. If for a pin ball machine you want fast, if for people turning switches on and off, speed is not so important.

Good luck
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thx retrolefty. It is indeed for a pinball machine.

I'll post the results.

Ben
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"It is indeed for a pinball machine"

i guess I'm on a roll today  smiley-wink Make sure you wire the diode such that the cathode band goes to the Aurduino logic and the other end to the switched 6vac.

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34541
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just a point, you say it's 6V ac but is that 6V rms or 6V peak. Most likely it is 6v rms as that's what a meter measures..

That means if you do a half wave rectification on it you will get 1.414 * 6 = 8.48 V as a signal. Be sure to factor that into your potential divider.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks grumpy, actually that should work out well because the voltage regular wants at least 7v to knock it reliably down to 5..

OK I found that mouser has DIP 16 channel analog multiplexers in stock at $1.25 so I am thinking that these could make my life much easier.

Warning: I am going to show my ignorance below:

So I have this 6v AC being brought in to all these physical switches, the switches make contact any bring 6v to lamps (6v bulbs) then off to a common ground.  
My plan is to remove the bulbs tap into the 6v coming in from the switches to the multiplexer, then use the arduino to check the values.

Question 1:
By Analog Multiplexer, does that mean I could connect the AC 6v from the switches directly to the multiplexer, or will I have to diode, cap, regulate each switch?
(The multiplexer is rated to run at 3-15V)

Question 2: If the above is possible then how should I power the multiplexer..can I do it from the 5v of the arduino

Question 3: Powering arduino. Will diode,cap(1uF), and regulator off the 6v ac(rms) power I have available be stable enough to power the arduino, or should I use a wall wart?

Question 4: Should I hook arduino ground to multiplexer ground to pinball ground.

Thanks,
Ben
Logged

Pages: [1]   Go Up
Jump to: