Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Getting AC signal to play nice with Arduino's TTL input?

Status
Not open for further replies.

RevZ

Newbie level 3
Joined
Jan 24, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,318
For measuring the engine speed on a two-stroke engine with adequate precision, I found the following project for the Arduino:

http://www.pjrc.com/teensy/td_libs_FreqMeasure.html

It's easy to set up, however it uses pin 8 which is a digital I/O pin.
That webpage says it wants to have a TTL input (0-5V with highs being >3V and lows <1.5V, I assume). However, the signal it would be receiving isn't TTL-safe, nor safe for the Arduino in its entirety.
The signal is picked up off the lighting coil on the ignition ground plate, which like the magneto itself generates an electrical pulse from the spinning of the flywheel and with four magnets (two opposed polarity pairs) passing by per revolution of the flywheel, the resulting waveform looks like this:



With the voltage peaks varying between ±6V at idle with all the lights off (slightly less under load) and beyond ±12V unloaded / around ±12V with a slight load applied (6-12 with full load), around 12000 revolutions per minute.
The frequency of the pulses would be 400 Hz at that speed.

What would I need to do to turn this waveform into a signal that will pick up nicely on the Arduino's digital I/O pin? If they say it expects a TTL signal I'm not one to try and get around it, but on how to get a good working signal out of it, I honestly have no clue. I understand what has to happen, but haven't the slightest clue on how to actually do it safely so I don't fry the AVR or anything..
 

RevZ

Newbie level 3
Joined
Jan 24, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,318
Wouldn't an opto-isolator circuit drop the voltage too much for the chip to see the pulses as highs, considering the source voltage low is to be taken as around ±6VAC?
If not, which opto-isolator would you suggest for this particular use? It needs to be fast enough to transfer signals up to around 18000 RPM, which would be 600Hz. Seeing as that isn't fast at all, the chip might possibly get a beating from that AC side; do I need to rectify it over a 1N diode bridge rectifier first?
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
4,986
Helped
1,090
Reputation
2,190
Reaction score
1,074
Trophy points
1,393
Location
California, USA
Activity points
27,288
If you use an opto with an open-collector output, you can set the output voltage to whatever you like (within reason). Just about any opto should work.
 

crutschow

Advanced Member level 5
Joined
Feb 22, 2012
Messages
3,788
Helped
903
Reputation
1,804
Reaction score
888
Trophy points
1,393
Location
L.A. USA Zulu -8
Activity points
21,343
The Arduino has protective diodes on its inputs so a series resistor of 50kΩ or so should prevent the maximum 12V from damaging anything.

If you want to square up the input, then you could use a comparator such as a LM339 for that purpose. You would also need a series input resistor with that and a small amount of positive feedback from the plus input to the output to provide hysteresis and prevent oscillations, say 50kΩ input and 500kΩ feedback.

The opto will also work to square up the input.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top