Author Topic: Square wave filtering question!  (Read 1999 times)

0 Members and 1 Guest are viewing this topic.

Offline demisparkTopic starter

  • Newbie
  • Posts: 1
  • Country: us
Square wave filtering question!
« on: August 21, 2020, 03:28:11 am »
Hello everyone,

I'm currently a senior EE student about to start my senior project. I've been thinking of some ideas and believe I have a promising one however I have a few questions that remain unanswered. I would like to develop a positioning system using inferred light. I will have a source using IR LED's and receivers using phototransistors.

Is it possible to filter a particular frequency square wave from other frequency square waves? I can then process these signals individually.

My idea is that if i want to use multiple light sources, they should be modulated at different frequencies. Is it possible to decipher which source the signal is coming from with the phototransistor? Is there a filter that can pick out a particular square wave at a certain frequency?

Perhaps I am going about this the wrong way. Any feedback is appreciated!
 

Offline bob91343

  • Super Contributor
  • ***
  • Posts: 2675
  • Country: us
Re: Square wave filtering question!
« Reply #1 on: August 21, 2020, 04:58:03 am »
Recognize that a square wave is composed of many frequencies.  If you superimpose two square waves of different frequencies you get a hodge podge of elements.  About the only thing that might work is to filter specific components that are unique to each signal.

If you have square waves at 1 kHz and 1.1 kHz then you only get a 3 kHz component when the first one is present, and only get a 3.3 kHz when the second one is present.  So a narrow filter could tell when a specific wave is present, as long as the spectrum of each is unique.

If you have more than two signals you must be careful in selecting the frequency.  Of course you can look for the fundamental also.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Square wave filtering question!
« Reply #2 on: August 21, 2020, 05:21:02 am »
Sure, use synchronized (coherent) squarewaves and a mixer.  This correlates the signal with a reference, rejecting anything out of phase on average -- which is any other frequency than the wave and its harmonics.

So you'll still have selectivity at (odd) harmonics, the width of those bands being the passband of the "averaging" filter.

In the limit as averaging is done over all time, the bandwidth is zero, and non-harmonic frequencies are orthogonal (fully excluded).

Sine waves have the particular orthogonality feature that they are unique (down to sign), i.e. they have no harmonics.  All other waveforms have harmonics, and may have nonzero mixing products there.  Hence why we're so interested in sinusoidal signals for RF purposes.

Over finite time scales, the averaging is just a filtering process, so you need to take some account of what interfering signals may be present, and how much is tolerable relative to your signal strength (in other words the SNR).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Re: Square wave filtering question!
« Reply #3 on: August 21, 2020, 05:44:31 am »
I thought about this for a while too once, and came to the conclusion that best luck might be had when the frequencies were relatively prime (e.g 700Hz, 900Hz 1100Hz). What information are you attempting to get? (e.g. time of flight, brightness, phase, a data stream...)

Have you considered using a pattern, maybe:

  "FLASH ALL CHANNEL" "FLASH CHANNEL 1" "FLASH CHANNEL 2" "FLASH CHANNEL 3"

with a few milliseconds between channels




Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 7045
  • Country: nl
Re: Square wave filtering question!
« Reply #4 on: August 21, 2020, 02:36:30 pm »
Is it possible to filter a particular frequency square wave from other frequency square waves? I can then process these signals individually.
You can modulate the burst from each transmitter with a different frequency so you can seperate them out ... you can even do it with square waves, just use power of 2 frequencies and the Hadamard transformer.

But doing all that while keeping the signal clean enough to measure edge movement of the squarewave with picosecond accuracy, forget about it.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17429
  • Country: us
  • DavidH
Re: Square wave filtering question!
« Reply #5 on: August 22, 2020, 06:56:53 pm »
I agree with T3sl4co1l; synchronous demodulation will do exactly what you want to do with the best possible performance.  The LEDs could even be modulated with different patterns, or even noise, rather than different frequencies.  If different frequencies are used, then they need to be non-harmonically related.

Filtering will of course also work if you have no way to synchronize the transmitters and receivers.
« Last Edit: August 22, 2020, 06:58:27 pm by David Hess »
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 7045
  • Country: nl
Re: Square wave filtering question!
« Reply #6 on: August 22, 2020, 07:48:56 pm »
The standard "easy" range detection passes a received square wave with a reference squarewave through an XOR gate and low passes the result for the ADC ... that's a pretty sensitive operation to begin with. The circuitry to make a squarewave of the received signal can very easily introduce significant phase shift based on signal strength. Moreso if you try to stack a whole bunch of different signals.

Seperating things in time makes things easier.
 

Online KT88

  • Frequent Contributor
  • **
  • Posts: 334
  • Country: de
Re: Square wave filtering question!
« Reply #7 on: August 22, 2020, 08:50:45 pm »
Is there a particular reason to use squarewave? It might be easier to implement it on the emiiter side but it would insrease the complexity on the recieve side. A sinewave modulated current source is not hard to do. With a sine wave you also would put all energy into the fundamental frequency and not into the harmonics. With narrow band filtering you could achieve a very good dynamic range if that is of interest.
What is the desired frequency range b.tw.?
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2078
  • Country: us
    • The Messy Basement
Re: Square wave filtering question!
« Reply #8 on: August 23, 2020, 02:55:34 am »
People have done something similar using sine waves or filtered square waves, and the old 567 tone decoder chips. It appears they're still made.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1472
  • Country: us
  • Very dangerous - may attack at any time
Re: Square wave filtering question!
« Reply #9 on: August 23, 2020, 04:01:33 am »
Is it possible to filter a particular frequency square wave from other frequency square waves? I can then process these signals individually.

My idea is that if i want to use multiple light sources, they should be modulated at different frequencies. Is it possible to decipher which source the signal is coming from with the phototransistor? Is there a filter that can pick out a particular square wave at a certain frequency?

Yes - the Walsh transform can do this. It is like the Fourier transform, but uses (1,-1) instead of reals. It can be implemented using only XOR and ADD.

I did a DTMF decoder using the Walsh transform with non-orthogonal basis functions. The input audio is clipped to a square wave.


 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 4034
  • Country: us
Re: Square wave filtering question!
« Reply #10 on: August 23, 2020, 05:23:38 am »
Is there a particular reason to use squarewave? It might be easier to implement it on the emiiter side but it would insrease the complexity on the recieve side. A sinewave modulated current source is not hard to do. With a sine wave you also would put all energy into the fundamental frequency and not into the harmonics. With narrow band filtering you could achieve a very good dynamic range if that is of interest.
What is the desired frequency range b.tw.?

If you are doing synchronous demodulation square waves work pretty much just as well as sine waves.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Square wave filtering question!
« Reply #11 on: August 23, 2020, 07:33:30 am »
Even more generally, any set of orthogonal codes will do -- read up on CDMA for ideas.  And it works from both sides, analog and digital -- there are filters perfectly crafted to optimize digital signal quality.

You can dive quite deeply indeed in this field; modern radio communications takes full advantage of the immense processing power available in modern technology.  (Typically, a BT, Wifi, 4G, 5G, Lora, etc. chip includes on-chip tuned circuits (filters and amplifiers), baseband or equivalent-time-sampled acquisition (ADC), DSP filtering and demodulation, code/key descrambling, error detection and correction, and some network stack.  It's a magnificently complex system, all in the name of performance per dollar!)

This is probably getting rather far away from the original purpose though -- distance sensing, sounds like the intent might've been to detect the relative amplitudes of each emitter, being able to separate them by frequency or code.  This isn't a great idea, because signal strength can vary from so many factors besides sheer physical distance.  Amplitude sensing is one of the least reliable methods of signal reception and detection.

A much better system is to use the relative delay between sources, and triangulate position from there.  This can be tricky -- fractional nanoseconds must be resolved.  But it is eminently solvable.  Indeed, fractional nanoseconds are no problem with even a modest PLL and some clever circuitry (maybe something better than a garden-variety phase detector, but that's a good starting point).  You might need some advanced analog circuitry or an FPGA to implement the full signal processing chain (for some level of complexity and performance), then probably a MCU to do the trig.

FWIW, distance imaging sensors (e.g. Xbox Kinect) typically use a pulsed illumination source, and a coherent (equivalent-time-sampled) image sensor, to resolve the phase shift (per pixel!) into a signal level.  The illumination source can be a modest frequency, 10s of MHz for example.  Even though the phase shift is small (a few ns), as long as the detection is proportional, that's fine, it's a 2simple matter of signal level.  It can also be averaged over many thousands of samples (15MHz makes 250k cycles every 60Hz frame!), giving reasonable SNR even after amplification.

Of course, a distance sensor is a monostatic radar system, different from what you're proposing.

Tim
« Last Edit: August 23, 2020, 09:40:47 am by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: EEEnthusiast

Online gf

  • Super Contributor
  • ***
  • Posts: 1425
  • Country: de
Re: Square wave filtering question!
« Reply #12 on: August 23, 2020, 08:14:26 am »
FWIW, distance imaging sensors (e.g. Xbox Kinect) typically use a pulsed illumination source, and a coherent (equivalent-time-sampled) image sensor, to resolve the phase shift (per pixel!) into a signal level.

It would certainly be nice if they were, but the rather cheap PrimeSense sensors (Kinekt, Xtion, etc.) are unfortunately not time of flight cameras, but are parallax/triangulation-based. They project a static IR pattern onto the 3D-scene, which is captured by an IR camera located a couple of centimeters from the projector (similar to stereo vision, but one of the two cameras is replaced by a projector).
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Square wave filtering question!
« Reply #13 on: August 23, 2020, 09:41:24 am »
Ah, not that then. Forget which ones are, but I know they're out there...

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1472
  • Country: us
  • Very dangerous - may attack at any time
Re: Square wave filtering question!
« Reply #14 on: August 23, 2020, 11:17:21 pm »
The second generation of Kinect is TOF. Kinect for Xbox One, Kinect 2 for Windows and Azure Kinect.

The first gen was a laser projected grid and an ordinary IR camera.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1472
  • Country: us
  • Very dangerous - may attack at any time
Re: Square wave filtering question!
« Reply #15 on: August 23, 2020, 11:19:19 pm »
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 7045
  • Country: nl
Re: Square wave filtering question!
« Reply #16 on: August 24, 2020, 01:02:24 pm »
Sub-ns ToF measurement for a pulse is harder than sub-ns phase difference measurement for a squarewave.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf