Webiopi doesn't work on Raspberry Pi 2
I bought 3 Pi2 and try to replace one of my Pi B+ which is running webiopi but I got error with the Pi2:
pi@pi2garage ~/WebIOPi-0.7.0/htdocs $ sudo webiopi -d -c /etc/webiopi/config
2015-02-06 17:02:36 - WebIOPi - INFO - Starting WebIOPi/0.7.0/Python3.2
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalCount to REST GET /GPIO/count
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalRead to REST GET /GPIO/%(channel)d/value
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalWrite to REST POST /GPIO/%(channel)d/value/%(value)d
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.getFunctionString to REST GET /GPIO/%(channel)d/function
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.getPulse to REST GET /GPIO/%(channel)d/pulse
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.outputSequence to REST POST /GPIO/%(channel)d/sequence/%(args)s
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.portRead to REST GET /GPIO/*/integer
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.portWrite to REST POST /GPIO/*/integer/%(value)d
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulse to REST POST /GPIO/%(channel)d/pulse/
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulseAngle to REST POST /GPIO/%(channel)d/pulseAngle/%(value)f
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulseRatio to REST POST /GPIO/%(channel)d/pulseRatio/%(value)f
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.setFunctionString to REST POST /GPIO/%(channel)d/function/%(value)s
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.wildcard to REST GET /GPIO/*
2015-02-06 17:02:36 - WebIOPi - INFO - GPIO - Native mapped to REST API /GPIO
2015-02-06 17:02:36 - WebIOPi - INFO - Loading configuration from /etc/webiopi/config
2015-02-06 17:02:36 - WebIOPi - ERROR - global name 'GPIO' is not defined
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 75, in <module>
main(sys.argv)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 69, in main
server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/server/__init__.py", line 52, in __init__
self.gpio.addSetups(config.items("GPIO"))
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 62, in addSetups
self.addGPIOSetup(gpio, params)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 55, in addGPIOSetup
self.addGPIO(self.gpio_setup, gpio, params)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 45, in addGPIO
func = GPIO.OUT
NameError: global name 'GPIO' is not defined
Please help!
pi@pi2garage ~/WebIOPi-0.7.0/htdocs $ sudo webiopi -d -c /etc/webiopi/config
2015-02-06 17:02:36 - WebIOPi - INFO - Starting WebIOPi/0.7.0/Python3.2
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalCount to REST GET /GPIO/count
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalRead to REST GET /GPIO/%(channel)d/value
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalWrite to REST POST /GPIO/%(channel)d/value/%(value)d
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.getFunctionString to REST GET /GPIO/%(channel)d/function
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.getPulse to REST GET /GPIO/%(channel)d/pulse
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.outputSequence to REST POST /GPIO/%(channel)d/sequence/%(args)s
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.portRead to REST GET /GPIO/*/integer
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.portWrite to REST POST /GPIO/*/integer/%(value)d
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulse to REST POST /GPIO/%(channel)d/pulse/
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulseAngle to REST POST /GPIO/%(channel)d/pulseAngle/%(value)f
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulseRatio to REST POST /GPIO/%(channel)d/pulseRatio/%(value)f
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.setFunctionString to REST POST /GPIO/%(channel)d/function/%(value)s
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.wildcard to REST GET /GPIO/*
2015-02-06 17:02:36 - WebIOPi - INFO - GPIO - Native mapped to REST API /GPIO
2015-02-06 17:02:36 - WebIOPi - INFO - Loading configuration from /etc/webiopi/config
2015-02-06 17:02:36 - WebIOPi - ERROR - global name 'GPIO' is not defined
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 75, in <module>
main(sys.argv)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 69, in main
server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/server/__init__.py", line 52, in __init__
self.gpio.addSetups(config.items("GPIO"))
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 62, in addSetups
self.addGPIOSetup(gpio, params)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 55, in addGPIOSetup
self.addGPIO(self.gpio_setup, gpio, params)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 45, in addGPIO
func = GPIO.OUT
NameError: global name 'GPIO' is not defined
Please help!
- DougieLawson
- Posts: 42771
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Webiopi doesn't work on Raspberry Pi 2
It's using Ben Croston's code to access the GPIO pins through memory mapping with /dev/mem.
If you look in the install package at ../WebIOPi-0.7.0/python/native/gpio.c you should be able to patch that code to work with the new base address for the RPI2. Hint: #define BCM2708_PERI_BASE 0x20000000 needs to change.
If you look in the install package at ../WebIOPi-0.7.0/python/native/gpio.c you should be able to patch that code to work with the new base address for the RPI2. Hint: #define BCM2708_PERI_BASE 0x20000000 needs to change.
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: Webiopi doesn't work on Raspberry Pi 2
This thread might also be relevant. http://www.raspberrypi.org/forums/viewt ... 66#p686869
The author/maintainer of RPi.GPIO is Ben Croston [ @croston on these forums ], one of the contributors to that thread.
The author/maintainer of RPi.GPIO is Ben Croston [ @croston on these forums ], one of the contributors to that thread.
Beware of the Leopard
Re: Webiopi doesn't work on Raspberry Pi 2
Thank you for the Hint. Sorry I am a newbie could you tell me what should I change to?DougieLawson wrote:It's using Ben Croston's code to access the GPIO pins through memory mapping with /dev/mem.
If you look in the install package at ../WebIOPi-0.7.0/python/native/gpio.c you should be able to patch that code to work with the new base address for the RPI2. Hint: #define BCM2708_PERI_BASE 0x20000000 needs to change.
Re: Webiopi doesn't work on Raspberry Pi 2
Compare gpio.c with:
https://sourceforge.net/p/raspberry-gpi ... format=raw
and apply the base address differences.
https://sourceforge.net/p/raspberry-gpi ... format=raw
and apply the base address differences.
Re: Webiopi doesn't work on Raspberry Pi 2
the gpio.c from the link is a lot different than my one. Which part should I change? or should I just copy everything?croston wrote:Compare gpio.c with:
https://sourceforge.net/p/raspberry-gpi ... format=raw
and apply the base address differences.
Thanks
Re: Webiopi doesn't work on Raspberry Pi 2
Looks like the setup() function and a couple of new #define lines at the top.
Re: Webiopi doesn't work on Raspberry Pi 2
sorry I still can't get it to workcroston wrote:Looks like the setup() function and a couple of new #define lines at the top.

Re: Webiopi doesn't work on Raspberry Pi 2
Has anyone got this to work with the raspberry pi 2? And if so would you be willing to upload the files some place? Be got a lovely Web controlled big track with Web Cam that thanks to the increased power of the pi 2 is now drivable over the Web so keen to get working on pi 2, but uses webiopi which don't work 

Re: Webiopi doesn't work on Raspberry Pi 2
Why not contact the author of webiopi?
There is a Google groups support website. Gotta be quicker than going through this forum.
Texy
There is a Google groups support website. Gotta be quicker than going through this forum.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
Re: Webiopi doesn't work on Raspberry Pi 2
Cheers, will do, have posted on their Google groups forum jobbie.
Many thanks
Many thanks
-
- Posts: 1
- Joined: Tue Mar 17, 2015 8:28 am
Re: Webiopi doesn't work on Raspberry Pi 2
1.python/native/cpuinfo.c,change "BCM2708" to "BCM2709";
2.python/native/gpio.c, change "#define BCM2708_PERI_BASE 0x20000000" to "#define BCM2708_PERI_BASE 0x3f000000";
3.run setup.sh again.
2.python/native/gpio.c, change "#define BCM2708_PERI_BASE 0x20000000" to "#define BCM2708_PERI_BASE 0x3f000000";
3.run setup.sh again.
Re: Webiopi doesn't work on Raspberry Pi 2
Did anyone get webiopi to work with the pi2? Can you please help with the code?
Re: Webiopi doesn't work on Raspberry Pi 2
@konglingboy, who posted the message preceding yours, appears to have done so and has posted clear details of the code changes needed.fatsel wrote:Did anyone get webiopi to work with the pi2? Can you please help with the code?
Beware of the Leopard
Re: Webiopi doesn't work on Raspberry Pi 2
@konglingboy, posted a simple solution above that worked for me. He is amazing. Thanks!
Re: Webiopi doesn't work on Raspberry Pi 2
Disclaimer: I haven't tried @konglingboy's "fix" ...
But it looks to me like it might simply change WEBIOPI from RPI(1) specific to RPI2 specific.
So that would mean I can't take that SD card and move it from a RPI2 to a RPI(1) ???
I think I won't use WEBIOPI for the moment.
It's now getting a bit bleak regarding remote GPIO control with web display:
* RASPCTL - discontinued.
* RASPCONTROL - disappeared.
* NETIO - still there, with smartphone control. The simplistic socket server they offered long back for RPI I found too fragile, but I think they might have a stronger example server now. I should try it again. I did buy the app, still on my phone & tablet.
* INSTRUCTABLES.COM php-javascript DIY simple port controller (http://www.instructables.com/id/Simple- ... ur-Raspbe/) - yea that might be a sampler, but it still works.
Maybe I've missed something obvious.
But it looks to me like it might simply change WEBIOPI from RPI(1) specific to RPI2 specific.
So that would mean I can't take that SD card and move it from a RPI2 to a RPI(1) ???
I think I won't use WEBIOPI for the moment.
It's now getting a bit bleak regarding remote GPIO control with web display:
* RASPCTL - discontinued.
* RASPCONTROL - disappeared.
* NETIO - still there, with smartphone control. The simplistic socket server they offered long back for RPI I found too fragile, but I think they might have a stronger example server now. I should try it again. I did buy the app, still on my phone & tablet.
* INSTRUCTABLES.COM php-javascript DIY simple port controller (http://www.instructables.com/id/Simple- ... ur-Raspbe/) - yea that might be a sampler, but it still works.
Maybe I've missed something obvious.
Re: Webiopi doesn't work on Raspberry Pi 2
You can use the patch from the following URL to get WebIOPi-0.7.1 up and running on pi-2
https://github.com/doublebind/raspi

https://github.com/doublebind/raspi
Re: Webiopi doesn't work on Raspberry Pi 2
Oh dear,
The doublebind patch (post above) works in some cases. It is almost identically a re-work of the patch at
https://github.com/acrobotic/Ai_Demos_R ... demos/gpio, which similarly works in some cases.
Take a look at the patch they both offer for board version detection (in file ...../python/native/cpuinfo.c):
Well guess what? My 4 RPi boards have revision numbers 0002, 000e, 000f, a21041. The middle 2 numbers are not recognised by the patched code above.
http://elinux.org/RPi_HardwareHistory indicates many more board versions. Maybe even that wiki listing is not up to date? But can I offer the following roughed-up code for the board revision function, code that is at least in closer accord with the wiki.
Are we seeing a sad fade-away on a useful project? I can't even think about the ambitions of WebIOPi re Weaved or REST etc, if the core functionality remains unsupported and broken.
The doublebind patch (post above) works in some cases. It is almost identically a re-work of the patch at
https://github.com/acrobotic/Ai_Demos_R ... demos/gpio, which similarly works in some cases.
Take a look at the patch they both offer for board version detection (in file ...../python/native/cpuinfo.c):
Code: Select all
int get_rpi_revision(void)
{
char revision[1024] = {'\0'};
if (get_cpuinfo_revision(revision) == NULL)
return -1;
if ((strcmp(revision, "0002") == 0) ||
(strcmp(revision, "1000002") == 0 ) ||
(strcmp(revision, "0003") == 0) ||
(strcmp(revision, "1000003") == 0 ))
return 1;
else if ((strcmp(revision, "0004") == 0) ||
(strcmp(revision, "1000004") == 0 ) ||
(strcmp(revision, "0005") == 0) ||
(strcmp(revision, "1000005") == 0 ) ||
(strcmp(revision, "0006") == 0) ||
(strcmp(revision, "1000006") == 0 ))
return 2;
else if ((strcmp(revision, "a01041") == 0) ||
(strcmp(revision, "a21041") == 0 ))
return 3;
else // assume rev 4
return 4;
}
http://elinux.org/RPi_HardwareHistory indicates many more board versions. Maybe even that wiki listing is not up to date? But can I offer the following roughed-up code for the board revision function, code that is at least in closer accord with the wiki.
Code: Select all
int get_rpi_revision(void)
{
char revision[1024] = {'\0'};
if (get_cpuinfo_revision(revision) == NULL)
return -1;
if ((strcmp(revision, "0002") == 0) ||
(strcmp(revision, "1000002") == 0 ) ||
(strcmp(revision, "0003") == 0) ||
(strcmp(revision, "1000003") == 0 ))
return 1;
else if ((strcmp(revision, "a01041") == 0) ||
(strcmp(revision, "a21041") == 0 ) ||
(strcmp(revision, "0012") == 0 ) ||
(strcmp(revision, "0013") == 0 ))
return 3; // A+ B+ RPI2
else
return 2; // all the 0004 - 000f
}
Re: Webiopi doesn't work on Raspberry Pi 2
And for anyone who wants, here is my own patched up 0.7.1 -- not official, not guaranteed -- that I have used for a local hobby class. It builds on those other sources/ideas above.
http://brian2012class.nfshost.com/where-are-we/ Check under entry for 15 August. It identifies as 0.7.1.p
All of my class used it successfully on a variety of Pi versions.
http://brian2012class.nfshost.com/where-are-we/ Check under entry for 15 August. It identifies as 0.7.1.p
All of my class used it successfully on a variety of Pi versions.
-
- Posts: 2
- Joined: Wed Dec 02, 2015 1:36 pm
Re: Webiopi doesn't work on Raspberry Pi 2
blavery wrote:And for anyone who wants, here is my own patched up 0.7.1 -- not official, not guaranteed -- that I have used for a local hobby class. It builds on those other sources/ideas above.
http://brian2012class.nfshost.com/where-are-we/ Check under entry for 15 August. It identifies as 0.7.1.p
All of my class used it successfully on a variety of Pi versions.
Hello blavery,
So what happened with the link it seems dead ? Or I am having trouble opening it I am not sure, anyway guys, any idea if there is any similar web interface like this one which is working on the pi2+ ?
-
- Posts: 4504
- Joined: Thu Dec 27, 2012 4:05 am
- Location: Québec, Canada
Re: Webiopi doesn't work on Raspberry Pi 2
Code: Select all
cd
wget http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz
tar -zxvf WebIOPi-0.7.1.tar.gz
Code: Select all
cd
git clone https://github.com/acrobotic/Ai_Demos_RPi
cd WebIOPi-0.7.1
patch -p0 -i ~/Ai_Demos_RPi/demos/gpio/webiopi_raspberry_pi_2_cpu_support.patch
patch -p0 -i ~/Ai_Demos_RPi/demos/gpio/webiopi_raspberry_pi_2_gpio_40_pin.patch
patch -p0 -i ~/Ai_Demos_RPi/demos/gpio/webiopi_raspberry_pi_2_gpio_mapping.patch
Code: Select all
cd
cd WebIOPi-0.7.1
sudo ./setup.sh
Code: Select all
sudo systemctl enable webiopi.service
sudo systemctl start webiopi.service
Re: Webiopi doesn't work on Raspberry Pi 2
Ahh, Sorry, That stuff got archived. You can still see it here:
http://www.blavery.com/BotSoftware-RPI/ ... index.html
Check for 15 August entry.
Brian
http://www.blavery.com/BotSoftware-RPI/ ... index.html
Check for 15 August entry.
Brian
-
- Posts: 1
- Joined: Sat Jan 30, 2016 10:24 pm
Re: Webiopi doesn't work on Raspberry Pi 2
danjperron solution worked for me. 

-
- Posts: 1
- Joined: Wed Feb 10, 2016 6:42 am
Re: Webiopi doesn't work on Raspberry Pi 2
Hello from Croatia...
First, I must point out that I'm new to programming and RPi
I'm having problems with Webiopi custom web pages on RPi2 model B.
When i'm using default demo web page, everything is working OK.
If I try to use custom web page (for example, I tried to use this http://webiopi.trouch.com/JAVASCRIPT.html ), all buttons are gray and not functioning. I've verified that with demo page all buttons are fully functional.
I've done all patches available thru this forum, and tried with simple python script ( http://raspi.tv/2013/how-to-use-interru ... d-rpi-gpio ) whitch works as expected.
Can someone at least point me in right direction where to look?
First, I must point out that I'm new to programming and RPi
I'm having problems with Webiopi custom web pages on RPi2 model B.
When i'm using default demo web page, everything is working OK.
If I try to use custom web page (for example, I tried to use this http://webiopi.trouch.com/JAVASCRIPT.html ), all buttons are gray and not functioning. I've verified that with demo page all buttons are fully functional.
I've done all patches available thru this forum, and tried with simple python script ( http://raspi.tv/2013/how-to-use-interru ... d-rpi-gpio ) whitch works as expected.
Can someone at least point me in right direction where to look?
Re: Webiopi doesn't work on Raspberry Pi 2
When attempting to access the webiopi portal via HTTP, it accepts my username/password, but gives me a completely blank page. When I go into https://ubuntu:8000/app/gpio-header I get this error:
Any idea what this could be?
Thanks for the help
Code: Select all
HTTP/1.0 500 Internal Server Error Server: WebIOPi/0.7.1/Python3.4 Date: Tue, 23 Feb 2016 10:10:55 GMT Content-Type: text/html;charset=utf-8 Connection: close Content-Length: 458
Error response
Error code: 500
Message: Internal Server Error.
Error code explan
Thanks for the help