DIGITAL electric METER monitor GOES OLD school
[Sal] sent us his digital electric meter monitor, which right away made us nostalgic for some of Forrest Mims’ books. Sal’s schematic and circuit description are similar to Forrest’s style, and we indicate that as a compliment. even in today’s world of CAD and EDS packages, sketching out a circuit by hand is often both much easier and faster. The schematic isn’t the only classic aspect of [Sal’s] design. He’s collecting data using a parallel port on an unused PC: in this case, a Toshiba Libretto running Windows 95. before low-cost flash-based microcontrollers and dev boards were available, the PC parallel port was the go-to hardware hacking interface for lots of of us. plenty of the software running those old hacks was written in basic, and [Sal’s] meter is no exception. His software runs on Microsoft QBasic, which shipped with Windows 95.
The circuit takes advantage of the digital meter’s output: a 10 ms pulse for every 1 Wh of energy used. An IR photo detector from RadioShack detects the meter pulses, which are amplified by an LM324 Op Amp. An NPN transistor then shifts the output to send it to two 74LS73 JK flip flops. The first flip flop uses a transistor to drive an LED for visual output. The second JK flip flop sends the data to the PC. The flip flop has the effect of dividing the number of meter pulses by two, creating a much longer toggled signal that a PC can better detect.
Although using an AVR or photo would consume less power, [Sal’s] setup has already a lot more than paid for its power usage. By monitoring and adapting his electrical usage, [Sal] is saving $20 a month on his electric bill. We’ve included [Sal’s] circuit diagram and source code after the break (apologies to our readers on RSS).
First [Sal’s] test program:
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
CLS
SCREEN 12
10 W = INP(&H379)
IF W <= 127 then GOTO 10 R! = TIMER 20 W = INP(&H379) IF W > 127 then GOTO 20
30 W = INP(&H379)
IF W <= 127 then GOTO 30
S! = TIMER
T! = S! – R!
IF T! = 0 then GOTO 10
KW = 7.2 / T!
PRINT KW;
ON KEY(1) GOSUB 40
KEY(1) ON
GOTO 10
40 END
Here is the main application:
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
CLS
REM C:\METER011.BAS
1 screen 12
LOCATE 1, 1: INPUT "INPUT ELECTRICAL METER KWH ", QQ
LOCATE 1, 1: FOR X = 1 TO 40: print " "; : URMĂTORUL
DD1$ = MID$(DATE$, 4, 2) ‘DAYS
TH1$ = LEFT$(TIME$, 2) ‘HOURS
TM1$ = MID$(TIME$, 4, 2) ‘MINUTES
TS1$ = RIGHT$(TIME$, 2) ‘SECONDS
4 A = 0: B = 0: C = 0: D = 0: F = 0: G = 0: K = 0: L = 0: M = 0: N = 0
O = 0: P = 0: Q = 0: R = 0: V = 32: LA = 0: MB = 0: NC = 0: OD = 0: NN = 0
DD = 1: U = 1
DIM A(120): dim B(120): dim C(25): dim D(32)
B = VAL(TM1$)
C = VAL(TH1$)
D = VAL(DD1$)
GOSUB 2010
GOSUB 500
8 Q! = TIMER
10 W = INP(&H379)
IF W <= 127 then GOTO 10 R! = TIMER 20 W = INP(&H379) IF W > 127 then GOTO 20
AA& = AA& + 1
BB& = BB& + 1
30 W = INP(&H379)
IF W <= 127 then GOTO 30
S! = TIMER
IF S! < Q! then S! = S! + 86400 T! = S! – R! IF T! >= 0 and T! <= .5 then GOTO 10 K = (7.2 / T!) locate 1, 5: print using "##.