I have been trying to detect an tag using the PN532 module that I bought from amazon here:
https://www.amazon.ca/ASHATA-Controller-Raspberry-Interface-Switching/dp/B07XFNDHNS
I followed the tutorial here:
http://wiki.sunfounder.cc/index.php?title=PN532_NFC_Module_for_Raspberry_Pi
I tried using both I2C or SPI, but both results just give me the following when I run nfc-poll:
nfc-poll uses libnfc 1.7.1
NFC reader: pn532_spi:/dev/spidev0.0 opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
nfc_initiator_poll_target: Success
It seems like the PN532 is connected to the Pi properly, but the tag is not being detected or printing any info. I am beginning to wonder if the problem is with the PN352 device itself. Maybe I got a faulty one?
Thanks
Answer
Update 2020mar29hkt2040
Part 1 - libnfc v1.17 I2C config tested OK
The OP has no luck in testing libnfc I2C mode and SPI mode. I tried I2C mode and found everything OK. I guess the OP has not set the config file, or has not set "auto scan = true". See my example libnfc171 config file in Appendix A. PS - (1) My NFC reader can detect a tag without any problem. (2) I am using Rpi4B buster 2020mar13.
Part 2 - Now testing SPI mode 2020mar29hkt2044
Sunfounder config instructions recommends lowering SPI speed 50kHz. So I have changed the /bbo/config.txt file as shown in Appendix F.
/ to continue, ...
References
(1) The OP's NFC RFID Controller Module
(2) SunFounder Rpi PN532 NFC Module Tutorial
(3) Libnfc NFC Library
(4) Libnfc Configuration Manual
(5) Libnfc Main Page
(6) Libnfc: configuration
(7) Libnfc: nfc-list
(8) MIFARE Card
Appendices
Appendix A - Installing libnfc 1.7.1
Appendix B - Reading a tag
Appendix C - NFC Reader Tested
Appendix D - My NFC readers and tags
Appendix E - PN532 NFC reader V3 Wiring
Appendix F - SPI configuration for testing PN532 using libnfc 1.1.7
Related
i am trying to use my raspberry pi with google home through IFTTT but it seems that there is an error in my code.
So the situation is like this when i say "Hey google, turn on the servo", Google Mini will reply "Alright" and turn the servo.
However, i do get the reply "Alright" but my servo did not turn. Why is that so?
FYI: i am using raspberry pi 3 b+. The servo turns well without flask in the python code. Furthermore, when i access the url: XXX.XXX.XXX.XXX/5300, the servo did turned. What is the problem here?
This is my code
import RPi.GPIO as GPIO
from time import sleep
from flask import (Flask,render_template,request, jsonify)
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(13,GPIO.OUT)
app = Flask(__name__)
#app.route('/')
def index():
p = GPIO.PWM(13,50)
p.start(0)
p.ChangeDutyCycle(3)
sleep(1)
p.ChangeDutyCycle(12)
sleep(1)
p.stop
return 'Hello world'
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=5300)
In my IFTTT,
For
(1) What do you want to say: Turn the $
(2) What do you want the Assistant to say in response?: Alright
(3) URL: http://XXX.XXX.XXX.XXX:5300/
(4) Method: GET
Try to replace:
return 'Hello world'
with:
print ('Request Received')
Check if 'Request Received' will appear in the console when you ask google to turn servo - means IFTTT was able to reach your raspberry pi.
If not, check if your port 5300 where Flask server is running is open, it might be that IFTTT can't reach RPi and you may need to forward it on the router.
Check another example on my blog IFTTT, Python and Flask
Might be good to specify the HTTP method for your route decorator:
#app.route("/api/v1/users/", methods=['GET'])
At the moment I'm using Taskflow to specify my test workflow. I'm trying to understand if Robotframework can be used for my tests scenario.
For example, my typical test is:
- Start traffic on device1
- While traffic is flowing:
- Collect via SSH realtime traffic data on device2
- Collect via SSH realtime traffic data on device3
- Stop traffic on a device1
- Get output data from device2 and device3
- Check outputs
I did not find any workflow detail for Robotframework. Is it possible to design such a test in RF?
Riccardo
I believe it can be used for your scenario.
Robot Framework uses external libraries such as SSHLibrary
Here is a documentation to said library with description of concepts, keywords you can use and with examples.
A lot of things are generally possible with Robot Framework as you can always expand it's capabilities by writing your own external libraries if the commonly used ones are not matching your needs.
But it seems that this library might do exactly what you need.
You can open several connections
You can start/execute command
You can log to file or read output
...
Recently i was try to develop some simple SIMULINK model which receive UDP packet, make some calculation and return answer via other UDP port. Model work just fine, i was able to compile to EXE - no problem.
My goal was that model to work in real time - mean 1 second in simulation to be equal to 1 second in PC. So after research i discover that block:
Real Time Sync
which do the trick - now my simulation is work exactly as I want. Next when I try to build project - after make all changes in settings according documentation (mainly change target to sldrt.tlc) - at end of compile process i've got this:
### Created Simulink Desktop Real-Time module udpTest.rxw64
C:/PROGRA~1/MATLAB/R2017b/toolbox/sldrt/clang/win64/llvm-link-bca \
-Bstatic \
-o udpTest.bc \
udpTest.obj rtGetInf.obj rtGetNaN.obj rt_nonfinite.obj udpTest_data.obj udpTest_tgtconn.obj sldrt_main.obj rt_sim.obj ext_svr.obj updown_sldrt.obj \
\
\
C:/PROGRA~1/MATLAB/R2017b/toolbox/sldrt/lib/win64/imports.obj \
C:/PROGRA~1/MATLAB/R2017b/toolbox/sldrt/lib/win64/sldrtlib.lib
C:/PROGRA~1/MATLAB/R2017b/toolbox/sldrt/clang/win64/llc -mtriple=x86_64-pc-win32 -O3 -O3 -filetype=obj -o ../udpTest.rxw64 udpTest.bc
Build process completed successfully
As far as I understand I can load that rxw64 file in simulink in external mode and control it - all that is ok, I've done it. But is it possible to distribute that to dedicated PC?
PS: Sorry for long description, but I'm feel really confused and i want to give all details
Case closed. The answer is that I can't distribute my model as separate application. I must set up a target PC which must be dedicated to run binary equivalent of my model. Now - going forward to search a suitable DOS-like boot setup, and maybe try in some kind of virtual PC
I've got a Beckhoff CX9020 module with the following informations (as seen in General Tab in the CX Configuration Tool):
System Information:
Device Name: CX-xxxxxx
Image Version: CX9020 HPS 5.02d
CXConfig Version: 1.0 (Build 73)
CPU Frequency: 1000 MHz
TwinCAT:
Version: 2.11
TC Build: 2254
AMS Net Id: 5.39.55.247.1.1
Reg Level: PLC
Now I have installed TwinCAT 3, but can't establish a working Connection.
The questions:
Is it, because there is a wrong Image installed on the Win 7 Compact Embedded CX9020?
If that is the case, how can I install a newer TwinCAT 3 Image?
First of all you have to establish route to the controller.
General idea is to right-click "TwinCAT" icon in the tray, select "router" and then "edit routes". Then add your controller by IP or by searching.
Assuming you use C# for your application:
You should use Twincat.Ads command yourClient.Connect(5.39.55.247.1.1,851)
Where the address is of the controller with ".1.1" and the port is the ADS port.
To get the port you should double click the controller in the PLC part of the project and look at the port there. Default of first PLC is 851.
When you have using TwinCAT.Ads;
just add
tcClient = new TcAdsClient();
tcClient.Connect(5.39.55.247.1.1,851);
to the code.
You can find good examples on the Beckhoff site for C# and for other languages.
I work with quite a big environment, which I am not familiar with most of it. There is now a DUT error reported by a checker. The problem is - the checker gets data items via ports. Is there an e method that can show which monitors are connected to the checker (so that I can see which monitor drove the bad data)? Also - how can I tell where in the code the checker was connected to the monitors?
there are several ways to debug external and internal port bindings:
1) You can use the get_inbound_set() on a specific port to get all the ports it is bound to.
2) Trace commands:
to debug procedural connections:(do_bind() or connect()) - use “trace bind”.
for static generation binding (keep bind()) - use “trace gen”.
3) we recommend using the procedural approach : connect() & do_bind() , as it simplifies the debugging , and does not burden the generator.
just a side note, you can also use:
"trace esi" : use this trace only up until the run phase , to see the full attribute list that was given to every port in your environment
"show ports" : show you information about a specific port or all ports in your environment , read the doc to see what kind of information can be seen. it is recommended to use this command after all of the port bindings are done.