Web Controlled Servo From A BeagleBone Black


[Babak] created an in-depth tutorial on how he got his BeagleBone Black to control a servo from a web browser.

[Babak] configured a pin on his BeagleBone Black (BBB) as a PWM line and connected it to the control line on a micro hobby servo. The BBB is running a Node.js web server that displays a simple web page to control the servo. The browser sends a WebSocket request to a small WebSocket node server also running on the BBB that then writes the appropriate PWM value to the pin connected to the servo.

The code for node WebSocket server and web server can be found on his GitHub page. There is also a small node library to control PWM lines on the BBB. Though the end result is simple, controlling the servo can be done from any browser that can make a network connection to the BeagleBone Black. Check out the video after the jump for a description and demonstration.

[via Adafruit]

13 thoughts on “Web Controlled Servo From A BeagleBone Black

    1. Definitely seems like the servo should have its own dedicated power supply. I guess for proof of concept it’s alright, but I wouldn’t use it like this for anything more than testing.

    1. The “RC PWM” used in RC servo control acts very differently than the PWM used in any other system. (In particular, the confusingly similar-sounding direct PWM DC motor speed control works entirely differently). Most RC servos move to exactly the same position when they receive a 1.5 ms pulse every 6 ms (a duty cycle of 25%) as when they receive a 1.5 ms pulse every 25 ms (a duty cycle of 6%) — in both cases, they turn to the center position (neutral position). The low time (and the total period) can vary over a wide range, and vary from one pulse to the next, without any effect on the position of the servo motor. With many RC servos, as long as the “frame rate” (how many times per second the pulse is sent, aka the pulse repetition rate) is in a range of 40 Hz to 200 Hz, the exact value of the frame rate is irrelevant. Most RC receivers send pulses to the RC servo at some constant frame rate, changing only the high time. However, it is possible to command an RC servo to move over its entire range with a function generator set to a constant 10% duty cycle by changing only the frequency (frame rate).

  1. You know what would be hackworthy? http://cointerra.com/engineering-update-asic-bringup-diagnostic-testing/ these people are using BBB. Their promise was: The TerraMiner IV is powered by 4 of CoinTerra’s proprietary GoldStrike I ASICs, a 28nm chip with a minimum performance rating of 500GH/s (0.5TH/s) and power consumption of 0.55W per GH. It operates at a clock frequency of 1.4GHz.

    The actual clock frequency as of shipping is 850mhz per core. They max out at around 1600GHS.
    http://cointerra.com/firmware-downloads/ it would be awesome if somebody more experienced with the BBB could modify the firmware to allow individual core frequency tuning, from like.. 800 to 1400mhz
    maybe a lower low core frequency for the cores that put out more errors or heat

    1. A “proper hack” would be to use a WiFi router running OpenWRT (these can be had for as little as $10 these days) using the serial port to interface with the microcontroller of your choice to function as a slave to handle I/O.

      There was an article about this on HaD within the past week or two.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.