Skip to content

This projects uses the on board Bluetooth module of a Raspberry Pi to control a motor

License

Notifications You must be signed in to change notification settings

AustinAttempts/BLE-Motor-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

BLE-Motor-Control

This projects uses the on board Bluetooth module of a Raspberry Pi to control a motor

Required Materials

NOTE: The Raspberry Pi can be any model as long as there is a bluetooth module. I just used a Raspberry Pi 3 model B I had laying around, so thats what I linked.

Setup

This program should work cross platform but I ran this on Debian GNU/Linux 11 (bullseye) so the following steps reflect that setup process.

Install BlueZ

  1. Grab the latest BlueZ package link from the offical website
  2. Adjust the following code snippet to direct to the link copied from above
cd ~
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.66.tar.xz
tar xvf bluez-5.66.tar.xz
cd bluez-5.66
  1. Install all dependencies
sudo apt-get update
sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
  1. Configure BlueZ and make sure it finishes with no errors. If there are errors then most likely there is a dependacy missing and needs to be installed
./configure --enable-library
  1. Make and Install BlueZ
make
sudo make install
  1. Enable Bluetooth service to run on boot
sudo systemctl enable bluetooth
  1. Enable experimental mode by adding the '--experimental' flag to the bluetooth.service file
sudo nano /lib/systemd/system/bluetooth.service
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth

[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental //Change This Line              
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1

[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service
  1. Reload and restart the system
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
  1. Check that everything is running with no errors and in experimental mode
systemctl status bluetooth

Hardware

The following wiring will be setup based off a Raspbery Pi 3 model B and the DRV8825.

  • 3.3v from Raspberry Pi to RST and SLP pin
  • GND to GND
  • Pin 21 to STEP
  • Pin 20 to DIR
  • Pin 14 to M0
  • Pin 15 to M1
  • Pin 18 to M2

The motor setup will be dependant on the motor but should be pretty straigt forward to set up.

License

License: MIT

Refrences

About

This projects uses the on board Bluetooth module of a Raspberry Pi to control a motor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages