Trail Tracer Electrical Details
This page is the electrical companion to the Trail Tracer technical guide, which covers what the system does and the physics behind it. The guide explains the idea. This page explains how each board pulls it off, and where the hard parts were. The vocabulary at the end of the guide applies here too.
Transmitter
The job
The transmitter has one job: put a sine wave current on the wire and keep it steady. The field around the wire follows the current exactly, so a current that sags on a long track would mean a weaker field, and the receiver would read the wire as farther away than it is. Every track has to feel the same to the car.
The current is 220 mA, the frequency is one of five channels near 53 kHz, and the whole thing runs from 5 V USB.
Why a long wire fights back
A wire is not just a resistance. Every loop of wire has inductance, which resists a change in current, and a 100 m loop has a lot of it. At 53 kHz the current changes direction one hundred and six thousand times a second, so the inductance pushes back far harder than the wire’s own resistance does. Driving 220 mA through a full-length track by brute force would take about four times the voltage a USB supply can give.
The way out is resonance. Put a capacitor in series with the wire and it pushes back the opposite way to the inductance. At one frequency the two cancel exactly, and the supply only has to overcome the plain resistance of the wire, whcih is not very much. That is the frequency the transmitter runs at.
Resonance benefits us a second time. The output stage can only switch on and off, so what it really makes is a square wave. A resonant circuit passes the frequency it is tuned to and blocks the rest, and a square wave is its own frequency plus a pile of higher ones. The inductance and capacitance cancel out only at the frequency we want, and the track inductance pushes back hard at the frequencies we don’t want. What reaches the wire is an almost pure sine wave!
Tuning to your track
Resonance only works if the capacitor matches the track’s inductance, and every track is a different length. A 3 m test loop and a 100 m course are nowhere near each other.
So the transmitter carries four inductors in series with its output, each with a relay across it. Closing a relay shorts its inductor out of the circuit, making it invisible. Leaving a relay open adds the inductor to the total. Four relays give sixteen combinations, from no added inductance up to a lot, in even steps. A short track gets most of them switched in, and a long track gets them switched out, so the total always lands near the same value.
Press the OUTPUT ENABLE button and the transmitter finds the right one by itself. It starts with the most added inductance, pushes some current on to the track, and notes how hard the track pushed back. Then it steps to the next combination. While the push-back keeps falling it keeps stepping. The moment the push-back starts to rise it has gone one step too far, so it steps back and stays there. The sweep takes a couple seconds and you hear the relays click through it.
If no combination can reach 220 mA, the transmitter gives up and shows a fault. In practice that means a break in the wire, a bad connection, or a track longer than the transmitter can handle.
Holding the current steady
Auto-tune gets the transmitter close. A control loop keeps it there, because the tuning steps are kindof coarse and the transmitters ouptut properties change a bit as it warms up.
The transmitter is constantly monitoring the output current and adjusting its output voltage square wave to hold the current strength steady. It cannot change the voltage of it’s square wave, that is always 5V from the USB supply. But it can easily change the high vs low time, and that changes how much of that square wave is concentrated at the single sine wave output frequency.
Power
Power comes in on a USB-C connector, or on a 3-pin header for an external 5 V supply. Both can be connected at once. Each input goes through its own diode, so whichever source is higher feeds the board and neither one back-feeds the other.
When something goes wrong
The transmitter does not shut down on a single bad reading. It keeps a counter that climbs while something is wrong and falls while everything is right. Only a fault that persists about 200ms trips it. This prevents nuisance trips but also protects the transmitter.
When it does trip, the output shuts off, every relay opens, and the fault light blinks a pattern that tells you which of the two it was: a short across the output, or an impedance too high to drive. The transmitter stays off until it is power-cycled, on purpose, so a fault that keeps coming back cannot quietly cycle all day.
Controls and lights
Two buttons. CHANNEL steps through the five channels and remembers the choice through a power cycle. You can only change channel when the output is off. OUTPUT ENABLE starts the auto-tune and the output, or stops it. Five lights show the selected channel, and three more show power, fault, and output on.
Channels
The five channels sit about 2 kHz apart, which is far enough that the receiver can lock onto one and ignore a neighbouring track running on another.
| Channel | Frequency |
|---|---|
| CH1 | 53,333 Hz |
| CH2 | 55,316 Hz |
| CH3 | 51,323 Hz |
| CH4 | 57,348 Hz |
| CH5 | 49,345 Hz |
The odd-looking numbers are not arbitrary. Each one is the transmitter’s clock divided by a whole number, which is what makes the frequency exact and stable, and the receiver depends on knowing it exactly.
The patterns is also not arbitrary. CH1 is the center frequency, and the higher channels step out from there. With no interference, CH1 performs slightly better than the rest, although choosing a channel with low interference is much more important.
Sensor
Two boards and no electronics
The sensor has no power, no chip, and no processor. It is two small circuit boards, each with a notch cut past the middle, slid together into an X. The only connection is one 2-pin lead to the receiver.
Each board is a coil. The winding is not wire wrapped around a form; it is a flat spiral etched into the copper of the board, repeated on seven of the board’s eight layers and joined layer to layer, so that a stack of spirals acts as one long winding of about 210 turns. A board is cheaper, thinner and far more repeatable than a wound coil, and every sensor comes out identical, which matters because the receiver’s calibration assumes it.
The filter
The coils were made as small as possible, and are not naturally tuned to the Trail tracer channel frequencies. We add a signal filter made with two inductors and two capacitors to fix that. The combine with the coil’s natural properties to help block interference and preserve the transmitter frequencies.
Why the X
A coil only responds to the part of the field that passes through its face, which the guide explains with the shadow analogy. Two coils at 90° split the field between them, and that split is what gives the receiver the angle to the wire while their combined strength gives the distance.
The interlocked X does that mechanically and keeps the overall sensor small.
Receiver
The job
The receiver turns four faint coil signals into two positions, a hundred times a second, and steers the car on them. The signals arriving from the coils only 1 to 100 millivolts, so they need amplification. They also vary in strength a lot, and ahave all the servo, ESC, and motor interference added in.
So the receiver has three parts: Amplification, filtering, and processing.
The aplification is adjustable to adjust for the wide range of coil signal strengths. The filtering helps reject interference, and the processing picks out the transmitter frequency from the rest.
Two processors
Measuring and processing the coil signals is not an easy task, it requires constant work and precise timing. Hosting a user-friendly interface over USB and/or WiFi is also not an easy task, the work comes in hevy bursts. So we split the workload between two processors.
One processor does nothing but measure. It converts each coil signal to a digital one at 333 thousand times per second, picks the transmitter’s frequency out of each digital signal, computes the positions, and supervises the charge port. It runs that whole process up to 100 times per second, and nothing is allowed to interrupt it.
The other processor drives. It reads the calculated position data, the R/C receiver, runs the steering loop, drives the servos and speed controller, handles charging and beacons, and sends telemetry over its radio. Those jobs come and go at unpredictable times, and any of them can afford to be late by a millisecond. Steering cannot afford a bad position.
The two are joined by a fast serial link. The measuring side sends a packet every 10 ms with both sensors’ positions, the beacon readings, voltages, charge current and status; the driving side sends short commands back, such as a channel change or a request to start charging.
Power
5 V comes in on a micro-USB connector or on the servo connectors’ power pins. As on the transmitter, each source goes through its own diode, so the higher one feeds the board and neither back-feeds the other. Plugging in USB while the car’s battery is powering the servo rail is normal, and it is the diodes that make it safe. The receiver can handle up to 8.4V on the servo power pins, perfect for 2-cell LiPos if your servos can handle that.
Both processors get their own +3.3V power supply to keep electrical noise separate and the position measurements clean.
One amplifier per coil
Each of the four coils gets its own chain, and each chain does three things in order.
It filters first. A band-pass network passes the 50 kHz region and rolls off what is below and above: the low rumble of motors and servos, and the high hash of the speed controller.
It amplifies the difference next. The coil has two ends, and the amplifier responds only to the difference between them, ignoring anything both ends pick up together. Most interference arrives equally on both leads, so ignoring what they share throws away most of the noise before the signal is amplified at all.
It then applies a switchable gain, one of three steps. The measuring processor picks the step.
Gain control
The wire’s signal changes by a large factor across the receiver’s range, so no single gain works everywhere. Near the wire a high gain would clip; far from it a low gain leaves the signal in the noise.
The measurement processor has some built-in features that help monitor each coil’s signal strength and helps select the appropriate gain for each one. The processor knows which signal is measured with which gain and compensated for that in the position math.
Picking out the transmitter’s frequency
This is the step the guide calls synchronizing.
Each coil is sampled about 333 thousand times per second. A measurement is 500 samples, a window 1.5ms long. Those samples get a bell-shaped weighting called a “window function” that tapers both ends of the window, because cutting a continuous signal into blocks leaves hard edges that smear the answer, and the taper smooths them out.
The “windowed” block then goes through a filter that measures the strength and the phase of exactly one frequency. A full frequency analysis would give every frequency in the block and throw almost all of them away; this measures the one that matters for a small fraction of the effort, which is what lets the whole chain run at 100 Hz on a small processor. The same pass also measures the active beacon frequency.
What comes out per coil is a strength and a phase. Everything not at the transmitter’s frequency averages away across the 500 samples. The wiggling coil signal has become one steady number, exactly as the guide describes.
From strengths to a position
Two strengths become a position the way the guide’s coil-pair plot shows.
The combined strength of the pair gives the distance, because the field falls off as 1 over distance. The ratio of the two strengths gives the angle. A ratio alone only covers a quarter turn, so the receiver uses the relative phase of the two coils, in step or opposite, to work out which quarter it is in, and then tracks the angle continuously as the sensor rolls. Distance and angle then give the sideways and vertical offsets the vehicle software steers on.
Each sensor keeps its own channel setting, its own calibration and its own angle zero, stored on the board so they survive a power cycle.
The loop runs at 100 Hz. Each cycle measures both sensors, and alternates between the two beacon channels, so each beacon updates at 50 Hz. A beacon’s reading is not a position. Its field falls off much faster than the wire’s, and it’s field shape is not the nice circles the track creates. The receiver simply calculates a proximity number: strong when you are near it, and quickly nothing when you are not. It is roughly scaled to equal distance in mm, but it is not as precise as the track position measurements.
Weak, lost and regained
The receiver reports the wire as lost beyond about 1.2 m, and it does not report it found again until the reading has stayed well inside that for half a second.
The gap between the two thresholds is deliberate. A single threshold would chatter on and off at the edge of range, and the car would stutter between following and not following. While the wire is lost the receiver zeroes the position and sets a status bit, so the driving processor knows the difference between “the wire is right here” and “I have nothing”.
Servo signals
Four servo inputs and four outputs come in on 6-pin connectors, two channels per connector, each with signal, power and ground.
The inputs pass through buffers with built-in noise margin before they reach the processors. R/C receivers put out 5 V pulses, the processors run at 3.3 V, and a servo cable in a car is a noisy place, so the buffers both drop the level and clean up the edges. The outputs are 3.3 V pulses through a series resistor, which every common servo and speed controller accepts.
Vehicle Control Software
What it does
The second processor on the receiver runs the program that drives the car. Everything it does hangs off one event: a new position packet arriving, about a hundred times a second. Each packet starts one cycle: read the R/C inputs, run the steering loop, choose the throttle, check for faults, and write the four servo outputs. Around that core it also handles docking and charging, the beacon behaviours, the weave, stuck detection, configuration and telemetry.
Steering
The steering loop is a PID controller. Its input is how far the wire is to the left or right of the front sensor, its target is zero, and its output is added to the steering servo’s centre position. Give it an offset instead of zero and the car runs beside the wire rather than over it.
Its output is smoothed before it reaches the servo, because raw PID output on a noisy measurement makes a servo buzz without steering any better.
When the wire is lost, the throttle is cut to prevent a runaway vehicle.
Drive modes
Three modes, chosen with the R/C aux channel and the throttle stick.
- Manual. Steering and throttle follow the sticks. A small steering input still lets the wire loop contribute, so you can trim the car onto the wire; a large one takes over completely.
- Cruise control. The wire steers. The throttle stick nudges a held speed up or down and holds steady with no input.
- Auto. No transmitter needed. A press of the receiver’s button starts the car at its configured cruise speed, and another press stops it.
At power-up the car picks manual if it sees a valid throttle signal and auto if it does not. Entering cruise requires the wire to have been locked on for half a second first.
Throttle
Two configured speeds do most of the work: a cruise speed for normal running, and a slower creep speed used near a beacon. Changes between them are ramped rather than stepped.
The throttle is cut to neutral on any fault: wire lost, car stuck, charging, over-temperature, or a hardware stop line pulled low. It comes back on its own as soon as the condition clears.
Docking and charging
The program watches the voltage on the charge contacts, which the measuring processor reports. When that voltage rises above the battery’s, the car has arrived at the charging station. It settles for a second, then asks the measuring processor to enable the charge port and holds still.
From there the car’s driving program is out of it. The measuring processor runs the charge on its own and clears its enable bit when it is done; the driving program waits for that bit to clear, waits out a short cooldown, and drives away. A pass through the charger also counts a lap for telemetry.
Beacons
A beacon transmitter is a small fixed coil the sensor picks up as a separate channel. One setting chooses what the car does with it:
- Creep zone. When the beacon reading rises above a threshold, the car ramps down to creep speed and holds it for a few seconds after the beacon is passed. Use it to slow down for the charging station or a tight section.
- Follow. The car watches the beacon on the car ahead and eases off the throttle when it reads strong, so a group can run in a train without rear-ending each other.
- Sine-swerve. A slow side-to-side wave is added to the steering target, so the car weaves across the wire instead of tracking a single line. The weave fades out near a beacon and stays off during any fault.
Moving the throttle stick overrides any beacon behaviour for a moment, so the driver always wins.
Stuck detection
Normal driving has bumps and changing position measurements, until a car gets stuck. Instead of staying stalled or spinning its wheels forever, the receiver senses if motion has stopped and will turn the throttle off. The movement threshold and timer are adjustable.
Configuration
Every tuning value lives in one settings file on a small USB drive the receiver presents when you plug it into a computer. Edit the file, save it, and the receiver reloads it a few seconds after the last write and flashes its LED to confirm. No rebuild, no programmer.
The file holds the vehicle ID and channel, the two throttle speeds, the servo centres and limits, the front and rear steering gains, the two-sensor heading blend, the stuck detector, the beacon behaviour, the weave, the charge limits and the telemetry switch.
A copy of the last working file is kept in the receiver’s own memory, so a mistyped setting cannot leave the car with no configuration at all.
Telemetry
With the radio turned on, the car broadcasts a short status message about once a second, and immediately whenever the charge state changes: battery, charger and supply voltages, charge current and state, temperature, distance to the wire, steering output, and flags for stuck, driving, charging and lap complete. The display unit and the Trail Tracer monitor listen for these.
Charge Port
What it does
The charge port sits between the car’s charge contacts and its battery. It has no processor. It helps the receiver meausre battery voltage and charge current, and lets the receiver turn charging on and off. Most importantly, it cuts the path itself if the battery voltage goes too high, protecting the battery if the receiver board isn’t acting right.
The path
Charge current comes in from the contacts and passes through two electronic switches in series. One guards against contacts touched the wrong way round; the other is the on-off switch. Both listen to the same enable line, so nothing conducts until the receiver deliberately turns it on. A car rolling over a live contact plate does nothing at all.
The current then crosses a very small resistor whose voltage tells the receiver how many amps are flowing, passes a fuse the designer describes as last-ditch, and reaches the battery. Two voltage dividers report the contact voltage and the battery voltage back to the receiver.
The hardware cutoff
A comparator watches the battery voltage against a fixed threshold, set for the pack size with a solder link when the board is built. Cross it and the comparator pulls the same enable line low, and the charge path opens.
The point is that the comparator is not connected to any processor. Firmware can be wrong, a processor can hang, a setting can be mistyped in the configuration file, and the hardware cutoff still works. Charging a lithium pack unattended, all day, on a course with nobody watching, is exactly the situation that needs a limit that does not depend on software being correct.
But be careful!!! We hope you never ever need the charge port safety features, and the safety features are no substitute for safe operation, that is up to you.
Who decides
The receiver’s measuring processor runs the charge itself. It starts when the driving processor asks, and it stops at the configured voltage, at a current limit, or after a time limit, whichever comes first. It refuses to start if the contact voltage is far above the battery, and after an overcurrent trip it waits before trying again. The limits come from the configuration file, and the processor caps them at its own maximums whatever the file says.
Beacon Transmitter
The beacon transmitter puts a small field at its own frequency into one spot on the track. The receiver hears it as a separate channel and reports how close it is, and the vehicle software uses that for the creep zone, the follow gap and the swerve pause.
There is no processor. A crystal oscillator runs at a fixed frequency and a divider chip divides it down by an exact factor, which gives a beacon frequency as precise as the transmitter’s without a microcontroller anywhere on the board. A driver chip switches the output into a coil, and the coil is the board itself: a single-layer spiral about 20 mm across. In this case a coil is used to create a magneitc field, not measure one. Its the same process just in reverse! Power is 5 V on a 3-pin header, same pinout as servos for 5 V BEC compatibility.
A beacon’s channel is chosen when it is built, by a single link fitted to select one of the two crystals. It can be switched with a soldering iron.
The beacon’s field falls off as the cube of distance, far faster than the wire’s, which is what makes it useful. It also does not have the nice cylindrical shape the wire track creates. The receiver just estimates the distance to the beacon in mm with no direction information.
Frequencies
| Channel | Frequency |
|---|---|
| Beacon 1 | 62,500 Hz |
| Beacon 2 | 46,875 Hz |
Vocabulary
Terms used on this page that the guide does not use. The guide’s vocabulary applies here too.
| Term | Meaning |
|---|---|
| inductance | A wire’s resistance to a change in current. Every loop of wire has some, and a long loop has a lot. |
| impedance | How hard a circuit pushes back on alternating current, counting resistance, inductance and capacitance together. |
| resonance | The one frequency at which a coil and a capacitor cancel each other out, so current flows as if only the plain resistance were there. |
| tuned circuit | A coil and a capacitor together, which respond most strongly at their resonant frequency. |
| band-pass | A filter that passes a range of frequencies and blocks what is above and below it. |
| phase | Where a wave sits in its cycle relative to another wave. Two coils in step or opposite is a phase difference. |
| gain | How much an amplifier multiplies its input. |
| clipping | What happens when a signal is amplified past what the circuit can represent: the peaks are flattened and the measurement is wrong. |
| relay | A mechanical switch closed by an electromagnet. The transmitter uses four of them to switch inductors in and out. |
| comparator | A part that flips its output when a voltage crosses a set threshold. |
| PID controller | A control loop with three terms: the error now, the error built up over time, and how fast the error is changing. |
| checksum | A number sent with a data packet so the far end can tell whether the packet arrived intact. |
| transient suppressor | A part that clamps voltage spikes, such as a static discharge, before they reach the circuit. |
| ferrite bead | A small part that blocks high-frequency noise on a power or signal line while passing everything else. |