Scrap Mechanic logic guide

Scrap Mechanic Logic Guide

Scrap Mechanic logic gates guide: AND/OR/XOR wiring, sensors, timers, controllers, pistons, and automation patterns for farms, doors, and raid traps on Steam.

kAN Gaming covers AND/OR/XOR gates and memory circuits — the foundation for farm automation and raid traps.

~9 min read

At A Glance

Scrap Mechanic logic gates turn Survival from manual button-mashing into programmable farms, raid traps, and factory lines. Axolot Games ships more than 400+ build parts on Steam (app 387990), and the Program Node family — gates, timers, sensors, controllers, and pistons — is what separates a hobby base from an automated planet.

This Scrap Mechanic logic guide explains AND/OR/XOR wiring, sensor detection, repeating timers, controller sequencing, and piston actuators with tables, callouts, and farm-ready examples. Pair it with the farming guide for raid defense, the building guide for stable contraptions, and the crafting guide for component recipes. Verified July 27, 2026 · Steam.

Scrap Mechanic controller and piston trap
TopicWhat you will build
Logic gatesAND doors, OR alarms, XOR toggles
SensorsRaid triggers, player-only airlocks
TimersRepeating harvest cycles, blinkers
ControllersMulti-step piston sequences
PistonsCrushers, lift doors, sorters
Full automationRaid traps, auto doors, sort lines

What are logic basics — binary signals and the Connect Tool?

Every Scrap Mechanic logic part speaks in binary: 1 (ON) or 0 (OFF). Buttons, switches, sensors, timers, and gates all push those states through connection ports. When a gate output is ON, its face glows — your visual debugger in the field.

Use the Connect Tool to link ports. Scrap Mechanic enforces direction: you cannot wire two gates as mutual input-and-output; the tool deletes the existing connection if you try. That limitation is why timers sit between flip-flop loops and why controllers exist for multi-step machines.

Logic gates update on ticks — roughly 0.025 seconds per tick with a 1-tick output delay on standard gates. Fast enough for doors and farm traps; slow enough that huge circuits may need planning. For brain-bending designs, the community Logic Gate Simulator (linked from the official wiki) lets you test before spending components in Survival.

Scrap Mechanic logic gates AND OR XOR wiring

Creative vs Survival

Logic parts work in Creative immediately for testing and in Survival once you craft them at a Craft Bot. Creative is the sandbox for prototyping repeating timers or XOR latches without raid pressure. When a design is stable, blueprint the frame and rebuild it at your Mechanic Station base.

Challenge mode also uses logic for timed builds — clearing the first six challenges earns the True mechanic achievement; see the achievements page for the full Challenge route.

Power and parent blocks

Most logic parts need a stable parent block on your lift structure. If bearings spin the whole assembly, wires can snap when the physics engine re-simulates. Anchor logic cores to the ground or a non-moving frame; mount pistons on the moving layer only.

How do AND, OR, XOR, and inverse logic gates work?

The block exposes six modes: AND, OR, XOR, plus inverses NAND, NOR, and XNOR. Right-click to cycle modes; the face icon shows the active gate. Scrap Mechanic logic gates are the same parts used in community CPU builds — you only need three modes for most Survival automation.

Scrap Mechanic sensor and timer automation
GateOutput ON when…Typical Survival use
ANDEvery connected input is ONTwo-button secure doors, dual-sensor raid alarms
ORAny input is ONMerge multiple raid sensors into one siren line
XORInputs disagree (one ON, one OFF)Toggle latches, alternating piston phases
NANDNOT all inputs ONReset lines for memory circuits
NORNo inputs ONRepeating timer loops with timers (wiki standard)
XNORInputs match (both ON or both OFF)Sync lines, repeating clock variants

AND gate — the two-key door

Wire and into an AND gate, then wire the AND output to a or on your gate. Both buttons must be held or latched ON before the door opens — classic airlock behavior for warehouse loot runs where you do not want Farmbots following you inside.

OR gate — any tripwire fires the trap

Connect three facing different raid paths into an OR gate, then into a piston crusher or mounted weapon controller. Any single bot crossing a beam triggers the output — ideal when raid spawn points rotate around your farming guide plots.

XOR gate — alternating phases

XOR outputs ON when inputs differ. Pair with a timer loop and you get alternating piston phases — one arm extends while another retracts. Sorting lines and flip-flop memory both start here; advanced builds chain XOR with NOR gates for stable clocks.

Inverse gates (NAND / NOR / XNOR)

NAND and NOR are AND/OR with inverted output — handy when you want a line idle HIGH and pulsed LOW. The official wiki repeating-timer recipe uses AND + NOR + Timer in a triangle; XNOR repeating clocks appear in community tutorials as an alternative to XOR loops.

Automate your farm next

Matched by build plan, shared topics, and guide progression — not random related links.

How do sensors and timers work in Survival?

Sensors cast a detection beam; Timers hold an ON pulse for a set duration then release. Together they are the sensory nervous system of Scrap Mechanic automation — raids detected, delays staged, harvesters clocked.

Scrap Mechanic repeating timer logic loop
PartRoleKnob settings
Detects objects/players in a beamFilter by type where supported; aim across choke points
Delays and pulses signalsDuration in ticks/time — shorter = faster cycle
Manual ON/OFF kill switchHard-disable repeating loops or trap arms
Momentary pulseManual door open, single-shot piston fire
  • Do01Place sensors before planting crops — raiding paths become obvious after one failed defense
  • Do02Test timer duration in Creative with a light block on the output
  • Do03Add a master switch on every repeating loop
  • Do04Keep timer cores on static frames, not on harvester arms

Sensor placement for raid defense

Mount sensors at ankle height across field entrances — Haybots and Totebots trip beams reliably at ground level. Point beams across chokepoints rather than wide open fields; fewer false positives from your own vehicles. Feed sensor outputs into OR gates when covering multiple lanes, then into piston crushers or mounted weapons.

For player-only doors, combine a sensor with an AND gate tied to an Enter button inside the base so Farmbots cannot follow even if they touch the outer switch.

Timer loops — repeating harvest or blinkers

A repeating timer needs at least two logic gates + one timer + optional switch (see wiki *Building: Repeating Timer*). Wire OR → XNOR → AND → Timer → back to OR, or the AND/NOR/Triangle variant. Adjust timer duration for crop harvest intervals or trap re-arm delays.

Always add a switch on the kill line so you can silence the loop during building — otherwise pistons hammer while you align bearings.

How do controllers and pistons sequence machines?

Controllers sequence multiple outputs from one input — perfect for garage doors, multi-stage traps, or synchronized piston walls. convert logic ON signals into linear motion: push crops into collectors, smash bots, or lift airlock doors.

Mount pistons on sturdy frames. Axolot Games's physics engine transfers force through lift blocks — a piston on a wobble bearing can yeet the whole trap sideways during a level-5 raid.

Scrap Mechanic controller and piston trap

Controller sequencing

Connect a gate output to a , then wire each controller channel to a piston, bearing brake, or mounted tool. Controllers fire steps in order — use them when a single pulse must extend three walls before arming a weapon.

For garage doors, pair a controller with timed piston pairs: one row extends to lift, a second row slides the gate. Test in Creative with no bots so you can rewind mis-timed channels without losing crops.

Piston crushers and flippers

Raid traps often use overhead pistons on OR-gated sensors — bot enters, piston slams, timer rearms after two seconds. Bot splat and junkyard achievements count creation kills; piston crushers rack up Totebot and Haybot totals passively during farmbot raids.

Horizontal pistons make fine sorters: extend to push items off a conveyor bearing, retract to let the next stack pass. Combine with XOR-timed arms for alternating lanes.

What automation examples work for farms, doors, and factories?

These four patterns cover most Scrap Mechanic automation needs from early Survival through Chapter 2 mining hubs. Copy one block at a time; do not merge raid traps with harvest loops until each sub-circuit works alone.

Scrap Mechanic automated farm defense circuit
BuildCore partsGoal
Dual-button AND door, , Stop Farmbots entering base
OR-gated raid trap, , , Passive kills during raids
Repeating timer farm clock, , , Cycle harvesters or sprinklers
Warehouse airlock, , 2× , Loot runs without bot tail
  • Do01Prototype in Creative, rebuild in Survival
  • Do02One master switch per loop
  • Do03Static frame for gates; moving layer for pistons only
  • Do04Test after every chunk save — reload blips happen

Example 1 — AND door for your first base

Place Button A outside and Button B inside, both wired to an AND gate driving a horizontal piston door. You must press inside first to arm, then outside to enter — bots cannot random-walk both buttons. Upgrade to sensors once you craft them.

Example 2 — OR raid trap ring

Surround the field with three sensors aimed at raid spawn lanes. OR gate → timer (0.5s) → piston crusher. Timer rearms after each smash so one bot does not drain the line ON forever. Pair with the farming guide raid calendar so you power traps before warnings.

Scrap Mechanic logic guide hero

Example 3 — repeating timer for lights or harvesters

Build the OR–XNOR–AND–Timer loop from the sensor section; hang a Light or Controller on the XNOR output. Flip the master switch OFF while aligning, then ON for overnight crop lighting or timed harvester bearings.

Example 4 — piston sorter for warehouse loot

After a warehouse guide run, drop loot on a bearing conveyor. Sensor detects item stack → piston pushes left if ON, timer clears → next sensor sorts another tier. XOR alternates lanes when two pistons would collide.

Logic FAQ

AND vs OR gates — which do I use first?

AND for doors that need two conditions; OR for traps that should fire when any sensor trips. Most raid rings start with OR.

Do logic parts work in Survival?

Yes — craft Program Node parts at Craft Bots after unlocking tiers at the Mechanic Station. Creative is only for risk-free testing.

Why does my repeating timer flash after load?

Gate states restore asynchronously on chunk load. Add a switch default-OFF or a short delay timer before explosives arm.

Can I build a computer with Scrap Mechanic logic gates?

Community builds include calculators and displays using XOR latches and binary adders — start with the wiki flip-flop, then scale up in Creative.

What connects to pistons — gates or controllers?

Both work. Gates for simple ON/OFF; controllers when one button must run multiple pistons in sequence.

Best logic build for farming raids?

OR-gated sensors into piston crushers along spawn paths, plus walls from the building guide. Automate before expanding to level-5 raid farm size.

Related pages

Matched by build plan, shared topics, and guide progression — not random related links.

Back to home