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

Hi Philip,
my solution works without Docker (as described in chapter 2 of the official installation guide).
It should also work with other Linux distributions (tested with Ubunto Server 64bit). You only have to change the “ESP8266 cross-compile toolchain” file.

If you would distribute an image or uSD card you would have an outdated system soon, because the server and drivers are updated often on github.

A good idea would be a proper automated installation script though …

I love it. The API request must be really faster.

Hi, first of all, great tutorial!

I was able to successfully run the server, scan drivers, build the firmware.
Unfortunately I cannot convince my Wio Links to connect to the local server.

After entering the Wifi information (via android or via wio-cli), i run in a timeout. The Wio seems to connect to Wifi successfully (blue LED turns from blinking twice to blinking once), but then fails connecting to the server.

Some further information:

  • I can login / register to the new server
  • There seem to be no requests from Wio to the server (according to the apache access/error logs)
  • I even tried to use Let’s Encrypt certificates (to exclude possible ssl cert validation errors)
  • International server works without issues

Any help highly appreciated!
Kai

Hello Kai,
do you see a different behaviour of the blue LED if you connect to the international server and your own server? It should blink every second.

Try the following:
stop the automatic start of the server by editing the file “/etc/rc.local” again. Delete the inserted line or comment out by putting a hash (#) in front of the line.

Restart the PI and enter

cd /opt/Wio_Link python server.py

Ther server should start now and you should see the communication, for example

[I 160430 10:13:30 server:535] SQLite version: 3.8.7.1 [I 160430 10:13:32 server:432] xchange device server accepted conns: 1 [I 160430 10:13:32 server:136] accepted sn: {your serial number here} @fw_version 1.1 [I 160430 10:13:32 server:165] valid hello packet from node 104 [I 160430 10:13:32 server:429] ota device server accepted conns: 1 [I 160430 10:13:32 server:136] accepted sn: {your serial number here} @fw_version 1.1 [I 160430 10:13:32 server:165] valid hello packet from node 104 [I 160430 10:14:32 server:306] heartbeat sent to node 104 on xchange channel [I 160430 10:14:32 server:306] heartbeat sent to node 104 on ota channel [I 160430 10:14:32 server:224] Node 104 alive on xchange channel! [I 160430 10:14:32 server:228] Node 104 recv json on ota channel

Or do you see any error messages?

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.