Tuesday, June 29, 2010

Solar Controller

I've been working on a simple solar heating controller based on an Arduino open source hardware microcontroller.

The design was inspired by Tristan Lea's unit on his openenergymonitor blog, and it was a project that I had been meaning to get around to doing on return from China.

Trystan's unit used PT1000 sensors and an analogue multiplexer and op amp circuit to scale the sensor readings. I decided to use 10K NTC thermistors because they are cheap and easy to use and accurate enough for this sort of application.

http://openenergymonitor.org/emon/node/70


It started with a nice blue LCD from Moderndevice, which comes with a LCD117 PIC based controller kit which makes displaying text as simple as serial.print statements from the Arduino.

http://www.moderndevice.com/products/16x2lcd-lcd117kit

It connects via a 3 wire interface, making it easy to have the display some distance away from the Arduino board. There are 3 spare outputs on the PIC for driving LEDS, and one can drive a piezo buzzer. The PIC allows the brightness of the display to be controlled using pwm.

It took about an hour to assemble the kit and get the display to show analogue readings from the Arduino. I also wrote a bit of code to display the time, counting in seconds and displaying leading zeros where required.

The next thing was to interface the analogue input channels to the temperature sensing thermistors. I had some pipe clip thermistors from Rapid Electronics, which will clip directly to 15 or 22mm copper pipe.

Using code on the Arduino forum to linearise the signal from the thermistors, I soon had them displaying in degrees centigrade. The linearisation uses the Hart-Steinhart equation which is simple in C, but previously had been stumping me to try to write it in assembler.

http://www.arduino.cc/playground/ComponentLib/Thermistor2

The Arduino will read up to 6 thermistors on its analogue inputs, but I chose to fit 3 and a variable resistor "pot" which allows me to define a set-point.

I'm not quite ready to fit the controller onto my solar panel system, so I thought I'd use it to monitor the various temperatures of my hot water tank. The Arduino outputs its thermistor readings to the display once per second, and also via the serial/USB interface to the laptop. They are generated as a CSV delimited file which can be read in and stored using the likes of Hyperterminal and then manipulated and graphed using Excel. The graph shows temperature of my hot water tank (red) heat up when hot water from the gas boiler (blue) is pumped through the heat exchanger coil.

I've realised for sometime that the Arduino could be much improved with the addition of a dedicated Real Time Clock and data storage using a SDcard interface. I learnt this week that NuElectronics have recently released a new shield combining RTC and SDcard. It also has 6+2 connectors allowing 1-wire or 2-wire sensor devices to be connected to it. More details here:

Similar products combining SDcard and RTC are also available from Lady Ada and Seeeduino Studios.

This new shield will transform the Arduino into a datalogging hub forming the basis of an integrated energy monitoring system - along the lines of Trystan Lea's openenergymonitor. With an ethernet gateway, the real time and logged data could be made available to the net via such services as Pachube.

Here are a few ideas how it could be used:

1. Solar Water Heating Controller - simple control with circulation pump relay
2. Central Heating / woodburner controller - determines best usage of hot water
3. Electricity Monitor - whole house electricity consumption
4. Gas consumption monitor - pulse counter on optical sensor on gas meter
5. pV / battery charge controller/datalogger
6. Gasifier controller
7. CHP controller - engine start/stop, rpm, voltage monitor etc
8. Battery management system for wind or solar pV.
9. General purpose sensing, datalogging and control tasks
10. Temperature, climate and weather monitoring and datalogging.

What is needed now are some standardised communication protocols to allow Arduino based hardware modules to communicate with one another, and the central hub and thus via the ethernet link to the web.

Sunday, June 20, 2010

Eating Out in China

I now come to the third part of my short series of observations about everyday life in modern China.

We have all seen TV documentaries of the bizarre cuisine in China, such as a couple of years ago when Paul Merton had lunch and interviewed a crazy woman in a restaurant that served snake and donkey penis.

Fortunately I have not yet stumbled across such establishments (or women), mainly because of self-preservation mantra “Stick to what you know”.

A Hong Kong friend man told me many years ago “If it moves – the Chinaman will eat it” – this was of course the abridged version, it should actually have been:

“If it slides, slithers, swims, scurries, scuttles, slips, creeps, crawls, climbs, dips, dives, hops, hobbles, jumps, jives, walks, wades, waddles, flys, flaps, flounders, flutters, frolics or f**ks – the Chinaman will eat almost every part of it”.

With this in mind, there is a high probability that you will encounter unfamiliar foodstuffs – so I offer this short guide to eating out in China.

The working title of this episode ought to be "How to retain your health and body weight - whilst all around you are trying to poison you".

Whilst living in a 5 star hotel, there are of course the hotel restaurants, Western, Chinese and Japanese style - as well as a revolving restaurant on the 24th floor, from where you get a panaoramic view of this area of Shenzhen's surrounding suburbs. We're next to Shenzhen airport here - so imagine it a bit like Staines or Houslow but a lot more densley built with high rise appartments. The Western style restaurant is at best disappointing, the others are over priced - so by way of adventure - and to get out of the hotel at night, I risk life and limb, cross the streets to the town centre and seek out local culinary diversions.

There are many outlets offering food in China, these range from market stalls selling snacks in the street, small makeshift eateries – that look that they adopt a fly by night strategy to avoid hygiene inspection, “mom & pop” family run restaurants – which is what folks drift into when they accidently end up with more than one daughter, and finally a multitude of specialist restaurants, offering food from all regions of China.

There are of course a plague of Western franchises, KFC, McDonalds, Pizza Hut, Starbucks – these tend to be common in the cities and the larger towns – the restaurants of last resort. In 30 years the next generation of Chinese will be unrecognisable - already the Hong Kong youth suffer from imported obesity from a diet of western junk food. (There's gotta be a pun there somewhere).

Street Cuisine.

This is literally prepared in the street and consists of simple foodstuffs or snacks, cooked or barbequed on charcoal or gas braziers mounted on modified tricycle stalls. The food often consists of barbequed or deep fried fritters/critters on sticks and sell for 2 or 3 Yuan. In homage to Monty Pythons “Chocolate Box” sketch, “Crunchy Frog” or “Lark Surprise” may well be on offer. A disguise of golden batter makes even the most exotic appear appetising.

Other stalls offer omelettes, pancakes, hard boiled eggs and fried waffles. Some traders offer carved pineapple, lychees, grapes, bananas – fruit that can be eaten “on the go” plus lengths of sugar cane to chew on – and then have to spit out great wads of sugar cane “cud”. Some stalls have a special cane-crusher machine mounted on the back of a trike – and offer freshly squeezed cane juice.

My advice with all street food – is try at your peril. The cooking facilities are at best basic, the vendors have no means to keep hygienic conditions, and any water used may be straight from the local tap – and really should be boiled before consumption. Bear this in mind with any fruit, that may have been handled or washed in the local water.

So how bad can it be – everyone will have had a “dodgy burger” from a catering trailer at an outside event – but here in China, the implications can be a little more severe. Best advice is stay clear of street food – just ‘cause the local factory workers can eat it – is no guarantee that your metabolism is quite ready for it.

“Fly by Night Cafes”

These consist of a mixed assortment of plastic tables and stools arranged outside an open shop, often under a fold out canopy to keep out the sun and rain. They are found predominantly in the industrial zones – directly across from the factories. They offer low cost eating for factory workers – as an alternative to the rather institutionalised works canteen. Meals will be about 10 Yuan (£1) per dish, and are served with a plastic mug of warmish water. If you eat in these outlets – don’t look too closely at the decor nor the serving conditions. Make sure they use new, disposable chop sticks – individually packed in a paper wrapper. These cafes offer budget eating, but at the end of the day – you get what you pay for.

Next up the hierarchy, are the family run restaurants. These usually have about 30 to 50 seats arranged around plain wooden tables. The service is polite and if you attend frequently, they get to know you and what you prefer to eat. A meal consisting of a bowl of soup, a rice or noodle dish and a large (600ml) bottle of Tsing Tao beer can be had for 21 Yuan (£2.10). I usually have fried rice with shredded beef or pork for lunch at such a place close by the factory. Fried rice by its nature is cooked at high temperature and the thin shreds of meat are also well cooked and easy to eat with chop sticks – this is an important consideration if you new to chop sticks. Whilst more elaborate dishes are available, such as pork chop, beef medallion or roast chicken – these are not so easy with chop sticks and involve either a lot of gnashing of teeth or man-handling like barbeque food.

The Chinese have a particular desire for food that offers “mouth feel”. To the unaccustomed Westerner, this means bony, lumpy, gristley or chewy and downright awkward to eat without having to eject bits onto your plate. Whilst this might appear bad mannered in the UK, it is common for anything inedible to be ejected directly onto the table cloth – so no need to be embarrassed – you won’t offend anyone. Table manners, like driving skills, are mostly absent here. Soup is slurped, rice scoffed from bowl to mouth, bones spat out, extra gas belched and teeth customley picked at the table.

A particular note about roast chicken – for the uninitiated. In the UK we generally joint our chicken into easy to manage portions, legs, wings breasts, making it easy to eat, either by fingers at barbeques or with a knife and fork. In China, after roasting a chicken, they put it on a chopping board, and section it laterally across the rib cage with a very sharp cleaver. This leaves a series of strips of flesh, about half an inch wide, each featuring its own bits of cut rib bone – another hazard and pitfall for the chop-stick newbie. This means that if you order chicken, it will be served on an oval plate, in the above fashion – still with the head at the end of the plate.

Specialist Restaurants. These abound in all the big towns. They are normally based on some regional speciality, such as Hunan, Szechuan, Cantonese (Hong Kong Style), plus Vietnamese, Thai and Japanese. I will describe two that I have had some recent experience of.

Hot Pot. This is a style from the north west of China, close to the nomadic sheep and goat herding areas of Mongolia. If the restauranteurs are genuinely from this area, they will be tall, muscular and ruddy faced. The dish consists of a large stainless steel pot of hot, spiced lamb broth – similar to a round washing up bowl, full of a liquid that looks like dirty dish water, which is kept hot by a gas burner set into the centre of the circular table. During the course of what is usually a 2 hour meal, you order various types of wafer thin sliced meats, meat balls, vegetables and mushrooms which you broil for a few minutes in the broth and eat with bowls of rice. As the evening proceeds, the broth thickens with the fats and juices from the cooked mutton. The hot pot is a very sociable meal, and a good opportunity to chat – so best attended with at least 4 people. Remember to take your interpreter – it’s almost impossible to order the right mix of dishes without someone who speaks the lingo. Wash the whole lot down with copious quantities of cold Tsing Tao beer. They do a spicy variant of the above dish – which is definitely not for the faint hearted. I tried it once and it was disappointing – way too hot for general consumption.

Maojia Restaurant.

This is often called “Mao Style” and it is a regional style from the Hunan province, where Mao was born. It is characterised as being hot and spicy, copiously involving the use of red and green chillies. If you are “up for a curry” this might just suit you – as curries are either non-existent or disappointing in this area. Dishes consist of meat or fish, served on a sizzling iron platter of red and green chillies. If you are lucky, the restaurant will have a picture menu – so best is to look for the ones that don’t have so much chilli – this can however be a bit of a “point and prey” lottery – rather like pinning the tail on the donkey. If you are lucky, the dish will be more or less what you expected, but I did once order liver rather than beef, as the picture was a bit unclear. The chefs tend to chuck in a lot more chillies than the picture might suggest – and I had one dish earlier this week, that was over-endowed with green chillies and almost too hot to enjoy.

Ordering from anything other than a picture menu is difficult, if dining alone. Fortunately I often have a Chinese friend with me, who keeps me out of trouble. I have however picked up a few words that usually result in the right dish being delivered.

A typical conversation in the restaurant might be:

Nihau - “hello, how are you”, then raise one digit to indicate that you are a sad lonely, singular western diner.

Nu yo chow fan - this normally is understood as fried rice with shredded beef.

Tsing Tao pee-jew – this will bring you a bottle of the local lager and a very small tumbler glass – this week there was a Tsing Tao promotion, and the nice girl in the Tsing Tao T-shirt put down a shot-glass not noticing that there was a small dead cockroach in the bottom. I pointed out her error and she got me a fresh one.

Fuwu yuan - “Waiter”

My Fan - reminds them you want a bowl of steamed rice

Ma Dan - bill please

She-she - thankyou

Bye bye - good night and thanks for having a giggle at my expense but hopefully not poisoning me. I’ll know within the next four hours.

Here’s some things I learnt during my odyssey:

During the course of your meal, expect lots of shouting from neighbouring tables when it comes to either place the order or discuss the bill. Smoking is still common in restaurants.

Don’t fret if you see a waiter with a fishing net go to the fish tank and bring back a live fish and head for the kitchen. They like their fish very fresh here. One barbaric delicacy is a live fish dunked tail first into hot oil, with its head and the chef's hand wrapped in a wet tea-towel. It is still (barely) alive when served at the table. Makes the "Spooks"/ deep fat fryer scene look quite tame really.

The “mom & pop” restaurant where I have lunch has a back kitchen with blazing gas burners. Occasionally there are minor explosions and loud “whooshes” and flames seen from the kitchen as the oil mist ignites over the gas burner – makes for a more exciting cooking experience.

If it looks like battered onion rings but very chewy, it’s probably sliced rings of pig intestine fried in batter.

Having started a meal in a small restaurant, I once saw a large rat make a bid for freedom, run from the kitchen area, across the restaurant and out of the front door. Rat was probably not on the menu – so I didn’t fret too much.

So now that we have got the polite aspects of eating out in China out of the way – I would like to warn you about some of the after effects and how best to cope with them.

Fortunately restaurants give you a plastic packet of about 8 or 10 folded napkins. These are great for wiping grease off your chin when struggling with chop-sticks – but at the end of the meal, keep the rest of the packet, put them in your pocket and take them with you – you may need them later.
Chinese restaurants seldom have western style toilets, so plan your evening so you are not caught short at the restaurant. Aim to base your daily business about the hotel, as western toilets, loo paper and soap are seldom found outside the hotel.

Last year, three of us staying here, who had a hot pot, suffered in the night and for most of the following morning. We had a bit of a laugh about it – put it down to bad luck, and returned to the same restaurant a week later with no similar effect. The effects are short lived and soon over within 12 hours.

Fuelling the Fires of Industry

The second of a short series of posts about day to day life in Southern China.

The miracle of economic growth that has blessed China in the last decade, has left a population rapidly trying to catch up with the rate of change. Agricultural villages in the Shenzhen, Dong Guan, Guang Zhou "Triangle", have expanded into bustling industrial towns in the matter of just a few years. Farm fields sold off to developers to produce industrial zones of identical factories and tracts of urban housing apartment blocks.

The rate of growth can probably be likened to that of the London boroughs during the 1830s in our own Industrial revolution - just on a much larger scale.

Modern factories compete with simple workshops - often located in the main street. It is common for the various traders to group together - for example, one Sunday morning in Chang An, I passed about 20 shopfronts all of which specialised in stainless steel wire and pipe.

The photo at the top shows a metal fabrication workshop in Chang An. Steel stock is piled up in the street and cut into the necessary profiles with simple jigs and gas cutting torches. Here a worker is cutting circles from heavy gauge steel plate.

Amongst this new urban chaos, live the bemused population, - factory workers, shop keepers, handymen, porters and the recyclers of which I spoke last time. The three cities named above are home to nearly 35 million. Equivalent to half the population of the UK, shoe-horned into an area less than the size of the southern Home Counties.

Keeping this population moving are a series of modern dual carriageway roads and 3 to 4 lane expressways. Competing on these roads are a mix of trucks, buses, vans, cars, motorbikes, auto-rickshaws, electric scooters/mopeds, bicycles and pedestrians - in roughly that pecking order.

To the uninitiated Westerner, the road traffic looks like total chaos, ungoverned by any rules or regulations. However, somehow, the system seems to work in a way that would seem impossible in the UK.

To understand the system, you have to discover a few things the hard way - if you survive the first time you cross a pedestrian crossing - you have cleared the first Darwinian hurdle. So here are the 3 things you need to know - "Three Steps to (avoid) Heaven".

First of all, there is no concept of "right of way". Most drivers will cut across the path of oncoming vehicles, loosely based on the pecking order above, and a quick decision on the size, speed and braking capability of the oncoming vehicle. It seems perfectly normal for a car to turn left across an on coming stream of motorcycles and electric mopeds, expecting them to slow down, stop or change their direction.

Secondly, road markings, such as centre-lines, double centre lines, stop lines and zebra crossings mean little if anything to the average road user. If your lane is blocked - then use the other carriageway, even though it might involve playing "chicken" across the centreline (or double centreline) with the oncoming traffic. If they are "just" bikes and scooters, they will probably part out of the way, if they are bigger than you, just barge in front of the obstruction you just overtook, and carve them up. My driver has scared me on many occasion by first overtaking and then carving up a 40-tonner with a fully laden shipping container on the back!

Thirdly, blowing the horn at every second vehicle appears to be mandatory, whenever other road users come in your way. Chinese cars should be designed with no indicators - totally redundant - but an extra horn or two controlled off the redundant indicator stalk.

Horns are used in advance to warn other slower road users or pedestrians that you have either no intention of stopping (see concrete trucks - below), so they should get out of your way, or as an indication to other slow road users that they are in your way and should change lanes or yield. There is no lane discipline, so you will commonly find a poor soul on a pedal-trike, or auto-rickshaw, holding up a queue of traffic in the outside lane of a 2-lane street. No problem, just undertake on the inside, comandeer the opposite carriageway or even the pavement if it looks easier - just keep moving, by whatever means possible.

The worst offenders are concrete trucks - the revolving type. Time, tide and setting concrete waits for no man - and the drivers of these trucks drive to the max, often with the horn on at all times - especially if there may be bikes or people crossing the road that might get in the way of them.

Pedestrian crossings are widely ignored. If you are a pedestrian on a zebra crossing, you often have to dodge oncoming vehicles or freeze like a bunny in the headlights as buses and trucks pass you on each side. Light controlled pedestrian crossings are almost as bad. Even if the green man is illuminated, there will be someone jumping the lights, sneaking a right turn on red, and generally trying to wipe you out.

One way steets are generally ignored - it is common to have to avoid oncoming traffic driving the wrong way on the slip road to the dual carrigeways. Exiting a carriageway on the "on ramp" is a common dodge if it will save you a few seconds - regardless of what happens when you come into conflict with those trying to get onto the carriageway. Even the buses and 40 tonners do this!

At night, the perils are a bit greater. Electric bikes are virtually silent and few use their lights after dark - a way of extending the range. Car drivers often drive without lights, use of lights and windscreen wipers appears to be arbitrary.

Even on the pavement, the pedestrian will still encounter road users. Cars will drive on the pavement if the road ahead is blocked. Bikes, trikes and e-bikes will sneak up on you on the pavement and then expect you to yield.

Most residents in the industrial towns are young and inexperienced of road traffic. Factory workers from rural towns flock to the urban areas and have little or no traffic awareness. Just by looking at oncoming traffic when they blindly stroll across the road would be a good starting point. Many are oblivious to oncoming traffic until they hear the blast of the horn. As darkness falls at 7:30 in this lattitude - workers exiting from an evening shift, at the end of a 13 hour day are generally oblivious to the container trucks that thunder through the industrial zones.

China still has a relatively low traffic density, which is probably the only reason that it can move in this manner. If car and vehicle ownership is to rise, then it must be followed with a roadsense awareness campaign - starting in primary school. Only then will they manage to increase their vehicle numbers and keep it flowing - and slowly move to a system like the West, based on discipline, rules and awareness of other road users. Currently you have to drive here in a manner that assumes that there will be a stationary object around the next bend - or at least expect a vehicle of any size or type to inexplicedly cross your path without notice.

Seatbelts are seldom fitted to cars. Taxis fold away the buckles under the back seats so that they cannot be fastened.

Youngsters are rapidly becoming more mobile with the introduction of affordable electric mopeds. It is common to see a lad riding, with his girlfriend riding side saddle on the back. "Three-up" on a scooter is not uncommon, and I once saw a family of 4 conveyed on one - oblivious to the danger that their children might be in, should they be struck by another vehicle. The other day, I saw a young mother riding a moped, with a toddler, squeezed between her knees, riding on the "footplate" at the bottom of the battery housing. He was unable to hold on, but just gripped between his mothers legs.

Every day one witnesses the bizarre, the foolhardy and the downright dangerous, but somehow the system works, and there does not appear to be a huge amount of carnage on the roads, ambulances or wrecked vehicles littering the highway.

To those of us that have learned our driving skills in the West, the traffic conditions here are alien at best. Who knows what our very own Health and Safety Inspectorate would make of it - perhaps they would become deeply traumatised, realising that they were powerless to change the ways of the population here. Perhaps we could wholesale export the HSE and all their minions to China?

Next time I will cover food, eating out, and coping with other unpredictabilities brought on when living in this quaintly crazy place!

Steet Life in Modern China


Some of you will know that I have spent most of the last month in Southern China, working in an electronics factory.

After 3 weeks of "putting up" with the basic living conditions, the squalor, squat toilets, the mad traffic and the lack of written or spoken English, I guess cabin fever begins to set in.

It came to a head last night when my boss decided that it would be good if I spent another week here, but sadly I only have a 30 day visa - so I'm back on a plane next Wednesday.

Whilst cooped up in the hotel room in the evenings - it is dark by 7:15pm, and the streets are not safe more than a few 100 metres from the hotel, you spend the time reading internet forums and blogs, listening to the BBC World Service and Radio 4 - and having a couple of beers.

Tsing Tao Beer, sells for about 30 - 45p a 600ml bottle in the convenience store around the block, but in the hotel bar, a 330ml bottle is £3.50 - talk about exploiting the guests! So I tend to support the local shopkeepers and buy my beer outside of the mad oasis, I find myself bunkered in.

The empty bottles are recyclable, and 4 bottles will fetch about 1 Yuan or 10p. Tonight I dropped off 8 empties, on the way around to the store.

At night, the streets become alive with those that perform the recycling function. Men and women on trikes and motorised 3 wheelers, tidy up the streets of all the cardboard, glass, packaging, food waste that is produced by the businesses in a busy town during the day. If it were not for these nocturnal workers the town would drown in it's own filth. Nothing goes to waste - this economy cannot afford to waste anything of value - no matter how small that value might be.

Particularly noticeable is the 3-wheelers with a couple of blue barrels on the back. These belong to the grease collectors, and they perform a nightly function of clearing the hotel and restaurant drains of the coagulated fat that collects in the grease traps. Tonight I passed a couple of them, clearing the traps of this hotel, using a sieve on the end of a bamboo pole. The stinking grease is collected in the plastic barrels and then taken somewhere where it is rendered down, filtered and probably goes towards making fuel for the basic tractors that they run around here.

As I left the £60 a night, 5 star hotel, I spared a thought for the old man collecting cardboard onto his tricycle at the back of the hotel. I gave him the 8 empty beer bottles, which he gratefully accepted - with not a little incredulity. The 2 yuan that these fetch, will probably mean that he eats a little better tonight.

The minimum wage for registered workers in this area is 1000 Yuan (£100) a month. For those that have migrated from the rural areas and do not have the correct urban "hukou" registration papers - their chances of a minimum wage are totally non-existent - they are not recognised by the state and have no entitlements - a virtual slave class in what was supposed to be an equal Communist society. Hence their seemingly scavenging life, not only provides an essential service for the district, but provides for them a very meagre source of income. China provides no welfare safety net for the elderly, infirm or out of work. The Hukou system has effectively forced a two tier society of the waged and the unwaged. The rural migrants do not appear on any unemployment statistics and are thus effectively hidden from the official figures - however, they are very much in existence, and very much present for those who only care to look.

So when you buy your laptops, iPhones, iPods and solar panels from China - don't worry about the factory workers. They are the lucky ones working in relatively well paid jobs. Of greater concern is their parents generation, outcast in the 1960s by Mao's radical reforms, and in 40 years are still out of kilter with "modern" China, and will remain so until they work themselves towards an early grave.

A View of Modern China


For the last 4 weeks, I have been working out in southern China, helping out with production of a consumer telecom product.

I was staying in the industrial town of Fu Yong, which is very close to Shenzhen Airport.

During my stay there, I had the opportunity to write a few entries based on my daily observations.

These will now be reproduced in this blog over the next few days.

I have been traveling to southern China since 2000, and have seen the rapid rate of change over the last 10 years. My job takes me onto the factory floor of the modern electronic manufacturers and I spend time working with Chinese workers on the line.

As a design engineer, the move to Globalisation has meant that the products I work on invariably get manufactured in China. So in ten years, I have nurtured five products through the initial stages of manufacturing, solving design problems, testing for faults and generally ensuring that production goes as smoothly as possible.

Language is often a problem, but I have been lucky that I have generally been accompanied by an English speaking local engineer.

Life in 21st Century China is basic, but fascinating - as I hope the next few posts will illustrate.

Wednesday, March 24, 2010

Nano Technology


March has been a frustrating month - I feel like I have just emerged from an extended illness - and am now feeling a lot better.

In all truth, this is the case. For 2 weeks, from 5th March - I had a really chesty cold which refused to shift. Meanwhile, my old Toshiba laptop was going through its own strains of virus infection - which have proven almost terminal.

Whilst searching for some antivirus software, I accidently landed on a bogus website that automatically installed the "av.exe" virus. Within seconds a fake "Windows XP Security" window appeared and claimed that I had 29 viral risks. It then encouraged you to click on a register for upgrade window - which either wanted to harvest your credit card details, passwords or get you to enter the Product Code - supplied on every legitimate copy of XP.

If you didn't choose this option, it sent very irritating popups every 30 seconds telling you that your machine was at risk. Enough was enough - this malware had to go. So I googled "av.exe virus" and got on a forum discussing how to remove it. However, the av virus was a robust little bugger, and if you just delete the av.exe file, it trashes your registry, so you cannot run any application that uses the .exe file extension. This I found out to my cost. After much gnashing of teeth and tinkering in the registry, I finally got shot of this plague - took me a whole day to get things back to normal.

However, the old Toshiba was running as slow as a 1 legged arthritic dog - so I bit the bullet and treated my self to a new Dell Inspirion - which I am typing on now. It turned up an hour ago, having been sent direct from Dell's manufacturing plant in China - just last Friday. 5 days shipping from China - direct to your door. That is one of the signs that we live truly in a global village.

So I now have a machine that I can host my electronic CAD software on - and get back to doing some real pcb design. In the meanwhile, I have a couple of projects that seem to be following converging paths, and I am looking for an efficient means to use one to solve the problems of the other.

I have been writing an application in C code - and trying to learn C, on the job. About 10 years ago, I borrowed a book from a software friend "Learn C in 21 Days". Well that was about 3650 days ago, and I'm still at the steep point on the learning curve.

From my previous posts, you may know that I have become a fan of the Arduino, and this has been the catalyst, and catapault for me into the exciting world of embedded C programming. For about 10 years I had plodded along with PIC assembley language, preferring to build on code that I had written years before whilst working on telecom products. I never could find the time or justification to switch to C, especially if the job just needed a few lines of assembley to make it run. However, I was finding that I was rapidly running out of steam and my ideas and projects were limited by the fact that writing code for them was just too damm hard. So when the Arduino came along, complete with an online army of code developers who shared their applications and techniques in a big open source "code-fest", I found it a lot easier to rapidly make inroads into C, and develop applications much faster. Whilst I had toyed with the CCS C compiler on the PIC a few years ago, I never really got past the "Hello World" stage.

So, onwards and upwards into the wonderful world of the Arduino, which brings me back to the title of this post. Armed with my new shiny laptop, it was time to buy some replacement Arduinos, as I was down to my last one, and I wanted to upgrade to the Mega328 mcu. So on browsing the Nuelectronics site, I saw that they had the Freeduino Nano for sale for a mere £16.50 complete with the '328 processor. So I settled on two, plus a '328 Decimeillia as a hot spare for the one that I'm developing code on at the moment.

The Nano makes a lot of sense, with its smaller footprint, upgraded processor and a connector pattern that is not only more logical, but not blighted by the stupid connector position error made in CAD some years ago that makes it down right awkward to prototype on Veroboard or breadboard. The Nano has a very compact footprint that will fit into a 28 pin 0.6" DIL socket. It has the added advantage of bringing out another couple of analogue inputs, and uses the much smaller micro USB connector. If only they had had the foresight to put a microSD socket on the back of the board, then it would be a great little engine. Perhaps I'll just have to do my own.

So the Nano is going to play quite a part in future projects. I want to port across a lot of my telecom signal processing routines that I wrote for the 16F PIC. These allow caller ID recognition in firmware and DTMF encoding and decodng, plus a completely soft V23 FSK modem allowing mcus to communicate across phone lines in SMS with very low overhead. Perhaps a bit outmoded in this broadband world - but there are lots of trivial applications where you are miles away from an ethernet connection, and have a few short messages to send.

So one of the first designs I'm working on is an application extender board for the Nano. It's a single eurocard that provides analogue inputs, for temperature or voltage sensing, buffered digital outputs for driving relays or stepper motors, an LCD or keypad interface (Nokia 3310 LCD shield from Nuelectronics) plus some SD memory for datalogging. The applications are for renewable energy monitoring and a wood gas generatore spark ignition and engine control product that I have been mulling over. Inspired by Martin Nile's excellent site:

http://sites.google.com/site/martinnile/

Well Windows Explorer doesn't seem to allow cut and pasting of text - how lame is that? Time to load firefox and dump this Windows crap.

To be continued - under a new regime. Mozilla Firefox. And yes I do want it as my default browser...

At this point Ken downloaded Firefox 3.6.2 and continued life almost normally....

Ok - so windows Internet Explorer really does not allow Ctrl C and Ctrl V. Thank god for sensible software!

So back on the subject of Nanos - here's an even smaller one - just a real shame that they have chosen a different pinout

http://www.gizmodo.com.au/2010/03/the-incredibly-arduino-nano-3-0/

Saturday, March 06, 2010

A Change of Tack

My week out in California has got me fired up again on wood gas. Converting the Lister engine to run directly on wood gas and see it perform so well has given me the assurance that wood gas can be made to work for small scale heat and power production.

In the last 5 years I have slowly established an experimental CHP system based on the Lister 6hp diesel engine. Until now, this engine has run on waste vegetable oil, but with WVO getting more difficult to obtain, I realised that a substitute was necessary. The CHP system is located in my garden workshop, known as the "Energy Shed" and the heat and power is brought back to the house via underground pipes and cables.

Following the success in California, it's now my intention to set up a complete wood fired CHP system to heat and power my house. Woodchips are generated as a waste product from tree surgery operations and so there is a glut of this material produced with no real market. Wood chips can be gasified to make a flammable gas to substitute for the WVO fuel for the Lister engine on my generator set. This will produce more than sufficient power to run the house, and the waste heat will be used to provide heat for the house.

A quick calculation suggest that 1 tonne of woodchips will be needed each month of the heating season. This is about 4 cubic metres of chips, which can be stored in a bunker at the front of the house. A converted wheel barrow will be used to transport up to 300 litres at a time, down the side path to a smaller bunker near the workshop holding enough for about 3 days operation. This is defined by the limited access to the rear of the house - everything has to pass through a 3 foot gate and down a narrow path.

A 200 litre drum full of chips will provide sufficient energy to run the Lister engine for about 10 hours. Spare electricity can be stored in the battery bank to run my inverters, or converted to stored heat in night storage heaters. Spare heat will be stored in a 700 litre thermal store, located in the workshop. This will hold about 60kW of heat, which is sufficient to warm the house overnight, and can be topped up from spare heat from the wood-burning stove.

The Lister will be run from about 8am till 6pm, and with adequate silencing and in an acoustic box, should not cause a distraction. It's a Startomatic generator, which can be remotely started. By retaining the diesel injector, it can be started on WVO, switching over to woodgas when the gasifier is fully operational and producing clean gas.

Waste heat from the engine will be used to dry the woodchips, and pre-cook them using a process called torrefication. This pre-chars the chips, driving off water vapour and volatiles, which improves the gasification process. The intention is that the Lister and the gasifier will work in close harmony, where waste heat is exploited in order to maximise the system efficiency.

The 200 litres of chips should produce 25kWh of electricity and 60kWh of hot water. As this household uses about 7.5kWh of electricity per day, the surplus can be used for heating the workroom and workshop.

Saturday, February 27, 2010

Knock on Wood

The observant amongst you will notice that most of my posts are named after song titles. This one is no exception. I have just returned from a week long odyssey to All Power Labs in Berkeley in Northern California to learn all about running engines on wood.

All Power Labs is based at "The Shipyard", a kind of creative artists community workspace, based in a couple of industrial units at the south end of Berkeley. They have a well equipped metal machining workshop with big machine tools and a metal fabrication shop. The artists share the facilities and develop great mechanical art projects such as the "Neverwas Haul" (pictured above) which attend festivals such as "Burning Man". Anyway the Shipyard is a very cool place - and I was lucky enough to hang out there for a week, and sofa surf.

Wood can be converted to a flammable gas, by a process known as wood gasification. The woodgas is then used to fuel a converted internal combustion engine. The technology to do this has been around for over 100 years and it was extensively used for running vehicles during WW2 - as documented in the recent book "Wartime Woodburners".

The aim of my trip was to learn how to make the technology work - so I could then set up a similar system in my Energy Shed and derive most of my household heat and electricity from waste woodchips.

So I flew out to San Francisco and crossed the bay to Berkeley - home of All Power Labs (APL) and the GEK gasifier. GEK is shorthand for Gasifier Experimenter's Kit.

APL is the brainchild of Jim Mason, a self taught gasification guru. When the city of Berkeley authorities tried to evict the artists from the Shipyard, they cut the power supply. Jim and his colleagues took the Shipyard offgrid with solar and diesel power and so they could remain operational.

Looking for an alternative to expensive diesel powered generation, Jim and his team re-discovered old studies on wood gasification and so the GEK was developed.

Over the weekend of 19th to 21st February I attended the Gasification Workshop, with 60 other delegates from all over the world. The workshop was hands on experience in working with the GEK gasifier, and other system components.

The fuel for wood gasification is just chipped wood. This drum load was made in a few minutes by running some old pallet planks through a wood-chipper. This sort of material can be obtained from tree surgeons who make so much they can't get rid of it quick enough.

During the course of the weekend we converted a Lister type diesel engine to spark ignition so that it could be run directly on woodgas. The conversion consisted of fitting a long reach spark plug in place of the diesel injector and devising a spark ignition circuit. A new pair of copper head gaskets were made using the CNC plasma cutter, and these were used to lower the compression ratio down to about 13:1.

The ignition circuit was made from an Arduino and a car ignition coil. A Hall effect sensor was used to detect a magnet on the flywheel, placed a few degrees before top dead centre. The Arduino was used to create the correct timing delay and fire off a darlington power transistor with a multi-burst spark.

A friend in Michigan had made a special wood-gas carburettor, which allows the air and the wood-gas to be mixed in the correct ratio. This fitted right on to the air-intake of the Lister engine.

By the Sunday evening we had the Lister running - in fact amazingly it ran first time without major adjustment.

There's a couple of Youtubes showing the conversion. In the first one, I explain to a small group of people what we are going to do and the second one, shows the engine running.

http://www.youtube.com/watch?v=lXPn5Nov9Fg

http://www.youtube.com/watch?v=kXX2GBHoeuo&feature=related

Tuesday, February 09, 2010

Keep the home fires burning


Freshly emancipated from my job in the city, I have reverted into suburban Victorian mode.

The 3 hours not spent battling with commuter trains are now either spent asleep or doing something useful.

This year we have had the addition of a wood burning stove and backbolier in our living room. This helps keep the core of the house cosy and offsets the amount of gas that we use. However, it must be stated that keeping a woodstove stocked with wood can become a distraction to other activities, more a labour of love.

Whilst man has been using wood to keep warm for millennia, there is a certain amount of skill needed to use it efficiently. Open fires are notoriously inefficient, and even some stoves have much to be desired. In the 21st Century, new wood based fuels are becoming available, and some of the mechanical handling associated with wood fuels can be automated. For the moment, I'm happy and contented to lie on the heath rug and gaze into the embers. Here's a few notes on how I keep this one burning.

Whilst you can just go out an buy a load of logs from numerous local log merchants, the quality is often dubious and you will need somewhere dry to keep them whilst they continue to dry out. Logs are often supplied quite chunky - meaning that further splitting is needed to make them more manageable for the woodstove -- despite its 18" log-length.

Another source of wood is from waste constructional timber. There are many loft conversions going on in this area, and I happened upon a load of roof timbers which were being skipped in the next road - so I offered to liberate them for nothing. These are generally older than 40 years - and so are not contaminated with pressure treatment or wood preservative.

Having cut the longer lengths into 6' pieces, so that they would fit in the back of the van, I hauled a van load back around the corner. These timbers are a nominal 5"x2" but when they are sawn the size is actually about 47 x122mm. They are probably Douglas Fir, and are very dry - so split easily with a hand axe. They are however full of roofing nails and felt tacks - so have to be handled a little carefully with leather faced riggers gloves.

After getting them home, they need to be chop-sawn into a suitable size for the stove. My chop saw has an end stop at 250mm - so this determined the average sawn length. Each 6' timber was sawn into roughly 7 pieces, carefully checking the path of the blade for nails and tacks before committing to the cut.

Once cut, the 10" lengths are split with a hand axe into two, generally unequal parts. These "halves" will burn rapidly and release their heat quickly. For a slower burn, whole pieces are used.

Eight of these 6 foot timbers will provide enough wood for two 12 hour burns. If we are both home, and the weather is cold, we light the stove in the early afternoon and keep it fired until past midnight.

The process of cutting up and splitting the roof timbers takes on average 30 minutes including the time to get out the chop saw, carry the timbers to the cutting area and tidy up afterwards.

The box on the left contains 30 of the 10" pieces and weighs 22kg. This gives the wood an average density of 511g/litre, and I have seen these pieces vary in mass from 500 to 800g.

The calorific value of woodfuel is approximately 4kWh/kg so the box represents about 88kWh of energy. Unfortunately, a basic cast iron woodstove is not a particularly efficient converter of wood into heat - so roughly half of this energy will reach the occupants in the room, the rest will be lost up the chimney. This is however about twice as good as an open fire.

Wood can vary in moisture content, depending on how it has been stored, and different species have different calorific values and burn rates. Better stoves do exist, but what is needed is a change in the technology in order to get the most out of wood. This is where wood gasification comes in.

Wood gasification is the conversion of woody biomass into a mixture of flammable gases, which can be burnt at optimum efficiency in a modified stove or burner. Woodgas primarily consists of carbon monoxide CO and hydrogen H2, with small amounts of CO2, methane and half of the mixture consists of the inert nitrogen from the atmosphere. Woodgas varies in calorific value from between one eighth to one sixth that of natural gas. Wood gas can be used as an engine fuel for riunning vehicles, generators and other machinery. In principle, it should be possible to run a whole household heated and powered from woodgas. Well that's the plan.

Next week I travel to Berkeley, California to learn all about wood gasification and how to build wood gasifiers. There is a project planned to convert a Lister diesel engine to run on wood gas using a spark ignition conversion - so that's what I'm hoping to do, learn how it's done and bring the technology home.

Saturday, January 16, 2010

An Arduino's Not Just For Christmas - but for all in 2010


I've been playing around with Arduino's for just over a year, having discovered them whilst researching low cost computing tools.

How can a little microcontroller board like this become a life changing device?

The Arduino is a classic case of something which exceeds the sum of its parts. On one level, it's just a cheap, 8 bit micro built on a board with some I/O and an accompanying programming environment. On an other level it's a unique tool which brings open source computing and programming skills to many different communities and professions.

A low cost computing device, plus the backing of a huge online community has helped develop an open source product rapidly turning it into a successful phenomenon.

Online communities, and social networking groups are actively bringing people together who share common interests and have brought about changes in the way we work and the way we interact with other people and organisations.

In the last year I have become a member of three or more online communities, who all use Arduinos to perform various tasks. The Homecamp Community are interested in changing the way we use energy in the home by way of increased awareness of our consumption. They also have an interest in re-purposing (hacking) consumer goods to give them modified functionality, or just for fun.

Through some of my Homecamp friends, I was introduced to the London Hackspace at an Open Source Hardware conference in early December. The guys from the Hackspace also use Arduinos, and are involved with other OpenSource projects such as the MakerBot. Last week, for one of their monthly meetings in London, arranged a beginners session for the Arduino at the Trampery - a "Co-Working" open office in Shoreditch.

In just over an hour, you learn how to blink an LED, use the Arduino to control the brightness of the LED, interface to a switch and control a process with an input from a potentiometer. The workshop was practical and hands-on, and avoided over-complicated lessons in the C programming language. These can come later for those who want to take it further.

Working, by necessity, in central London, comes the advantage that you are never too far from meetings at social get togethers. This was something I had failed to appreciate in the 20 years or so I desperately shyed away from London commuting. I now take the attitude that if i must travel up to London on a daily basis, I might as well make the most of the evenings up there, avoid the evening commuter rush and meet a few new people.

In addition, I use the Arduino at work as a development and prototyping aid, because its quick cheap and simple to get something up and running. Whilst I am not a natural programmer, I do amaze myself how quickly and with very little effort you can develop applications on this device. It's handy because of it's portability. Just plug into your laptop, wherever you might be, hot-desking or on the train, and you can spend a little time developing.

So, crystal-balling, for 2010, what new direction will this open accessible physical computing take us in?

Already the Arduino community are extending their programming environment and hardware to make larger more powerful microcontrollers available. A whole new community of non-programmers is being introduced to the C programming language and its unique ease of portability. The Arduino is being extended with Ethernet and web connectivity, and interfaced to mass memory and USB devices. Wireless connectivity through Zigbee, Bluetooth and other standard are making Arduinos portable and no-longer tied to the back of a laptop. The basic Arduino with web-connectivity can form the core of a monitoring and control system that can be accessed from a browser anywhere in the world, and from a variety of platforms, - soon you will be able to check your household electricity or gas consumption from an Iphone app. Arduinos are already tweeting information around the net. For the techie, the Arduino has laid the groundwork towards the £10 internet-enabled computing device is likely to appear sometime this year, in a form that can be built into many innovative products.

The Arduino or its successor- which I'll call Arduino 2.0 or Webduino, once coupled with web connectivity, brings firstly to the technical community, and later to the wider consumer market the enabling technology of microcontroller with always-on web communications. This combination of control and remote communications will find its way into many products and environments - and give further fanning of the flames to Web 2.0 - the Internet of Things.

On a larger scale, key companies in Shoreditch's "Silicon Roundabout" phenomenon, clustered around the Old St. tube, have recognised the usefulness of the Arduino and at least two are using it as part of their business. These organisations are getting together with other groups and offering starter courses and evening workshops - to bring the technology out to a wider audience.

So the humble Arduino, combined with social networking groups, new communications methods and the occasional meet-up in town can bring a whole new dimension to the life of the technical-curious.

Links to topics mentioned above

Open Source Hardware
Pachube
Homecamp
London Hackspace
The Trampery
Arduino
Tinker.it
Silicon Roundabout
Internet of Things (Wikipedia)

Here Comes the Rain Again!



Finally, after a month of cold, sub-zero snow and icy weather - we are now back to a state of liquid water.

Whilst in the south east, the thaw really started at the beginning of the week, Wednesday caught a lot of people out. Who would have known that just 1 or 2cm of fine powdery snow would cause disproportionate chaos on the roads and rail network.

I walked down to the station at 6am, in time to catch the 6:13 to Victoria. It was still snowing, and the combination of fine powder snow and the third rail electrical pick-up system used on the Southern trains, made for a commuting disaster area.

A layer of compressed snow was building up between the pick-up shoe and the conductor live rail. When the train tries to pull off, all you get is arcing and the traction computer goes into restart. After 3 false starts and loads of intense white arcing we finally got moving at 06:45.

However, because we were the first train north out of Redhill, we had 3 trains loads of customers on board - and it was breathing room only. To make matters worse, the train was only 4 carriages.

After a very uncomfortable 45 minutes on board - I got to London Bridge, where fortunately I almost immediately caught a South Eastern Train to Charing Cross. Fortunately because of my early start, I avoided much of the ensuing chaos as rush hour approached.

By the late evening the network was running well. I got a 23:12 out of London Bridge, and a 23:30 from East Croydon back to Redhill. I had had visions that I might be sleeping on the sofa at work, if 'd failed to get home that night.

By Thursday the big thaw was on, and by Friday most of the snow melted from Monson Road. I can now actually see my garden again for the first time in 10 days.

//rant on

The Council now have absolutely no excuse left why they cannot empty my bin.

Lessons need to be learned about how to cope in this unusual weather. Councils should be mandated to store 4 weeks of salt, every year. Schools should not shut at the first sign of a few snowflakes - on health and safety grounds. What do the kids do when it's snowy? Run around in the snow, chuck snowballs and go sledging. It's a lesson in life that we just have to chill out in snowy conditions, apply some common sense and just get on with it.

I suggest we withhold our Council Tax for the period of December and January - they certainly have done nothing to deserve it. No schools, minimum road gritting and bins that have festered since mid-December.

//rant_off

Wednesday, December 23, 2009

More thoughts on Boiler Hacking

I've set up a 4 channel thermistor sensor adjacent to my boiler and have been logging the temperatures of flow, return, outside and inside temperature for the last few days. I've taken advantage of the pretty cold weather to get an overall assessment of how the boiler performs under various conditions.

At the weekend the house was cold so I measured the time taken for the boiler to get the house back up to temperature. Now that it's hovering around the set point on the thermostat, I'm monitoring how long the boiler cycle periods are, and see if I can reduce the cycling by direct manipulation of the water temperature control pot.

I've also discovered a subtlety about my Drayton Digistat wireless thermostat. In order to save battery life, it restricts the sending of messages to every 4 minutes. So if the thermistor in the thermostat reaches temperature, the boiler off command is only sent when the next message is scheduled. The timing of these messages is probably derived from a 1 second interrupt from a real time clock routine running of a 32kHz watch crystal. The effect of this is that the boiler appears to turn on and off, exactly synchronised to the seconds counter of my PC clock - i.e. all on and off activity appears to be when it's 32 seconds past the minute.

The Worcester Bosh Greenstar boiler, has a 2 minute start up sequence. If the boiler is cycling on and off every 20 minutes, it means that it goes through 3 start-ups per hour. If it is possible to reduce the number of start-ups and the cycling, then some of the wasteful start-up period would be removed and the heating would be more efficient.

It would also be advantageous to introduce some hysteresis into the thermostat control. Although the set point might be 19C, the user is not going to notice if you turn the boiler off at 20.0C and back on again at 18.0C. The boiler will have a longer runtime, and less time will be spent repeatedly reheating the pipes and radiators.

As far as controlling the boiler, it should be possible to use an RC servo to turn the pot on the front panel. The temperature control should be turned to maximum for a rapid warm-up, and then backed off once the property is up to temperature.

By way of some figures. Yesterday morning was about 1C outside. When the boiler came on at 4:30am it took 3hrs 30 mins to raise the room temperature by 3 degrees, and in the process used 46kWH of gas (£1.50 worth) and the room was still chilly. The boiler was restarted at 1pm and then only used a further 130kWh to keep the temperature maintained for the next 18 hours.

Saturday, December 19, 2009

Towards the Hackable Boiler?


This post is the result of some discussions I had last Thursday at the Homecamp Christmas Party, with Paul Tanner and Mark regarding the feasibility of hacking the home heating system (in a safe, benign kind of way) to see if it is possible to make it better featured and return improved efficiency over the existing time of day and thermostat type controls that almost every central heating boiler employs.



Whilst a lot of people are now monitoring home electricity consumption - because it's cheap and easy to do, I thought I'd take on the challenge of monitoring my gas consumption and to try and link it in with a thermal model of this 1905 brick-built house.

Home heating is becoming increasingly expensive, and will continue to become more-so as we get even shorter of natural gas reserves. What I want to do here is analyse my domestic heating system to see if there are scopes for big savings. My electricity consumption is already fairly low - so there may well be an better opportunity in focussing on gas.

I have suspected for some time that it is more efficient to leave the heating on 24/7 at a low heat in an old house like this, and get the thermal mass of the brickwork thoroughly warmed through. It was now a good opportunity to try and prove that theory. I now have some temperature sensors and know enough Arduino code to be dangerous, and with the snow lying around outside, now was a good weekend to get some data to try to prove the point.

The first thing to assess was the availabilty of suitable inputs and monitoring points on the boiler to allow it to be monitored and controlled. Most boilers have a simple on/off control that is wired out to the timeswitch and thermostat. The timeswitch brings it on at a certain time of day, it keeps heating the rooms until the set point on the thermostat is reached, and the thermostat turns it off. Simple on/off control.

About 10 years ago, boilers started to get a little more sophisticated, - they had to, in order to cope with the control demands of the condensing mode heat exchanger. Boilers now have thermistors to monitor the flow and return temperatures and a variable speed fan and modulating gas valve, to ensure that the boiler can react to sudden demands and always combust the gas at the best air/fuel mixture. When your burner, rated at 24kW is only the size of a 5 litre paint can - you have to be fairly much in control of the air/fuel mix. Additionally you need to turn the power down such that the water returned to the boiler after heating the radiators is sufficiently cool enough to condense the water vapour in flue gases, and thus recuperate the heat of vapourisation/condensation. This is how condensing boilers manage to achieve efficiencies of about 90% when running correctly in their condensing mode.

So firstly a quick monitor of the boiler flow and return temperatures. I had some pipe clip thermistors from Rapid Electronics, which I attached to the flow and return pipes. As it's close to freezing this weekend, and the boiler is on almost 24/7 right now - it's a good time to observe the heating cycle. The plot below shows flow and return temperatures over a 3 hour period. The boiler had been struggling to get the living room much above 17C, so the first thing to do was see what the respective temperatures were before and after I turned up the water temperature control knob on the front of the boiler.

The traces are the raw count output from the thermistor ADC channels - but for the purpose of understanding, just divide by 1000 to get approximate water temperatures in degress C.

First I let the temperatures stabilise for about 50 minutes before turning up the heat control on the boiler. The red trace (the flow), shows a near immediate rise, as the boiler adjusts its combustion power to increase the flow temperature. The blue trace is the return water temperature that has circulated around the radiators and underfloor heating and its response to more heat, was a more sluggish response. This is because it takes time to heat up all those rads and pipework to their new elevated temperatures and this is characterised by the rounded, almost exponential rise in the blue trace in response to a near instantaneous step change in the red.

After the traces had stabilised at their new levels, I then decided to turn on a radiator in the front room that had previously been shut off. This corresponds to an increase in heat demand or thermal load, and quite expectedly, the return water temperature fell by a few degrees as the cold water in the dead rad, was now circulated back to the boiler. What I hadn't fully appreciated was the accompanying drop in boiler flow temperature - as I thought that the boiler would quickly modulate it's power output up to match the increased thermal load. Instead it was the flow temperature that showed a slow rise back up to the 51000 asymptote. Finally I decided to go for another boost in the heat control and this is shown by the final step up in the red trace, with the accompanying slower exponential rise in the blue trace.

So what can we learn from this chart.

1. The flow temperature is controlled so that it runs at a few degrees hotter than the return temperature.
2. The boiler responds rapidly to demand changes made on the control knob on the front panel of the boiler.
3. There is an appreciable thermal lag associated with having to raise the temperature of the pipework and rads up to the new temperature.
4. A sudden change in thermal load such as a cold rad being turned on (or a zone valve or DHW valve) will cause the boiler flow temperature to drop and slowly climb back to the original level.
5. For a given position of the front panel water temperature control, and a given circulation pump speed, the boiler can only produce a certain heat output. If the house is losing heat to the outside (on a cold day), the boiler might not be capable of reaching the room temperature as demanded by the thermostat - unless you turn the wick up a bit, by manual intervention on the heat control. This was proven over the last couple of days when the boiler struggled to get the living room above 17C.

Other Observations - made over the last few years whilst messing with the heating controls.

1. Older houses leak heat very easily. The amount of heat needed to keep them at a constant comfortable temperature, is directly proportional to the temperature difference between the outside temperature and the temperature you set the thermometer to.
2. it has taken the boiler about 2 hours to get the living room up to temperature (19C) and this was only as a result of turning up the heat control. The boiler has now entered a kind of cycling mode, where it ticks on and off about every 10 minutes. This is bad, because it gives the water in the pipework a chance to cool down, and the boiler has a 4 minute start up sequence. This is the boiler equivalent of stop-start driving in traffic - wasteful in fuel. So it must be possible to hack into the boiler heat control potentiometer so that it can be set exactly at the right setting to balance the thermal load and heat loss from the house - so the boiler doesn't keep cycling.

In the case of my house, where I have nearly 10 years of gas readings, I have found the constant of proportionality to be about 6kWh of gas consumption per day, for every degree difference. So if I set the thermostat in the living room to 19C, and its averaging 9C outside, the boiler will consume approximately 60kWh of gas in a 24 hour period.

If like over the last few days it's close to freezing outside, the temperature difference is closer to 20C, and so you will consume more like 120kWh per day in order to keep the house at the same comfortable temperature.
2. Somewhat contrary to expectations, I believe that in an older property that it is better to leave the heat on low 24/7 as this uses less gas than trying to heat the house for a few hours in the morning and at night.

So the next thing to do is to capture some data of room temperature and outside temperature and tie this in with the boiler behaviour. This will need another couple of thermistors wiring into my sensor board - and probably a move to using the Arduino as the sensing and control platform - mainly because its easier to try things out quickly than having to edit PIC assembly code.

Future Requirements.

I'm currently using a little PIC16F88 to read the two thermistors and send the readings plus a time stamp out to the PC using an FTDI serial lead. I built the PIC board onto some stripboard a few years ago as it was intended to be a wireless temperature sensor, so it has a Telecontrolli RT4 433MHz transmitter module on it and a couple of connectors to add thermistors and radio control servos - as I thought I would be using this board to open and close radiator valves. It's a handy little board, which predates any of my Arduino stuff by 5 years.

So in order to progress further with this investigation there are some extra things needed. I already have the flow and return sensors logging on a second by second basis. I now need to extend this to include a room temperature sensor in the living room and an outside air temperature sensor. This could easily be done with the Arduino, which could probably be embedded inside the control box area of the boiler, in such a way to share the boiler's low voltage DC supply. A protoshield would include the interfaces for the 4 thermocouples, an on/off relay for firing the boiler on and off and an analogue PWM voltage output to over-ride the heat control potentiometer. If I include 433MHz wireless Tx and Rx modules on the protoshield, I can get wireless temperature data out of the boiler and use the receiver to intercept the boiler on/off signals from the Drayton Digistat wireless thermostat - but I suspect that will shortly will be redundant. A USB socket on the bottom of the boiler will allow me acess to data output and to re-hack the Arduino code as new ideas arise.

According to the digital thermometer outside, it's currently -2.7C out there - so no wonder the heating has been struggling these last couple of days.

I can probably extend my little PIC board to read another couple of thermistor channels, so that the serial output of this board can be read by hyperterminal and graphed in XL - as how I have been doing it so far. However it would be good to get more practice in on C programming the Arduino, and this sort of project is ideally suited to it.

There is also the question of hacking into the water temperature control pot on the boiler. Recent boilers use either an analogue voltage control (0 - 10V) or an open protocol called Open Therm (OT) to allow them to be controlled remotely from other systems or devices. I suspect that I will first use an Arduino to generate an optically isolated PWM signal, which drives the potentiometer input.

Friday, December 18, 2009

Simple Displays and Homecamp



As part of a quick hack for the homecamp Christmas party competition, I put a few (42) different coloured LEDs onto a bit of stripboard - in the shape of a Christmas Tree. The LEDs were clustered into groups so that different parts of the tree could be individually driven.


As it was a 2 hour mega-rush-hack my addressing scheme wasn't the best thought out, but I did have the means to light up each of the tree branches individually, light up the star on top, plus the pot and stem as separate items. Having wired it up to the digital outputs of a spare Arduino and hacked a few lines of code to animate it, I was struck by the simplicity of it and the effective way that it could be used to convey simple information. It certainly comes alive after dark, with the previously almost invisible pea green LEDs contributing to the effect. These were a bit of a mistake - but I didnt have enough of the brighter blue-green ones and even connected in series it shows how efficient the blue-green ones are by comparison.

The green branches could be used in a sort of bargraph manner to show rising temperature for example, or as it was a Homecamp party, using the segments to show trends of energy usage would make a very appropriate application for it.

This sort of display is very easy to drive from a few lines of code, and is ideal for applications where numerical information is unnecessary. If this was a room thermometer or thermostat, for example, which progressively lit up over the temperature range 16 to 24C, a quick glance at it would be sufficient to tell you whether the room was on the cool side, just right or over heated. The nature of the display is that it's easily visible at the 3 to 4m range, which is good for most peoples room dimensions - and it doesn't mean you have to get up and peer at some tiny LCD thermometer digits to get an idea of room temperature. LEDs are cheap and easy to use - the whole thing could be built for under a pound, add a microcontroller, and possibly my micropower 433MHz transeceiver - and you have a wireless visual thermometer which can measure the room temperature and chirp out boiler on and boiler off commands to the 433MHz thermostat.

With a knowledge of the current cost protocol, it could be used to display household power usage - possibly rewarding you by lighting the star on the top of the tree when you are an "energy star".

Other uses are as an annunciator device to inform you that some event has happened - such as a distant relative logging into a chat program for example, or as a visual reminder, that something needs doing.

Whilst christmas trees may be seasonal this week - they will be somewhat forgotten about in a couple of weeks, but the concept of using a brightly animated LED display to convey trends or events is a lasting one.

A very short clip of the tree, with simple flashing firmware is on youtube:

http://www.youtube.com/watch?v=GeUvDwwX3-U