<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rfid Archives - ClickedyClick</title>
	<atom:link href="https://gergely.imreh.net/blog/tag/rfid/feed/" rel="self" type="application/rss+xml" />
	<link>https://gergely.imreh.net/blog/tag/rfid/</link>
	<description>Life in real, complex and digital.</description>
	<lastBuildDate>Wed, 31 Jul 2013 14:56:12 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Electronic check-in at the Taipei Hackerspace</title>
		<link>https://gergely.imreh.net/blog/2013/07/electronic-check-in-at-the-taipei-hackerspace/</link>
					<comments>https://gergely.imreh.net/blog/2013/07/electronic-check-in-at-the-taipei-hackerspace/#comments</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Wed, 31 Jul 2013 07:47:18 +0000</pubDate>
				<category><![CDATA[Maker]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[hackerspace]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[rfid]]></category>
		<category><![CDATA[web]]></category>
		<guid isPermaLink="false">https://gergely.imreh.net/blog/?p=1523</guid>

					<description><![CDATA[<p>Made an Arduino/RFID/Node.js/Websockets powered real-time check-in/out system for the Taipei Hackerspace, to see better when is someone there so people come visit.</p>
<p>The post <a href="https://gergely.imreh.net/blog/2013/07/electronic-check-in-at-the-taipei-hackerspace/">Electronic check-in at the Taipei Hackerspace</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>One issue we have frequently at the <a title="Taipei Hackerspace mailing list" href="https://groups.google.com/forum/?fromgroups#!forum/taipeihackerspace">Taipei Hackerspace</a> is that people don&#8217;t know when we are open. Our  basic rule is simple: whenever a keyholder member is in the Hackerspace, anyone/everyone can come. In practice people never really know if anyone&#8217;s there.</p>
<p>They could give <a title="Call the Taipei Hackerspace" href="tel:00886225507630">a call</a> to the space, or even send an email to the <a title="Taipei Hackerspace mailing list" href="https://groups.google.com/forum/?fromgroups#!forum/taipeihackerspace">mailing list</a>, while the people I know usually end up asking me directly &#8211; hey, anyone&#8217;s at the space at the moment? Since I don&#8217;t always know the answer, the search was on for a better &#8211; maybe more technological or hackish solution: let&#8217;s build an electronic check-in/out system that will show the current status on out <a title="Taipei Hackerspace website" href="http://tpehack.no-ip.biz/">website</a>, so people can check right there.</p>
<p>I had the following idea in the back of my mind for a few weeks and even got the hardware acquired, but one of our co-founder had to call me out by name on the mailing list, a few days ago to swing into action. So now here it is, kinda working, ready for real usage.</p>
<p>The main idea is that in Taipei pretty much everyone has an <a title="EasyCard on wikipedia" href="http://en.wikipedia.org/wiki/EasyCard">EasyCard</a>, an 13.56MHz RFID card that is used for all public transport in the city and a lot more. The <a title="RFID-RC522 on eBay" href="http://www.ebay.com/sch/Electrical-Test-Equipment-/92074/i.html?_from=R40&amp;_nkw=rc522">RC522 card-antenna module</a> seems to be able to read the card pretty well, and all I need to get off it is the the ID number which is pretty straightforward (after digging the Arduino forums for source code).</p>
<p>The project in a nutshell is:</p>
<ul>
<li><span style="line-height: 13px;">Use Arduino Mega with an RC522 board to get the ID number of a given EasyCard</span></li>
<li>Use witches to get whether the person is checking in or out</li>
<li>Use LEDs to provide some feedback and basic user interface for the hardware</li>
<li>Node.js server to communicate with the Arduino, interface the check-in/out database, and provide API and realtime access to the data</li>
<li>Create a bit of interface on the website to display the check-in status</li>
</ul>
<p>Now let me dig into the different parts in detail.</p>
<h3>RFID</h3>
<p>The RC522 module has 8 pins, and Arduino can use the SPI library to communicate with it. I used <a title="Arduino Mega ADK home page" href="http://arduino.cc/en/Main/ArduinoBoardADK">Arduino Mega ADK</a>, because the SPI pins are conveniently accessible, unlike e.g. the <a title="Arduino Leonardo" href="http://arduino.cc/en/Main/ArduinoBoardLeonardo">Leonardo</a>, for which I would have had to make some new cables or headers. The RC522(pin number)-&gt;Mega(pin number) connections are done such that:</p>
<ul>
<li>SA(1) -&gt; SS(53)</li>
<li>SCK(2) -&gt; SCK(52)</li>
<li>MOSI(3) -&gt; MOSI(51)</li>
<li>MISO(4) -&gt; MISO(50)</li>
<li>(5) not connected</li>
<li>GND(6) -&gt; GND</li>
<li>RST(8) -&gt; (any digital pin)</li>
<li>+3.3V(8) -&gt; +3.3V</li>
</ul>
<figure id="attachment_1531" aria-describedby="caption-attachment-1531" style="width: 500px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" class="size-full wp-image-1531" alt="Photo of the electronics" src="https://gergely.imreh.net/blog/wp-content/uploads/2013/07/rc522.jpg" width="500" height="257" /><figcaption id="caption-attachment-1531" class="wp-caption-text">RFID-RC522, with blank card and pins</figcaption></figure>
<p>The source code to talk to the card is from a <a title="How to get started with the Mifare MF522-AN and Arduino" href="http://www.grantgibson.co.uk/blog/2012/04/how-to-get-started-with-the-mifare-mf522-an-and-arduino/">blog</a>, and originally from a tech shop in China, I guess (based on the big bunch of Simplified Chinese comments).</p>
<p>Switches and Visual Feedback</p>
<p>I wanted to make as simple interface for the card reader as possible. Added this pair of switches and LEDs (the D1 being green, and D2 being red). After the Arduino received a card ID from the reader, the LEDs are blinked to prompt people to press either the Check In or Check Out buttons. If they press either of them, the corresponding LED is blinked very brightly for a bit, and the card ID and check-in/out event is sent to the connected computer via serial connection</p>
<figure id="attachment_1524" aria-describedby="caption-attachment-1524" style="width: 500px" class="wp-caption aligncenter"><img decoding="async" class="size-full wp-image-1524  " alt="The (very basic) circuit for the check-in/out buttons and visual feedback LEDs" src="https://gergely.imreh.net/blog/wp-content/uploads/2013/07/checkinswitches.png" width="500" height="265" /><figcaption id="caption-attachment-1524" class="wp-caption-text">The (very basic) circuit for the check-in/out buttons and visual feedback LEDs. &#8220;Pins&#8221; refer to the Arduino pins used in the current version</figcaption></figure>
<p>If no button press occurs within 10 seconds or so, the reading is discarded and the card reader goes back to listening mode.</p>
<h3>Webserver</h3>
<p><a title="Node.js homepage" href="http://nodejs.org/">Node.js</a> is very useful to make quick web services, and its library support is not too bad at all, although it&#8217;s not all smooth sailing: their documentation is often scarce at best. Nevertheless it was the fastest one to get things up and running, since I have used before almost all required components.</p>
<p>The server communicates with Arduino via the <a title="Serialport library" href="https://npmjs.org/package/serialport">serialport</a> library. I&#8217;m more used to Python&#8217;s <a title="PySerial" href="http://pyserial.sourceforge.net/">pyserial</a>, though in this case it was very handy that serialport can emit read events, thus the server can just wait until there&#8217;s something to read and run some functions on the incoming data. In my experience, serialport wouldn&#8217;t be good for every cornercase I came across in serial-land, but in this setup works beautifully.</p>
<p>I chose SQLite3 to store the data, using the <a title="sqlite3 library" href="https://npmjs.org/package/sqlite3">sqlite3</a> library. There are a bunch of others, had to look around which one is still being developed. This particular library is not too bad, though I found myself fighting the lack of documentation and asynchronicity quite a bit. The resulting code is pretty ugly I&#8217;m sure, in some places inefficient because I didn&#8217;t know how to get to the result I wanted in a less roundabout way, still it seems to work and that is what matters for a prototype.</p>
<p>First I made a simple REST API to query the currently checked-in people, and later added (real-time) push updates via <a title="Socket.io homepage" href="http://socket.io/">socket.io</a>, to make it nicer. It&#8217;s brilliant that without any polling, all clients can be updated once someone signs in or out.</p>
<p>Since this code is running on a different computer than our main web server, had to play around with the <a title="HTTP access control (CORS)" href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS">Access-Control-Allow-Origin</a> header, and adjusting the settings of our  router to make it accessible for the web correctly.</p>
<p>Tried to add a pretty-much self-contained script that the front-end can load, and it handles everything, just need an appropriate HTML span or div element to display the information.</p>
<figure id="attachment_1527" aria-describedby="caption-attachment-1527" style="width: 500px" class="wp-caption aligncenter"><img decoding="async" class="size-full wp-image-1527" alt="Photo showing the circuit used for the check-in system" src="https://gergely.imreh.net/blog/wp-content/uploads/2013/07/checkinarduino.jpg" width="500" height="375" /><figcaption id="caption-attachment-1527" class="wp-caption-text">Hardware setup for checking in/out: Arduino Mega, RFID-RC522 circuit, and some switches and LEDs.</figcaption></figure>
<p>The result is pretty good, as long as the card-reader does not crash. Originally the results were displayed in a table, but wanted to make it more human, so here&#8217;s the format I ended up with:</p>
<figure id="attachment_1525" aria-describedby="caption-attachment-1525" style="width: 500px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="size-full wp-image-1525" alt="Website screenshot showing two people checked in" src="https://gergely.imreh.net/blog/wp-content/uploads/2013/07/checkedinscreenshot.png" width="500" height="96" /><figcaption id="caption-attachment-1525" class="wp-caption-text">Screenshot of the homepage with one particular check-in situation.</figcaption></figure>
<p>There can also be people with no name, they just show up something like &#8220;Right now there are three people checked in the Hackerspace: Greg, and two other people.&#8221;</p>
<h3>It lives!</h3>
<p>Here&#8217;s a quick demonstration video of how does it work:</p>
<p><iframe loading="lazy" title="Taipei Hackerspace Check-in System" width="580" height="326" src="https://www.youtube.com/embed/L3ccO_AuhQ8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p>So you can check out our website at <a href="http://tpehack.no-ip.biz/">http://tpehack.no-ip.biz/</a> for the live results, and drop in if you are in the neighbourhood if there&#8217;s anyone in the &#8216;space.</p>
<p>The whole source code is shared in <a title="thcheckin Github repo" href="https://github.com/taipeihackerspace/thcheckin">a Github repository</a>: the Arduino sketch, the server script, and any additional files. I&#8217;m sure there are a lot of things that could be improved about it.</p>
<p>The post <a href="https://gergely.imreh.net/blog/2013/07/electronic-check-in-at-the-taipei-hackerspace/">Electronic check-in at the Taipei Hackerspace</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2013/07/electronic-check-in-at-the-taipei-hackerspace/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Object Caching 17/28 objects using APC
Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: gergely.imreh.net @ 2026-04-17 19:58:06 by W3 Total Cache
-->