Difference between revisions of "Raspberry PI"

From BITPlan can4eve Wiki
Jump to navigation Jump to search
Line 56: Line 56:
  
 
= Bluetooth =
 
= Bluetooth =
 +
To use a Bluetooth dongle like {{Link|target=OBDLink_LX}} you need to first pair the device:
 +
 
see https://www.raspberrypi.org/forums/viewtopic.php?t=214373
 
see https://www.raspberrypi.org/forums/viewtopic.php?t=214373
 
== check connection ==
 
== check connection ==
Line 81: Line 83:
 
quit
 
quit
 
</source>
 
</source>
== Example script ==
+
== Redirecting bluetooth to TCP/IP ==
 +
There is a helper script obdii_blue available that you can use to redirect the bluetooth device to tcip/ip.
 +
=== Example script call ===
 
<source lang='bash'>
 
<source lang='bash'>
 
#!/bin/bash
 
#!/bin/bash

Revision as of 11:21, 24 January 2019

To run on a Raspberry PI you need a properly configured device. See e.g. http://ion.bitplan.com/index.php/Ion2017-07-18#Raspberry_PI

Hardware

See e.g. 31jEGhZmPdL.jpg

91zSu44%2B34L._SL1500_.jpg

Raspberry Setup

You'll find setup guides all over the internet here are just two links:

Software configuration

cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Java 8 installation

apt-get install oracle-java8-jdk

Run script

If you have an official touchscreen you can control the brightness of the screen with the darkmode button of can4eve.

You might want to make sure that you use the run script to start the app. The important lines are:

sudo chmod 0664 /sys/class/backlight/rpi_backlight/brightness
sudo chown root.pi /sys/class/backlight/rpi_backlight/brightness

Autostart

Example Can4Eve.desktop file to be placed in .config/autostart of your user. Please adapt the exec line to where you installed can4eve

[Desktop Entry]
Type=Application
Name=Can4Eve
Comment=Onboard Diagnostic software for Electric Vehicles
NoDisplay=false
Exec=/home/wf/source/java/can4eve/run

You can make the desktop shortcut available on your desktop by creating a symbolic link from your Desktop

cd $HOME/Desktop
ln -s /home/wf/.config/autostart/Can4Eve.desktop

Bluetooth

To use a Bluetooth dongle like OBDLink_LX you need to first pair the device:

see https://www.raspberrypi.org/forums/viewtopic.php?t=214373

check connection

Bluetooth services

service bluetooth status
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset
   Active: active (running) since Thu 2019-01-24 08:51:05 CET; 3min 2s ago
     Docs: man:bluetoothd(8)
 Main PID: 849 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─849 /usr/lib/bluetooth/bluetoothd

Pairing

Pair the device using the Graphical User Interface Bluetooth button in the top right. You will not be able to connect the message is "Connection failed - No usabel services on this device". We'll work around this with some python helper software Check result with commmand line:

bluetoothctl
[NEW] Controller B8:27:EB:2E:AB:2B pito [default]
[NEW] Device 00:04:3E:9F:A3:C0 OBDLink LX
quit

Redirecting bluetooth to TCP/IP

There is a helper script obdii_blue available that you can use to redirect the bluetooth device to tcip/ip.

Example script call

#!/bin/bash
# WF 2019-01-24
cd $HOME/source/java/can4eve/can4eve_bluetooth
./obdii_blue 00:04:3E:9F:A3:C0