NMEA2000 to WebSocket+Serial gateway build around Adafruit Huzzah ESP8266 module with CAN-Bus Shield (including hardware design/eagle-files)
Reads messages of N2K-bus and relaying over WebSocket and Serial
Depends on the following libraries (in addtion to the ESP8266 Core
and Arduino IDE
)
arduinoWebSockets
- WebSocket Server and Client for ArduinoCAN_BUS_Shield
- Can Bus Mcp2515 8/16 MHz oscillator NMEA2000
- NMEA2000 library for Arduino NMEA2000_mcp
- NMEA2000 library support for MCP2515 CAN bus controller. Forked version with added support for ESP8266 interruptsWiFiManager
- ESP8266 WiFi Connection manager with web captive portalArduino-Makefile-ESP
- Arduino Makefile for ESP-boards Edit the Makefile
ARDMK_DIR := $(SRCDIR)/../Arduino-Makefile-ESP
BOARD_TAG=huzzah
ESP_OTA_ADDR=192.168.12.31
Then compile->link->hex
make
Normal upload (esptool
) over USB-serial-FTDI
# first hit GPIO0+RST buttons on the Huzzah-board to enter flash-mode
make upload
# 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
MONITOR_PORT=/dev/tty.usbserial-A104OFNV
A special target monitor
in the makefile opens a screen-connection over serial
make monitor
# Ctrl-A k let's you terminate the serial connection
# 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:
ESP_OTA_ADDR=192.168.4.1
ESP_OTA_PORT=8080 (default 8266)
ESP_OTA_PWD=mysecret (default <empty>)
and then
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
make fs
and uploaded/flashed with
make upload_fs
or
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.
The ESP-module used is the Adafruit HUZZAH ESP8266 breakout with a “shield” providing
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)