Playing with callerid again

Back in April last year I started playing with an old external serial-attached modem to read the callerid of incoming calls. My intention was to intercept calls from direct marketeers. The concept was good, but I ran into problems with the modem; it took up a lot of space, kept overheating, and lacked any voice facilities, limiting what I could do with it. In addition (probably because of the modem constantly overheating) the software I was running kept crashing.

So in the end, I gave up on the idea.

But recently we seem to have had a spate of annoying calls from direct marketeers based in India, selling products for UK companies that are cynically avoiding the UK’s regulations around direct marketing opt-outs. The straw that broke the camels back was the call that came through at 6am on a Saturday morning.

The problem here is that the phone companies don’t care about this. They make money from all these calls, so its not in their interest to block them. They’ll sell me a service to block “withheld” numbers, but not numbers that show as “unavailable”. Unfortunately, these days the majority of the problem calls come from India, and show as “unavailable” because the Indian call centers are using VoIP systems to place their calls to the UK, and they deliberately ensure that their callerid is “unavailable”.

So I’m back on the idea of making my own solution to this problem. So first off, I purchased a USR 5637 USB fax modem that is compatible with the UK callerid protocols. Even better, this is a voice modem too, so it can interact with a caller, sending audio as well as data down the phone line, and recognise touchtones. It’s also small, self-powered, cool-running and very reliable.

Next I spent some time looking to see what other people have done in this space, and eventually found this webpage, that describes a simple Bash script that intercepts calls that are not on a whitelist, and plays modem tones to them before hanging up. Recognised callers are allowed to ring the phone as normal, progressing to an answerphone if necessary. It’s not exactly the functionality that I want, but the simplicity is beguiling, and it’s trivial to extend it to do something closer to what I do want. And anyway, anything more sophisticated is going to require something like Asterisk, and switching my whole phone system over to VoIP, which is not going to be very family-friendly.

So for now, I’m gathering lists of all incoming calls to establish a basic whitelist, before moving on to do some really basic screening of calls.

Advertisements

Or, you could just look out the window…

For a couple of years now I’ve fancied the idea of installing a weather station at home. I had no specific requirement for it, I simply figured it would be a fun thing to hook up to my home server, allowing me to track the weather over time. I also had some vague thoughts about justifying the purchase by using a combination of the live and historical weather data, along with hysteresis data for my central heating system, to more efficiently control the temperature at home by doing things like predictive start up and shutdown of the central heating boiler.

I started by looking into building my own system from scratch, using a microcontroller and one-wire sensors. Cheap and easy for the basic temperature and pressure readings, but the difficult part was always going to be the mechanical parts for the rain gauge, wind direction and wind speed sensors. So I kept putting it off. Then I noticed Maplin were selling a complete wireless weatherstation with computer connectivity for only £50. I figured it was worth it just to get the sensors.

Of course it’s been built to a price (in China by a company called Fine Offset), and is a generic design that ends up being sold with a few variations under a variety of different brand names. Mine has sensors for temperature, humidity, rainfall, wind speed and wind direction mounted on a small mast, which then send their measurements via a 433Mhz wireless connection to a console (the base station) that has further temperature, humidity and pressure sensors, and a large LCD display and a USB port.

The console displays the current readings, and stores a historical log of the data that can be scrolled through at will. However, of more interest to me, once the console is connected to my home server I can grab the latest set of readings from all the sensors via a program. I can then graph that data, or upload it to online systems like WeatherUnderground or Xively, or even use it to optimise the control of my central heating system!

Of course, to get decent readings it’s necessary to mount the sensors where they can work at their best. Ideally you’d want to split the sensors up and mount them in different places; the wind sensors on a tall mast, well away from buildings, and the rain and temperature sensors low to the ground, carefully sited to get the best results.

But for me, this is meant to be a bit of fun, so I’m not going to get too hung up about any of that. In practice the best I can sensibly manage is put them all on a tall mast. I picked up a 6 foot cranked aluminium TV aerial mast and a zinc-plated wall bracket for about £15, and modified the original mast so it could be attached to the cranked mast.

So back at the end of April I mounted the whole lot on the side of my garage, so the sensors were positioned above the roof-line of the garage. I expected the wind direction to be influenced by the garage and other nearby buildings, and for the temperature sensor to over-read on particularly sunny days when the sun is shining directly on it, but I figured it ought to be fine for my purposes.

And for the first month or so, it basically worked. Except the base station seemed to have a very tenuous connection to the sensors on the mast. I reckon it maintained contact for no more than 10-20% of the time, so most of my readings were only of the base station sensors – which were all indoor, and of limited interest. Getting reconnected usually involved standing in the garden waving the base station around for a few minutes, and often having done that, it would lose contact again as I took it back indoors. Worse, after a few weeks the wind speed indicator stopped working. It wouldn’t rotate in anything less than about a force 4 or 5 wind, and even then it wouldn’t indicate the correct wind speed. I also noticed that the wind direction sensor tended not to produce very consistent results, but rather, would “helicopter” all over the place in anything other than the most stable of gentle breezes.

This was not what I had hoped for, but I just didn’t have the spare time to fight with it in the run up to my operation in July, so everything stagnated for a time. But with my operation delayed, and me taking some vacation, I finally got around to looking into the problems with the weather station this week.

The first thing to solve was the wind speed sensor. Taking it apart reveals that there is a simple reed switch in the base of the unit. Gently levering the spinning cups off the base of the wind speed unit reveals a magnet, attached to the spinning cups, which triggers the reed switch. The spinning cups are attached to the base of the unit by way of a mini-bearing (5x10x4mm) which allows it to spin easily. Or in my case, not, as the bearing had failed, producing a noticeable sticking point in the rotation. So I ordered a pair of new bearings from Technobots for about £1.40. Repairing was a simple matter of removing the old bearing, pressing on the new one, replacing the spinning cups, and then making sure everything was carefully aligned so it would spin smoothly again.

I feared that improving the connectivity between the console and the sensors would be a lot more difficult, as I can only think of a few ways to improve a radio link:

  • Improve the siting of the transmitter: Not easy when mine is already at the top of a tall mast!
  • Improve the siting of the receiver: I can’t really do much to improve matters, as I’m constrained by the need to connect it to my home server.
  • Improve the output of the transmitter: there’s not much that can be legally done to 433Mhz kit while staying legal. Messing with this would be a last resort, especially as whatever I did would need to operate on 3xAA batteries, at the top of a mast, and be weatherproof!
  • Improve the sensitivity of the receiver: Really the only option for me, which actually comes down to improving the receiving antenna.

So I disassembled the console. And discovered that the internal antenna consists of a 1/4 wavelength piece of unshielded wire, wrapped around the edge of the case. Probably about as good for communications as the proverbial piece of damp string. But the good news is that the back of the case is practically empty, and there is a nice flat, horizontal surface on the top edge of the back panel. A quick trawl through the RS Components catalog reveals that they stock inexpensive helically wound stub antenna for 433MHz telemetry equipment. Add an appropriate panel mounting, a little bit of spare coaxial cable, and with a little careful soldering I now have a console with a removable external antenna.

The result? The console instantly connected to the sensors as soon as the batteries were installed in my study. No need to take it for a walk in the garden and wave it around under the sensors any more. And as far as I can tell from my Weather Underground page, the console hasn’t lost contact with the sensors since. A spectacularly good result for £5 of components and a little effort.

However, that page clearly shows the problem with the wind vane. If you look at the plot, it’s clear that the wind is generally from the SouthWest, but the data points are all over the place because (I think) the sensor lacks damping. So for now I’m researching ways of damping it that won’t spoil the accuracy. What is needed is something that resists sudden movements, but will happily respond to slow ones, even when the force is very low. Magnetic damping is probably the best option, but given that the vane uses a magnet and reed switches to detect its orientation, that might be hard to arrange. Given the cost, I’m tempted to get a spare vane to experiment on. And use as spares if (when?!) I break the the original.

Sticky tape

Or, in this case, not.

In general, the flexible LED tapes come with a self-adhesive backing tape. You remove the backing from that, and stick the tape to whatever you want. It (apparently) works a treat. However, the LED tape suppliers also want their tape to be used in harsher environments like bathrooms, kitchens, or outside, where there may be more ambient water around. So they’ve taken to encapsulating their LED tape in silicone. This provides both protection from splashes and dampness, and also a degree of physical protection too, without compromising the flexibility or the light output.

My test purchase was of the latter type. And the problem with this stuff is that the silicone both adds weight, and is a devil to adhere to.

To resolve the first issue, the backing tape really needs to be lot stronger than that on the normal tape. In my case it’s apparently branded 3M adhesive tape, but it’s clearly only just borderline strong enough to hold the LED tape in place when it’s stuck upside down without support. The LED tape and adhesive backing tape are pulling away from the cupboard in places. But worse, in other places the LED tape is pulling away from the adhesive backing tape, leaving just that stuck to the cupboard. Silicone is difficult stuff to stick to, and clearly this 3M tape is struggling.

Now, admittedly it’s hot weather at the moment – pushing 30c in my study – but these adhesive tapes are normally rated to 100+c, so I don’t think that’s the root issue here. It’s the weight and the silicone encapsulation that are causing the problems. So, what options do I have?

When I come to do the kitchen I could switch to un-encapsulated LED tape. That would solve the problem. But it’s not going to be as easy to keep clean, and it’s going to be exposed to steam etc. That doesn’t seem like a good solution. So I really need a better approach to mounting the silicone encapsulated LED tape.

My first thought was “better adhesive tape”. There are structural adhesive tapes around (usually called Very High Bond tapes) that can even be used as alternatives to spot welding. They’re not cheap, but I hoped that they might do the job. And there are some mid-range very high strength “professional” double-sided adhesive tapes that are used to make things like advertising signs that might be OK too. So I called a specialist adhesive tape supplier, Tapes Direct, and asked for some technical help. I ended up talking to the owner, and he wasn’t convinced that any of the normal tapes on the market will work well with silicone – not even the VHB stuff at £50 a roll. Kudos to him for not trying to sell me something that wouldn’t work too – proper customer service – I’ll definitely be using him next time I need some specialist tape. But for now it sounds as though adhesive tape is not the answer.

So the other thought is to stick it in place with Silicone sealant. I suspect this is one of those situations where it will be worth paying for a good quality sealant from someone like Dow Corning or Unibond. But the problem with this is that the good quality silicones all cure slowly, developing maximum strength over about 3 days. Which isn’t going to work upside down on a kitchen cupboard.

So the solution is to get some cheap angle or channel, and mount the LED tape onto that, using the silicone, and then mount that onto the kitchen cabinet (with something like screws) once the silicone has cured. You might be able to get away with plastic channel, but my preference is for some aluminium angle; it’s more rigid, so will mount more easily, and isn’t expensive from a wholesaler, even when bought in small quantities.

So later this week I’ll demount the LED tape in my study and build it up into what amounts to a custom light fitting. The trial continues. But of course, this is going to add to the cost. By self-building, I’m currently looking at about £20 a meter for this LED lighting. Adding aluminium angle & quality silicone sealant is going to raise that, perhaps to nearer £30 a meter. It’s still cost-effective, but the differential to something like these, at about £65/m is falling.

On the positive side though, as well as being cheaper, mine are still both brighter and easier to dim!

Let there be (dimmable) light!

I find that there is a point at which you need to switch from doing academic research to carrying out some practical experimentation. I reached that stage on Sunday evening while investigating whether LED “strip” lighting would be a good replacement for the traditional fluorescent work surface lighting.

I realised that I didn’t have any feel for how bright any of these tapes actually were, or if their characteristics would make them good or bad sources of light for work surfaces. I’d also had suggestions from contacts on Twitter that it was a lot harder to dim these strips than I was expecting.

But it transpires that in my study I happen to have a run of wall cupboards over my desk which closely mirrors a kitchen layout. The desk is much deeper, and the cupboards are mounted higher than they would be in a kitchen, but the principle is the same. If anything, my study would be a more challenging environment because of the higher mounting point and larger area to illuminate.

So I ordered 2 meters of moderately high output “dimmable” LED strip; this is built with 60 cool-white SMD 5050 LEDs per meter of tape, operating at 12v and drawing a little under 15w a meter. It’s all encapsulated in a silicone coating, and backed with a 3M self-adhesive coating. I added a 33w “TRIAC dimmable” LED driver that someone had reviewed as working successfully for them, and a Varilight V-Pro low power dimmer switch.

The advantage of that dimmer switch is that it can run with a minimum load of only 10w, unlike normal dimmer switches that usually require a minimum load of 40w or more. It’s also a “smart” dimmer switch, where the mode (leading/trailing edge dimming) and minimum brightness point can be “programmed” into the switch.

I’ve just set it all up “loose” on my desk, and it works quite well. The LED strip is very bright; more than sufficient to light a work surface under a kitchen cabinet. In fact, for my immediate “test” application in my study, it would be too bright without the dimmer.

The dimmer works very well in trailing edge mode. It’s completely silent at minimum and maximum brightness points, with only a very slight buzz from the LED driver at the mid-point. Minimum brightness is (subjectively) about 25% of the maximum, and control of the light level within those extremes is very smooth. Perhaps the only issue is that turning the LEDs on with the dimmer at anything other than full brightness seems to take a second or two for the dimmer to fire everything up. Noticeable, but not necessarily a problem.

Out of interest, I also tried the dimmer in leading edge mode; it wasn’t a good experience. The LEDs did not dim very much, and the LED driver produced a much more noticeable buzzing noise. Trailing edge is definitely the way to go, at least for this set up.

So, the summary is that the LED strip tape is fine for my intended use. I will almost certainly need to be able to dim it, and I now know that is possible without resorting to expensive professional remote-controlled low-voltage dimming, even though it’s perhaps not as ultimately good. From what I can see of the problems with this type of solution (noise, failure to start the LEDs) are probably all related to the LED drivers, so finding ones that are known to work well is going to be the key to success.

Circuit to dim 12v flexible LED strip

Update: Having had this system properly wired into my study for the last few days, a small issue has arisen; the adhesive backing tape (which I think is probably double-sided adhesive tape that is pre-applied as part of the manufacturing process) is not proving man enough for the job. About 2 days after I initially applied the strip to the bottom of the overhead cupboards, it it started to peel off. Pressing it back into place makes it stick again for a while, but it’s definitely not a good long-term solution.

At the moment I’m looking for a better fixing system, but the fact that the tape is encapsulated in silicone is not helpful, as getting anything to adhere to it is problematic. My first thoughts are around using a silicone-based adhesive/sealant to stick it up … but it will need supporting in place while everything cures, which could be interesting. More research required.

Kitchen lighting

Having had such a positive result from tinkering with my chandelier, I’ve been thinking about how I could apply LED lighting to the upcoming refit of our kitchen. Currently we are having LED down-lighters in the ceiling, tri-phosphor fluorescent lighting over the worktops, and standard 40w incandescent candle bulbs in the extractor hood.

I think that the main LED down-lighters will be fine, subject to getting the right colour temperature, and having a way to dim them. But I’m now much less happy with the idea of tri-phosphor fluorescent worktop lighting, and the incandescent lights in the extractor hood. I’d now like to go LED everywhere in the kitchen, if only to colour-match the lighting.

The extractor hood is slightly frustrating. All the different hoods are basically just a metal enclosure, some filtration, some fans, and some lights. The pricing for that varies wildly, and without much obvious logic to it. We wanted as large an extraction rate as possible, in a simple chimney style hood, with LED lighting. To get LED lighting we would have had to get a much lower rate of extraction, and pay a huge amount more, so in the end we decided the extraction rate was more important, and got the one with incandescent bulbs.

However, a bit of poking around in the showroom reveals that these bulbs fit into a pair of back to back SES/E14 sockets, and shine down through perspex lenses. So I’m already thinking that I could convert that to LED before it’s fitted. Another of those little 12w LED drivers from Amazon, a couple of these G4 “panel” type bulbs, and pair of these neat little converters from ATEN Lighting (so I can use the existing SES sockets as mounting points) should see me good.

The worktop lighting is somewhat less clear. There are (hideously expensive) pre-made LED lights designed to fit under cupboards, and be daisy-chained together much like the old T5 fluorescent fittings. I guess that’s convenient for the electricians, but at anywhere from £50 to over a £100 a meter (depending on what you buy, and where from!) that’s never going to fly from a budget perspective. On the other hand, you can now buy flexible strips of splash-proof LED’s that come with a self-adhesive backing on them for around £40 for 5m. Simply add a driver and you should be good to go.

Of course, it’s not quite that simple. There are a lot of different makers of strip LED, with different LED types, densities, etc. And what kind of driver do you need? And actually, I’m going to end up with several runs of this stuff, each on it’s own driver. How to do I connect them all together? Worse, in an ideal world I want to be able to independently dim the ceiling down-lighters and worktop lighting. Suddenly this is starting to look more complex. No wonder the kitchen fitter wanted to use fluorescent tubes!

Still, at the moment it looks like I need:

  1. A dual gang, low-wattage, trailing-edge mains voltage dimmer
  2. The down-lighters wired in parallel directly to the dimmer
  3. The various worktop strips to be dimmable, and also wired to dimmable constant current LED drivers
  4. Those drivers then wired in parallel to the other channel of the dimmer

With a bit of thought it may even be possible to add some interesting “accent” lighting, as additional circuits in parallel with the down-lights. But at this point I need to do more research, and talk to people who’ve done this. So if anyone has any insight to add, please leave a comment!

Converting halogen chandelier to LED

About a decade back we bought a modern chandelier, powered by five 20w G4 halogen capsules. It’s a really lovely feature light, covering the hall, stairs and landing. Unfortunately, in the intervening time, electricity costs have rocketed, and we’ve all moved to lower-powered lighting using things like compact florescent lamps (CFLs) which cost a fifth of what old incandescent bulbs did to run. That chandelier is now the only incandescent fitting left in our house, and by far the most power hungry to run.

As a result we’re careful to turn it off whenever we don’t actually need it. As this defeats the whole point of having a feature light like a chandelier, I’ve been trying for some time to find a way to reduce it’s power consumption.

Newer technology halogen capsules were the first choice; the original 20w bulbs got switched out for 15w equivalents, that produced approximately the same light. But boy were they expensive, and they lasted 1000 hours at best – a year or so. So I’ve still been looking for alternatives; CFL was never going to work aesthetically, but LEDs seemed to hold promise … though the light output of early LEDs was not great, and no-one supported the G4 form factor anyway.

But recently I noticed manufactures were trying again. Mostly they were building simple circuit boards with a few high power SMD LEDs on each side. I don’t doubt that they work, but I suspect the beam angles would make the field of light very patchy. They look awful too!

And then I noticed these: 24 SMD LEDs mounted onto a neat cross-shaped circuit board. Nominally 360 degree beam angles, with the whole thing encapsulated in some type of silicon for physical robustness. Finally, something worth the gamble.

G4 Halogen capsule and G4 LED alternative

The existing 12v halogen transformer is apparently not suitable for driving LEDs so I picked up a cheap 12W LED driver from Amazon to replace it. In total, a little over £20 for 5 LED G4 replacements, the LED driver and the P&P.

LED driver and G4 LED bulb with halogen G4 bulb and AA battery for comparison of size

And the result is pretty good. The LEDs are extremely bright, and look simply wonderful in the chandelier. However the nature of LEDs is that they are extremely directional, producing a tight beam of light. When you’re in alignment with the output beam the LEDs are extremely bright. However, off-beam they are much less bright that an incandescent bulb that acts more like a point light source, radiating in every direction. The fact that there are 120 little surface mounted LEDs each pointing in slightly different directions helps enormously, but the overall room illumination from the chandelier still just isn’t as bright as it was with the old halogens.

It is, however, more than bright enough, and is only using 6w 7.5w rather than 100w to run, so we can run it as much as we like now. That’s a pretty good compromise in my book!

Update: I was asked for a picture of the end result. So here it is, taken at night, with the chandelier lit up, which makes the picture look a lot darker that it is in real life. The walls are also a light purple colour, accentuating the cold blue-white colour of the LED’s:
Picture of the lit chandelier

Clear as a bell

Our house has a doorbell consisting of a set of the traditional (some might say “old fashioned”) “Ding Dong” chimes, triggered by a pair of hardwired bellpushes at the front and back doors. Rather than eating through lots of sets of batteries there is a small 12v mains transformer that powers the whole setup. Since the system is mains-powered, it’s possible to support bellpushes that contain a very small incandescent bulb, wired across the contacts which “glow” all the time, making the bellpush easy to find at night.

Except they don’t. Although the life of incandescent bulbs is inversely proportional to their voltage, most tiny 12v bulbs only last a few thousand hours; if we assume about 5000 hours, that’s less than seven months in this application. Worse, whenever someone presses one of the bellpushes the current through the bulb is snapped off, and then back EMF from the coils in the chimes unit will drive an even bigger transient voltage through the bulb when when the bellpush is released – which shortens the bulb life even further. My last replacement lasted less than 6 months.

To add insult to injury, you don’t seem to be able to easily buy replacement bulbs – only much more expensive complete replacement bellpushes. And changing just the little bulb is a fiddly job which further encourages you to just buy a complete replacement bellpush. No wonder most people quickly give up and leave them “unlit”.

So I decided to go solid-state, and upgrade my existing bellpushes to LED lighting. The basic idea is to change the little incandescent bulb with an LED, which will last at least 50,000 hours. However, there are two problems with this approach that we need to overcome:

  1. Since the actual chimes operate by way of electromagnets, the voltage in the system is alternating current
  2. The back EMF from the coils is going to generate a much larger voltage than the LED can cope with

LEDs normally operate on a maximum of a couple of volts. However, it is possible to buy LEDs with a suitable ballast resistor integrated into the LED package to allow them to work directly from a 12v DC supply. Two of these, connected back-to-back, can be used to replace the incandescent bulb. One of the pair will glow on each phase of the AC. Actually, they’ll each flash 50 times a second, but we just see a glow, which is good enough. Unfortunately the transient voltage spikes (back EMF from the chimes) in the system would completely destroy the LEDs when the bellpush is first pressed.

To avoid this, it is possible to take advantage of a Voltage Dependant Resistor (VDR). This is a simple passive component whose resistance varies according to the voltage placed accross it. When the voltage is below a rated value, it presents a very high resistance – essentially it is an insulator. When the voltage rises above that rated value its resistance falls rapidly, becoming a conductor, and allowing current to flow through it, preventing excess voltage from forming across it.

By wiring a VDR rated at 12v across each coil, the voltages across the coils can be clamped to a maximum of 12v, preventing any back EMF voltages from forming in the circuit. The result, in my case, is a pair of bellpushes that glow a gentle blue colour, and should continue to do so for years to come.

This circuit diagram should make things clearer; the bits in the “dotted T” outline are in the chime unit:

Doorbell circuit diagram

Also refer to this photo from the HowStuffWorks site to see how a chime unit works mechanically:

Inside of chime showing solenoids

The pistons of the solenoids rest just above the “dong” tone bar (at the bottom). When energised the pistons push upward against springs. One (the right hand one in the above picture) is able to contact the “ding” tone bar (at the top), the other is not – there is a plastic buffer to prevent that. When de-energised, springs force the pistons to rebound back against the “dong” tone bar, before they settle into their resting positions. So one solenoid causes a “ding-dong” sound, the other only a “dong” sound.

Finally, refer to Wikipedia to understand how the solenoids create back EMF when they are de-energised and the springs push the pistons back through the coils to their original location.