
Page 13
Copyright © 2017 Matrix Technology Solutions Limited
www.matrixtsl.com
Bluetooth setup
Raspberry Pi and Linux
Step 4 – Making the change permanent
The final step is to make this pairing happen automatically when the RPi is next used.
This can be done by editing the “/etc/bluetooth/rfcomm.conf” file (e.g. using nano) and
entering the following code. Again, you will need to ensure you use the correct MAC
address that was found earlier.
You will need to add a section to this rfcomm.conf file similar to the following:
rfcomm1 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the device
device
00:BA:55:23:1C:20
;
# RFCOMM channel for the connection
channel 1;
# Description of the connection
comment "
MIAC AllCode
";
}
The three red bits of text can be customised - you will use the MAC address found in step
2, and can use the name in the “comment” field.
If you have more than one MIAC, you can add multiple sections - just name each one
“rfcomm1”, “rfcomm2”, etc.
Step 5 – Testing the connection
Once you are paired, you can test the connection by using the following in the command line
terminal:
echo "WriteRelay 1 1\n" > /dev/rfcomm1
If all goes well, the Relay Q1 should become activated and the LED for Q1 should light up.
If this does not work and you get “permission denied” message, you may need to add
yourself to the “dialout” group. To see if this is the case, use the “id” command with your
username as a parameter to check which groups you belong to. If the group “dialout” is
not listed, you can add yourself to the group using the following command (remember to
substitute your username in place of “username”!):
sudo usermod -a -G dialout username
You will then need to logout and log back in and the “
WriteRelay
” command should now work
ok.
MIAC AllCode
Instructional Guide
Summary of Contents for MI3932 MIAC AllCode
Page 1: ......