I've written a little python program to do gpio pins monitor and testing. It is small and doesn't need any external dependencies (additional libraries or other programs). All what you need is Python interpreter (installed in all Linux distros) and my program itself.
Program runs under Linux console and may be started directly with or without GUI or via SSH. Reading of gpio pins state made with gpio events and callback functions, that's why program will detect all of changes within debounce time. The small log window can help you to see when and which pin's state was changed. Also you can set output values and debug your DYI projects this way.
Program can automatically detect Raspberry Pi model (to determine number of gpio pins). List of model's id has been taken from http://elinux.org/RPi_HardwareHistory. If you have rare model - please let me know (and use --gpio_num command line option).
Program is free, so you can modify anything your want. My github repo https://github.com/kgbplus/gpiotest. Look at tiny manual here or start program with --help argument.
Gpio pins monitoring and test
- Attachments
-
- gpiotest.png (7.44 KiB) Viewed 23376 times
Last edited by kgbplus on Tue Dec 06, 2016 4:33 pm, edited 1 time in total.
Re: Gpio pins monitoring and test
The code is using the RPi.GPIO library. That is both a library and a dependency.
Re: Gpio pins monitoring and test
Of course, you are right. I mean that you don't need type 'pip install' or something like this to install additional modules before you can start program. All modules used are common and installed in Raspbian by default. I will fix my first message.joan wrote:The code is using the RPi.GPIO library. That is both a library and a dependency.
-
- Posts: 1
- Joined: Mon Dec 18, 2017 12:53 pm
Re: Gpio pins monitoring and test
Hi, my RaspiModel is a32082, it's production from Japan, when running the script, there's an error occur "hardware not supported"
so i added
def getRaspiModel(argument):
"a32082": "3 Model B 1Gb"
def getGpioNum(argument):
"a32082": 26
but still occur the error in the shell:
setupterm: could not find terminal
Traceback (most recent call last):
File "/home/pi/Desktop/gpiotest-master/gpiotest.py", line 391, in <module>
termOn()
File "/home/pi/Desktop/gpiotest-master/gpiotest.py", line 39, in termOn
curses.nocbreak()
_curses.error: must call initscr() first
what can i do now?
so i added
def getRaspiModel(argument):
"a32082": "3 Model B 1Gb"
def getGpioNum(argument):
"a32082": 26
but still occur the error in the shell:
setupterm: could not find terminal
Traceback (most recent call last):
File "/home/pi/Desktop/gpiotest-master/gpiotest.py", line 391, in <module>
termOn()
File "/home/pi/Desktop/gpiotest-master/gpiotest.py", line 39, in termOn
curses.nocbreak()
_curses.error: must call initscr() first
what can i do now?
- DougieLawson
- Posts: 42217
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Gpio pins monitoring and test
Two options:
1. Rewrite the script or library function to recognise your Japanese machine.
2. Report the error to the library author so they can fix the library for everyone.
Option 1 is fun (and part of learning to your use Raspberry). Option 2 is essential.
1. Rewrite the script or library function to recognise your Japanese machine.
2. Report the error to the library author so they can fix the library for everyone.
Option 1 is fun (and part of learning to your use Raspberry). Option 2 is essential.
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Gpio pins monitoring and test
My apologies for taking so long to reply. I've updated hardware detection in my project, please try to use it.
I will try to catch this exception soon.
I will try to catch this exception soon.
-
- Posts: 1
- Joined: Tue May 15, 2018 6:10 pm
Re: Gpio pins monitoring and test
Hi, I am trying to use this but I get a "Failed to add edge detection" when I run sudo python3 gpiotest.py. Any help is appreciated.
Re: Gpio pins monitoring and test
Could you please tell me your python version and rpi.gpio library version (use this guide)
Re: Gpio pins monitoring and test
Hello
I suspect I roasted one or more Gpoi-pins. Anyway SPI doesn't do its job like it used to, since I tried to measure battery voltage via Mcp3008 ADconverter
Gpio load spi gives gpio:unable to load/unload modules etc
Ls /dev/*spi* gives the two devices /dev/spidev0.0 and 0.1
Did raspi-config, dtparam=spi=on
Lsmod gives no spidev anymore! But bcm2835_gpiomem is there.
Controled the settings several times, updated etc, no clue. So tried to test with Gpiotest.py.
sudo pigpiod but when I run the program in CL, i get no message and a new commandline after 1-2 seconds.
No message. What can be the background of this?
Is my SPI "broken"? If just Gpiotest would work!
I have a Rasberry 2B v.14 2014
Linux raspberry 4.1.19-v7+
Thanks
I suspect I roasted one or more Gpoi-pins. Anyway SPI doesn't do its job like it used to, since I tried to measure battery voltage via Mcp3008 ADconverter
Gpio load spi gives gpio:unable to load/unload modules etc
Ls /dev/*spi* gives the two devices /dev/spidev0.0 and 0.1
Did raspi-config, dtparam=spi=on
Lsmod gives no spidev anymore! But bcm2835_gpiomem is there.
Controled the settings several times, updated etc, no clue. So tried to test with Gpiotest.py.
sudo pigpiod but when I run the program in CL, i get no message and a new commandline after 1-2 seconds.
No message. What can be the background of this?
Is my SPI "broken"? If just Gpiotest would work!
I have a Rasberry 2B v.14 2014
Linux raspberry 4.1.19-v7+
Thanks
Re: Gpio pins monitoring and test
Hello!
Seems the only way to know is to find another Raspberry Pi and try it with your sd card in it.
I haven't seen anything like that but I haven't seen enough.
Roman
Re: Gpio pins monitoring and test
Yes, I'm busy doing exactly that.....but still, that won't answer the question why the otther one is having this problem.
-
- Posts: 25
- Joined: Mon Oct 10, 2016 1:13 pm
Re: Gpio pins monitoring and test
I am getting some irregular responses from this script that make no sense to me.
I am trying to test out a relay I want to switch. 5v and grond from pin 4 and 6. signal wire is set on pin 11 (gpio17)
When I run an "input" command to gpio17 the relay turns off.
If I run a "output" commend and ether set gpio17 to true or false the relay turns on.
If I switch the status from high to low or the other way around the relay remains on.
I makes no sense. should I use another pin?
I am trying to test out a relay I want to switch. 5v and grond from pin 4 and 6. signal wire is set on pin 11 (gpio17)
When I run an "input" command to gpio17 the relay turns off.
If I run a "output" commend and ether set gpio17 to true or false the relay turns on.
If I switch the status from high to low or the other way around the relay remains on.
I makes no sense. should I use another pin?
Re: Gpio pins monitoring and test
Seems some relay issue (incorrect relay voltage)