Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Attendence System
#1
Hi there.
I am a bit of a newbie to python so i may need a bit more help than normal.
I am trying to program a raspberry pi using python to create an attendance system at work. I would like it to have a small LCD display and use a USB keypad for staff to input their code.

The idea is as a member of staff comes into work they would type their code in the pi would recognize it and clock them in with a time stamp. At the end of the day when they have finished they would then type their code in again and it would clock them out also putting a time stamp on it. As they clocked in or out it would just say on the screen their name and that they had clocked in/out.
All of the clocking in and out data would be stored in a separate file so it can be then viewed on a computer at a later date. it would be useful if it made a new file each month but this is not compulsory.

I have seen a couple of systems like this with guides but they use RFID tag readers as we have a lot of freelance staff in it is impractical to give them all tags. Much easier to add them into the system and give them a 4 digit code.

I know that something like this is possible, just wondering am i attempting something way out of my depth. I said i would give it a go before we have to spend hundreds of pounds on a full system that will do the same thing. + I love a good challenge.

If anyone has some tips and advice or good sources that i can get some guides that would be great.

Thanks in advance for any help
Elliott
Reply
#2
My first suggestion is... don't use files. You probably don't want the data on the pi, you probably want it in a database that your accounting people can get to easily. Plus, a pi is a pretty small thing... if someone grabs it off the wall (or it gets wet or something), you just lose all your time clock data.

You might want to add a confirmation step to the process, so if someone types the wrong code, and they see someone else's name, they don't accidentally clock out the wrong person (from experience, I can tell you that will happen A LOT).
Reply
#3
nilamo is right on point there, but I wanted to also mention this: http://python-forum.io/Forum-Tutorials
Reply
#4
Yeah I had thought of the entering the wrong code. I considered that the program would sleep after having found out who's the code is and then get them to press enter after a short period. Say 2-3 seconds, just so they can't enter their code and then press enter strait away.
I had considered a database. Maybe MySQL not too sure yet.
Thank you for the resources I'll be sure to use them while I get better at programming.
Thanks for the help so far ?
Reply
#5
Another thing you could consider, is just using the pi as a dumb terminal. IE: it doesn't do any calculating or anything on it's own, a remote host does all of that. RPC or rest could then be used to talk to the server, to find out what a user's name is for a given code, or how long they've been clocked in (useful for showing them before they clock out, so if it looks wrong to them they know to immediately talk to someone to fix the timings), etc. ...and if you set it up that way, it's extremely easy to add a second/third one for each of the doors to your building, or even to allow a certain small group of user ids to log in remotely (contractors that don't work on site, for example).
Reply
#6
We are a very small company. 6 full time staff and in the summer around 20 freelancers.
We currently use a raspberry pi as our server because we only require NAS and Print server. Although we do have a website hosted on a virtual sever.
I do like the idea of the box just being a dummy. How much harder would it be to code it like this and which library should I look into.
Thank you so much for the help.
Reply
#7
You could just use http calls to get/send info somewhere else, and display that info to the user. Strictly speaking, I think that'd actually be easier to do, as long as you've got a network connection. Instead of working with a flat file, and figuring out how you want to back that up (...even if it's just rsync running as a cron job), would be more work than a network call and something like Flask running on the other end to update a database (...which again, could just be a flat file).

Unfortunately, I don't know anything about python+pi, so I can't offer any library's or frameworks for a constantly running interface that listens to a keypad/keyboard. Although I should probably look into that eventually since I have a couple pis laying around...
Reply
#8
(Dec-13-2016, 05:20 PM)nilamo Wrote: You could just use http calls to get/send info somewhere else, and display that info to the user.  Strictly speaking, I think that'd actually be easier to do, as long as you've got a network connection.  Instead of working with a flat file, and figuring out how you want to back that up (...even if it's just rsync running as a cron job), would be more work than a network call and something like Flask running on the other end to update a database (...which again, could just be a flat file).

Unfortunately, I don't know anything about python+pi, so I can't offer any library's or frameworks for a constantly running interface that listens to a keypad/keyboard.  Although I should probably look into that eventually since I have a couple pis laying around...

It will defiantly have an internet connection so that could be a possibility. Yeah that's what i thought when i took this task on. Ill see how i do. Just trying to bring my own python experience up before i start actually laying down the basics of the code.
Reply
#9
I'm just finishing up a timeclock project. Before I started I didn't know Python. We now have a system that uses facial recognition and posts the attendance info into our ERP system.

I transfer the pictures to a face recog server via sockets along with the back and forth chat. The Pi client then opens a socket with the ERP server to notify it of activity and to receive feedback for the Pi to display. For the timeclock I used a Pi 3 + a 10" touch display. It's working really well so far (2nd week of actual use).
Reply
#10
Ok then i have been playing around with mysql.connector today and i keep getting an error when calling
cursor = cnx.cursor()
This is the error that i keep getting i have looked a little online but don't understand enough to fix anything.

Error:
OperationalError                          Traceback (most recent call last) <ipython-input-6-23c84600e42c> in <module>() ----> 1 cursor = cnx.cursor() /home/Elliott/Documents/ana/lib/python3.5/site-packages/mysql/connector/connection.py in cursor(self, buffered, raw, prepared, cursor_class, dictionary, named_tuple)   1381             raise errors.InternalError("Unread result found.")   1382         if not self.is_connected(): -> 1383             raise errors.OperationalError("MySQL Connection not available.")   1384         if cursor_class is not None:   1385             if not issubclass(cursor_class, CursorBase): OperationalError: MySQL Connection not available.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Difference between os.system("clear") and os.system("cls") chmsrohit 7 16,642 Jan-11-2021, 06:30 PM
Last Post: ykumar34
Question Difference between Python's os.system and Perl's system command Agile741 13 6,843 Dec-02-2019, 04:41 PM
Last Post: Agile741

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020