All posts by EEadmin

MSF Clock be wrong – RPI MSF transmitter

A friend of mine was asking me about MSF time reception and I realised I only knew some of the basics.  So this sent me on  a hunt for more information.

In the UK the MSF tme signal is sent on a carrier of 60khz from a transmitter in Anthorn Yorkshire with a radiated power if 17KW

17KW sounds large, but this is at 60 Khz, the efficiency of ariels less than 2.5Km (a half a wavelength of 60Khz) long with all round  coverage is going to be much less than 1, probably a lot less than 1. The old Time Signal transmitter at Rugby was in the order of 200KW. I can only assume the new transmitter is of a similar power to get a ERP of 17Kw.

After a little looking around, I discovered the web site of Andy ( who has made a MSF transmitter for 60Khz using a Pc’s sound card using the third harmonic of 20Khz to produce a 60 Khz signal and written the Python code to encode a date time into the MSF protocol.

So with most of the heavy lifting done, I started to think about what I had to hand. Raspberry Pi’s…

My first thought was using the frequency generator built in to the PI to give the 60Khz as used in many PI transmitter projects , but  there were limitations in trying to get 60Khz. So the next thought was a PWM output. A bit of googling gave me the formulae for the frequency of the hardware PWM on a PI


PWMrange is the number of “levels” you can specify for the PWM signal.

After some experimenting I found that you could set the range really small e.g. 2 Which is great if you sent the PWM a 0  it goes off. If you send it a 1 you get 50/50 Mark Space, ideal.  Setting the pwmClockDivisor to 160 gives a 60Khz output.

The Wiring PI Wrapper for Python supports this setup. So setting  the hardware PWM is a case of

io = wiringpi.GPIO(wiringpi.GPIO.WPI_MODE_PINS)

The wiring Pi for Python setup is detailed here

# This script uses PWM on GPIO PIN 18 to transmit an MSF timecode
# Save it as somewhere on your Pi.
# Run it with 'python'
# Requires the Wiring Pi Python Library
# Based on Audio MSF code from 
# by
# PWM output, Frequency and DateTime Code Added by Derek Woodroffe 

# Set the time/date to transmit below.
# The date time startes at the datetime you set regardless of local 
# clock settings
# Use groundhogday=True to repeat the same "day" every 24 hours.
# Your clock(s) should have set its time by around minute 5.
# Some clocks only look at MSF data every 12 hours.
# The day of the week is automatically set to the correct value

import time
import math
import wiringpi
import datetime

#----------------- Carrier  Frequency ------------------------------
#UK tested, others un-tested not sure about the modulation
Freq=60000 #60Khz UK/Japan - 66.66Khz Russia - 77.5Khz Germany/Taiwan

#----------------------- Set inital time ---------------------------
#start with a defined datetime
mmfdt = datetime.datetime(2019,4,1  ,6,1) #datetime year,month,day,hour,min
#Run with current time 
#mmfdt = 
#run 1 hour in the future
#mmfdt =,0,0,0,0,1,0) #timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]])

#------------------------ Groundhogday -----------------------------
#repeat after 24 hours.
#dont repeat 

#------------------------ Parity -----------------------------------
# Set to 1 to transmit proper parity bits
enableparity = 1

def carrier_on(length):
def carrier_off(length):

def minutemarker():
def send01():

def send11():

def send00():

def send10():

bcdlist= [80, 40, 20, 10, 8, 4, 2, 1]

#setup PWM GPIO pin 18 (pin1) Hardware PWM at Freq
#pwmClock divisor=19.2e6/2/Frequency

io = wiringpi.GPIO(wiringpi.GPIO.WPI_MODE_PINS)


    year = mmfdt.year
    month = mmfdt.month
    dayofmonth =
    dayofweek = (mmfdt.weekday()+1) % 7       #0 = sunday, 1 = monday etc.
    hour = mmfdt.hour
    minute= mmfdt.minute

    # Ignore the '0' element in the list as it confuses matters
    # with the timecode
    timecodeA = [0] * 60
    timecodeB = [0] * 60

    # Convert the year to BCD and store in the correct place in the timecode
    temp = year
    for i in range(17,25):
        if temp >= bcdlist[bcdindex]:
            timecodeA[i] = 1
            sum += 1;
            temp -= bcdlist[bcdindex]
        bcdindex += 1

    # Work out the parity bit for 17-24
    if (sum % 2) != 1:
        timecodeB[54] = enableparity

    # Now do the month
    bcdindex=3  #starts at 10
    temp = month
    sum = 0
    for i in range(25,30):
        if temp >= bcdlist[bcdindex]:
            timecodeA[i] = 1
            temp -= bcdlist[bcdindex]
            sum += 1
        bcdindex += 1

    # Do the day of month
    bcdindex=2  #starts at 20
    temp = dayofmonth
    for i in range(30,36):
        if temp >= bcdlist[bcdindex]:
            timecodeA[i] = 1
            temp -= bcdlist[bcdindex]
            sum += 1
        bcdindex += 1

    # Work out the parity bit for 25-35
    if (sum % 2) != 1:
        timecodeB[55] = enableparity

    # Do the day of week
    bcdindex=5  #starts at 4
    temp = dayofweek
    sum = 0
    for i in range(36,39):
        if temp >= bcdlist[bcdindex]:
            timecodeA[i] = 1
            temp -= bcdlist[bcdindex]
            sum += 1
        bcdindex += 1

    # Work out the parity bit for 36-38
    if (sum % 2) != 1:
        timecodeB[56] = enableparity

    # Do the hour
    bcdindex=2  #starts at 20
    temp = hour
    sum = 0
    for i in range(39,45):
        if temp >= bcdlist[bcdindex]:
            timecodeA[i] = 1
            temp -= bcdlist[bcdindex]
            sum += 1
        bcdindex += 1

    # Do the minute
    bcdindex=1  #starts at 40
    temp = minute
    for i in range(45,52):
        if temp >= bcdlist[bcdindex]:
            timecodeA[i] = 1
            temp -= bcdlist[bcdindex]
            sum += 1
        bcdindex += 1

    # Work out the parity bit for 36-38
    if (sum % 2) != 1:
        timecodeB[57] = enableparity

    #Bits 53A - 58A should always be 1
    for i in range(53,59):
        timecodeA[i] = 1

    print(str(year).zfill(2) + "-" + str(month).zfill(2) + "-" + str(dayofmonth).zfill(2) + " " + str(hour).zfill(2) + ":" + str(minute).zfill(2)+ " - " + str(dayofweek)  )
    #print("A bits: " + str(timecodeA[1:]))
    #print("B bits: " + str(timecodeB[1:]))

    # Now play the timecode out
    for i in range(1,60):
        if (timecodeA[i] == 1) and (timecodeB[i] == 1):
        elif (timecodeA[i] == 0) and (timecodeB[i] == 1):
        elif (timecodeA[i] == 0) and (timecodeB[i] == 0):
        elif (timecodeA[i] == 1) and (timecodeB[i] == 0):

    mmfdt = mmfdt + datetime.timedelta(0,60) #timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]])
    if (groundhogday):
      if (mmfdt-mmfdts>datetime.timedelta(1)):
        #restart day
        print ("RESTART DAY")


io.pwmWrite(PIN,1) turns on the 60 Khz and io.pwmWrite(PIN,0) turns it off.

I replaced all of Andy’s Sound Card Code with functions that mimicked the operation, but used the PWM commands above and a sleep to give me the correct on/off times (yes, sleep is inaccurate, this could be improved)

Adding a short wire to GPIO 1 (PIN18) and placing this near an MSF clock, worked… (it was 4 in the afternoon, and not April 1st 2019)

But if you want some fun, this close is probably not enough 🙂

Note: Transmitting on this frequency is Illegal and It is possible to affect all sorts of equipment that uses MSF. The transmitter below has a range of only a few feet and so is unlikely to cause any unexpected effects, but don’t do this where there is  any medical or industrial control equipment that may use the time signal.

Oh, and your neighbour may get quite miffed if his alarm clock goes off at the wrong time…

So adding some power..

I made an X of 300mm strips of MDF and wound 100Turns of 0.3mm enamelled wire around the structure.

This I drove from a MC4428 mosfet driver. Using both channels together gives a full bridge drive of up to 1.5A and can run up to 24V.

C1 will need to be modified to get your coil in tune. Tuning can easily be done by monitoring the Cap to coil connection and varying the value of C1 for maximum voltage. Beware that the voltage on C1 can get to about 100V when in tune, so keep it away from your PI#s GPIO

(And other things too)

The Circuit generates about 1W of power, but remember the ariel is only a fraction of the 2.5Km dipole required for 1:1 ERP , so the actual  ERP is much lower. Mine will “correct” clocks time at a range of about 4-5 Meters.


Key-In-The-Dark Torch

Key in the dark has been played in Scout groups and youth groups for as long as I can remember.

The idea of the game is one Scout is blindfolded and sat on a chair with a large set of keys underneath. He is “armed” with a torch. Usually a number of obstacles and places to hide are set up around them.  The rest of the scouts need to stealthily get to the keys without the Scout shining the torch on them.  If they are hit by a touch beam they are defined dead and have to either sit out the game, or start from the beginning again. The idea is that any sound made by the scouts in their approach means a torch shone their way.

Of course in practice a torch is not the ideal “weapon” although rules are that the torch is only to be used intermittently, it is basically an infinite resource and is usually shone around with abandon. Plus the operator being blindfold, they have no idea if the touch is on or off. The other main problem is that the torch beam diverges so much that multiple asalients can be cought at once.

So I started to look at alternatives. As 5W leds are cheap I thought of one of these as a source, combined with a 10 x 70mm focal length lens from a watchmakers eyeglass (loupe) in a 20mm tube. I could get a pretty narrow, bright beam.

Mounting the LED on a piece of copper allowed for any heat from the led to escape. 

Of course, I needed a way of switching this, so I used a MC4427 1.5A mosfet driver, purely as it was a single chip solution and mainly as I had one to hand.

I dead bug soldered it, as there were only 4 connections. and glued the driver to the back of the heatsink.

I had had the idea of “charge” to keep down the number of flashes, the idea being that every press of the button would freeze out the user for 0.5 Seconds. To show this, I thought of a number of neopixels along the barrel. So these were attached with some acrylic rings to spread the light out 

Whilst I was thinking about the design of this, I was given an Adafruit Feather Huzzah 

This was ideal, as it had a Lipo PSU and charger built in, and plenty of IO, coupled with a 25mmx9mm LIPO battery it gives loads of power..

Plus If you use MicroPython you got the neopixel support.

Realising that the operator would be blindfolded, I wanted some feedback so they would know when the torch was used. After trying a solenoid, I found this had two problems. 1. It was power hungry. 2. It took up a load of space.  So I went back to a large’ish vibration motor (also to hand)

I had decided that the whole thing should fit in a tube no more than 40mm in diameter, so I laser cut some supports and hung the whole lot from two m3 threaded bars. After many attempts I finally got the acrylic into pieces that would support the electronics and battery and assembled the whole thing together. 


Of course, I’d forgotten the buttons. These needed to be at the front, but so the case could be removed they needed to connect at the back.

After a couple of attempts with internal wiring, that got cought up either putting it together or taking it apart. I eventually put the wires on the outside, covered the whole handle, wires and everything in leather and connected the buttons with a cable at the back.

The USB cable for power (and programming) currently exits out of the back, but is soon to be replaced with a micro socket.  There is also a small switch for the units power.

The next addition was a burst fire mode, you get 5 shots in quick succession, but it takes longer to recharge.

I also added an auto power off, if left for 60 seconds.

Circuit Diagram 

Download (SVG, 21KB)

Final Touches…

End plate with USB charging port and On off switch.

Unfortunately as I take the power for the motor, Neopixels and the main LED straight from the battery Powering down is a two stage process. First you press and hold both buttons. After a few seconds everything is turned off. Then you can switch off the uP. I do it this way as  I don’t have to switch everything on to charge it.

The finished Torch


import machine, neopixel, time, utime

np1 = neopixel.NeoPixel(machine.Pin(12), 8)
np2 = neopixel.NeoPixel(machine.Pin(13), 8)
LED5w = machine.Pin(14, machine.Pin.OUT)
B1 = machine.Pin(5, machine.Pin.IN, machine.Pin.PULL_UP)
B2 = machine.Pin(2, machine.Pin.IN, machine.Pin.PULL_UP)
vib = machine.Pin(4, machine.Pin.OUT)



def fire(fx):
   for x in range(0,fx,1):
      for a in range(8):
def charge(cx):
  for a in range(8):
def vibrate():


while(B1.value() or B2.value()):
  if not B1.value():
    if(not B1.value()): 
  if not B2.value():
    if(not B2.value()): 
  if ((utime.ticks_ms()-start) > OffTime*1000):
    for a in range(7,-1,-1):

for a in range(7,-1,-1):

Nottingham Gaussfest 2018

What a great day at Papplewick Pumping station. The change of venue caused some teething problems with space and I caused some problems with exhibitors names (no change there!) Over 140 visitors, three film crew’s on the day and 12 Exhibitors.


The pumping station were great in sorting out our rather strange needs and were over the moon about the attendance (they ran out of bacon in the cafe, apparently the indication of a good day). All proceeds from the day went directly to the Pumping station.

Photos from the day, If you, or your equipment is missing, please email me a picture/video. It was such a busy day I missed a lot of things.

Derek’s (my) Equipment

Sam’s Equipment

Tony/Leicester Hackspace

Alex’s Equipment

Dave’s Equipment

Jason’s Equipment

Roger’s Equipment

Chris’s Equipment

Chris with his Florescent tubes and small radio

Chris’ Battery powered Tesla coil

Andrews Equipment


After a number of valiant attempts and a few disasters. Earl unfortunately failed to get his coil working. This was a great shame as the travel and effort he put in was huge. I would have loved to see his coil in action again. I especially wanted to see his bottle cap bank in action.

Robert’s Jacobs ladder


Papplewick Pumping station

A superb venue, although a bit cold, mitigated by a superb on site Cafe…

Micro Python with ESP8266 & Oled Display

How to load a test script

After loading python on your own system

Install esptool
pip install esptool –upgrade

Install AMPY
pip install adafruit-ampy

Download from

Plug in the board and find the Com port that is created (mine was COM4)

Download the micropython from
Should save as a bin file like esp8266-20171101-v1.9.3.bin

Erase the board
python –port COM4 erase_flash

Flash the board with MicroPython
python –port COM4 write_flash –flash_size=detect -fm dio 0 esp8266-20171101-v1.9.3.bin

Bodge the ampy package

Open /usr/local/lib/python2.7/site-packages/ampy/ Find line 171. Specifically go to the enter_raw_repl method:

add a time.sleep(2). So it becomes
def enter_raw_repl(self):
self.serial.write(b’\r\x03\x03′) # ctrl-C twice: interrupt any running program

# flush input (without relying on serial.flushInput())
n = self.serial.inWaiting()
while n > 0:
n = self.serial.inWaiting()


Using a terminal open the com port and at the >>> prompt write

f = open(“”, “w”)
f.write(“print(\” Hello\”)\n”)

Write the oled Library to the board

ampy –port COM4 –baud 115200 put

Create a file called with the following content

import machine, ssd1306
i2c = machine.I2C(scl=machine.Pin(4), sda=machine.Pin(5))
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
oled.text(‘MicroPython on’, 0, 0)
oled.text(‘an ESP8266 with an’, 0, 10)
oled.text(‘attached SSD1306’, 0, 20)
oled.text(‘OLED display’, 0, 30)

ampy –port COM4 –baud 115200 run

Teslathon & tesla workshop/talk Venues needed

EE are actively looking for venues for teslathons in the East Midlands for next year.

Places to hold our events are getting few and far between, mostly because of our “special” requirements.

What is a teslathon : A tesalthon is a meeting of tesla coil enthusiasts. Our tesla coils vary in size from tabletop to 3M tall and are all built by amateurs.

I have been running teslathons for 18+ years and have Risk assessments and method statements to cover the H&S aspects to our hobby.

So what do we need?

The Must have’s

A room with tables a minimum of 11M x 8M in size, on the ground floor that can be blacked out and a ceiling height of ideally more than 4M. Bigger of course is better. We usually have 20 or so coilers and 30-60 visitors to the events.

Plenty of 13A sockets (for our bigger events, a 32A Commando or accessible cooker socket would be needed, or an electrician on site to give support.)
Some method of providing a separate electrical earth. 10 or more tables.

Tea and coffee making facilities 🙂

Other needs (can generally be worked around)

The room needs a minimum (ideally non) of Burglar alarm, Fire alarm or network cables. Electronic lighting can be OK, but they must be high the ceiling. Fire sensors are generally OK, but they must not be of the ionisation type.

Ideal Venues are usually industrial museums or metal skinned warehouses/barns as these have a minimum of electronic equipment. We would like to work with the venues own insurance if possible, but we can provide our own if needed.

I also arrange workshops and talks with lesser requirements, so most venues can be used for something.

We can work in two ways, either a daily rental for the hall, paid by us,or we can work as a ticketed event to raise funds or awareness for a museum, venue or charity.

Before any booking, I would need to assess the venue for safety and suitability.

Have a suitable venue? (Or would like a talk at your venue) contact me

Details of past events are here and here

Flashing Light Prize 2017 – 2

Flashing Light Prize 2017 second entry

So I had a better idea… and as far as I know there is no restrictions on entering twice.

This time, I needed some thing more impressive. I’d been tinkering with a demonstration of lighting a bulb with a single connection for a while, so I tied it in with that. Unfortunately the only (working) tesla coil that I have that has enough power (actually RMS current at the topload) is the Aetheriser. So that is the coil I had to use.

A quick test with a long filament lamp proved the idea workable, but the free connection got a bit warm (e.g. too hot to touch) so I added a brass ball protection to the free end

The large ball on the other end gives stability and stops the lamp from falling over.

The stills from the video.

and the last one of the failed cap end..


My other entry to Flashing Light Challenge 2017

Flashing light prize 2017

Details for the entry for the 2017 flashing light prize.

The Flashing Light Prize  is an informal & fun contest to find the most unusual way of flashing an incandescent light bulb.

So, being me, it had to include high voltage, and It had to use what I had lying around as I’ve been quite short of time recently.

My Wimshurst came to mind, but I wasn’t sure the two laden jars would hold enough energy to light a lamp. A quick test proved that as long as I was using small lamps, there was plenty of power available.

My initial tests failed, as the leads from the bulb made a point source that leaked charge away from the Wimshurst, so it never charged up to enough voltage. This was an easy fix, I attached a 1/2″ brass ball onto the bulb leads, with a 12mm Gap I go a flash rate of ~1Hz and ~40,000V, plenty for a 6v bulb 🙂

I had a few 6V 30ma Grain of wheat bulbs and these flashed really well from the sparks from the Wimshurst. The problem was after about 4 flashes that only just lit the bulb the filament would explode and leave a small arc lamp behind.

My thought was that the thermal shock from having 40,000V dumped into the filaments (rather than 6v) was probably something to do with the failure. I started to look around for a large HV inductance that would limit the inrush.

An Ignition coil secondary was put in series with the bulb and then I had a second thought, use it as a transformer to power the bulb at lower voltages.

So two bulbs were connected across the Ignition coil primary and the secondary was put via a spark gap across the Wimshurst terminals.  This flashed really reliably.  Power and speed could be varied with the spark gap, although at full separation the bulbs looked excessively bright so the rate was kept quite small.
2017 flashing light entry video


Wimshurst machine details/build


Incredibly, I won with this entry … So Chuffed !

Can’t wait until September to defend the title … 

Flashing light challenge 2017 my second entry

House breaking with a cheap Chinese laser cutter

First I do not condone house breaking, unless you own or are permitted to enter the property anyway. But there are instances where house breaking becomes a necessity.

We were working in the garden, our next door neighbour wanted to start strimming. Our Rescue Rottie/Great Dane has issues with hissy whirly noises, so we shut him inside, whilst we continued in the garden. 

The strimming started and he jumped up at the door, unfortunately he also turned the key in the lock, locking the  door, from the inside with the keys still in the lock, although we had keys they wouldn’t work. Our front door, also had keys still in the lock. Our dog had locked us out of the house 🙁

All other Windows and means of entry were fully secured. Not versed in house breaking, I know a couple of local lock smiths Ill see if they could help. A few phone calls later proved that they were all on holiday 🙁

OK so you hear of people breaking in when keys are in the lock, how hard could it be… Well first obstacle, we had a “high security letter box” that took me less than 10 seconds to remove with a pair of pliers from the outside, I’m glad I spent the extra on that!

The letter hole that was left just allowed me to put my hand into the door, nothing else. Even borrowing a small local kid didn’t help, the hole was too small. Being locked out also gave me a few other issues, all my tools were inside, but finding garden wire etc I tried to make a hook to remove the key.

No, the key needed to turn and be upright to be removed.

I then realised that I was left with assess to the most versatile tool a laser cutter.

I made a key spanner, actually I made two as I dropped the first one through the letter box, the second one had a piece of string attached, just in case.  After a little fiddling I managed to turn the key and unlock the door from the inside.

I even made a temporary replacement letter box with the laser cutter afterwards.

So why have I posted how to break into a house.

Because I couldn’t believe how easy it was. OK, I had a laser cutter, but making a tool like the one above could be done in a couple of minutes with a fret saw, and I’m sure they (or something better) would exist available on the internet. So the take away message is if you want to secure your house


The other thing is, I live on a street with a door that opens onto the pavement, I was trying to break into my house for over 30 minutes.