[HowTo] [updated] Install the WIO Server on Raspberry Pi 3

Hi,

thanks for your quick response!

I am already starting the server manually. This is the output:

  • When creating new wio link node:
    [I 160430 12:35:23 handlers:86] get current user, id: 26, email: <>
    [I 160430 12:35:23 web:1946] 200 POST /v1/nodes/create?name=node000&board=Wio+Link+v1.0 (127.0.0.1) 20.31ms

  • After entering wifi key, wio name and submitting (with android app)
    [I 160430 12:36:01 handlers:86] get current user, id: 26, email: <>
    [I 160430 12:36:01 web:1946] 200 GET /v1/nodes/list (127.0.0.1) 6.26ms
    (multiple times, then timeout)

So the app is polling for changes on the server.
Problem is, that the Wio itself does not connect to the server, although wifi connection is established (confirmed via fritzbox log)

The led is blinking twice first, while connecting to wifi. The it starts blinking shortly once while trying to connect to server and stays is this state, even after the timeout.

Any other idea? :slight_smile:

Most importantly ther is no access to the apache server from the Wio itself, only from the android phone, I use.

[I 160430 12:33:39 server:535] SQLite version: 3.8.7.1
[I 160430 12:35:23 handlers:86] get current user, id: 26, email: <<censored>>
[I 160430 12:35:23 web:1946] 200 POST /v1/nodes/create?name=node000&board=Wio+Link+v1.0 (127.0.0.1) 20.31ms
[I 160430 12:36:01 handlers:86] get current user, id: 26, email: <<censored>>
[I 160430 12:36:01 web:1946] 200 GET /v1/nodes/list (127.0.0.1) 6.26ms
...and so on

Do you have the Chrome Application “Postman” or another REST test environment installed? Then we can test the connection manually (you can also use CURL, but I prefer Postman):

POST http://[your IP]:8080/v1/user/login?email=[your user]&password=[your password]

You should get an access token back.

GET http://[your IP]:8080/v1/nodes/list?access_token=[your access token]

Do you get a reponse for these two requests?
I intentionally bypassed the SSL part here by using http and port 8080 to test whether your problem is the certificate.

Hi,

I get the correct responses (I assume):

POST (http) rasp.fritz.box:8080/v1/user/login?email=<>&password=<>

{
  "token": "DcZCSVZYYxef6YWaQ9jMTIuw7pbOi8I0B4W-tEPI6Ro",
  "user_id": 26
}

GET (http) rasp.fritz.box:8080/v1/nodes/lis … 4W-tEPI6Ro

{
  "nodes": [
    {
      "name": "node000",
      "node_key": "3d2b6c044bd93e9f4db6f4a9e59ccb51",
      "node_sn": "dc1b971edd77011a6bf64cf88d205259",
      "dataxserver": null,
      "board": "Wio Link v1.0",
      "online": false
    }
  ]
}

Both requests also work via SSL

Thanks a lot for your support!

Seems you node is really not connected to the server (“online” : false).
Please try to delete the node:

POST http://[your IP]:8080/v1/nodes/delete?access_token=[you access toke]&node_sn=[the serial number of the node, see last response]

In the App logout your user. Change the custom IP address to the none SSL type (“http://[your IP]:8080”) and login again.
Try to register the node again.

That works.

So my taks will be to solve the SSL issue.

Hello uwe.fetzer, under Configure SSL when you say "Make sure, that you enter your (local) domain name at “Common name (FQDN), for example “*.se38.local” " where do you get your (local) domain name? Do you need a real FQDN? My server on a BBB is just local and only has an IP address with a local name. Everything I did will be at home and behind a firewall so I dont understand this step. Also you do not mention Steps 2.4 to 2.6.

I have a problem with 2.4 The command “supervisor” is to run the server at startup with the config file esp8266_server.conf. This file refers to " directory=/root/esp8266_iot_node/"
& “command=python /root/esp8266_iot_node/server.py”. In the whole process up to this stage this directory was never created. Using ubuntu command find / -name “esp8266*” -type d, the only files containing “esp8266*”. These are:
/opt/xtensa-lx106-elf/bin/Wio_Link/esp8266_arduino
/opt/xtensa-lx106-elf/bin/Wio_Link/esp8266_sdk
/usr/local/bin/Wio_Link/esp8266_arduino
/usr/local/bin/Wio_Link/esp8266_sdk

There is no directory at /root/esp8266_iot_node/. What is the correct directory? The command
“sudo supervisorctl start esp8266” fails.

Did you include the step, “2.6 Block 8080 port”? I can not get the command “supervisorctl restart esp8266” to work.
Thanks
Philip

Hello Philip,

some development environments check the requested URL against the FQDN in the certificate. In this case you will get an error message, if you just call the server via IP address. Just enter a domain name of your choice into the /etc/hosts (or \Windows\System32\drivers\etc\hosts on a Windows machine) of your client machine where you want to call the server.

Because you don’t need these steps if you follow my solution. The server starts automatically because of the last step (the entry in file /etc/rc.local)

Hope this helps
Uwe

Hello Uwe, thanks for you help. I was able to progress one extra step and I think I am nearly there! Local server is working and was able to connect wiolink computer to it. I was able to assemble hardware on the WioLink ports and accessed the APIs. Only problem was it did not Update and deliver the firmware to the WioLink computer but gave me an error message on both the server and the Android app.
On the server:
I 160502 12:24:47 handlers:555] get current node, id: 100, name: Wio05
rm -f *.elf *.hex *.d *.o *.a *.dump *.S
[E 160502 12:24:48 handlers:1332] /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++: 1: /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++: Syntax error: Unterminated quoted string

[I 160502 12:24:48 handlers:1459] +++send ota state to app:(‘error’, ‘/opt/xtens a-lx106-elf/bin/xtensa-lx106-elf-g++: 1: /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++: Syntax error: Unterminated quoted string\n’)

I also got another previous error that related to “xtensa-lx106-elf/bin/xtensa-lx106-elf-g++”:

  1. in executing python ./build_firmware.py I get the error message:
    /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++: 1: /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++: Syntax error: Unterminated quoted string
    make: *** [Main.cpp.o] Error 2
    /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++: 1: /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++: Syntax error: Unterminated quoted string"

Did you come across this problem? How are you using your system? Are you using the “International” server for creating APIs and serving them locally? Thanks again
Android App4.JPG

Hi Philip,
sorry for beeing late, was on a business trip the last days.
And to answer your question: no, I haven’t got these error messages yet.

Maybe you should test, whether the server, the grove drivers or the Android App got updates in the meantime.
Also check, whether you’ve selected the correct file:

sudo wget http://arduino.esp8266.com/linuxarm-xtensa-lx106-elf-g46f160f.tar.gz

It has to be the ARM file for the Raspi.

Hello uwe, thanks very much for your help. Your advice was spot on. Although I am using a BBG it is also ARM based and the file you quoted was the one I needed. After re-compiling and connecting everything works locally. That is fantastic and your help was the key. Interestingly the support from the official WioLink release seems to be incorrect, confusing and complex. It needs to be re-written. What is interesting is that there is a lack of response from the original author of “Server Deployment Guide” github.com/Seeed-Studio/Wio_Lin … ment-Guide. I initially posted these issues on a separate post little response. This is disappointing. You departed from this procedure and I am interesting how you discovering the correct process and the correct files. Thanks again and now I can move on

Regards
Philip

Instructions updated due to a compile error (see last chapter). Maybe the Wio/Grove team have a look at this issue…

Thanks uwe.fetzer,
Is this method compatible with Raspberry Pi 2 ?
What is the lean_server.py files ?

It also should work on the Raspi2 because it’s also an ARM processor. Just try it out.
(and forget about the lean_server.py, you don’t need it with this solution)

Thanks, On Raspberry Pi 2 stuck on following Message :

[I 160430 11:14:40 server:535] SQLite version: 3.8.7.1

What is the problem ?

No problem here: this message indicates, that the server is running now. Congratulations :smiley:

OMG :blush: Thank you.

Now you can connect your WioLink with the Android App to this local server (using the IP address and port of the Raspi2).

Really Grateful

I am doing the same but when I try to read from the node(s) I get:
{“error”: “Please attach the valid node token (not the user token)”}

with curl I logged in (didn’t achieve it with postman) and also I did a list through curl to see my nodes

Also for FQDN I put my dyddns hostname

What am I doing wrong?

Hi Uwe,

Great manual !
I already wanted to this, but Googling already brought me to your walkthrough :smiley:

I used a stock Raspberry Pi 3, with Raspbian Pixel edition for the setup.
Your manual covered almost everything
I had only to change 2 things to make it work :

1 API not available for Wio
Initially, I got an 404 error, when trying to access the API of a linked Wio device
To fix this I had to config the 000-default.conf file :
(see the deploy script from the wio site)

2 Automatically start server.py
After the installation, even after manually running server.py and installing the firmware, I still got an error when trying to automatically boot it.
To fix this, I had to make sure the Raspberry waited until it had network connection before booting.
This can be set in the GUI or using the shell command :

sudo raspi-config
Boot Options/Wait for network at boot

Have fun !