# Radio/magnetic field: detect direction of antenna

1. Aug 2, 2013

### petterg

Hi guys,
It's been 15 years since I played with radios, and i've basically forgotten everything.
Do you think I'm on the right track with this problem? Do you have any suggestions for the circuit needed for the generator and/or receiving filter described in the last two paragraphs?
Or maybe you have a totally different idea of how to solve the problem?

(Hop I manage to express this in English in a way you'll understand.)

I'm trying to design a circuit (for use in a robot) that can detect if a wire carrying an AC-current is to the left or right of the detecting circuit. Luckily we operate in a limited 3D environment that can be considered as a 2D environment. (The cable is on the ground, the sensor in the robot will be placed a tiny bit above the ground. The robot is moving around on the ground, the XY-plane.)
However, as the robot has motors there will be some magnetic disturbance involved.

Assume that our 2D world is a XY-plane and the wire is placed along the Y-axis. And we know the current passing through the wire. Then we can detect the strength of the electromagnetic field with the known frequency from the wire and approximate the distance (x1) from the circuit to the wire. So we get that abs(Xr)=x1
(Xr is the position of the robot i X-direction. Xr=0 means the robot is on the cable.)

Now the problem: How can we know if Xr=x1 or Xr=-x1 ?

First thought for solution: Move in one direction, see if the signal get stronger or weaker. (Calculate new x1).
Why it doesn't work: The approximation of x1 has an error of up to 40% off, because of various disturbance. For the application x1 is good enough, if we just could figure if it's positive or negative. It will require to much moving in order to get a delta x1 with an acceptable level of certainty.

Second thought for solution: When the robot is above the wire, keep track of which direction it moves.
Why it doesn't work: It works 99% of the time. We need some method that works 100%, or combine this with another 99% method. The most obvious fail is when the robot is powered on at a random position.

Third though for solution: use a compass and add a DC component to the wire. The compass would align with the wire.
Why it doesn't work: Even though this would work even when the compass is 89 degrees off, the disturbance can be enough to make it go 180 degrees off. (And we want to adopt this navigation to also detect Y-position from a wire along the X-axis. It wouldn't work at all with two crossing wires.)

Forth though for solution: (This is probably the way to go, if just can figure how to do it.)
Make use of vertical magnetic field direction around the wire. When current flows through the wire, magnetic field will point up on one side, down on the other. With a vertical coil in the detector circuit the direction of current in the coil will tell which way the field around the wire goes, hence we know which side of the wire the detector is.
Issue to solve: The current in the wire has to be AC. Hence it (and the magnetic field, and the current in the detector coil) is changing direction all the time. We need some way for the detector to know which way the current in the wire flows. I'm thinking the easiest way to do this would be to "stretch" the sin-wave in the wire so that the current is negative for about twice the time of it's positive time. Then the detector can detect if the current in the coil is negative for longer than it's positive it's position has positive value of x - or the other way around.
(If a sin-wave use time t for a full wave it's positive for t/2 and negative for t/2. This modified wave I try to make/detect is positive for t/3 and negative for 2t/3.)

Now the challenge 1: How to design a generator for such a wave signal?
Adding a DC component will probably not work. I think the amplitude in both positive and negative direction should be equal. Hence there will be need for a change of frequency every 1/2 wave length.

challenge 2
The receiver circuit will connect to a arduino board. I'm thinking the circuit may provide two signalwires: a highpin (high level when positive current above a certain level in the coil) and a lowpin (high level when negative current above a certain level in the coil). If both are low the level of current is to low. Then the arduino can be programmed check which of the pins that are high for the longest period and conclude on positive or negative x1. But the receiver circuit still needs a filter, quite narrow bandpass to filter the frequency/frequencies from the sender to filter out most other electric/magnetic noise.

2. Aug 2, 2013

### Staff: Mentor

That is DC+AC as well, as you get a net current flow.

You need some way to break the symmetry of the wire. A homogeneous magnetic field won't help, a modification of the current flow looks better.
What is available? A function generator can do that, electronic circuits can do that.
That is not a frequency change - your signal will be the sum of multiple frequencies, all of them are integer multiples of the base frequency. I think you don't have to care about that.

Program code?

3. Aug 2, 2013

### petterg

With "stretching" the wave I'm thinking something similar to the attached picture. It shouldn't be homogenous, and it's not DC.
Are you thinking some kind of modulation? If so I think the modulated signal must be in sync with the carrying signal in some way so that it can signal the waves current phase. To me that sound far too complicated. (Although miracles can be performed with the help of magicians.)

Components need to be ordered anyhow, so basically anything on ebay is available. However, the goal is to make this thing, so I'm aiming for components, not a preassembled generator. I was thinking maybe a couple of 555 timers could be enough for creating the signal?
Maybe it's better to go for a square signal and go for a pattern like: fast high, fast low, pause, fast high, fast low, pause ....

Sure it's a sum of lots of frequencies (everything is), but I don't really see how to make the sum generated in a not-homogenous way without making a full bunch of oscillators. It sounded easier to adjust the speed of how the voltage is changed depending on what the voltage is.

Would a filter tuned for the base frequency not filter away all the other frequencies added?

If the receiving circuit makes the pinA high when current is above triggerlevel in one direction and pinB high when current is above triggerlevel in the other direction, the new signbit for x1 will be given as:
NOR(A, NOR(B, previousSignBit))

File size:
1 KB
Views:
88
4. Aug 2, 2013

### Staff: Mentor

Well, depends on the definition of DC. It has a net current flow.
Sure, that waveform could (at least in theory) allow to determine the side.

I think I would count to 3 and generate a pattern like low, low, high, repeat. Or use the lowest two bits without reset for the pattern low, low, low, high, repeat, this avoids the reset.
Why do you need an alternating current, by the way?

Why do you want to use filters?

5. Aug 2, 2013

### petterg

The idea with filter is to reduce disturbance. Brushed engines do create quite a bit of "random" magnetic fields.

How would you signal two low's after each other? Like the attached picture?

The reason for alternating current is only to create magnetic fields that can be detected. Distance can be estimated from the power at receiver, and hopefully positive/negative value of the distance decided in some way. I can't think of any other way of doing this. Any suggestions are welcome.

File size:
4.1 KB
Views:
97
6. Aug 2, 2013

### Staff: Mentor

If you have a magnetic field sensor (~measurement has to be faster than the period of the current), I don't see the point. If your receiver is antenna-like and reacts to alternating fields only, things get tricky. A superposition of two frequencies could be possible.

7. Aug 2, 2013

### petterg

I think magnetic field will be to disturbed by the motors so that is probably not possible. The only possible way I can think of is a wave from the wire that can be identified.

8. Aug 2, 2013

### Staff: Mentor

What is your noise environment like? You probably don't want to use 60Hz for the signal, since there is so much 60Hz noise around (assuming you are in the US and not Europe). What is the room like where you are doing this? What other noise sources are around?

It would be nice if the room were shielded, since that would give you less noise and give you more flexibility in the waveform that you choose to drive on the cable.

And then there is the issue of the robot generating noise itself. You should try to minimize that noise, and you should characterize what that noise looks like, so you can avoid the frequencies of that noise when you pick the frequency of the cable signal.

You might also want to add some modulation to the signal on the wire, so that your detector circuit can use the appropriate demodulation to give you a better SNR overall for the system.

9. Aug 2, 2013

### Staff: Mentor

BTW, you can also use tricks like cutting power to the motors at the instant that you are listneing for the cable's signal...

10. Aug 2, 2013

### dlgoff

That's what I was thinking. Something similar to an Instrument Landing System (ILS) technique.

http://static.landing-system.com/thumbs/ground-equipment-position.jpg

11. Aug 3, 2013

### petterg

I'm in Norway, so your 60Hz would be 50Hz here. This project is performed outdoors and most noise is the engines them self. They are quite random (circles, various directions, various center of the circles, various strength, and many of them. It all sums up to "random"), hence hard to compensate for. Shielding them turns out to be much harder than I expected.

Picking a frequency that is not disturbed is relatively easy. Picking a constant (DC generated field) is much harder. Hence I'm aiming for an AC that can be phase identified.

A workaround can, as you say, be switching of all motors for stabilizing the magnetic field, then read a DC component of the field. It's not ideal though, as it involves stopping everything regularly.

Yes, modulation is probably the solution. But even with modulation it's the direction of the carrying signal that needs to be detected. The modulated signal will just be signaling the carriers phase. But I don't really see how it can be done. As I remember modulation the carriers frequency has to be at least 4 times the modulated signal. That means there's simply not enough resolution to modulate the phase of the carrier.
I'm sure there must be a trick to this. It's just a matter of figuring it out.

12. Aug 3, 2013

### petterg

The ILS is a beam. I think the detection is based on detecting which beam the receiver is in. I'm kind of stuck with "a beam" that is the same in both fields (both sides of the wire), except that they are inverted, and for the moment symmetrical. It's a matter of making the signal not symmetrical.

13. Aug 3, 2013

### petterg

Maybe something like the attached signal could work?
I think this can be made from a timer setting a positive potential over a capacitor, then disconnects and let the capacitor discharge through the wire (wire must be connected in both ends).
When the potential gets below a certain level a negative pulse is triggered, and a slowly discharge through the wire.

That sounds like a signal that can be generated without too much hassle. And a detector for the pulses should also be possible. The hardest part might be to make the detector able to detect the pulse from far away (low amplitude) without being distracted by the discharge when it's close to the wire.

#### Attached Files:

• ###### carl-signalproposal3.jpg
File size:
5 KB
Views:
85
14. Aug 3, 2013

### Staff: Mentor

The only asymmetry I see is the small step at the end of the positive part. That will be hard to see.

15. Aug 3, 2013

### petterg

The asymmetry is that it's a pulse that is positive, then negative. The detector has to decide if it receives positive-negative-pause or negative-positive-pause.

16. Aug 3, 2013

### Staff: Mentor

I don't see a significant pause in your sketch. It is possible to add one, of course.
More details about the expected noise levels and their frequencies would be interesting.

17. Aug 3, 2013

### petterg

Along the timeline there is actually twice as much delay from low to high as there is from high to low.

Noise frequencies depend on motor rotations. If there are no motion the frequency is 0. If a motor is running fast there is a higher frequency noise. Speed varies, hence frequency varies. Motors positions varies, hence the disturbance direction varies. Then there will be 7 of those motors, all running at different speeds and angled in different directions, having different distance from the detector circuit. On top of that we have the wiring, and each motor is controlled by PWM. All in all the disturbance is far to complicated to predict, so the disturbance must be considered as random.

18. Aug 3, 2013

### Staff: Mentor

Sure, but random in which way. I would expect that all frequencies of the motor are less than 1 kHz. If you can send an AC signal with 10kHz for example, and measure it, motor noise is just an offset which varies a bit in time.

19. Aug 3, 2013

### petterg

That's true. Noise is probably less than 400Hz. So AC > 1,6kHz (=4x max disturbance) should be safe.
But an AC can't be used to identify direction, even at high frequencies and a DC will be disturbed. So there is a need for something more advanced.

20. Aug 3, 2013

### Staff: Mentor

It can, if you give it some structure. Using the 10kHz-value (so we have 100µs per cycle), something like "30µs one direction, 70µs the other direction" can be identified. The noise won't change significantly within those 100µs.