This week I have been working solely on the electronics apart from a few business meetings and some work on that commercial website I am doing.

 

Above image shows  the gateway to the CAN bus from Ethernet.
I finished the communication from the desktop through the gateway to the CAN bus clients. I also finished implementing the first client sketch for the motorised valves. Have found motorised ball valves in cr-05 configuration meaning they have feedback signals at closed and open state, not just motor wires. I can connect 5 of such valves to one Arduino using an IO expansion shield. It is more practical to connect 5 to one box rather than using more boxes with less connections. The same Arduino can have up to 12 temperature sensors and 5 tank senders. The temp sensors use OneWire bus and the tank senders are connected via analogue in.
This makes up one control box connected to the CAN bus. I have three of these with a total of 15 valve controls but only 10 tank senders connected. The IO expansion shield uses the I2C bus of the Arduino.

I have tested the connection between the gateway and one client with 10m of cat5 cable and it works fine, however for the real installation I will use the proper shielded twisted pair.

I have also started to test the current sensors and the IR senders, which will be connected to another type of box.

Here is a diagram describing the communication between the main application and the gateway. It does include a component of gateway client component . I have also documented everything in my development wiki that  I remember when I get to the point when I finally put the boxes together.

Communication_TAS_CAN_gateway

Below is a screen shot of the diagnostic app which I have written in JAVA while I was developing the gateway and client communication. It allows me to individually send packets over the Ethernet and the CAN bus and test individual aspects of the box which it is mean to connect to. I will eventually have several of these test apps for the different type of boxes, a bit like the diagnostic system for a car although I use my own protocol and connect via Ethernet. This means that I can remotely connect also to each low level signal over Wifi or Bluetooth.

CAN_bus_test_app

It all took a tad longer than I thought cause I had a few issues with the Arduinos and had to do some digging to solve it because there was no answer on the web for one of the problems I had (sync problem when programming – no solution or diagnosis on the web). It had to do with one pin disturbing the serial sync when pulled low. Better not use pin 0 or don’t pull it low when programming.

Apart from that everything works really well and since the basic communication is now solved the other sensor connections should be quicker. It now all boils down to simple programming, shear effort- not much brain work anymore.