Beagle Board - beagleboard.org
walkergrimes5
Published © LGPL

PocketBeagle Drone - Part 1

The beginnings of a 210mm quadcopter controlled by the BeagleBoard.org PocketBeagle development board powered by Octavo Systems SiP.

EasyWork in progressOver 1 day495
PocketBeagle Drone - Part 1

Things used in this project

Hardware components

QAV210 Mini Carbon Fiber Frame
×1
DX2205 2300KV Brushless DC Motors (2xCW 2xCCW)
×1
PocketBeagle
BeagleBoard.org PocketBeagle
×1
20amp BLHeli_s 2-4S esc
×1
Matek PDB-XT60 w/BEC(5v and 12v)
×1
SparkFun Triple Axis Accelerometer and Gyro Breakout - MPU-6050
SparkFun Triple Axis Accelerometer and Gyro Breakout - MPU-6050
×1
Dinogy 1300mAh 4s LiPo battery pack (XT60 plug)
×1
Propellers (210mm - 300mm frame)
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
Didn't actually end up using this component, but I have plans to eventually implement it.
×1
Battery Charging Cable (XT60)
×1
Altitude/Pressure Sensor Breakout MPL3115A2
SparkFun Altitude/Pressure Sensor Breakout MPL3115A2
×1
Male/Male Jumper Wires
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Prototyping Board (6cmx8cm)
×1

Software apps and online services

Amazon Web Services Cloud9 IDE

Hand tools and fabrication machines

Soldering Station
Power Supply
Models capable of delivering higher current are preferred for motor testing.

Story

Read more

Schematics

Drone Fritzing Diagram

Schematic of the control and power layout for the drone.

Other Useful Links

NOT SCHEMATIC - Websites I found useful when completing this project.

Code

Drone_Motor_Run.py

Python
Arms and runs the drone's motors. Will start automatically on PocketBeagle boot.
"""
--------------------------------------------------------------------------
Drone Motor Run
--------------------------------------------------------------------------
License:   
Copyright 2018 <Charles Walker Grimes>
Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------
This program runs all motors on my homebrew drone
Upon startup, the pocket beagle will power on the four motors and run 
them for 5 seconds before shutting down. This serves as a proof of concept
for the drone and the viability of my power/logic setup
This program will also allow for easy control of motor throttle for 
thrust/weight testing. By changing the pulse width, the power of the 
motor can be increased.
"""
# ------------------------------------------------------------------------
# Libraries - import the required libraries
# ------------------------------------------------------------------------
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM
import time
# ------------------------------------------------------------------------
# Constants - N/A
# ------------------------------------------------------------------------


# ------------------------------4.5------------------------------------------
# Global variables - N/A
# ------------------------------------------------------------------------


# ------------------------------------------------------------------------
# Functions 
# ------------------------------------------------------------------------
def main():
    # Arm the motor
    PWM.start("P1_33",0,100)        # Initialize all the pins with 0 duty cycle
    PWM.start("P1_36",0,100)
    PWM.start("P2_1",0,100)
    PWM.start("P2_3",0,100)
    time.sleep(1.0)                 # Hold for one second
    PWM.set_duty_cycle("P1_33",10)  # Start the pins a a l;ow duty cycle
    PWM.set_duty_cycle("P1_36",10)
    PWM.set_duty_cycle("P2_1",10)
    PWM.set_duty_cycle("P2_3",10)
    time.sleep(1.0)
   
    # Run the motor for 5 seconds
    PWM.set_duty_cycle("P1_33",11) # Run the pins at high duty cycle to
    PWM.set_duty_cycle("P1_36",11) # start the motors
    PWM.set_duty_cycle("P2_1",11)
    PWM.set_duty_cycle("P2_3",11)
    time.sleep(1.0)
    PWM.set_duty_cycle("P1_33",14) # Ramp up motors for power/current test
    PWM.set_duty_cycle("P1_36",14)
    PWM.set_duty_cycle("P2_1",14)
    PWM.set_duty_cycle("P2_3",14)
    time.sleep(5.0)
    PWM.stop("P1_33")              # Stop PWM signals and clean pins
    PWM.stop("P1_36")
    PWM.stop("P2_1")
    PWM.stop("P2_3")
    PWM.cleanup
    
    
    
# ------------------------------------------------------------------------
# Main script
# ------------------------------------------------------------------------
if __name__ == "__main__":
    main()
    
        

droneInit.sh

SH
Initializes the PWM pins on the PocketBeagle and automatically runs the motor arming code on boot.
#!/bin/bash
: '
--------------------------------------------------------------------------
Drone Initialize
--------------------------------------------------------------------------
License:   
Copyright 2018 <Charles Walker Grimes>
Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------
This shell script will initialize all of the pins required
by the PocketBeagle drone as PWM
Additionally, it will run the motor arming sequence Python script
'

# Configure all four PocketBeagle PWM capable pins as PWM
config-pin P1_33 pwm
config-pin P1_36 pwm
config-pin P2_1 pwm
config-pin P2_3 pwm

# Run the motor arming script
cd /var/lib/cloud9/ENGI301/Project/Code 
python Drone_Motor_Run.py

Credits

walkergrimes5

walkergrimes5

1 project • 5 followers
Thanks to Patrick Poirier.

Comments

Add projectSign up / Login