Donkie / Spoolman

Keep track of your inventory of 3D-printer filament spools.
MIT License
891 stars 82 forks source link

RFID RC-522 #260

Open absak0 opened 8 months ago

absak0 commented 8 months ago

Is your feature request related to a problem? Please describe. RFID rc-522 support for per spool quick ID and possibly filament usage tracking ? like on the bambulab AMS ?

Describe the solution you'd like The rc-522 module would need to be connected to the printers raspberry and communicate with the spoolsman instance that is on an other pi as most of us at least myself host spoolman on a proxmox server… (this would require a spoolman client that acts as a proxy for the spoolman instance…

Describe alternatives you've considered the elephant in the room….QR code exists…but the ease of use is…worst…

Additional context i would happily contribute, i can also work on a hardware integration for a voron 2.4.

absak0 commented 8 months ago

also btw, i just saw now that there are already an active development by other users… i will work on my side on a hardware setup for it and if someone wants to help me with the software part…or at least guide me where to start tinkering it would be super helpful.

npab19 commented 8 months ago

Hey I had a similar idea to this yesterday and started working on it today.

I'm not great with coding but I'm using what I know.

I took an old ESP8266 and loaded ESPHome on it. I was then able to add an SPI bus and the RC522 to that bus. For now I have it posting the UID to webhook.site just as a test and so far its working well. I ran into an issue relizing the RC522 cant read NDEF data. So I'm waiting for a new NFC reader.

The idea is to set a text field on each NFC tag with the spool ID. ESPHome will read that text field and send a post request to moonraker. Moonraker will then set the active spool and sync usage back to spoolman.

I have found some problems with this setup such as,

I think it would work better if it was a plugin in moonraker. This way it could read the NFC UID and use that as a unique identifier for each spool. If it finds the UID in Spoolman then it sets it to the current spool, If not it could prompt the user in moonraker to make a new spool in Spoolman.

The real reasons I came to issues was looking for a feature request on custom fields so I can use it for the UID.

TBH this might drive me to learn Python enough to finish this. I know you cant use this not but its an idea.

absak0 commented 8 months ago

Hey I had a similar idea to this yesterday and started working on it today.

I'm not great with coding but I'm using what I know.

I took an old ESP8266 and loaded ESPHome on it. I was then able to add an SPI bus and the RC522 to that bus. For now I have it posting the UID to webhook.site just as a test and so far its working well. I ran into an issue relizing the RC522 cant read NDEF data. So I'm waiting for a new NFC reader.

The idea is to set a text field on each NFC tag with the spool ID. ESPHome will read that text field and send a post request to moonraker. Moonraker will then set the active spool and sync usage back to spoolman.

I have found some problems with this setup such as,

  • Needing yet another piece of hardware.
  • Having to manually set NDEF data on each NFC card.

I think it would work better if it was a plugin in moonraker. This way it could read the NFC UID and use that as a unique identifier for each spool. If it finds the UID in Spoolman then it sets it to the current spool, If not it could prompt the user in moonraker to make a new spool in Spoolman.

The real reasons I came to issues was looking for a feature request on custom fields so I can use it for the UID.

TBH this might drive me to learn Python enough to finish this. I know you cant use this not but its an idea.

Wow that's great !

Thanks for your work

The only thing that's gripping me with this integration is that it uses HA if I understand correctly ?

~~Maybe it would be good to look for a way to have the I2C bus on the raspberry pi instead, so we do not need any other hardware ?

then maybe have something like this : https://pypi.org/project/remote-i2c/

Which could run in parallel of moonraker/klipper and transfer the I2C tag reader to the device that hosts spoolman and have a second script that checks for the UID and compares it to the database where everything is happening greatly reducing code complexity and not having to deal with moonraker APIs~~

Woops sorry scrap that I just realized that you actually want to communicate with moonraker to change the active spool mhmh I'll think about it

Then your proposed way of handling UID seems pretty straightforward...

I know a bit of python I started learning it for work stuff so I will try that approach...

The stuff that will lack in this integration will be my front end integration I absolutely suck at anything UI so I'll try something and report back my findings once I have something...but it will most likely be in the form of a CLI...

But there's already something and i don't think it's that complicated to make (hopefully)

bofh69 commented 6 months ago

I have an implementation for that here: https://github.com/bofh69/nfc2klipper/

I've not tested it so much yet, but so far it seems to work fine for me. I use a PD532 connected to the rpi's UART. nfcpy also supports other ways of connecting NFC readers, I think.

absak0 commented 6 months ago

I have an implementation for that here: https://github.com/bofh69/nfc2klipper/

I've not tested it so much yet, but so far it seems to work fine for me. I use a PD532 connected to the rpi's UART. nfcpy also supports other ways of connecting NFC readers, I think.

That's neat thanks, i'll look into that!