LEGO IR Controller Server
This is the server side of the LEGO IR Controller system which is trying to provide an alternative to the original IR controller by using a smartphone application. The smartphone application communicates with the IR receiver on the vehicle (e.g. 9398 4x4 Crawler) through an IR transmitter controlled by a Raspberry Pi installed on the vehicle. The smartphone communicates with the Raspberry Pi through Wifi signal which allows to extend the operation range and makes the control of the vehicle less prone to signal loss which is often experienced with the original IR controller. This solution also allows to use the Raspberry Pi Camera to stream realtime video from the vehicle and display it on the screen of the smartphone. The installation is non-invasive and doesn't require any modification of the vehicle.
To make this project working with your LEGO Technic vehicle, you should have the following:
- Raspberry PI B+ (£25.70)
- Raspberry PI case (£11.98)
- Raspberry Pi camera (£19.25)
- External battery (£13.99)
- IR tramsmitter (£5.25)
- Wifi dongle (£10.85)
- Jumper Cable (£2.09)
Total cost: £89.11
The installation is described for the 9398 4x4 Crawler). Similar setup can be applied with small modifications to any other vehicles.
The IR transmitter should be connected to the Raspberry Pi on the PIN 17 (
DAT) and 19 (
GND) as shown on the following image:
The IR transmitter can be installed on the top of the roof facing towards the IR receiver. Because even sunlight can interrupt the IR communication, it's recommended to cover both the IR transmitter and the receiver.
The Raspberry Pi itself fits nicely into the rear cargo area of the car. It only requires to remove the site bars and install them in horizontal position above the Raspberry Pi.
The battery for the Raspberry Pi should be installed above the front axle to balance the weight.
Raspberry Pi Camera can be installed either on the bar above the IR receiver or in the from of the car (requires longer flex cable).
Raspberry PI configuration
The installation of the
legoirc-server on the Raspberry Pi is described for
Arch Linux ARM. For other
distributions it's necessary to compile it manually. In general, the
legoirc-server depends on
library which must be
installed before the compilation. If your distribution is not using
systemd then you have to write your own
init.d scripts or run the
legoirc-server manually every time you start up the
The installation procedure on the Arch Linux ARM, including the installation of
systemd services, is as follows:
pacman -S base-devel curl -o PKGBUILD https://aur.archlinux.org/packages/le/legoirc-server/PKGBUILD makepkg --asroot --install --syncdeps
Each command sent to the server should be terminated by a newline (
\n). If the
command consists only of a newline, the connection will be closed. The commands
can be sent by a specially created Android
application or by the
which is part of this project:
legoirc-client -s <IP_of_your_RPi>
Even easier is to use
telnet <IP_of_your_RPi> 8160
The direction commands correspond with the layout of the keys on the numeric keyboard:
The only non-directional command implemented so far is the command "
shuts down the Raspberry Pi server.
The video stream has about 1 second delay due to the transport through the network and the encoding/decoding of the video.
The control can be delayed due to the network communication.
Only the control channel 1 works.
Only the "Combo PWM mode" is implemented.
There might be other issues. Please report them on the project site.
This software is licensed by the MIT License which can be found in the file LICENSE.