Browsing Posts tagged low-voltage

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!

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…

Second Box? Done! 02/02/13

Yes, yes, yes, I know, Dear Reader.  You’re about to faint.

But it is true.  The second box for TradeBase is actually finished.  What isn’t finished is the A-frame bit that the bike sits in.

But I will finish it, come Hell or high water.  It only needs the wheel sensor whacking on, and if I get a clear run at it (HA!), it’ll only take me a morning or an afternoon.

This second box now has much brighter LED’s than the original ‘demo’ box -bright enough to be easily visible even in direct sunshine.  And it only took another 16 transistors and 30 resistors on one board to achieve this.  Piece of cake!

Other news is that since Ian (no relation) gave me that little TV with the HDMI input socket, I’ve been ‘playing’ with the Raspberry Pi, and having a Big Lot of fun in the process.

I ordered a tiny little ‘wireless dongle’ for it -so I can use it on the Internet at home running wirelessly from my router. This really was a little swine to get going, and it took me a full half-day to get there, but it’s now working fine and very fast when you consider it’s a full computer the size of a credit card for less than £30.00.

“So what?” you quite rightly shout.

Ah, I actually plan to have a Pi down on The Plots in the top shed.  Because it’s so small, I can easily hide it away -probably behind somewhere or even under something, so any potential thieves won’t be able to find it.

I may take an old, empty PC case, and put that in there, complete with a couple of bricks in the bottom.  A scabby old 14″ CRT monitor (…which won’t work…), and a knackered keyboard and mouse will finish off my ‘stage set’.  If any thieves do break in, they see these, and take them.

I can imagine them picking up the empty PC case (…plus two bricks), and saying to each other;-

“Eh, Wayne!  Feel the weight of this!  Must cost a fortune, one of these!”

Ha!  Wait ’til they get it all home and try to plug it in.

Okay, an idle, but very fun thought…

Watch this space…

You must have caught the news recently?  There have been items about the new ‘Raspberry Pi’ single-board computer that the government is hoping to get into schools to teach children proper programming rather than just how to use ‘Word’ or ‘PowerPoint’ (…shudder.  I HATE ‘PowerPoint’…).

We think this is a very, very good thing.

Of course, guys of a similar age to me will fondly remember spending hours and hours over their ZX80’s or ZX81’s typing in programs to play ‘Space Invaders’!  Aaaah…  Happy days!

Nostalgia aside, its great that the Government have finally seen sense and decided to overhaul the computing curriculum.

AnywayDad, what ARE you going on about?

I’ve been following the progress of the little Raspberry Pi with great interest.  As soon as it was announced that it was available, I was one of the hundreds of thousands of guys and gals who totally crashed both the Farnell and Radio Spares websites, all wanting our orders there and then.

When Farnell had put their servers back together (!!!), they mailed me and said that they had received my order, and that my Raspberry Pi would be dispatched late April.  Well, today I received a polite mail telling me that the dispatch is ‘imminent’.


So what’s this all to do with a growing project here in Sunny Sheffield?

Well Dear Reader, as soon as my little board arrives, I’m looking to hook it up to the Electric Bike!

Out go the LED displays and little LED ‘tell-tales’.  In comes a full HD display!  Full high-definition graphics!

Out goes assembler programming, in comes Python, C, C#, HTML and CSS.

As the title says: Watch This Space for further fun and photos!

(Yes.  That photo is obviously my cat, Alfie.  This was his look this morning from my knee as I shouted in glee that my Pi was on its way.)

14 seconds. 13/12/11

That’s how much the timing circuit gains in one hour.

Now, the purists out there would say I have to correct this, but at this time I really want to crack on with other, more exciting stuff -like getting two PIC’s to chat to each other via the I2C communications I’ve been talking about for the last few days.

Anyway, I’ve now got the bottom six digits showing seconds, minutes and hours as it should. And yes, its showing it in the right format -the seconds and minutes roll over at sixty as they should.

This only took a matter of minutes in ‘C’!  If I’d tried to do this in assembler, it would have taken forever to write and debug.

So, its down to Maplin’s to buy their entire stock of FA02C green segment displays (7) along with their entire stock of BC547C’s (…Er. One…)

More pictures later.

Today’s mission… 11/12/11

…should I choose to accept it will be to program the display board I built last week with some new code.  This will be to give me speed and distance.

Okay, its with the old chip, but as I’ve mentioned before, porting code across chips with ‘C’ and the Microchip Integrated Development Environment (IDE) is ridiculously easy.

It will give me a ‘feel’ for doing it on the ‘proper’ board in the next few days after the new PICKIT3 arrives tomorrow. (…It will arrive.  Its FARNELL, after all…)

BUT, of course there is a slight problem.

In the course of the madess that was the other night, I’m sure I’ve corrupted the code that is currently running on that board.

SO, I’ll have to make sure I’ve got a working copy of that before I try anything fancy with new code.

Today’s progress? 06/12/11

…I hear you scream.

Well Dear Reader, it has been very slow, but very steady.

I spent about 4 hours in the morning planning out the new display board.

After long and careful deliberation, I’ve decided that this board will have a two digit speed display -which you’ll be able to see your speed in either kilometers per hour (…for our younger riders…), or for our more ‘Senior’ members, the proper speed in good old miles per hour.  This will be accomplished at any time by just touching a button and it will flip over.

This display will sit towards the top right of the new board, and beneath it there will be a six digit timer (…HH:MM:SS  For the real bike enthusiast…) and you’ll be able to select from either incremental total time you’ve been cycling, or at the touch -and re-touch- of another button, you’ll be able to set time as a ‘countdown’.  By repeatedly pressing this, you will be able to increment your time-to-count-down in minutes that I haven’t decided on yet.  I think this will be experimental to see what riders think the time increments should be, but as its all in software, it’ll be dead easy to change after a few field trials.

All the displays will be in fetching green LED’s that are about 0.56″ high.  Easily viewable from the bike if the box is placed fairly near the rider.

Now, I could just about have handled this from just the one big 40-legged PIC (…the PIC16F887…) that I’m using for everything else, but I’ve chosen to have another PIC on this board handling these displays and buttons.


Well, if I had tried to run everything off the single PIC, I would have needed some pretty awesome software skills to get it all to work without falling over and glitching.  The displays would have been pretty ‘jumpy’.

This new PIC is the little 28-legged PIC16F876A.  This is from the same ‘stable’ as it’s bigger brother, so porting code -especially ‘C’ between the two- is no bother whatsoever.  They both have the same internal specifications, give or take the odd peripheral or two.

They also have virtually identical communications systems, so I plan to have the two of them ‘chatting’ using the industry-standard I2C specification I’m familiar with from my days with Bang & Olufsen (…They used to use this to communicate between processors and peripherals on their high-end music and TV/Video systems.  This was back in the late eighties, so goodness only knows what they use nowadays.  Probably fibre-optic…)

This also means that the whole system isn’t completely reliant on one single processor, and I have a gut feeling that this is the right way to go.  Don’t ask me why just yet, but I think it’ll pan out.

Now, whilst I know the I2C standards (…or can very quickly re-learn them…), I’m not quite familiar with how Microchip have implemented them, so that’ll be fun to learn.

By increasing my knowledge in this way, it’ll make it much easier to add further ‘whistles-and-bells’ further down the line as volunteers and users actually get to try this thing out.

And finally, as everyone who knows me knows, I’m a huge fan of flashing lights and ‘tell-tales’, so call it self-indulgence.  “Little Boys never grow up.  They just turn into Big Kids.”

“So where’s all the pictures you keep promising us, Wardo?”  Someone screams from the back.

They’re in my camera and safely backed up on my big back-up drive, ready to be processed at some very near date.

Don’t worry!  I have taken shots all the way through making this board, and I’ll be able to bore you to tears explaining just how difficult it is to use the hook-up wire I’ve chosen.  Thanks to the new camera’s awesome close-up facilities, I can get you right down to the heart of where I’ve been working.

Anyway, I’ve said too much already for fear of ‘jinxing’ it all, and as I’ve been sat at this bench more-or-less solidly since before 8.00 this morning, I’m starting to get a little fraggy now, so you’ll have to excuse me.

Oh, and only having had about four hours sleep in total since Saturday morning is starting to lose it’s ‘comedy value’ about now.

“Stop whining, you fool!”  Someone else jeers.  “You love it!”

Ah.  You found me out.

G’ Night, Dear Reader!


And counting. 25/11/11

I finally did it!

Okay, with a little help from undoubtedly Sheffield’s best electronic engineer, who actually said it as an almost throw-away comment; “…You have to reset everything to zero with a PIC because by default, everything is left on.”

Too true, as I finally turned OFF the PORT B analogue inputs and shazam!  Its counting like crazy.

So, in just a few minutes I have to pop back up to Diane’s office in the library to finish up the wording for a bid we’re putting together, then on my return, I will connect my circuit board up to the bike, do a little math as to how far you cycle with one wheel revolution and then, when I cycle, I’ll be able to tell how far I’ve gone.


Of course, the more cynical reader will simply say; “Why not buy one of those cheap bike computers you can pick up for less than a fiver?” And they’d be right to say this, but that’s missing the point.

The point is, without having to hack a ready-made piece of kit, I’ve actually done it myself.

And very quickly, from getting the distance travelled, I can work out all kinds of other stuff -speed, calories burned off; all manner of interesting stuff.

Yes, you can do that with a cheap bike computer, but it wouldn’t be anything like as much ‘fun’ to simply do that!

I use the word ‘fun’ there in inverted commas, because if truth be told, sometimes its been anything but fun, but I’ve sure leaned a Big Lot about the PIC interrupt system!

More soon…

That’ll be me then, will it?

In fact, let’s all get together and shout as loud as we can:-

“Who’s the numpty??!!   WARDO!”

For the last twenty four hours or so, I’ve been kicking myself trying to figure out why the seven segment displays on the bike circuit refused to work, but not only refused to work properly, but partially worked in a really, really weird way.

I’d turn one LED on, and four would come on, one of them being much dimmer than the rest.

Then I try to turn another on, and the display would be blank.

I’d turn three on, and five would light…

Eh?  Major head-scratching.

Well Dear Reader, I’ve found my mistake.

I’m not going to go into any detail whatsoever -for fear of boring you senseless, but suffice to say, if my cat Alfie had been in, and he’d spotted it, he’d have laughed his little ratty socks off.

Its too late to do anything tonight -well past my bedtime, but first thing in the morning, you can guess what I’ll be doing.



Seven Segments. 18/11/11

‘Seven Segments’ refers to the little displays I’m currently wiring up to give us a distance traveled and speed.

This is not as easy as it may sound.  Big maths, thanks to ‘C’, and the wiring is a nightmare!

I have photos I’ll post later of the ‘underfloor heating’ required to hook these displays up.

Still, its a very pretty violet colour!

SEO Powered By SEOPressor