-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.txt
190 lines (123 loc) · 5.12 KB
/
install.txt
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/////////////////////////
// Config raspberry pi //
/////////////////////////
//download Raspbian “wheezy” from http://www.raspberrypi.org/downloads
use Raspi-Config to
- expand_rootfs -> expand root partition
- change_pass -> change password for "pi" user
- change_timezone
- configure_keyboards
- boot-behaviour -> don't start desktop on boot
//use a keyboard and monitor on your raspberry or connect from your PC with a SSH Client (http://www.putty.org/)
//you should change the default password of the pi user
$passwd
//you can also add a new user and enable this user with sudo privileges
$sudo adduser username
$sudo nano /etc/group
//Install apache, git and screen (http://raspi.tv/2012/using-screen-with-raspberry-pi-to-avoid-leaving-ssh-sessions-open)
$sudo apt-get update
$sudo apt-get install apache2
$sudo apt-get install git
$sudo apt-get install screen (screen bash ; ctrl a,d - run app in additional terminal)
//Configure serial Interface ; disable console
$sudo nano /boot/cmdline.txt
// change : dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
// to dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
$sudo nano /etc/inittab
// comment out the last line: T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
////////////////////////////////
// Install EnergyCam on Meter //
////////////////////////////////
A description on how to install the EnergyCam on a Meter by using the button menu can be found
in EnergyCam_Manual.pdf available on the ftp-server of FAST Forward.
//////////////////////////////////////////
// connect EnergyCam to the Raspberry Pi//
/////////////////////////////////////////
//the 4 wire cable of the EnergyCam can be connected to the Raspberry Pi expansion port
// EnergyCam - Raspberry Pi
// 3V3 (red) - 3V3 (Pin 1)
// GND (black) - GND (Pin 6)
// RxD (green) - TxD (Pin 8)
// TxD (yellow) - RxD (Pin 10)
//the expansion port is mapped as /dev/ttyAMA0 ; you have to use the commandline option -c AMA
$ ./ecpi -c AMA
//you can also connect the EnergyCam with a USB Communication Box from FAST
//the USB port is mapped as /dev/ttyUSB0
$ ./ecpi -c USB -p 0
///////////////////////////
// compile and run ecpi //
///////////////////////////
//get ecpi source
$mkdir projects
$cd projects
$git clone https://github.com/ffcrg/ecpi.git
$cd ecpi
//copy websource to var/www
$chmod u+x cpwww.sh
$./cpwww.sh
//run make file
$cd linux/bin
$make
//serial connection
//the ecpi Source uses the configuration 115200 Baud, Even Parity, 1 StopBit
//if your EnergyCam is configured different, you have to adjust the source code
//energycampi.h #define MODBUSBAUDRATE 115200
//energycammodbus.c *ctx = (modbus_t* )modbus_new_rtu(comDeviceName, Baud, 'E', 8, 1);
/////////////////////////////////////////////////////////////////////
// run App as root ; App writes per default a csv file to /var/www //
////////////////////////////////////////////////////////////////////
$screen bash
$sudo ./ecpi
Press <Ctrl a> <d> brings you back to the terminal.
//you can view the created csv File
sudo nano /var/www/ecpi/data/ecpi.csv
//reconnect to ecpi
$screen -r
//close ssh session ; ecpi continues to run
$exit
//open website from your PC
//type the IP Address of your raspberry into the address bar of the browser
//////////////////////////
// commandline options //
//////////////////////////
$./ecpi -c USB -p 0 -s 1 -l VZ -i
-c USB : use USB connection
-p 0 : Portnumber 0 -> /dev/ttyUSB0
-s 1 : MODBUSSlaveAdress 1
-l VZ : log to (VZ)Volkszähler, (XML) XMLFile, (CSV) CSV File
-o 1 : (1) -> single run, (loop) -> continuous run\n\n");
-i : show detailed infos
$./ecpi -c AMA -p 0 -s 1 -o 1
-c AMA : use Expansionport
-p 0 : Portnumber 0 -> /dev/ttyAMA0
-s 1 : MODBUSSlaveAdress 1
-o 1 : single run
-i : show detailed infos
single run -> The app writes the actual meter reading to the console.
////////////////////////////////
// -l VZ : log to Volkszähler //
////////////////////////////////
// to install volkszähler
//see http://wiki.volkszaehler.org/software/middleware/installation
////////////////////////////
// connect to volkszähler //
////////////////////////////
//see: http://wiki.volkszaehler.org/software/clients/vzclient
//Install vzclient
$wget https://raw.github.com/volkszaehler/volkszaehler.org/master/misc/tools/vzclient
$sudo cp vzclient /usr/local/bin/vzclient
$sudo chmod 555 /usr/local/bin/vzclient
$chmod u+x ecpi/linux/bin/add2zv.sh
//config /etc/vzclient.conf ; you have to enter the IP adress of your volkszähler PC
$sudo nano /etc/vzclient.conf
[default]
url:http://192.168.0.110/middleware.php
//create new channel in the UI
- Add Channel
Typ: Stromzaehler
Auflösung: 1000
Preis: 0.00028
- press info button in the UI
copy UUID-String
enter UUID-String into ecpi/linux/bin/add2zv.sh
vzclient -u <UUID> add data value=$1