I have just bought another ESP8266/NodeMCU development board cheapy from eBay (this one) with an ESP-12E chip on board. I’ve also bought an SPI-CAN bus interface with the common Microchip MCP2515 CAN controller to try and create a CAN-Wifi gateway.
There are not a lot of details on the CAN module board, but the pinout is written on it – although the Vcc voltage isn’t noted:
The MCP2151 datasheet is here. The board also uses a TJA1050 CAN Transceiver to translate the voltage levels to CAN. It appears that the MCP2151 can operate between 2.7V and 5.5V but the TJA1050 requires 5V, and since there are no voltage regulators on the board, I will assume I have to supply VCC with 5V
I’ve then found an Arduino ‘Unified CAN Bus library’ on the Arduino forums and have forked it on GitHub to start porting it to the ESP8266. This is a great idea – it’s a single library which should support many different types of MCU, across many different CAN controllers – so it should be a great place to start and would be nice to add ESP8266 compatibility to the library.
In order to test whether the CAN communication is working at all, I am using a PCAN USB Gateway from PEAK, and PiSnoop ECU Calibration Tool from Pi Innovo. The PCAN USB gateway uses the (almost) industry standard D-Sub pinout for CAN connections on DB-9 connectors shown below where CAN-H is pin 7 and CAN-L is pin 2:
Got it working – check it out here: ESP8266 Wifi CAN Gateway