I am trying to set the ethernet port pins directly to send High / Low signals to light up four LEDs. Is there any way I can simply connect LEDs to the ethernet cable?
What would be the best approach, if using ethernet is not a good option, to light up four LED lights and switch them on/off using a PC.
I am planning to create a command-line tool in Python. So far I have gone through a lot of articles about PySerial, LibUSB etc. and have been suggested to use USB to UART converter modules, or USB to RS-232 converters.
Actually I don't want any interfaces except the PC port and the LEDs as far as possible.
Please suggest!
No, it is not possible. There is no sane way to affect the PHY in PC software.
Related
I am currently developing a Python tool for Windows that is able to lookup all devices connected to a windows pc. It already supports ethernet devices and by now I'm trying to add support for USB and serial devices. For those devices I want to read out their vendor id, product id, serial number and of course the address/port which is needed to connect to the device.
Simple USB devices can be easily detected with PyUSB or PyWin32. Unfortunately, many devices say that its vendor is FTDI, which is not the case. As far as I know, FTDI just provides the USB adapter/converter.
So, how can I lookup the device behind the FTDI adapter? I already tried PyUSB, PyWin32 and PySerial, but all of them just say, that there is a FTDI-device connected; but I want to know the actual device behind the FTDI adapter... Is there a way to find that out?
I hope that you can help me... Thank you for that in advance.
Update
Since there seems to be no universal solution, is there at least a way to uniquely identify one of those FTDI devices? Some of them provide serial numbers, but unfortunately not all of them. For example there are devices, with a device id like "USB\VID_0403&PID_FAF0\7&5E2426C&0&2", where "7&5E2426C&0&2" should be the serial number. But these serial numbers with ampersands in it are not the real serial numbers (maybe it is something from Windows or so). PySerial even recognizes this serial number only as "7".
If I had at least the possibility to get the real serial number of that device, this would be very helpful. So I could uniquely identify that device, even if it got a new port or device id after disconnecting and reconnecting. Or are those ampersand-serials always the same for one device?
When a FTDI Serial to USB converter is used you usually get a virtual com port that is recognized as PlugAndPlay device by windows. A small internal electronic circuit board is placed in the USB-Plug of an FTDI cable which performs the conversion from serial UART interface to USB.
When you now request the information about the connected device you get the information of the connected PlugAndPlay device, the FTDI cable board, not the information of the device behind this cable. E.g. when a Card Reader is connected using such a cable you get the serial number of the FTDI Cable board not the serial number of the Card Reader.
But it is possible that usefull information can be retrieved. There is a program from FTDI, called FT_Prog, which allows to programm the EEPROM board in the cable. Using this tool it is possible to change some of the information you can retrieve from the FTDI cable as shown in the image below.
This is sometimes done but not mandatory for device manufacturers. And when it is done there is no standardized scheme of what to put into these fields. You would need your own dictionary of known device identifiers to handle that.
Another way is to get information directly from the device behind the cable. But in this case you need to know the communication protocol to be able to talk to the device. If proprietary protocols are used, your only chance is to use sniffer hardware to reverse engineer the protocol but that may be a bit to extreme^^
Af far as company using FTDI is not interested in buying own vendor ID you are out of luck.
There is no standard protocol behind FTDI so no universal way to detect device behind it.
USB specification allows (not requires) device to provide string descriptor containing serial number - or better it could be any string.
Fortunately FTDIs provides unique serial numbers. See this thread Get Serial Number of USB device with Python 3
FTDI is typically allow the use of an EEPROM (actually it is in most cases a simple flash memory) to store specific information about the product in it. E.g. one can assign a specific vendorID, ProductID, SerialNo, Manufacturer Desc., Product Desc. BUT it is only optional (For details search for FT_Prog). So every product designer has the freedom, but does not need to fill in whatever he/she wants.
If you have a set of devices you want to support you could check if the either support a SCPI compliant interface. In this case you can ask them using *IDN? about their identity. If not you can hope that the product has properly written ROM to supply further information. In any other case you can only guess.
first sorry if this is a simple question but I can't figure this out. I have this development board and on page 19 on the kits user guide the block diagram shows a RS232 line and on page 20 and 22 the schematic show the pins I need to connect to use RS232. My problem is that, despite being able to configure the fpga/cpld, I cannot find the com port on my computer (using pyserial and the following code(I tried changing COM%s in line 15 to FTUSB-%s)). So my questions are:
What interface does the FTDI, ft2232h USB to UART/FIFO, chip use (Serial, parallel... ) on the computer's end (like arduino's virtual COM port)?
On lattice's software there are 3 options to program the device. the program shows the following: HW-USBN-2b (FTDI) (with port as FTUSB-0), HW-USBN-2b (with port as ezUSB-0) and HW-DLN-3C. How can I use either of them to communicate with the device outside of Lattice's software?
thanks for you time.
1) RS232 is a combination of UART with certain voltage levels for the high and low (i.e. +3 to +15V and -3 to -15V afaik. Never ever connect a RS232 adapter to standard 3.3V or 5V devices e.g. UART, TTL-UART etc. The Lattice Semiconductor document just plainly missuses the term RS232 - try not to fall for it (IMHO the performance of their products strongly anticorrelates with the quality of their documentation and support).
2) page 19 of the linked doc shows the sections: Ordering Information, Technical Support Assistance, Revision History. Shifted by one page?
3) The FT2232H can be used in multiple modes. This depends on the way how it is addressed and of the settings flashed to the EEPROM connected to it (on the dev board is one placed but the FT2232H can be used without as well). The dev board is in the standard configuration designed to be programmed via the JTAG pins and the FT2232H is opened via the D2XX driver by lattice diamond. For that reason they flashed the EEPROM with settings which prohibits the use as virtual com port. The FTDI flash software can be used to change that behavior - for each bank seperately.
4) The solder bridges can be used to rearrange the connections (e.g. if one wants to change from the JTAG interface to the SPI or I2C programming interface). In your case you most likely want to place bridges on R14 and R15 to make the proper connection for an UART link to the port B of the FT2232H. EDIT: This way Port A can be used in JTAG mode to program the FT2232H and port B to communicate via e.g. UART or even other modes like the fast opto or the parallel bus/FIFO - if the correct bridges are soldered. Changing the EEPROM settings might be still required to make Port B visible as VCP if one want to avoid the usage of the D2XXX driver.
Most things were said in the previous reply, but here again in a slightly different way. This is what you need to prepare the use of an UART connection to the FPGA, but still needs any generic UART module configured into the FPGA after that:
This was tested on the Lattice MachXO3D development board, but I crosschecked that at least this part with the pins is the same with the MachXO3L board that you linked:
First, you need to bridge (solder) resistors R14 and R15 to connect UART RX and TX pins from the FTDI to the FPGA. You can use 0 Ohm resistors or just do it with solder tin, they are close enough for that. After that, FPGA pins/sites C11(=Tx) and A11(=Rx) can be used for your UART inside the FPGA, that you probably have as a Verilog/VHDL design. You find this information by looking at the "Appendix A. Schematics" of the user guide.
Additionally, something that was at least needed for the MachXO3D is to reconfigure the FTDI chip with FTDI's "ftprog" software. Not sure if it is needed for the MachXO3L, but it is easy to check and causes no harm:
Run "ftprog". Search/Parse for your FTDI chip and find the configuration for "Port B", and change "Hardware" from "245 FIFO" to "RS232 UART", and "Driver" from "D2XX" to "Virtual COM port". Then the second of the two ports you get from the FTDI chip (COM# in Windows, /dev/ttyUSB# in Linux; # being a number) should be usable through some virtual terminal software, use with python-serial, etc.
In Linux, the ftdi_sio kernel module has to be unloaded (sudo modprobe -r ftdi_sio) for Lattice Diamond to be able to program the FPGA, and after that loaded again (sudo modprobe ftdi_sio), to be able to use the respective /dev/ttyUSB# device. In Windows it doesn't need that and just works with python using COM#. Any suggestion to make this easier in Linux is also welcome!
In any case, as already said, you still need the respective UART module programmed in the FPGA and connected to the respective sites to be able to use it.
Update: I found that at a very obscure location, Lattice also documented a part of this, which is the User Guide to their Propel SDK. You can find the information starting Page 39 there: Lattice Propel SDK 2.0 User Guide
I'm new to using a RaspberryPi. Until now I was experimenting with an Arduino.
If I connect an Arduino by usb it is recognized as COM device and with the Arduino serial plot software it was easily possible to live plot sensor data.
For my next project I want to work with an Raspberry Pi Zero W and Python.
Is it possible to send serial data from a python script over the charging usb-cable like with the Arduino? If not, what would be the easiest way to send sensor data e.g. to matplotlib to plot the data directly?
It is possible. However I would not recommend using the USB serial port profile. While it works, it is severely limited in comparison to the alternative. Which is using one of the various ethernet gadget modes.
One tutorial for setting this up is e.g. http://www.circuitbasics.com/raspberry-pi-zero-ethernet-gadget/
The result of this is a full network interface that you can not only use to transfer data over a TCP/IP socket but at the same time run a SSH-connection to start and monitor your application. Even to develop by using a SSH-enabled editor such as Emacs. So the possibilities are much bigger than over the single-stream serial setup.
If it absolutely has to be serial, that's of course possible too - follow e.g. this tutorial: https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/serial-gadget
Is there a way I can hack somehow an xbox controller to send custom signal or clone the protocol with a usb dongle.
Basically a way I can use my pc as a controller for xbox console.
I am trying to develop an AI that plays FIFA and all the processing is made on PC. I can't find how to send the signal, corresponding to the action the AI has decided to make, to the xbox console.
Thank you in advance
No, xbox controller wireless protocol is proprietary and nobody reverse-engineered it yet AFAIK.
To use a real xbox wireless controller on a PC (the opposite of what you want) you need an adapter, which is sold separately, and most USB XBOX code we have published is dedicated to make those adapters work on linux. The actual protocol of wireless communication between the adapter and the controller is a mystery. It is not normal wifi so you can't use any wifi adapter available in the market to mimic it.
Another option is to crack open an xbox controller and connect the components (using arduino maybe?) directly to the PC.
There's a work around solution to your problem. The Xbox app for Windows allows you to play games via streaming over a local network. The quality is imperfect, but if you have access to the console's actual video output you can set the stream quality to the lowest setting to minimize latency.
Streaming via the Xbox app for Windows will allow you to emulate a controller via any of a number of methods that convert various signals to X-input. I personally have tested this with a Dual Shock 4 controller and InputMapper. For your purposes, you may want to try EventGhost.
People shouldn't just throw shade automatically because you're designing a bot. There are plenty of respectable reasons for doing so, particularly academic ones. I hope you're not just trying to cheat, but if you are, it's an impressive way of going about it, at least.
I am doing a project that involves using a Raspberry Pi to control all the switchboards in my house. I will start by wiring three switchboards first.
I am planning to use one 8-channel and one 2-channel relay for each of the switchboards, as each of these switchboards contain 10 switches. So, that amounts to 30 relay units.
However, I do not have as many as 30 free GPIO pins on my Raspberry Pi. I can use a port expander, but the Pi is installed with a camera and stationed near a door and fixed there. So, all the 30 wires from the switchboards need to be brought to the Pi, which will make the walls look messy. I was wondering if I could install an Arduino mini for each of the switchboards and control the relays using the Arduinos.
The Arduinos in that case need to the connected to the Raspberry Pi somehow such that when I want to switch on a specific light in my bedroom, I send a command to the Pi. The Pi sends the corresponding information to the Arduino in some well-defined format, like JSON, mentioning the switch number and the action to be performed. The Arduino switches on or off the switch and returns a message to the Pi.
Can this be done? I would be grateful if anyone could help me with this.
Thanks in advance.