Iam new to Python so maybe this is not an appropriate question. I am working on a project on Python that will use GPIO functionalities of the raspberry Pi. Right now, I am developing the python code on my local windows environment. This is because it is faster to work this way for me. I have it in a git repository so that when I want to test the code I just log into my raspberry pi and pull the latest code found on the repository.
However, I want to implement the code that will interact with the raspberry pi GPIO pins. I have downloaded the GPIO python source: RPi.GPIO 0.5.11, but I do not know how to add it into my python project on windows in order to use the GPIO functionality.
If you are just looking to test the whole code and not worry about the actual pins (as windows machines don't have GPIO), then you can fake it.First, in your main python source directory, create a directory named "RPi". In that folder, put an empty text file named __init__.py. This lets python know the folder "RPi" is a package. Also in that folder put a text file named "GPIO.py". In that file put the following:
This puts a pretty blank attribute set that can answer some of the GPIO calls you would most likely be using. Of course, there is no way to actually check whether the calls worked, but you won't get error messages stating the module GPIO doesn't exist. It's pretty hacky, but I use it when I don't feel like ssh into my pi for some quick code updates. You can add any other GPIO attributes you may need.
Hidden deep in the settings is a way by which you can download different libraries to import in your program. Anything, from the conventional numpy and kivy, to the Pi standard RPi.GPIO, to externally developed ones like pigpio (that's what I use on my Pi, because it has a daemon and doesn't get interrupted by the system processes).
hi Ewald
there not a great option for me due to network security. i also don't trust them to turn off at the right time if there is any network issues. part off the risk assessment includes the safety shutdown in the octotprint software.
I don't think any of the plugins that work over GPIO will work with something else plugged into a PC, since there would be quite a different way to communicate with them. So you would probably have to modify a plugin to add the code to communicate with whatever additional hardware you add.
Now, this is in Ubuntu, and not windows 10. But I do have jneillii's subplugin for PSUcontrol working and it will turn an led off through the GPIO pins on an FT232H attached to a desktop running ubuntu. I'm not sure what would need to be done to make this work in windows at this point, but I don't think it would be overly different, just the windows way. adafruit-blinka can be installed in windows, and so can OctoPrint. so, i imagine it's probably doable. I'm just busy getting the Linux side to work. I've never played with OctoPrint on windows, but I assume if you have Octoprint, adafruit-blinka, and pyftdi installed in windows, the same plugins will just work.
And if it will turn an led on and off, it will run a relay to turn a PSu on and off. If you're interested in trying it out, As long as you get octoprint working on windows, i can help get adafruit-blinka and pyftdi installed and working for you. The subplugin will work fine. Not sure how it would work over multiple instances of octoprint running at the same time, because i do know that if octoprint has a hold of the ft232h in the venv environment, i can't access it without shutting down octoprint.
For now I just connected the adapter -to-gpio and tried the software downloadable from that page. Unzipping the contents to a folder on desktop (path: \USB Interface Adapter Software\USB Interface Adapter GUI-v1.10\bin\) and executing by doubleclicking USB SAA GUI.exe there.
Got this window. Please note the "Adapter not attached" message at the bottom of the window. As a starting exercise I just wanted to set the pull-up resistors to 2.2k. Doing so by pressing Set lets a popup appear:
Need to mention that I'm connecting the adapter directly to the system with no hub in between. According to Windows (device manager) and also visible by the adapter's green light it is enumerated correctly.
Brad
Do we need any driver for USB device?
The FUSION DIGITAL POWER DESIGNER has been installed and restart PC.
The SW seen hang up(forever) to looking for USB series adaptor.
It will resum after disconnect USB adaptor.
And hang up again when reconnect USB adaptor.
Please let me know more.
BR
I'm finding some troubles when using "SMBus & I2C & SAA Degub Tool" with my USB Interface Adapter. In my case the application freezes during "Looking for USB Serial Adapter". If try to use the adapter with the BQ2416x EVM software, it works fine.
I wanted to have a virtual containerised beaglebone to use in my project as I needed to test how the beaglebone would react and estimate the performance when more than 2 beaglebones are communicating where it manipulates pins virtually to simulate if a message was received, sent, or (if there has been error/problem).
/sys/class is not a regular folder. That is a filesystem for communicating with the kernel. The container does not have its own kernel as it is just an isolated process or processes running on the host and not a virtual machine.
Just a question with regards to the kernel, do all the containers not have a kernel? What if the container does not have a kernel does it require like Kernel Git to be added and compiled into the container to be able to have some sys functions, for instance, gpio?
I looked online and found libraries and packages like lib-gpio to make mock GPIO pins which they behaviour similar to the /sys/class/gpio. Would you recommend this package or is there something else I can use?
Not sure if this has been suggested but I was wondering if we can have a video where you show us how we can use our own personal computer (a laptop for example) to control things rather than write a program in some IDE on the laptop or desktop and then transfer it to another microprocessor for execution. Is there a bank of GPIO that we can hook up to the USB port of the laptop where we can execute the sketch to control things directly? After all, my laptop has 16GB of memory with at least two processors. I'm writing the program (in my case C#) on my laptop anyway. It would be nice if I we can eliminate the middle hardware and just have a bank of GPIO that I control directly from my laptop. The vision here is that, right now you can buy a 7-inch display Windows 10 tablet very cheaply. If I can have a bank of GPIO connected to that Windows 10 tablet, I just saved myself a bunch of time bread-boarding, hooking up LCD displays, worry about storage, wifi is included, Bluetooth is available, camera is already hooked up, etc.
There are no direct access to ports but you can make your own GPIO virtual ports with hardware that plugs into a USB port of a computer and then write a set of functions such as OUT(PORT,DATA) and data = IN(PORT) to call from your own code written in c# or whatever language you choose.
It is possible to control the GPIO pins on a Rpi from another computer or PC. You could get an inexpensive Rpi and link it it via USB to your computer and control its GPIO pins from a program running on your PC. You may need to do some googling as to what is possible for you and I suspect you will find the example are all in Python. I quote from the Rpi GPIO Zero documentation as shown on the recent DroneBot Workshop article below:
GPIO Zero supports a number of different pin implementations (low-level pin libraries which deal with the GPIO pins directly). By default, the RPi.GPIO library is used (assuming it is installed on your system), but you can optionally specify one to use. For more information, see the API - Pinsdocumentation page.
One of the pin libraries supported, pigpio, provides the ability to control GPIO pins remotely over the network, which means you can use GPIO Zero to control devices connected to a Raspberry Pi on the network. You can do this from another Raspberry Pi, or even from a PC.
how about sshing into the rpi? or curl into a wemos board. that's how i turn on my relays. i don't touch the wemos webpage. just curl onto the page of the process that i want it to execute. like setting the relay high or low.
That board seems a bit pricey to me. Couldn't you just use an Arduino and leave it connected to the computer via the USB serial port? Then you could just send your commands to the Arduino board. I don't see where that would be much different. And you can obtain an Arduino for a lot less than $44.00.
You would need a mega to match it in terms of i/o. Also if you used an Arduino board (which is what I was doing) you have to write your own interface protocol for the language you are using on the pc and for the Arduino to send commands,
I was actually thinking of a Mega looking at the picture. However using 74HC595 shift registers would allow any Arduino to be used. In fact, I just ordered a bunch of ATtiny13 chips. Just because they are small and cheap. They look like they might be fun to play with. In any case even with those my first thought was to extend their I/O capabilities with shift registers.
That's my thoughts as well. But then again I'm not clear on how the board that was linked to would be interfaced. If you need to write your own programs to control it, then there's probably not much of a limitation to it. You're just basically turning things on and off. The power would be in the program you write on the PC.
Although it appears all the GPIOs are TTL or 3.3v signals anyway. So if a person is going to control anything hefty they're going to need to add additional drivers. In other words, the hefty connectors aren't going to do a whole lot as additional drivers are going to be required anyway.
I agree with you and thank you for your feedback. While i love Arduino (thanks to Bill's videos to spark my interest), for this project, I'm trying to save time. It's not just one or two things. For this project, I need to have a good display and I need to have a camera. Then I need a bit of disk storage. Power and charging is another consideration. So I figured a Windows 10 tablet is the fastest way to go with a bank of GPIO. Plus, I'm mostly a software guy these days...you don't want me to fix your toaster, believe me.
3a8082e126