Wednesday, March 22, 2017
Home » Flowstone Workshop » Flowstone Workshop 14

Flowstone Workshop 14

Flowstone-Header

TELEMETRY Networking Your Robots

FLOWSTONE WORKSHOP 14-1

Welcome to the FlowStone Workshop number 14, where we give a beginner’s guide to computer programming using the FlowStone graphical programming language inside FlowBotics Studio. In this issue, we are going to look at Telemetry and Networking using two-way wireless remote control of robotics.

WHAT IS TELEMETRY? 

Telemetry is the ability to communicate in two directions with a device or system. Good examples of telemetry are satellites sending and receiving data to and from earth, or a Formula 1 race car sending engine management data back to the pits. If the system is fast and reliable enough, it has the advantage of allowing the main processing to be back at a home base. In robotics this has huge implications. Imagine a robot walking around where the robot hardware is nothing more than a few motors and controllers— and the brains can be programmed and maintained on your laptop.

FLOWSTONE WORKSHOP 14-2
Bluetooth2.

Alternatively, look at how most robotics are controlled and programmed today. Take the simple example of Lego NXT; you write your program on your laptop but then have to download the new firmware into the Lego brick. Test it and if it doesn’t work how you imagined, you have to go back to the PC and try again. You can’t see what’s going on in the hardware so you just have to guess and troubleshoot what’s wrong with your code, etc. Many hobby robots have the processing built in, and users have no access to the source code at all

The way forward for the next generation of robots is to host the working program (brains) on the PC side and just send the end results, the motor positions, etc., to the robot. Then, the robot sends back the feedback data and sensor data so you can act on it. A good example of a modern system using telemetry is the Servo Erector Set from LynxMotion. The robots all use the SSC-32 servo controller on the robot to control the servos, but the movements and control all come live from the PC via Bluetooth using FlowBotics Studio so you can edit the code live while it’s working. There are two main ways you can wirelessly control your robot:

FLOWSTONE WORKSHOP 14-3
LynxMotion Quadruped with Bluetooth.

1—Using a serial telemetry system that is two-way, like Bluetooth, or a long-range telemetry system.

2—Using Wi-Fi and a networking protocol

FLOWSTONE WORKSHOP 14-5
Laptop with built in Bluetooth.

BLUETOOTH 

Most of you are probably familiar with Bluetooth (2400–2483.5 MHz). This was first designed to create a wireless version of RS232, so it is ideal for controlling our robots. The standard low-powered Bluetooth usually works at 9600 baud, and has a range of around 30 feet. This makes Bluetooth ideal if you want to control a robot in the same room, plus most laptops have Bluetooth built in so no external hardware is necessary for the PC side.

In FlowStone, the Bluetooth device just comes up as a virtual com port (e.g. Com 5) so you can use the FlowStone comport module to send and receive data from your robot, while keeping the main processing on the PC.

The main limitation of Bluetooth is that it has a relatively short range in its standard form. You can get high-powered Bluetooth that will work up to 300 feet, but you need to use special hardware for this.

FLOWSTONE WORKSHOP 14-7
The FlowStone Comport Module used for Telemetry.

SERIAL TELEMETRY 

High frequency telemetry systems (433MHz or 915MHz) are now readily available for not a lot more than a Bluetooth system. These use higher transmission frequencies and can go up to one mile! Plus the baud rate can typically go up to 115200, but this is range dependant. Again the PC side comes up as a virtual com port so you can use the same FlowStone com port module to get at the data easily. The remote end is just TTL serial (5v RS232) so you can connect to a servo board like the SSC-32 from LynxMotion, or any standard microprocessor board. The wireless systems I am using were originally designed to send and receive telemetry data to UAVs (Unmanned Aerial Vehicles) and have a good range. Since the Bluetooth and long-range telemetry system are both com ports, it means that they are directly interchangeable with no changes to any software on the PC side. So you could use the robotics apps inside FlowBotics Studio to control your robot up to a mile away.

FLOWSTONE WORKSHOP 14-6
A long range USB Telemetry system.

WI-FI – TCP/UDP 

Traditionally, networking was a bit of a black art but now using FlowStone inside FlowBotics Studio, it’s easier than you might think. Yes it’s a bit more complicated than a simple com port but once you get your head around IP addresses, it’s not so hard. In general, if you network two systems together you need a network “Server” (the base station or master) and a network “Client” (the device or slave). In FlowStone, there are two components dedicated for these functions and they can communicate via TCP or UDP. TCP stands for “Transmission Control Protocol” and in layman’s terms is a way to send and receive messages with error checking to see if your message actually made it to the end address. UDP stands for “User Datagram Protocol” and is similar to TCP only without any error checking, so it is a little simpler and ideal for control applications.

FLOWSTONE WORKSHOP 14-8
Server/Client Network test.

The Server needs a Port number to communicate on, a protocol type (TCP or UDP) and the Client needs an IP address (of the Server) plus the protocol type (TCP or UDP) and a Port number. The Port number is a 16-bit unsigned integer (1-65535); similar to a house number on a street. The Server/Client Network test illustration shows a typical Server/Client test set up on the same PC, where the client sends some data back to the Server

The cool thing about using a network protocol is that it isn’t restricted to just your home Wi-Fi network. You can send data to literally any computer network in the world. Each internet connection has a unique IP address so you can send your data to a specific computer if you like. To check your IP address just type “My IP” into Google and it will display your public IP address. At the remote end, the port will need to be opened in your router otherwise it may get blocked. Some common ports like 80 and 8080 are usually open by default. If you are using any of the Phidgets interfaces with FlowStone you can also set the ID to include the IP address so that you can send/read the data over the internet.

FLOWSTONE WORKSHOP 14-9
FlowStone iPad app.

Another neat Networking app is the free FlowStone UDP app available on the iPad. This also uses UDP and your Wi-Fi network to send and receive data to FlowStone inside FlowBotics Studio. This is really cool as it turns the iPad into a remote control for FlowStone so you can control a robot, your home automation system, control an MP3 player volume or just about anything else you can think of that FlowStone can interface to. You can also send data back to it for display, such as temperature or status LED’s, etc. To make this work you need to set the app IP address to match your PC IP on your Wi-Fi network. This is usually 192.168.0.xx and can be seen inside FlowStone as an output from the Server module. You then set the port to a number that is not used, like 9,000. Finally, inside FlowStone, you need to set the Server to the same port number and you’re off.

FLOWSTONE WORKSHOP 14-10
FlowStone Network Server receiving data from the iPad app

This simple FlowStone project turns on a Relay on a USB board based on which buttons you press on the iPad app. This will then control your lights at home.

CONCLUSION 

Using Telemetry you can gain full control over your robot by using your PC and FlowStone. You can see the live telemetry data which will allow you to develop your robotics applications faster. You can use Bluetooth, a long-range telemetry system, networking and even a wireless webcam with FlowStone. Meanwhile your robot can be much simpler with just a transceiver and a simple servo control board or microprocessor and do the hard stuff on your PC with all of the comfort of a realtime development platform like FlowStone inside FlowBotics Studio

Links 

DSPRobotics, dsprobotics.com
FlowBotics, flowbotics.com
RobotShop, robotshop.com

Leave a Reply

Your email address will not be published. Required fields are marked *