OpenLCB Arduino Support

This page describes the OpenLCB Arduino software. See also the Hobbyists page.

The OpenLCB software requires Arduino version 1.0 or later.

Hardware

There are several versions of CAN hardware available or under development for the Arduino. All of these use the Microchip MCP2515/MCP2551 chip set, so are compatible with the standard CAN library.

Arduino Sketches

Version 18 or later of the Arduino IDE allows you to set the location of the “sketch book” in the preferences. Perhaps the easiest way to compile and run the example OpenLCB sketches: Open Arduino, go to the preferences, and set the sketchbook directory to this one. Save the preferences, quit Arduino, and start it again. You can then go to the File menu, select Sketchbook → libraries → OlcbArduinoCAN → some sketch you'd like to build and run.

OlcbBasicNode

Two consumer, two producer sample node with configuration and blue/gold programming support.

OlcbEightConsumer

Eight consumer sample node with configuration and blue/gold programming support.

RailroadShieldNode

One consumer, one producer sample node with configuration and blue/gold programming support. Uses the first of the built-in green buttons for input and output.

Note 1: You need to set the CS selection to B,1 in the CAN/utility/config.h file of the CAN library.

Note 2: The 2nd built-in button is on Arduino pin 10, which is the CS bit on other CAN interfaces. If this sketch is updated to use that bit, it ceases to function after a little while, so there's probably another reference to the CS bit in the CAN library that we haven't found yet.

OlcbEightConsumer

Eight consumer sample node with configuration and blue/gold programming support.

OlcbServoNode

Three consumer sample node to drive a servo to one of three positions.

OlcbDisplay

Display OpenLCB messages on a LCD display.

CAN2EtherNetClient, CAN2EtherNetServer

Provide an ASCII format Ethernet-CAN interface as either a Telnet client or server.

CAN2USBuino

Provide an ASCII-format CAN-USB interface. Useful as an adapter for e.g. a PC program.

CAN2USBuinoFilters

An ASCII-format CAN-USB interface with filtering; work in progress.

OlcbClockGenerator, OlcbFastClockDisplayNode

A fast clock time generator and display module for OpenLCB (Work in progress)

OlcbLocoNet

(Work in progress)

OlcbNmraDcc

(Work in progress)

Library

The platform-independent library code lives in the libraries/OlcbCommonCAN directory.

Getting the Code

The content of this development area, including code, documents and web pages, is kept in the OpenLCB SourceForge.net SVN repository in the “trunk/prototypes/C” directory. To check it out, please do:

svn co http://svn.code.sf.net/p/openlcb/svn/trunk/prototypes/C C

For more information on the SVN source code management tool, please see the SVN website and the online SVN book.



This web sites contains trademarks and copyrighted information. Please see the Licensing page.

This is SVN $Revision: 3111 $ of 08/16/09.