4177

No Smartphone or Tablet needed to control LEGO Powered UP bricksets


 Introduction:With introduction of new LEGO technic model sets in 2019 based on their new BLE automation system "PoweredUp" the community was wondering why control handset where still provided for train sets , but mising for car sets ike
https://www.lego.com/de-de/product/4x4-x-treme-off-roader-42099
or
https://www.lego.com/de-de/product/app-controlled-top-gear-rally-car-42109

The only official control olution is to use apps and a mobile phone or tablet

When LEGO published some detailsabout the protocol used:
https://lego.github.io/lego-ble-wireless-protocol-docs/
I decides to build one on my own:

Basic Engineering:

To become famiiar with BLE i followed a training course and bought 2 of these : nrf52840-DK

https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK

Most reason to do so was because they where used in the course, to
The biggest advantage is the flexibility of the boards and package.
In addition that the SDK is free of cost, you get a full licence for SEGGER EMBEDDED IDE too.
The board has in in build segger JTAG Programmer / Debugger that can be used via pin header for
other boards , like Adadfruit feather express, or Arduino Nano 33 BLE.

Last but not least:
The nRF52840-DK board is a flexible testing tool in combination with NRF connect softare.
Nordik also provides a special firmware, and wireshark plugin, to use this board as an BLE sniffer.


Project Preparation
At a fist step a sniffed the data traffic between the LEGO HUB with motors attached as used by the Rally car and the LEGO Control+ profile that is intended to control car..

Bill of material

1. Controller:
I choose Ardafruit nRF52840 feather expess because of :
                         --> Adafruit supports potential BLE Lib called "Bluefruit"
                         --> Has onboard JTAG Port for Debugging or using "bare metal path" if needed
                        --> Small form fctor that fits into CAR control handset.                      -> Support for 1S LIPO  including charging electronics via USB

2. Control hardware :
   
I simpy removed the µC and transmitter unit and left other controls untouched and connect them to
    BLE controler.


3. Software:
   The  software is kept as simple as possible, for that erason it uses small RTOS Tasks.
    The connection is established on "Power On".
     Two simple transfer methods are provded to send a single data message for speed and steering               position.

    One Task is responsible to translate ADC conversion of Trottle ;other do same for steering position.
    "New" steering or "Throttle" is detected by using a value change small threshold . For that reason ther       i s no need to permanently transmit something via bluetooth
   
Conclusion
The idea  behind this project was to demonstrate , that it is possible to provide a control for a specific
LEGO powered up  technic car, even for beginners in this field, with not investing much tome and          money..

Because it is indented as a proof of concept   am very satisfied with the result.