Browsing Posts published in March, 2013

The sun is shining! 30/03/13

Holy Crow!  What’s that beautiful yellow thing in the sky?!

Quick!  Gardening gear on, boots fully laced!

(…And as a Party-Bonus, Ian (no relation) is bringing down some of his awesome beef stew and new potatoes today!..)

 

Doing it properly.

On Wednesday, I went down to Maplin’s to get just a couple of really, really pratty push-buttons that with only minor tweaking can be made to fit into standard 0.1-inch Veroboard.

Armed with these, I hurried home, and because the session down The Plots was cancelled what with the awful weather and all, I popped the kettle on, and planned my next attack on this little i2c board.

And the next attack just had to be those inputs I mentioned last post.  I could hear the board, laughing at me, challenging me to solder up the two buttons and go for it.

Well, I can report good progress on Wednesday and Thursday afternoon/evening!

By last night, I had it so it not only showed the correct time, but when I pressed one, or both, of the buttons, the corresponding LED’s would light.  I’m not saying it was easy -it wasn’t, but I finally managed to get the i2C to read the values of the buttons into the main PIC processor.  The only ‘problem’ (…if you could call it that…) was that I was doing this by polling the input pins every few milliseconds, then displaying any changes as they happened.  So yes.  It worked, but not properly.

This morning, after the usual chores, I sat down again with a fresh cup of tea, deciding to do it the right way.

The right way, is to have the little input/output chip produce an interrupt when a button is pressed.  This interrupt then temporarily stops the processor from what it’s doing -namely displaying the clock.  In the interrupt service routine, the i2c chip is then read, the processor then does a little magic to get the numbers right, then whacks it back out on the i2c bus, this time writing to the chip to tell it to display on the LED’s.

Now, this all sounds terribly simple to do, but really, it isn’t.

Anyway, long, boring and tedious story shorter: It now FULLY works.  With interrupts!

Yes, you press a push-button, and the corresponding LED comes on, and yes, you could do that simply with a switch.

But that’s not the point!

The point is that I’ve managed to get the i2c reading and writing and interrupting the PIC when something happens.

(…mutter… …mutter… …mutter…)

Onwards and upwards!

What’s next?

Why, another cup of tea, of course!

Sunday and Monday, it’ll be that cute new LCD panel I bought the other day.  It’s sat in my drawers, laughing at me.

Ha!  I’ll have you, you little swine!

…to LED clocks.

After that last posting last night, I bit the bullet and went for it.  After all, I’d got the RTCC showing sensible numbers.  Why not make it show correct numbers?A few minutes ago...

To the right here is a photo I took of it just a few minutes ago.

Well, 5:03pm, to be precise!

The little blue board towards the bottom of the shot, sat on a piece of white card, held on by black insulation tape, is the RTCC, joined to the main board by that thick piece of black wire.  That’s actually four-core flex, so it carries not only the SDA and SCL lines I mentioned yesterday, but also the +5 volts and ground connection.

You’ll also notice that none of the LED’s are lit tonight.  This isn’t because that bit of the circuit has broken:  Far from it, it’s working too well, in that the LED’s are too bright to work around!  Trying to focus on something when there are little green dots in your eyes is a little off-putting!

When I came to check the time this morning as I switched my computer on, it disagreed with the computer by about four seconds, until the computer logged into time.windows.com for Internet time, then the two agreed completely.

It works -better than my PC clock!  Whether it will still work up at The Plots, given the extremes in temperature, and being kicked around in the top shed, well, we’ll have to see, but so far, it’s looking good.

The little chip about halfway down on the right hand side is the MCP23008 i/o chip that was controlling those LED’s, while the big black one towards the bottom is the PIC.

Now, this MCP23008 is an 8-channel device, and I’ve only used four of the pins as outputs for the LED’s.  This means I have up to four spare pins, which I’ll be using shortly to make the input circuit I mentioned last night.

All good, harmless fun!

More soon…

From flashing LED’s…

No photos tonight, I’m afraid.  The camera battery is flat, and anyway, in this light, they probably wouldn’t have come out.

So you’re going to have to take my word for this…

After long, long hours of head scratching, and moments of seeming madness, I’ve finally cracked this i2c lark.

Saturday’s missive was all about how I’d managed to write data down the i2c bus.

As it turns out, this was the easy part.  Apparently, even my cat could have done it, if he’d been bothered.

Getting i2c to receive coherently and on time is apparently quite a big beef amongst the electronics fraternity, and Microchip -the makers of the PIC’s I’m using, haven’t done themselves many favours. Briefly, the way they’ve implemented it is, well, decidedly pratty.

A very long and boring story shorter, but just suffice to say I’ve now got the little board you saw on Saturday not only flashing the LED’s if I want to, but I’ve whacked on an RTCC (Real Time Clock Counter) onto the i2c bus too.

The input/output chip and the clock are quite happily sat on the same two lines (SCL and SDA if you’re that bothered), because they have different i2c addresses.  Before you talk to a chip, you have to give it the right address, which kind of makes sense.

SO, I’ve now got that same board, and you’ll remember it has those four displays left over on it.  Well, these are now coded up so the display simply reads minutes and seconds from the RTCC.  I haven’t set the clock properly, so the numbers are pretty meaningless, but the fact is that even if I completely unplug the board to switch it off, this little clock keeps on ticking -in much the same way as your PC clocks does when you power it down at night.

So, when I come to switch it on again, not only has the clock advanced, but it’s advanced properly to show the correct minutes and seconds that it was when it was on previously.

I guess I’m not explaining this very well, I guess I’m a little tired, but I’ll get some proper photos tomorrow to explain.

Hells, I may even set the clock properly so it shows the correct time!

The next job will be to work with that little input/output chip to get it to input, rather than simply lighting LED’s.

This shouldn’t be quite as difficult as today’s marathon effort, but I have the added ‘fun factor’ of having to set it up so that a button press will interrupt the processor.  This will then send out a command to find out just which button was pressed.

Why?

Well, this vastly saves on processor time.  Rather than the processor having to ‘poll’ the inputs every few milliseconds, and all the bother that entails, this way, it’ll only do something when it’s interrupted.

There’s even a possibility of being able to ‘wake’ the processor from ‘sleep mode’ with a button press.  This then does away with a whopping great on/off switch -it’ll just be a button press to turn on.  …Maybe, we’ll see…

I guess it all sounds dead simple, but take it from me -it’s not!

This is One Tired Wardo, signing off!

Ladies and Gentlemen…

…And cats.

At about midday today, there was great jubilation here at Wardian Towers.

Yup, you guessed it.  I got a couple of LED’s to light.Two LED's.

‘No Big Deal,’ you may think.  ‘Surely, a switch and a battery would achieve the same thing?’

And you’d be dead right.  ‘Why use microprocessors and the ‘C’ programming language, when all you need is a switch?’

Ah, but there lies the rub.

Those two humble (…but very, very bright…) LED’s are being controlled by the black chip just down and to the right of them.  For the more technically minded, it’s a Microchip MCP23008e i2c input/output chip.

However, the key bit of that information is ‘i2c’.

After what seems like years of half-heartedly trying to ‘get into’ i2c, then giving up, I’ve now finally achieved i2c communication across two chips in the programming language ‘C’.

Even though I’d studied it extensively with Bang & Olufsen many years ago, I’d never built and programmed an i2c system from scratch until this lunchtime.And the other two lit!

The proof here is to the left.  I changed one byte of information sent to the MCP23008, and the other two LED’s are now lit.

Okay, not earth-shattering in itself, but you may remember my excitement all those years ago when I got my first ever LED to light when programmed from a PIC?

The same feeling, but better.

These four little LED’s now pave the way for the really fun stuff as I whack the RTCC (Real Time Clock Counter) into it. This will then tell the PIC the exact time and date whenever it switches on.  This paves the way for ‘workouts’ on the bike to be correctly time and date stamped, so I’ll know just how much was put in, or taken out, of the battery over a given period.

Then, I’ve got the excitement of adding the cute little LCD display panel that also runs from i2c.  Different chip, but same protocol.

So, you can see, Dear Reader, things at Wardian Towers are moving forward.

…Even if the weather isn’t!

Ah.  That’ll be snow, then, will it?

Towards the end of March, there’s about a foot of it on the ground, and apparently there’s more to follow!

>sigh<

So, no Plotting for LEAF today, but I’ve been more than busy doing dead fun stuff.

(…well, it is for me, anyway…)

I hope there’ll be more in this column when/if the snow melts!

Well, it may look like our site has been run over repeatedly by a mechanical digger, especially the top Plots, but that’s just Gary.  He’s our very own ‘JCB’, and today he carried on with more clearing and weeding, and now, from the road, the site is starting to look a little more loved.Cleared!

It’s funny, but we’ve had loads of comments, both from passers-by, and from other allotment holders who really can’t believe the difference we’ve made just since the start of the year.

Yes, it may look like it’s all just ‘scorched earth’ at the moment, but in a few weeks when all we’ve planted starts to show itself, we’re hoping it will all be a complete riot of colour and shape.

What you can’t really see from that last photo is the immense difference that taking down the jasmine has made.No jasmine!

Here you can see the remains of it from a different angle, looking out onto the main entrance path.

Just a few days ago, this was all totally overgrown, with a couple of dead roses, a huge bramble, and all other kinds of detritus that was choking the life out of everything.

Now, thanks to Gary, this area in a few days will be ready to plant proper rose bushes, and we may have a small jasmine as well for the scent.  It won’t, however, be allowed to completely swamp everything around.

So today has been fairly quiet down our Plots.  Still, this is not really surprising given the weather being like the middle of January, but those who did turn up to work were rewarded by a hot lunch in the shed (soup), the inevitable Plot Tea, and Classic FM in the background.  I still have to shake my head at just how this has all turned round so quickly, and it’s a big ‘Thank You’ to all the volunteers who got stuck in and made it so.

Of course, no day at The Plots would be complete without a visit from our Honorary Vice ChairCat, Mitzi-Moos.Vice ChairCat, Mitzi

This was her last Thursday -we certainly had no sunshine today!

Today, after being fed, she spent most of the day either watching (…and directing us…) at work, or catching some sleep in ‘her’ greenhouse.  Bless!

…Anyway, there’ll be more ‘Tales From The Plots’ very soon.

Planting and a meeting. 14/03/13

The new gas regulator for the bottled gas heater arrived the other day, and today it was put to good use.

Since Diane has been away poorly, we’ve been having the monthly management meetings at Julie’s house, but this time, Ian suggested we have the meeting down on The Plots.

What a great idea!

So, rather than mess an entire evening up with traveling, we held the meeting after our regular Thursday LEAF session in our ‘new’ wooden shed.

Yes, I know the shed isn’t strictly speaking new, but it’s the first time we’ve been able to properly use it for exactly what it was intended for: A place for having meetings.

Unfortunately, Cyril, our secretary is laid up with a poorly foot, but myself, Ian (no relation), Julie and Sara all sat around the table in the shed and talked ‘LEAF Business’.

And it was brilliant!

Meanwhile, Pam was hard at work planting beans and peas in our greenhouse in little pots for later transplanting out, and we noticed that the sweet peas some of the Plot Kids had planted a couple of weeks ago were just starting to show their first shoots.

Gary and Jon were also hard at work moving a load of soil from by the main entrance into the bottom of one of the new beds, so even while we were all ‘yakking’ away in the shed, hard work was being done.

Anyway, I’m going to be brief tonight (…’Yay for THAT!’ someone shouts…), but there’ll be loads happening on Saturday which I’ll be sure to Blog on my return to Wardian Towers.

Chat with you then!

Second Box? Collected!

Yesterday, Phil from Trade Base came over to pick up his shiny new Electric Bike Box from us.

Okay, so it’s only months late, but as he himself admitted, they didn’t have anywhere secure to store it until a few days ago.

In the meantime, I’m working on the mkII version of ‘The Box’.

This version does away with all the confusing 7-segment displays, and makes do with a single larger LCD display.  At the touch of a button, this will show what the rider needs to know, but more importantly, because the display unit is almost self-contained, it relieves the main processor of all the work of updating all 20 7-segment displays.  All this unit needs are four wires to connect it to the processor -all the communications are handled serially via I2C.

I’ve also got a ‘Real Time Clock Counter’ on order from eBay as well.  This will mean the unit knows what time it is, and even what day of the year it is.  Again, this communicates via I2C.

If, like me, you’re of the ‘Propellor Head’ persuasion, you’ll find this pretty exciting.

More news as it happens…

Oh, we happy, happy few. 09/03/13

Last night, the weather for the next few days was set to be awful, and for today, at least, it really was awful.

BUT, this didn’t bother us!

I mentioned last post that I’d get some photos of the inside of the top wooden shed, and today there was loads happening in it, so I’ve got the photos.Eating in the shed!

But in all the excitement, I’m getting a little ahead of myself here.

This morning, Jon very kindly gave me and the ‘Box’ for TradeBase a lift over to The Plots, and we arrived well before 10.00.  While Jon went down to his own plot, I opened up the sheds and got the trusty Kelly Kettle out for the first brew of many.

I set up the Box and wired up a few lights in the top shed, then Ian arrived, soon to be followed by Gary.

Gary had been threatening to replant the saddest of all sad pear trees from a horribly tiny little pot into a bed just cleared on the Orchard Plot, and you can see it in its new home here.New home for the pear tree

The light brown ‘dust’ you can see in this photo is the blood and bone meal fertilizer that he spread on the ground after planting.  Of course, he put a good few trowel fulls in the hole he’d dug for the tree.  As this is ‘slow release’ fertilizer, it should give the tree plenty of food for at least a season, possibly longer.

Meanwhile, Ian found a wicked-looking billhook with which to attack the huge honeysuckle that has been threatening to take over one of the top Plots for years.  Gary soon joined him, and the pair of them spent well over an hour carefully hacking away to remove a couple of vast brambles and some well-dead rose bushes.

The result?  Check this out:-Honeysuckle no more!

Don’t worry, though.  Ian and Gary have four or five ‘runners’ that it had sent out, and these are now safely, temporarily healed in in a spare bed nearby.  Yes, I know it looks like this area has been devastated, but give it a couple of months and some sunshine, and this will be back to a much more manageable size, and as I said, we’ve got those runners to plant along some chestnut paling further down near the greenhouse.

As promised, Matt had brought one of his fabled stews today, so we thought we’d all properly eat up in the top shed where we’re meant to eat.  This is rather than shivering out on the benches getting slowly drenched by the ever-present drizzle.

Sara had bought some fresh bread, so as you can see by the first photo, after a hard day’s grafting, we enjoyed a proper meal, all sat round a table, inside whilst listening to Classic FM on the radio.

I’d also moved the gas bottle and regulator over from the metal shed, so for the first time in forever, we had a gentle heat in there to keep us warm.  Just how civilised is that?

Afterwards, over the inevitable cup of Plot Tea, Sara commented that all we really needed were duvets and pillows, and we could have a sleep-over.  Well, we had everything else, even a cat!

All too soon, it was time to call it quits for the day, but not before we’d found every tool we’d used outside, put everything away, and I’ve brought the dishes home to give them all a good washing.

Still, having said that, even after all the tea and drinks we’ve had today, both of the vacuum flasks were still full of piping hot water.

More on Wednesday evening…


SEO Powered By SEOPressor