Hello. Hopefully someone has already done something like this so that I can see the code. I have an RFID reader that opens a door, and I have a RTC clock module so my arduino knows the time and date. Now I can make my cards open the door ( pretty standard stuff for an RFID project), but what I want to do is that while most card can open the door all the time, I want one or two card to only be able to open the door at certain times and certain days. For example have two cards/fobs that only open the door MON to FRI from 8:50 am to 9:30 am while the rest of the cards open the door whenever. If anyone can point me to a sketch that does something like this so that I may shamelessly steal borrow it for my project.
If you are too lazy to write the code yourself, ask your question in Gigs And Collaborations.
Otherwise store the restricted IDs, e.g. in a const array, and look up the current ID in that array. If found, get the current time and day of week from the RTC and decide, whether to open the door or not.
I would say... DrDiettrich is (mostly) correct.. lol
first point... I think would be better if you posted your current code.. and maybe an ATTEMPT at what you want to do.
second point.. hes dead on the money on how to go about it (without code)
if you know the card/id's..
you can add them in the sketch (as an array as pointed out)..
when a card is 'scanned' you grab the card's id... check that against your array of id's above...
if it is found in the array.. then you can do a 'time check' to see if they are within the threshold of being allowed entry.
posting your code so other can HELP is the key here.
When I was in charge of a team of engineers working on access control this sort of thing was know as a time profile and is very common.
All you have to do is to check in the database that the tag has been assigned a time profile, and if so is the current time in that profile. Sounds easy enough doesn't it?
However, it is tricky and full of gotchas, here are a few. You have to implement a calendar that knows when to add a leap year and also when to move the clocks forward and back for daylight saving. It has to be able to predict these dates going forward. When you have that you need a specific time profile for every different type you implement. Also there is a safety requirement that your building exit readers must not be governed by a time profile. Working late - building catches fire - you can't get out because you are out of your time profile.
Needless to say this is complex software and normally implemented on a system much bigger than a Uno. There is about three months of coding and testing here. So stealing such code becomes quite a crime, and getting some one to write it will cost a fair bit.
My project uses the Arduino to parse the Wiegand signal into an URL that is passed to a webserver (Raspberry Pi). I can then look up the number in a database which also contains scheduling information for that particular user. Also logs each entry, failed or otherwise, and stores a photo of the person attempting to gain entry. Happy to help if I can but it's taken me months of writing and testing and it's pretty hacky code at the best of times.
Depending on where you are in the world, logging authorised accesses can be illegal.
Grumpy_Mike:
Depending on where you are in the world, logging authorised accesses can be illegal.
Really? Cite a source please?
I worked in the industry. It is part of certain countries privacy laws. In Europe it was mainly the Scandinavian countries, but it was an option that the customer could request.
Fair enough. I'm in the UK and I am the client - it's for a set of domestic drive gates. Nice to know who has been on my property as several people have the code
Yes it is not illegal in the UK because we have rubbish privacy laws and they are just about to get worse.
Really? Worse how?