51 (edited by rhys 2017-10-01 12:10:19)

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

cgrillo wrote:

OK, I'm completely new to Python so am probably doing a really silly thing - but I can't get the instructions on
https://github.com/rhysbryant/readerEmulatorClient
to work....

C:\Users\Charlie\Desktop\readerEmulatorClient>"C:\Program Files (x86)\Python\python.exe" readerClient.py --readerPath=COM1 --file=pageData.txt --cmd=writeToFile
Traceback (most recent call last):
  File "readerClient.py", line 22, in <module>
    import readerSerialConnection
  File "C:\Users\Charlie\Desktop\readerEmulatorClient\readerSerialConnection.py", line 22, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'

Python is installed in the path specified.
Module has been changed to COM1

it requires pyserial to be installed. alternately I've attached the Windows GUI client to the first post in this thread note support for this may be dropped in the future as I would prefer to move to one one solution for all platforms.

52 (edited by rhys 2017-10-01 12:37:02)

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

cgrillo wrote:

OK, I'm completely new to Python so am probably doing a really silly thing - but I can't get the instructions on
https://github.com/rhysbryant/readerEmulatorClient
to work....

C:\Users\Charlie\Desktop\readerEmulatorClient>"C:\Program Files (x86)\Python\python.exe" readerClient.py --readerPath=COM1 --file=pageData.txt --cmd=writeToFile
Traceback (most recent call last):
  File "readerClient.py", line 22, in <module>
    import readerSerialConnection
  File "C:\Users\Charlie\Desktop\readerEmulatorClient\readerSerialConnection.py", line 22, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'

Python is installed in the path specified.
Module has been changed to COM1


**EDIT***
OK, installed pyserial using PIP...

now get..

Traceback (most recent call last):
  File "readerClient.py", line 161, in <module>
    main()
  File "readerClient.py", line 153, in main
    c.connect(args.readerPath)
  File "C:\Users\Charlie\Desktop\readerEmulatorClient\readerSerialConnection.py", line 27, in connect
    self.serial = serial.Serial(comport)
  File "C:\Program Files (x86)\Python\lib\site-packages\serial\serialwin32.py", line 31, in __init__
    super(Serial, self).__init__(*args, **kwargs)
  File "C:\Program Files (x86)\Python\lib\site-packages\serial\serialutil.py", line 240, in __init__
    self.open()
  File "C:\Program Files (x86)\Python\lib\site-packages\serial\serialwin32.py", line 62, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM1': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)

** EDIT 2 **
Ran as administrator
Getting better smile

Writing
No output..  but an empty file


Reading

C:\Users\Charlie\Desktop\readerEmulatorClient>"C:\Program Files (x86)\Python\python.exe" readerClient.py --readerPath="COM1" --file=pageData.txt --cmd=readFromFile
Traceback (most recent call last):
  File "readerClient.py", line 161, in <module>
    main()
  File "readerClient.py", line 158, in main
    reader.writePagesFromFile(args.file)
  File "readerClient.py", line 82, in writePagesFromFile
    line2 = line.rstrip('\n')
TypeError: a bytes-like object is required, not 'str'

What format must the input file be in?

one page per line in Hex so 8 chars.
Edit: what python version do you have? can you try changing line 80 to fl = open(filename, 'r')

53

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

rhys wrote:
cgrillo wrote:

OK, I'm completely new to Python so am probably doing a really silly thing - but I can't get the instructions on
https://github.com/rhysbryant/readerEmulatorClient
to work....

C:\Users\Charlie\Desktop\readerEmulatorClient>"C:\Program Files (x86)\Python\python.exe" readerClient.py --readerPath=COM1 --file=pageData.txt --cmd=writeToFile
Traceback (most recent call last):
  File "readerClient.py", line 22, in <module>
    import readerSerialConnection
  File "C:\Users\Charlie\Desktop\readerEmulatorClient\readerSerialConnection.py", line 22, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'

Python is installed in the path specified.
Module has been changed to COM1

it requires pyserial to be installed. alternately I've attached the Windows GUI client to the first post in this thread note support for this may be dropped in the future as I would prefer to move to one one solution for all platforms.


The windows gui works fine - thanks
I'll just uninstall python smile

54 (edited by cgrillo 2017-10-01 12:53:41)

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

Ok, the windows app writes to and reads from the unit fine.
I'm assuming that the unit needs power whilst in the printer - so it's connected to usb.

How many pages of data does the input file need?
Should that include the Password and PACK code?

Sorry for all the questions...

** EDIT **


Ignore the above - it's working perfectly and I'm doing a test print.

55

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

cgrillo wrote:

Ok, the windows app writes to and reads from the unit fine.
I'm assuming that the unit needs power whilst in the printer - so it's connected to usb.

How many pages of data does the input file need?
Should that include the Password and PACK code?

Sorry for all the questions...

Yes the boards require USB power.
the input file should be all 46 pages with Password and PACK code included.

56

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

If you use my daVinci Tag Manager (  http://www.soliforum.com/topic/16627/da … g-manager/  ) It will output the file required.  If this week goes as planned, I will update it with the button to program Rhys's emulator.

57

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

The earlier print worked fine, until it was about to finish.
The printer then beeped and displayed “spool error”.
Powered printer off/on and then wouldn’t print any more due to “unidentified spool”
Haven’t had time to dump off the stored card details yet.

58

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

cgrillo wrote:

The earlier print worked fine, until it was about to finish.
The printer then beeped and displayed “spool error”.
Powered printer off/on and then wouldn’t print any more due to “unidentified spool”
Haven’t had time to dump off the stored card details yet.



I haven't seen the  “spool error” under normal operation maybe there was a loose connection.

“unidentified spool” I have seen this happen after disconnecting and reconnecting power recently I'm working on a firmware update that I'll release sometime this month. that verifies the data was correctly written to the Emulator's EEPROM on tag data upload. where as the current verification process only checks it was uploaded to RAM correctly.

59

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

I had that one time after a quick power brownout.  I rebooted the Jr, and have never seen it again

60

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

rhys wrote:
cgrillo wrote:

The earlier print worked fine, until it was about to finish.
The printer then beeped and displayed “spool error”.
Powered printer off/on and then wouldn’t print any more due to “unidentified spool”
Haven’t had time to dump off the stored card details yet.



I haven't seen the  “spool error” under normal operation maybe there was a loose connection.

“unidentified spool” I have seen this happen after disconnecting and reconnecting power recently I'm working on a firmware update that I'll release sometime this month. that verifies the data was correctly written to the Emulator's EEPROM on tag data upload. where as the current verification process only checks it was uploaded to RAM correctly.

I'll play with it when I have more time - but on first impressions it seems to be a nice solution to the tag issue.

61 (edited by mjf55 2017-10-03 12:59:51)

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

I had a spool error last night.  I did power cycle the RPi ( which powers the emulator.) prior to noticing it  I dumped the emulator and did a diff with the original file.  Here it is.  Note the length is waaaay wrong (9999M ( I wish) and pack code changed.   UMMMMM

SpoolError:     Original File
0405ceaa        0405CEAA
2ab44281       229A3D81
79480000       79480000
e1101200       E1101200
0103a00c       0103A00C
340300fe        340300FE
00000000       00000000
00000000       00000000
5a505a00       5A505A00
0035344a       0035344A
e0930400       E0930400
e0930400       E0930400
d2002d00       D2002D00
54484742       54484742
e09304ff         E09304FF
00000000       00000000
00000000       00000000
34000000       34000000
00000000       00000000
00000000       00000000
98929800       E0930400
d080aa54       A8813654
083e7a31       F03FEECE
aa6d2177       F26E4D76

00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
000000ff         000000FF
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
00000000       00000000
000000bd       000000BD
070000ff         070000FF
80050000       80050000
73f528c1        73F528C1
f97e0000        51170000

Interesting that the checksum data (page 21, d080aa54 ) is CORRECT for the length of 9999000 mm (page 20, 98929800)

62

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

I dumped the data from my unit after it failed and I had the same issue.

My Page 20 value is now "D11B0000" (7.121m) was originally "E0930400" (300m) - I didn't use that much filament!!
Pages 21-23 values had also changed - but this is expected.

What concerns me is that the Password and PACK code had also changed!

63

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

cgrillo wrote:

I dumped the data from my unit after it failed and I had the same issue.

My Page 20 value is now "D11B0000" (7.121m) was originally "E0930400" (300m) - I didn't use that much filament!!
Pages 21-23 values had also changed - but this is expected.

What concerns me is that the Password and PACK code had also changed!

Do you know if anything external happened to you emulator?  Like I know I had 2 power outages ( one accidental i.e. neighborhood power outage, the other a power off / on to reset my RPi )

64

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

mjf55 wrote:
cgrillo wrote:

I dumped the data from my unit after it failed and I had the same issue.

My Page 20 value is now "D11B0000" (7.121m) was originally "E0930400" (300m) - I didn't use that much filament!!
Pages 21-23 values had also changed - but this is expected.

What concerns me is that the Password and PACK code had also changed!

Do you know if anything external happened to you emulator?  Like I know I had 2 power outages ( one accidental i.e. neighborhood power outage, the other a power off / on to reset my RPi )

No, mine was powered throughout via a USB powered hub / PC - on a UPS...
Cable is well out of the way and so wasn't disturbed.

65 (edited by jeboo 2017-10-19 22:02:01)

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

mjf55 wrote:

Well, it's much easier to design a small box than re-layout a board.  But that is up to Rhys, and he needs to make a common board for both jr and mini.

I went ahead and whipped up a quick replacement cover for the mini w. I'm waiting on the board to arrive, so I guesstimated the clearance required for now (probably a bit too large). I'll refine it and throw it on thingiverse once I have the hardware. For now, I'll just attach the .scad/.stl here.

Long-time developer/reverser (mostly Android as of recent), looking forward to joining the party smile

Updated (10/19): v2 of cover, improved fit, added usb cable holder

Post's attachments

emu_cover_mini_w.scad 2.58 kb, 8 downloads since 2017-10-19 

emu_cover_mini_w.stl 146.02 kb, 13 downloads since 2017-10-19 

You don't have the permssions to download the attachments of this post.

66

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

Got my emulator this week, working like a charm! Thanks rhys

PS - I updated my post above for the retrofit cover to use with the mini w. You will need to widen the screw holes on the emulator with a 1/8" bit to accommodate the stock screws.
http://soliforum.com/i/?VnZZpYV.jpg

67

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

Nice job jeboo.

68

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

boards are now back in stock!
the new board version does support being powered by the printer (no longer requires constant USB Power).

I'm trialing the use of a different online store platform for selling the current batch (link in first post in this thread).

69

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

rhys wrote:

boards are now back in stock!
the new board version does support being powered by the printer (no longer requires constant USB Power).

I'm trialing the use of a different online store platform for selling the current batch (link in first post in this thread).

Interesting that you can power the master from a slave USB device.  If both are plugged in USB from PC and the printer,what power source takes precedent?

70

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

rhys wrote:

boards are now back in stock!
the new board version does support being powered by the printer (no longer requires constant USB Power).

I'm trialing the use of a different online store platform for selling the current batch (link in first post in this thread).

Is there an easy "hack" to the v1 boards to nick the power supplied by the printer and channel it to the Vin?

71

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

mjf55 wrote:
rhys wrote:

boards are now back in stock!
the new board version does support being powered by the printer (no longer requires constant USB Power).

I'm trialing the use of a different online store platform for selling the current batch (link in first post in this thread).

Interesting that you can power the master from a slave USB device.  If both are plugged in USB from PC and the printer,what power source takes precedent?

technically it is the slave

USB precedent over the printer power rail supplied by the 6 pin connector. (auto cut over)

72

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

cgrillo wrote:
rhys wrote:

boards are now back in stock!
the new board version does support being powered by the printer (no longer requires constant USB Power).

I'm trialing the use of a different online store platform for selling the current batch (link in first post in this thread).

Is there an easy "hack" to the v1 boards to nick the power supplied by the printer and channel it to the Vin?

the same functionality could not easily be achieved on the existing v1 boards.

73

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

rhys wrote:
cgrillo wrote:
rhys wrote:

boards are now back in stock!
the new board version does support being powered by the printer (no longer requires constant USB Power).

I'm trialing the use of a different online store platform for selling the current batch (link in first post in this thread).

Is there an easy "hack" to the v1 boards to nick the power supplied by the printer and channel it to the Vin?

the same functionality could not easily be achieved on the existing v1 boards.

ah bugger sad

74

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

cgrillo wrote:
rhys wrote:
cgrillo wrote:

Is there an easy "hack" to the v1 boards to nick the power supplied by the printer and channel it to the Vin?

the same functionality could not easily be achieved on the existing v1 boards.

ah bugger sad

just to add,
sure there is two points on the board that if you jumper-ed a wire between them it would run off the power pin of the connector but then there is no isolation between the printers 3.3v rail and the boards own 3.3v regulator powered by USB connector when connected to USB this may cause issues. the cut over between the two power sources is implemented on the v2 boards.

75 (edited by nilezon 2017-11-19 08:09:35)

Re: Davinci Jr/Mini emulating the NFC reader and tag on demand UID cycling

rhys wrote:

boards are now back in stock!
the new board version does support being powered by the printer (no longer requires constant USB Power).

I'm trialing the use of a different online store platform for selling the current batch (link in first post in this thread).

Maybe you can re-program the emulator to automatically respond with a random (full) NFC tag every reboot (power cycle), and remove the need to even connect the emulator to a PC? This would be the ultimate solution to the third-party filament problem.