Build a drift car, from zero

Start with one headlight. Finish with the whole board.

A 1:64 toy drift car, seen from above. Its headlight is your first circuit.

Seven things to understand

Tap a part. Finish its chapters and it turns green.

Seven levels of a game. Clear a level and its part of the car lights up.

Positions are illustrative, not measured from a real car.

What a PCB is

Parts, held and wired by flat copper.

A tiny city. The parts are buildings. The copper lines are the roads between them. PCB means printed circuit board.

Every part, three ways

The thing. Its symbol. Its footprint.

A person, a stick-figure drawing of them, and their footprints in sand. One part, three views.

Real part
Symbol
Footprint

Symbol key

Twelve symbols cover most drawings.

The symbols on a map: a small drawing that stands for a real thing.

Find the symbol

Now without the names.

A flash-card round. No names this time.

Tap the symbol for
Six right to finish.

Two families

Legs through the board, or flat on top.

One kind goes through the board like a nail through wood. The other sits on top like a sticker.

How small?

Four standard sizes, drawn to scale.

The names work like shoe sizes: a smaller number is a smaller part.

The datasheet

Read three things first.

The instruction leaflet that comes with a part. It says how much the part can take before it breaks.

Red LED, 1206. Illustrative values, not a real datasheet.

Current needs a loop

Out on VCC, back on GND.

A racetrack. Cars keep moving only if the track joins back to the start. VCC is the road out of the battery, GND is the road home.

Push, flow, squeeze

Voltage pushes. Resistance squeezes. Current is what gets through.

Water in a hose. Voltage is how hard the tap pushes. Resistance is a pinch in the hose. Current is the water that gets through.

Why the LED needs a resistor

The resistor sets the LED's current.

The resistor is a speed bump. Without it the current rushes through and the LED burns out.

Current
Across R1
R1 heat

Draw the schematic

A schematic says one thing: which pin joins which.

A metro map. It shows which stations connect, not where they really are.

Nets

Each wire you drew is a net. Same net, same copper.

A net is like a group chat: every pin in it gets the same signal.

Schematic
Board

Labels connect without lines

Same name, same net. Even across pages.

A label is a teleport. Two wires with the same name are joined, with no line drawn between them.

ERC: the spell-check

It catches some mistakes. Not all.

ERC means electrical rules check. A spell-checker spots a misspelt word, but not a wrong fact. This is the same.

The board is a sandwich

Cut it in half: six layers.

A layer cake. The copper layers carry the electricity. The others hold, protect and label it.

Not to scale. About 1.6 mm in total.

What is on it

Eight kinds of shape.

Tracks are roads. Pads are parking spots for part legs. Vias are lifts between floors.

Millimetres and mils

A mil is a thousandth of an inch.

Two rulers for one length, like kilometres and miles. A mil is tiny: about 0.025 mm.

Start with the outline

Shape and screw holes come first.

Cut the pizza base before adding toppings. The board has to fit inside the car first.

How wide for how much current?

Decide this before you route.

A wider road carries more traffic. A wider track carries more current without getting hot.

Estimate from the IPC-2221 formula: outer layer, 1 oz copper, 10 °C rise. A guide, not a guarantee.

Place the parts

Drag them. Short, uncrossed lines make routing easy.

Seat friends who talk a lot next to each other. Parts that connect should sit close.

White = ratsnest: connections still waiting for copper. Yellow = crossed.

Route it

Tap a white line. It becomes copper.

Drawing roads between houses. Two roads cannot cross on the same floor.

A capacitor at every chip

As close to the power pin as it will go.

A water bottle on the chip's desk. When it needs a quick gulp of power, it does not wait for the far-away battery.

Orange area = the loop the current has to run round.

Flood the spare space with ground

Every current comes home through it. Then hunt for islands.

Pave the whole empty field instead of building small roads home. An island is a paved patch with no bridge to the rest.

Labels you can still read

After the parts are soldered on.

Name tags. They help whoever solders the board, and whoever repairs it later.

Review before you move on

Five checks.

A pilot's checklist before take-off.

Too thin, too close

The DRC flags what the factory cannot make.

DRC means design rules check. The factory draws with a pen of a fixed thickness. Thinner lines, or lines closer together than that, cannot be made.

Two tracks, magnified. Limits: 0.15 mm track, 0.15 mm gap.

What the rules measure

Six distances.

The smallest gaps allowed between cars in a car park.

One file per layer

The factory gets Gerber files, plus a drill file.

A stack of stencils: one sheet for copper, one for the green coat, one for labels, one for holes.

Inside a Gerber

Plain text: pick a pen, move, draw.

Orders for a drawing robot: pick a pen, go to a point, draw to the next point.

Parts list and positions

BOM: what to buy. Position file: where it goes.

A shopping list and a seating plan. BOM means bill of materials.

Before you send

Four checks.

Check your homework before handing it in. A wrong board costs days of waiting.

How the factory makes it

A slice through the board.

Wax on an egg before dyeing it: the copper that is covered stays, the rest is washed away.

How the parts go on

Paste, place, heat.

Baking biscuits: dots of paste, toppings on, then into the oven. The paste melts into solder.

First power-up

Never start with the battery.

A lab power supply is a tap you open slowly. A battery is a burst pipe: one mistake gets full power at once.

Inside your drift car

L.O.T Cars Nitro, 1:64 scale, 7.5 cm long.

Five jobs in one tiny car. Each job has its own part.

Top view, nose left. Positions are illustrative. "On the box" comes from the seller's page. "Probably inside" is how such toys are usually built: nobody has published this car's board.

Why it drifts: grip runs out

A tyre has a grip budget. Ask for more and it slides.

Grip is pocket money. Spend it on speed, on turning, or split it. Try to spend more than you have and the tyre lets go.

One tyre, seen from above. A simplified "friction circle". The seller's page does not say what this car's tyres are made of.

Why it drifts: the back goes wide

A drift is a slide you steer.

Sliding across a smooth floor in socks, and steering while you slide.

Dashed line = the path of the car. A simplified picture, not a physics simulation.

Why it drifts: four wheels pulling

Your car drives all four wheels. That changes the slide.

Rear-wheel drive is pushing a shopping trolley from behind. Four-wheel drive also pulls it from the front.

Orange arrows = wheels that push. Four-wheel drive is from the seller's page. The rest is general drift-car knowledge from training data, not tested on this car.

From thumb to wheel

Follow one command through the car.

A relay race. Each part passes the message on to the next.

A real board you can open

The open-source Micro RC Receiver, made for tiny cars.

Your car's board is a secret. This one is an open book, built for the same job.

Block diagram, not the real board layout.

Battery: one small cell

Everything runs from it. It must never go flat.

A water tank that gets damaged if it is drained empty. So the brain keeps watching the level.

Example numbers for one lithium cell. The real cutoff is set in the firmware.

Power: two voltages, one cell

Chips want it steady. The motor wants it raw.

The motor drinks straight from the firehose. The chips need a calm, steady tap. The part that makes the calm tap is a regulator.

Connections: the board's Eagle schematic. Cell voltages: typical lithium numbers, from training data.

Brain: every pin, and why that one

ATmega328P, 32 pins. Some are forced. Some were a choice.

Each pin is a finger. Some fingers have one special skill, so their job is fixed. The rest can do any simple on/off job.

Connections: the board's Eagle schematic. Reasons: the chip's fixed pin functions, from training data.

Brain: three helpers it cannot run without

Remove one. See what breaks.

A metronome to keep time, a water bottle for sudden thirst, and a hand that keeps the restart button from being bumped.

On the board's schematic: 100 nF capacitors, 10 kΩ on RESET, and a ceramic resonator for the clock: a cheaper cousin of a crystal.

Radio: bits ride on a wave

2.4 GHz. A touch faster means 1, a touch slower means 0.

Whistling a code: a slightly higher note means 1, a slightly lower note means 0. Here the note is a radio wave.

Hugely exaggerated. The real shift is a tiny fraction of 2.4 GHz. The scheme is called GFSK.

Radio: same channel, or silence

126 channels. Remote and car must agree on one.

Walkie-talkies. Both must be set to the same channel number to hear each other.

NRF24L01+: channel n sits at 2400 + n MHz. The Wi-Fi block is an example.

Radio: what one message holds

Four parts, sent in a burst, many times a second.

A letter in an envelope: a knock on the door, who it is for, the news, and a check that nothing got smudged.

Simplified NRF24L01+ packet. A small control field is left out.

Radio: did it arrive?

The car answers every message.

The car shouts "got it!" after every message. No shout back means: send it again.

The radio chip can do this by itself. Whether this board's firmware uses it was not checked.

Radio: one byte over SPI

Select, tick eight times, release.

Passing a note one letter at a time. One wire taps the beat, and on every tap one bit crosses. Eight bits make a byte.

Three wires shown. MISO carries the radio's reply the same way.

Gyro: three ways to turn

MPU-6050. A drift is only one of them.

Nod yes, tilt your head, shake your head no. The "no" turn is called yaw, and that is the drift.

The chip also measures acceleration on three axes.

Gyro: asked over I2C

Two wires. The brain asks, the gyro answers.

A classroom. The teacher calls one name, and only that pupil answers.

0x68 is the MPU-6050's usual address. Both wires need a pull-up resistor.

Gyro: the drift helper

On a car with a gyro: the back slides out, the board steers the other way.

Balancing a broom on your palm: you move your hand under where it falls. A gyro does that with the steering.

Arrow = direction of travel. A simplified picture, not a physics simulation.

Motor: more load, more current

Two wires. Hold the wheel and watch.

Pedalling uphill. The harder the job, the more energy it takes. A stuck motor takes the most current of all.

Example numbers for a tiny brushed motor. Not measured.

Motor driver: four switches

This is an H-bridge. Close two switches to make a loop.

Turn a battery round in a toy and the motor spins backwards. The four switches do that turning for you.

Inside the TB6612FNG the switches are transistors. The chip stops you closing a bad pair; here nothing does.

Motor driver: the pins the brain uses

Two direction pins and one speed pin. The sleep pin is wired always-on.

The brain whispers, the driver has the muscles. Two pins say which way, one says how fast.

TB6612FNG truth table, recalled from training data. Check the datasheet. On this board STBY is wired to 3.3 V: always awake.

Speed: on, off, very fast

PWM. More on-time, more speed.

Flick a light switch very fast. On for half the time looks half as bright. PWM means pulse-width modulation.

Steering: the width of a pulse

One signal wire tells the servo an angle.

A clapping code: a short clap means one way, a long clap the other, in between means straight.

Usual hobby-servo timing: one pulse every 20 ms, 1 to 2 ms wide. The plug has three wires: signal, plus, minus.

A chip program has four parts

The program is a text file. Almost every one has this shape.

A recipe card: ingredients, names for your bowls, prep you do once, then the step you repeat.

Lines from the real receiver program. Most are left out: the full file is 1,103 lines.

Six words the chip knows

Most chip code is these six, in different orders.

A tiny phrasebook. Six phrases get you a long way.

Five are lines from the real program. analogWrite is an example: the real one hides inside the motor library.

The loop the chip runs

Seven lines. The real ones, in the real order.

A goalkeeper: look, decide, move, and again, many times a second.

void loop() {
}  ↻ back to the top

Zoom in: is the remote still there?

Inside readRadio(). The chip times how long the remote has been silent.

Marco Polo. No "Polo" for a whole second? Stop and stand still.

Shortened from the real readRadio(). The four times are the real ones.

Zoom in: the gyro sum

Inside mrsc(). Three lines of arithmetic decide where the front wheels point.

A co-driver with a hand on the wheel. The faster you go, the harder the nudge.

The real sum, variable names shortened, your numbers filled in. Which way the gyro pushes depends on how it is mounted.

Build one

Lego first, glue later. Get it working on a breadboard, then turn it into a board.

Files: github.com/TheDIYGuy999/Micro_RC_Receiver

Sources for this chapter

Toy specifications: the seller's page for the L.O.T Cars Nitro (legendoftoys.com). That car's board is not published, so this chapter teaches from a different, open-source board. Chips, headers, battery cutoff and steering correction of the Micro RC Receiver: its GitHub README. Everything else comes from the model's training data and was not checked against datasheets or the board files: which ATmega328P pins do SPI, I2C, PWM and ADC; the H-bridge and PWM explanations; servo pulse timing; lithium cell voltages; the firmware loop; the teaching layout. Neither board was opened or measured.

Twelve questions

Glossary

Where next

  1. Install KiCad, free: kicad.org/download. Guide: docs.kicad.org.
  2. The NIELIT course: folder · outline (web page) · outline (PDF).
  3. The car board: Micro RC Receiver.
  4. Full lectures: MIT's The Art and Science of PCB Design.
Written by an AI model, not reviewed by an electronics engineer. Values, design rules, chip pinouts and file names come from the model's training data. Check datasheets and your fabricator's limits before relying on them.