项目作者: andreasberg

项目描述 :
NMEA2000 to WebSocket+Serial gateway build around Adafruit Huzzah ESP8266 module with CAN-Bus Shield (including hardware design/eagle-files)
高级语言: Eagle
项目地址: git://github.com/andreasberg/esp8266_n2k_gateway.git
创建时间: 2017-06-02T19:50:51Z
项目社区:https://github.com/andreasberg/esp8266_n2k_gateway

开源协议:

下载


NMEA2000 to WebSocket+Serial gateway

Reads messages of N2K-bus and relaying over WebSocket and Serial

Functionality

  • Listens for messages on NMEA 2000 (CANBus) bus and logs PGN of all messages received
  • Writes same output over WebSocket and over Serial in Linux-‘Tee’-like fashion (WebSocketBufferedStrem.h, inspired by NeoTee)
  • Parses selected messages and logs
  • Provides a simple yet (somewhat) responsive (BootstrapV3-based) web interface from the ESP8266 SPIFFS-filesystem
  • Web-captive portal for configuration of WiFi-connecition
  • Over-The-Air updates supported

Dependencies

Depends on the following libraries (in addtion to the ESP8266 Core and Arduino IDE)

Building & flashing

Edit the Makefile

  1. ARDMK_DIR := $(SRCDIR)/../Arduino-Makefile-ESP
  2. BOARD_TAG=huzzah
  3. ESP_OTA_ADDR=192.168.12.31

Then compile->link->hex

  1. make

Normal upload (esptool) over USB-serial-FTDI

  1. # first hit GPIO0+RST buttons on the Huzzah-board to enter flash-mode
  2. make upload
  3. # sometimes the boot process hangs after upload, press RST to try again

If the device for the USB-serial port in not detected correctly then override by defining MONITOR_PORT in Makefile

  1. MONITOR_PORT=/dev/tty.usbserial-A104OFNV

A special target monitor in the makefile opens a screen-connection over serial

  1. make monitor
  2. # Ctrl-A k let's you terminate the serial connection
  3. # Connection needs to be terminated before 'make upload' or 'make upload_fs'

Once this (or any other sketch supporing Over-The-Air (OTA) updates) is successfully flashed, further uploads can be done with espota.py without putting board into flash-mode or closing serial connection(monitor)
Update Makefile:

  1. ESP_OTA_ADDR=192.168.4.1
  2. ESP_OTA_PORT=8080 (default 8266)
  3. ESP_OTA_PWD=mysecret (default <empty>)

and then

  1. make upload_ota

The webserver-files are located in $(SRCDIR)/data and the SPIFFS-file (filesystem binary image file) is created with makefile target fs

  1. make fs

and uploaded/flashed with

  1. make upload_fs

or

  1. make upload_fs_ota

After the board has booted and connected to Wifi, open a browser and go to http://<IP>/index.html

Default WebSocket-port is 81 so clicking ‘Connect’ shoud open the WebSocket-connection and start the feed of log-messages.

ScreenShot

Hardware

The ESP-module used is the Adafruit HUZZAH ESP8266 breakout with a “shield” providing

  • a CAN-bus interface (based on Microchip MCP2515- & MCP2562-ICs)
  • a switching regulator (based on Texas Instrument TPS54202-IC) for powering both the ESP8266-module and shield from the standard 12V supply of NMEA2000 bus

The schematic&board (EAGLE-)files can be found here

Components of the shield are hand-solderable (minimum size 0705) but both the inductor (L1) and oscillator (Y1) are a bit tricky (should have a bit larger landing-pads)

ToDo/Limitations/Issues

  • Implement more generic/lightwigth parse-to-log-function
    • The implementation for parsing the N2k messages is a simple rip of NMEA2000-library DataDisplay-examples and quite heavy. Only a few messages can be handled before exhausting the ESP8266’s very limited .text-section (max 32 KB, linker error: section ‘.text’ will not fit in region ‘iram1_0_seg’). I assume the WiFiManager & arduinoWebSockets are also to blame for bloating the section.
  • Design shield version 2 for more cost effective ESP8266-modules like the Wemos D1 Mini