Controlling transistors via usb
Controlling transistors via usb
Hi fellas.
I'm looking for a ready made device or a wiring diagram that would allow me to control around 10 transistors via usb port.
I'm sure that someone on here has built such a device.
Thanks in advance
I'm looking for a ready made device or a wiring diagram that would allow me to control around 10 transistors via usb port.
I'm sure that someone on here has built such a device.
Thanks in advance
Re: Controlling transistors via usb
Hi,
I'm not certain that this is the right forum for you.
This is typically about software (that might control devices) but NOT about building those DIY style.
A forum specializing in DIY-hardware might be more appropriate for your aims.
I'm not certain that this is the right forum for you.
This is typically about software (that might control devices) but NOT about building those DIY style.
A forum specializing in DIY-hardware might be more appropriate for your aims.
-
- Posts: 862
- Joined: May 05, 2015 5:35
- Location: Germany
Re: Controlling transistors via usb
On the other hand: The capability of accessing USB by FB -analogue to GetMouse or GetJoystick would be a nice feature.
Re: Controlling transistors via usb
Maybe I should have posted it under "Hardware Interfaces / Communication" section of the forum.MrSwiss wrote:Hi,
I'm not certain that this is the right forum for you.
This is typically about software (that might control devices) but NOT about building those DIY style.
A forum specializing in DIY-hardware might be more appropriate for your aims.
I posted it on this website since the two are very much connected - the software and the hardware.
You mean to say that there is no way for Freebasic to send commands through usb or maybe even receive them?grindstone wrote:On the other hand: The capability of accessing USB by FB -analogue to GetMouse or GetJoystick would be a nice feature.
Re: Controlling transistors via usb
christuna wrote:...
Maybe I should have posted it under "Hardware Interfaces / Communication" section of the forum.
I posted it on this website since the two are very much connected - the software and the hardware.
In that section, there is libpruio (BB D/A - I/O fast and easy) which might be useful for you. No experience with it myself.
There is Libusb, but the problem is, how to talk to which USB device. Things are more complicated than 30 years where you could just set a few outputs pins on a printer port with 3 lines of code.christuna wrote:You mean to say that there is no way for Freebasic to send commands through usb or maybe even receive them?grindstone wrote:On the other hand: The capability of accessing USB by FB -analogue to GetMouse or GetJoystick would be a nice feature.
Maybe a virtual com-port device? With a simple serial protocol? Something like that must exist somewhere I would think.
(maybe an admin can merge the 2 topics, this and https://freebasic.net/forum/viewtopic.php?f=18&t=29303)
Last edited by badidea on Apr 07, 2021 23:02, edited 3 times in total.
Re: Controlling transistors via usb
The easiest way to do what you want is to connect an Arduino to your USB port and send serial commands to it from FreeBasic.
Have a simple serial receive sketch in your arduino to interpret the serial command and set the GPIO output accordingly.
You can also send GPIO input back to the PC using the serial port, or even use A/D converter to read analog voltages.
Yes, the Hardware area of this forum is the proper place-----and if you look in there you will probably see examples where others have already done it.
The Arduino IDE comes with multiple example sketches to do exactly what you want.
Have a simple serial receive sketch in your arduino to interpret the serial command and set the GPIO output accordingly.
You can also send GPIO input back to the PC using the serial port, or even use A/D converter to read analog voltages.
Yes, the Hardware area of this forum is the proper place-----and if you look in there you will probably see examples where others have already done it.
The Arduino IDE comes with multiple example sketches to do exactly what you want.
Re: Controlling transistors via usb
Hi All
It also depends on why you mention Transistor.
If you are using the transistor to turn on a more powerful device like a relay, then there are may options.
Just browse for usb relay. Many cheap boards out there.
On the other hand I find using Wifi so much simpler, again browse for Wifi Relay.
Regards
It also depends on why you mention Transistor.
If you are using the transistor to turn on a more powerful device like a relay, then there are may options.
Just browse for usb relay. Many cheap boards out there.
On the other hand I find using Wifi so much simpler, again browse for Wifi Relay.
Regards
Re: Controlling transistors via usb
No USB feature in libpruio, but very fast direct hardware access.badidea wrote:In that section, there is libpruio (BB D/A - I/O fast and easy) which might be useful for you. No experience with it myself.
Note:
libpruio is a hardware driver for the Texas Instruments AM335x SoC (CPU), working best on BeagleBoard computers (but not on PCs).
Re: Controlling transistors via usb
You can try Arduino, Or any other microcontroller(like attiny 85) that can emulate usb device.
Re: Controlling transistors via usb
The easiest and most common way of using an Arduino for this purpose is to control the Arduino via serial commands. Plug in the arduino with usb, it shows up as a serial port. Write a program for the arduino to interpret simple commands and control some hardware. Then FB just has to open the serial port and read and write from it.
There is even a standardized protocol and firmware for Arduino to do this sort of thing called Firmata. It could be overkill for what you are doing, but it's widely used. There's a C client library that could be used from FB: https://github.com/grandsmarquis/FirmataC
There is even a standardized protocol and firmware for Arduino to do this sort of thing called Firmata. It could be overkill for what you are doing, but it's widely used. There's a C client library that could be used from FB: https://github.com/grandsmarquis/FirmataC
Re: Controlling transistors via usb
Hi All
just use your PC or Laptop then that may be the way.
The listing below (without the actual code) describes what needs doing to communicate with a usb device.If you are interested I can list the actual code I used for specific devices.
Regards
You can use Libusb which I have used in Linux So if you are not into Arduino /rPi or Beaglebone but instead want toYou mean to say that there is no way for Freebasic to send commands through usb or maybe even receive them?
Top
just use your PC or Laptop then that may be the way.
The listing below (without the actual code) describes what needs doing to communicate with a usb device.
Code: Select all
''This program does the following:
'' 0: Do some Main Thread stuff before creating usbThread.
'' In the usbThread does the following.
'' ------------------------------------
'' 1: Initialize: Libusb,
'' 2: Gets List of usb devices attached.
'' 3: Uses 0-7 idVendor/idProduct's to find matches in list in usbIO.bi
'' 4: Opens matches found and assign's .Handle(n).
'' 5: Uses .Handle(n) to check if Kernel has control, then releases it.
'' 6: Uses .Handle(n) to Claim Interface & load ascii string desc to get iSerialNumber.
'' 7: Uses usbAccesInit to send init cmnds to possible AccesIO devices.
'' 8: Now .Handle(n) is available to Write & Read Control Transfers to devices attached.
'' 9: usbThread checks flags to confirm all OK, then sits in loop until Quit.
'' 10: WriteOntrak & ReadOnTrak are dedicated to Ontrak ADU70 Load Cell's.
'' Read & WriteAcces are dedicated to AccesIO USB-IDIO-16L. and USB-AO16-4E
'' 11: Quit Deallocates Buffer, and closes Interface's and Libusb.
''---------------------------------------------------------------------------------------
Regards