Git Product home page Git Product logo

pibluebot_public's Introduction

pibluebot

This is a server script which controls the Raspberry pi rover. For an implementation overview refer to the video below.

Implementation

The rover is controlled by Raspberry Pi Zero W, with Raspbian-jesse distribution installed. The rover actions are controlled by rover.py script. The script is ran as an unprivileged user rover who is a member of dialout and shutdown groups. The dialout group membership is needed for serial port operations, the shutdown groups was added to manage permissions for the shutdown command, which were granted by adding the following line in the sudoers file via visudo command:

%shutdown ALL = NOPASSWD: /sbin/shutdown

###Bluetooth Gotchas The rover implementation uses Bluetooth Serial Profile, which is NOT enabled by default. In order to fix it there are a few modifications required for the systemd bluetooth service:

  1. add compatibility option -C to the bluetoothd
  2. add serial profile using sdptool command

The above requirements are reflected in the following 2 lines of your systemd bluetooh.service script:

ExecStart=/usr/lib/bluetooth/bluetoothd -C and ExecStartPost=/usr/bin/sdptool add SP

Permission tricks

In Pi Zero W the Bluetooth is ran on the serial inteface /dev/ttyAMA0. However, you will not be able to connect to it directly. The tricky part is the way RFCOMM sockets are implemented on Linux. By default the Bluetooth device (ran on the /dev/ttyAMA0) will be listening for a connection, using rfcomm listen hcXX, or rfcomm watch hcXX commands, where hcXX is your Bluetooth interface. Once connection is acceptied the Bluetooth stack will create another serial inteface, usually /dev/rfcomm0, and hand over the connection to it. The /dev/rfcomm0 inteface is owned by the dialout group, hence the required group membership mentioned above.

The systemd rover-setup.service takes care of setting up a connection listener by running rfcomm watch hci0. The rover.service launches the rover.py script, which communicates via /dev/rfcomm0.

Please refer to the rover-setup.service and rover.service files

Video Overview

IMAGE ALT TEXT HERE

pibluebot_public's People

Stargazers

zen avatar Pranav Lathigara avatar Bladymir Tellez avatar

Watchers

Vladimir avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.