Skip to the content
PCBKitNew board
2 layers24 × 30 mmM link lite, the printed circuit board in 3D

Simple WiFi/WebSocker based receiver for combat robotics

Size
24 × 30 mm
Copper layers
2
Thickness
0.89 mm
Parts
22
Nets
25
Pads
96
Tracks, vias
227, 62
Pours
7
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
16 Jul 2022
Updated
27 May 2024

Overview

M link lite is an open-source printed circuit board by mooped, from the mooped/m-link-lite repository on GitHub. It is a 2-layer board of 24 × 30 mm with 22 parts on 25 nets, routed with 227 tracks and 62 vias.

It is built around the 74LS365DC and ESP-12F. Its parts include 8 resistors, 6 capacitors, 3 ICs, 3 connectors and 1 diode. It belongs with the radio and wireless and robots and motor control boards and the ESP8266 boards of this library.

Main components

2

README

README.md

M-Link Lite

M-Link Lite is a receiver for combat robotics based on the ESP8266 microcontroller. It acts as a WiFi access point and can be controlled from a WebSocket.

M-Link Lite hosts a web server with a basic page for controlling a simple combat robot.

Additional files can be uploaded to control more complex robots with up to 6 channels.

The servo pulsewidth data sent to the WebSocket is passed straight through to the outputs to avoid limiting possibilities.

M-Link Lite has a configurable failsafe so if no updates are received for 500ms the outputs will be put into a safe state.

When turned on M-Link will create a WiFi Access Point named m-link-XXXXXX where XXXXXX is a unique set of digits that identifies the device. The device should be labelled with this ID. A single user can connect to this access point and the controller page should be accessible by navigating to http://m-link-XXXXXXX.local or if wildcard DNS is enabled to any url e.g. http://m-link/ .

When connected to the access point the device will always be available at http://192.168.4.1 . If you are having trouble when using the access point from a mobile device, turning off mobile internet so WiFi is the only option may help.

Once configured via the access point you can enter details for your own access point and the device will connect to it from then on.

Extending M-Link Lite

The default Drive page on the M-Link Lite device provides a single virtual joystick that directly drives the first two channels. It performs no mixing and is designed for a dual ESC with onboard mixing.

If you wish to use all 6 channels or other features you can upload additional files through the File Manager page that make use of these features.

As a starting point it is recommended to download the default 'Drive' page from main/joystick.html, modify it. You can use the File Manager page on the device to upload and test the modified version.

The on-screen Joystick is implemented with jeromeetienne/virtualjoystick.js which has its own documentation and examples for adding additional joysticks.

Some examples are provided for implementing one, two, or three on-screen joysticks in the examples folder of the project.

The page talks to the M-Link Lite by sending JSON messages over a websocket and the device will send JSON messages back in response.

The code at line 40 of the Drive page sends an initial packet to center all outputs, and it also sends a set of failsafe values which will be applied if a packet is not received for 500 milliseconds. This is intended to avoid the robot going out of control if the user closes their browser, turns of the controlling device, or the connection is otherwise disrupted.

text
        ws.onopen = function() {
          ws.send(
            JSON.stringify(
              {
                servos: [
                  1500,
                  1500,
                  1500,
                  1500,
                  1500,
                  1500
                ],
                failsafes: [
                  1500,
                  1500,
                  1500,
                  1500,
                  1500,
                  1500
                ],
                query: "settings"
              }
            )
          );
        };

The default failsafes will stop a brushed ESC that has a reverse feature and center a servo. If you intend to build a robot using non-reversible ESCs or your servo driven mechanisms require a different position on failsafe you will need to update these values.

The values sent in the servos and failsafes array are the pulse width that will be sent to the servo in microseconds. 1000 microseconds is usually fully left, 2000 microseconds is fully right, and 1500 microseconds is centered. You can send 0 microseconds to stop sending a signal, which will cause many servos to idle, but depending on the servos you will need to be careful with other out of range values which may cause unexpected behaviour and/or damage.

For the failsafes array a value of -1 can be set instead of a pulsewidth to hold the channel at its last position when in failsafe.

The code between lines 103 and 124 is responsible for sending updated values to the M-Link Lite 30 times a second. By altering the values to the servos array you can make use of all 6 channels.

text
      setInterval(function(){
        const x = Math.round(joystick.deltaX() * 5);
        const y = Math.round(joystick.deltaY() * 5);
        $msg = JSON.stringify({
          servos: [
            parseInt(1500 - y),
            parseInt(1500 + x),
            1500,
            1500,
            1500,
            1500,
          ]
        });
        if ($('#send').val() != $msg || (++counter % keepalive) === 0) {
          $('#send').val($msg);
          ws.send($msg);
        }

        var outputEl  = document.getElementById('result');
        outputEl.innerHTML = $('#wsresponse').val();

      }, 1/30 * 1000);

For example you could declare a second VirtualJoystick instance and have it respond to a second area of the screen, and use it to drive 1 or 2 of the extra channels.

These extensions are likely to depend on the intended features of the robot so the system has designed to leave these up to the user while providing maximum flexibility.

For ease of experimentation the default Drive page declares a mlink object in the global scope which contains a reference to the WebSocket. You can use this from the browser's Javascript console to send messages manually.

For example, to request the M-Link device send back the current battery voltage reading:

text
mlink.ws.send(JSON.stringify({
  query: "battery"
});

WebSocket API

The WebSocket API expects a JSON message and responds based on the keys contained in the message.

Sending servo pulsewidths to drive the robot:

For example Ch 1 center/brake, Ch 2 left/reverse, Ch 3 right/forward, Ch 4 center/brake, Ch 5 left/reverse, Ch 6 right/forward

text
{
  servos: [
    1500,
    1000,
    2000,
    1500,
    1000,
    2000
  ]
}

The M-Link will read as many channels from the array as it supports and then ignore any additional values. If fewer values are sent than are supported the remaining channels will be left alone.

Setting Failsafe Positions

For example Ch 1 center/brake, Ch2 left, Ch3 right, Ch4/5/6 hold position

text
{
  failsafes: [
    1500,
    1000,
    2000,
    -1
    -1
    -1
  ]
}

The failsafes key is handled in the same way as a servos key with the exception that -1 is interpreted as hold position.

Updating settings

text
{
  settings: {
    name: "My Robot",
    ssid: "my-ssid",
    password: "my-password"
  }
}

The settings object can contain any or all of the keys name, ssid, password and the settings relating to any keys provided will be updated upon receipt of the packet.

If the SSID or Password for the WiFi are changed the settings will be saved immediately but the device must be rebooted before they will take effect.

The SSID and Password fields refer to an external Access Point the device will try to connect to. The details for the M-Link's Access Point are fixed and cannot be changed.

Resetting Settings

text
{
  reset_settings: "sgnittes_teser"
}

The reset_settings key will cause a reset of all settings to factory defaults as soon as it is received, so long as the value is the string "reset_settings" backwards to prevent accidental resets.

Rebooting

text
{
  reboot: "toober"
}

The reboot key will cause an immediate reboot of the device so long as the value is the string "reboot" backwards, to prevent accidental reboots.

This can be used after updating settings to apply any that require a reboot to take effect.

Query

The query key can be used to read various values back from the M-Link.

text
{
  query: "battery"
}

The device will respond to a battery query with an object containing the value read on the ADC which may be connected to an external battery of the 5v rail of the servo connectors depending on the device and how it is wired.

text
{
  query: "failsafes"
}

The device will respond to a failsafes query with the current failsafe values.

text
{
  query: "settings"
}

The device will respond to a settings query with an object containing the current settings.

Safety

M-Link Lite is designed as a simple device to make it easy to get started and because of this it has been designed to be simple and robust at the expense of some security features.

To avoid users locking themselves out of the device its Access Point has a fixed password, and when connected to a shared Access Point there is no authentication to prevent other users from taking control of the device. For this reason we do not recommend using this device for any robot with spinning weapons or any other weapons that would be dangerous if activated unexpectedly.

Building The Project

This project is based on the ESP8266 FreeRTOS SDK, which is the ESP8266 equivalent of the ESP32's ESP-IDF project.

You can find instructions for installing and setting this up in their Getting Started Guide.

This project uses a version of the ESP8266 FreeRTOS SDK that I modified to include the ESP32 version's web server. You will need to check out my ESP8266_RTOS_SDK_ESP32TTTPD project instead of the official version.

Parts

22
QtyValueFootprintReferences
610kResistor_SMD:R_0603_1608MetricR2, R3, R4, R5, R6, R8
4100nCapacitor_SMD:C_0603_1608MetricC2, C3, C5, C7
21uCapacitor_SMD:C_0603_1608MetricC1, C4
1100Resistor_SMD:R_0603_1608MetricR10
133kResistor_SMD:R_0603_1608MetricR1
174LS365Package_SO:SO-16_3.9x9.9mm_P1.27mmU3
1ADC INConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ1
1AP1117-33Package_TO_SOT_SMD:SOT-223-3_TabPin2U1
1ESP-12FRF_Module:ESP-12EU4
1PROGRAMConnector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_VerticalJ2
1RESTORE SETTINGSnew_moop_items:SW_SPST_PTS810SW1
1SIGnew_moop_items:ServoHeader_3x06_P2.54mm_VerticalJ3
1STATUSLED_SMD:LED_0603_1608MetricD1

Questions

How big is the M link lite PCB?

It measures 24 × 30 mm and has 2 copper layers, 0.89 mm thick.

What parts does the M link lite use?

22 parts, built around the 74LS365DC and ESP-12F. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the M link lite KiCad files?

From the mooped/m-link-lite repository on GitHub, at the commit this page was made from: the board is hardware/m-link-lite.kicad_pcb and its schematic hardware/m-link-lite.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the M link lite design in my own project?

Its repository states no licence, so its author keeps all rights: ask mooped before reusing the design.

Similar boards

  • 2 layers100 × 77.5 mmSuperSerial, the printed circuit board in 3D

    SuperSerial

    btb/SuperSerial

    A clone of the Apple Super Serial Card ][

    55 parts18
  • 2 layers239.6 × 239.9 mmTK3000, the printed circuit board in 3D

    TK3000

    clemarfolly/TK3000

    Réplica do Microdigital TK3000

    329 parts7GPL-3.0
  • 2 layers170 × 170 mmTELESTRAT2, the printed circuit board in 3D

    TELESTRAT2

    Fred72z/ORIC

    Extensions pour ORIC1-ATMOS

    160 parts5GPL-2.0
  • 2 layers206.2 × 138.1 mmOric, the printed circuit board in 3D

    Oric

    Board-Folk/Oric-Remix

    Oric Remix

    133 parts4
  • 2 layers90.6 × 58.6 mmTimerModule, the printed circuit board in 3D

    TimerModule

    crempp/ucpu

    16bit CPU made from TTL Logic Chips

    17 parts4
  • 2 layers51.4 × 61 mmWifi gb cart, the printed circuit board in 3D

    Wifi gb cart

    Staacks/wifi-game-boy-cartridge

    A WiFi cartridge for the original Game Boy.

    38 parts242
  • 2 layers50 × 38 mmPcb smd, the printed circuit board in 3D

    Pcb smd

    tenderlove/esp8266aq

    ESP8266 and Plantower AQ sensor

    24 parts220