Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation instructions Raspberry - Bluetooth #192

Closed
wtal710174 opened this issue Jan 4, 2021 · 100 comments
Closed

Installation instructions Raspberry - Bluetooth #192

wtal710174 opened this issue Jan 4, 2021 · 100 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed Raspberry Issues related to Raspberry

Comments

@wtal710174
Copy link

wtal710174 commented Jan 4, 2021

The intend is to create installation instructions for RaspberryPi OS. Since I have a RaspberryPi 3B this will be mostly base on this device. Let's exchange here to make this an instruction for all Raspberries around.

I am running a Fortius Trainer (T1930) with a T1932 head unit and the T1941 motor combined with the VR Steering Frame.

My original instruction can be found here: https://gist.github.com/wtal710174/23081b986ab05c9a17facfec2d738202. However I would like to continue the work in this issue.

Using the instructions I have the Raspberry control the Fortius Trainer with only the USB cable connected to it. I run Zwift on my iPad or Laptop connected using Bluetooth. I run the FortiusANT without the GUI in a terminal.

FortiusANT BLE on Raspberry PI 3B Installation

This is a short description of the necessary steps for the installation of the FortiusANT project by WouterJD. The project is located here (https://github.com/WouterJD/FortiusANT).
The first part of this document is taken from the USB ANT Installation Instruction written by martin-vi which is located here (https://gist.github.com/martin-vi/5206b6b26faf6f2d6121f6c8f300e44d).

Prerequisits

  • Raspberry Pi 3b or similar with a clean RaspiOS Buster full installation (https://www.raspberrypi.org/software/)
  • Python3 version > 3.6 (Version 3.7.3 is included in the Buster full installation December 2nd 2020)
  • Standard user pi or any other user which belongs to the groups sudo, ssh, dialout, audio, video, plugdev, users, input, netdev (not sure if you need all of these, however this worked for me)
  • Enable ssh and/or VNC in the Raspberry Pi Configuration in Preferences (Interfaces tab), if you want to connect remotely to your Raspberry Pi
  • Update your system (did not work for me during the initial setup, make sure that you run the apt update command at least before installing any other packages, running both commands does not hurt, just takes some time):
$ sudo apt update
$ sudo apt full-upgrade
  • FortiusANT repository downloaded to the user home directory
    via git:
$ sudo apt install git
$ git clone https://github.com/WouterJD/FortiusANT.git

or via download

$ curl -L https://github.com/WouterJD/FortiusANT/archive/master.tar.gz | tar -xzvf -

Now you should have a FortiusAnt folder in your home. Check with ls -all if the folder belongs to you.

There is an updated version of this instruction here, which introduces some improvements. You can continue with the updated version from this point. Just click on the link.

Install wxPython

Download pre-build wxPython package to home folder. This wheel package works for an ARM7l CPU.

Install package with

$ sudo pip3 install wxPython-4.1.1-cp37-cp37m-linux_armv7l.whl

If you can not use the prebuild package, you need follow the install instructions below to build your own wxPython by replacing the version with 4.1.1 (This can take up to 18 hours depending on the RaspberryPi you are using):

https://www.marcdobler.com/2020/05/17/how-to-compile-and-install-wxpython-on-raspberry-pi/

Install required packages

$ sudo apt install -y python-virtualenv python3-virtualenv build-essential bluetooth bluez libbluetooth-dev libudev-dev
$ sudo apt-get install -y libatlas-base-dev # for numpy, https://github.com/numpy/numpy/issues/11110

Setup virtual environment for Python

$ cd ~
$ virtualenv -p python3 --system-site-packages venv

Afterwards, the installation of packages for FortiusANT always requires the virtualv to be activated first. This also applies to starting FortiusANT.

The virtual environment needs to be activated for the following with this command:

$ source ~/venv/bin/activate

Node JS installation

Follow the installation instruction on https://www.makersupplies.sg/blogs/tutorials/how-to-install-node-js-and-npm-on-the-raspberry-pi

For the Raspberry Pi 3B the following steps apply for version 14.15.3:

# Go to home
$ cd ~
# Download node 14.15.3
$ wget https://nodejs.org/dist/v14.15.3/node-v14.15.3-linux-armv7l.tar.xz
# Untar downloaded archive
$ tar xf node-v14.15.3-linux-armv7l.tar.xz
# Go into folder with unzipped files
$ cd node-v14.15.3-linux-armv7l/
# Copy folder content to 
$ sudo cp -R * /usr/local/
# Check if installed correctly
$ node -v
# Output: v14.15.3
$ npm -v
# Output: 6.14.9

After installing node to the system, you have to set it up for FortiusANT

$ cd ~/FortiusANT/node/
$ npm install

The npm install command will display several warnings which can be ignored.

Last step is to grant the node binary cap_net_raw privileges, so it can start/stop BLE advertising without root access.

$ sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

Install FortiusANT dependencies

# remember that an activated virtualenvironment is required
$ pip3 install -r ~/FortiusANT/pythoncode/requirements.txt  

Create startup script for FortiusANT

Check the updated script for starting without sudo in the comment 'Bluetooth without Sudo and updated script' below

$ cd ~
# Deactivate virtual environment
$ deactivate
$ touch FortiusANT.sh
# Open the new file with any editor you like, I prefer pico or nano
$ pico FortiusANT.sh
# Insert the following text including the !/bin/bash comment

#!/bin/bash

echo "Enter the sudo password, please."
read -s PW
echo Password entered. Thank You!

echo $PW|sudo -S service bluetooth stop
echo Bluetooth Service stopped
source /home/pi/venv/bin/activate
if [[ "$VIRTUAL_ENV" != "" ]]
then
  echo Virtual Environment set
else
  echo Virtual Environment not set
fi
echo Virtual Environment Set
echo $PW|sudo -S hciconfig hci0 up
echo Bluetooth for BLE on internal adapter started
cd /home/pi/FortiusANT/pythoncode
echo Starting FortiusANT ...
# Use any command line parameter as required. '-b' does start the command line based bluetooth interface 
# only, without GUI. Add '-g' for the GUI. More Details in the FortiusANTUserManual in section 4.2 
# starting on page 29. 
python3 FortiusAnt.py $@
deactivate
if [[ "$VIRTUAL_ENV" != "" ]]
then
  echo Virtual Environment set
else
  echo Virtual Environment not Set
fi
echo $PW|sudo -S service bluetooth start
echo Standard Bluetooth Service restarted

Save file with control+O and exit file with control+x and make script executable with the following command

$ chmod u+x FortiusANT.sh

Give user access to USB port

Run the following commands to create an access file in /etc/udev/rules and reboot Raspberry to activate rule

$ sudo -i
$ cat << EOF > /etc/udev/rules.d/10-usbaccess.rules
# Allow users in group usbtacx to access usb
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="usbtacx"
EOF
# Create group usbtacx
$ addgroup usbtacx
# add user pi to this group
$ adduser pi usbtacx
# Reboot to activate rule
$ reboot now

Let's fire it up

Connect your trainer to one of the USB ports of the Raspberry Pi and execute FortiusANT with

# -b for command line bluetooth startup, add any command line parameter as required, like -g to start with GUI
$ ~/FortiusANT.sh -b

Next, the calibration procedure will start with a pedal kick. After the procedure is complete, the bluetooth starts broadcasting identifying the Raspberry Pi as periphal device with the identifier 'FortiusANT Trainer'. This one you can connect to your CTP.

After the calibration you might see a couple of error messages. This happens while the http server is being established and the program is not able to access it. After 5-10 secondes the connection should be stable and you will see the normal output in the terminal like the one below.

20:08:31,698: Target=100W Speed= 0.0kmh hr=  0 Current=  0W Cad=  0 r=   0 T= 15
20:08:32,700: Target=100W Speed= 0.0kmh hr=  0 Current=  0W Cad=  0 r=   0 T= 15
20:08:33,702: Target=100W Speed= 0.0kmh hr=  0 Current=  0W Cad=  0 r=   0 T= 15
20:08:34,703: Target=100W Speed= 0.0kmh hr=  0 Current=  0W Cad=  0 r=   0 T= 15
20:08:35,705: Target=100W Speed= 0.0kmh hr=  0 Current=  0W Cad=  0 r=   0 T= 15
20:08:36,706: Target=100W Speed= 0.0kmh hr=  0 Current=  0W Cad=  0 r=   0 T= 15
@switchabl
Copy link
Contributor

Don't have a Raspberry PI 3B so can't test this directly, but it looks quite thorough! I have a few suggestions on how to improve this further (well, I hope so at least):

  • I suggest putting the venv inside the FortiusANT directory, not directly in home
  • Maybe node.js can be installed locally as well (instead of system-wide in /usr/local) with something like nvm (similar to venv). I think with nodeenv it might even be possible to install node directly inside the python venv.
  • Passing through additional command line options from the script to FortiusANT would probably be nice.
  • I don't think you need to activate the venv in the script, it should be enough to run ~/venv/bin/python FortiusAnt.py.
  • I wonder if hciconfig is actually necessary? I thought that the system Bluetooth stack is actually bypassed completely with the current implementation but I have to admit I didn't look at it in detail.
  • The USB permissions could be made a bit narrower (similar to Installing Antbridge on Kubuntu #176 (comment)), but on a Raspberry PI it is maybe not so critical I suppose.

Some more general ideas that may or may not make sense to persue:

  • A simplified no-GUI version of the guide. I think if you run without GUI, you don't actually need wxPython anymore. So it might be sufficient to install the numpy, requests and pyusb packages with apt and do away with venv.
  • It should be possible to give the pi user permission to start/stop Bluetooth with polkit, but I would need to look up how. That way it might be possible to run the whole script without sudo (and storing the password, I am not sure "read -s" is actually secure).
  • Alternatively we could run FortiusANT as a systemd service and with a dedicated user. That won't work with a GUI, but it could be particularly attractive if you use a dedicated, headless Raspberry PI for your trainer. Then you might just set the the service to auto-start on boot. I think if you declare a conflict with the bluetooth service in the unit file it will even auto-stop that for you.
  • I wonder if we could just make a docker container to save people the hassle of setting it up manually.

@wouterstrand
Copy link

wouterstrand commented Jan 5, 2021

First of all, props for writing this instruction, very thorough.
I’ve looked through the instruction and I am tempted to give it a go. Am I correct that I won’t need a Ant dongle anymore?
A docker container or even a image file for my sd card would be very convenient of course. I’m willing to share an image if I succeed. That should work for other users with the same RPi then right?

@switchabl
Copy link
Contributor

switchabl commented Jan 5, 2021

Am I correct that I won’t need a Ant dongle anymore?

If the device you use Zwift/Rouvy/etc on has Bluetooth LE (or if you are using Zwift on PC with the Companion app on the phone) as well and you are not using any ANT-only power meter/sensor, yes, no ANT dongle required.

I’m willing to share an image if I succeed. That should work for other users with the same RPi then right?

I think so, yes. There are a number of potential disadvantages to building images that way:

  • they may not work on other Raspberry PI-models
  • if you expanded the partition to the whole SD card, the image may become quite large (and can only installed on cards at least as big as yours)
  • they may contain unnecessary (temp/log) files
  • it is relatively time-consuming if you wanted to update it regularly

For that reason, images are usually built in an automated way on a PC/server instead. But that is quite a bit more work to set-up, so unless someone volunteers to do that, I think your image could still be quite helpful for others!

@switchabl
Copy link
Contributor

Not sure what the best options are long-term:

  • distributing normal Debian/rpm packages and relying on the OS for dependencies would be the best solution, but that may not be feasable anymore with the node.js dependencies for Bluetooth
  • an automatically built Linux image would be great for people using a dedicated Raspberry PI, but I am not sure how much work that is
  • a Docker container would be more flexible and probably easier to build
  • there is also AppImage, which would be similar to the binaries provided on Windows (that should also work with the GUI)

@wouterstrand
Copy link

I'm stuck at the following step:

The virtual environment needs to be activated for the following with this command:

$ source ~/venv/bin/activate

I get the message the file or folder does not exist? Using command ls -all, it does not exist indeed in the home folder?

@wtal710174
Copy link
Author

wtal710174 commented Jan 5, 2021

I'm stuck at the following step:

The virtual environment needs to be activated for the following with this command:

$ source ~/venv/bin/activate

I get the message the file or folder does not exist? Using command ls -all, it does not exist indeed in the home folder?

test "$ source --help", does this give you the help messages? If not something went wrong with your virtual environment install.

@wouterstrand
Copy link

This does give me the help message. I also didn;t get any errors during the virtual environment install. The venv folder is not visible in the home folder though?

@wouterstrand
Copy link

Wooops, noob at work here. I skipped a step, I've succeeded now. Continuing install on the RPi3.

@wtal710174
Copy link
Author

@switchabl Thanks a lot for the great comments. I will pick this up and try to work through your proposal. I do agree with almost all of it. I did try to run without stopping the bluetooth service and not using the hciconfig command, however this did not work for me. Maybe you have a suggestion there. Regarding the virtual environment in the script, this was just to make the startup as easy as possible. I have already altered the text to include the command line parameters for startup. Very nice suggestion there.

Regarding your general ideas:

  • Non Gui version: Yes this is a great idea. This will require changes in the requirement.txt files to prevent the check for the wxPython or a completely altered program version without the GUI calls. Not sure which option to choose. I prefer the changes in the Python to detect if wxPython is present and in case it is not ignore all the GUI options.
  • It should be possible to give the pi user permission to start/stop Bluetooth with polkit: Not requiring sudo would be perfect. I have no experience with polkit. I will look it up and start working on this.
  • Alternatively we could run FortiusANT as a systemd service: This would be my favorite solution, since it would allow me to power up the Raspi and start cycling without logging in and typing any command. I do think that you will still need the calibration process. Keeping the FortiusANT on Raspi running all the time seems to cause issues over time. I need to look into that more closely.
  • Docker: YES! Unfortunately I have no experience at all with the docker concept. Therefore I could use some help to get this done. This would be a very convenient way of setup. I would as well prefer this to an image.

@wouterstrand
Copy link

Well, Thanks a bunch. I successfully connected my iPhone to the Tacx via BLE. Tomorrow I will set my bike up on the Tacx and make an attempt with my laptop.

@wtal710174
Copy link
Author

Nice! Thanks for the feedback. Good luck with the test tomorrow.

@switchabl
Copy link
Contributor

switchabl commented Jan 5, 2021

I did try to run without stopping the bluetooth service and not using the hciconfig command, however this did not work for me. Maybe you have a suggestion there.

It seems I was wrong, I looked at the bleno docs (the library used for the Bluetooth functionality) and apparently they are both necessary.
But it should be possible to set up permissions so we don't need root for them:

sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hciconfig`

Regarding the virtual environment in the script, this was just to make the startup as easy as possible.

Yes, if you are using it interactively, it definitely makes sense. In a script it apparently isn't necessary most of the times as long as you call the right Python interpreter. If it is (in case FortiusANT expects the Python interpreter in PATH or something), I believe you can at least skip the deactivate step. The changes to the environment should revert once the script terminates.

Non Gui version: Yes this is a great idea. This will require changes in the requirement.txt files to prevent the check for the wxPython or a completely altered program version without the GUI calls. Not sure which option to choose. I prefer the changes in the Python to detect if wxPython is present and in case it is not ignore all the GUI options.

I was under the impression that the latest version of FortiusANT doesn't import wx in CLI mode. So I was hoping that

sudo apt install python3-usb python3-numpy python3-requests
python3 pythoncode/FortiusAnt.py -a

may be all that is required (apart from the permissions and Bluetooth part). But maybe not, I haven't tried yet.

Keeping the FortiusANT on Raspi running all the time seems to cause issues over time. I need to look into that more closely.

Yes, I wouldn't be surprised if running it continously uncovered some stability bugs.

I have some plans to improve calibration (save calibration value between sessions; allow calibration on request, not on startup; allow calibration requests through ANT/Bluetooth) that would probably help with the head-less case as well.

@TacxBiker
Copy link

Hi, by excecuting all the commands wtal710174 it sure works perfectly on a raspberry 3b+
Also the GUI works

Adding
/home/pi/FortiusANT.sh -a -b
to the /etc/rc.local starts up FortiusANT.
One pedal kick and the calibration starts. After calibration the FortiusANT trainer is visible by bluetooth on a PC or iPAd

@mikeherriman
Copy link

I can also attest that the natallation and configuration steps work on a raspberry Pi 4. I have a 7” touchscreen connected to the raspberry Pi HDMI port allowing for startup/shutdown without external keyboard or mouse. Happily able to run Zwift app on iPhone, Zwift app on Windows with FortiusAnt connected via iPhone Zwift Companion app.

There does seem to be some GUI related issues, in that the GUI becomes unresponsive, and requires a kill command to close out. Even though the GUI becomes unresponsive, FortiusANT continues to function.

Mike

@wouterstrand
Copy link

wouterstrand commented Jan 7, 2021

How do I start the GUI? I attempted with -g but it didn’t work.
Also, do you get resistance control through the iPhone?

@TacxBiker
Copy link

It is also possible to start FortiusANT by simply clicking in the script /home/pi/FortiusANT.sh in the filebrower.
Then the GUI is visible.

@wouterstrand
Copy link

wouterstrand commented Jan 7, 2021 via email

@TacxBiker
Copy link

TacxBiker commented Jan 7, 2021

One thing, it is not possible to add opperants when clicking on the script.
I just eddited the scrip by addeing te opperants -a -b -g

@wtal710174
Copy link
Author

I created a little add on which might be useful to others as well. When I started the GUI today for testing some stuff I noticed that the GUI is showing new versions in the status bar if available (very nice feature :-)). Therefore I implemented an automatic update in the script, to check for the latest version during start up and update the new files. In order to do this you need to implement the following.

Step 1:

$ cd ~/FortiusANT/
$ git remote add upstream https://github.com/WouterJD/FortiusANT

Step 2 - Get new code from repository (needs to be done in the FortiusANT directory)

$ git pull upstream master

If you implement this line in the script after the password section with

git -C /home/pi/FortiusANT pull upstream master

the script will always check for updates and download the files before starting FortiusANT.

@wtal710174
Copy link
Author

wtal710174 commented Jan 7, 2021

Bluetooth without sudo for pi

I followed @switchabl 's advice. This worked kind of for me. So step 1 is complete ... pi can start and stop bluetooth, however a password is still required. Did anybody get this working without password request for pi so far?

Edit: Forget it! I have figured it out and will post a short step by step with an updated script shortly. Maybe I just need some more sleep and less riding on my bike...

@wtal710174
Copy link
Author

One thing, it is not possible to add opperants when clicking on the script.
I just eddited the scrip by addeing te opperants -a -b -g

@TacxBiker Sounds like you do not need a sudo password for the script anymore, how did you get this done? Or are you starting the script in a terminal after double clicking?

@wtal710174
Copy link
Author

On more idea for improvement. Some of the users here talk about running the Pi headless and just attaching it to the trainer to make it kind of an interface that does not require any input through a terminal or touchscreen. @switchabl mentioned the service before. What about connecting an on/off switch to the IO-ports of the raspberry, which starts the script or service in on position and stops the script or service in off position. Anybody that did something similar in the past and has an idea how to implement this for the user pi (script) or as a service that listens to the switch status?

@wtal710174
Copy link
Author

@mikeherriman Thanks for the feedback!

@wtal710174
Copy link
Author

wtal710174 commented Jan 7, 2021

Bluetooth without Sudo and updated script

Based on the remarks from @switchabl above.

Edit: $@ was lacking the quotation marks. Changed to if [ -z "$@" ]

First give user the right to use hciconfig without sudo

$ sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hciconfig`

Then enter the command 'sudo visudo' to edit the sudoers file. In the section
'# Allow members of group sudo to execute any command' add the following lines:

%usbtacx ALL=NOPASSWD: /bin/systemctl stop bluetooth.service
%usbtacx ALL=NOPASSWD: /bin/systemctl start bluetooth.service

This will grant all member of the group usbtacx the right to start bluetooth service without entering a password.
Now you can use sudo service bluetooth stop and sudo service bluetooth start as user pi without entering a password.

(Comment: I tried to run the command without sudo, since this works for the hciconfig command. If you ommit the sudo you will have to enter a password)

Now edit the FortiusANT script with $ pico ~/FortiusANT.sh and replace the content with the following code:

#!/bin/bash
# FortiusANT Startup Script v0.2
#Checking command line options
if [  -z "$@" ]
then
 #enter your default startup options here, if starting without commandline options
 CLO="-b"
else
 CLO=$@
fi

# Remove comment below if you want automatic updates
# Execute 'git remote add upstream https://github.com/WouterJD/FortiusANT' in FortiusANT directory first before removing comment
#echo Getting FortiusANT updates from Github Repository
#git -C /home/pi/FortiusANT pull upstream master

sudo service bluetooth stop
echo Bluetooth Service stopped
source /home/pi/venv/bin/activate
if [[ "$VIRTUAL_ENV" != "" ]]
then
  echo Virtual Environment set
else
  echo Virtual Environment not set
fi
hciconfig hci0 up
echo Bluetooth for BLE on internal adapter started
cd /home/pi/FortiusANT/pythoncode
echo Starting FortiusANT ...
python3 FortiusAnt.py $CLO
sudo service bluetooth start
echo Standard Bluetooth Service restarted

Save the changed file restart the RaspberryPi with sudo reboot now and give it a try. Let me know if this works.

In the beginning of the script you can set your default command line options now in case you start the script with no options.

Now you should be able to start the script without any issue by double clicking the file in the file browser in the graphical interface (using default options) or as before in a terminal with ~/FortiusANT.sh to just launch the bluetooth interface with the default options.

@mikeherriman
Copy link

I just updated the sudouser file as instructed, edited the FortiusANT.sh file as instructed. I also added the switches inside the script (-a -g -H0 -c12).

Created desktop shortcut to the script.
Now can double-click the shortcut from Desktop and everything fires up.
One thing that I am not sure about is when I double click the shortcut, I am prompted to Execute, Execute In Terminal, Cancel.
When I select Execute in Terminal, everything goes but within a minute or so, the GUI and terminal window become unresponsive, requiring CTRL+C to stop the script. When I select Execute the GUI starts with no background terminal window and all seems to operate much better. Any ideas?

@TacxBiker
Copy link

@wtal710174
I'm not sure why that is. when auto start the script by RC.local I don't need to enter a password.
when using the same script by clicking or command line in a terminal I do need to enter a password.

@wtal710174
Copy link
Author

@TacxBiker Which script are you using? Please make sure you have #!/bin/bashin the first line. I forgot to add this yesterday, which caused the issues I was having.
Regarding RC.local startup should launch the script as root, which could explain the behavior. You can double check by logging the output of the script in a text file using whoami to print the user name when executing the script.
I have updated the script in the comment above to include the reference to the bash.

@WouterJD WouterJD added the documentation Improvements or additions to documentation label Jan 9, 2021
@WouterJD
Copy link
Owner

WouterJD commented Mar 1, 2021

@decodeais I followed the installation instructions #192 and it worked right-away.
Do not forget next two commands:

sudo service bluetooth stop
sudo hciconfig hci0 up

I understand this is to "disable standard ble and enable ble for nodejs" but that's my interpretation.

I'm gathering all exchanged data into the manual, the publication will take some time.

@decodeais
Copy link

Thank you, I already did everything written in the description. When you said that it is really working with the internaI RP4 bluetooth i started testing again.
My tablet stuck in the connection screen while the RPI4 was nearly frozen.
So I looked for another device to test. I Installed Rouvy AR on my smartphone and it works, but the display is a little to small. Has anyone an idea what is wrong with my tablet (Galaxy Tab A with Android 8.1.0)

@MeanHat
Copy link

MeanHat commented Mar 2, 2021

@WouterJD - do you need/want any help updating the manual for RPi installation? Happy to lend a hand.

@WouterJD
Copy link
Owner

WouterJD commented Mar 2, 2021

do you need/want any help updating the manual for RPi installation

Thanks @MeanHat I'll come back to it when required.
Currently scripting the whole installation (after some bootstrap); manual page is next step.

@WouterJD
Copy link
Owner

WouterJD commented Mar 2, 2021

@wtal710174, @decodeais, @MeanHat

Thanks for all the inspiration and documentation!
image

I will make a wiki-page where all special pictures will be gathered "Raspberry page of glory"; who has a fancier title for the page?

@WouterJD
Copy link
Owner

WouterJD commented Mar 4, 2021

Please enjoy https://github.com/WouterJD/FortiusANT/wiki/Raspberry-page-of-glory

@WouterJD
Copy link
Owner

WouterJD commented Mar 4, 2021

I have integrated Raspberry Pi into FortiusAnt, code, installation scripts and manual.
Branch Raspberry_Release6 is checked in; review is appreciated.

Tonight I cleaned the SD-card and reinstalled everything.
When the Raspberry is started, FortiusAnt is started, so far so good.

BUT the bluetooth hci0 device does not work:

pi@TacxFortiusPi:~ $ sudo service bluetooth stop
pi@TacxFortiusPi:~ $ sudo hciconfig hci0 up
Can't init device hci0: Connection timed out (110)

and when I give the sudo service bluetooth status:

* bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-03-05 00:24:26 CET; 14s ago
     Docs: man:bluetoothd(8)
 Main PID: 2346 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/bluetooth.service
           `-2346 /usr/lib/bluetooth/bluetoothd

Mar 05 00:24:26 TacxFortiusPi systemd[1]: Starting Bluetooth service...
Mar 05 00:24:26 TacxFortiusPi bluetoothd[2346]: Bluetooth daemon 5.50
Mar 05 00:24:26 TacxFortiusPi systemd[1]: Started Bluetooth service.
Mar 05 00:24:26 TacxFortiusPi bluetoothd[2346]: Starting SDP server
Mar 05 00:24:26 TacxFortiusPi bluetoothd[2346]: Bluetooth management interface 1.18 initialized
Mar 05 00:24:26 TacxFortiusPi bluetoothd[2346]: Sap driver initialization failed.
Mar 05 00:24:26 TacxFortiusPi bluetoothd[2346]: sap-server: Operation not permitted (1)
Mar 05 00:24:26 TacxFortiusPi bluetoothd[2346]: Endpoint registered: sender=:1.23 path=/MediaEndpoint/A2DPSource
Mar 05 00:24:26 TacxFortiusPi bluetoothd[2346]: Endpoint registered: sender=:1.23 path=/MediaEndpoint/A2DPSink
Mar 05 00:24:28 TacxFortiusPi bluetoothd[2346]: Loading LTKs timed out for hci0

Suggestions appreciated!

@MeanHat
Copy link

MeanHat commented Mar 5, 2021

Hi @WouterJD - great work on the new Release and the updated manual https://github.com/WouterJD/FortiusANT/blob/Raspberry_Release6/doc/FortiusANTUserManual.pdf. I'll happily test out the new v6.

I've changed the code running the miniTFT display as Bluetooth was dropping out after about 2 mins. I will post the updated version which fixes this.

Hope you are able to fix your Bluetooth issue - if I have any suggestions I'll let you know.

@WouterJD
Copy link
Owner

WouterJD commented Mar 5, 2021

BUT the bluetooth hci0 device does not work:

pi@TacxFortiusPi:~ $ sudo service bluetooth stop
pi@TacxFortiusPi:~ $ sudo hciconfig hci0 up
Can't init device hci0: Connection timed out

Yesterday (ahum it was 01:00) I switched the RPI off, left it for tonite to redo the installation.
I just switched on - issue gone and Bluetooth working. Hum hum. But for now problem solved.

@WouterJD
Copy link
Owner

WouterJD commented Mar 5, 2021

@wtal710174 I hope hope you can live with how I scripted and documented. After all it's your work I "scrambled". It sure gives thoughts how to redo the windows installation.

@WouterJD
Copy link
Owner

WouterJD commented Mar 5, 2021

changed the code running the miniTFT display

@MeanHat keep us informed in #237 👍

@wtal710174
Copy link
Author

@wtal710174 I hope hope you can live with how I scripted and documented. After all it's your work I "scrambled". It sure gives thoughts how to redo the windows installation.

Makes me happy to see that I could give something back to this awesome project, which increased my time on the bike tremendously during the winter 🥇. I will check the documentation and let you know if I have any remarks.

@wtal710174
Copy link
Author

Yesterday (ahum it was 01:00) I switched the RPI off, left it for tonite to redo the installation.
I just switched on - issue gone and Bluetooth working. Hum hum. But for now problem solved.

And I thought stuff like this happens on Windows only ...

@WouterJD
Copy link
Owner

WouterJD commented Mar 5, 2021

I thought stuff like this happens on Windows only

A hard wake-up call :-(.

@WouterJD
Copy link
Owner

WouterJD commented Mar 6, 2021

@martin-vi do you follow this issue?

@wtal710174 references https://gist.github.com/martin-vi/5206b6b26faf6f2d6121f6c8f300e44d and I think it would be good to integrate that into the current description and manual.

My consideration to see BLE as the default for Raspberry Pi is that it's default onboard AND there is a lot of confusion on ANT-dongles. The Raspberry Pi can then be used from a Smartphone. (Ahum ... this part is not in the manual yet).

What is your consideration to use ANT?

@WouterJD
Copy link
Owner

WouterJD commented Mar 6, 2021

@MeanHat do you use ANT or BLE?
Would it be possible to script the ANT-configuration, even when some modifications are needed?

@WouterJD
Copy link
Owner

WouterJD commented Mar 6, 2021

I intend to extend the manual with the following section:

3.12.7 Now pair with a CTP

Zwift, Trainer Road, Rouvy, Sufferfest, Golden Cheetah, Road Grand Tour, TTS and many others can now pair with the Bluetooth trainer “FortiusANT Trainer” on a device that supports BLE. Perhaps a Smartphone is the most generally available device to use and from there the screen can be streamed to a TV. Of course, you can also use a PC with a Bluetooth dongle.
I would think that this the recommended configuration because BLE is native on Raspberry Pi, a Bluetooth dongle is usually cheaper than an ANT-dongle and because ANT-dongles are hard to get (see issue #61). Also, it seems that the market of CTP’s is moving from ANT to BLE; usually Bluetooth is preferred and/or supported before ANT.


Comment appreciated

@WouterJD
Copy link
Owner

WouterJD commented Mar 6, 2021

Another question: when the .sh files are fetched from git, the execute bit is not set and hence the files are not executable using a double-click from the file-manager. How could that be solved?

@MeanHat
Copy link

MeanHat commented Mar 6, 2021

@martin-vi do you follow this issue?

@wtal710174 references https://gist.github.com/martin-vi/5206b6b26faf6f2d6121f6c8f300e44d and I think it would be good to integrate that into the current description and manual.

My consideration to see BLE as the default for Raspberry Pi is that it's default onboard AND there is a lot of confusion on ANT-dongles. The Raspberry Pi can then be used from a Smartphone. (Ahum ... this part is not in the manual yet).

What is your consideration to use ANT?

Supporting @martin-vi's points about both Bluetooth and phones I'd add:

  • using Bluetooth was great for users running Zwift on an Android phone as Zwift did not support FE-C with ANT though this was fixed in Dec 20 (https://forums.zwift.com/t/zwiftgame-android-faq-v-1-0-60239/520294) which now gives users a choice.
  • ANT runs successfully on an RPi0 which is very cost-effective (other than the cost of the dongles of course). I've not yet managed to get Bluetooth running on an RPi0 but will keep experimenting with a spare Zero as RPi0 + onboard Bluetooth would be really cost-effective

@MeanHat
Copy link

MeanHat commented Mar 6, 2021

@MeanHat do you use ANT or BLE?
Would it be possible to script the ANT-configuration, even when some modifications are needed?

Hi @WouterJD - I've been using Bluetooth with the minTFT display but have used ANT for a headless RPi0 version I did for my neighbour last year. I'll do that.
It's a great suggestion to add ANT to the miniTFT controller. I'll need to generate a log file for an RPi running with ANT (unless you have one to hand you could share) to set this up and test it. I can install FortiusANT on a spare RPi0 and get a log file (based on -d1 or higher combination parameter). I'll post the updated version of the miniTFT controller that fixes the Bluetooth issue first (it's complete but being tested) and then do the ANT version.

@MeanHat
Copy link

MeanHat commented Mar 6, 2021 via email

@decodeais
Copy link

hello @WouterJD, in Windows you can set the execution flag by this git command.
git update-index --chmod=+x <filename>
You can check the result by git ls-files --stage

@MeanHat
Copy link

MeanHat commented Mar 6, 2021 via email

@decodeais
Copy link

Would it be possible to make kind of list which Tablet or smartphone is working. For example:
My Samsung Tablet A6 works with internal ANT+ but not with BLE.
My Smartphone S5 has internal ANT+ too, but Android 10 has a bug and the internal ANT+ does not work. Fortunately BLE is working here.
It would be bad when all the Problems of the tablets and smartphones has to be discussed here separately.

@WouterJD
Copy link
Owner

WouterJD commented Mar 6, 2021

A hardware compatibility list would be very limitted since usually when things work, it's not reported.
Would become a known issues list

@WouterJD
Copy link
Owner

Discussion moved to #274, I suggest we close this one.
We always reopen if required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed Raspberry Issues related to Raspberry
Projects
None yet
Development

No branches or pull requests