JamesNZL / nx-makerspace-rfid-reader

A simple Arduino RFID reader project for Northcross Intermediate's Robotics & Makerspace class.
https://jamesnzl.xyz/nx-makerspace-rfid-reader
0 stars 0 forks source link

Project planning #1

Open JamesNZL opened 1 year ago

JamesNZL commented 1 year ago

An issue to define problem/specifications/implementation plan/etc.

JamesNZL commented 1 year ago

Wed, 24 May 2023 at 15:16

Dear <>,

<> has come home with an Arduino and some parts, and has asked if it would be possible for me to help get it to work. Unfortunately I do Engineering Science, which doesn't really cover this sort of thing, however I do know some Computer Systems Engineering students who may be able to help. They have given me a list of questions to ask in order to get a better idea of what is required/needs to be done:

1) What are the expected timeframes for this project?

  • Exams are in a months, so most people will not be free until then 2) What is the budget for this project?
    • Will additional parts need to be brought etc.? 3) What does an 'ideal' solution look like?
  • How do you see this being used?
  • How will a student log into a room?
  • How will staff access these logs?
  • What will these logs need to be used for? 4) What solutions have been tried so far?
  • What is currently being used? 5) Have commercial solutions been looked into?
  • Is there a reason to try do it from scratch, for example is this for learning/teaching engineering, software, and/or hardware? 6) Does the solution need to be scalable?
  • How many rooms does this need to deployed to?
  • How many often will students use this?
  • How often will the logs be accessed? 7) Does this need to link into any other software e.g. electronic roles?
  • If yes, what software will it need to connect to? 8) Is this a class project?
  • Do students need to be able to understand how it works?
  • Sorry in advance for asking lots of questions in one go, but hopefully this will make it clear what is required.

Kind regards, <>

JamesNZL commented 1 year ago

Sun, Jun 4, 2023 at 10:28 PM

Hi <>,

Thanks for getting back to me and sorry it has taken me a while to respond fully.

My idea for the project was as follows:

  1. It is small scale - only to work for the students in my Friday Makerspace class. I thought it would be an easy way for them to sign in (and possibly out) as they come into the classroom rather than me take the roll at the beginning of the bell.
  2. The students in this class would all have their own RFID that they could scan in with- it would just need to register a "present mark" next to their name- this could be done as simply as on a Google Sheet that only i need access to
  3. I thought it would be pretty simple that you could scan a card and that number is assigned to a student and it said that they were "present" on that given day. There is no desire to make this extend outside of this class to the whole school at all. It would probably serve about 40 students a year.
  4. In terms of budget - i just thought about buying more RFID tags/cards and possibly anymore arduino parts i needed- the school internet network could scarper the whole thing if i use WiFi as its pretty locked down. In terms of paying someone to do this, i hadn't considered it before we tried to do it. The complexity of such a project is unknown to me. My experience with Arduino normally involves following some tutorials and tweaking a small part of code to get a project to work. I guess the question I have is, how difficult and how much time would this take for such a project? Is doesn't need or want to be complex.

I am not sure if this is something that is feasible- it was more a whimsical idea I had. I guess from your "team" we need to know what they think please. Is it easy, how much time will it take, is there any point in pursuing it for essentially a bit of fun? I never expected it to be quite a big challenge!?!

Appreciate your time and help in engaging your expert friends. Thank you and Speak soon,

<>

JamesNZL commented 1 year ago

Hi <>,

Thanks for getting back to me and sorry it has taken me a while to respond fully.

My idea for the project was as follows:

  1. It is small scale - only to work for the students in my Friday Makerspace class. I thought it would be an easy way for them to sign in (and possibly out) as they come into the classroom rather than me take the roll at the beginning of the bell.

Gotcha, makes sense.

  1. The students in this class would all have their own RFID that they could scan in with- it would just need to register a "present mark" next to their name- this could be done as simply as on a Google Sheet that only i need access to

This should be very doable.

A little lookup table mapping each student's RFID identifier to <some destination data> should do the trick—whether a row in a spreadsheet, a student ID, or something like that.

If you wanted to expand this to learn about software, I don't think it would be too much trouble to spin up a little express or Flask API endpoint that took an integer input (ie the RFID identifer) and then did the processing from a server-side script.

This might actually be easier to maintain/implement, as you can then make web calls from Node/whatever runtime, rather than doing it from the Arduino.

  1. I thought it would be pretty simple that you could scan a card and that number is assigned to a student and it said that they were "present" on that given day. There is no desire to make this extend outside of this class to the whole school at all. It would probably serve about 40 students a year.

Yes, this should be simple and achievable.

My main fear was scope creep—it wasn't clear at first whether you were looking for a school-wide 'production' solution, or if it was just a little project for a class to tinker with.

  1. In terms of budget - i just thought about buying more RFID tags/cards and possibly anymore arduino parts i needed- the school internet network could scarper the whole thing if i use WiFi as its pretty locked down. In terms of paying someone to do this, i hadn't considered it before we tried to do it. The complexity of such a project is unknown to me. My experience with Arduino normally involves following some tutorials and tweaking a small part of code to get a project to work. I guess the question I have is, how difficult and how much time would this take for such a project? Is doesn't need or want to be complex.

Yeah, that should be enough.

A rough BOM (bill of materials) off the top of my head (covering the main ticket items) would include:

I am not sure if this is something that is feasible- it was more a whimsical idea I had. I guess from your "team" we need to know what they think please. Is it easy, how much time will it take, is there any point in pursuing it for essentially a bit of fun? I never expected it to be quite a big challenge!?!

Easy—yes, I think so.

Time—depends on the aim. Elaborated below.

Point in pursuing it—now that I know the aim/specifications, yes, 100%, it sounds like a brilliant idea for an introductory project.

Big challenge—only if overengineered :sweat_smile:, or if the specifications were more complex, but this sounds fine.


Minimum Viable Product

What I envisage as a rough bare-bones solution (after only thinking about it for 10 minutes). See Scope for Further Development.

  1. RFID module connected to Arduino via breadboard or jumper/Dupont cables
  2. (For non-WiFi Arduino) ESP8266/other connected to Arduino to provide WiFi/Bluetooth functionality
  3. RFID module reads a pre-registered card
  4. RFID module transmits the read RFID identifier to the Arduino
  5. Arduino uses the RFID identifier and a lookup table to identify the cardholder
  6. Arduino makes an HTTP POST request to eg Google Sheets' API

Scope for Further Development

Very dependent on how keen the students are; how much learning you want to happen out of this; etc I (James) do need to keep in mind that these are intermediate students, not 2nd year ECE engineers :joy:

Not an exhaustive list, just some stuff I would have loved to have had exposure to when I was in intermediate.

Electronics

Software

Mechanical

Time Estimate

Assuming:

  1. A class that is keen to learn
  2. Students have very limited knowledge (ie keen, but assume no prior knowledge)
  3. Makerspace sessions are 1hr long
  4. Goal is for them to get a decent high-level awareness of concepts, but not necessarily thorough technical familiarity

    ie, the goal is to give them something fun to play/tinker/experiment with, and we are not hot-and-bothered about them retaining the knowledge or being able to reproduce it themselves.

  5. Most of the work will be done by the teacher/tutor, with explanations/context/anecdotes to engage the class
  6. BOM components are all available
  7. Teacher/tutor already has a (at least mostly completed) model solution before working through with the class

Assuming the above (most importantly #5), I could see the MVP being completed within 4–6 one-hour sessions, with ample time for explanations.

Each of the further scope points could probably be comfortably completed in 2 sessions.

If we wanted to give the students time to work through problems themselves/in small groups before moving on together as a class, I would estimate 1.5x/2x the above estimates.

These would have be quite heavily guided though, and be very small, bite-sized problems to give an opportunity to apply previously-discussed concepts; not necessarily research (unless the students are very switched on).

Definitely keen/happy to help/support if wanted 🙂.

JamesNZL commented 1 year ago

Gentleman,

Thank you for your time and patience once again to this point. It has been a hectic end to term here (just like yourselves) and I thought it was best to hold off on this until you were clear of exams etc too.

James, hello and thank you for your input so far- fantastic!

I have just read through the github repository. Something new for me there. It is probably easiest if I respond on here as I don't want to disturb your notes flow thus far.

No worries at all if you just add your responses as a new comment below, if anything it just helps us keep everything in one place.

So, in that sense, here we go:

I think the first thing to make clear is that the project wasn't intended for a whole class of students. It was a project that <> and I just discussed as something that she might be interested in doing in order to broaden her understanding of electronics and code. She had shown an interest last year in doing a project with the Arduino and I thought this might be something that she could have a crack at.

Ah, this is really good to know, cheers.

The idea is something more that I have had previously in the past about a way of using technology and demonstrating to the students a way that we can use an Arduino in projects in class. I was thinking about a smart mirror for some time and then how to get the information from the roll into that SmartScreen. Then I figured maybe RFID using the built-in boards that came with the Arduino kits that we have would be straightforward. However, it seems that I was mistaken as we have not been able to get it to work at our end at all really. I recall @Donut-the-1st coming to the school and being a strong student, particularly around all things technology and <> advised that he still retained an interest in coding. I thought we could ask him for some pointers so we were in the right direction as to what to do. Now we meet at this point where we are discussing this project in some depth.

Essentially what happens in the class on a Friday (they run once a week, Friday, from blocks 1 to 4, 9am to 1pm) is the students just turn up and get straight into whatever project they are making.

Wow, that's a really significant block of time—that's brilliant. Wish I had that 👀.

I thought that automating the roll would be a good idea as it stops me from being interrupted helping the students and plus we don't have to wait for everybody to arrive to commence. I was trying to do some simple facial recognition software with some students in order to make this role work as opposed to RFID. This wasn't successful despite my best efforts discussing with the developer in India for large proportions of lockdown. Then we ended it back at the RFID points this term when <> showed interest. I thought we could do this but it was not within my skill set and it started to become quite frustrating for me that I wasn't able to help her and help her to succeed with her project. So essentially the only student we need to teach how to do this is <> (@Donut-the-1st's sister) probably me the teacher lol.

Yeah, I'm not sure if there really is a such thing as 'simple facial recognition software'; in any case, I don't have any experience in facial recognition so wouldn't be a terrible amount of help there.

RFID can definitely be tricky to get up and running without much to build upon, but I'm sure it'll be achievable with a bit of support.

Good to know that this is only necessarily targeted towards a small handful of students/yourself.

I like the idea of integrating some lights into the system as a visual recognition of you scanning in and it working. We have some PCB boards at school that we could potentially wire ourselves and all we could develop and send it away and get that made for us, happy to do this. We also have access to 3D printers here at school so we could look at the sign and closure as well, no problem at all there. Also, making the Arduino run off battery power only would be perfect as we would only need it running on Friday's.

Brilliant.

Additional thoughts on The Project

  • I could look to try and recruit another student or two to assist <> and myself, who already have an expertise/interest in coding.

The more the merrier, if there're other students that are keen.

  • anything that we try to make work across the school's Wi-Fi using servers etc could likely end in it be in unsuccessful due to the nature of the network system here at school being very constricted and i have no say or access to controlling this

This wouldn't necessarily affect any of the additional backend services/API possibilities that I mentioned—that can all sit on our own server somewhere off the school network, and be accessed like any other website.

The only implication that this may have is that the Arduino itself may be unable to connect to the school WiFi (and hence the internet), which would make it harder to have the RFID attendance data to go anywhere.

We could work around this in a few ways:

  1. Keep another network-connected computer attached to the Arduino whilst in use, and send data over the serial port.
  2. Use an Ethernet shield, if you have wired Ethernet access to the school network (though I suspect this would also be locked down).
  3. Use a cellular data connection.
  • significant plot shift is do we just shift back to facial recognition and go along that Avenue as opposed to using the RFID. What may be simpler??? I was thinking that in future years we just real name the RFID username to the new students they're in the class but if we could do a simple scan of the face and attach it to a new name then that would be even cooler potentially.

As I mentioned above, I don't have any experience with facial recognition and I'm almost certain that it'd be much more difficult than RFID.

It would be cooler, but I think it'd produce less learning outcomes (less systems understanding, and more 'the black box does the work').

I also suspect there'd be a few ethics/privacy considerations to be made with facial recognition—not sure how keen some parents might be on having their child's biometric signature being used.

James & @Donut-the-1st, how do we proceed from here? I'm conscious that i am asking a lot of you both and you are helping out of your own sincere kindness. Coding outside of scratch is not something I know a lot of (I have done simple Arduino and Raspberry Pi projects- following tutorials) and realise that potentially this makes things even more challenging for yourselves to assist. I am keen to learn and determined to help <> have success with her learning.

I don't see this as a problem at all; I always find reward in doing what I can to help give younger students the opportunities that I wish I would've had.

I was really fortunate to go to schools with some really stand-out Technology teachers (TNIS & Westlake), who played such a pivotal role in getting me to where I am now—including electronics/robotics teachers who were extremely passionate but learnt alongside the class—which sounds to me like yourself :smiley:.

In terms of where-to-from-here—I'm keen to get as much of the ball rolling on this as possible whilst we're still on Semester Break (Semester Two begins at the same time as Term 3)—so I'm aware that although it is school holidays for you, perhaps it might be a good idea for us to come in and sit down at some point in the next week to talk about where the project sits currently, next steps, and to kick-off?

Cheers 🙂

JamesNZL commented 12 months ago

Hi <>,

Have got a working sketch that you guys can try out. You can find the code here, and a demo video here.

Let me know if this works 🙂

If you guys are able to get this uploaded and working, you can start having <>/others think about how to flash an LED at the same time, etc. We'll get some proper guiding questions sent over soonish.

Cheers,

James

JamesNZL commented 12 months ago

Fantastic news! I can see the code file and have just watched the short video, perfect. Looks to be working a charm, thanks!

I will get it wired up and tested this coming week and advise of the progress. I'll even throw the light challenge out.

Sweet as, sounds good.

Is the code language just written in the default Arduino script? No Python or anything like that? Additionally, do I need to download any libraries to run with it? If so, which one(s)?

Ah sorry, made a mental note to mention which library, but forgot—using a single library, RFID_MFRC522v2. image

Yup, this Arduino sketch is in Arduino C++ only.
Python/other would only be for the backend server once we have that spun up.

A side thought I had post Wednesday, could we make it so the kids could scan out as well as in? Just a question at this stage and one that hopefully the students could solve if it is possible.

Had this thought myself earlier—yes, absolutely possible.

There is already a TODO marked to 'debounce' the scanning—basically, the idea here is that even though the reader.PICC_IsNewCardPresent() method supposedly ensures that each card is only processed once each time it is placed up to the scanner (and this does mostly work, as you would have seen in the video), it isn't 100% reliable (and we would expect some users to want to 'confirm' their card has been scanned by trying again, like you see with some people scanning their HOP cards).

So, we probably want to 'debounce' any repeated processing by adding a cooldown to each card, eg the same card cannot scan in then scan out within 30 seconds, or some reasonable value like that.

If we have this going, then we can definitely just treat the first scan event as a 'scan in', and the subsequent scan event as a 'scan out' (with some forced global 'scan out' at midnight for example, for anyone who might have forgotten to scan out before leaving). These are good problems to try and get the students to identify and solve by themselves, though.

We could do this in the Arduino code, but it'd be easier to do on the server (ie the Arduino sketch just reads the card then sends the message, and we do all the 'smart' logic on the server).

Thanks heaps for your time and effort so far with the project! I really enjoyed meeting on Wednesday, it was a pleasure to spend time with you both and humbling how willing you both are to help the younger generation; awesome.

I'll be in touch soon with a working prototype 🤞

Pleasure was all mine, sounds good!

JamesNZL commented 11 months ago

Electronics

Software

Mechanical

JamesNZL commented 9 months ago

James,

Long time no speak! I hope you are well and have been enjoying a good semester at university. We have had various interruptions at school this term and our RFID project has been stalling. This morning <> and I sat down to address where we are at and how we progress. Currently, we have the RFID scanning and a green light shining when you scan in. Our issues are around this voltage divider. We can not seem to find a simple example to follow- wiring diagram and or code. Lots of the examples we have found are either text only (hard to comprehend) or use an LCD to display the values and we can't get success. Once we figure this out (hopefully you can assist more, please) then we can look at the PCB design. The API guy is hard work to get involved so i need to look for a new target to help with this. <> is very keen to get this project finished before she leaves in December, however, it is a little above her expertise despite her efforts. Do you have any free time currently to assist us? I understand you may be busy with exams etc. so very happy for your help when possible.

Regards,

<> & <>

JamesNZL commented 9 months ago

Hi Marc & Sienna,

Great to hear from you again! Perfect timing with your email—it's been a busy week, but next week is a sort of 'reset' before new deadlines appear again.

Here's a little taster of what I've been working on—it's a robot that is able to find the shortest path through a maze (though the video just shows a simple line) that is projected down onto the ground (so a little bit tougher than just a typical line-following robot, as the projected light is not constantly on/off) 🙂 301 PCB Render

Currently, we have the RFID scanning and a green light shining when you scan in. Our issues are around this voltage divider. We can not seem to find a simple example to follow- wiring diagram and or code. Lots of the examples we have found are either text only (hard to comprehend) or use an LCD to display the values and we can't get success.

Glad to hear that you've had at least some success!

Can I ask what you're trying to achieve with the voltage divider/what are you trying to do? A voltage divider is constructed out of two resistors in series with each other, and is used to step down a given voltage to some lower value—for example, 'dividing' 5V in half to 2.5V. If you can let me know what you're trying to get working, I can help a bit more :)

Once we figure this out (hopefully you can assist more, please) then we can look at the PCB design.

Of course!

The API guy is hard work to get involved so i need to look for a new target to help with this. Sienna is very keen to get this project finished before she leaves in December, however, it is a little above her expertise despite her efforts.

That's unfortunate, but I'm sure we can overcome. I'm happy to help where needed, just keep me in the loop!

Cheers,

James

JamesNZL commented 9 months ago

https://github.com/JamesNZL/nx-makerspace-rfid-reader/assets/44986932/c743573e-32b8-49c6-b51a-792b3212405a

JamesNZL commented 9 months ago

James,

That PCB looks pretty intense. I'll have to view the video outside of the school network, they don't allow discord....

The voltage divider, as you suggested, was so that we could read the battery level (using the Analog pins) that is powering the circuit. Then if the voltage dipped below "x" amount a red led would illuminate and we knew to charge and/or switch out the batteries. She/we just need a straight forward tutorial that she can follow and then add the code to the RFID code. Once that is done, PCB design and then case design would be left on the hardware side. Then into the API and assigning RFID tags to students.

I'll be happy to get it done to be honest, it has been dragging a bit this term and I have been stretched with more material based projects with the students. Do you think we can do this all remotely or would a meet up be good/better?

Thanks again for your expertise,

<>

JamesNZL commented 9 months ago

Hi Marc,

I have mirrored the video here for you: https://github.com/JamesNZL/nx-makerspace-rfid-reader/issues/1#issuecomment-1730524108

The voltage divider, as you suggested, was so that we could read the battery level (using the Analog pins) that is powering the circuit. Then if the voltage dipped below "x" amount a red led would illuminate and we knew to charge and/or switch out the batteries. She/we just need a straight forward tutorial that she can follow and then add the code to the RFID code. Once that is done, PCB design and then case design would be left on the hardware side. Then into the API and assigning RFID tags to students. 

Righto, I suspected this would be it. Arduino Voltage Sensor Tutorial — Schindler Electronics this tutorial seems to be reasonably straightforward, though this may be the text-only one you referenced? Feel free to give me a ring before 2pm if you'd like to discuss any specific problems.

As in my last email, the voltage divider is used to step-down the battery voltage into a range that will not damage the Arduino, using a constant ratio that is defined by the resistors.

If the batteries have a maximum voltage of eg 9.6V, we can divide by a factor of 2 to produce a voltage range of 0V–4.8V, which will be suitable to be read by the Arduino.

A factor of two with a voltage divider is just two equal resistors such that

V_\text{out} = V_\text{in} \left(\frac{R_1}{R_1+R_2}\right)

becomes

V_\text{out} = V_\text{in} \left(0.5\right)

A good 'rule-of-thumb' value that is typically chosen is $R_1 = R_2 = 10\ \text{k}\Omega$, as this means our voltage divider does not draw too much excess current from the batteries.

  1. Connect the two resistors in series
  2. Connect the positive terminal of the batteries to one end of the resistor network
  3. Connect the other end of the resistor network to the negative terminal
  4. Connect the middle of the resistor network to an analogue input of the Arduino
  5. Use analogRead(PIN) to read the voltage at the analogue pin
  6. You can either use the value of 01023 directly as your "x", or you can convert it into the actual battery voltage by
    float analogVoltage = analogRead(PIN) * (5.0 / 1024.0); // 5V analogue reference, 1024 values
    float batteryVoltage = analogVoltage / 0.5; // 0.5 is the ratio of the voltage divider

I hope this helps!

I'll be happy to get it done to be honest, it has been dragging a bit this term and I have been stretched with more material based projects with the students. Do you think we can do this all remotely or would a meet up be good/better? 

Meet up would always be better—I will be able to come in next Wednesday if that works?