Why cutting renewable energy subsidies is sometimes a good idea

Yesterday, the following article was being shared on my Facebook timeline, amid much wailing and gnashing of teeth and general condemnation of our inept and shortsighted government:

http://www.solarpowerportal.co.uk/news/decc_proposing_to_cut_solar_feed_in_tariff_rates_by_87_2324

Here’s a quick summary of that article:

  • The government decided to cut solar feed-in tariffs (subsidies for generating electricity through solar panels) by more than was expected – this is partly because the subsidies have been slightly too generous recently, resulting in a budget overshoot.
  • The changes will take effect from January 2016, in just over four months’ time.

So, is this a bad thing? and if so, why?

My opinion is that this is far from the biggest thing wrong with current government policy, and that this change to solar subsidies will not change much. It may even be a good thing in the long run. Here is why.

Fact no. 1: the government has legal targets to meet for decarbonising the power sector – and subsidies are part of meeting them.

Let’s not forget that the UK Department for Energy and Climate Change (DECC) has a remit driven partly by the Climate Change Act 2008, the world’s first ever legally binding carbon emissions reduction target. In it, the UK promised to itself that it would reduce its carbon footprint by 80% from 1990 levels by the year 2050 (in line with EU plans, although the EU doesn’t yet have any legal commitments for 2050). Power generation accounts for about 35% of UK emissions, so DECC has a goal of switching the sector from coal and gas to renewables. Renewable energy also carries benefits in terms of energy independence and public health. So far, so good.

However, because renewable power is historically more expensive than fossil fuels (though this is less and less the case), they have until recently needed a lot of help to get any kind of deployment at all.

  • Sticks – targets and obligations, with penalties for failure
  • Carrots – something to sweeten the deal for renewables

While you can, broadly speaking, coerce and cajole and regulate big companies quite easily (especially if they are unpopular!), it is harder to enforce behaviour change from the top down onto consumers – especially since they also happen to be voters. To incentivise domestic or small-scale renewable power, then, the government uses carrots and not sticks.

The government therefore offers a feed-in tariff (FiT), a subsidy on the income per unit of energy generated. Compared to the alternative, which is to subsidise the cost of the panel at point of purchase, FiTs also encourage panel owners to maximise the energy output from each panel, by, for example, installing it on a south-facing roof, rather than anywhere less sunny. This is just fine, since DECC is only offering the subsidy in order to actually make solar electricity, rather than to simply sell large numbers of solar panels.

Fact no. 2: solar panel costs have been declining fast for 40 years.

Solar panel costs follow an experience curve, whereby the cost per of each solar panel is seen to fall exponentially the more you manufacture. Specifically, each time the installed capacity is multipled by 10, we see a cost reduction of about 30%. This is a trend that has been observed in solar panels for about 40 years. It’s equivalent to Moore’s law for computing. Like Moore’s law there are physical limits, but unlike with computing we’re a long way from hitting them with solar panels.

In 1978 Jimmy Carter was paying over $76 per Watt for solar panels on the White House. By 2012 the cost had fallen by a factor of 100, to only $0.80 per Watt.

There are some quite good charts outlining the cost trend in solar cells and comparing them to other energy sources here.

NOTE that the experience curve from 2013 below is actually plotted on logarithmic axes, meaning that the price is dropping by multiples of ten – that’s fast. Note also that you have to actually manufacture more solar capacity for the cost to keep falling.

Credit: Bloomberg New Energy Finance, 2013

Credit: Bloomberg New Energy Finance, 2013

Fact 3: right now in the UK, other renewable energy sources are more cost-effective than solar power – particularly wind power.

As with all renewable energy sources, it’s important to only build appropriately according to the resources you have available. In the UK, it is cloudy and gloomy most of the time, especially in the winter months. For solar power to be economically competitive here on a cost-per-megawatt-hour basis, solar panels either have to be really, really cheap, or the subsidies have to be quite high.

On the other hand, wind power is now cost competitive with coal, according to recent cost figures by NREL and the US EIA. Unfortunately the numbers are changing so fast that reliable data are hard to come by. Moreover it isn’t always possible to compare energy sources in abstract because the cost depends on the level of resource at that location and how far you have to take the electricity once you’ve built the plant.

But in any event: per pound (£) of subsidy money spent, you will very likely get more renewable energy if you put it into wind than into solar.

Fact 4: solar subsidies are designed to distort the market, to allow solar power to compete with other forms of energy.

Under a feed-in tariff (FiT) scheme, solar panel owners are awarded a fixed amount of money per unit of energy produced, in addition to whatever cash they get from selling the energy. This offsets the cost of the solar panel, making it more attractive economically.

Here’s how it works.

Let’s say I’m thinking of buying a solar panel at a cost of £1000. And let’s say that if I put this panel on my roof, the energy it generates is worth £30 per year, on average. After 20 years it would have given me £600 worth of energy, so I’ve made a loss on my initial £1000 investment. This might be worth it if, for example, I live on an island without mains power and it’s expensive or difficult to bring fuel from the mainland. But for an average house or an investor in solar farms, it doesn’t make sense to buy a solar panel.

Now let’s say as well as my £30 worth of energy per year, I also get a FiT worth £25 per year. Overall, I now get £55 per year, or £1100 over 20 years, and I’m happy because this is actually a 10% return on my £1000 investment.

So far so good. But as I said earlier, the cost of solar panels is declining. Fast.

Fact 5: if subsidies are too high, they can produce a boom, which may actually harm the renewable industry as a whole.

Let’s take our scenario above, with a solar panel costing £1000 and the income from FiT-plus-energy over 20 years giving us £1100. Now let’s say six months later the income is still the same, but the upfront cost of the panel has fallen by 10% to £900. If I buy a panel now, I’ll be making a ridiculously good 22% return on my initial investment. And in a world where the stock market offers an average of 5% (if you’re lucky), a 22% return is an absolute no-brainer, and everybody wants in.

A quick aside on thresholds: in general, something is only worth buying if it gives me more value than I would get by putting that money elsewhere. Say I’m an investor (like a pension fund), and I think the stock market is likely to grow by an average of 5% per year: I will then only buy solar panels if I can get a higher return than this. All other things equal, that’s my threshold for investing in solar rather than in stocks and shares. Any higher than about 6% returns for solar is a nice bonus, but if I’ve already decided to invest in solar by that point, it doesn’t change anything about the amount of renewable energy I will be building.

Subsidising very high returns in solar energy is basically a wasted subsidy, as far as the government’s objective to generate more renewable energy is concerned.

High subsidies can also mean solar farms get built that produce less energy. If the costs decline but the subsidy stays the same, then sites with lousy levels of solar resource (e.g. a roof in total shade) will be economically viable, even thought it means installing solar panels that don’t produce any energy. The government will end up shelling out billions for all the solar panels in the dark.

From DECC’s perspective, this is not a desirable policy outcome.

Finally, because of Fact 2 (the cost of solar reduces exponentially in line with total installed capacity), if you have a boom, the costs of solar panels will decline faster. In other words, a boom makes itself worse.

Germany had a huge solar boom in 2011-12 when the government’s FiT levels were just a little too high for a little too long. In a fairly short space of time, 14GW was installed, far above what the government expected to pay for, or that the grid could handle at the time. The sheer number of Watts of solar panels resulted in the power grid being crippled on sunny days, when the equivalent of a dozen nuclear power plants suddenly started chucking energy into it, nearly doubling the load.

Some of the consequences of Germany’s solar boom include:

  • The country was forced to invest in making its grid more flexible, and as a result the problems of grid stability are much less than they were – in fact, Germany is showing the world that it’s possible to absorb far more solar power than anyone had ever dreamed of.
  • Germany built up a domestic solar manufacturing industry, which can then export to other countries and boost the German economy in the long term. Some of these companies have since gone under, thanks to harsh competition from China and Taiwan, but overall the solar subsidy payout can be (sort of) justified on the basis that Germany became, and is still, a big-league player in an industry whose importance is only going to increase.
  • However, the country now has a very subsidy payout of something like £8bn per year for the next decade or so, in the form of feed-in tariffs to all those people who bought solar panels. Thanks to this and the cost of having to invest in the grid, German energy prices are among the highest in Europe.

In the UK, despite having strong decarbonisation laws, we do not have a national strategy to build up a big solar manufacturing industry, nor does trying to put one in place now really make sense. We are also not a sunny country, and solar is unlikely to form a large part of our energy mix until it is dirt cheap (which it will be).

Fact 6: governments must reduce subsidies for new installations over time, but impose retroactive cuts at their peril.

In Spain, a boom similar to Germany’s was combined with an economic slump across the board, so the cash-starved Spanish government decided to impose retroactive cuts on solar subsidies in 2012. This means that they cut the feed-in tariffs going to installations that had already been built, and that had been promised to them for 20 years. People who had invested in solar farms on the basis that the feed-in tariff would cover their costs found themselves making huge losses. Feed-in tariffs are essentially a contract between the government and the owner of the solar panel, and the Spanish government broke them. Since then, Spain has found it incredibly difficult to attract investment or loans for any government projects at all, because investors and pension funds are scared that the government might pull the plug. After all, if the government feels it can do that to renewable energy, why not railways?

Fact 7: solar power – and wind too, but less so – needs effective energy storage before it can really come into its own.

Very little explanation needed here – if you don’t have a battery or something to store energy with, you can only have solar power when the sun is shining or when the wind is blowing.

Fortunately, the cost of batteries is also declining on an experience curve.

Conclusion: the change in solar subsidies doesn’t matter all that much, and might actually help.

With the cautionary tales of Spain and Germany, it’s easy to see why governments now fret so much over getting subsidies just right. It’s a tightrope walk: set subsidies too high, and you risk another expensive solar boom. Too low, and you throttle the industry. That said, the global solar industry is growing fast, so installers will only have to wait a while for costs to fall before their business picks up again.

By giving four months’ notice of the change, DECC is giving people and companies just a bit of time to adapt. This is more notice than they have given in the past.

Reducing subsidies for solar might free up more cash to put towards wind or other cheaper forms of renewable power. As per Fact no. 3, this would likely end up allowing the UK to have more renewable energy overall, other things being equal. (Granted, this is probably optimistic: DECC is probably just reducing the overall budget rather than reallocating funds to other sectors.)

Ultimately, we want solar to be so cheap that it doesn’t need subsidies – and it will be. It already is cost-effective without subsidy in certain sunny places where energy from other sources is already expensive. Soon, though – and according to Deutsche Bank this will happen in 2 years – even the trickle of photons descending from the skies above the UK will be able to justify the price of the panel without any subsidies.

And at that point, everything will change.

Advertisements

Energy and fracking – a personal perspective from the UK

I used to work for a well-known company that provides ‘information services’ (data and reports) to companies and governments around the world. What follows is a collection of thoughts gained from two and a half years as a specialist in the clean energy industry.


1) In an ideal world we’d have cheap carbon-free energy that causes no permanent or unsustainable damage to the landscape or to ecosystems.

Unfortunately we don’t have this yet, and must use coal (dirty, and the technology isn’t really improving in any particular direction) or renewables (much cleaner, and becoming exponentially cheaper but still a bit more than coal on a levelised-cost basis). Renewable sources are intermittent – solar panels only produce energy when the sun deigns to shine – but this intermittency can be managed effectively with a flexible grid. This means being able to move electricity from wherever it happens to be created to wherever it happens to be needed, through advanced power grids that span countries and continents. In the longer term, energy storage will become more important: grid-scale batteries are becoming more common as costs fall dramatically, and even now pumped hydro storage in Norway is helping to even out the peaks and troughs in Danish wind generation. As an aside, Denmark generated 140% of its electricity needs from wind one day in July this year.

2) The economics, business models and market design for clean energy sources differ radically from fossil fuels and nuclear. Once you’ve built a wind farm it’s essentially free to generate power whenever the wind blows: the installation had a high capital cost, but basically zero operating cost. Anything that consumes fuel (coal, nuclear etc.) has a lower upfront capital cost and significant operating costs.

Here’s one of the ways renewable energy pisses all over the established order.

In the UK, our power markets are designed for things that consume fuel. If you own a power station, you watch the price of electricity go up and down on the market: when demand is high, the price goes up. You switch on your plant when you can make a profit from selling the electricity. Coal plants will be on more often than gas plants because gas plants cost more to run than coal. Gas plants can switch on very quickly, so they are used to satisfy ‘peaks’ in demand, such as when everyone watching Coronation Street gets up in the ad break and goes to switch on the kettle at the same time. So far, so good. Since deregulation and the creation of the National Grid, this free-ish market has done a good job of meeting demand with low costs.

When you put a lot of renewable power on the grid, though, this lovely, functional (if dirty) system completely crumbles. Renewable power plants are essentially free to run, so when the sun shines or the wind blows they will dump power into the market whatever the price. This has the effect of depressing the wholesale power price. Before long, even at peak demand times, the power price isn’t high enough for gas plants to bother turning on. Sometimes the power price actually goes negative because there is an excess, meaning generators are actually paying to be able to burn fuel and feed into the grid because it would cost them more to shut down and start up again. In the long run, such a market does not encourage the building of gas plants – despite the fact that gas is 1) cleaner and 2) the only technology flexibile enough to ramp up and down at peaks in power demand. We can end up with capacity shortfalls, power outages, economic disruption and general chaos.

All this is why, along with grid management technology that lets us integrate renewable energy better, we also need power market reform, and business model innovation. The above scenario is also the reason why a lot of incumbent power generating companies are just scared of renewables and desperately want to stay with the old order. The UK has actually been quite forward looking on reforms, though I won’t go into the technicalities here – and of course it could do better!

There are also external costs to consider for each technology. External costs for fossil fuels include pollution (carbon dioxide, particulates and other toxic or acidic impurities from the earth) which imposes costs on healthcare systems and building maintenance – although acid rain is less common these days thanks to environmental campaigning in the past. Through climate change, fossil fuel burning also imposes costs on everyone for things like flood defences and desertification.

Nuclear power carries the risk of meltdown amd radioactive contamination. While these risks are very small, the potential hazard is monumental. True, we don’t have earthquakes or tsunamis in Europe, but the risk of fallout is basically uninsurable. No energy company will pay the premium required to insure against it, and few insurance companie would even be capable of paying out for a Fukushima-like disaster in the UK. So who picks up the tab? All of us. You may think the government has a harsh austerity programme to reduce its deficit right now, but imagine what we’d have if we had to rebuild half the country. This is basically why Germany has cancelled its civil nuclear programme.

Major innovations in natural gas extraction have made the fuel much much cheaper than ever before. But the extraction process can create big environmental problems whose cost tends to be borne by the public. Fracking is a really horribly dirty, messy process. In the US there have been reports of groundwater and surface water being contaminated with the many toxic chemicals and salts used for fracking. In the UK, which is much more densely populated than the US, smaller mistakes are likely to have worse consequences.

The external costs for renewable power, on the other hand, are largely aesthetic in nature, particularly because many of the largest and most suitable areas for wind farms in the UK happen to be in treasured landscapes. However it is important to note that while a wind farm causes next to no permanent change in a landscape, a coal mine or gas fracking pad leaves behind a desolate waste (many of the open cast coal mines in Wales have been left unrestored, since clean-up can cost hundreds of millions and there is no requirement for mining companies to pay).

Sure, there are other kinds of ‘external costs’ for renewables, like the need to invest in the grid to manage intermittent energy supplies. I’m thinking of these as being part of the ‘cost of switching to a renewable-rich energy system’, and therefore not really an external cost.

Overall it seems safe to say that renewable power has fewer externalised or hidden costs than other forms of energy. 

4) So what about fracking? Well, first up, if we accept that climate change is real, we need to plan on a total decarbonisation of the energy sector. But our markets and infrastructure are not yet ready for total adoption of clean energy. For one thing, it would cost an awful lot, and most of this would be passed on to the consumer.

Per unit of energy created, gas creates less carbon than coal. With the advent of cheap shale gas technology we may be able to be self sufficient in energy for the first time in half a century.

The danger is that we are setting up fracking as a dead end. If – and it’s a very, very big if – we can have a UK fracking operation that is cheap and squeaky clean with negligible impact on the environment, then it only makes sense to incorporate that into a national energy strategy provided that you know what you’re going to do when the gas runs out.

A domestic source of cheap gas could also mean we wouldn’t need to buy gas from Russia, but Qatar may soon be taking care of that with its accelerating LNG programme.

For all kinds of reasons, then, from energy security to environmental conservation to health to energy economics, the best and cheapest solution in the long term is a mix of renewable energy sources coupled with a flexible grid. But our infrastructure revolves around fossil fuels today. We need to find a way of getting there from here.

Thoughts on #GE2015

I voted for the Green Party in Bethnal Green & Bow on Thursday. Just wanted to get that out of the way first. Here’s my commentary on the process and the result.politics1

In my view, the Conservative party ran a better campaign than most of the other parties. Its comms were consistent and unambiguous, and projected professionalism and competence. Whatever you may think of the party’s vision, or of the accuracy of its claims, it succeeded in telling you what it wanted you to know. Its brand story was coherent and effective.

Labour’s platform, on the other hand, was incoherent, repetitious and patronising. While their manifesto seems to make liberal use of Tory rhetoric, it seems to basically say one thing: “we’re not the Tories”. This negative platform had worked for the party for several decades, particularly in Scotland and the North, where Thatcher’s legacy made Labour the de facto winner – the ‘enemy of my enemy’. But it has long outlived its usefulness. The Labour party has not had a strong vision since 2005, and unlike the Tory party it does not project competence and clarity of purpose. Moreover, by borrowing so much Tory rhetoric in its manifesto, it chained itself to the fortunes of its main rival, and did not appear to provide a real alternative. The field was wide-open for parties that do a better job of connecting with people – largely nationalists and the radical left. The non-Tory vote fragmented.

While this General Election was not a referendum on the Conservative party as such, it sort of was. The majority of the country who did not vote Conservative would probably have preferred any other party over the Tories, but we have no way of factoring in this kind of preference in our voting system. So despite getting only 36.9% of the overall vote, Conservatives won an absolute majority with 51% of the house. We can’t know what the 2015 result would have looked like if we had adopted the Alternative Vote in the 2011 referendum, but it would almost certainly be a hung parliament, and we’d be in for weeks of coalition negotiations. But it would also very likely be a closer reflection of the will of the British people compared to what we have now.

 

Review: the refurbished Imperial War Museum

Yesterday I visited the Imperial War Museum. The building in Southwark – once the infamous Bedlam mental hospital – has recently had its first major facelift since the 1980s. It cost £40m and it was designed by ‘starchitects’ Foster + Partners.

Great, I thought. The IWM, an excellent and charming museum, if a little dated, will soon be joining the V&A, BM, Ashmolean et al in the twenty-first century. We can look forward to some cutting-edge storytelling, interactive content and interesting architecture.

Apparently there were some teething troubles on the opening weekend in July – but hey, surely they will have been overcome, by now, right?

Ho-hum. This rant needs a bit of structure. Here goes…

Architecture, circulation and layout

You approach the building. You climb the steps on the outside, passing under a Classical portico. In the past, you used to then come straight into the atrium on the ground floor:

Old atrium, pre-refurb (credit: BBC)

Old atrium, pre-refurb (photo link: BBC)

Today, though, after passing through a series of unfortunate but inoffensive dead spaces at the entrance, you are presented with this:

The new atrium (credit: BBC http://www.bbc.co.uk/news/uk-england-london-28316238)

The new atrium (credit: BBC)

Welcome to the new-and-improved atrium, now taller, longer and darker. The floor has been lowered, and the two mezzanine levels rising in steps have also gone. The huge vehicles and equipment are still there, but the lack of interposing galleries means that we can now see from one side of the space to the other. Ooo. It also means we have less gallery space in the museum. Ah well. Never mind: Ooo! Atrium!

Worse, though, the crowd circulation now has some terrible bottlenecks. There are lots of examples, but one of the worst happens right at the entrance. Here we are, standing between the gift shops, just after entering the museum on level 1. At this point I’ve just climbed up the stairs on the outside. I approach what looks like a balcony with a view over this great atrium. But no, it’s not a balcony, it’s actually the main staircase into the museum, which you have to climb down in order to get anywhere. And because everyone wants to stand there for a moment and look at the space, they end up blocking everyone behind them from coming in. So this happens:

Traffic jam

Traffic jam!

The offending balcony/staircase

The offending balcony/staircase

Another random example of a really bad bottleneck was in the WWII gallery (more of which below) – this space between a pillar and the nose of a Lancaster bomber was both the main entrance to the ‘tea rooms’ and also just the point where you had to stand if you wanted to listen to an audio extract being played overhead. 

Exhibit in a bottleneck

Exhibit in a bottleneck

The exhibition spaces felt very cramped all-round – even before you add the dozens of elderly people in wheelchairs and strollers. This may have been because they’d taken away about half the gallery space of the museum when they built that frightfully impressive atrium. Seriously, the sclerotic circulation in those cramped galleries means that you feel bad actually trying to learn about any of the exhibits, for fear that you’re blocking someone else’s path on their way to the tea rooms.

Exhibits and story

What’s with the new fashion for having to look at stuff in the dark? Museums used to be better lit than this. You used to be able to see where you’re going. Ambient light is useful, especially in a room full of people – as you would expect the WWI galleries to be in the centenary years of WWI.

The fog of war? No, just bad lighting.

Realistic recreation of oppressive, over-crowded trenches

The WWI gallery itself – the flagship exhibition in all the gunmetal grey refurbishment – was an assemblage of objects and facts. There was some attempt at storytelling and drawing connections. But overall it seemed haphazard, incoherent, inchoate. (Helping an audience make connections is, I’d like to point out, not the same as making conclusions for them.) I wanted timelines, a sense of chronology and causality. Also, while interactivity is nice, a glorified microfiche reader is not an ‘interactive exhibit’.

And can someone please tell me how this ship-in-a-track-on-a-map improves anyone’s understanding of the causes of the First World War?

Unexplained. Inexplicable. Inexcusable.

Unexplained, and inexplicable. Therefore, inexcusable.

The problems are far worse in the Second World War gallery, where we’ve lost most of the excellent content and depth of the former museum, including any sense whatsoever of chronology. What remains is, once again, an odd assemblage of military hardware and models, assembled in rather odd themes, poorly labelled and dismally lit. And on the subject of labels…

Media – labelling, engagement and design of exhibits

The WWII gallery was the worst culprit here: it’s just too dark to read. Seriously. This museum has two major audience groups: schoolchildren and over-60s. Let’s stereotype ruthlessly, and say that they both need big, friendly typefaces, whatever content you’re trying to deliver.

So here’s what the labelling looks like:

Enigmatic labelling

Enigmatic labelling

See that thing that looks like it’s been slapped on by a vandal? That’s the exhibit label. Jaunty post-its, in a microscopic font, in the dark. Whose idea was that? The placement is also downright weird – the label referring to the Enigma machine (the wooden box on the right) is nearly two metres away from it, and doesn’t really say what it is or why it’s important. Never mind that it catalysed the development of the modern computer and modern intelligence infrastructures.

Decapitated by light

Decapitated by light

Here we go again. What do the different colours of labels mean? And while we’re at it, why is the eagle itself so badly lit?

When you actually get to reading the labels, you find the content is, of course, accurate and interesting. But the delivery and placement are so unforgivably bad that you barely notice them in the first place, much less read them.

Please, Imperial War Museum: can you hire a good design team, with communication, graphic design and UX specialists? Hell, I’ll even write you a brief for free.

Services – toilets, cafes, shops

SO MANY SHOPS. Sod the museum, this is now the Imperial Wartime Shopping Experience. Do we have to be ejected from every single gallery into a retail space?

Malnourished Singapore civilians cheerfully rounding off the WWII gallery, before the gift shop.

Malnourished Singapore civilians cheerfully rounding off the WWII gallery, before the gift shop.

Lots of the common spaces are subject to the circulation issues I mention above, but they look (superficially, at least) cleaner, simpler and more modern. The loos are an improvement over what was there, but again the lighting is abysmal and the space is oddly laid-out. In the gents’, for example, there are parallel rows of sinks that are too close together, so that if there are people actually washing their hands on both sides you can’t walk between them to get out of the room.

Conclusion

The four areas above touch on pretty much every part of your experience at the IWM. The architects’ stated aims were to achieve three things: ‘clarity and circulation’; ‘chronology’; and, ‘consolidation’. In my view, they’ve made them all worse. How can they have screwed this up so badly? I just don’t understand.

One of the main functions of museums are to tell stories with objects. Today’s curators seem to be attempting a kind of ‘impressionism’, giving the idea of what it might have been like rather than telling the story of what happened. Any success that this approach would have had is undermined by poor legibility of labels and terrible crowd circulation.

With better communication during the design process, these kind of mistakes are all easily avoidable. They’re all pretty obvious errors, which is part of what makes them so frustrating. I hope that the exhibits themselves can be replaced, rearranged or improved, but until then, one of London’s best museums has been utterly screwed up. I am angered and saddened.

Adventures with Arduino, episode VI: The board speaks!

More than halfway through the projects book now, and I’m starting to develop a few ideas of what to do with all this stuff afterwards. It’s like a grown-up lego set, but more interactive and varied.

Project 9 – Motor

OK, so this one is actually ridiculously simple. There’s a motor. There’s a switch. You hit the switch and the motor starts spinning. As far as functionality goes, that’s it. The problem is that the Arduino board cannot tolerate high enough power to make a motor turn, so you have to use it as a control circuit. When you hit the button, it changes the voltage on the control pin of a transistor – this turns on the motor circuit.

http://youtu.be/CU5GtGXvuFE

Project 10 – Zoetrope

Using cardboard shapes from the starter kit, I then assembled this animation device, a simple design invented before the days of cinema. As the zoetrope spins, you end up looking through the slits from the outside, your view lining up with each frame of the animation on the inside surface.

As in the previous circuit, the motor is controlled by the Arduino, but this time there is also a speed control via a potentiometer. To make all of this work, the circuit uses an ‘H-bridge‘ integrated circuit.

There isn’t much in the projects book about what the H-bridge actually does so I had to look it up. They are very frequently used with motors, to control the state and direction of the motion. There are four switches inside it that allow it to do this. Many of the circuit’s 16 pins, therefore, are control pins hooked up to the Arduino’s outputs. The motor is connected to pins 3 and 6 only, with the 9V battery (supplying the high power for the motor) connected to pin 8. Both control and power circuits are grounded to the same voltage.

The end result is a circuit that can control speed and direction of a zoetrope:

http://youtu.be/n37oDBHgxrY

Project 11 – Crystal ball

This project is the first that uses the included LCD. The wiring is complicated but the script was actually really simple – it just takes the input from a tilt switch to trigger a bit of text coming up on the screen. The ‘fortune’ it tells is the result of a ‘switch / case’ based on a random number. As you can tell, though, the tilt switch is a little hyper-sensitive and calls fortunes a bit too much.

http://youtu.be/Ouz3hJ-_SfE

Upgrades:

– A better tilt switch. This one keeps popping out of the breadboard when I put it in, and is way too sensitive. I have no idea what state it needs to be in to turn off – it just makes intermittent and very rapid connections. Alternatively, a push-button trigger would also work.

– Some kind of ‘suspense’ device, between fortunes. Of course it’s possible to do lots of sophisticated animations on the Arduino LCD – as evidenced by this rather nifty video.

Project 12 – Coded knock lock

Fairly complicated wiring and script here (relatively speaking, of course). Here’s what we have:

  • piezo used as an input for ‘knocks’
  • servo used as a lock
  • LEDs used as signifiers for the state of the system

When the box is closed (I didn’t build a box, but the servo is in the closed position) the red LED is on and you can only open the box by knocking. You have to knock powerfully enough, and when you do, the yellow LED flashes. If you give it three ‘valid’ knocks, the box will open and the green LED lights up. You can close the box again by

http://youtu.be/R2deZWuiG00

Upgrades:

– It’s too easy to lock the box when it might be open. There should therefore be a way of either detecting whether the box is open (and thereby preventing it from entering a locked state when it is so), or another button to be placed on the inside of the box to ‘unlock’ it. Otherwise, if you accidentally press the ‘lock’ button, you’d have to knock three times to open it.

– It would be better to ensure that the three knocks need to happen within a certain time of each other. Otherwise they could happen days apart and the third one would open the box. To do this, you would probably have to record the three knocks as separate variables and make sure that the time between the first and last knock was shorter than a minimum (eg. 20 seconds).

Adventures with Arduino, Episode V: tonality and timers

So here we are again, just about halfway through the Arduino Projects Book, and I’m remembering more and more of my elementary electronics as we go on. There are two pretty straightforward projects I’m covering in this post.

Project 7 – the Ardu-piano

The input circuit consists of a simple resistor ladder, coupled with a switch to short each rung of the ladder. The resistors on the ladder each have a different value. Thus, each switch produces a different voltage input to the Arduino when pressed.

The output circuit consists of a piezo, wired directly to digital output number 8 (which can be pulsed). Using the ‘tone’ function, this piezo is then vibrated at a given frequency to produce a particular note.

All the notes (frequencies) that may be called on are stored in an array variable. Using a series of ‘if/else’ statements and by selecting ranges of possible voltages, a different element of the array (a different note of the scale) is called into the ‘tone’ function depending on which button you press. In this project I’ve used the first four notes of a major scale, but it would be possible to use something much more demonic, of course.

As you can see in the video below, this works fine as long as you press only one button at a time. If you two buttons, the combined resistance is higher (1/R = 1/R1 + 1/R2) so in this case no tone is heard. Alas.

I wonder if there would be a way to play two notes simultaneously on the Piezo – probably not, as you’d have to superpose the two notes to create a single waveform, and then project that waveform into the piezo. This would be achievable in principle, but not with Arduino as the hardware doesn’t have an easy way of varying the amplitude.

Project 8 – LED timer

In this project, most of the magic happens in the script. The circuit itself is pretty simple – a bunch of LEDs, each connected to a different digital pin at one end, and to the ground at the other. This effectively creates six output circuits.

The tilt switch has a little ball-bearing in it, which allows current across it when the circuit is flat. This is basically the input circuit, and when it is completed, the Arduino begins counting, and turns on another LED each time a set number of milliseconds has passed. In this case, I set it to count in seconds (1000 milliseconds per LED).  Whenever the input circuit is broken, the counter resets – as you can see when I shake the circuit:

images

Next time: fun with motors and transistors!

Adventures with Arduino, Episode IV: A New Trope

So I’ve kept busy with these things the past few days, but decided to roll a bunch of them into one post instead of spamming my own blog with them.

These THREE projects are both variations on the sensor feedback/control circuit that we saw in the previous post.

But first, I’d like to acknowledge some help I got in writing this post:

Who knew ducks made such great tea?

Who knew ducks made such great tea?

In the first, I had a circuit that used three LDRs to send colour-type information back to the controller, which would in turn vary the intensity of the three-colour LED. However, because LEDs don’t vary linearly with colour very well, the best way to achieve this is through PWM (pulse width modulation) i.e. instead of actually making the lamp dimmer, just pulse it so it’s on for less of the time. The Arduino code has a special function built in for this, which is brilliant.

Here’s the video of this project – it’s not that easy to see the light changing but I’m not sure whether this is due to my poor calibration or the very warm (red-rich) light in the room: https://www.youtube.com/watch?v=dR9lg20TdrU

The second project here (project 5 in the book) uses the servo, a mechanical control device a bit like a motor with a limited range of motion – in this case 180 degrees. This is the device that underpins a lot of robotics – it allows a component or limb to move through a range of motion and it also senses feedback about its own position to send back to the microcontroller. Anyway, this circuit is about the simplest thing you can do to exhibit a servo: basically we take the output of a variable resistor (the twisty knob) and convert its analog output into a digital signal. This digital signal was then fed back into the servo to change its position, as you can see in this video: http://youtu.be/MXnbUoFBKCE

The third and final project here used the buzzer included with the kit (technically, the ‘piezo’, presumably so called because it was a piezoelectric speaker/sensor). This project used exactly the same principle as the two above, but instead of changing a light’s intensity or the position of a servo, the circuit changes the frequency of the noise emitted by the piezo.  This can go from ‘low stuttering farts’ all the way through ‘spooky glissando’ to ‘ear-piercing screech’. Video here: http://youtu.be/8QrWWPxWoXI

One other thing I noticed in this project is that the capacitors provided with the kit have slightly odd legs – smooth and uneven – so I decided to make them knobbly. (It’s all very well to cut them to an even length when you’re soldering them onto a board, but in this reusable situation I had to improvise in order to make sure I still knew which way round to put these things…).

Capacitors - undoctored (left) and 'fixed' for easy reuse with this breadboard (right).

Capacitors – undoctored (left) and ‘fixed’ for easy reuse with this breadboard (right).

In the next post, I’ll be putting some of these different pieces together to build something a little more groovy.