Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Based Employee Time Clock — Parallax Forums

Propeller Based Employee Time Clock

MicrocontrolledMicrocontrolled Posts: 2,461
edited 2010-06-22 11:12 in Propeller 1
My dad owns a small local buisness and has been pricing time clocks for some time so that he could make sure his employees were getting paid the right amount. Each one was over $200, and well over his budget. I offered to make him one, and I came up with a simple design that worked like a charm.

The Propeller Time Clock (PTC) uses a USB connection to transfer the minutes to the computer. I have written simple software for the PC that receives the data stored on the EEPROM and puts on a console so that it can be copied and printed.

What the hardware consists of is a Propeller Protoboard USB, an RFID reader (I use those a lot), and a Gadget Gangster Monochrome LCD. It also has a green and red LED for an indicator. Only 5 users are supported to save memory. The users each have thier own card that they use to check in and out by waving it above the clock. The LEDs blink green for in, red for out. It converts the time (kept in a seperate cog) into a string value and prints it to the EEPROM. The EEPROM can hold hex $1000 bytes of memory (could someone kindly convert that to decimal?) for each user.

The PCT has worked like a charm in all the hardcore tests I've put on it (including dropping it from 6 feet, I might add) because it will have to be sturdy to take the abuse it may take. I have checked in and out and come back hours later to see how it has done, and it works every time.

At my dad's request, I have made it add up the total time for each user and print it to the console when the EEPROM is downloaded. Also, to avoid extreme data loss I back up all the variables when the card is scanned. The code for this looks very messy and unrefined, which makes me cringe, but I want it to work so I won't risk changing it. smile.gif

The Propeller uses almost ALL the cogs for this, as it has:
1 printing the time on the screen
2 keeping the time (one is string and one in decimal, I should just convert it on cue but I was lazy)
1 running the USB engine
The one running the USB engine is special because it allows you to transfer data over the USB port and scan for RFID cards AND keep time all in simultanious processing! This project is not only useful, it is a good show of something that ONLY the Propeller could do. And the whole system only uses the Prop, no other ICs!

Here are some hi res pics:


microcontrolled.propmodule.com/P6170679.JPG
microcontrolled.propmodule.com/P6170672.JPG
microcontrolled.propmodule.com/P6170671.JPG
microcontrolled.propmodule.com/P6170680.JPG
microcontrolled.propmodule.com/P6170672.JPG

I've also posted the code. I'll post the .exe program when I have the chance (it's not on this PC).
I hope that you enjoy it!


Micro

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my new website!!

Use the Propeller icon!! Propeller.gif

Follow me on Twitter! Search "Microcontrolled"

Post Edited (Microcontrolled) : 6/21/2010 8:40:35 PM GMT

Comments

  • hover1hover1 Posts: 1,929
    edited 2010-06-21 18:29
    Corbin,

    You have been busy! Great project! I smell another Nuts&Volts article in the making!

    Just finished reading your RFID acticle, very well done young man!

    Jim
    Microcontrolled said...
    My dad owns a small local buisness and has been pricing time clocks for some time so that he could make sure his employees were getting paid the right amount. Each one was over $200, and well over his budget. I offered to make him one, and I came up with a simple design that worked like a charm.

    The Propeller Time Clock (PTC) uses a USB connection to transfer the minutes to the computer. I have written simple software for the PC that receives the data stored on the EEPROM and puts on a console so that it can be copied and printed.

    What the hardware consists of is a Propeller Protoboard USB, an RFID reader (I use those a lot), and a Gadget Gangster Monochrome LCD. It also has a green and red LED for an indicator. Only 5 users are supported to save memory. The users each have thier own card that they use to check in and out by waving it above the clock. The LEDs blink green for in, red for out. It converts the time (kept in a seperate cog) into a string value and prints it to the EEPROM. The EEPROM can hold hex $1000 bytes of memory (could someone kindly convert that to decimal?) for each user.

    The PCT has worked like a charm in all the hardcore tests I've put on it (including dropping it from 6 feet, I might add) because it will have to be sturdy to take the abuse it may take. I have checked in and out and come back hours later to see how it has done, and it works every time.

    At my dad's request, I have made it add up the total time for each user and print it to the console when the EEPROM is downloaded. Also, to avoid extreme data loss I back up all the variables when the card is scanned. The code for this looks very messy and unrefined, which makes me cringe, but I want it to work so I won't risk changing it. smile.gif

    The Propeller uses almost ALL the cogs for this, as it has:
    1 printing the time on the screen
    2 keeping the time (one is string and one in decimal, I should just convert it on cue but I was lazy)
    1 running the USB engine
    The one running the USB engine is special because it allows you to transfer data over the USB port and scan for RFID cards AND keep time all in simultanious processing! This project is not only useful, it is a good show of something that ONLY the Propeller could do. And the whole system only uses the Prop, no other ICs!

    Here are some hi res pics:


    microcontrolled.propmodule.com/P6170679.JPG
    microcontrolled.propmodule.com/P6170672.JPG
    microcontrolled.propmodule.com/P6170671.JPG
    microcontrolled.propmodule.com/P6170680.JPG
    microcontrolled.propmodule.com/P6170672.JPG

    I've also posted the code. I'll post the .exe program when I have the chance (it's not on this PC).
    I hope that you enjoy it!


    Micro

  • bill190bill190 Posts: 769
    edited 2010-06-21 18:33
    Cool!

    Advanced would be a loud CLUNK! sound when you·clock in/out. burger.gif
  • jazzedjazzed Posts: 11,803
    edited 2010-06-21 18:36
    Yay! Nice work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2010-06-21 18:47
    Thanks guys! I was in fact planning on writing a Nuts and Volts article for this. This scores 2 things that my other projects lack in that it:
    1. Looks like you bought it, and not like you ripped it out of an old computer
    2. I bought things to go with in while I was developing it, so all the parts are well fitted in the case.

    The case is the only recycled item, and even that doesn't show much. I've worked on this over the last few weeks, and it looks quite nice. Thank you for your interest!

    Micro

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my new website!!

    Use the Propeller icon!! Propeller.gif

    Follow me on Twitter! Search "Microcontrolled"
  • Zap-oZap-o Posts: 452
    edited 2010-06-21 18:48
    Not sure if you are aware of this but the propeller cant keep time very accurately. It will drift up to a few seconds a day in my experience.
  • johnnycarlosjohnnycarlos Posts: 44
    edited 2010-06-21 19:11
    @Zap-o Out of curiosity, how are you tracking time in the Propeller? It will definitely drift if you are using:

    repeat 
      waitcnt(clkfreq + cnt)        
      seconds ++ 
    
    



    The problem is that any processing happening after the waitcnt adds a delay the next time you go through the loop. The solution is to keep the "destination time" in a variable, instead of adding 1 second to the current time:

    dT := clkfreq 
    T  := cnt 
     
    repeat 
      T += dT     
      waitcnt(T) 
      seconds ++ 
    
    



    If that's the method you are using and it is still drifting, I'd like to know because I just made a clock too.

    John
  • jazzedjazzed Posts: 11,803
    edited 2010-06-21 19:15
    Well, I guess if your hourly employee is clocked in for several days at a time, the time drift might make a difference [noparse]:)[/noparse] Still, a DS1302 or DS1307 would provide a more accurate, comfortable, and professional accounting. One of those is optional on some GG boards.

    Cheers,
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2010-06-21 19:16
    I am using the exact code that jonnycarlos listed to keep time. The lower one that he said would work, that is. It can keep time pretty accurately, and not to worry, because I will running a real life test all this week (or next week, I need that screen to come in) to see if it is keeping time properly.

    I was going to run the real life test starting today, but when I had it all together on Friday (and working perfect) I saw that the screen was just about 1mm off center. When prying off the glue, I damaged the ribbon cable on the screen! So now, as disappointing as it is, I am waiting for my slow order from Gadget Gangster to get through so I can get this thing running again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my new website!!

    Use the Propeller icon!! Propeller.gif

    Follow me on Twitter! Search "Microcontrolled"
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2010-06-21 20:29
    Looks like a very practical project. Hmm...perhaps I'll have to read your Nuts-and-Volts article to understand how the RFID portion of it works. You might want to modify the title of this thread to read "Propeller-Based Employee Time Clock" with the key word "Employee" to distinguish it from real-time clock (RTC) interfaces or software-based time clocks that don't do anything additional. Your time clock is a complete system, though apparently sans the nice "ka-thunk" of the old employee time clocks from yesteryear. Hmm...maybe an audio cog for that last-remaining cog or two? Or perhaps at least a "beep" or two upon activating the "near-field." Well, maybe you have that already or plans. Anyway, nice project for your ever-growing portfolio.
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2010-06-21 20:41
    I've changed the thread title, I've never thought about it being confused with an RTC.
    I also did not know that the old time clocks made a "ka-thunk" sound. I could fit that in, or a beeping sound, as there is 2 cogs left. I could also pick a random employee to play a fanfare upon scanning. smile.gif Just kidding.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my new website!!

    Use the Propeller icon!! Propeller.gif

    Follow me on Twitter! Search "Microcontrolled"
  • jazzedjazzed Posts: 11,803
    edited 2010-06-21 21:11
    Microcontrolled said...
    I've changed the thread title, I've never thought about it being confused with an RTC.
    I also did not know that the old time clocks made a "ka-thunk" sound. I could fit that in, or a beeping sound, as there is 2 cogs left. I could also pick a random employee to play a fanfare upon scanning. smile.gif Just kidding.
    Could you use vocaltrac to say the employee's name? Good morning Mr. Phelps! Have a good day/night Mr. Phelps!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2010-06-21 21:19
    Ha-ha. Keep up the good work! Or should I say, "Keep putting some of us to shame!" I'm still on my first Prop/Microcontroller-based project (though it's kind of a doozy). But I enjoy living vicariously through others, such as you. Yes, it was a quite satisfying and necessary "ka-thunk" sound that those old-style (but likely still around) clocks made, the ones that printed on cards, and it was especially satisfying when clocking out. I'm guessing the employees using your time clock would appreciate the audio feedback along with the visual feedback that you already provide. Hmm...wonder if volunteers--not just paid employees--also have to clock-in and out. Guess so. What about slaves? Probably. Oh wait, that's just another name for employees. Regarding the name-change, it's only strictly necessary for simpletons (sounds like a quantum particle), like me, though it might also help when searching. Anyway, thanks for implementing and pardon my busting in. --Jim
  • hover1hover1 Posts: 1,929
    edited 2010-06-21 22:02
    Here you go. I guess you will have to add·an SD card or VMusic2 to·your new toy. tongue.gif


    Microcontrolled said...
    I've changed the thread title, I've never thought about it being confused with an RTC.
    I also did not know that the old time clocks made a "ka-thunk" sound. I could fit that in, or a beeping sound, as there is 2 cogs left. I could also pick a random employee to play a fanfare upon scanning. smile.gif Just kidding.

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-06-21 22:06
    Micro,

    Nice project. Been there myself with the employee time clock project (circa 1994). Interestingly mine relied on employees to enter their employee ID directly on the keypad. I always wondered if there would be a problem of someone clocking someone in / out if they were late, but it too was a small company.

    As a note, I used the DS1287 in my application, which was Z80-based, however these days if I used a Propeller I might consider the software clock running in its own COG if I had a battery backup on the system. That's always been the draw of these external RTC chips...small, cheap, battery backed and many have extra features like battery backed RAM.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-21 22:12
    I'm with Chris; since this is an employee time clock and you'd hate to have a power outage/glitch screw up somebody's paycheck, a couple extra dollars for a battery-backed RTC chip would be a good investment. I have software RTCs/timers for the Propeller, but would never use them in a like this (especially in the current economy).

    You could add SIDcog to create interesting in and out sounds.

    BTW... $1000 = 4096

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • hover1hover1 Posts: 1,929
    edited 2010-06-21 22:21
    Yea, strike the Vmusic2. SIDcog.

    Concerning Hex to Deciamal conversion, did you miss this recent thread?

    http://forums.parallax.com/showthread.php?p=915034

    Jim

    Post Edited (hover1) : 6/21/2010 10:26:36 PM GMT
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-06-21 22:49
    Another advance feature, for when the employee count grows, would be to log the data to a SD Card. Or even more advance would be to have the time clock work over ethernet and log the time on the PC/web server when the employee clocks in/out.

    Good work, thanks for being open and sharing your projects!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, P.E.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" 16:9 LCD Composite video display, eProto for SunSPOT, PropNET, PolkaDOT-51
    www.tdswieter.com
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2010-06-22 01:42
    Thanks for the suggestions, everyone! It looks like I'll be adding sound to this!
    Thanks for the recordings hover1. smile.gif Lets hope they fit on RAM, I don't have a spare SD card.
    I was thinking about using the NS sound driver from the Hydra to do the tone processing. I can't get my little speaker loud enough, though. How do those machines make such a loud beep with such a small speaker??

    Thanks,
    Micro

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my new website!!

    Use the Propeller icon!! Propeller.gif

    Follow me on Twitter! Search "Microcontrolled"
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-22 02:15
    Transistor driver.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2010-06-22 02:23
    I am, a 1 transistor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my new website!!

    Use the Propeller icon!! Propeller.gif

    Follow me on Twitter! Search "Microcontrolled"
  • GranzGranz Posts: 179
    edited 2010-06-22 02:40
    Microcontrolled said...
    My dad owns a small local buisness and has been pricing time clocks for some time so that he could make sure his employees were getting paid the right amount. Each one was over $200, and well over his budget. I offered to make him one, and I came up with a simple design that worked like a charm.

    The Propeller Time Clock (PTC) ...

    Micro

    Micro,

    How much are you spending in parts? The rule-of-thumb for business is that you should charge at least 100% mark-up for your products to be able to make a little profit. If you are spending enough below $100, then you may have found a nice market for your PTC.

    Art
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-22 02:54
    Microcontrolled said...
    I am, a 1 transistor.

    You may need to experiment with tones to find a "sweet spot" with your particular speaker. Also, you might check the current limiter into the base to make sure, in your desire to protect the Propeller pin, that you're not "goosing" the transistor quite enough.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2010-06-22 09:38
    >>> Thanks for the recordings hover1. Lets hope they fit on RAM, I don't have a spare SD card.

    Since you did save your dad $200, maybe an SD card might not be an unreasonable request.

    Jon Williams wrote a Spin Zone column that deals with using a bicolor LED with the Propeller. I think this would be a good application for one. Here is the article: www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp1.pdf.
  • Zap-oZap-o Posts: 452
    edited 2010-06-22 11:12
    @ johnnycarlos

    I have tried all and everything I could to make the propeller a clock. It always drifted. Ill see if I can pull up some code later this morning when I am at my office.

    I think its the crystal that is making it drift. I matched it according to the propeller data sheet but no luck. I also tried several different types of x-tals.


    Got one of the codes I use - its ran in its own cog

    {
     Clock object used for keeping track of time in seconds
     
    }
    
            
    VAR
            Long cog        
            Long Stack[noparse][[/noparse]25]
            Long Second 
              
    Pub Start  : okay         
      stop
      okay := cog := cognew(main, @stack) + 1
    
    
    PUB stop
    
      IF cog  
        cogstop(cog~ - 1)
        
      
    PUB Main 
      Second~
      result := cnt
       
      Repeat   
        waitcnt( result += clkfreq )  
        Second++
    
    Pub SetTime(in)
    
      Second := (in)
                                                     
    Pub Seconds 
    
        Return Second
        
    
    

    Post Edited (Zap-o) : 6/22/2010 11:26:23 AM GMT
Sign In or Register to comment.