Sketch of the electronics

Its heart is a Teensy 3.2 microcontroller board. It is fast, has plenty of peripherals and is easy to use due to Arduino compatible libraries.

I use an H-bridge IC, the L293, as motor driver, allowing to drive in reverse. It is rated for 1 A. The LEGO motor draws less than that. The motor that I bought after that is still in the 1 A range. So no worries.

I measure the battery voltage straight forwardly in the middle of a voltage divider. This drops the voltage proportionally to something that can be safely connected to the input pins of the uC. I added a OpAmp buffer, because it avoids loading effects and I had one free unit of my dual OpAmp.

This configuration uses a ACS 711 hall effect current sensor on top of carrier board. I found it helpful to filter its output and amplify it with an OpAmp. It is a bit noisy, however tolerable.

The circuit can be powered by 9 - 12 V from the battery or the PSU. My version of reverse polarity protection is made of a diode and a polyfuse. In case I connect power in reverse it becomes the problem of the power supply to handle the current for a brief period.

The uC board, RaspberryPi's and servo motors need a supply of 5 to 6 V. So I ordered a common switch mode regulator for RC models from Conrad. It is rated for 5 A which is plenty for the little servo and the electronics.

I put (almost) everything on a breadboard. Has to be good enough.

Basic WiFi Link (ESP8266)

To get started, I ordered a small WiFi-enabled SoC board, the Olimex ESP8266 Dev board http://www.exp-tech.de/olimex-mod-wifi-esp8266-dev. Thanks to other cool dudes there is an Arduino compatibility layer https://github.com/esp8266/Arduino, which makes programming the chip very easy. Note that the board has no voltage regulator of its own. However, it can be supplied with the required 3.3 V by the regulator on the Teensy board.

Base station, ESP8266 and the uC communicate via a simple packet based protocol.
I didn't bother with anything fancy, but encode just numbers in ASCII Hex format. Thus a packet has the form "@x1;x2;x3;...$", where "@" and "$" delineate start and end of the packet. The integers x1, x2, x3 are the payload. The advantage of this protocol is that the data is still somewhat human readable.

The program on the ESP8266 relays packets bidirectionally over WiFi as UDP datagrams. It does nothing else. The packets arrive intact if they arrive, so no error correction on my side is required. The communication with the Teensy board goes through the UART serial interface.

Maximum range, outdoors within line of sight is approximately 70 m with the ESP 8266 configured as access point and a Mac Book Air as remote control. I mounted the WiFi-adapter on a little pole to keep it away from interference. It also looks cool.

Later on where I used the Raspberry Pi, it does the packet relaying in principle in the same manner. In addition, the RPi has to deal with video of course.

Raspberry Pi & Wifibroadcast

Wifibroadcast (WBC) https://befinitiv.wordpress.com/ is a project that allows data transmission over wifi without device association, much link an analog link. It's core comprises a rx and tx programs.

It eliminates the case of failure where devices fail to reconnect after a temporary disruption, e.g. due to blocked line of sight. It also allows for damaged packets to arrive - useful for video transmission.

Following the author of WBC I obtained a Raspberry Pi A+ and a camera module for it https://www.raspberrypi.org/products/camera-module

. Getting the Pi to capture a video stream is straight forward with raspivid. Video compression is already already performed by raspivid, which is nice, albeit the format seemed fixed to h264 at the time.

I open three logical transmission channels on the Raspberry Pi. One for telemetry, one for commands and one for the video stream. Each...

Read more »