Making Time

Enter Your Electronics & Design Project for a chance to win a $200 shopping cart!

Submit an EntrySubmit an Entry  Back to homepage
Project14 Home
Monthly Themes
Monthly Theme Poll

 

After a long think about what I might do for the Making Time Project14 challenge and thinking I might not be able to come up with anything suitable I had the idea of creating a current flow that would represent the time, hence the name current time. I thought it would be fun to create a circuit that would create a current between 0 and 11 microamps to represent the hours 0.00 to 11.00 o'clock - I had trouble thinking about whether 12.00 o'clock should be 12.00 or 00.00 and in the end decided on using 00.00. So all I needed was to create 12 different current steps, 0.0 microamps to 11.00 microamps. My initial idea was to use a stabilised voltage source such as a Zener combined with high precision resistors, controlled using analogue switches. Sadly, at this point my thinking went awry and for some reason I decided that I could use analogue multiplexers for the analogue switches with just one value of resistor. As I had some analogue multiplexers and had just purchased some resistors I thought I would be OK. I also wanted to use moving coil meters to display the time, one for hours and one for minutes. At this point I stopped thinking and went to do something else assuming that I could get the meters later.

 

Unfortunately it seems that low cost moving coil meters can only be obtained from China and the delivery time was after this competition ended. I was then about to give up when I just thought 'well, I could use digital multi-meters to display the two currents', as a sort of proof of concept. I was just about to start construction when I also realised that analogue multiplexers would not provide an incrementing current value if the same resistor value is used. So, I was about to give up for a second time when I thought 'maybe I could use the 4.7V digital voltage outputs from a Nano, with a 4.7 MOhm resistor on the output to create the increments of 1 microamp. Unfortunately, Nano outputs do not work properly unless more than 100 microamps is drawn. Was I discouraged? Yes! But decided that perhaps I could use 1 milliampere increments rather than 1 microamperes and happily, this is the case. So I needed 11 digital outputs from the Nano for the hours - it has 12 so that was OK.

 

I decided to make a neat little stripboard construction, with turned pin sockets as I had a Nano with turned pin connectors already soldered in. Everything went fine, everything was soldered together, I made preliminary tests and it seemed to work quite well, although getting exactly 1.00 mA increments was difficult but I managed 1.0 mA +/- 0.05 mA which I thought would be satisfactory. After all, the original design called for moving coil meters and these small discrepancies would not have been visible. At that point the Nano decided it didn't want to be programmed anymore so I had to change to a Nano with the square 1 mm pins, which of course, do not fit into turned pin sockets. Nor could I get any turned pin connectors in time to solder to a different Nano. So at that point I gave up on being next and went into just getting it connected together somehow mode. I used a protoboard for the Nano and used single core wire to make connections to my already assembled stripboard - as I didn't have enough 4K7 resistors to start again!. Success, it all worked well.

 

Then I turned my mind to how to create the minutes. A bit more tricky. To get minute increments I would need 59 different digital outs and 59 resistors, - none of which I had. So I thought, why not use 5 minute increments and then I would need only 11 more digital outputs. Unfortunately there were not enough on the Nano to do this so it would have meant using two Nanos synchronised together. Time was running out and I didn't think I would get that going in time, so just went for 10 minute increments (deciminutes) - why not! This required 5 digital outputs so I used five of the Nano analogue I/O pins, hoping that their digital output voltage would also be 4.8V .Fortunately, they were. And it worked. Houray.

 

I had hoped to be able to show the 10 minutes increments on the second meter, but this could not be achieved. It needed more than 100 uA to get the analogue outputs to work (programmed to be digital outputs), 1 mA worked but didn't increment in steps of 10 and using 10 mA from each output would have needed 50 mA for the Nano and something was bound to change if I started to drawn that much current, so I settled on just incrementing in deciminutes. I would have worked on a moving coil meter. The circuit diagram is shown below.

 

The Current Clock Circuit Diagram

 

The programme for the Current Time clock is listed below. I didn't have much time left to test it much so I have no idea how accurate it will be over 24 hours, but I think there would be enough granularity to be able to tweak the timing in order to achieve a suitable accuracy. Alternatively I could just add a real-time clock chip - which I do not have - so I didn't. This did make the programme fairly simple, as can be seen below. I used a while loop for the hours and a for loop for the decimeters (why not!)

 

/*

  Uses current to create a clock display

  Just for Fun

  Dubbie Dubbie 5th Jan'21

*/

 

 

#define oneclock   2

#define twoclock   3

#define threeclock 4

#define fourclock  5

#define fiveclock  6

#define sixclock   7

#define sevenclock 8

#define eightclock 9

#define nineclock 10

#define tenclock  11

#define elevenclock 12

#define tenmin    A0

#define twentymin A1

#define thirtymin A2

#define fortymin  A3

#define fiftymin  A4

#define decimindelay 2500

 

 

void setup()

{

  // initialize digital pins as outputs

  pinMode(LED_BUILTIN, OUTPUT);

  pinMode(oneclock,   OUTPUT);

  pinMode(twoclock,   OUTPUT);

  pinMode(threeclock, OUTPUT);

  pinMode(fourclock,  OUTPUT);

  pinMode(fiveclock,  OUTPUT);

  pinMode(sixclock,   OUTPUT);

  pinMode(sevenclock, OUTPUT);

  pinMode(eightclock, OUTPUT);

  pinMode(nineclock,  OUTPUT);

  pinMode(tenclock,   OUTPUT);

  pinMode(elevenclock, OUTPUT);

  pinMode(tenmin,     OUTPUT);

  pinMode(twentymin,  OUTPUT);

  pinMode(thirtymin,  OUTPUT);

  pinMode(fortymin,   OUTPUT);

  pinMode(fiftymin,   OUTPUT);

} /* setup */

 

 

void loop()

 

 

{

int timecount;

 

 

timecount = 0;

while (1)

  {

    switch (timecount)

      {

        case 0 : alloff(); break;

        case 1 : digitalWrite(oneclock, HIGH); break;

        case 2 : digitalWrite(twoclock, HIGH); break;

        case 3 : digitalWrite(threeclock, HIGH); break;

        case 4 : digitalWrite(fourclock, HIGH); break;

        case 5 : digitalWrite(fiveclock, HIGH); break;

        case 6 : digitalWrite(sixclock, HIGH); break;

        case 7 : digitalWrite(sevenclock, HIGH); break;

        case 8 : digitalWrite(eightclock, HIGH); break;

        case 9 : digitalWrite(nineclock, HIGH); break;

        case 10 : digitalWrite(tenclock, HIGH); break;

        case 11 : digitalWrite(elevenclock, HIGH); break;

        default : alloff();

                  timecount = 0;

                  break;   

      } /* switch */

 

 

    timecount++;

 

    deciminutes(); // This is the 10 minues x 6 = 1 hour delay

    digitalWrite(LED_BUILTIN, HIGH);  

    delay(1000);   // Heart beat to show working. Once every hour.   

    digitalWrite(LED_BUILTIN, LOW);

  } /* while */

} /* loop */

 

void alloff(void)

 

{

digitalWrite(oneclock,   LOW);   

digitalWrite(twoclock,   LOW);   

digitalWrite(threeclock, LOW); 

digitalWrite(fourclock,  LOW);  

digitalWrite(fiveclock,  LOW);  

digitalWrite(sixclock,   LOW);   

digitalWrite(sevenclock, LOW); 

digitalWrite(eightclock, LOW); 

digitalWrite(nineclock,  LOW);  

digitalWrite(tenclock,   LOW);   

digitalWrite(elevenclock, LOW);  

} /* alloff */

 

void minoff(void)

 

{

  digitalWrite(tenmin,    LOW);

  digitalWrite(twentymin, LOW);  

  digitalWrite(thirtymin, LOW);

  digitalWrite(fortymin,  LOW);  

  digitalWrite(fiftymin,  LOW);  

} /* minoff */

 

void deciminutes(void)

 

{

int mincount;

 

 

mincount = 0;

 

  for (mincount=0; mincount < 6; mincount++)

  {

    switch (mincount)

      {

        case 0 : minoff(); break;

        case 1 : digitalWrite(tenmin, HIGH);  ; break;

        case 2 : digitalWrite(twentymin, HIGH); break;

        case 3 : digitalWrite(thirtymin, HIGH); break;

        case 4 : digitalWrite(fortymin, HIGH); break;

        case 5 : digitalWrite(fiftymin, HIGH); break;

        default : minoff(); break;   

      } /* switch */   

    delay(decimindelay); /* 10 minute delay */     

  } /* for */

} /* deciminutes */

 

 

The completed Current Time clock is illustrated in the following video. In order to be able to see the hours and deciminutes changing I have not implemented 'real time'. Instead the deciminutes increment every 2.5 seconds rather than every 10 minutes (or 600 seconds).

 

 

All-in-all and despite all the problems and setbacks I am happy with what I have created and I am sure (mostly) that if I had two moving coil meters of the correct range, that it would work satisfactorily. Add a real-time clock chip and it would even keep time as well.

 

Well, now it is time for a walk, followed by a cup of tea, maybe even a biscuit.

 

Dubbie