8
$\begingroup$

I am a programmer facing an electronic question, so I thought here is the place to ask!

  • I have a magnetic field sensor which provides me with magnetic field values (XYZ axis) 250 times a second.
  • An electronic circuit with a programmable microprocessor controls a coil, which can change the magnetic field close enough to this sensor. Yet, the two devices are not strictly positioned, so I cannot relay on positioning measurement.
  • I wish to send 2 different types of signals from the circuit to the sensor, which can withstand strong noises on the magnetic field, and be shorter than half a second (Yes, seconds - we are in 250 Hz !)

Current solution is to transmit a 17Hz square wave, then 12Hz, then 17Hz for signal A, reversing the order for signal B. But in order to detect these signals it is needed to send long enough waves, which brings the signals to length around 1.5 seconds.

So, my question here is: Is there a way, let's say a pattern, like musical pattern that can be used to signal faster, and still be reliable?

$\endgroup$
7
$\begingroup$

With a sample rate of 250 Hz, you could easily send 100 bits/second or more. In 0.5 second, that would be on the order of 50-60 bits.

The question is, what bit patterns should you select that are readily distinguishable from each other and also from outside noise and interference? A common solution is to use pseudorandom bit sequences, also known as Barker Codes, that have the desired low cross-correlation.

A DSP technique known as "matched filter" can be used to detect the codes.

$\endgroup$
  • $\begingroup$ Sounds interesting! But, I was wandering how computationally complex "matched filter" might be? Would it require heavy FFT/other calculations? $\endgroup$ – rubmz Mar 14 '15 at 5:49
  • $\begingroup$ I checked the c++ implementations for a Matched Filter, and it seems that it would require quite a heavy calculations to detect the signal. So it might be not as useful for me, because my sensor side code would run in a RT environment, so is there any other filter that might allow me to send 2 types of signals, in less than .5 second, without too many calculations? $\endgroup$ – rubmz Mar 14 '15 at 6:14
  • 2
    $\begingroup$ It doesn't require a Fourier transform, but it does require the equivalent of an FIR (finite impulse response) filter on each of the three input channels, which is mathematically equivalent to doing a dot product on two 128-sample vectors for every new sample that comes in (128 multiplies and 128 adds, 250 times a second, for a total of ~33k multiply-add operations each second per filter, or about 100k MAC/s second total). Even a very low-end DSP chip such as the Microchip dsPIC can easily handle this sort of real-time calculation. $\endgroup$ – Dave Tweed Mar 14 '15 at 11:24
  • 2
    $\begingroup$ Just to be clear, you need to run that calculation separately for each different code that you want to be able to detect. So, for example, if you have 10 different codes, any one of which can be transmitted at any time, you'll need to run ten matched filters in parallel, for a total of 1M MACs/sec -- still within the capability of a dsPIC or similar chip. If you find that shorter codes are robust enough in your application, then you can use correspondingly shorter filters, and the computational load drops proportionally. $\endgroup$ – Dave Tweed Mar 14 '15 at 11:37

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.