RFID Access control / door lock actuator

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

RFID Access control / door lock actuator

#1 Post by rtenklooster » 03 Sep 2015, 23:02

My current door lock situation required serial communication to add and remove accepted RFID tag numbers to the arduino.
I replaced te arduino by an esp module, rebuilt the whole thing and modified R15 of the esp build.

My PCB contains 1 12v to 5v converter and 1 5v to 3.3v converter, a dual channel level converter and 2 mosfets.
This allows me to connect my wiegand RFID reader, and my 12v door lock.

The esp sketch allows you to set pulse intervals for the lock, and the built-in buzzer. You can add up to 8 RFID keys using the web interface.
Schermafbeelding 2015-09-03 om 22.56.13.png
Schermafbeelding 2015-09-03 om 22.56.13.png (156.96 KiB) Viewed 8440 times
If anyone is interested in my sketch, don't hesitate to contact me. I am willing to share it with you. For now, it works like a charm :)
Richard - Groningen (NL) - Image

maluko
Normal user
Posts: 112
Joined: 02 Sep 2015, 00:49

Re: RFID Access control / door lock actuator

#2 Post by maluko » 04 Sep 2015, 10:09

good job ;)

finch666
Normal user
Posts: 6
Joined: 11 Sep 2015, 20:36

Re: RFID Access control / door lock actuator

#3 Post by finch666 » 11 Sep 2015, 20:40

Heavily interested in this.
I have a arduino pro micro running my doorlock, but it has shown signs of instability (stays unlocked, heating op the coil of the lock).
Will send you a pm.

(nice forum)

Edit: because I'm new here I'm not allowed yet to pm anyone....
:(

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#4 Post by rtenklooster » 11 Sep 2015, 20:50

There is no need to PM. You can just use this forum to ask your questions.
Richard - Groningen (NL) - Image

finch666
Normal user
Posts: 6
Joined: 11 Sep 2015, 20:36

Re: RFID Access control / door lock actuator

#5 Post by finch666 » 11 Sep 2015, 20:58

Ah well, I would very much appreciate it if you would share your hardware setup and your software with me.
I have some esp modules laying around and haven't been able to put them to use very well (being no expert in programming them).

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#6 Post by rtenklooster » 11 Sep 2015, 21:05

That's no problem.
The first thing to keep in mind is the RFID uses 5v signals and the esp modules are NON 5v tolerant. So you have to find a way to shift those levels.
Theoretically you could use a simple voltage devider, i used a i2c level shifter, like this: Image

Next thing is testing if it's working. The default build has RFID options straight out of the box.
If you're good to go, your tag numbers are appearing please let me know.
Richard - Groningen (NL) - Image

finch666
Normal user
Posts: 6
Joined: 11 Sep 2015, 20:36

Re: RFID Access control / door lock actuator

#7 Post by finch666 » 11 Sep 2015, 21:15

Thank you, but being a noob here, but what is the default build?

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#8 Post by rtenklooster » 11 Sep 2015, 21:24

finch666 wrote:Thank you, but being a noob here, but what is the default build?
I just mean the latest ESP Easy release as you can find on source forge:
http://sourceforge.net/projects/espeasy ... urce=files
Richard - Groningen (NL) - Image

finch666
Normal user
Posts: 6
Joined: 11 Sep 2015, 20:36

Re: RFID Access control / door lock actuator

#9 Post by finch666 » 11 Sep 2015, 21:35

Aha, now it's beginning to make sense to me. I've read about the possibility of running complete programs on the esp, but never seen more then simple servers or clients. Same goes for level shifters. Didn't know they existed :)
This will definitely help me.
Thanks

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#10 Post by rtenklooster » 11 Sep 2015, 22:01

finch666 wrote:Aha, now it's beginning to make sense to me. I've read about the possibility of running complete programs on the esp, but never seen more then simple servers or clients. Same goes for level shifters. Didn't know they existed :)
This will definitely help me.
Thanks
Okay! Good luck on getting started. You can also use 3.3v zener diodes to break down the voltage. Used this also successfully.
Richard - Groningen (NL) - Image

finch666
Normal user
Posts: 6
Joined: 11 Sep 2015, 20:36

Re: RFID Access control / door lock actuator

#11 Post by finch666 » 11 Sep 2015, 22:21

Thank you.
I''ve got plenty of stepdown voltage converters laying around, so no problems there.
Signal converters ... just visited ebay :)

BertB
Normal user
Posts: 1005
Joined: 25 Apr 2015, 14:39

Re: RFID Access control / door lock actuator

#12 Post by BertB » 04 Oct 2015, 17:51

Hi Richard,
I have completed my setup with an RFID reader and get the RFID tags in the Domoticz Text device.
Now, I would like to add your sketch to my setup. Can you please tell me where to download it?

BertB
Normal user
Posts: 1005
Joined: 25 Apr 2015, 14:39

Re: RFID Access control / door lock actuator

#13 Post by BertB » 18 Oct 2015, 20:51

@rtenklooster
Hi, where can I get you sketch?

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#14 Post by rtenklooster » 19 Oct 2015, 19:41

I have attached the esp easy. It's based on build 15.
Although it's working fine it might be nice to create a device for it, i thougt i already did that, but can't find it.
Anyway, it's working stable for a couple of months now, so no need to upgrade to the latest release for me.
[attachment=0]ESPEasyRFID.zip[/attachment]
Attachments
ESPEasyRFID.zip
(28.62 KiB) Downloaded 464 times
Richard - Groningen (NL) - Image

BertB
Normal user
Posts: 1005
Joined: 25 Apr 2015, 14:39

Re: RFID Access control / door lock actuator

#15 Post by BertB » 19 Oct 2015, 22:49

Thanks

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#16 Post by rtenklooster » 20 Oct 2015, 23:23

[quote="BertB"]Thanks[/quote]
Thanks for the suggestion. My current print was using two mosfets. One for the buzzer, one for the lock. Well.. this works great!
The mosfets I used where expensive (2 USD each) and designed to work for 5v.
This cheap ass UL xxx i ripped of a cheap servo motor driver works way better, the door lock get's the needed current, less parts are needed (pull down etc.) les space and a cleaner pcb.

Thanks for the suggestion :)
Richard - Groningen (NL) - Image

BertB
Normal user
Posts: 1005
Joined: 25 Apr 2015, 14:39

Re: RFID Access control / door lock actuator

#17 Post by BertB » 20 Oct 2015, 23:26

Welcome

finch666
Normal user
Posts: 6
Joined: 11 Sep 2015, 20:36

Re: RFID Access control / door lock actuator

#18 Post by finch666 » 02 Nov 2015, 19:43

Thanks for the sketch too. 8-)
Just got it all working; domoticz reading tags now.
Next step will be using a raspberry pi as a 24/7 domoticz server.....

mebo
Normal user
Posts: 1
Joined: 21 Nov 2015, 16:24

Re: RFID Access control / door lock actuator

#19 Post by mebo » 10 Dec 2015, 17:12

Hoi Richard,

ik zou graag jouw broncode van de "RFID Access control / door lock actuator" willen zien.
Ben zelf met een RFID RC522 + Esp aan het stoeien, maar wat jij er van hebt gemaakt, ziet er uit zo als ik het ook graag zou willen.
Hoor graag van je,

Groet Bas
1+1=1

maluko
Normal user
Posts: 112
Joined: 02 Sep 2015, 00:49

Re: RFID Access control / door lock actuator

#20 Post by maluko » 10 Dec 2015, 18:38

English please ;)

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#21 Post by rtenklooster » 10 Dec 2015, 18:51

I have attached the source code a few comment's above. Have fun :)
Richard - Groningen (NL) - Image

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#22 Post by rtenklooster » 03 Jan 2016, 18:50

I found another version on my server.
RFID.zip
(29.45 KiB) Downloaded 435 times
I think this is the version i'm using at the moment ;)
Richard - Groningen (NL) - Image

fibigod
Normal user
Posts: 4
Joined: 03 Jun 2016, 21:06

Re: RFID Access control / door lock actuator

#23 Post by fibigod » 19 Jul 2016, 22:03

Dear Richard,

What is your current wiring setup?

I wanna setup a esp8266 with the wiegand in combination with a door lock.

But the esp sends it to domoticz i assume? How do you control the door lock from there?

Or do I understand it wrong?

Kind Regards,

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#24 Post by rtenklooster » 19 Jul 2016, 23:37

No, i don't let domoticz control my lock.
I have added an option to the esp module's web interface where you can fill-in the lock pin, and accepted tag numbers.
This way it's rock solid, works all the time and is independend op domoticz/ internet etc.

Of course you can still monitor it using domoticz. The tag numbers are still beeing send to domoticz.
It updates a text sensor with the last known tag number.
Richard - Groningen (NL) - Image

fibigod
Normal user
Posts: 4
Joined: 03 Jun 2016, 21:06

Re: RFID Access control / door lock actuator

#25 Post by fibigod » 20 Jul 2016, 11:48

Allright that's clear then. So you use the esp only as a controller.

rt45433
Normal user
Posts: 3
Joined: 06 Aug 2016, 21:13

Re: RFID Access control / door lock actuator

#26 Post by rt45433 » 06 Aug 2016, 21:19

This is a great post, I am wondering if anyone can help with my project. I would like to use a rfid access control keypad such as this one that can be purchased on ebay

http://www.ebay.co.uk/itm/291640063894? ... EBIDX%3AIT

I would like to be able to use the keypad codes through espeasy. For example I can log into the espeasy control and then add or remove keypad codes that can then be used on the keypad for door entry. Then I would like to be able to see this in Domoticz.

Does anyone know if this would be possible?

KateKitty91
Normal user
Posts: 1
Joined: 05 Jan 2017, 21:50

Re: RFID Access control / door lock actuator

#27 Post by KateKitty91 » 08 Jan 2017, 20:52

Can I use such door lock type in my house? Actually I hove no deep understanding in the niche. But I need remote control for door access. If I will show this thread to my local door locksmith - he will understand the whole system?

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: RFID Access control / door lock actuator

#28 Post by tozett » 15 Jan 2017, 13:53

rt45433 wrote:Does anyone know if this would be possible?
i dont think so, because you only get from the reader the powerline for unlocking a lock.

the images dont show some usefull output from the reader to use in espeasy
http://pic.ebayimg.net/11/201512/60981_ ... 7_36e7da4a

maybe thats enough for you, but than you dont need to have espeasy in between.

look at the espeasy wiki, you need a reader with i2c output, or with wiegand output.
than you get the key-id from the reader, and than you can let espeasy/or any other homesystem control what tag/person is allowed to open doors/...

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: RFID Access control / door lock actuator

#29 Post by rtenklooster » 19 Jan 2017, 14:12

tozett wrote:
rt45433 wrote:Does anyone know if this would be possible?
i dont think so, because you only get from the reader the powerline for unlocking a lock.

the images dont show some usefull output from the reader to use in espeasy
http://pic.ebayimg.net/11/201512/60981_ ... 7_36e7da4a

maybe thats enough for you, but than you dont need to have espeasy in between.

look at the espeasy wiki, you need a reader with i2c output, or with wiegand output.
than you get the key-id from the reader, and than you can let espeasy/or any other homesystem control what tag/person is allowed to open doors/...
I'm not a fan of those modules. They operate autonomous, you'll never know if there is some master code programmed into the firmware.
Besides that, you won't be able to see who has entered your house. It's just a simple actuator.
Richard - Groningen (NL) - Image

sm0k0
Normal user
Posts: 15
Joined: 24 Sep 2016, 10:41

Re: RFID Access control / door lock actuator but W34 not W26

#30 Post by sm0k0 » 28 Apr 2017, 09:51

Hi all,
hope this is the right section for my question.

Since some days i try to get a new Wiegand34 Reader (chinabomber KR100 from A..express) running with an WemosD1 mini or nodemcu or whitty on R108,120 & 147 without any result.
Another reader, Wiegand26 Reader (Sebury Touch whatever) works perfectly connected to the ESP via LVL Shifters.

I know the differences between W26 and W34 and it looks like espeasy currently only supporting W26 but my problem is that i expect at least a "reading eror" or any indication after the falling edge of either D0 or D1 has triggerd an interupt on the ESP. But nothing happens, the ESP just ignores the falling edge coming from the Reader.
While the D0/D1 at 5v level of course i have used a level shifter (Chinaboards, Z-Diodes, Resistors ...) and connected it to several ports (having Interupt Support) on the boards. No interrupt done on the ESP .... But the falling Edge it is definitely there. Checked that with an Oscilloscope before and behind the shifter (where the signal is not that nice as before the LVLS).
The w34 Reader is working fine with an arduino.

So :
* Will ESPEasy support Wiegand34 in the future ?
* i assume the problem might have to do with the timing or lenght of the falling edge, any ideas ?

Many thanks in advance & best regards
sm0k0

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: RFID Access control / door lock actuator

#31 Post by tozett » 28 Apr 2017, 11:44

from wiegand 26 to 34 should not be a really big problem,
but i think its up to the coder/developer to expand the existing code.

martinus was very quick in the past to do such things,
dont know if the actual developer can help you.

as i am no coder, i regret i cannot help, but if i could code perfectly enough i would have done this.
maybe you can lookup the code-enhancement yourself?

sm0k0
Normal user
Posts: 15
Joined: 24 Sep 2016, 10:41

Re: RFID Access control / door lock actuator

#32 Post by sm0k0 » 29 Apr 2017, 08:56

Thanks tozett.

In the meatime i have checked the devel branch, recompiled the FW but same result. I stepped back to the signal itself and it looks like the problem is not the Software but the falling edge is "too small" to get recognized by ESP.
Image2.png
Image2.png (3.88 KiB) Viewed 7134 times
Once i have connected the Reader via the level shifter, no falling edge is seen at all. :(

As longer i think about this as more i get the impression that it cannot work that way. The ESPEasy RFID implementation (_P008_RFID.ino) says INPUT_PULLUP on GPIO`s where D0/D1 is connected and FALLING for detecting the interrupt. That results in both pins are at 3.3v in "idle" operations.

So, from my little, screwed german brain : Both datapins are hooked up with 3.3v and as an Input i have another 3.3v coming in idle state from the Reader. Now, the reader pulls down voltage for initiating sequence and sending data by pulling up/down voltage. :geek:
But what about the hooked up ESP Pins ? They are still equipped with 3.3v (even if they are defined as INPUT) so treated as HIGH and therefore there is no change and falling edge and they stay logical 1 whatever you're doing at the readers side ... HäH ?? :shock:

I searched around the Web and did not find any real working solution for Wiegand@ESP so next steps would be to dig into making the signal "visible" to the ESP. Will try to make a "real" level shifter which is pulling ESP D0/D1 to ground in case of a falling edge. Will come back for report afterwards.

Have a good weekend & regards
sm0k0

sm0k0
Normal user
Posts: 15
Joined: 24 Sep 2016, 10:41

Re: RFID Access control / door lock actuator

#33 Post by sm0k0 » 29 Apr 2017, 13:06

Hi again,

a appropriate LVL shifter and changing #define PLUGIN_008_WGSIZE to "34" does the trick

this is working like a charm. :mrgreen:
wiegand_2_EPS8266_LVL_Shifter.png
wiegand_2_EPS8266_LVL_Shifter.png (7.7 KiB) Viewed 7120 times
wemos-wiegand34 (Small).jpg
wemos-wiegand34 (Small).jpg (113.15 KiB) Viewed 7120 times
wiegand_2_EPS8266_LVL_Software.png
wiegand_2_EPS8266_LVL_Software.png (18.5 KiB) Viewed 7120 times
best regards
sm0k0

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: RFID Access control / door lock actuator

#34 Post by tozett » 30 Apr 2017, 13:45

I use my reader without a level shifter, esp can handle 5v,
I documentated this here in the forum somewhere

May you try this also to simplify electronics...

sm0k0
Normal user
Posts: 15
Joined: 24 Sep 2016, 10:41

Re: RFID Access control / door lock actuator

#35 Post by sm0k0 » 30 Apr 2017, 16:19

thanks tozett.

:shock:

what i have seen on that device, there is a lot of noise on it in general so a LVL shifter is not a bad idea.
From what is telling Espressif, ESP8266 is not 5v tolerant, on some china bombers it might work, on some it doesn't. Depends on the delivering circuit, the current, breakdown of the voltage and what your pull ups are eating. So youre lucky that you might have a "dirty" board and your device is still operating. :mrgreen:

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: RFID Access control / door lock actuator

#36 Post by tozett » 01 May 2017, 08:08

your level shifter looks good (mine was confusing to use),
does the oszi show a better signal after shifting? do you made a screenshot?

esp is 5v tolerant as i found here: https://www.letscontrolit.com/forum/vie ... evel#p8713
so your shifter is more to straighten the signal for your reader than to shift.

gratulations, everthings looks proper and is working perfect! ;)

(and thanks for the images, wonderful to see something!)

sm0k0
Normal user
Posts: 15
Joined: 24 Sep 2016, 10:41

Re: RFID Access control / door lock actuator

#37 Post by sm0k0 » 01 May 2017, 09:05

Hi tozett,

scale has been changed of course but signal looks ok, noisy but ok.
Image1.png
Image1.png (3.34 KiB) Viewed 7055 times

CCameron
Normal user
Posts: 7
Joined: 03 May 2017, 22:32

Re: RFID Access control / door lock actuator

#38 Post by CCameron » 08 Nov 2017, 23:59

Does anyone know if I would be able to use arduino on anything on this list: https://unitedlocksmith.net/blog/8-best ... door-locks

Trying to anticipate mods before I buy.

mghaff007
Normal user
Posts: 3
Joined: 22 Dec 2017, 02:21

Re: RFID Access control / door lock actuator

#39 Post by mghaff007 » 22 Dec 2017, 02:45

I am new to posting my problems on-line, I usually like to figure them out my self.... but i don't have a great deal of experience with coding so i have been learning ALOT. so any help is greatly appreciated!!! :D I am trying to get this code to compile in order to upload it to my esp8266. and i keep getting compiler errors. Seems to be with the PubSubClient. HELP PLEASE.



Arduino: 1.8.4 (Linux), Board: "WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)"

ESPEasyRFID:140: error: no matching function for call to 'PubSubClient::PubSubClient(const char [1])'
PubSubClient MQTTclient("");
^
/home/mark/Downloads/ESPEasyRFID/ESPEasyRFID.ino:140:27: note: candidates are:
In file included from /home/mark/Downloads/ESPEasyRFID/ESPEasyRFID.ino:135:0:
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:116:4: note: PubSubClient::PubSubClient(const char*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&, Stream&)
PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:116:4: note: candidate expects 5 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:115:4: note: PubSubClient::PubSubClient(const char*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&)
PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:115:4: note: candidate expects 4 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:114:4: note: PubSubClient::PubSubClient(const char*, uint16_t, Client&, Stream&)
PubSubClient(const char*, uint16_t, Client& client, Stream&);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:114:4: note: candidate expects 4 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:113:4: note: PubSubClient::PubSubClient(const char*, uint16_t, Client&)
PubSubClient(const char*, uint16_t, Client& client);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:113:4: note: candidate expects 3 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:112:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&, Stream&)
PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:112:4: note: candidate expects 5 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:111:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&)
PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:111:4: note: candidate expects 4 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:110:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, Client&, Stream&)
PubSubClient(uint8_t *, uint16_t, Client& client, Stream&);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:110:4: note: candidate expects 4 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:109:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, Client&)
PubSubClient(uint8_t *, uint16_t, Client& client);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:109:4: note: candidate expects 3 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:108:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&, Stream&)
PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:108:4: note: candidate expects 5 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:107:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&)
PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:107:4: note: candidate expects 4 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:106:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, Client&, Stream&)
PubSubClient(IPAddress, uint16_t, Client& client, Stream&);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:106:4: note: candidate expects 4 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:105:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, Client&)
PubSubClient(IPAddress, uint16_t, Client& client);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:105:4: note: candidate expects 3 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:104:4: note: PubSubClient::PubSubClient(Client&)
PubSubClient(Client& client);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:104:4: note: no known conversion for argument 1 from 'const char [1]' to 'Client&'
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:103:4: note: PubSubClient::PubSubClient()
PubSubClient();
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:103:4: note: candidate expects 0 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:83:7: note: PubSubClient::PubSubClient(const PubSubClient&)
class PubSubClient {
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:83:7: note: no known conversion for argument 1 from 'const char [1]' to 'const PubSubClient&'
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:83:7: note: PubSubClient::PubSubClient(PubSubClient&&)
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:83:7: note: no known conversion for argument 1 from 'const char [1]' to 'PubSubClient&&'
Controller:298: error: 'MQTT' does not name a type
void callback(const MQTT::Publish& pub) {
^
Controller:298: error: expected unqualified-id before '&' token
void callback(const MQTT::Publish& pub) {
^
Controller:298: error: expected ')' before '&' token
Controller:298: error: expected initializer before 'pub'
void callback(const MQTT::Publish& pub) {
^
Controller:298: error: 'MQTT' does not name a type
void callback(const MQTT::Publish& pub) {
^
Controller:298: error: expected unqualified-id before '&' token
void callback(const MQTT::Publish& pub) {
^
Controller:298: error: expected ')' before '&' token
Controller:298: error: expected initializer before 'pub'
void callback(const MQTT::Publish& pub) {
^
/home/mark/Downloads/ESPEasyRFID/Controller.ino: In function 'void MQTTConnect()':
Controller:310: error: 'class PubSubClient' has no member named 'set_server'
MQTTclient.set_server(MQTTBrokerIP, 1883);
^
Controller:311: error: 'class PubSubClient' has no member named 'set_callback'
MQTTclient.set_callback(callback);
^
Controller:311: error: 'callback' was not declared in this scope
MQTTclient.set_callback(callback);
^
Controller:319: error: no matching function for call to 'PubSubClient::connect(String&)'
if (MQTTclient.connect(clientid))
^
/home/mark/Downloads/ESPEasyRFID/Controller.ino:319:36: note: candidates are:
In file included from /home/mark/Downloads/ESPEasyRFID/ESPEasyRFID.ino:135:0:
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:125:12: note: boolean PubSubClient::connect(const char*)
boolean connect(const char* id);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:125:12: note: no known conversion for argument 1 from 'String' to 'const char*'
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:126:12: note: boolean PubSubClient::connect(const char*, const char*, const char*)
boolean connect(const char* id, const char* user, const char* pass);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:126:12: note: candidate expects 3 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:127:12: note: boolean PubSubClient::connect(const char*, const char*, uint8_t, boolean, const char*)
boolean connect(const char* id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:127:12: note: candidate expects 5 arguments, 1 provided
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:128:12: note: boolean PubSubClient::connect(const char*, const char*, const char*, const char*, uint8_t, boolean, const char*)
boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage);
^
/home/mark/Arduino/libraries/pubsubclient/src/PubSubClient.h:128:12: note: candidate expects 7 arguments, 1 provided
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: /home/mark/Arduino/libraries/LiquidCrystal_I2C
Not used: /home/mark/Downloads/arduino-1.8.4/libraries/LiquidCrystal_I2C
Multiple libraries were found for "PubSubClient.h"
Used: /home/mark/Arduino/libraries/pubsubclient
Not used: /home/mark/Arduino/libraries/PubSubClient
Not used: /home/mark/Downloads/arduino-1.8.4/libraries/pubsubclient

no matching function for call to 'PubSubClient::PubSubClient(const char [1])'

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: RFID Access control / door lock actuator

#40 Post by vader » 22 Dec 2017, 12:20

No compiling issues so far. Try Arduino 1.8.5 and 1M SPIFFS setting.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: RFID Access control / door lock actuator

#41 Post by papperone » 22 Dec 2017, 12:47

I think you miss some libraries (at least the PubSub related to MQTT) in order to be able to compile ESPEasy...
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

mghaff007
Normal user
Posts: 3
Joined: 22 Dec 2017, 02:21

Re: RFID Access control / door lock actuator

#42 Post by mghaff007 » 22 Dec 2017, 21:06

/****************************************************************************************************************************\
* Arduino project "ESP Easy" © Copyright www.esp8266.nu
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You received a copy of the GNU General Public License along with this program in file 'License.txt'.
*
* IDE download : https://www.arduino.cc/en/Main/Software
* ESP8266 Package : https://github.com/esp8266/Arduino
*
* Source Code : https://sourceforge.net/projects/espeasy/
* Support : http://www.esp8266.nu
* Discussion : http://www.esp8266.nu/forum/
*
* Additional information about licensing can be found at : http://www.gnu.org/licenses
\*************************************************************************************************************************/

// This file incorporates work covered by the following copyright and permission notice:

/****************************************************************************************************************************\
* Arduino project "Nodo" © Copyright 2010..2015 Paul Tonkes
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You received a copy of the GNU General Public License along with this program in file 'License.txt'.
*
* Voor toelichting op de licentievoorwaarden zie : http://www.gnu.org/licenses
* Uitgebreide documentatie is te vinden op : http://www.nodo-domotica.nl
* Compiler voor deze programmacode te downloaden op : http://arduino.cc
\*************************************************************************************************************************/

// Simple Arduino sketch for ESP module, supporting:
// Dallas OneWire DS18b20 temperature sensors
// DHT11/22 humidity sensors
// BH1750 I2C Lux sensor
// BMP085 I2C Barometric Pressure sensor
// RFID Wiegand-26 reader
// MCP23017 I2C IO Expanders
// Analog input (ESP-7/12 only)
// LCD I2C display 4x20 chars
// Pulse counters
// Simple switch inputs
// Direct GPIO output control to drive relais, mosfets, etc

// ********************************************************************************
// User specific configuration
// ********************************************************************************

// Set default configuration settings if you want (not mandatory)
// You can allways change these during runtime and save to eeprom
// After loading firmware, issue a 'reset' command to load the defaults.

#define DEFAULT_NAME "" // Enter your device friendly name
#define DEFAULT_SSID "" // Enter your network SSID
#define DEFAULT_KEY "" // Enter your network WPA key
#define DEFAULT_SERVER "192.168.1.0" // Enter your Domoticz Server IP address
#define DEFAULT_PORT 8080 // Enter your Domoticz Server port value
#define DEFAULT_DELAY 60 // Enter your Send delay in seconds
#define DEFAULT_AP_KEY "configesp" // Enter network WPA key for AP (config) mode
#define DEFAULT_PROTOCOL 1 // Protocol used for controller communications
// 1 = Domoticz HTTP
// 2 = Domoticz MQTT
// 3 = Nodo Telnet
#define UNIT 0

#define KEYS_MAX 8
#define KEY1 1
#define KEY2 2345678
#define KEY3 3456789
#define KEY4 4567890
#define KEY5 1234567
#define KEY6 2345678
#define KEY7 3456789
#define KEY8 4567890
#define BUZZERPIN 5
#define BUZZERSHORTDELAY 200
#define BUZZERLONGDELAY 500
#define BUZZERPULSES 3
#define DOORPIN 14
#define DOORSHORTDELAY 100
#define DOORLONGDELAY 200
#define DOORPULSES 20

// ********************************************************************************
// DO NOT CHANGE ANYTHING BELOW THIS LINE
// ********************************************************************************

// sensor types
// 1 = single value, general purpose (Dallas, LUX, counters, etc)
// 2 = temp + hum (DHT)
// 3 = temp + hum + baro (BMP085)
// 10 = switch

#define ESP_PROJECT_PID 2015050101L
#define ESP_EASY
#define VERSION 4
#define BUILD 15
#define REBOOT_ON_MAX_CONNECTION_FAILURES 30

#define LOG_LEVEL_ERROR 1
#define LOG_LEVEL_INFO 2
#define LOG_LEVEL_DEBUG 3
#define LOG_LEVEL_DEBUG_MORE 4

#define CMD_REBOOT 89
#define CMD_WIFI_DISCONNECT 135

#define DEVICE_DS18B20 1
#define DEVICE_DHT11 2
#define DEVICE_DHT22 3
#define DEVICE_BMP085 4
#define DEVICE_BH1750 5
#define DEVICE_ANALOG 6
#define DEVICE_RFID 7
#define DEVICE_PULSE 8
#define DEVICE_SWITCH 9

#define DEVICES_MAX 10
#define TASKS_MAX 8

#define DEVICE_TYPE_SINGLE 1 // connected through 1 datapin
#define DEVICE_TYPE_I2C 2 // connected through I2C
#define DEVICE_TYPE_ANALOG 3 // tout pin
#define DEVICE_TYPE_DUAL 4 // connected through 2 datapins

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>
#include <Wire.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <LiquidCrystal_I2C.h>

// MQTT client
PubSubClient MQTTclient("");

// LCD
LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 16 chars and 2 line display

// WebServer
ESP8266WebServer WebServer(80);

// syslog stuff
WiFiUDP portRX;
WiFiUDP portTX;

struct SettingsStruct
{
unsigned long PID;
int Version;
byte Unit;
char WifiSSID[26];
char WifiKey[26];
byte Controller_IP[4];
unsigned int ControllerPort;
byte IP_Octet;
char WifiAPKey[26];
unsigned long Delay;
unsigned int _Dallas;
unsigned int _DHT;
byte _DHTType;
unsigned int _BMP;
unsigned int _LUX;
unsigned int _RFID;
unsigned int _Analog;
unsigned int _Pulse1;
byte _BoardType;
int8_t Pin_i2c_sda;
int8_t Pin_i2c_scl;
int8_t _Pin_wired_in_1;
int8_t _Pin_wired_in_2;
int8_t _Pin_wired_out_1;
int8_t _Pin_wired_out_2;
byte Syslog_IP[4];
unsigned int UDPPort;
unsigned int Switch1;
byte Protocol;
byte IP[4];
byte Gateway[4];
byte Subnet[4];
byte Debug;
char Name[26];
byte SyslogLevel;
byte SerialLogLevel;
byte WebLogLevel;
unsigned long BaudRate;
char ControllerUser[26];
char ControllerPassword[26];
char Password[26];
unsigned long MessageDelay;
byte TaskDeviceNumber[TASKS_MAX];
unsigned int TaskDeviceID[TASKS_MAX];
int8_t TaskDevicePin1[TASKS_MAX];
int8_t TaskDevicePin2[TASKS_MAX];
int Keys[KEYS_MAX];
int buzzerPin;
int buzzerShortDelay;
int buzzerLongDelay;
int buzzerPulses;
int doorPin;
int doorShortDelay;
int doorLongDelay;
int doorPulses;

} Settings;

struct LogStruct
{
unsigned long timeStamp;
char Message[80];
} Logging[10];
int logcount = -1;

struct DeviceStruct
{
byte Number;
char Name[26];
byte Type;
} Device[DEVICES_MAX];

boolean printToWeb = false;
String printWebString = "";

float UserVar[2 * TASKS_MAX];
unsigned long pulseCounter[TASKS_MAX];
unsigned long pulseTotalCounter[TASKS_MAX];
byte switchstate[TASKS_MAX];

unsigned long timer;
unsigned long timer100ms;
unsigned long timer1s;
unsigned long timerwd;
unsigned int NC_Count = 0;
unsigned int C_Count = 0;
boolean AP_Mode = false;
byte cmd_within_mainloop = 0;
unsigned long connectionFailures;
unsigned long wdcounter = 0;

unsigned long pulseCounter1 = 0;
byte switch1state = 0;

boolean WebLoggedIn = false;
int WebLoggedInTimer = 300;


void setup()
{
EEPROM.begin(1024);

LoadSettings();
// if different version, eeprom settings structure has changed. Full Reset needed
// on a fresh ESP module eeprom values are set to 255. Version results into -1 (signed int)
if (Settings.Version != VERSION || Settings.PID != ESP_PROJECT_PID)
{
Serial.begin(9600); // Initialiseer de seriele poort
Serial.println(Settings.PID);
Serial.println(Settings.Version);
Serial.println(F("INIT : Incorrect PID or version!"));
delay(10000);
ResetFactory();
}

Serial.begin(Settings.BaudRate);
Serial.print(F("\nINIT : Booting Build nr:"));
Serial.println(BUILD);

if (Settings.SerialLogLevel >= LOG_LEVEL_DEBUG_MORE)
Serial.setDebugOutput(true);

Device_Init();
hardwareInit();

WifiAPconfig();
WifiConnect();

WebServerInit();

// setup UDP
if (Settings.UDPPort != 0)
portRX.begin(Settings.UDPPort);

// Setup timers
timer = millis() + 30000; // startup delay 30 sec
timer100ms = millis() + 100; // timer for periodic actions 10 x per/sec
timer1s = millis() + 1000; // timer for periodic actions once per/sec
timerwd = millis() + 30000; // timer for watchdog once per 30 sec

// Setup LCD display
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.print("ESP Easy");

// Setup MQTT Client
if (Settings.Protocol == 2)
MQTTConnect();

sendSysInfoUDP(3);
Serial.println(F("INIT : Boot OK"));
addLog(LOG_LEVEL_INFO,(char*)"Boot");
}

void loop()
{
if (Serial.available())
serial();

checkUDP();


if (cmd_within_mainloop != 0)
{
switch (cmd_within_mainloop)
{
case CMD_WIFI_DISCONNECT:
{
WifiDisconnect();
break;
}
case CMD_REBOOT:
{
ESP.reset();
break;
}
}
cmd_within_mainloop = 0;
}

// Watchdog trigger
if (millis() > timerwd)
{
wdcounter++;
timerwd = millis() + 30000;
char str[40];
str[0] = 0;
Serial.print("WD : ");
sprintf_P(str, PSTR("Uptime %u ConnectFailures %u FreeMem %u"), wdcounter / 2, connectionFailures, FreeMem());
Serial.println(str);
syslog(str);
sendSysInfoUDP(1);
refreshNodeList();
}

// Perform regular checks, 10 times/sec
if (millis() > timer100ms)
{
timer100ms = millis() + 100;
inputCheck();
}

// Perform regular checks, 1 time/sec
if (millis() > timer1s)
{
timer1s = millis() + 1000;
WifiCheck();

if (Settings.Password[0] != 0)
{
if (WebLoggedIn)
WebLoggedInTimer++;
if (WebLoggedInTimer > 300)
WebLoggedIn = false;
}
}

// Check sensors and send data to controller when sensor timer has elapsed
if (millis() > timer)
{
timer = millis() + Settings.Delay * 1000;
SensorSend();
}

if (connectionFailures > REBOOT_ON_MAX_CONNECTION_FAILURES)
{
Serial.println(F("Too many connection failures"));
delayedReboot(60);
}

backgroundtasks();

}

void inputCheck()
{
// Handle switches
for (byte x=0; x < TASKS_MAX; x++)
{
if(Settings.TaskDeviceNumber[x] == DEVICE_SWITCH && Settings.TaskDeviceID[x] != 0)
{
byte state = digitalRead(Settings.TaskDevicePin1[x]);
if (state != switchstate[x])
{
switchstate[x] = state;
UserVar[(x*2+1) - 1] = state;
sendData(10, Settings.TaskDeviceID[x], x*2+1);
delay(100);
}
}
}

// Handle rfid
boolean granted = false;
for (byte x=0; x < TASKS_MAX; x++)
{
if(Settings.TaskDeviceNumber[x] == DEVICE_RFID && Settings.TaskDeviceID[x] != 0)
{
unsigned long rfid_id = rfid();
if (rfid_id > 0)
{
Serial.print("RFID : Tag : ");
Serial.println(rfid_id);
UserVar[(x*2+1) - 1] = rfid_id;
sendData(1, Settings.TaskDeviceID[x], x*2+1);
for (byte x=0; x < KEYS_MAX;x++){
if (Settings.Keys[x]==rfid_id)
{
granted = true;
x = KEYS_MAX;
}
}
if(granted){
sendPulse(Settings.doorPin, Settings.doorShortDelay, Settings.doorLongDelay, Settings.doorPulses);
Serial.println("Key Accepted");
}else{
sendPulse(Settings.buzzerPin, Settings.buzzerShortDelay, Settings.buzzerLongDelay, Settings.buzzerPulses);
Serial.println("Key declined");
}
}
}
}
}

void SensorSend()
{
for (byte x=0; x < TASKS_MAX; x++)
{
if (Settings.TaskDeviceID[x] != 0)
{
switch(Settings.TaskDeviceNumber[x])
{
case DEVICE_DS18B20:
dallas(Settings.TaskDevicePin1[x], x*2+1);
sendData(1, Settings.TaskDeviceID[x], x*2+1);
break;

case DEVICE_DHT11:
dht(11, Settings.TaskDevicePin1[x], x*2+1);
if (!isnan(UserVar[(x*2+1) - 1]) && (UserVar[(x*2+2) - 1] > 0))
sendData(2,Settings.TaskDeviceID[x], x*2+1);
break;

case DEVICE_DHT22:
dht(22, Settings.TaskDevicePin1[x], x*2+1);
if (!isnan(UserVar[(x*2+1) - 1]) && (UserVar[(x*2+2) - 1] > 0))
sendData(2, Settings.TaskDeviceID[x], x*2+1);
break;

case DEVICE_BMP085:
bmp085(x*2+1);
if ((UserVar[(x*2+2) - 1] >= 300) && (UserVar[(x*2+2) - 1] <= 1100))
sendData(3, Settings.TaskDeviceID[x], x*2+1);
break;

case DEVICE_BH1750:
lux(x*2+1); // read BH1750 LUX sensor and store to var 6
sendData(1, Settings.TaskDeviceID[x], x*2+1);
break;

case DEVICE_ANALOG:
analog(x*2+1); // read ADC and store to var 7
sendData(1, Settings.TaskDeviceID[x], x*2+1);
break;

case DEVICE_PULSE:
UserVar[(x*2+1) - 1] = pulseCounter[x];
sendData(1, Settings.TaskDeviceID[x], x*2+1);
pulseCounter[x] = 0;
break;
}
}
}
}

void backgroundtasks()
{
WebServer.handleClient();
MQTTclient.loop();
delay(10);
}

mghaff007
Normal user
Posts: 3
Joined: 22 Dec 2017, 02:21

Re: RFID Access control / door lock actuator

#43 Post by mghaff007 » 22 Dec 2017, 21:11

I checked and i do have the PubSubClient Version 2.6.0 on arduino 1.8.5 Installed... what am i missing????? Thanks in advance!!!

UPDATE:

Alright so i found a workaround just using ESPeasy rules. for what i needed it to do it works just fine! Thanks for the insight.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests