1
\$\begingroup\$

A continuation of this question.

I am attempting to read two flow meters through the mic port of a phone/tablet. The flow meters' pulse pins toggle between +0V and +5V as their pinwheels rotate. I use an R-2R to combine the pulses from the flow meters. My first attempt was to simply send the digital output from the R-2R straight into to mic port like so:

schematic

simulate this circuit – Schematic created using CircuitLab

This worked great on my PC. I was able to look for edges in the signal and (based on the magnitude of the amplitude change) determine which flow meter the pulse was sent from. Here is a screenshot of my program detecting pulses on my PC:

Raw signal read from PC mic port: PC flow meter signal http://s3.awesomebox.net/Flow%20Meter%20Reader/FlowMeterReaderRaw.png

Program highlighting detected flow meter state changes: PC flow meter signal state change detection http://s3.awesomebox.net/Flow%20Meter%20Reader/FlowMeterReaderDetected.png

As you can see, the program is successfully identifying flow meter state changes; smaller amplitude changes are caused by flow meter 1 and larger amplitude changes are caused by flow meter 2.


The problems start when sending the same signal to my Galaxy Note 8 Android tablet. This is what the signal looks like when one of the flow meters is spinning and changing state, read through my PC's mic port: single flow meter through PC http://www.awesomebox.net/share/androidReadingExpected.png

Here is what the same signal looks like when read through the tablet's mic port: tablet flow meter signal http://www.awesomebox.net/share/androidReadingReal.png

Because of the (stronger?) AC-coupling in the tablet's sound card and the noise cancellation and other processing done to the signal, it is not possible to use the same edge detection method.

I was suggested by @DwayneReid to not try to force a digital signal through. Instead, I should convert the digital signal to an analog one and pass that through. He suggested this schematic for converting the digital signal into an analog one:

schematic

simulate this circuit

I combined this schematic with mine and came up with:

schematic

simulate this circuit

As far as I understand it, a constant analog signal should be generated by the 555 timer and sent to the mic port. Voltage changes caused by flow meter state changes should cause frequency changes in the analog signal. I will then be able to read the frequency changes of the analog signal and know when a pulse occurs, and based on the change in frequency, which flow meter the pulse came from.

This is what the signal now looks like when one of the flow meters is spinning and changing state, read through my PC's mic port: reading with 555 http://www.awesomebox.net/share/ReadingWith555.png

As you can see, there is a now a slight oscillation present in the signal. However, the overall signal is unchanged and none of my expectations are met. The constant analog signal is so slight it could be considered noise. Changes in voltage seem to effect the signal no differently than before.

Where is my schematic wrong? How can I get a generate a constant analog signal that changes in either amplitude or frequency when the combined voltage from the flow meters changes?

Thanks,
- Mike

\$\endgroup\$
  • \$\begingroup\$ Mic input may have some DC in it, try some cap between. Also not sure why you picking signal from discharge but not output. Try an emitter follower, connected to output and connectemitter to the card through a cap. \$\endgroup\$ – ilkhd May 12 '15 at 3:28
1
\$\begingroup\$

Given the unknown limitations of the mic inputs of various devices you have to design conservatively.

If you are always going to be sending just the pulses from two flow meters you can use pertty specialised modulation techniques.

Knowing that you will need to decode the signal in the device you want to maintain a relatively simple modulation scheme.

Given that the bandwidth should be low you have some flexibility.

I suggest you use amplitude modulation and frequency shift keying (FM and AM together) at these low bandwidths you will likely be able to have simple modulation systems. I would specify a 8 pin microcontroller for the modulator.

If you have flow sensor one wired up to generate 1300Hz and 2100Hz for the two states and flow sensor two wired up to modify the amplitude between 30% and 70% of maximum you should be able to send the data over almost any kind of audio signal path.

https://en.wikipedia.org/wiki/ITU_V.23

If you do not want to rely on amplitude modulation you could use a dual tone system like a DTMF phone and use the two flow sensors for the row and column selects on the top and bottom rows and the left and right columns. This will require a bit more smarts in decoding but even a PIC micro can do it so a smart phone should be fine with the job. The tones for the one sensor would be 1209 and 1633 HZ and the other would have 697 and 941 Hz, these are not harmonically related and well within the audio band and can be separated from each other easily. Generating these signals in a micro is possible but a bit harder though there are examples out there. There used to be ICs that would do this for you from digital inputs requiring a few passives and a crystal.

https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling

Just to add to your results so far. All the mic inputs will be different. The DC coupling capacitors will make low speed digital input a problem, converting your initial 4 level analogue system to AFSK with a 555 or similar is also a workable solution.

\$\endgroup\$
0
\$\begingroup\$

Many thanks for posting your schematic. This makes things much easier.

1) You can eliminate R8. I included it because I didn't know what the output impedance of your R-2R network was.

2) Optimize the 555 frequency.

a) temporarily replace the flow-meters with SPDT switches such that you get Vdd & Vss at the switch wiper as you flip the switch one way or the other.

b) set the output of flowmeter #2 HI.

c) Observe the waveform on the target device. Vary the 555 frequency until the amplitude isn't being rolled-off at the high end. I was guessing that 10KHz - 20 KHz would be good - but I don't know.

Basically, start with the frequency high and observe the amplitude as you change the frequency downwards. You want to pick the frequency such that the amplitude response is flat at that point.

You may find that you need to attenuate the signal if this is going into a mic input instead of a line-level input. That's easy - just add a shunt resistor across the input to the computer until the amplitude is at the appropriate level.

When things are optimized, flipping the switch for flow-meter #2 should give you a clean amplitude change: nothing to something.

Now test flow-meter #1. You should see a smaller but completely-reproducible amplitude change.

Please post your results - I'll offer more comments.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the response. A couple questions: How do I "Vary the 555 frequency"? What does "rolled-off at the high end" mean? How do I "change the frequency downwards"? What does it mean to "attenuate the signal"? Thanks again! \$\endgroup\$ – Mike May 12 '15 at 2:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.