MyRegister
MyRegister began as a simple Internet of Things (IoT) demo for
students. I've developed it into what I hope might be a genuinely
useful piece of kit.
MyRegister is a small, hand held device which uses RFID to capture
(eg) attendance data. It stores data internally & uses WiFi to
facilitate access to the stored data.
Physically, MyRegister is around 100x70x20 mm and weighs around
70g.
On the outside it's a small white box with a single button:
On the inside:
- WiFi enabled microcontroller
- RFID reader
- LiPo & charger
The case is actually ‘engineered’ from a mobile phone power bank.
As well as being a very convenient size, it obviously contains
LiPo battery charging circuitry and also provides an extremely
useful power management scheme.
The microcontroller is a ESP8266 device from Espressif Systems.
This is a SoC which integrates a 32 bit CPU & WiFi interface.
I guess performance is comparable to the ARM Cortex M0 for those
who care. The device I've used has 4MB of FLASH memory, 1M for
code & 3M for data. It's programmed in Arduino C/C++ but there
is some CSS/HTML/JS jiggery pokery too...
The RFID reader (the blue board underneath) is a low cost and
readily available Chinese board, it has a conventional SPI
interface to the ESP8266 microcontroller.
A small (1200mAh) LiPo battery is used for power. Typically this
will provide 20 hours of use between charges.
The case has a single push button & LED as well as a micro usb
socket for charging the LiPo. A bi-colour LED in the case
indicates when the device is in use (blue), charging (flashing
orange), or fully charged (solid orange). The microcontroller has
a LED and piezo buzzer attached to provide user feedback:
basically it beeps & flashes a light when a card is presented!
Mischief Avoidance
Rather than students queuinq at the door to register attendance,
MyRegister is designed to be passed around the group while a
session is in progress. This circumvents the 'flash & dash'
philosophy of students who attend a session for only 10 seconds!
It also avoids the slow trickle of students entering large group
sessions...
An obvious issue is that someone is sure to switch the
thing off while on its way around the class? Impossible - the
power bank case takes care of this. The button is an ‘ON’ button not
an ‘ON/OFF’ button. The device will only switch off after a
pre-programmed time or by remote intervention using the WiFi
interface.
Operation
At power up, MyRegister searches for known WiFi networks &
connects automatically to the last used network if it’s available,
much like a laptop or mobile phone might.
If it fails, it starts its own network & becomes an access
point (AP). It broadcasts its presence & unique identity (no
two devices are the same). Users can connect to this network &
then access the device via a web browser. A QR code on the reverse
of the case can be used to ‘enter’ the URL.
At this point, MyRegister is fully functional but insecure as the
AP is open & anyone in range can access it. This might be
acceptable in some cases but it’s likely that users need to
connect to a ‘private’ network.
On connection the home page is displayed:
On first use we would probably go to the network page by clicking
on the NETWORK link at the top of the page.
This page displays the WiFi networks within earshot – hopefully
the one we want is listed!
Entering appropriate network parameters in the boxes should
connect the device to the network & close the access point.
It will acquire an IP address through DHCP & we need to
know this to gain access, or we can use mDNS (aka
Bonjour).
A QR code on the reverse of the case indicates the mDNS
address(es).
A nice feature of mDNS is that if we have an AirPrint device
locally we can capture & print a register with only a few taps
on an iPhone or iPad.
Once a network connection is established it will be remembered.
The access point won’t start again if it can connect as a client
to a familiar network.
Home again
On the home page we’re invited to set the time. The device doesn’t
have a Real Time Clock (RTC) & doesn’t remember the time. The
time can be synchronised with a laptop/phone/whatever from a
browser using JavaScript. This is quite useful as it means that we
can’t be out of sync. I'll probably add a RTC, the jury is out on
this. I've tried using NTP servers for setting the time but found
this to be a little hit & miss.
When the time has been set it's indicated on the home page.
There's other stuff here too, primarily for my debugging:
By default, the register closes automatically after 15 minutes but
the time out is programmable from the TIMER page:
The home page is where the current register ‘exists’. As cards are
presented a table grows on this page, this is more for reassurance
(& debugging) than anything else. This is what it looks like:
Names & Numbers
The register which appears on the home page is simply a table of
UIDs & the time they were registered.
MyRegister uses the Unique Identification (UID) feature of Mifare
cards. This is a 32 bit number, not a name. At
some stage it will be necessary to associate numbers with names.
This might be done by some ‘central admin’ service but it’s likely
that the person collecting the attendance data will need/want to
do this.
On the home page we might see a message: A list of
names (names.csv) has been found…
Probably the most elegant way to match names & numbers is
through a lookup table in a spreadsheet (see later) but MyRegister
can also achieve this independently. The ‘names.csv’ file is a
‘comma separated value’ file which associates names & UIDs. An
example snippet of such a file is shown below:
1542003658,Purple Peter
186850250,Green Sarah
2581507054,Ehuoyan Ed
709254167,Stronglink Sam
2075269578,Jones Janet
2078743498,Smith Jimmy
1078358149,Bloggs Fred
1522158517,Smith Joe
2521235173,Brown Billy
320094120,White Jack
3943439050,Bluehat Billy
This file must be created/provided by the user and uploaded to the
device from the UPLOAD page:
MyRegister detects the existence of the file & if it's found,
offers us the opportunity to replace numbers with names. If the
file isn't found the option isn't offered.
The sorting & filtering is actually achieved using JavaScript
in the user’s browser rather than on the MyRegister device. This
is of no particular significance but it obviously requires the
browser to have JavaScript enabled.
The names.csv file is converted to a JavaScript ‘table’ by
MyRegister and embedded in the register web page, as a consequence
the page loads more slowly if the file is very large. The same
list of names is used for every register, in other words it
contains the names of every student we might encounter across all
classes.
Clicking the 'Look up Names' button reveals:
Excel
Any serious 'local' use of the data collected by MyRegister is
best off loaded to something like Excel. We can import data from
'the web' directly into an Excel spreadsheet:
Clicking the 'From Web' button opens a browser window in Excel
which highlights those parts of the page which can be imported.
Here I've selected (the green tick) the table showing RFIDs and
times:
Excel asks where we'd like to put the data:
And Bob's yer uncle:
From here it's fairly simple to convert the numbers to
names using a lookup table in the spreadsheet.
There are several advantages in using Excel:
- The spreadsheet can be formatted exactly
how the user wants
- Data is easily collated & analysed
- Filesize on the device is reduced
- Provides an archive
- etc.
I'm confident that this approach can be used with
Open Office too but not tried it.
Storage
Whether or not we use Excel, registers are stored on the device
using its file system:
There are a few 'helper' files here too, the actual registers are
tagged with their creation date which makes them easier to find.
The strange numerical filenames are unix timestamps denoting the
creation date/time of the register. This is to help with
remote/automated collection of data.
All of the files on this page are 'clickable'. Clicking a register
page opens the register which looks exactly like an open register
on the home page.
A facility is provided for deleting single files here and it's
possible to delete ALL registers (perhaps at the end of term?)
from a URL.
Deleting ALL registers is quite drastic so I've deliberately
avoided a 'single click'
It's possible for the user to upload their own 'helper' files too
- note in the picture above there is an example Excel spreadsheet.
Despite the limited storage capacity there is scope for retaining
several hundred registers. The html files are terse and
correspondingly small.
Conclusion
Have you ever looked at the boxes on
the walls of our lecture theatres which are used to collect
attendance data?
I'm told these are very expensive and some of our
rooms have several of them.
MyRegister costs less than £10 to build in one off
quantities.
I'm quite pleased with this. I've produced a very capable IoT
device for only a few quid. There is plenty scope for enhancements
- maybe a few student projects?
/etc
I've skated over, or omitted quite a bit here for the sake of
brevity. MyRegister has a few other features but I think I've
covered the essential details.
I've not talked at all about deployment or data collection. I've
endeavoured to make MyRegister as generic as possible by using
HTTP. There probably is no 'one size fits all' solution!
I've not mentioned security apart from discouraging use in AP
mode. Simple security methods may be implemented soon...
Where do we get the student RFIDs to make (eg) the names.csv file?
It's quite tedious to collect these...
mDNS is great but Android doesn't do it(?) I'm looking at this...
etc.
Where to connect? Eduroam is a no-no :( Aether is a maybe...
I've reached a point where I need to test & get some feedback.
My code needs a little tidying but I'm disinclined to add anything
new at this stage unless I can identify a real need.
Ian Sexton 2016