npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@embedded32/bridge

v1.0.0

Published

CAN ↔ Ethernet ↔ MQTT routing and bridging

Readme

embedded32-bridge

Intelligent routing and bridging of J1939 CAN messages to Ethernet and MQTT.

Overview

Embedded32 Bridge connects the CAN bus to cloud and IoT infrastructure:

  • CAN ↔ Ethernet - Bidirectional routing with filtering and rate limiting
  • CAN ↔ MQTT - Topic-based message distribution with device discovery
  • Rule Engine - Priority-based filtering, transformations, and selective routing
  • J1939 Aware - Native PGN/SPN parsing and selective message propagation

Installation

npm install embedded32-bridge embedded32-ethernet embedded32-can embedded32-j1939

Usage

CAN-Ethernet Bridge

import { CanEthernetBridge } from 'embedded32-bridge';
import { CANBus } from 'embedded32-can';
import { UDPServer } from 'embedded32-ethernet';

const canBus = new CANBus({ interface: 'vcan0' });
const ethServer = new UDPServer(5000);

const bridge = new CanEthernetBridge({
  canBus,
  ethServer,
  pgnFilters: {
    whitelist: [0xF004, 0xFECA],
    blacklist: []
  },
  rateLimits: {
    0xF004: 10,  // 10 Hz for Engine Speed
    default: 5   // 5 Hz for others
  }
});

await bridge.start();

CAN-MQTT Bridge

import { CanMqttBridge } from 'embedded32-bridge';
import { CANBus } from 'embedded32-can';
import { MQTTClient } from 'embedded32-ethernet';

const canBus = new CANBus();
const mqtt = new MQTTClient({ broker: 'mqtt://localhost:1883' });

const bridge = new CanMqttBridge({
  canBus,
  mqtt,
  topicPrefix: 'fleet/truck1',
  pgnTopics: {
    0xF004: 'engine/speed',
    0xFECA: 'engine/controller'
  },
  deviceName: 'Truck ECU 1',
  payloadFormat: 'nanoproto'
});

await bridge.start();

Rule Engine

import { RuleEngine } from 'embedded32-bridge';

const engine = new RuleEngine({
  defaultAction: 'drop',
  rules: [
    {
      id: 1,
      priority: 100,
      pgn: 0xF004,
      action: 'forward',
      destinations: ['ethernet', 'mqtt'],
      rateLimit: 10
    },
    {
      id: 2,
      priority: 80,
      pgn: 0xFECA,
      spnFilter: [190, 191],
      action: 'forward',
      destinations: ['mqtt'],
      rateLimit: 1
    }
  ]
});

const decision = engine.route(canMessage);

Configuration Options

CanEthernetConfig

| Option | Type | Description | |--------|------|-------------| | canBus | CANBus | CAN interface instance | | ethServer | UDPServer | UDP server instance | | pgnFilters | object | Whitelist/blacklist PGNs | | rateLimits | object | Rate limit per PGN (Hz) | | statsInterval | number | Statistics reporting interval (ms) |

CanMqttConfig

| Option | Type | Description | |--------|------|-------------| | canBus | CANBus | CAN interface instance | | mqtt | MQTTClient | MQTT client instance | | topicPrefix | string | Base topic path | | pgnTopics | object | PGN to topic mapping | | deviceName | string | Device identifier | | payloadFormat | string | 'nanoproto' or 'json' |

License

MIT © Mukesh Mani Tripathi