element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Bluetooth Unleashed Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Bluetooth Unleashed Design Challenge
  • More
  • Cancel
Bluetooth Unleashed Design Challenge
Blog Bluetooth Maze - testing servos attached to the Beaglebone using a 2-axis Joystick
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: carmelito
  • Date Created: 17 Jul 2018 7:02 AM Date Created
  • Views 541 views
  • Likes 4 likes
  • Comments 0 comments
  • bluetooh
  • joystick
  • servo
  • bluetooth unleashed
  • BeagleBone Black
  • beagleboneblackwireless
  • bluetooth_maze
Related
Recommended

Bluetooth Maze - testing servos attached to the Beaglebone using a 2-axis Joystick

carmelito
carmelito
17 Jul 2018

This is a quick blog post which includes attaching two servos to the Beaglebone Wireless and using a 2-axis analog thumb joystick to test out the movement and help calibrate the angle I need to move as part of the final servo mechanism. Basically each axis on the thumb joystick maps to movement of one of the servos, which will be placed below top plate of the maze. And, as part of the final setup the in addition or instead of the joystick, the BBC Microbit will be used to control the servo mechanism.

image

Here are the connections made to Beaglebone Wireless

  • Servo1 - P8_13
  • Servo2 - P8_19 - both these are PWM pins on the Beaglebone

And the pins of the Thumb Joystick

  • VERT - P9_38
  • HORZ - P9_36 - both these are analog pins on the Beaglebone

To power the servo's I am using 5V mini breadboard power supplies.

 

 

And, here is the python program that I used on the Beaglebone to run the test -

#07142018 testing Beaglebone Wireless with servo, and thumb joystick
import Adafruit_BBIO.PWM as PWM
import Adafruit_BBIO.ADC as ADC
import time


servo_pinL = "P8_13"
servo_pinS = "P8_19"
sensor_pinHOR = 'P9_36'

sensor_pinVER = 'P9_38'


ADC.setup()


duty_min = 3
duty_max = 11
duty_span = duty_max - duty_min
PWM.start(servo_pinL, (100-duty_min), 50.0)
PWM.start(servo_pinS, (100-duty_min), 50.0)


while True:
        readingHOR = ADC.read(sensor_pinHOR)
        readingVER = ADC.read(sensor_pinVER)


        print("ADC HOR: "+ str(readingHOR) + " ADC VER: "+ str(readingVER))
        angleHOR = readingHOR * 180
        angleVER = readingVER * 180


        if angleHOR > 180:
                PWM.stop(servo_pinL)
                PWM.cleanup()
                break
        if angleVER > 180:
                PWM.stop(servo_pinS)
                PWM.cleanup()
                break
        angleflHOR = float(angleHOR)
        angleflVER = float(angleVER)
        dutyHOR = (angleflHOR / 180) * duty_span + duty_min
        dutyVER = (angleflVER / 180) * duty_span + duty_min
        print("duty servo HOR: "+ str(dutyHOR) + " duty servo VER: " + str(dutyVER))
        PWM.set_duty_cycle(servo_pinL, dutyHOR)
        PWM.set_duty_cycle(servo_pinS, dutyVER)
        time.sleep(1)

 

Here is a screenshot of the output of the program above running on the Beaglebone Wirless.

image

 

Here is a quick video demo

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube