PDA

View Full Version : MSF clock module



cunninghamjohn
- 26th November 2008, 13:53
I bought a radio controlled clock yesterday from Argos for 8.99GBP and was pleased to see that it has an easily detatchable MSF receiver module. (ferrite rod antenna and small PCB with 5 connections). I am looking for information on the output from this module, I have had my oscilloscope hooked up and am getting 1 second pulses, with a train of different width pulses sent at the end of every minute. Im thinking about decoding the time/date information with a pic to make my own clock, possibly with nixie tubes. Im new to pic programming, but my first thoughts are on the 'pulsin' command. The NPL website seems to have a dead link for the data on the MSF signal.

derryck
- 26th November 2008, 15:42
I bought a radio controlled clock yesterday from Argos for 8.99GBP and was pleased to see that it has an easily detatchable MSF receiver module. (ferrite rod antenna and small PCB with 5 connections). I am looking for information on the output from this module,
A search on Google for rugby time clock gives the answer in the first result, and there is a link on the resulting web page to the data sheet for the transmission format. It's sent in BCD using longer or shorter pulse gaps as you've seen with your 'scope.

I suspect that you will have to use an interrupt routine to grab the incoming pulse stream so as not to miss one of those gaps.

Please post if you're successful in this!

cunninghamjohn
- 26th November 2008, 16:37
Thanks for the quick response derryck. I have since found a pdf on the MSF data format from a link from: http://www.timstyles.me.uk/projects/clock/clock_page.html

The site gives a design for a complete clock with date and time, but as a learning exercise I want to design my own from scratch.

I think that for now, with my limited programming experience, I would be happy to just make a program which extracts the minutes pulses from MSF, and manually set the clock, perhaps with an LED flashing with the seconds pulses. Im also planning to include an alarm facility.

Im also wondering about the power supply for the MSF module, it runs on a single AA battery, but i will be using a 5v power supply. Im thinking of wiring an LED and series resistor across the supply, and running the module on the higher voltage of about 2.1v or so. I hope the module will still be happy with this.

Will the pic recognise 2.1v as a logic 1, or will I need to amplify this to 5v to drive the pic?

How reliable is the MSF signal? I understand it does sometimes go off air for maintenance, so will it be necessary to provide a quartz based back up clock?

BobP
- 26th November 2008, 19:35
Hi,

Done this many years ago. But unfortunately the code was assembler and I last seen it 15 years ago?

Few things to check. Is it MSF from Cumbria (Changed from Rugby) or DCF from Germany. Most of the new cheap clocks are DCF. The clock instruction leaflet should say what it is.

Slight change in the protocol between the two but information on both are available on the web.

Both transmit the time and date over the full minute so PIC would need to be dedicated for at least 1 minute in 3 or 4 keeping time in between. Using interrupts is the way to go enabling the PIC to do other things while getting the time signal.

Have fun, it’s a good intermediate task,

Bob

cunninghamjohn
- 26th November 2008, 20:50
Thanks Bob. I am pretty sure the clock is for Rugby/now Anthorn. So far I have got the pic to decode the minute information, and I have an LED flashing once per minute. I have 2 other LEDs flashing the 1s and 0s of the time/date information. I have been sat with a pen jotting down the 1s and 0s but not yet deciphered it into anything meaningful.

N var word
PAUSE 1000
HIGH PORTB.2
START
PULSIN PORTB.0,0,N
IF N=>49000 and N=<51000 THEN PULSOUT PORTB.4,50000 ;500mS 'minute'

IF N=<15000 and n=>5000 THEN PULSOUT PORTB.5,10000 ;100mS '0'

IF N=>15000 and n=<25000 THEN PULSOUT PORTB.6,10000 ;200mS '1'

GOTO START

I hear what you say on using interrupts, but with my limited experience im thinking of using a separate pic to drive the display and provide alarm functions. I only started using picbasic a couple of weeks ago, prior to that I havent used basic for at least 10 years. The code above is what im using to drive the 3 LEDs so far.

derryck
- 28th November 2008, 14:09
I have been sat with a pen jotting down the 1s and 0s but not yet deciphered it into anything meaningful.

That would be useful as a means of seeing if your receiver is correctly picking up the signal and as a learning aid, but otherwise not needed.

Your clock will never be accurate until you decode a whole minute's worth of time information and set your clock from that. You can then use that to perhaps update a RTC chip, which in turn keeps your clock running until the next time you decide to do an update from MSF, if you want some form of backup.

I won't comment on the supply to your receiver, or the level of its output as the latter might depend on how you ultimately decide to detect the pulses.

If you care to PM me with your email address, I will send you a document that I prepared for the local U3A Science and Technology group which I think clarifies the major part of the data stream format, omitting the niceties.

Archangel
- 28th November 2008, 17:52
Will the pic recognise 2.1v as a logic 1, or will I need to amplify this to 5v to drive the pic?

Hi John, I do not think it will @ 5v as 2.1 is less than 1/2 way, but if you operate a PIC on 3.3v, then I would say yes. Check Microchips web site for PICs made to operate at that voltage.

cunninghamjohn
- 28th November 2008, 23:05
Thanks again for the replies on this subject. 'Derryck', i agree with your comments that it is a useful learning aid but nothing more. It would be easy enough to make a clock which was manually set and then incremented the minutes via MSF but im no longer satisfied with that idea and want to do something a little more sophisticated.
I have no experience with RTC chips, so cannot comment on the use of those. Perhaps some research is required. I do however want to keep the hardware as simple as possible, and preferably use 'junkbox' components. I do not yet know whether the MSF signal will be reliable enough not to need a backup clock.

Thanks for your comments Joe. The pic did not work with 2.1v pulses, so as it stands i am running the MSF module from a single 1.5v cell and 6v for the pic. I am using a simple common emitter amplifier to convert the pulses to logic levels (inverted of course)

Just as a matter of interest, I tried this program

pause 1000
N VAR WORD
M VAR BYTE
START
PULSIN PORTB.2,1,N
LET M=N/200 ; so that M fits into a byte variable
LCDOUT $FE,1,#M


GOTO START

This displayed the pulse lengths in mS/2. The LCD display gives 248 for the minute pulse, 98mS for a logic 1 and 47mS for a logic 0. ( my 4MHz clock for the pic must be out) This time the pen and paper exercise gave me the time and date information, so im pleased with the results so far.