Skip to content

Arduino Generic CAN Open Node

License

Notifications You must be signed in to change notification settings

jgeisler0303/AGCON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Project is no longer maintained. Please see if this might be an alternative for you: https://github.com/jgeisler0303/CANFestivino

Introduction

This project aims to provide hardware and software to build a versatile and generic device that can be used to connect all sorts of sensors and actuators to a CANopen network. My main intention is to use these devices in home automation applications.

Originally I wanted to cal the project CANduino but that name is already taken. Now I think that AGCON -- Arduino Generic CANopen Node -- is much more descriptive and unique.

The hardware is based on the ubiquitous ATmega 328 microcontroller found e.g. on the Arduino Uno. The mc is preflashed with the Arduino bootloader and can be programmed using an FTDI USB to serial adapter.

Connection to the CAN bus is established via an MCP2515 CAN controller.

The free input and output pins of the ATmega are not routed to the available connectors. Instead, the board features a prototyping area that can be used to customize the device to connect to any sensor or actuator. This allows to mass-produce the board and use it for many different applications.

The software is currently based on the http://www.canfestival.org/ CANopen stack adapted to run on the ATmega 328. For sending and receiving of CAN messages a modified version of the https://github.com/Seeed-Studio/CAN_BUS_Shield library is used. This example code is configured to let the user read 6 digital inputs and write 4 digital outputs. The software has to be compiled using the avr-gcc via a makefile.

The CANopen stack is a protocol that runs ontop of the CAN communication layer and facilitates the acces to device parameters and input/ouput data in a standardized way. Check out the following links to get a quick start on the basic concept:

In the future I plan to rewrite the software as an Arduino library so that the Arduino IDE can be used to configure the device behaviour, e.g. read special sensor protocols or to control pwm outputs.

Getting Started

To compile the software, got to the Software/CanFestival/examples/Arduino subfolder and run make. (This is assuming you have the avr-gcc compiler installed). If you have a USB to serial adapter connected to your PC and board you can also run make flash to directly download the new programm to your controller. The software is not restricted to run on the supplied controller board. Though I haye not tested it, the software can be run on most Arduino boards with a CAN bus shield. But beware that in its current incarnation the SPI chip selection of the MCP2515 is not connected to PB2 (Arduino pin 10). If you want to use the software with CAN bus shields you will probably have to change the following line in mcp_can.c to match your chip select configuration:

#define DDR_CS DDRD
#define PORT_CS PORTD
#define P_CS PD7

For the standard SS pin you will have to change these to

#define DDR_CS DDRB
#define PORT_CS PORTB
#define P_CS PB2

About

Arduino Generic CAN Open Node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published