Tuesday, December 27, 2016

Upgrading the sensor pods: Boxing the boards.

Now that I've confirmed that the CAI board works, it's time to put it in a box. For this project, I used one of the boxes I'd originally purchased for the energy monitor project.



This was a wired alarm housing when purchased, although I discarded the alarm board after removing some of the more interesting parts, like nice screw-terminal connectors. (They have the same footprint as the ones I used on the purple alarm relay board.) I didn't need the built-in board, and most alarm manufacturers won't talk to you unless you have a license. Into the recycle bin it goes.

I've made some minor modification to the box, which includes drilling some new holes inside (the original push-lock standoffs were kept and re-used) and putting a meter on the front. Since this box will be talking to the leak detector box, I decided to add the meter to this one. As this will sit on the wall as you open the closet door, you can immediately see the meter without peering around the corner. It's currently displaying 13.5, which is being provided by a power supply.


Inside is still pretty sparse. I've placed the terminal strip for the incoming power, mounted the CAI board, and wired it and the meter in place and tied everything down. There will be another board under the terminal strip, probably a rectifier and supply board as I'd like to add a current monitor to the unit, but I'm not sure. Since I'm keeping the same form factor for everything, I went ahead and punched the pilots for possible mounts.

The CAI board is connected to the local network via a wireless adapter, aka a repurposed WRT54GL, that will probably follow it into the closet. Both units are perfectly happy running at 13.6V, so no other regulator is needed save the battery. (From what I can tell, the WRT54GL is good up to about 18V or so, and is probably good to around 10V on the other end. I have not verified this, so YMMV.)

Something I've read in a few places is these boards like to lock up after a few days when running with multiple DS1820s. I've placed a solderless breadboard in the bottom for now with 4 sensors on it to see what happens. So far, nothing other than good solid temps. As the CAI board is capable of reading I2C units, I also have a BMP280 pressure sensor mounted, although this isn't hooked up as of yet. That, and possibly an I2C RTC board are projects for another day.

Thursday, December 22, 2016

Thinking more about the energy monitor...

I had kind of given up on the energy monitor project for the simple reason that getting data into some useful form would be beyond what I have available to me at the moment.

However, opportunities present themselves in odd places. My employer needed something similar to monitor the lines of an air compressor to determine when the compressors are on or off. They didn't want to break the lines, so a non-invasive method of collecting data was needed.

Well, I had these clip-on current sensors from Seeed Studios left from my attempt, so I brought them in and measured the output to see if it would work. Yes, but the output of the clip is AC, and every device we have only measures a DC input.

Easy enough to solve, I pulled out an old design I had from the audio days, a precision full-wave rectifier circuit located on Page 234 of a book called "Encyclopedia of Electronic Circuits, Vol. 1" by Rudolf Graf. While some of the circuits in the book are less than useful due to age, incompleteness, or simply by being reference block diagrams instead of circuits, there are a few gems.

(This image is presented as a reference only.)

While I've made some changes to the circuit, using TL08x Op-Amps and germanium point contact diodes, output buffers and some minor output filtering, the circuit presented is doing the dirty work.

Since I have access to circuit board tools, I've decided to lay it out on a new board, give it it's own filtered power supplies, and add some easy-to-use connectors to it. What's amazing is how much bigger the diodes are as compared to almost everything else on the board, save the input connectors.

Then again, what's cooler than a 1N34A point-contact germanium diode in a glass case?


(image from https://www.banzaimusic.com/image.php?id=5047&type=D)

The board layout is the same form factor as my power supply and alarm monitor board, a size I've adopted for a lot of different things. Right now, I've completed the schematic (save the power converter, which I have not chosen yet) and am getting ready to see how well everything fits. Here's hoping I can get everything on this board!



Once it's all done, I'm going to work the design a little and begin the energy monitor project again.


Tuesday, December 20, 2016

Upgrading the sensor pods...

The power supply, leak detector, and alarm box has been working well for the past few months, but I'm kind of unhappy with the sensor arrays. While they work well enough, they consume a lot of space for the amount of inputs they have (two one-wire channels of one input each, plus single contact input.) As I needed three, they take up a good portion of the wall where they are mounted. Add that to the relatively weak output (1mW) in an area with a lot of metal and water, and you get Good, but not Great performance.

How to replace these? Well, there are several options. I considered a number of single-board computers, but settled on a device designed more for industrial environments as a PLC. The CAI WebControl unit offers a lot of functionality in a small package - 10baseT Ethernet, 8 channels of 1-wire input (DS1820-style,) 10V analog inputs, Digital I/O and I2C/SPI capability. It has a pretty wide range of input voltages, so it runs off my battery charger setup with no issues (at ~13.6VDC.)

It has a simple programming language that resembles assembly, so if you have any familiarity with ladder logic or any kind of logical programming language, it shouldn't be an issue. As an example, a program I wrote for testing, which sends an I/O summary every hour at 45 past:



START

WHATTIME:
     TSTEQ CM 45 RAM1
     BNZ RAM1 TELLME 
     GOTO WHATTIME 

END

TELLME:
     EMAIL EM1
     DELAY 120000
     GOTO WHATTIME 

In the program:

Test if CM (Minute) is equal to 45 and store in RAM1
If yes (branch if not zero) go to the email function sub
Loop it forever

Tellme subroutine:

Email using the parameters specified in EM1
Wait 120000 1/1000 of a seconds (2 minutes, so we don't loop back and send another email)
Return to the main program

Right now, I just have a single DS18B20 and an HIH4000-001 humidity sensor connected to the board, which is wirelessly connected to my network via a repurposed WRT54GL running DD-WRT and acting as a wireless bridge. Total current draw for the board at 13.6V is about 110mA, with the wireless bridge consuming another 220mA.

Something of note regarding this board: Older variants of the WebControl used a linear regulator, which got HOT quickly. This one has (what appears to be) a simple switcher, which doesn't get anywhere near as warm, and offers a wider input range. It's supposed to run at 5V, but the lowest I could get reliable operation is 6V.

I'm looking forward to replacing everything and adding yet more sensors to the system!


Wow that's a terrible picture!

Turning everything on - and there's no smoke!

Installation of my board was without issues (other than the filtering issue, which was corrected before installation.)

The box everything goes into is an Elk Products box with integrated battery charger originally designed for the alarm industry. It's basically a pass-through, and uses the battery as a cheap regulator. Nominal output voltage is 13.6-13.9, which is what the battery is floating at during charge, so everything in the box needs to handle this.

Starting at the top right, my board, the built-in battery charger, the battery, the power transformer (12.6VAC 2A), terminal strip and fuse, and the final component which is a commercially available water leak detector, "The WaterBug," available from Winland Electronics. The wireless sensors being powered are off to the right (out of frame.)

Everything powered up with no issues, and has been working reliably for the last few months.


The box was installed in the furnace closet, with the leak detector going down to the water heater directly underneath. (Lid removed during installation.) The only addition was to hang a temperature/humidity sensor in the box and connect it to one of the wireless sensor units.

(Apologies for the picture, it was taken in the dark with a potato!)

Board Built and (mostly) operational!

My boards came back from OSH Park with no issues, and they look good. Everything is gold-plated, and solderability is excellent. The only issue (not really an issue) were the tabs left over from where the boards were broken out of their larger panel. A quick hit with a file took care of that no problem.

The board consists of two power converters - one a DC-DC device that powers wireless sensor pods (on the left by the fuse.) The other is a simple three-terminal regulator that provides a somewhat dirty 5V to engage the alarm relay. There are two supplies, as the dirty supply needs to fail when the AC is removed. This causes the relay to fall, and a remote sensor (powered by the DC-DC converter and a battery) sends an alarm to a remote system. The DC-DC converter runs off the battery and powers sensors during an outage.

The three-term device doesn't get a heatsink, as there is only about 50mA of current draw. The DC-DC converter is rated for 500mA, and has a load of about 150mA.

The back of the board (which I didn't take a picture of for some reason) has the remaining components - a rectifier for the alarm side (as it runs directly from the input transformer) and some filter capacitors. I actually didn't put enough filtering on the board, so a radial capacitor was added. As I'm making a second run with a few more functions, the capacitor will be changed to surface mount and placed on the board.

In all, my first personal project PCB turned out pretty nice, and I've decided to add some extra stuff like a low battery monitor and cutoff circuit to the next rev.