Skip to content

CAN (Controller Area Network) Controlled Analog/Digital Input/Output Module

License

Notifications You must be signed in to change notification settings

matthias-bs/CAN-IO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CAN-IO

CAN (Controller Area Network) Controlled Analog/Digital Input/Output Module

  • Control analog outputs by CAN messages
  • Control digital outputs by CAN message
  • Monitor analog inputs via CAN message
  • Monitor digital inputs via CAN message

⚠️ Check supply and I/O voltages carefully and build up your circuit accordingly!

⚠️ Over voltage/over current protection for analog and digital inputs/outputs must be implemented as required!

⚠️ Implement voltage dividers and filter capacitors for analog inputs as required.

Examples - Features

Program MCU Board Devel.-Env. Supply Voltage
Board/MCU
Analog Inputs Analog Outputs Digital Inputs Digital Outputs
ESP32_MCP2515_CAN_IO ESP32 generic
(e.g. Joy-It SBC-NodeMCU-ESP32)
Arduino 5V(1) / 3.3V 2(2) (0...3.3V) 2(3) (external; 0...5V) 6(2) 2(2)
ESP32_IntegratedSJA1000
_CAN_IO
ESP32 generic
(e.g. Joy-It SBC-NodeMCU-ESP32)
Arduino 5V(1) / 3.3V 2(2) (0...3.3V) 2(3) (external; 0...5V) 6(2) 2(2)
ATSAME51_CAN_IO ATSAME51 Adafruit Feather M4 CAN Express Arduino 5V(1) / 3.3V(1) 4 (0...3.3V) 2 (internal; 0..3.3V) /
2(3) (external; 0..5V)
6 2
AT90CAN128_CAN_IO AT90CAN128 Crumb128-CAN AVR-GCC 5V(1) / 5V 4(4) (0...5V) 2(3) (external; 0...5V) 8(5) 8(5)

(1) Supply voltage level and quality have direct impact on the DACs' output signals. For instance, you won't get a 5V analog output from a USB power supply (due to the typical schottky diode between VDDUSB and VDD5V).

(2) ESP32 allows great flexibility of utilizing I/O pins - the numbers provided here are only for the default configuration. The actual number of I/O pins varies with different boards.

(3) More DAC channels possible with MCP4725 devices with suitable I2C addresses

(4) More ADC channels are available if required

(5) More I/O ports are available if required

Examples - CAN Interfaces

Program MCU Board CAN Controller CAN Transceiver CAN Bus Termination
ESP32_MCP2515_CAN_IO ESP32 generic
(e.g. Joy-It SBC-NodeMCU-ESP32)
external (MCP2515)(1) external(1) external(1)(2)
ESP32_IntegratedSJA1000
_CAN_IO
ESP32 generic
(e.g. Joy-It SBC-NodeMCU-ESP32)
internal external external
ATSAME51_CAN_IO ATSAME51 Adafruit Feather M4 CAN Express internal Adafruit Feather M4 CAN Express: on board Adafruit Feather M4 CAN Express:
120 Ohm on board;
trace "Trm" needs to be cut if not needed
AT90CAN128_CAN_IO AT90CAN128 Crumb128-CAN internal Crumb128-CAN: on board external

(1) Tested with AZDelivery MCP2515 CAN Bus Module

(2) AZDelivery MCP2515 CAN Bus Module: enable 120 Ohm termination with jumper J1

Timing

Currently no effort is made to synchronize the various inputs and outputs -

  • CAN_ID_DOUT message reception -> update digital outputs
  • CAN_ID_AOUT0/1 message reception -> start DAC for analog output 0/1, respectively
  • read analog inputs (sequentially) -> transmit CAN_ID_AIN message
  • read digital inputs -> transmit CAN_ID_DIN message

Please take the conversion time (and transmission time, if applicable) of your DACs/ADCs into account.

AT90CAN128 / Crumb128-CAN Configuration

  • Configure fuses on a fresh MCU - see AVR Fuse Calculator

    • Switch off "Divide clock by 8 internally":
    • Switch to external clock oscillator >= 8 MHz (here: with a very conservative startup time...)

    avrdude -c <programmer> -P <port> -p at90can128 -U lfuse:w:0xFF:m

  • The SW is configured for a 16 MHz crystal

  • Set J6 "USBpowered" if desired

  • Set J8 "HighSpeed CAN" if you don't have other requirements

Releases

No releases published

Packages

No packages published