Home

Awesome

For esp32 go to esp32 branch

For updates on arduino micro pcb go to arduino_micro_pcb branch

Lin bus reader and writer

Ardunio Ethernet (alt. arduino micro + ethernet shield) + MCP2004A. Read/write, act as a master or one or many slaves.

Setup

Arduino Micro based

Components

for ENC28J60 connect (Same coloring as in picture)

microW5100/ENC28J60
5vVCC
GNDGND
MOSISI
D10CS
MISOS0
SCLKSCK
RESETRST

Arduino Ethernet based

Components

components:

Alternative hardware...

<br/> for this you need to use the following library https://github.com/UIPEthernet/UIPEthernet <br/> <br/>

Yet other alternatives...

Yet another alternative, probably the leanest Configuration (untested)

Configuration

Arduino

Install software

Adafruit Feather 32u4

If you are using an Adafruit Feather 32u4 you need to add Adafruit board definitions to the Arduino IDE.

File/Preferences: Additional Boards Manager URLs: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json

Tools/Board:/Boads Manager... Install "Adafruit AVR boards"

Now "Adafruit Feather 32u4" should be selectable under Tools/Board:

Upload software to arduino

Once it's configured use Arduino Studio to upload your software. When uploading the software make sure RX is discsonnect, othervise the upload will likely fail.

Signal Server

Signal sever will configure the node automatically.

https://github.com/AleksandarFilipov/signalbroker-server

Make sure to ports are open on the linux machine hosting the signalserver.

For ubuntu 16.04 you would need to open some port...

sudo ufw allow 2013
sudo ufw allow 2014
sudo ufw allow 4000

And configure your interfaces.json accordingly

{
      "namespace": "LinSlave",
      "type": "lin",
      "config": {
        "device_identifier": 1,
        "server_port": 2014,
        "target_host": null,
        "target_port": 2013
      },
      "device_name": "lin",
      "node_mode": "slave",
      "ldf_file": "configuration/ldf_files/linone.ldf",
      "schedule_file": "configuration/ldf_files/linone.ldf",
      "schedule_table_name": "linoneSchedule",
      "schedule_autostart": false
    },s

In the example above the arduino is set up as a slave. by setting:

{
    "node_mode": "master",
}

arduino will act as a master. In this case it also make sense to activate the automatic schedule

{
    "node_mode": "master",
    "schedule_autostart": true,
}

Starting

Once the arduino is powered on it will start by fetching configuration from the signal server. Once the onboard led goes on, the board has fetched its configuration successfully from the signal server. (It will keep trying feting configuration until it succeeds)

To reload the configuration press the reset button on the top left (see picture above)

Debugging

The arduino will by default output it's logs on port 3000, again, make sure to unblock that port in you firewall (check top of ino file to switch port).

Logging can the be traced on ubunto 16.04 by issuing

sudo tcpdump udp port 3000 -vv -X

Nice to know

In slave mode the arduino keeps a write buffer which it writes every time the master scheduler queries it. This buffer is never cleared (the same reasoning goes for the signal server), so in practice, if you tampered with the wrong signal you should restart the signal server which will reset the arduino.

References