I've been following this tutorial: https://circuitdigest.com/microcontroller-projects/arduino-python-tutorial
import pyserial didn't return any errors, but when I run my python code, I get the following error:
SerialException: could not open port 'com18': WindowsError(2, 'The system cannot find the file specified.')
Anyone know how to fix this?
I copy what you can read in the tutorial:
ArduinoSerial = serial.Serial('com18',9600)
Note: It is very important to mention the correct COM port name. It can found by using the Device manager on your computer.
When you have plugged your arduino, windows has chosen another COM number.
The port can be found directly in arduino IDE. It detects all devices connected on USB; but the IDE do not know which one is your arduino. In the menu tools / port you will see the list of COM on your computer.
If no COM is proposed, then you miss a driver for your card under windows --> google for it.
Related
i'm currently trying to connect with my Thorlabs PM100USB Powermeter via pymeasure.
I'm using Win10 und pymeasure is installed via anaconda.
I found an old python script of my lab in an archive which connected to the powermeter via:
adapter = 'USB0::0x1313::0x8078::P0025186::INSTR'
power_meter = thorlabspm100usb.ThorlabsPM100USB(adapter)
But at this point I'm completly lost.
How do I get this address?
And yes, I have read the chapter on connecting to a device in the pymeasure documentation, but I can't figure it out either.
If I try to run the the code above the following error is raised:
VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.
May anyone help me? Thanks a lot!
I have a device that I want to be able to communicate with serially. On Linux, I can see that when I plug in the device to my computer, I see that /dev/ttyUSB0 pops up, which I know to be the device; however, what I am not sure about is how would I go about finding out what port my device is connected to in the general sense? Say if I were to go to another machine and plug it in, or if I had multiple serial devices already plugged in to this computer; I wouldn't be able to rely on it always being /dev/ttyUSB0.
I plan on using PySerial to be communicate with the device (I couldn't find any other officially supported method with python to communicate with a serial device), and when you open a serial connection, you of course must specify the path to the device. On Windows it would be COM something, and Linux /dev/tty something. I want to be able to automatically find this out through the program. What is the best method to go about this?
I'm trying to use PyFirmata to code my Arduino Uno, but it requires the port my board is connected to. I tried out checking device manager, but it doesn't show the URL address, which is what PyFirmata requires.
Please help me, thanks!
You can try to find the path by first connecting the arduino and raspberry pi via USB. Then, on the raspberry pi's terminal, make sure you are current in the home directory (if you open a new terminal window, you will most likely be home), and enter:
ls /dev
This should show you the content inside "dev", there should be an entry that resembles "ttyACM0" / "ttyACM1". That is the path to the USB port on the raspberry pi, which will give you access to the Arduino connected to it.
Working with an Adafruit FTDI 232H Breakout assembly. I've already asked at Adafruit and FTDI and I'm still clueless. Writing in Python using the Adafruit-provided libraries and the FTDI libraries. Very new to Python and the FTDI 232H device...
Using Windows 10 Pro
I am able to successfully install the 'drivers' for the Adafruit based on this tutorial (specifically the Windows portion):
https://learn.adafruit.com/adafruit-ft232h-breakout?view=all
In the end, the interface will work, but what happens is that the device seems to be locked to a physical USB port. If I move the device to another USB port on the same machine, it is not recognized.
Based on some reading I've done, it seems like the driver, although installed in Windows, can only associate with the device on one port. Some say that Windows uses the serial number to keep track of what device uses what driver.
I have observed, using USBDView, that this device is not displaying a S/N. I have other devices that do not display a serial number and they can move from port to port without issue. This leads me to believe that the S/N tracking may not be 100% true in Windows. The Adafruit board does have a S/N in the EEPROM, but for some reason that information is not being provided to Windows / USBDView. I've not been able to successfully access the EEPROM via the FTProg utility.
I suspect that this might have something to to with the libusbK library that is installed via Zadig tool (again in the instructions) but I am not sure. FTDI says that there should not be any issue using the libusbK library.
Can anyone out there give me some pointers on:
Is it accurate that Windows uses the S/N to keep track of what driver goes with what device?
If so, how to get the FTDI device to display the S/N?
Is there some other setting in Windows that needs to be changed to allow this device to be used on other physical ports?
Is there any other utility like FTProg that could be used to work with the EEPROM?
Am I just missing something simple, Noob-style?
Thank you in advance,
I seem to recall a similar case related to COM port enumeration and Windows where the COM port enumeration is a hash of assorted variables including the PCI bus #, device #, etc. We witnessed this through the Microsoft devcon utility which is priceless and is a command line version of Device Manager.
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon
https://blogs.technet.microsoft.com/deploymentguys/2009/12/16/where-to-find-devcon-exe/
If you google around, you can find the compiled version of this invaluable tool. With confidence, believe this tool will assist you to debug your USB port mystery. Good luck.
I just bought a GPS bluetooth receiver, which has been correctly paired with my OSX machine. Now I would like to query the device for my position with python. How do I do it?
I assume your GPS receiver works over a virtual COM port, so it's independent of bluetooth.
Probably these libraries will help you:
Python bindings for gpsd (which is available for Mac too)
PyGPS, untested
with a virtual COM port you can use this script with the NMEA 0183 protocol http://miguellopes.net/bluetooth-gps-python/ (it's in portuguese but google translator can give you a help there)