esp32-can-iot

Public

newtec-gmbh/esp32-can-iot

Loading…

Description

Imported from GitHub: NewTec-GmbH/esp32-can-iot · commit da2b9f4 · license BSD-3-Clause

Description

A ESP32 based interface between CAN-bus and IoT environments.

README

Hardware Description

Architecture

Hardware_Overview

This deviced is based on the ESP32­-WROOM-­32E processor, which has a diverse number of interfaces such as digital and analog inputs and output, as well as an integrated CAN bus controller and WiFi capabilities, between many other characteristics. The ESP32 additionally needs a CAN Transceiver to receive the data from the CAN-H and CAN-L lines.

The connection to the CAN Bus is done through a DSUB-9 connector, which is the standard for CAN busses. This connector can also provide a the device with power, but with a 12V voltage which has to be reduced to 5V before going into the ESP32 DevKit, where it will be transformed again into 3.3V.

Implementation

The Project was developed using KiCad and all its Toolchain. This includes Eeschema, Pcbnew and GerbView.

CAN/OBD-II Switching

In order to implement this device in the automotive environment it is necessary to adapt the standard connector found in cars (OBD-II) to the standard CAN connector (D-SUB9). This is achieved by using an OBD-II to DB9 Cable, from Sparkfun for example. The problem with this solution is that the cable does not use the same pins for the High and Low signals of the CAN-Bus:

PinOBD-IIDSUB-9
2GNDCAN-LOW
3CAN-HIGHGND
5CAN-LOW---
7---CAN-HIGH
912V---

The main issue is the connection of the CAN signals to Ground, as this would turn off the Bus in all of its nodes and this should be prevented at all costs.

Our solution is the use of one analog pin on the microcontroller, which detects the incoming 12V at Pin 9 when using the OBD-II option (through a 10:1 voltage divider). If the analog signal is present, two relays are closed to change the connections of the D-SUB9 connector to the rest of the board.

This solution has been proved effective and quick enough so no the bus is not distrubed in any way.

Components

The following components were selected for this project's PCB. Smaller components such as resistors and capacitors are not included in this list, but can be found on the BOM.

ComponentDescription
ESP32-DEVKITC-32DMicroprocessor used. Connected using socket strips
SS24Safety diode for Microprocessor in case more than one power supply is being used
TPS62160DGK12V 1A Step-down Converter
R45200212V Fuse
SMAJ16AProtective Diode at 12V input
G5V-2-DC5Relay for "smart" switching between CAN and OBD Pinout
BC817Transistor for Relay control
1N4148Diodes for Relay protection
DSUB9Standard connector for CAN-Bus
SN65HVD233-HTCAN Transceiver
744242220Toroid for CAN-Bus Filtering
PESD1CANDiode for CAN-Bus Filtering
AST 045-088-position connector with latches for GPIO
CAB-10087OBD-II to DB9 Cable

Version 1.0

Version 1.0_Front Version 1.0_Back

Version 1.1

2 Main Errors were found on Version 1.0:

  • Tx and Rx Signals from the CAN Transceiver were inverted
  • The 5V Supply for the Relays was located after a diode, which prevented the use of the relays when connected only through USB Supply.

In the new version were these two changes made and after testing it resolved in success.

Other minor errors were also repaired, such as the size of the holes for AST 045-08 Connector which were too small.

Comments

No comments yet. Be the first to ask about this board.

Askabout this board