takyonxxx / BalanceRobotQT-Raspberry

BalanceRobot & Remote Control by Bluetooth BLE GATT Services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BalanceRobot & Remote control with Bluetooth BLE GATT Services & Google Speech to Text with Alsa sound cards, Wiki Api that answers your questions.

This is a Balance Robot Project developed with QT 5

The remote control has ios and qt version which can compile on all platforms that supports qt.
https://www.youtube.com/watch?v=immSrXEHzQE&feature=youtu.be

I use Rpi Motor Drive which works perfect with all raspberry versions.
Please check below link for details.
https://www.waveshare.com/wiki/RPi_Motor_Driver_Board

Proportional Term (KP)
The proportional term is your primary term for controlling the error. this directly scales your error, so with a small KP the controller will make small attempts to minimize the error, and with a large KP the controller will make a larger attempt. If the KP is too small you might never minimize the error (unless you are using D and I terms) and not be able to respond to changes affecting your system, and if KP is too large you can have an unstable (ie. weird oscillations) filter that severely overshoot the desired value.

Integral Term (KI)
The integral term lets the controller handle errors that are accumulating over time. This is good when you need to handle errors steady state errors. The problem is that if you have a large KI you are trying to correct error over time so it can interfere with your response for dealing with current changes. This term is often the cause of instability in your PID controller.

Derivative Term (KD)
The derivative term is looking at how your system is behaving between time intervals. This helps dampen your system to improve stability. Many motor controllers will only let you configure a PI controller.

How AutoStart the app on boot?
I assume that your code and exec (bin) will be in /home/pi/BalanceRobotPI folder.

create a script start_robot.sh on your home folder (home/pi) nano start_robot.sh
place below code in it.

#!/bin/bash
sudo chown root.root /home/pi/BalanceRobotPI/BalanceRobotPI
sudo chmod 4755 /home/pi/BalanceRobotPI/BalanceRobotPI
cd /home/pi/BalanceRobotPI
sudo ./BalanceRobotPI

make executable
chmod +x start_robot.sh

Open a sample unit file using the command as shown below:
sudo nano /lib/systemd/system/balancerobot.service

Add in the following text :

[Unit]
Description=Balance Robot Service
After=multi-user.target

[Service]
Type=idle
ExecStart=/home/pi/start_robot.sh

[Install]
WantedBy=multi-user.target

You should save and exit the nano editor.

The permission on the unit file needs to be set to 644 :
sudo chmod 644 /lib/systemd/system/balancerobot.service

Configure Systemd

Now the unit file has been defined we can tell systemd to start it during the boot sequence :
sudo systemctl daemon-reload
sudo systemctl enable balancerobot.service
Reboot the Pi and your custom service should run:
sudo reboot
check your service
sudo systemctl status balancerobot.service
turn switch off and on if service not start.

Required libraries:
sudo apt update && sudo apt upgrade
sudo apt install alsa-utils espeak libespeak-dev libasound2-dev libbluetooth-dev libflac-dev bluetooth blueman bluez python-gobject python-gobject-2 libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev i2c-tools libi2c-dev qt5-default qtconnectivity5-dev qtmultimedia5-dev libqt5multimedia5-plugins

Enable the I2C protocol feature in raspberry pi:
sudo raspi-config
Enable the I2C, SPI, Remote GPIO
Reboot your system

Compile code:
cd BalanceRobotPI
qmake, make

Install latest wiringpi for rasp 4
sudo apt purge wiringpi
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v

About

BalanceRobot & Remote Control by Bluetooth BLE GATT Services

License:GNU General Public License v3.0


Languages

Language:C++ 86.3%Language:Swift 11.9%Language:QMake 1.5%Language:C 0.3%