Chicken coop door controller


This is the chicken coop door controller. When it gets dark at night, then hens go in by themselves, then the door shuts when the light reaches a certain level. In the morning it gets brighter and the door opens again. There is some hysteresis to stop it from going up and down. The electronics are simpler (ish..) and there is software running on a PIC16 to do the slightly clever stuff. I might write about it some time later, but for now I’m trying out this album plugin for wordpress.

The controller. Drill motor + geabox to the left, battery above. Blue and white cable is to the light sensor (light dependent resistor). Cables off the RHS go down to limit switches.
The controller on the door. Ignore the orange string - that's the manual override when the power dies.
Zoomed in view of the main circuitboard.

Solar Power – where now?

If you interested in the subject, you will no doubt have heard that the government is cutting the feed-in tariff by half, with almost immediate effect (given the delay from order to installation). So what now?

First of all, a little background to the market. Cheap panels (mainly from China) have been appearing in volume in the UK, driving panel prices down. This is the good bit, as it is resulting from competition. At the same time the FiT has been cut in Germany and Spain, leading to an oversupply. This has also reduced costs further, not necessarily in a good way for the solar industry. The UK government chose to increase its FiT (in line with inflation) in April, when with hindsight it should probably have reduced it, by a small amount. So all in all we ended up with the position in the UK being that solar power became a good money earner (irrespective of the merits of the technology) and while this has driven growth, it has been too quickly. The necessary (albeit sudden and substantial) correction will have a negative impact on the solar industry, with potentially grave consequences – for the industry, I’m not drawing conclusions beyond that.

The figures I gave in my previous post regarding a typical system cost, while accurate for when we got our panels are several thousand pounds in excess of today’s prices. This means that for a large (3 to 4kWp system) in a good location (no shading), the cheaper panels are still cost effective, although the returns now take approaching 20 years for you to be better off. This means a more substantial risk on the owner, should components need repair/replacement. It also means that borrowing money to fund such an installation is unlikely to be financially viable.

All in all, I’m a little disappointed as solar power will return to being a small niche market. Maybe that’s all it should be in our high latitude. Oh well, I just hope somebody gets on with building nuclear power stations, which we need if we’re going to “keep the lights on” and meet our low carbon targets… but that rant could wait for another day, and I hope it might be somewhat less controversial.

Solar Panels – One year on

Just over a year ago, I installed an array of solar photvoltaic panels on the roof of my house, which have generated about 3MWh (3000 units) so far. I thought it would be a good idea to add my 2p to the discussion of the various issues surrounding solar panels and the feed-in tariff in the UK.

Solar panels on house

A nice sunny day for electricity generation

Generating Green Electricity

So first up I’ll briefly cover what a feed-in tariff (FIT) is, although there are plenty of websites that already cover this topic adequately (such as the energy saving trust or, but here is my quick summary, based upon current (Aug 2011) levels:

  • You get 44.3p for every unit of electricity irrespective of whether you use it or not.
  • You don’t pay 12p or so/unit for buying a unit of electricity if at the time you are generating it instead of importing it.
  • You get 3p/unit for every unit of electricity you export. In practice most people don’t have an export meter (it’s not financially worthwhile for domestic solar PV to install one), so instead they deem that you have exported half of what you generate (the 50% figure is current guidance and may change).
  • The feed-in tariff goes up by inflation (RPI) each year and lasts 25 years. After that you will only get a reduction in your bill (and maybe a small amount for the energy you export – if you have a suitable meter).

I usually prefer to simplify things and combine the first and third point into one so in practice you get 44.3 + 0.5*3 = 45.8p/unit for all electricity generated. The important thing to note is that this far outweighs what you save off your electricity bill – although that saving becomes a little more significant if energy price inflation (currently 7-10%) exceeds the RPI (currently 4-5%).

Note that the generation vs consumption balance applies instantaneously – that is any electricity that you consume in excess of what you are generating this second is imported, and billed (*) and if you don’t use it, it is exported. This leads to you being encouraged to use the electricity as it is generated, e.g. running dishwashers, washing machines, etc. at peak generating time (midday or just before in our case).

(*) Actually in my case we were lucky in that we have an old electricity meter. It ran backwards when we exported electricity. This means we pay for the net energy imported, rather than the sum of the instantaneous import. In practise that means we have cheaper bills – as all the generated electricity gets taken off what we use and also we don’t have to worry about timing when to do things. Unfortunately after the summer the fact that the meter reading was lower than it was in March meant that npower finally cottoned on.. and came round and fitted a new meter which doesn’t run backwards. It would have been nice if they had fitted a smart meter instead. I requested one, they said yes, then the guy who came to the house seemed to know nothing about it.

Thinking of trying it yourself?

How much electricity will I generate?

Although an installer can give you an estimate, who is to know if it is at all accurate? I used this website to get a 2nd opinion.

What they don’t tell you (although if you look at the details on thay website, you’ll see) is that in the UK generation is very seasonal. The best month (normally June, although it was May for us this year) will see you generating more electricity than the whole of October-February and half of March. On the flip side, system does seem to work whatever, so even when it’s dull and overcast you get some power generated, just not that much.

What can go wrong?

I believe the most expensive single component (in excess of £1000) is also the one most likely to fail – the inverter. This is the device that turns the DC from the panels into an AC in a phase such that it will drive into the grid. Without it the system doesn’t work. So if it does break mid-way through your 25 years, you probably need to invest in a new one.

There is the potential for a panel to break in bad weather (although it’s uncommon). If you can get one, the same size and rating it would be straightforward to replace, access aside.

Who should I get to install it?

There is no reason to treat PV panels any differently to any other purchase. The only thing is to make sure you get a MCS installer so that you can get the Feed-In Tarriff. Get a couple of quotes from companies and compare them. If they work like double glazing salesmen, you can quite happily show them the door straight away. There are plenty of companies who don’t work that way. We experienced both – the double glazing tactics at least got us interested, but they were far too expensive. We eventually chose evoenergy, who will give you a quote on the basis of an email and looking at your house on Google maps. If you do go for them, please quote PV4959 and they’ll give me a small referral fee.

Costs and Investments

How much does it cost?

Before we installed, evo were quoting about £4000 per kWp + £2000. It’s probably a bit less than that today. The panels themselves only amount to half the cost – the inverter, electrical cables and switches, meter (or two) scaffolding, brackets and installation – it took 4 men one day to do our straightforward installation, although the company had made an allowance for 3 of them to return for most of the following day as well.

To get best value for money you want a fairly south-facing roof with a large enough area to get 3-4 kWp of panels.

Can I really get a 7-10% return on my investment?

Yes, and no. The returns can indeed be in the 7-10% region, however it is not directly comparable to savings account. The capital outlay (i.e. installation cost) cannot be (driectly) recovered. One can easily argue that it would add value to your house, so the capital isn’t really lost. While this may be true, I suspect the value is related to the expected return – so as the installation ages, so will its value – probably down to close to zero at the end of the 25 year feed-in tariff. You certainly can’t cash in your investment and get your capital back, like you can with shares or a savings account. In many senses I think this is very similar to an annunity – you pay out a large capital fee up front in turn for a regular income.

I found it more helpful to consider the comparison of a solar installation versus putting your money in a savings account earning a similar amount to the inflation rate. For our installation (facing more west than south) I was better off with solar panels after 11-12 years. So it did seem a reasonable investment. However I don’t think we’d have done it purely for investment reasons as I’m sure if we were prepared to tie our money up for such a long period there would be plenty of alternative financial products offering something similar or better.

However for large (domestic) installations (i.e. near the 4kWp after which the feed in tariff rate changes) on south-facing unshaded roofs it must be a fairly good investment, particularly with the lower prices today. How do I know this? because other people are prepared to offer this for free – any they are willing to do this on the basis of the feed in tariff (and export) alone.

Free Solar Installation

A number of companies in different parts of the country are offering to install solar panels on your roof for free (or for a small fee). Firstly consider what this actually means. You are effectively renting your roof in return for a modest fee, in the form of a bit of free electricity. The latter is probably only worth a couple of hundred pounds. Some of these offers ask you to pay a small sum for installation. That’s not a lot of return and I’ve read an argument that by agreeing to a 25 rent you may be depriving a future homeowner of putting their own panels up an thereby reducing the value of your property. I wouldn’t go that far, but there is no such thing as a free lunch. They will only install where they can get a reasonable sized installation (probably 3-4 kWp) with a good site (good orientation and no shading). Also the small print (what happens if you need work done on the roof – who pays to remove / replace panels, etc.)

The environmentalist in me tells me that overall these schemes are a good idea because it make sure installations in good locations actually happen. What it more clearly tells me is that many big companies believe that the feed-in tariff alone on a good site is a sound investment. Otherwise they wouldn’t do it. So if you have such a site it must be a good investment for you, assuming you have a necessary capital. If you don’t have the capital then money lenders (banks) are happy with giving loans on the basis that the feed-in tariff is a reliable income source, but you have to ask who is making the money here? (the bank!)

More info in free solar installtions is available here.

Wider Issues

Is it a tax on the poor to give money to the middle classes?

The short answer to this is no, not really – but the short answer doesn’t really cut it. Many people, particularly those who can’t afford to install their own panels, see the (sometimes overstated) benefits and realise that ultimately the feed-in tariffs will come out of their fuel bills. While the latter is true, the impact is only slight and is similar to power companies investing in new power stations themselves. It is important to understand what the feed-in tariff is trying to achieve. The government has limited money to spend, but is also committed to various climate change / green energy targets. To address the latter it obviously wants to encourage people to install things like solar panels, but they aren’t economic at the moment purely on bill reducing grounds. In the past it has used grants but these are bad for a government because:

  • They have to pay up front (and don’t have the money)
  • They have no guarantee that the panels will actually deliver their promise

The feed-in tariff directly addresses both of these issues by using private finance (i.e. my savings) to fund the installation and only paying back in proportion to what is delivered. In addition, the sliding scale where future feed-in tariffs are supposed to reduce year on year for new starters on the scheme encourage people to spend their money now rather than later. Furthermore, the aim is to stimulate the market in order to commoditise the process and drive down costs – so that future feed-in tariffs are still cost effective, but also to get green electricity more economic. Given that a few of my friends have had quotes that are a little less than mine, it appears that the costs are coming down, to the FITs are having the desired effect.

How green is it?

First up, the embodied energy in producing the system is recovered by the energy the panel generates in 3-4 years. So only after 3-4 years is a panel carbon neutral. That is somewhat less than the 25+ years nominal lifetime, but it’s not brilliant. One of ecotricity‘s wind turbines recovers its embodied energy in 3-6 months.

Is the UK a good place for solar power? I mentioned earlier that the generation is highly seasonal. The high lattitude of the UK means although we have very long days in the summer, winter days are very short and in total we have less daylight. So if you are a pure green, maybe you should argue for panels to be installed in the tropics. BUT there is no UK FIT to do that. So I have just taken advantage of what have available. A reasonable feed-in tariff on an imperfect site (my own home). Maybe if I lived in Austrailia it would be better, but I like it here in the UK.


I hope you’ve found this interesting. I’ve opened up this article for comments (until the spam becomes excessive).


Marantz SR5200 repair

Recently, I’ve managed to sucessfully repair my Marantz SR5200 receiver (surround sound amplifier). This is a quick note as an internet record to say what to do if you have similar problems.

First of all the symptoms:

The main symptom is intermittent (at least in my case) loud hissing / static / white noise on more than one speaker, which you can reduce the level of with the volume control.

I did a bit more investigation:

  • It only happens on the front 2 speakers, not any of the others (i.e. not centre or surround)
  • It doesn’t affect the radio / tuner
  • It affects all the other inputs regardless.
  • It goes away if you use source direct on an analogue input (but not a digital one).
  • It doesn’t happen if you put the signal straight into the pre-amp (i.e. 7-channel input mode)

There is a service manual that you can download for free as a multipart rar file if you find the right place. The block diagram in that clearly identifies one component as the culprit – the stereo DAC (a CS4391, IC720) on the DSP board. If you look at the detailed schematics there are actually quite a few other components in that path, however it was the DAC 🙂

So the good news is that you can still get the part without too much trouble. I used a CS4391A which is a suitable alternative (technically it can only work with the analogue at 5V as opposed to a wider range, however the analogue input is at 5V). The bad news is that it isn’t really a DIY repair. It is a surface mount component and requires either considerable skill with a soldering iron or the use of hot air to melt the solder. Fortunately for me the latter was available at work, along with someone skilled at using it. If you find another amp with a different fault (e.g. not working on one channel only) then taking the DSP board out of that one is relatively easy (but you will need to take the back panel off to get the DSP board out) and suitable for DIY.

This issue appears to be relatively common (looking at eBay for a faulty one usually returned one with the same fault), and I dare say may affect the Marantz SR6200 as well (same service manual). Interestingly I had always thought that I couldn’t hear a difference when playing CDs between using a digital lead from the DVD player and an analogue one. Not suprising seeing that they use the same DAC!

I hope this might help someone else.

LED flashing Christmas Star

For the last few years I’ve joined in with group of my friends in a “home-made Santa” – a couple of months before Christmas, we all put our names into a hat and then each draw one name out. The idea is that we make a present for that person. There are no other restrictions – gifts in the past have included sculpture, jewelry, knitting, sewing, plenty of cakes and sweeties. Last year I made an LED flashing star and I thought it might be interesting to know how I made it.

LED flashing star on tree

In case you haven’t worked it out, the LEDs light as rings moving outwards so there are either 5 yellow or the one central blue one on at a time. There are plenty of sources to help on the internet – this isn’t quite taken from someone else’s design, but the ideas behind it are fairly well understood.

I was originally toying with the idea of making a tree shaped object with LED “lights” on it, but I wasn’t convinced as to what to do with it once finished. Then the idea of making a star for the top of the tree came to me. My first consideration was how to power it. On the top of a tree, batteries are probably easiest. Initially I thought about a single 9v (potentially powering 2-3 LEDs in series), but this probably wouldn’t last that long, so I went for 4 AAA cells 6V) instead. There are two ICs, a standard 555 timer, which generates a pulse (clock) followed by a 4017 decade counter / Johnson counter (at work I’d call this a shift register). [Aside1: I’m a digital chip designer by day so the logic required to get something running is straightforward to me – however building it out of discrete components is somewhat different. Normally I write in a software like language then this gets parsed by a whole chain of “CAD tools” (computer programs) before you get something that the nice guys in Taiwan will work with.] [Aside 2: It’s somewhat amusing that they make a chip which can count to 16 in pulses, but do this with just 4 flip-flops and then a decoder. The finished chip, when packaged is massive, bigger than one of CSR‘s bluetooth+FM+audio chips despite being really, really, really simple in comparison.]

Generating the clock pulses is relatively straightforward – I could download the chip datasheet from Farnell before ordering and this has a wealth of information. I made a bit of guess at the period (i.e. flashing rate) and had range of different resistors to try. It took a few goes runs to see what looked best.

Once I had a clock, this drives the counter. It’s relatively simple in that you just connect the clock, you have one output for each count (to turn the LEDs you want on), then the next count just goes to the reset to get it back to zero again without having a long off time while the counter counts past numbers you aren’t using. Although the 4017 is perfectly capable providing enough current for one LED, I wasn’t sure about 5 moderately high intensity ones. So I went for the safe option of including a transistor switch for each set of 5. There are actually several ways of getting this to work – I checked in the bible (had a copy from my university days) and jsut went for a NPN with the load on the collector and the emitter grounded. I added in a moderate base resistor (470 ohm, 1 K would have done) to reduce current flow here, and therefore decrease power consumption / increase battery life. I chose most of the components to be cheap (using a transistor as a switch doesn’t have a particularly high spec!) after they basic “it’s a transistor” choice. I probably checked that the transistor was definitely saturating, given it’s hFE, but that’s the sort of person I am. Incidentally, swap the npn for a pnp and you’ll get all the lights but one ring on if that’s what you’d prefer (and a quarter of the battery life).

Circuit diagramAt this point I came up with a neat idea to save me from adding in a series resistor for each of the 17 LEDs. The series resistor is required to ensure the correct current flows through the LED when lit. Only one LED in each spoke is lit at one time, so they can share a series resistor. You can see this on my circuit diagram. ABCDE are different spokes, 1234 are LEDs along one spoke. As I wasn’t 100% sure the circuit was OK, I tried it out on breadboard first. This also gave me a chance to get the flashing rate right. One of the tricky things to do is actually translate the circuit diagram onto something that can go on breadboard or (later) soldered on the veraboard. Here you get connections in columns for free and connect components between rows. You don’t need the optimum configuration, but it saves on time (soldering) and space if you can come up with something fairly efficient.

Trial circuit on breadboardThis is my test circuit. As you might see here, I dispensed with the transistor on the central blue LED, and it needed a different value of series resistance. Happy that the idea was OK, I could now do it for real.

First it’s onto the star itself. I’ll leave the challenge to draw a regular pentagon when you do not have a large enough sheet of paper to fit it all on as an exercise to the reader. (Hint: a pair of compasses help – no not the sort that tell you which way is North!) It helps if you don’t make it too pointy as then you have plenty of space to hide circuits and batteries behind it. I drew the template onto a piece of hardboard, then drilled small holes in the wood to be able to get the LED’s leads through without the body coming through as well. I fussed over countersinking slightly to get the LEDs to fit nicely, but it wasn’t really worth it. Next I painted it and added some glitter into the drying paint to make it more star like. The downside of this is everytime you move it thereafter, some of the glitter falls off. Better is to use glitter glue after the paint has dried instead (we’ve only recently discovered this – for small children!). I saw someone on the interwebs use a hot glue gun to fix the LEDs in – sounds like a good plan, but I didn’t have a glue gun at the time, so went for grab adhesive instead. This worked fine (although I did have to check it didn’t conduct when dry – it does a bit when still wet).

I soldered up the circuit part on to veraboard and left some trailing wires so I could test before the final connections. It’s easy to say that in one sentence, although in practice it took several evenings, especially as I always seem to have trouble getting my soldering iron hot enough. It was so much easier when I was a little boy and no-one worried about lead-free solder!

back of starThe LEDs were connected up – you end up with one side of the LEDs connected to all the others in the same spoke and the other side connected to the next LED in the same ring. You can see what I mean in the picture. Once it is all working, the grap adhesive came out again. I stuck the circuit board on one side, batteries on the other. The panel in the middle has double sided velcro stapled to it. This is for attaching to the tree and helps stop you from poking the wires when putting it up. Be warned – once the glue is dry there is no way of repairing it. The final star looks like this.

Finished back of star

Hello world!

I’ve decided that I ought to have a homepage again. El has one and writes a blog for the children, so I ought to be here too. As our web hosting company makes it easy to install various things like blogging software, I’m trying out this while I’m at it rather than writing everything in HTML as El does. Many if I like it, I’ll try and persuade her to swap to it as well.

I expect I’ll probably come up with random musings on various unrelated topics… watch this space.