Skip to main content

MCU1 LED Control ECU (Arduino Uno + MCP2515)

This device drives an 8-LED strip over CAN and reports its current light status back to the Raspberry Pi 5 running the Kuksa CAN Provider.

Hardware

ComponentDetails
BoardArduino Uno R4 WiFi
CAN transceiverMCP2515 module (8 MHz crystal, TJA1050)
LED outputWS2812 LED strip (8 LEDs)
BusCAN at 500 kbit/s

See the Hardware BOM for sourcing details and wiring instructions.

Responsibilities

  • Receive BlinkerCommand CAN frames from the Raspberry Pi 5
  • Drive the WS2812 LED strip to show turn-indicator and brake-light states
  • Send BlinkerStatus CAN frames reporting the current state back to the Pi

Arduino Libraries

LED Allocation

LEDs (1-based)LEDs (0-based)Function
1-20-1Left indicator
4-53-4Brake light
7-86-7Right indicator

CAN Protocol

Payload Encoding

The Arduino expects a single-byte payload where each bit (or bit pair) represents a VSS signal. The same encoding is used when publishing status back to the Raspberry Pi.

Bit(s)VSS Signal
0Vehicle.Body.Lights.DirectionIndicator.Left.IsSignaling
1Vehicle.Body.Lights.DirectionIndicator.Right.IsSignaling
2-3Vehicle.Body.Lights.Brake.IsActive (0=INACTIVE, 1=ACTIVE, 2=ADAPTIVE)

CAN IDs

CAN IDNameDirectionDescription
0x120 (288)BlinkerCommandRaspberry Pi → ArduinoSet blinker and brake state
0x121 (289)BlinkerStatusArduino → Raspberry PiReport current state

See VSS / CAN Signal Mapping for the full DBC definition and value transforms.

LED Blinking Behavior

Signal StateLED Behavior
Left indicator ONLEDs 0-1 blink at 1 Hz (500 ms on/off)
Right indicator ONLEDs 6-7 blink at 1 Hz (500 ms on/off)
Brake ACTIVELEDs 3-4 solid on
All OFFAll LEDs off

Wiring

MCP2515 to Arduino

MCP2515 PinArduino Pin
VCC5 V
GNDGND
CSD10 (SPI SS)
SOD12 (SPI MISO)
SID11 (SPI MOSI)
SCKD13 (SPI SCK)
INTD2

The WS2812 LED strip data line connects to a digital output pin (see sketch for the exact pin).

CAN Bus Connection

Connect CAN_H and CAN_L between the MCP2515 module and the Waveshare RS485 CAN Hat on the Raspberry Pi 5. Use twisted-pair wiring and add 120 Ω termination resistors at each end of the bus.

Configuration

  • CAN bitrate: 500 kbit/s
  • MCP2515 clock: 8 MHz

No Wi-Fi or MQTT configuration is needed — this ECU communicates solely over CAN.

Sketch Location

devices/mcu1-led-control-can/mcu1-led-control-can/mcu1-led-control-can.ino

Upload via the Arduino IDE (2.x) with the Arduino UNO R4 WiFi board selected.