Arduino Timer– To Overflow or not to Overflow

Part of the learning curve in mastering the use of the Arduino – is how to use delays. The simplest sketches (programs to most people) show turning a light on, waiting a second, turning it off, waiting a second… in a permanent loop.

Still don’t know what an Arduino is? Well, perhaps you should because Google want to put these things in our schools – it’s like a PIC chip but different – a cheap and cheerful way for kids to learn about computers… or put another way, a damned powerful and CHEAP microprocessor to let you do control experiments – timers, lighting systems, heating control, robots….. you name it.

That’s easy – but almost NO programs are so simple that all they do is flash lights (though the chip does a cracking job of emulating a police car set of lights given red and blue LEDS)! The problem with delays is that you can’t DO anything while waiting for the delay to finish.

Perhaps you might want to get clever and make use of interrupts to ensure that certain things happen at the right time – the problem with that is one of volatility – i.e. using variables in the interrupt routine (which can happen at any time) which may be affected by stuff going on in the main program – and vice-versa. Yes interrupts are do-able but anyone who tells beginners that interrupts are easy is delusional. If there’s another way, simple avoid the subject.

I figured instead I’d make use of a standard Arduino routine called millis() – quite safe, it tells you how many milliseconds have elapsed since the chip was last reset. Well, that’s easy – except that it isn’t. There is a whole lot of mumbo-jumbo about how long it takes before millis() overflows… and what does that mean?

It is quite simple really, the millis() routine stores it’s value in an "unsigned long" which you can’t easily access – no black magic, this is a 32-bit number which can count from 0 to just over 4 billion – and that doesn’t take too long really at a count of 1000 a second. Depending what you are building that might not be a problem but any program with any kind of long term timer might end up in trouble.

So as an alternative to sitting in a loop you can look to see how long it was since the last time you read millis() and run code accordingly. The problems with that are two-fold… eventually millis() will reset and you could end up with a duff comparison – OR you could be busy doing something else, call millis() a little late… and now the WHOLE thing is put back a little. Accumulatively you end up building up inaccuracies over time that could be significant.

I decided I needed a delay that was accurate and if I was a little late calling it – well, it would time a little earlier next time to make up for lost time – then I realised people might not want this – even if they were way too late they might not want another call before the minimum specified… so I looked around for routines to do the timing and offer the option of catching up or not. Look for METRO library – sounds great but in order to retain accuracy you have to call that at least every millisecond – WHAT? The simplest DALLAS temperature chip calls sometimes go away for a SECOND… I’ve fixed that incidentally – but you know what I mean.

So, I needed a routine that would handle overflow, that would not mind my calling it a bit late and would give me options to compensate next time for the delay – or NOT.

I’ve wrapped this in a class just really to make sure I understood classes.. and put it on GITHUB again just as a training exercise.

Enjoy.. but TEST – don’t take my word that this works…. if you want to test the overflow- remember the limit for a 32 bit number in HEX is FFFFFFFF (ie 6 Fs). Consider a last timing just under that- add the interval – you get a lower value as it overflows – but actually do the math and you’ll find the difference is still a positive number because both millis() and the comparison are 32 bits and so it still works.

So now you can write a program with routines that might take some time – and you can then check for intervals… an example might be to update the screen every 1 second – if you’re not fussed about accuracy use TRUE for the last parameter – on the other hand you might want a rock-steady beep every second – use FALSE or 0 as the last parameter.

As always a thanks to my pal Aidan – in this case the answer was mine but simply the ability to have someone to bounce the questions off and get intelligent answers makes all the difference.

Incidentally this is NOT super-accurate – you may check the routine at any time – not just dead on the millisecond so WORSE CASE you might find a stagger of somewhat less than a millisecond – ok 1 in a 1000 isn’t that bad – but it’s not perfect. It might mean in a real time clock the difference between catching a show and missing the first second or so Smile

So simple – but it does work. Proof…. call every 1000ms and print out the value of millis() on an LCD and it will display having added 1000 every time i.e. it remains accurate.

class Timing
{
private:
 unsigned long counter;
 boolean catchup;
 
public:
    void begin(boolean cat)
    {
        counter=millis();
        catchup=cat;
    }
        
    boolean isOver(unsigned long interval)
    {
        unsigned long newmillis=millis();  // temp vars so easier comparison
        if ((newmillis-counter)>=interval)
            {
            if (catchup) counter=newmillis; else counter+=interval;
            return true;
            }
        return false;
    }
};

// you can hide that class in an include file... so here's how to use it.
Timing myTimer;

void setup()
{
 myTimer.begin(0); 
 // 0 means catch up, 1 means delay will always 
 // be at least the value stated
}

void loop()
{
   if (myTimer.isOver(1000))
     {
        // do something here
     }
}

This code may be improved on – and I’m most likely to store improvements over at GITHUB. Here’s the link for the latest version. Enjoy.

Peter Scargill

The Mighty 1284p

The 1284p is the next step up from the ATMega328 chip powering many of the “Arduino” type microcontroller boards and their many clones.

Why another chip? Well, anyone who has used the ATMega328 knows that it’s a great controller chip but the lack of RAM soon gets very tiring. Also if you’re messing with things like Ethernet and maybe you want a Real Time Clock, perhaps access toSD memory, the libraries have a habit of filling your FLASH memory much faster than you’d like.

1284p chipWhy the 1284p? That’s simple – there are only so many of these chips in DIP format – that is the old 0.1” pin format that is easy to use for prototyping – the other upgraded chips are surface mount and a PAIN to solder.

The 328 chip has 32Kbytes of FLASH (for your programs), 1K of EPROM (for storing data permanently) and 2K of RAM (for variables). The likes of the Ethernet code EATS up the RAM in no time. Finally, it’s also quite easy to run out of Interrupts and port bits.

Don’t get me wrong, the 328 is a great general purpose chip but it has it’s limits. A  problem with many other chips is the cost – by the time you’ve finished you may as well have bought a Raspberry Pi and the idea surely is to keep costs low.

Well, the 328 can be as cheap as a couple of pounds or so… and the 1284p can be had for double that. What do you get for your money?

  • 128K Flash (ie 4 times as much)
  • 16K RAM (ie 8 times as much – MOST welcome)
  • 4K EEPROM(4 times as much)
  • 32 pins as against 23
  • 3 interrupts as against 2
  • 8 analog ports as against 6
  • 2 UARTS as against 1

As you can see in the diagram above, putting together a prototype board is a snap (provided you have a TTL-USB converter which I use for all my kits.)

Here is the information you need. If you’re starting from scratch you need the Arduino IDE, the TTL to USB converter (for programming) and a few bits and pieces for your prototype – information for that is all here.

tmp4AFFFollow instructions and you get this on your IDE bottom right when you’ve set the right board..

The standard BLINK test which flashes a LED once a second, when modified to use output 16 – will flash physical pin 22 on and off as per my photo demo above.

Thanks here to Aidan Ruff for pointing me in the right direction and supplying the test chip – which will soon end up in some long-abandoned project (because I ran out of room in the ‘328). Magic.

Skype

Background

SkypeSkype was first developed in 2003 and since 2011 has been owned by Microsoft. Skype started off in life offering simple messaging and now offers multi-user conference calling incorporating video and audio. It is also capable of making calls to real phones and even accepting incoming numbers.

I use Skype every day of the week in a variety of ways and this blog is my attempt to offer advice on how best to use this excellent product. Used the wrong way it can cause a lot of frustration. Used the right way it offers quality communication while saving money – potentially LOTS of money.

Is Skype “professional”? Well, 663+ million users seem to think it is good enough for them – but it’s reputation varies – some folk find it excellent, others have problems with quality. I suggest that disregarding early problems in the past,  today, most of those problems are down to matters unrelated to Skype and I’ll attempt to explain below.

Skype is free (for most but not all of the services offered) and registered users are identified by a unique Skype name – and may be listed in the Skype directory. If you want a full background on the product, check out the Wikipedia article.

What can Skype do?

Firstly and most simply, you can send typed messages back and forth to other Skype users for free. Simply download the software, get a free account, find out the “Skype name” of your friend of colleague and start typing. The only cost is that of your Internet connection.

Next, If you have a microphone you can talk to people on Skype – and if you have a camera, you can add video into the mix – all for free. If you want to have a conference call with several people including video, there is a slight cost involved for ONE of the parties.

The next step up is to purchase Skype credits and make calls to real telephones. It’s possible to call real phones for as little as 0.8p per minute. For more information on this go to the Skype website.

At the top end you can have a Skype-in account. With that, real phones can call you, no matter where you are. For example my 0191 number is Skype and it works if I’m in the UK or in Spain – no catches.

Skype is available on most PCs and most mobile phones and tablets. Even some Android phones now support Skype including video (though not multi-video).

The downside

Let’s get this out of the way…

  • Technology: if you don’t take the time to set up Skype correctly and KEEP it set up correctly, you’re asking for a heart attack. Updates sometimes change settings, in a business environment people sometimes “fiddle” with settings and the next thing you know your excellent installation is ruined 2 minutes before your meeting starts.

    Skype calls to mobile phones, especially those on hands-free can be less than satisfying at times. Skype does not work well with poor and variable broadband. The software uses a proprietary, NOT industry-standard format (which hasn’t stopped it’s use rocketing past those using industry standards) and it is definitely not perfect, however, millions believe it is “good enough”.

  • People: In both business and personal life, electronic communication does not fare well where there is conflict. Technical issues can make a bad situation worse – and if you have someone who does not like using this technology, they’ll find every excuse in the world to complain. Choose wisely the people and the occasions when you use Skype.

The upside

Again in a business environment, travel costs money – we’re all sick of complaining about the ever-increasing price of fuel (and that’s never going to improve) – I can tell you from my experiences in the Federation of Small Businesses where I have pushed this product (and others such as GotoMeeting) for internal use, it is possible to save a LOT of money with the product by cutting down on travel and overnight stays – not to mention the actual savings in time.  From a personal perspective I have relatives overseas and there is a WORLD of difference between long phone calls while worrying about the cost of overseas calls and actually seeing people face to face and chatting for free.

The Technical bits

You don’t have to be a techy to work Skype – but you DO have to understand and appreciate some basics if you’re to truly benefit from this technology. I’m increasingly coming to the view that for any serious meeting you should run through a check-list before-hand.  I’ll attempt to explain some of the areas you might consider:

  • Broadband capacity – many homes and offices today have decent broadband extending to several Mbps downloads – well, here’s the deal – Skype doesn’t care. The lesser-mentioned broadband figure is the speed of your UPLOADS and this is where we sometimes hit bottlenecks… For YOU to send me video or audio, you are using your UPLOAD capacity – and the same the other way around.  As uploads are generally CONSIDERABLY slower than downloads on domestic and even some business broadband setups, you need to be careful to ensure you’re not wasting any of this precious resource.  For example, uploading files to the web or making backups to the web while simultaneously using Skype is generally not a good idea. 

    Let’s say you have 8Mbps broadband, not untypical, the chances are the upload capacity is less than 1Mbps, perhaps MUCH less. I’ve seen standard 8Mbps deals with only 200Kbps (ie 0.2Mpbs) upload speed. THIS is the bottleneck. For simple text messages Skype really needs very little capacity. Add video and such speed-limits will start to get in the way, perhaps not on their own but complicated by some other activity such as backups or other users on the same connection.
    If in doubt use something like Speedtest.Net to check out your upload speed. You may be surprised. If you’re upload speed is as good as the image below or better… that’s ok, if it is significantly lower you may have issues getting high quality video out of Skype – and remember, all parties in a call need decent bandwidth – the bottleneck will be the person with the lowest figure.tmp5BCA
    For best Skype performance then, get the best UPLOAD deal and avoid as far as possible, backup activities or online gaming while running Skype for video. This is ESPECIALLY important if you’re running multi-video – i.e. more than 2 people in a video conference.

    The EFFECT of poor broadband speed is obvious, starting with a good connection, as things get worse, video quality will suffer, the image will freeze or get blocky. With really bad connections, Skype will suggest turning the video off. As things get even worse the sound will break up and eventually you will have to abandon the call or Skype will disconnect and reconnect.

  • Bad lighting – it always amazes me that people come on a Skype call with light shining behind them from a window and wonder why the picture quality is rubbish! Quality is down to a number of factors – cheap cameras and built-in cameras in laptops are generally not very satisfactory. Personally I like Logitech cameras – around the £50 mark and upwards. The Pro-9000 and similar models are excellent. Soft lighting on your face, not behind your head is best.
  • Fingerprints – this one is often overlooked – because of the small lenses the slightest smear ruins the imagery – compare these two photos – with a fingerprint and without.

with fingerprintclean lens

  • Bad sound – there are many reasons for this – rubbish microphones, lots of background noise, large hollow-sounding rooms. If in doubt the BEST solution is almost always to use a headset. Most people understand the concept of feedback – using speakers and a microphone it’s far too easy to set the volume high or make the mic too sensitive. Your voice goes into the mic – to the person at the other end – back through his or her mic – and into your speakers – slightly delayed and so on causing howl or squeeking.

    Skype does a decent but not perfect job of suppressing such feedback. If you must use speakers – keep the volume as low as practical and if at all possible use and anti-feedback mic such as the Solo. Pick a quiet room to hold a Skype conversation, if at all possible smaller rooms are best. Heavy furnishing and wallpaper help minimise the “boom” sound you get in larger rooms. Keep the mic close to your mouth but not THAT close that direct air blasts hit the mic. You’ve all heard that effect – on the train or plain where the operator hasn’t a clue how to use the mic and certain sounds seem to distort. Whether using a separate microphone or headset I tend to keep the mic just off-centre out of the direct air blast when speaking.

  • Old computers – this is simple – use a modern computer no more than 3-4 years old – if application performance is generally poor, keeping you waiting for ages as the likes of WORD loads – then the chances are Skype will have issues too – especially for video. Try to avoid internal cameras and internal microphones – the quality varies so much. Get a decent external mic or headset and a decent external camera.  Skype works well on the iPad because there are no fans inside to interfere with the microphone. You can’t plug a Logitech camera into an iPad so that’s out – and beware the build in camera is atrocious in bad lighting -  you need soft but bright light to get best results. Bad lighting sometimes results in jerky movement resembling that of slow broadband.
  • Settings– for reasons not always obvious, Skype settings change – perhaps you’ve upgraded the product, perhaps someone in the office has been fiddling with it. Before an important call, check the settings. Because this is important I’m going to cover this in detail below.

Before messing with settings – a very SIMPLE way to check Skype and you should do this before any important call – is simply call the SKYPE TESTING SERVICE – speak to it then wait to hear your voice replayed. If you can hear the Skype call and you can also hear yourself coming back clearly – that’s half the battle! Under Tools – options – audio settings you should see “Make a free test call”. Try it! It’s free!

tmp8B72

Skype Settings

Tools - optionsThese are my Skype settings, I’ll attempt to explain why they are as such. They work for me. Some will vary depending on the installation.  The current remarks refer to version 5.92 of Skype on Microsoft Windows. Most of it has not changed for some time.

imageSkype settings are accessed from the Toolsoptions panel (tools at the top of the main Skype panel).

Once in options there are several places you can go… and several reasons to go there…

General: Under “General” there is nothing special to set. You may wish to ensure that “Start Skype when I start Windows” is ticked.

Audio settings: Ensure the correct microphone is set-  if you’re using the SOLO mic, make sure that’s set – if you’re using say a Logitech webcam and NOT a separate SOLO mic, make sure the Logitech is set and not some internal laptop microphone. This CAN get reset so always check this before an important meeting. When in this setting panel, if you talk you should see the mic level bars moving..

image

Notice in the Microphone settings above I have UNTICKED “automatically adjust microphone settings”. You are FAR better off generally with that UN-ticked. Adjust the audio manually, too low and people will not be able to hear you – too high and the sound will be distorted. Make a SKYPE TEST CALL to see what sounds good. Sound should be clear and loud without sounding “poppy” when you say “Peter Piper Picked a Pale of Pickled Peppers”. Also if the level is too loud it might sound like your speakers are crackling.

imageThe next important place to go (if you have a camera) is “Video Settings” but here it gets more complicated as some cameras have their own control panels which then pop up.  Important issues again involved making sure the correct camera is set and you can preview the imagery.

At this stage when previewing your video you might like to think about things like overpowering backlights, light reflecting off glasses, poor lighting, smearing on lens. These cameras do NOT like poor lighting and the results may vary from a stuttering effect to poor colouring or grain. You cannot compensate for this – the solutions include clean lens, soft lighting, the brighter the better and little or no background movement!

Like audio, video settings are normally set to auto and this is often a recipe for disaster. If you can access these (webcam settings) and you are half-comfortable with the terms used – then turn off the automatic controls. Turn off any “follow my face”, “RightSound” or “RightLight” settings – turn off auto-focus, auto-white level.. I’ll explain why:

Auto-focus: when you move back and forth- the auto-focus will compensate – but it’s not very clever. You may be in a conference and someone moves behind you – the camera may attempt to focus on them instead of you. That might be a minor inconvenience for you but it’ll be a LOT worse at the other end. For video conferencing – especially with limited broadband bandwidth, try to keep CHANGE and movement down to a minimum – again it looks a LOT worse at the other end than it does at yours.  Modern camera focus systems do not work immediately to the sharpest. They have to go OUT of focus and work their way back in. If you can fix the focus manually you’ll get better results.

imageAuto-white-level: Great for setup – this makes sure that whites are, well, white and not yellow or blue.. and generally it works well, but once set for the session you might wish to turn it OFF as any changes will affect the colour, for example you might point out a coloured leaflet to the people at the other end and… the colours will all change to compensate! See the image on the left for an example of the “colour balance” being bad – note the orange overcast. Adjusting is a matter of common sense. Make sure there is no orange, green, red or blue overall “cast”. Make the image look natural.

Auto-level, Brightness etc. Again great for setting up but once set… imagine you’re stuck with a backlight – perhaps the window… you look good, facial detail is clear- then you move your head – the light from the window pours through – and the auto level (or auto-exposure) compensates and all of a sudden there is no detail in your face. Turn it OFF. Make sure everything looks ok BEFORE you start your conference/video call.

Here are a series of images – the first is about right – the rest for one reason or another are all wrong – see if you can guess what the issue is with the images… hover over these images to see what’s wrong – as if it’s not obvious.

Reasonable imageColour-balance - (white-balance)focusBrillianceBrillianceContrastContrastColour Intensity

In order, the first one is fine – then white balance, focus, intensity, intensity, contrast, contrast and colour intensity.  They may have slightly different names depending on your camera.

imageSkype would like to interfere with your browser and would like to send you adverts. Turn them all off like this:

Under privacy options, accept calls “from people in my contact list only” otherwise you’ll get Orientals trying to make friends (they’re automatic – they don’t really want to be friends”. Don’t accept Skype cookies. Don’t allow Microsoft targeted ads.

Under notifications un-tick everything except what you really want…

Under alerts and messages untick both.

Under advanced un-tick “use skype to call callto: links”

Flicker – if you see a flickering in background lights when you’re using any form of fluorescent lighting (or even SOME modern compact fluorescent – ensure the flicker filter in your camera settings is set to UK 50Hz, not the American 60Hz. Once set it should never need setting again. Cameras may vary. This is from the Logitech setup.

Flicker reduction

All of this takes FAR less time to DO than explain – it is worth making a checklist and checking these settings at regular intervals – and always after an update or if there is any chance someone else could have “tinkered” with the settings.

Used properly, Skype is an effective alternative to the phone for all but emergency calls.

Believe me, my experience counts as I’ve had an “0191” Skype-in number now for several years – no matter where I am if I turn Skype on I can be contacted on that number at normal cost.

When abroad, Brits can contact me and I can contact them at normal rates. My phone bills except to mobiles are insignificant. Often for routine meetings, instead of losing hour travelling, an overnight stay and the cost of a meeting room I can simply check Skype 15 minutes before the meeting and lose almost no time at all from my daily routine (other than of course the meeting time) and at almost no cost. For business use the cost of a decent camera is irrelevant compared to lost time and travel costs.

Where does Skype end and GotoMeeting start? The latter is not free or anywhere near it – there is a licence fee (again for the person initiating the call – similar situation with Skype multi-video) – GotoMeeting will also handle up to 25 people in a call and allow screen sharing and control, it is MUCH better suited to larger meetings than Skype which really works best one-to-one or for say 3-4 people.

Assuming you have a licence for GotoMeeting and have installed the software, you might have a little icon at the bottom of your screen. It may vary a little from this one…RIGHT-click on it…tmp96B8 No easy way to check the video for example – so best START the meeting by coming in early and having someone you can trust at the other end come in before the rest to give the audio and video a good testing.

tmp123D

So you have all sorts of means to start meetings – perhaps NOW, perhaps SCHEDULE a meeting…

Under PREFERENCES there is very little a CONNECTION option – and one that says AUDIO – so no direct way to test your camera here…

tmp1422

If you do have problems – think about which end of the link might be responsible… in a 3-way conversation if the other two go bad – it’s your end – if only one goes bad while the other says ok – that suggests the blame might be at the other end – the person who’s connection has gone bad…

Tips:

  • Wear headphones – avoid hassles with feedback by using a headset and mic where possible.
  • For GotoMeeting- anyone having trouble with audio quality can always coming via TELEPHONE instead!
  • Have audio conferencing numbers available as an emergency backstop if all else fails.
  • Avoid talking STRAIGHT into the microphone if you’re on a headset – move slightly to one side out of the direct air blast. This will stop the mic overloading on letters like “P”.

I hope this was useful to you.

Peter Scargill

2-Wire LCD for Arduino and other Projects

The problem with standard 2-line LCDs is that they take AT LEAST 6 lines to control them (2 control, 4 data) – and that’s a problem if you don’t have that many.

2-wire LCDThere’s a lot of info out about reducing the number of leads out there and some of it is confusing… so here is a working example of how to make an adaptor – some day I’ll do a board layout – suffice it to say the diagram is correct – the ONLY thing that is missing – and it’s something that catches amateurs out – is a decoupling capacitor – or phrased another way, a bog-standard 0.1uf capacitor (not an electrolytic).

The research isn’t mine – the library is out there (and it’s a winner) and the diagram is out there, I’ve just put the lot together after a lot of wasted time and effort following notes by people who don’t even understand why you’d need a decoupling capacitor then wondering why it doesn’t work.

2-wire LCDHere’s my prototype on the right, a bit of prototype board underneath a bog-standard 16-character by 2 line display… and here it is on the left in action – note the 4 wires are +5v, ground, clock and data  – that’s it.

The Library is one you should be replacing your standard Arduino library with ANYWAY (simply overwrite)…

For the diagram see here http://code.google.com/p/arduinoshiftreglcd/#Note_about_the_diode-resistor_AND_%22gate%22 it’s the one marked “Bill’s version with a latched shift register”.  This has 2 less resistors than other circuits however it WORKS – keep your wires short and don’t forget that 0.1uf cap from pins 8 and 16 on the chip – as near to the chip as poss. This is essential to reduce electrical noise that might otherwise make the whole thing unreliable. To date this has not failed to continue to run, or failed to start up correctly.

That same link gets you the library as well. The version there is old and the writer points you to here. https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

I didn’t use his “contrast” pin. I used a 10k preset from ground to +v with the centre slider going to pin 3 on the LCD. If that’s not roughly in the right place (usually at one end) you’ll just see a blank backlit screen. You COULD bring out the backlight + to an Arduino analog output if you wanted to control the brilliance as I did one one project as the backlight got on my nerves overnight (bedroom SAD light timer).

If this was put on a little PCB it could be much smaller than my prototype and through-hole-plating would make for a much stronger connection than I have here – but… it works!

4-line LCD using 2-wire connectionTo prove this wasn’t a fluke (if you read variations of the article I’ve linked to,  people start ranting about different diodes etc., I stuck with the 4148 and the 1k resistor as in the diagram) I made another version (better wiring, no links on the bottom, it gets easier the second time) with a 4-line display from a completely different supplier… worked first time, utterly reliably. The green main board you see is my own Uberduino and 4-line LCD using 2-wire connectionI’m seriously considering adding this circuitry to the next version… for a matter of pennies worth of components you get 4 lines back and less chance of messing up.

Next I’m going to try one of those cheap Nokia graphic displays to see if I can reduce THAT down to 2 lines! If only finding decent project boxes was this simple.

Update: It occurred to me that while using the shift-register solution is certainly neat  it does not solve one problem – the library – also people seem to have to go to ridiculous lengths to make larger fonts (which don’t look nice) for these displays because the technology is ancient (I was using these things, what, 20 year ago?)… so I took a close look at the Nokia displays – the side-lighting on the latter is awful but they are capable of full graphics (ie progress bars etc and larger fonts) but in order to do THAT the libraries generally rely on a memory buffer to hold the bitmap… and that of course eats into your available RAM. In my tests I was down to 500 bytes left after installing real time clock and the graphical library for the display…

I’d been checking on the cost of the 328 chips and it turns out that many suppliers are ripping off the community – charging 3 o 4 £ sterling for a chip – in fact there are UK suppliers who will sell them in small quantities for sub-£2 and at that price you can think of them a just another component. It turns out that the 328 chip can run at 8Mhz without a crystal (ie internal oscillator) and run i2c quite reliably (2-wire interface). Thinking about the benefits of this – all the RAM-consuming graphics can be contained in an inexpensive chip powering the Nokia display (with room for the 2-line displays in there as well), software RTC and more – and you can then just talk to the thing by a simple 2-wire interface.

So, that’s my next project but not until I find out by experiment what the power overhead is in doing it this way… If I can get the chip to wake up on i2c then it should be easy to shut the chip down when it’s not changing the display or updating the clock – but more of that in a future blog.

 

Peter Scargill