Articles tagged with WebRTC:

  • Eyepot - Programming

    Let's program the robot I built in the previous article!

    The Eyepot works by using in conjunction a Raspberry Pi Zero W and an Arduino Pro Mini connected by a serial link. Therefore, we'll write the Arduino code first, then a Python program for the Raspberry Pi. Then, we'll setup remote control from a web browser.

    You can find the entire source code for the project licensed under GPLv3 on my repository on GitHub.

    The finished Eyepot moving

    The finished Eyepot moving

    Arduino program

    The Arduino Pro Mini is responsible for driving the eight servos of the legs. Commands to specify target angles are sent from the Raspberry Pi through a serial link.

    The custom serial protocol is text-based and quite simple. It can easily be typed manually when debugging, but it is still compact enough to allow short transmission times even at low bitrates. Each line contains a one-character command, an optional space, and an optional parameter as a base-10 integer. Implemeted commands are as follows:

    • 0 to 7: store target angle for corresponding servo (0 to 7)
    • R: reset stored target angle to default for each servo
    • C: commit stored target angles (apply the stored angle for each servo)

    So, for instance …

  • A telepresence robot - Enhancements

    In this article, I'm going to describe architecture enhancements for the control system of the WebRTC-controlled telepresence robot I built a few months ago, presented in a previous article.

    The four-wheel base of the telepresence robot

    The four-wheel base of the telepresence robot

    Since I did not manage to have a satisfying WebRTC support directly in a native Android app, I previously settled for a hack where the smartphone of the Telebot uses two different connections to the signaling channel: one to receive user control in the Android app, and one to handle the WebRTC session in the browser.

    This was bad for two reasons:

    • The robot can enter an incoherent state if one connection is closed and not the other.
    • User control commands do not benefit from WebRTC, instead they travel through the server, adding latency and jitter.

    The idea for the new architecture is to have the Android app run a small HTTP server in background that can accept motor control commands and send them to the Bluetooth device. We will send users commands on an RTCDataChannel and forward them to this small HTTP server with JavaScript in the browser.

    General schematic of the enhanced architecture

    General schematic of the enhanced architecture

    Let's put together a tiny single-threaded HTTP server for …

  • A telepresence robot - Programming

    In this article we are going to program the Telebot we have built in the previous article.

    We will use WebRTC, which is the new standard for real-time communication in Web browsers, and take advantage of the necessary signaling channel to also transmit commands to move the robot.

    General schematic of the whole control system

    General schematic of the whole control system

    Programming the robot actually consists of three different steps:

    • Writing Arduino-flavored C++ code for the Arduino-like controller to properly move and balance the robot
    • Building a specific Android application to handle a WebRTC session on the smartphone and relay commands to the controller via Bluetooth
    • Setting up a node.js server to serve an HTML5 control page over HTTPS allowing visioconference and remote control
    The Telebot ready to be programmed

    The Telebot ready to be programmed

    Therefore, the project will be a mix of Arduino, Android Java, and Javascript (client-side and server-side). The source code is free software, licensed under BSD 2-clause license and GPLv3 (Arduino code). The complete source for the project is available on my repository on GitHub.

    Arduino programming

    First, motor control is achieved through an extremely simple text protocol over the Bluetooth serial, with one single-letter command and one value per line. Motors are driven with PWM …