Wednesday, December 29, 2021

Do-It-Yourself Elemental Analysis

 For some time now I've been working on a system that can produce an analysis of elements that are present in an unknown sample (within limits, explained later).  It's based on a lot of excellent work by an Italian group called Theremino.  They use a combination of parts that can be acquired on ebay, such as a type of x-ray detector called a scintillator, a photomultiplier tube, high voltage power supply, some pulse-shaping circuitry and a computer's audio board (one that can digitize audio).

The basic idea is to use a variation on fluorescence, where some materials will emit visible light when illuminated by ultraviolet light.  The exact term is XRF, for X-Ray Fluorescence.  For ultraviolet illumination, only a few materials will emit light:  and they, as far as I am aware, are compounds, doped or otherwise.  The emission wavelengths are more dependent on the dopant than the compound.  While this might sound OK, the dopants typically are exotic elements like Yttrium, Eutropium, Erbium and the like -- not of much interest if you want to know if your jewelry really is gold or silver.

On the other hand, x-ray illumination can excite fluorescence of all elements except hydrogen and helium.  The key is that the emitted light is characteristic of the element, not a dopant.  So if we had a way to (1) illuminate a sample with x-rays and (2) determine the wavelength of light emitted by the sample's fluorescence, we can determine the elements present and get an approximate idea of their concentration. 

The first problem to solve is a hobbyist-available X-Ray source.  The Theremino group uses radioactive capsules from ionization-type smoke detectors.  They have a small amount of Americium-241 in them, representing about 1 micro-curie of radioactive decay (about 37000 decays per second).  Along with the desired alpha particles used by the smoke detector circuitry, the capsule emits gamma rays with an energy of about 60,000 electron-volts, 60 Kev (visible light is in the 2-4 electron-volt range).  Before anyone freaks out, the gamma ray flux is quite low, and, since smoke detectors typically are installed on the ceiling, a long way away from people.  This reduces the radiation dose even more.  So in normal use they are safe.  The Theremino application uses several of these to produce a higher count rate for better analysis results.  I don't think the total x-ray flux is much of an issue, but, even so, my system uses lead shielding to completely remove any misgivings on my part.

The other issue with regard to the Americium241 (Am241) is the 60Kev photon.  It can only excite fluorescence in elements if their characteristic fluorescence is at a lower wavelength.  That makes sense, right?  The emitted light's energy per photon CANNOT exceed the incident photons that are stimulating the fluorescence.  Otherwise you have a variation on the perpetual-motion machine, where the energy-out exceeds the energy-in.  So Am241 can't excite the primary fluorescence line for any element past Tungsten, whose k-alpha line is about 58Kev.  Elements with higher atomic numbers won't get "tickled" enough to emit X-rays.  It gets a bit more complicated because inner-shell electrons can get involved and emit much lower energy x-rays, but their energies are much more difficult to detect, out of the range of commonly-available x-ray detectors.

So.  We have a fairly readily-available x-ray source to cause elements up to Tungsten to fluoresce.  Now, how do we tell them apart?  The key is a particular type of radiation detector called a proportional detector.  For each incoming x-ray photon its output is proportional to the photon energy, which is directly related to its wavelength.  Planck's constant at work.  Look it up!  Anyway, there are a few hobbyist-available proportional detectors.  The first is a scintillator.  It's a special crystal that outputs a burst of light whose intensity is proportional to the x-ray photon that generated it.  The crystal typically is optically coupled to a high-speed detector called a photomultiplier tube that can turn the burst of light into an electrical signal, along with a substantial gain (that's the 'multiplier' part of the name).  The photomultiplier tube (PMT) output also is proportional to the light input, so the pulse height coming out of the PMT is proportional to the x-ray photon that created it.  Each element has a characteristic x-ray fluorescence wavelength, so by sorting the pulse height into bins, where each bin represents a small range of pulse heights, we obtain a spectrum that is a fingerprint of the elements present in the sample.

This sounds pretty good, except for a few things I haven't mentioned yet.  The first is that the PMT requires a fairly high voltage to operate, about 800-200 volts.  It doesn't require much current, but that's still a challenge.  The voltage determines the gain of the PMT, so it also is necessary to regulate that voltage, while avoiding instability (oscillations) and noise.  Photomultipliers also are sensitive to magnetic fields so they need to be magnetically shielded, using mu-metal surrounds.  They are very light-sensitive so they also need to be completely shielded from visible light (and if exposed to light when their supply voltage is still on, they can be destroyed!).  Finally, the best scintillator crystals are hygroscopic -- they absorb moisture -- so ones you find on ebay may be seriously degraded.

PMT's can be found on Ebay for not a lot of money, but then you need to add in the power supply and scintillator.

An in-between solution is to use a silicon photomultiplier, also called an SiPM.  It is a type of avalanche photodetector and is more robust compared to a PMT, plus it usually only needs 20-50V to operate.  It still requires a scintillator crystal with all the attendant issues related to the types that offer the best energy resolution (i.e., very hygroscopic).

Finally, there are PIN (P-type/Intrinsic/N-type) diode detectors.  The name is related to their structure, with the important part being the relatively wide lightly doped Intrinsic region that can capture lots of x-rays.  This type of diode can be all over the map, depending on the range of elements you want to analyze, plus the sensitivity of the system.  The most sensitive detectors have an energy range that covers Boron, with a primary x-ray wavelength of 185 electron-volts on up to lead and beyond, in the 10,000 electron-volt range.  These are operated in a liquid nitrogen dewar at 77 degrees Kelvin, operate at hundreds of volts, and would destroy themselves if for some reason they rose to room temperature.  These systems are very expensive and very unforgiving if you screw up.

However, if we're willing to give up something on the lighter-atomic-weight range, we can get by with something that runs at room temperature.  Silicon PIN diodes specially designed as x-ray detectors can be had for something in the $100 range, and, in some cases, for a bit less if already in a consumer application:  PocketGeiger.  In the latter case, the device is not meant for XRF -- it's a simple geiger counter, not sensitive to the incoming x-ray photon energy.  But it appears to be possible to tap into an internal signal line that MAY permit some form of elemental analysis.  I'm hopeful about this and will report results as I get them.  I have already found that the boost switching regulator, used to generate the ~26V bias voltage needed to operate the PIN diode, is a significant noise source and needs to be replaced by an external bias voltage source.  I didn't find an easy way to eliminate the noise and keep the on-board switching regulator.  Moving it off-board might work, but for now I'm using an old linear bench supply to provide the detector's bias voltage and it is working OK.

Tuesday, September 7, 2021

DIY A/C, some measurements

Optimizing any complex system requires good metrology -- making measurements to evaluate how things are working.  A model is a good start:  but without real data you don't know if your model is accurate or not.  So I have been working on that.  Significant measures of performance for input and output air would be the air temperature (of course), and the relative humidity of the air.  To that end, I bought two SHT40 temperature/humidity sensor boards from Adafruit so I can measure ambient conditions and air coming out of the evaporative cooler.  I'd like to include measurements of the water temperature in the recirculated-water loop portion of the evap cooler but the humidity sensor is directly exposed to the environment so that's not a good idea.  As a workaround, I used a cheap thermocouple temperature measurement unit purchased from Harbor Freight.

One suspicion I had was that the air flow through the evaporative cooler is too high, so the relatively-warm air entering the evaporation pad doesn't spend enough time to aborb as much water as it could -- therefore reducing the exit air's temperature drop.  The temperature delta depends on the temperature of the entrance air, so it's necessary to measure the temperature and RH of the entrance air -- as the day goes on, the ambient temperature and RH changes so my setup's operating condition changes along with that.

Anyway, here are a couple of photos showing my current setup and one measurement of the recirculated water temperature:


The firs photo shows my Adafruit Feather NRF69 RF transceiver board with two sensors -- one in the fan's exit air stream and the other is there to measure ambient conditions.  It's powered using a LiPo battery.  This particular board only has one native I2C port so (because the sensor chip's I2C address is fixed) I had to implement a second I2C port using the old-fashioned bit-bang approach.  That took a week or so to get working OK.

The second photo shows the temperature of the water being recirculated through the evaporative cooler.  At the time the photo was taken, the ambient temperature was about 87F so I was getting about a 16 degree temperature drop.  71F isn't too bad for house air, depending on what the interior RH is, so that's sort of encouraging.  But I'd expect the water temperature to increase if it's used (via a water-air heat exchanger) to actually cool the house.  The one saving grace here is that water's specific heat is MUCH higher than air, so a little water should be able to cool a lot of air.  But that part of the system isn't built yet so I can't report any measurements.  Metrology.

I also added a PWM motor speed controller to adjust the fan's speed (and hence the volume of air flowing through the evaporator).  As I suspected, running the fan at 100% of its maximum speed was not optimal with regard to delivering the lowest exit air temperature and highest RH.  Setting the speed at about half its maximum seemed to deliver the best performance for lowest exit air temperature.

However.....I'm not really interested in the lowest-possible exit AIR temperature.  My plan is to circulate the evaporatively-cooled water through a heat exchanger that is in the house, so it is desirable to optimize the system so the water temperature is as low as possible.  In this regard, I observed two things.  First, the temperature of the water that is recirculated through the evaporative cooler doesn't have a strong dependency on the fan speed.  That's a good thing to know.  But the second observation is that the water temperature seems to have some variation that can't be totally explained by the ambient air temperature and its RH.  I suspect it is due to solar heat input, so further experiments (using insulation and light shading measures) are needed.  This summer's temperature extremes probably are at an end -- today's high was only in the high 80's -- so more progress may not happen until next summer.

One main result is that our region's relatively high humidity substantially reduces the effectiveness of an evaporative cooler when it uses un-processed ambient air.  By "un-processed", I mean air that has not been dehumidified before being fed into the evaporation unit.

The Tech Ingredients youtube channel has demonstrated two different approaches to evaporative cooling.  Their first system used liquid desiccant to dry air before it entered an evaporative cooler.  On first examination this would seem to a viable approach for more-humid environments:  but they also have to use an ambient-air "swamp cooler" to cool the liquid desiccant after it's been regenerated.

Their second approach uses liquid desiccant to directly cool room air (and remove humidity), but depends on an ambient-air swamp cooler to get the liquid desiccant cold enough to cool the house air.  I think the second approach is less useful (in a broad sense), since evaporative coolers in regions with higher humidity won't be able to deliver liquid desiccant that's much below ambient.  However, reducing the humidity in a house, independently of the temperature, will make the house feel cooler (because of the evaporatively-cooled inhabitants).

A swamp cooler that uses pre-dried air can output coolant water that is below the ambient dew point, which will remove moisture -- thus improving living conditions in two ways.  In addition, such a system can be used in a "bootstrap" mode*, using the coolant water to also chill the liquid desiccant before it drys the evap-cooler's entrance air.  This IS an additional heat load so pre-cooling the liquid desiccant, using an approach similar to Tech Ingredient's second LD cooling scheme, would be desirable.  For these reasons, I believe a hybrid scheme using parts of their first and second systems would be more useful for most who are interested in a DIY approach.  It utilizes the cooled exit air, which otherwise is unused.

*I call this a "bootstrap" mode because at first the effectiveness of the liquid desiccant (LD) will be relatively poor because it's not cool enough to pull a lot of moisture out of the air.  But as the system starts to work, the temperature of the coolant water should drop and thus help the LD dry the entrance air more -- thus further improving the performance of evaporative-cooling step, dropping the temperature of the coolant water.  And so on. 

A hybrid scheme probably won't deliver dry, cool air the instant it's turned on.  It might actually take a day or more to really get up to speed, depending on the amount of water being recirculated through the chiller and the house's heat load.  Then there's the question of how to deal with night-time conditions, where temperatures can drop to a reasonable level but the ambient relative humidity still is uncomfortably high.  For that, it might be necessary to add some auxiliary heat (rather than solar) to regenerate the LD.  But now I'm getting 'way ahead of myself -- currently being far from any kind of real, practical home-brew A/C system.  

Metrology.

Friday, August 13, 2021

DIY A/C More Observations

Today I took more measurements after my cooling tower had stabilized.  The ambient conditions were 33.4C ( 94.6F) and 41.4% RH.  My psyrometric chart indicates the wet bulb temperature should be 22.8C (73F).  Measurement of the exit air showed it was 30.35C (86F), substantially higher than the wet bulb temperature.  The temperature of the (recirculated) water was about 74.5F so it IS close to the wet bulb temperature.

The reason the exit air is much warmer than wet bulb may be due to excessively high air flow through the evaporation pad; or perhaps the air never is going to get all that close to wet bulb.  After all, the wet bulb measurement doesn't measure the temperature of the air after evaporation, it basically measures the residual water surrounding the thermometer bulb.  Videos done by Desertsun02 suggest that the exit air temperature should be much lower, but his setup isn't exactly like mine.

I'd like to get the temperature of the exit air lower, because I can use it (via a second heat exchanger) to cool the return water from the interior heat exchanger.  That would increase the system efficiency, perhaps by a significant amount.  To work on this, I bought a couple of PWM motor speed controllers to experiment with air flows through the evaporation tower and inside heat exchanger.

I did try throttling down the water pump to see how that would affect the system, but reducing the flow rate by about 50% didn't have a noticeable impact on the measurements.

Examination of my psyrometric chart did suggest a way to improve the system performance by a small amount.  Although it sounds counterintuitive, if the air entering the cooling tower is pre-cooled by passing it through a heat exchanger, the wet bulb temperature of the cooler-but-more-humid air is lower.  To check this out, you need to look at what happens when the air is cooled by a heat exchanger.  It doesn't pick up any more moisture so the "humidity ratio", which is the ratio of dissolved water vs air masses, remains constant.  So the heat exchanger just moves the air straight to the left (i.e., it just moves along a constant humidity ratio line).  Then you look at what the resultant wet bulb temperature would be.  Here's an example.  Looking at the ambient conditions I get a humidity ratio of 14.  Cooling the air down to 25C before it enters the tower should produce a wet bulb temperature of 21.5C, which is about 1C lower.  Not a huge improvement, so I don't think it's worth the added cost and complexity.  It's more worthwhile to get the exit air temperature closer to wet bulb so I can reduce the heat load on the recirculated-water loop.  This will ONLY work if the exit air temperature is lower than the return water from the interior heat exchanger....which, in turn, can't be any higher than the ambient temperature in the house.  Clearly, we want to cool the house down so ideally there will be a substantial change in coolant temperature from inlet to outlet.

I have to say that my measurements don't look all that promising for cooling our house with this setup.  There is a final way to (potentially) greatly improve the performance of an evaporative cooler, but it comes with quite an increased bit of complexity.  It would reduce the humidity of the air going into the cooling tower using something called "liquid desiccant", which will improve operation of the system in regions where the relative humidity is  moderately high to high (and our region seems to fall into that category) .  The liquid desiccant absorbs moisture but must be regenerated on a continuous basis in order to keep working.  This requires some sort of heat source and another "tower" to help extract the absorbed water from the desiccant.  Sounds complicated?  Yes, but fortunately it appears that it can be done using a fairly low-tech approach.  I will leave it there for now.

Thursday, August 12, 2021

DIY A/C, A Brief Follow-up

 I went back through my spreadsheet and found a couple of errors in the math, in both the evaporated-water and fan CFM calculations.  After correcting them, both numbers are pretty close, within .07%.  That's scary-close.  I would have been pleased to have them within 5%.  If nothing else, I would have expected the (cheap) fan I bought not to really deliver 1700CFM.

The corrections also showed that the amount of heat power being transferred is amazingly high, but water does require a lot of energy to change it from its liquid to gas phase.   The fact that a lot of heat energy is being moved around suggests that my indirect-cooled A/C setup has a chance of really working, but we shall see.

Wednesday, August 11, 2021

Homebrew A/C testing

 I have moved on to making some measurements on my first version of a DIY A/C system.  My main interest at this point is to get a rough indicator of how much heat energy the unit is capable of absorbing.  I currently don't have two temperature sensors to measure the air's temperature drop (nor do I have an anemometer to measure the air flow through the fan), so I tried doing it by measuring the amount of water consumed by the cooling tower.

Heat energy can be derived from water consumption using the fact that it takes 4184  2,451, 824 joules to convert 1 gram of water to vapor (at the same temperature).  To get the volume change of water, I measured the dimensions of my water reservoir so I can calculate the volume as a function of height change of water.  The test setup looks like this:


The metal ruler that's at an angle is used to measure the change in water level (in the photo, it's about parallel to the house's shadow line).  It's at about a 50 degree angle, which helps to improve the effective resolution of the measurement.  To convert the distance on the ruler to actual height change, I multiply the measurement (in decimal numbers, not fractions) by sin(50), about .776.  If I laid the ruler along the long axis of my reservoir I could get even better resolution, with a multiplier of .545.  Multiplying the volume change (in mililiters) by 4184 results in the number of joules absorbed by that amount of evaporated water.  Dividing that by the elapsed time gives me the watts of heat energy involved

So far I have two data points, starting earlier in the day when the ambient temperature was relatively low (76F) and the relative humidity was relatively high (61%).  In about 34 minutes the system moved approximately 2.2 megaJoules (!), which works out to an average heat power close to 1KW.  A second measurement taken 2 hours 10 minutes later showed an average heat power around 1.9KW.  Since the second number was calculated for the start of the experiment, as the outside air warmed up the effective power went a bit higher than 1.9KW (2.15KW, to be precise).

At the same time, the fan and pump consumed about 90 watts, so it can be seen that the system is capable of absorbing at least 10 times the amount of heat than the system needs to operate.  Not bad!

I need to point out that, as it is now, the system is not suitable for cooling our house.  The exit air is pretty humid so any improvement in comfort due to lower temperature is more than offset by the increased humidity.  I have gotten a 12x12 heat exchanger, a second fan and higher-volume water pump so I can try the indirect-cooled approach, where the evaporatively-cooled water in the reservoir will be pumped through the heat exchanger.  I still need to get some bulkhead fittings to make a clean system for pumping water out of the reservoir.  Desertsun02 has an indirect-cooled setup he shows on a youtube video, but he just snaked the added tubes up and over the side of the reservoir, which permits uncooled outside air to get into the tower.  While I don't really care what the exit air temperature is, that air leakage also reduces the evaporation rate, which is a concern.  Using two bulkhead fittings will get around this problem, as long as the hoses never have to go above the surface of the water.

It also will be necessary to make an enclosure for the heat exchanger so I can pull air through it with my second 12 volt fan.  So I likely will miss the opportunity to try the whole thing during our current heat wave (100F predicted today, 104F or higher tomorrow).

Update:  I let the system run until almost 5PM (a total runtime of about 60,000 seconds).  The overall heat transfer rate came to 2.125KW, for a total of around 12KWH. (51 mega joules).  

I need to think about this some.  The actual heat transfer may be substantially more because the cooling tower cooled a whole lot of air, in addition to evaporating a bunch of water (about 12 liters).  I could calculate what this is, assuming that the fan really moved 1700CFM and (based on ambient vs exit air temp) the temperature drop.  But I believe I can't add the two results -- the heat absorbed by the evaporating water was pulled out of the air (and the residual water in the cooling pads).  So using just the latent heat in the evaporated water probably is correct.  But my calculation produces a result that is about an order of magnitude higher than the water-evaporation calculation.  I definitely need to think about this.....

Sunday, August 8, 2021

DIY A/C experiments

 As is often the case, when the weather turns hot I start thinking about making some kind of home-brew A/C system for our house.  In the northern Willamette Valley of Oregon, for the most part summers are fairly mild so in some ways it doesn't make monetary sense to install a whole-house A/C system.  This, of course, assumes that the house in question has a gas, electric or wood heating system.  Heat pumps have A/C as a "freebie", but we went with forced-air gas.

So earlier this season I was once again doing online searches for DIY A/C systems that don't require exotic stuff like compressors, refrigerant etc. -- in other words, something that could be built using commonly available materials and tools (like a saw, drill, screwdriver and so on).  I came across a series of youtube videos produced by Desertsun02, and this one looked interesting.  He provides a lot of build information so, even though his emphasis was on using solar power to run the thing, it looked like it could be adapted for a test setup.

I built most of Desertsun02's evaporative cooler -- I omitted the 90 degree elbow duct on the output side of the fan.  Here's a photo of it (minus the fan):


 I attached two of the blue evaporation pads using his approach, using copper wire pushed through the pad and wrapping the ends around the PVC pipe, but didn't like the gap between the wires -- any path for air to enter without going through the pad will reduce the cooling capacity of the unit -- so for the remaining pads I used carpet thread, threading it through the pad and around the pipes in a corkscrew fashion.  This worked much better, but I don't think the thread will hold up very long being exposed to the sun's UV.  It also is clear that it will be a pain to replace pads using either of these approaches.  So that part of the design needs some work.

I found a similar problem with the way the fan is attached to the top of the cooler.  The PVC 3-way fittings on the top of the cooler raise the board so there is a ~1/8" tall gap all the way around the board, also permitting uncooled outside air to enter the exit air stream (and it also reduces the quantity of air that _does_ flow through the wet evaporation pad).  This latter problem could be addressed with the judicious use of adhesive-backed foam weather stripping.  However, just to compound the problem, I found that my piece of scrap plywood I'd used for the board was warped.  Since this thing could potentially be exposed to rain, there's no guarantee this wouldn't become a problem even if I started with a perfectly-flat board.

Alright, so despite these problems, how well does my setup perform?  I have to say, so-so; but mostly because the outside air's relative humidity can be pretty high, even in an Oregon summer.  Example:  right now my (homebrew) remote-reading temperature and RH sensor is reporting 72F and 42% relative humidity.  When I tested my evaporative cooler, the ambient temperature was 80F and the relative humidity was about 58% -- not the best when it comes to getting a lot of cooling out of a swamp cooler.  According to my psyrometric chart, the wet bulb temperature was 68F, so that's about the best I could hope for.  My measurements showed the exit air temp was about 71F, and the recirculating water in the cooler had cooled down to about 70F.  If I eliminated the gaps around the edges of the cooling pads and between the fan board and cooling tower, I probably will get the exit air and recirc water close to the same temperature.

Oh, BTW, here's a photo of my remote-reading sensor:


OK, it's a little rustic, shall we say :).  But I just got it working.  It uses a couple of items I bought from Adafruit -- a Feather M0 with an RF69 radio transceiver, and an SHT40 temp/humidity sensor.  I'm powering it with a spare cell phone power bank, which has much higher capacity than the LiPo batteries Adafruit sells for these things.  The Feather boards were designed to be battery powered, so supplying power some other way can be a little tricky -- but, since they also are designed to be powered off a USB cord, the power bank scheme works a treat.

One big issue with evaporative coolers is that the cooled exit air also is much higher in humidity, which is a problem if you're starting out with a relatively high RH (as in, where I live).  So my long-term solution is to add another cooling loop to the swamp cooler.  It will circulate the evaporatively-cooled water through a water-to-air heat exchanger that is inside the house.  A fan will pull warm interior air through the HX and cool it down.  If the interior dew point is relatively high, it also may condense some water and lower the interior relative humidity, too -- but I really don't expect that to have a significant impact on the interior RH.  But I will make sure to design the HX enclosure so condensation that DOES occur is directed back outside, rather than dripping all over the floor.

What would an improved version of the cooling tower look like?  I'm considering the use of U-channel aluminum extrusions to capture the edges of the cooling pads.  To prevent the pads from being sucked into the cooler, I will attach support panels made from fencing mesh.  The U-channel will be screwed to square aluminum tubing, so replacing a pad would be easy -- pull the old one out and install the new one by tucking its edges into the U channel.  An aluminum sheet would be used for the fan mount.

Switching over to aluminum extrusions would still be compatible with hand tools -- a hack saw for cutting the aluminum and a drill for making screw holes would just about do it.  It may be necessary to make corner brackets to assemble the parts into the tower shape, but I haven't gotten that far yet.


Saturday, July 17, 2021

Cat Deterrent design notes

 The PIR detectors and tweeters arrived so I threw a rough prototype together, using a couple pieces of 4 x 1/2 wood for the base and vertical mast.  I used a single shelf bracket to assemble that part of the project.  Then I moved on to the electrical connections.  The PIR detectors have 3 male pins on the top edge, so I made two small receptacles using .1" headers soldered to small pieces of vector board.  I also had purchased a wall wart style power supply that outputs 5V and 12V.  The 5 volt supply runs the Arduino and PIR detectors, and the 12 volt supply is for the tweeter driver.

Speaking of the tweeter driver, I first planned on making a simple class AB audio amplifier, but realized that I don't need even semi-accurate sound production.  So instead I got an L293 quadruple half-H driver, typically used to drive DC motors.  It can output plenty of current and is a single-chip solution.  One side is directly driven by an Arduino digital output pin, and the other is an inverted version.  I used one of my (many) 2N3904 NPN transistors as an inverter.

After putting everything together I started playing with the software.  I quickly discovered that these PIR detectors are a bit noisy, outputting signals due to external interference.  Some browsing through the Web showed that this is a common problem.  However, it also appears that the noise susceptibility is greatly reduced if you minimize the lead length going to the detectors.  I can do this with the bottom detector but not for the top.  However, it looks like I can reject those phantom detect signals using software.  One issue is that, for a person, the top and bottom detectors don't switch at exactly the same time.  This complicated the software because there was a good chance the bottom detector would switch first, so just using that alone to identify a cat would be incorrect.

The other important observation was that, indeed, the PIR detector's field of view is so wide that the top detector was detecting cats -- so the system was incorrectly allowing cats to enter the "forbidden space".  I solved this by attaching another shelf bracket to the vertical board, just below the top PIR sensor.  Then I attached an aluminum sheet to the bracket.  This greatly improved the system's ability to discriminate between cats and humans.

One final thing I did in order to check how the system works in our absence was to get a wildlife camera.  I will set it up to monitor the cat deterrent system and modify things when I find problems with my implementation.

Here's a photo of my (messy) prototype:


The piezoelectric tweeter is resting on the floor.  My L293 tweeter driver board is to its left, and behind that, my Arduino board.

Thursday, June 3, 2021

A Smart Cat Deterrent

Recently our geriatric Siamese cat has started peeing on the floor.  We are going to take her into our vet to determine if she has a UTI,  but it's quite possible that she is just going senile.  She's exhibiting other behavior that suggests this is the case.  We're not to the point of putting her down for that yet,  because we have no carpet on our floors.  Slate and hardwood.  But we DO have some wool area rugs at risk.

So I started thinking about a way to restrict her access to places she visits when she transgresses.  There are some commercial and DIY solutions that combine a motion sensor with some sort of deterrent -- making a loud noise and some sort of electronically-activated spray system are out there.  But they also are activated by a human entering that space.  Some kind of sophisticated image recognition system would likely work to differentiate between people and their pets but would be relatively expensive.  In contrast, a relatively simple logic scheme using two PIR motion sensors looks like it could work.  They would be at two different heights -- one close to the ground and the other about 2-3 feet high.  If both are activated, something tall (like a human) just entered the space.  If only the bottom one is activated, it must be something smaller like a cat.  In that case, the logic circuit will activate a piezo tweeter that emits sound obnoxious to a cat.  This will teach the cat -- hopefully -- to stay away from that area.  If the frequency is above about 15KHz we won't hear it (not much anyway), but the cat definitely will.

PIR motion detectors usually have a fairly wide field of view.  So it may be necessary to place a tube around the top one to restrict its field of view so it won't trigger when a cat enters the area.

To test the idea out I ordered several PIR sensors, a couple of piezo tweeters and a 5V/12V wall-wart power supply from ebay.  The 12V supply will be used for the piezo driver circuit.  I have several Arduinos lying around so I will use one of them to perform the logic and output a high frequency signal to the piezo driver.  So far I have far less than the $$ charged for a commercial device, and it should work better.  Such a deal.  And if need be, I will have enough sensors and tweeters to protect another area.

Sunday, April 25, 2021

XRF update

 It's been some time since I posted -- for some reason, although Covid meant we spend much more time at home, I have remained busy.  But it's time for a quick update on my home-made XRF setup.

I started by finding some relatively inexpensive scintillator crystals that looked suitable for XRF, but got hung up on the detector side.  Photomultiplier tubes are fairly inexpensive but require well regulated high voltage, on the order of 1,000V.  They also are fairly bulky, a disadvantage if you want to perform XRF in the field.  A number of semiconductor manufacturers make something called silicon photomultipliers, commonly referred to as SiPM's.  They typically require something on the order of 30V to operate, much friendlier -- and they are much smaller than PMT's.  A 6x6mm SiPM on an evaluation board costs about $100.

However, I came across a thing called a pocket geiger radiation detector, sold by Sparkfun.  It uses a 10x10mm detector that by itself costs about $100 -- but they're selling it on a circuit board for only $69.95.  In its as-delivered condition it can't be used as the detector for XRF because the design uses comparators, which remove the pulse-height information needed.  However, the circuit board has some pads (possibly used for test purposes) that DO make the analog signal available.  So I bought a pocket geiger and started experimenting.  I used the 60Kev gamma rays from Americium (found in ionization type smoke detectors) as the radiation source, to excite XRF in a thin brass sheet.  I was hoping to see pulses of various heights coming out of the amplifier (from the mixture of copper and zinc that make up brass), and sure enough, I did.

While this result is encouraging, it's not quite enough.  To analyze ferrous metals the copper shield has to be removed, so the ~10Kev x-rays aren't absorbed.  But removing the shield results in a large 60Hz signal coming in from all the power lines.  The detector circuit has very high gain so this is an unavoidable problem with an unshielded detector.  So currently I'm making an aluminum box that will house the detector, and also serve as a shield to block 60Hz and those pesky 60Kev x-rays.  The box will have a partition with a hole in it to admit the x-rays emitted by the sample, and a removable end that, when installed, will fully shield the detector from all that power line noise.  The Americium disks will be placed around the hole so the detector will be shielded from them, but can "see" the fluorescence x-rays.  I have some 1/8" thick lead sheet that will line the interior of the box, just to make absolutely sure that I have no exposure to x-rays.


Then there is the software needed to process the pulses and assign their peak height to individual channels.  That information, in turn, will be used to determine what element(s) are present in the sample.  First things first though -- I need a robust test platform I can depend on before spending the effort on S/W.