I need help to write a python program described below to read rfid tags, activate two relays and save rfid number to MySQL database.
----------- Equipment -----------
I will use the following products for this project:
- Raspberry Pi B with ethernet connection and Raspbian OS (OS can of course be changed if needed)
- SainSmart 5V 2 Channel Relay ([url removed, login to view])
- MAX3232 RS232 Serial Port To TTL Converter Module ([url removed, login to view])
- RFID-reader (please see attached pdf for user manual. Help on how to connect it to the rs232 converter is needed)
----------- Programming details-----------
MySQL database specification:
Three tables; one table named MF_Logg with fields Logg_ID, Logg_RFID_ID and Logg_Tid, one table named MF_Djur with fields Djur_RFID_ID, Djur_Namn, Djur_Intervall, Djur_Intervall_Foder1, Djur_Intervall_Foder2, Djur_Foder1 and Djur_Foder2 and one table named MF_Lantbruk (I will complete this table later, but data from column Lantbruk_Email will be used in this project).
1. When a rfid tag is read, the rfid number is controlled in the MF_Djur table (field Djur_RFID_ID).
1.1 If tag number exist in table MF_Djur:
1.1.1 Read the time for the latest time the tag was recorded in MF_Logg (A) and read the value of Djur_Intervall (minutes) from table MF_Djur (B).
126.96.36.199 If current time is within time interval A + B minutes: Read values from field Djur_Intervall_Foder1 and Djur_Intervall_Foder2 and activate the relay 1 for the time (seconds) specified in Djur_Intervall_Foder1 and activate the relay 2 for the time (seconds) specified in Djur_Intervall_Foder2.
188.8.131.52 If current time is not within time interval: Read values from field Djur_Foder1 and Djur_Foder2 and activate the relay 1 for the time (seconds) specified in Djur_Foder1 and activate the relay 2 for the time (seconds) specified in Djur_Foder2. Write tag number and current date and time to table MF_Logg. If internet connection exist: MySQL table need to synchronize with a MySQL database on another server on Internet.
2.1 If tag number does not exist in table MF_Djur:
2.1.1 In table MF_Djur save rfid number to Djur_RFID_ID, set Djur_Intervall to 180, set all four Foder-fields to 2.
2.1.2 Activate both relays for 2 seconds
2.1.3 Write tag number and current date and time to table MF_Logg.
2.1.4 If/when internet connection exist: Syncronize both tables with MySQL database on other server and send email to the specified emailaddress in table MF_Lantbruk with info that a new rfid tag has been saved to the database.
- When the Raspberry Pi starts up, this program must autostart.
- Programming must be well commented.
- Because this is a personal project that I will work on in my rare spare time, testing may take a little longer than usual so please accept that I need two-three weeks for testing after your coding has been finished.
- I can’t connect the rfid reader at the moment because I’m still waiting for the male db9/rs232 connector to arrive (it is said to arrive in beginning of next week)
- Because I don’t know Linux very well, please accept questions on what commands I have to run to get the script working.
- If you suggest that the coding can be made better in another language or with other hardware, please tell me in your bid description so I know before I choose a coder.
- I prefer fixed bids and will not rent a coder on hourly rates.
8 freelancers are bidding on average $373 for this job
Hi Im expert coder with experience on developing for Raspberry and Python I do have a Raspberry to test and develop Please check my profile Best regards Diego
With strong experience in embedded system software development including on Raspberry Pi device, I can do this. Please keep me into you consideration. Look forward to working with you. Thanks.