Controller for lego

    A little less than six months ago, he gave his son a birthday present - the Xiaomi MITU designer . Unexpectedly for me, the child hung in this constructor for a week. When the first models were tested and their control from the tablet, a logical question arose - “How to write programs for it?”

    image

    And here I was severely disappointed - this creation of a gloomy Chinese genius contained a programming system that was quite accessible for reptilians from the planet Nubira, but hardly whether suitable for a child of 6 years. Plus, it suddenly turned out that it was quite possible not to wait for compatible sensors with Mitu.

    But if the child asks, dad cannot refuse. I started exploring options, of course I'm looking at Lego, for starters on the NXT / EV3. Immediately a little disappointed by the price, both on the computer and on the motors / buttons, then I start to look at their latest squeak Wedo - and there everything is generally depressing.

    Ok, there are alternative versions, I find an interesting Sbrick project - the price is more or less sane, compatible motors can be taken on Ali , but there is not much programming.

    There were also all sorts of shields on the Beaglebones and the Arduins, but nothing worthy of attention was caught.
    Well, there were long winter evenings ahead, we took a file and started sawing.

    For the first version I took the advertised ESP32, and even with OLED on board. Beauty.

    image

    A shield with the drivers of engines and PCA9685 was bought for her company:

    image

    My enthusiasm was enough for about a week. Those. and something is showing on the screen, and the motor is spinning, but I feel something with the back - the wrong chip. Perhaps somewhere for him there will be a niche, but it is very specialized, it is too unbalanced and some kind of Chinese .

    I put a bold cross on ESP32, I take the next interest. By chance, it turned out to be RTL8710, bought shortly before on Ali on the pretext of “Oh, funny! And inexpensive! ”

    But there wasn’t even much time to spend :)

    image

    With a clear conscience, the chip is sent to landfill. And here the introduction ends and we move on to the project itself. For the next one on my table was NRF52. And it is no coincidence - a well-balanced AWP, with solid KFOR and sensible technical support. I collect the first knee-joint version:

    image

    To begin with, only LEDs and bluetooth profiles. I am debugging the most basic things and I understand that here it is! This is exactly the chip that I need. Now you can add a little muscle to the project:

    image

    Well, there is already a speaker, and drivers, and an accelerometer, and connectors for the periphery. As connectors, I initially considered the USB-C option, like on Mitu, but I was confused by the complexity of making the connecting cables. Therefore, I did not invent a bicycle, but simply put almost compatible with Lego RJ-12. They are easy to squeeze, they are cheap and quite reliable, as for children's playful pens.

    Well, in ordinary Legov details, the connector changes in 3 minutes:

    image

    More or less sensible software is already written here, you can configure and control the hardware from the phone via bluetooth.

    In parallel, a project is being created on CircuitMaker (this is the same Altium, only free), where the circuit and the board are drawn.

    On Ali, little things are bought, on Siidstudio - the manufacture of the board, and while they are slowly floating in the oceans, we continue to write firmware.

    Finally, the boards and some of the parts arrived:

    image

    Fill the firmware, rejoice at the LED blinking. The time has come for the next part. We draw a model of the battery compartment and print it on a 3D printer:

    image
    Moreover, unlike Chinese holders, you can insert batteries with or without protection in this one:
    image

    It suddenly turns out for me that the very first version of the board was without global jambs, all the details intermeddle, nowhere is any jumper forgotten, minor updates along the way do not count:

    image

    Again, put off the soldering iron and take the 3D printer. After a dozen unsuccessful models, a decent body is obtained:

    image

    On the reverse side, everything is ready for connection to the usual Lego, the ears on the sides are the same size as Lego Technic: I

    image

    use the motors in ordinary Chinese, lego-compatible, but I do all sorts of additional buns separately. For example, the Chinese HC-SR04 for the dollar turned out to be an excellent Range srnsor: with a

    image

    printed case and a connector, its cost is less than $ 3, while a similar Legovsky one costs $ 57 :

    image

    Total today there is a box that can control motors and sensors with the help of a javascript (inside the slightly castrated Espruino is spinning as a submodule), the box can update its firmware via bluetooth, circuits, boards, sorts, 3D models - everything is laid out in an open form on the github .

    Unfortunately, I still have one open task. I’m still more ironic, and when I needed to write a softink for Android, I was a little sad.

    In plan, take the regular Blockly code and add an update via bluetooth to it. And if you want to join or make yourself the same toy - Wellcome.

    Github
    Schemes
    Facebook group
    I hope this piece of iron is useful not only for my kid.

    Also popular now: