Browse code

base release

Gandolf authored on 06/02/2021 02:54:40
Showing 5 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+<html>
2
+<body>
3
+<h4>NodePower - Monitor your Node's Power Consumption</h4>
4
+<p>
5
+NodePower enables you to view your node's power consumption for any time period stored in the database.  Nodepower uses a "round-robin" database to store up to years worth of data.  Once you install NodePower it begins keeping a database.  You can use the web browser to view charts of any time period after installing NodePower.
6
+</p>
7
+<p>
8
+Installing and using NodePower will give you an excellent introduction to Linux "devops".  You will learn about Linux server software systems and architecture, scripting for Internet applications, and displaying information in a web page.  Additionally you will learn about Raspberry Pies, GPIO, and I2C sensors.
9
+</p>
10
+<p>
11
+You can find all the required software available under open source, GNU license on this project site.  Please read the
12
+ <a href="docs/NodePower_Software_Installation_Guide.pdf">installation instructions</a> for details on how to install NodePower.
13
+Also in the docs folder you will find schematics, datasheets for the sensors, and hookup guides.
14
+</p> 
15
+</body>
16
+</html>
... ...
@@ -153,8 +153,8 @@ def getSensorData(dData):
153 153
         dData["current"] = pwr.getCurrent()
154 154
         dData["voltage"] = pwr.getVoltage()
155 155
         dData["power"] = pwr.getPower()
156
-        dData["battemp"] = btmp.getTempC()
157
-        dData["ambtemp"] = atmp.getTempC()
156
+        dData["battemp"] = btmp.getTempF()
157
+        dData["ambtemp"] = atmp.getTempF()
158 158
      
159 159
     except Exception, exError:
160 160
         print "%s sensor error: %s" % (getTimeStamp(), exError)
... ...
@@ -281,11 +281,11 @@ def createGraph(fileName, dataItem, gLabel, gTitle, gStart,
281 281
     if addTrend == 0:
282 282
         strCmd += "LINE1:dSeries#0400ff "
283 283
     elif addTrend == 1:
284
-        strCmd += "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 " \
284
+        strCmd += "CDEF:smoothed=dSeries,%s,TREND LINE2:smoothed#000000 " \
285 285
                   % trendWindow[gStart]
286 286
     elif addTrend == 2:
287 287
         strCmd += "LINE1:dSeries#0400ff "
288
-        strCmd += "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 " \
288
+        strCmd += "CDEF:smoothed=dSeries,%s,TREND LINE2:smoothed#000000 " \
289 289
                   % trendWindow[gStart]
290 290
      
291 291
     if verboseDebug:
... ...
@@ -316,47 +316,47 @@ def generateGraphs():
316 316
     # 24 hour stock charts
317 317
 
318 318
     createGraph('24hr_current', 'CUR', 'mA', 
319
-                'Current\ -\ Last\ 24\ Hours', 'end-1day', 0, 0, 2, autoScale)
319
+                'Current\ -\ Last\ 24\ Hours', 'end-1day', 0, 0, 0, autoScale)
320 320
     createGraph('24hr_voltage', 'VOLT', 'V', 
321
-                'Voltage\ -\ Last\ 24\ Hours', 'end-1day', 0, 0, 2, autoScale)
321
+                'Voltage\ -\ Last\ 24\ Hours', 'end-1day', 0, 0, 0, autoScale)
322 322
     createGraph('24hr_power', 'PWR', 'mW', 
323
-                'Power\ -\ Last\ 24\ Hours', 'end-1day', 0, 0, 2, autoScale)
324
-    createGraph('24hr_battemp', 'BTMP', 'deg\ C', 
323
+                'Power\ -\ Last\ 24\ Hours', 'end-1day', 0, 0, 0, autoScale)
324
+    createGraph('24hr_battemp', 'BTMP', 'deg\ F', 
325 325
                 'Battery\ Temperature\ -\ Last\ 24\ Hours', 'end-1day', \
326
-                 0, 0, 2, autoScale)
327
-    createGraph('24hr_ambtemp', 'ATMP', 'deg\ C', 
326
+                 0, 0, 0, autoScale)
327
+    createGraph('24hr_ambtemp', 'ATMP', 'deg\ F', 
328 328
                 'Ambient\ Temperature\ -\ Last\ 24\ Hours', 'end-1day', \
329
-                 0, 0, 2, autoScale)
329
+                 0, 0, 0, autoScale)
330 330
 
331 331
     # 4 week stock charts
332 332
 
333 333
     createGraph('4wk_current', 'CUR', 'mA', 
334
-                'Current\ -\ Last\ 4\ Weeks', 'end-4weeks', 0, 0, 2, autoScale)
334
+                'Current\ -\ Last\ 4\ Weeks', 'end-4weeks', 0, 0, 0, autoScale)
335 335
     createGraph('4wk_voltage', 'VOLT', 'V', 
336
-                'Voltage\ -\ Last\ 4\ Weeks', 'end-4weeks', 0, 0, 2, autoScale)
336
+                'Voltage\ -\ Last\ 4\ Weeks', 'end-4weeks', 0, 0, 0, autoScale)
337 337
     createGraph('4wk_power', 'PWR', 'mW', 
338
-                'Power\ -\ Last\ 4\ Weeks', 'end-4weeks', 0, 0, 2, autoScale)
339
-    createGraph('4wk_battemp', 'BTMP', 'deg\ C', 
338
+                'Power\ -\ Last\ 4\ Weeks', 'end-4weeks', 0, 0, 0, autoScale)
339
+    createGraph('4wk_battemp', 'BTMP', 'deg\ F', 
340 340
                 'Battery\ Temperature\ -\ Last\ 4\ Weeks', 'end-4weeks', \
341 341
                  0, 0, 2, autoScale)
342
-    createGraph('4wk_ambtemp', 'ATMP', 'deg\ C', 
342
+    createGraph('4wk_ambtemp', 'ATMP', 'deg\ F', 
343 343
                 'Ambient\ Temperature\ -\ Last\ 4\ Weeks', 'end-4weeks', \
344
-                 0, 0, 2, autoScale)
344
+                 0, 0, 0, autoScale)
345 345
 
346 346
     # 12 month stock charts
347 347
 
348 348
     createGraph('12m_current', 'CUR', 'mA', 
349
-                'Current\ -\ Past\ Year', 'end-12months', 0, 0, 2, autoScale)
349
+                'Current\ -\ Past\ Year', 'end-12months', 0, 0, 0, autoScale)
350 350
     createGraph('12m_voltage', 'VOLT', 'V', 
351
-                'Voltage\ -\ Past\ Year', 'end-12months', 0, 0, 2, autoScale)
351
+                'Voltage\ -\ Past\ Year', 'end-12months', 0, 0, 0, autoScale)
352 352
     createGraph('12m_power', 'PWR', 'mW', 
353
-                'Power\ -\ Past\ Year', 'end-12months', 0, 0, 2, autoScale)
354
-    createGraph('12m_battemp', 'BTMP', 'deg\ C', 
353
+                'Power\ -\ Past\ Year', 'end-12months', 0, 0, 0, autoScale)
354
+    createGraph('12m_battemp', 'BTMP', 'deg\ F', 
355 355
                 'Battery\ Temperature\ -\ Past\ Year', 'end-12months', \
356
-                 0, 0, 2, autoScale)
357
-    createGraph('12m_ambtemp', 'ATMP', 'deg\ C', 
356
+                 0, 0, 0, autoScale)
357
+    createGraph('12m_ambtemp', 'ATMP', 'deg\ F', 
358 358
                 'Ambient\ Temperature\ -\ Past\ Year', 'end-12months', \
359
-                 0, 0, 2, autoScale)
359
+                 0, 0, 0, autoScale)
360 360
 ##end def
361 361
 
362 362
 def getCLarguments():
363 363
new file mode 100644
364 364
Binary files /dev/null and b/nodepower/docs/NodePower_Software_Installation_Guide.pdf differ
365 365
deleted file mode 100644
... ...
@@ -1,180 +0,0 @@
1
-Raspbian 'stretch' - system build notes
2
-
3
-1. Copy os disk image to SD card.
4
-
5
-2. Mount the SD card to the host computer and navigate
6
-   to the boot volume of the SD card.
7
-
8
-3. If using wired Ethernet, skip to step 6.
9
-
10
-4. Edit the wpa_supplicant.conf file with your wifi ssid and
11
-   wifi password.
12
-
13
-5. Copy the wpa_supplicant.conf file to the root of the boot
14
-   volume.
15
-
16
-6. Create an empty file named "ssh" in the root of the boot
17
-   volume.
18
-
19
-7. Unmount the SD card and install in the Pi Zero.  Apply
20
-   power and boot up the Pi Zero.
21
-
22
-8. Secure shell into the Pi Zero by running
23
-       ssh pi@raspberrypi.local
24
-   The password is 'raspberry'
25
-
26
-9. Configure the following by running
27
-       sudo raspi-config
28
-   In System Options modify the following
29
-     hostname: nodepower
30
-     password: YOUR_PASSWORD
31
-   In Interface Options modify the following
32
-     I2C: ON
33
-   In Localisation Options modify the following     
34
-     Locale: en_US.UTF-8 UTF-8
35
-     Timezone: PACIFIC
36
-     Keyboard: US
37
-     WLAN: US
38
-
39
-10. If using wired Ethernet, disable wifi by adding the following
40
-    line to the end of the /boot/config.txt file
41
-      dtoverlay=disable-wifi
42
-    This helps to conserve power.
43
-
44
-11. Disable Bluetooth by adding the following line to the end of
45
-    the '/boot/config.txt' file:
46
-      dtoverlay=disable-bt
47
-    This helps to conserve power.
48
-    [Optional] Run the once off command:
49
-        sudo systemctl disable hciuart
50
-
51
-12. Set up ssh keys on client and import the public key
52
-   to the Pi Zero .ssh directory.  Create .ssh directory
53
-   on the Pi Zero.  In .ssh create a file authorized_keys
54
-   and copy the public key to it.
55
-
56
-13. Backup and then modify /etc/ssh/sshd_config as follows
57
-
58
-       #PermitRootLogin prohibit-password
59
-       PermitRootLogin no
60
-
61
-       #X11Forwarding yes
62
-       X11Forwarding no
63
-
64
-   Optionally turn off password authentication
65
-
66
-       #PasswordAuthentication yes
67
-       PasswordAuthentication no
68
-
69
-14. Setup tmpfs by backup and then modifying /etc/fstab.  Add
70
-   the following lines to the bottom of the file.
71
-
72
-       # uncomment if needed for web apps
73
-       # These changes store all non-essential logs in ram to reduce
74
-       # stress on the SD card due to frequent writes.
75
-       tmpfs /tmp tmpfs nodev,nosuid,size=20M 0 0
76
-       tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=20m 0 0
77
-       tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=20m 0 0
78
-       tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0700,gid=12,size=20m 0 0
79
-
80
-15. Reboot the Pi Zero by running
81
-        sudo reboot
82
-
83
-16. Run updates by running the commands
84
-        sudo apt-get update
85
-   
86
-    Optionally run all software updates
87
-        sudo apt-get upgrade
88
-        sudo reboot
89
-
90
-17. Install vim
91
-      apt-get install vim
92
-
93
-18. Optionally copy pi backup archive from the ssh client to
94
-    the /home/pi folder
95
-        scp pi.zip pi@nodepower.local:~
96
-
97
-19. Restore files and directories from backup archive by running
98
-      unzip pi.zip
99
-    Use 'mv' to move folders and files to their appropriate locations.
100
-
101
-20. Make backups of /etc/rc.local, /etc/motd. Then, acting as superuser
102
-    copy to /etc from the unzipped directory the files rc.local and motd.
103
-
104
-21. Install rrdtool
105
-       sudo apt-get install rrdtool
106
-
107
-22. Install web server
108
-
109
-    Apache2 
110
-    ======
111
-    sudo apt-get install apache2 -y
112
-    sudo a2enmod rewrite
113
-    sudo service apache2 restart
114
-
115
-    PHP
116
-    ===
117
-    sudo apt-get install php libapache2-mod-php -y
118
-    sudo service apache2 restart
119
-
120
-23. Acting as superuser, backup and then modify
121
-    /etc/apache2/mods-available/userdir.conf
122
-
123
-       # changed {date} by {name} to allow user .htacess file
124
-       #AllowOverride FileInfo AuthConfig Limit Indexes
125
-       AllowOverride All
126
-
127
-24. Enable user directories in apache2
128
-       sudo a2enmod userdir
129
-
130
-25. Acting as superuser, backup and then modify
131
-    /etc/apache2/sites-available/000-default.conf
132
-
133
-       # changed 12-06-2019 by JLO to make user pi the html document root
134
-       #DocumentRoot /var/www/html
135
-       DocumentRoot /home/pi/public_html
136
-
137
-26. Acting as superuser, backup and then modify
138
-    /etc/apache2/mods-available/php7.3.conf to allow user directories
139
-    by commenting the lines at bottom of file.  E.g.,
140
-
141
-       #<IfModule mod_userdir.c>
142
-       #    <Directory /home/*/public_html>
143
-       #        php_admin_flag engine Off
144
-       #    </Directory>
145
-       #</IfModule>
146
-
147
-27. Enable php in apache2
148
-       sudo a2enmod php7.3
149
-
150
-28. Acting as superuser, backup and then modify /etc/apache2/envvars
151
-    to create apache2 logs in tmpfs.  Add the following lines at the top
152
-    of the file
153
-
154
-       if [ ! -d /var/log/apache2 ]; then
155
-         mkdir /var/log/apache2
156
-       fi
157
-
158
-29. Acting as superuser, enable apache2 to access files the tmpfs /tmp
159
-    directory by backing up and then modifying
160
-    /lib/systemd/system/apache2.service
161
-
162
-       # changed {date} by {name} to allow apache to follow symlinks
163
-       # to the /tmp folder in tmpfs
164
-       #PrivateTmp=true
165
-       PrivateTmp=false
166
-
167
-30. Reload system deamons
168
-       sudo systemctl daemon-reload
169
-
170
-31. Restart apache2 service
171
-       sudo systemctl restart apache2
172
-
173
-32. Install i2c smbus python library by running
174
-       sudo apt-get install python-smbus
175
-
176
-33. Reboot the Pi Zero by running 'sudo reboot'.
177
-
178
-34. Test all above modifications.
179
-
180
-
... ...
@@ -100,10 +100,10 @@ text.chartNav {
100 100
 <h2><a href="https://github.com/fractalxaos/ham/tree/master/nodepower" 
101 101
 style="text-decoration:none" target="_new">
102 102
 Node Power</a></h2>
103
-<h4>YOUR NODE DESCRIPTION AND CALL SIGN</h4>
103
+<h4>WA7ABU Victor Point AREDN Mesh Installation</h4>
104 104
 
105 105
 <div style="width:60%; text-align:left; font:14px arial, sans-serif;">
106
-This web page shows the power consumption of the above node.  Charts below
106
+This web page shows the power consumption of above node(s).  Charts below
107 107
 provide a historical glimpse of node power consumption, battery and ambient
108 108
 temperatures.
109 109
 </div>
... ...
@@ -135,8 +135,8 @@ Battery Temperature:<br>
135 135
 Ambient Temperature:
136 136
 </div>
137 137
 <div class="dataItems"  style="width: 30%;">
138
-<text id="battemp"></text> &#8451;<br>
139
-<text id="ambtemp"></text> &#8451;<br>
138
+<text id="battemp"></text> &#8457;<br>
139
+<text id="ambtemp"></text> &#8457;<br>
140 140
 </div>
141 141
 </div>
142 142
 </div>