aboutsummaryrefslogtreecommitdiffstats
path: root/PILC.md
blob: f5fdb30aab3b96fcab92ca1517552041ee6ddb63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# PiLC - The Raspberry Pi PLC

[PiLC](https://bues.ch/a/pilc) is a [Raspbian](https://www.raspberrypi.org/) Operating System derivative that comes with Awlsim preinstalled and ready-to-go.

PiLC can be used to run a Raspberry Pi just like a "real" PLC.


## How to setup PiLC on the Raspberry Pi?

Just copy the PiLC image file onto an SD card. The process of installing PiLC is exactly the same as installing the standard Raspbian distribution.

Please see the [install instructions](https://bues.ch/a/pilc#install) for more details.

There is no need to set up anything else. The PiLC image is pre-configured so that the Awlsim core will automatically start during bootup. The Awlsim core on the PiLC listens to SSH connections on the Ethernet port.


## How to connect to the PiLC?

1. Connect the Raspberry Pi's Ethernet port to your network and power up the Raspberry Pi. It will automatically fetch an IP address from your router.

1. Check your router information page to see which IP address the Raspberry Pi obtained.

1. Start the Awlsim GUI on your PC.

1. Load the example project `raspberrypi-gpio.awlpro` that is shipped with Awlsim into the Awlsim GUI by clicking `File` and then `Open project...`

1. Then connect to the PiLC by clicking `CPU` and then `Go online (Connect to a CPU)` in the menu bar.

1. Enter the IP address of your Raspberry Pi here:<br />
   <a href="doc/pic/pilc/connection0.png"><img src="doc/pic/pilc/connection0.png" alt="awlsim-gui" /></a>

1. Then click `Accept`.

1. If Awlsim asks you to confirm the connection authentication, click `Yes`:<br />
   <a href="doc/pic/pilc/connection1.png"><img src="doc/pic/pilc/connection1.png" alt="awlsim-gui" /></a>

1. Finally type in the Raspberry Pi login password. The default password is `raspberry`<br />
   <a href="doc/pic/pilc/connection2.png"><img src="doc/pic/pilc/connection2.png" alt="awlsim-gui" /></a>


## Connection failure

If the connection fails with the following error message, it might be due to a failed SSH authentication:<br />
<a href="doc/pic/pilc/connection3.png"><img src="doc/pic/pilc/connection3.png" alt="awlsim-gui" /></a>

This will happen, if you re-install PiLC on the Raspberry Pi.<br />
Re-installing PiLC generates new SSH keys and therefore causes subsequent authentications to fail.

To fix this delete the SSH authentication (`known_hosts` entry) on the PC (*not* on the Raspberry Pi).
If you are using OpenSSH/Linux on the PC, enter the following command into a command prompt:

`ssh-keygen -R 192.168.0.10`

Replace `192.168.0.10` with the IP address of your Raspberry Pi.


## How do I get my PLC program onto PiLC?

Just connect to PiLC (see previous chapter) and click the `download` button in the Awlsim GUI. This will transfer the program over to the PiLC.<br />
<a href="doc/pic/pilc/download.png"><img src="doc/pic/pilc/download.png" alt="awlsim-gui" /></a>

If the PiLC is not in RUN state, click the RUN button to start the program.
bues.ch cgit interface