Unit 06 · lesson

Digital, Analog, and PWM Are Different Ideas

Robotics wiring diagrams often mix several signal types on the same page. If you treat them all as "data wires," debugging becomes harder than it needs to be.

Digital input

A basic digital input represents discrete states.

Examples:

  • switch open/closed;
  • beam broken/clear;
  • fault active/inactive.

The voltage is still physical, but software commonly interprets it as a logical state.

Analog input

An analog input measures a voltage range and converts it into a numeric value.

A sensor might map:

0.5 V → low pressure 2.5 V → medium pressure 4.5 V → high pressure

The conversion requires calibration. The voltage is not the physical quantity itself.

PWM output

PWM usually commands an output by changing duty cycle over time.

command 0.20  → 20% duty
command 0.50  → 50% duty
command 0.80  → 80% duty

That is different from reading an analog sensor, even though both can involve values between minimum and maximum.

Bus communication

Modern sensors and motor controllers may exchange structured digital messages over a shared communication bus.

Now the system has another layer:

device value

message encoding

shared bus

message decoding

software object/value

A device can have perfect power and still disappear from software if communication fails.

Misconception check

"Analog means accurate." No.

"Digital means only on/off devices." No.

"PWM is a lower DC voltage." Not exactly.

"Bus communication eliminates wiring problems." Absolutely not.

Each signal type solves a different interface problem.

Signal classification

For four robot devices, record:

  • what physical quantity or command is involved;
  • signal/interface type;
  • expected range or states;
  • one impossible value;
  • one failure that could look valid.

The last column matters. A believable wrong value is more dangerous than an obvious error.

Decode the interface before using the value

Suppose three devices report information in different ways:

DeviceInterfaceWhat the controller actually observes
limit switchdigitalone of two logic states
potentiometeranaloga voltage converted into a numeric sample
hobby servo commandPWM-like timed pulsepulse timing interpreted as a target

Calling all three "signals" is correct but not very helpful. Their failure modes are different.

A disconnected digital input may float or settle to a default state. An analog input may produce a plausible but incorrect voltage. A timed signal can contain valid voltage levels but incorrect timing.

PWM is about time

For a simplified duty-cycle example, imagine a digital output repeating every 10 ms.

HIGH 2 ms + LOW 8 ms = 20% duty cycle
HIGH 7 ms + LOW 3 ms = 70% duty cycle

The output does not become "70% digital." The signal remains high or low at each instant. The fraction of time spent high changes.

That timing can be used for power control or information encoding depending on the interface. Do not assume every waveform called PWM has the same meaning.

Interface card

For one sensor or actuator interface, document:

  • electrical or message form;
  • update rate;
  • valid range;
  • invalid or disconnected behavior;
  • conversion performed before software uses the value.

That small card prevents a common robotics mistake: trusting a number without understanding how the number entered the program.