I just want to share with you my Spark Core project.
I created a Door access control system with the Spark Core. The door can be oppened by a secured web page, an Android widget or with a RFID tag where the reader is next to the bell button.
For this project I used:
A Spark Core
The Spark Relay Shield
A RDM6300 which is a 125kHz RFID cardreader (supporting EM4100 tags)
The RDM6300 sends the informations over Serial1 to the Spark Core.
Pin1 of P1 is connected to RX on the Spark Core.
It is connected trough a voltage divider of 10k Ohms (R1) and 20k Ohms (R2), because the Spark Core serial port is working with 3,3V and the RDM6300 with 5V TTL. On this photo, VCC would be the RDM6300 TX and Vout the Spark Core RX.
Pin4 of P1 is connected to Gnd on the Spark Core.
Pin5 of P1 is connected to Vin (+5V) on the Spark Core.
Pin 1 and 2 of P2 are connected to the RFID antenna.
The other pins are not used.
The door latch is connected to the Relay 1 of the Relay Shield.
Which is unlocked by supplying 12V AC to it.
And finnaly the Spark Core with the Relay Shield is placed in the ceiling above the door.
Cover off.
The door can be opened via a Android Widget via a simple POST request to the Spark Cloud or the same way on a web page.
The door can also be opened via the RFID tag reader next to the bell button.
The Spark Door code for the Spark Web IDE can be found: Here.
@Dave The door latch was already incorpored to the door by the manufacturer. The door is a Hörmann door.
I don’t find either a lot of informations in the Door manual.
I don’t have more informations than that. Sorry.
@shocku992 Sure! The possibilities are endless! I want to put s everywhere!
I tried to use your code to make some testing with it, but the web ide is dropping error if i copypaste the shared code. (especially the includes, etc…)
Sorry it was my fault, there was a missing */ on line 8.
But you can remove the following lines if your are compiling with the Spark Web IDE:
/* Includes ------------------------------------------------------------------*/
#include "application.h"
and
/* Function prototypes -------------------------------------------------------*/
int openDoor(String command);
bool comparetag(int tag1[14], int tag2[14]);
int checkmytags(int newtag[14]);
void readTags();
Started to put things together, but unfortunately i stuck at some point, in your code, line 61:
while (Serial.read() != -1); // stops multiple reads
Are you sure it’s Serial, not Serial1? (Serial is the usb port, Serial1 is the rx)
Also when i wire things, the reader is just reading a bunch of 0s, instead of the actual rfid’s number. I’m not a pro in wiring things, i started to think maybe i didn’t connect the rfid reader and the spark properly, so here is what i did:
II. connected the spark with the id12 breakout on the following way: (rfid -> spark)
pin 1 -> gnd
pin 2 -> 3v3
pin 11 -> 3v3 (I hope it works with 3v3 as well, not just 5v, this is what they are saying on the website)
pin 9 -> rx
pin 7 -> gnd
You’ve right! It’s Serial1 and not Serial. It was a bad copy/paste sorry. The code was corrected on Pastebin.
Thank’s for the input!
The wiring seems to be correct, if it is really working with 3v3 as said on the website.
But after the datasheet it’s require a pull up resistor on pin 9.
Maybe that code can help you: ID12 code for Arduino, because my code is specific to the RDM6300 reader.
I tried with both with your code and with the other one from Arduino’s site, but Serial1.read() returns always just 0 for each characters.
So if i write Serial.println(Serial1.read()); the output is like this:
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Really don’t know what can be the issue, coz i followed the instructions from the table you linked (ASCII column). I assume it should write different numbers for different chars as it reads the rfid tag.
I didn’t add as under ASCII column it was not listed. Do you think that would do? Also the other problem is i don’t know what is that :S and how to wire it.
But the pin 9 on the ID12 connects to the RX (Serial), not to the VCC i guess, also i can't see any VCC pin on the spark, only a VIN. I'm a bit confused, sorry
I’m not sure, but i think my id12 rfid reader is not working properly, coz the values that it reads for the same card are always different. Wrote to the vendor, really not sure what’s going on with the reader.
Hopefully this will be sorted soon and can continue the project with the interesting part
Maybe try to lower the resistor value. Instead of the 4k7 resistor put a 1k resistor, but not lower than 1k.
This will result that the voltage will going back faster to 3v3.