Using a 3g/4g internet connection and two mobile phones

For the fun of it we made an Android app allowing a sender phone and a receiver phone to act as a remote control. The reciever phone is connected to a Polulo Maestro servo card with Usb Host.

It work pretty fine actually.

We use some nice piece of communication software (from another project) enabeling mobilphones to communicate peer to peer bypasing NAT restrictions using no server in between. This software also allow for logical peer identites without any spesific account or setting, just figure a peer name and connect. (so it make it very easy to connect with a standard phone connected to internett with 3g/4g)

Why not use mobilphones for controller directly, it have everything, gps, gyro, accelerometer (+ easy programmable i java) ?


Views: 3221

Comment by Stephen Gloor on November 22, 2015 at 6:12pm

What is the communications software - it looks interesting.

Comment by Leif Auke on November 23, 2015 at 3:52am

The software is called M2, (it is not publicly availiable as api). We developed it for the purpose of peer to peer messaging applications.

M2 has the appabillity to connect peers on any network even if the IP is unknown or behind a NAT. (What is the fact for mobilphones on mobile networks)

Its written in java and run on any device supporting java and have a network connection and allow the devices to enable p2p session supporting message and streams.

It run on any android phone, on rasberry pi card (and like) with a 3g dongle and on any windows, mac or linux pc.

Interested for projects? : -> skype: leifauke


Comment by rishabh jain on November 23, 2015 at 5:32am

i wonder what will happen to the machine (in flight) and its assigned task, when the 3g/4g network signals drop. :P
you won't have any control over it.

Comment by Leif Auke on November 23, 2015 at 6:15am

It is a very good question Rishabh!

In this particular app the receiver service is initiated with neutral servo position (motor=0, other = middle). If communication is lost servos are moving to neutral.

Basically it work like this:

1. The sender is streaming one packet with all servo positions to receiver approx. 50 times a second (each 20ms) 

2. The receiver has 2 loops,

2.1. Receiving packet loop updating current incoming positions,

2.2  Servo update loop reading the current positions and send positions to servo card

If no packets have arrived in a period of time (set to 100ms) the servos are moved neutral by the servo moving loop.

Since this is not and autopilot, only a simple remote control, the only thing to do is moving neutral on loast connection :)

It’s an experiment and it is tried on a Norwegian mobile network. The interesting part is the latency (how long time for each packet to travel from sender to receiver). On this Norwegian mobile network and both pees (sender / receiver) on same network I experienced the latency to approx. 50ms. That means 1/20 of a second for sender / receiver response to change of servo movements

Comment by Stephen Gloor on November 23, 2015 at 6:19am

@Lief - it is interesting - is it a TCP connection or UDP?

Comment by Leif Auke on November 23, 2015 at 6:32am

M2 is based on UDP. This app send positions as simple streamed packets (see above comment) and commands as messages (for the moment commands are very limited ;) but I plan to enable some)

M2 is based on UDP, but sending messages are reliable, i.e. it's handshake and fail proof with an internal protocol (almost like TCP) The reason for using UDP is easy NAT traversal.

Comment by Damian on November 23, 2015 at 6:36am

Have you published a paper/ more info about the UDP NAT traversal???


Comment by Leif Auke on November 23, 2015 at 6:38am

hmm @Daimian its a trick of the trade actually :)

Comment by Damian on November 23, 2015 at 6:40am

Fair enough, Leif!

Does your trick work with different mobile providers on these 2 phones? Or the 2 phones with the same provider, but in different geographies?

Comment by Martin on November 23, 2015 at 6:42am

Would it be possible to stream video with M2?


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service