4DBrix Wi-Fi Controller and Internet of Things with LEGO

Recommended Posts

I got my hands on a 4DBrix Wi-Fi Controller:

It's intended to control LEGO trains through Wi-Fi but it got my attention when I knew it uses MQTT messages. I'm a big fan of MQTT, a light message queing protocol developed by IBM to control satellites in the last century and then released to the community. There are tools to use MQTT in all major operating systems and also on some microcontrollers like Arduino so we can create a mesh of very heterogeneous devices including Arduino, Raspberry Pi... and MINDSTORMS EV3:

So in case someone needs to control a LEGO motor and Bluetooth or Infrared is not an option you can also use Wi-Fi.

MQTT is an asynchronous protocol to exchange messages. There is a 'broker' that receives messages from 'publishers' and delivers them to 'subscribers' and there is a sort of 'namespace' to organize all this messages in 'topics'

In the video I used a fresh installation of current snapshot version of ev3dev 'stretch'. It already includes the tools to 'publish' and 'subscribe' MQTT messages. The 'broker' is my laptop and the 4DBrix had subscribed a topic named 'nControl/one'. So when I type the command

mosquitto_pub -h -t nControl/one -m "mot,f,1023"

i am publishing a message on the broker (my laptop, on the topic that 4DBrix Wi-Fi Controller has subscribed. The payload of the message is "mot,f,1023" and the Controller interprets this a "turn motor ON, forward, at full power".

it is really simple. The only problem i have so far is with the connection to my wireless acces point, sometimes it takes A LOT of time.

With just a PF 1.0 connector it isn't exactly a competitor for SBrick, BuWizz or LEGO Powered Up. And for €32 anyone familiar with Arduino and ESP can make their own. But it's always good to have an option.

Share this post

Link to post
Share on other sites

An ESP8266-based module. You can use it like an Arduino, even use the Arduino IDE and libraries.

It should also have a power driver, probably an H-bridge and some sort of power regulator.

The PF connector only exposes C1 and C2 pins, not 9V and GND. So it's not possible to use a PF Servo Motor. Everything else (9V and PF) should work.

Share this post

Link to post
Share on other sites

That sounds simiIiar to the WEMOS D1 mini ESP8266 and motor driver module I bought for $5. Flashing new firmware to the STM32F4 on the motor driver was an interesting experience.  I still have a ways to go with the WIFI stuff.  The 4DBrix seems easier out of the box. 



Share this post

Link to post
Share on other sites


Yes, the idea of buying a 4DBrix was having some immediately usable device. For people with Arduino or other microcontroller platforms experience, it's something we can do on our own for more or less the same price (and more fun :) ) but most AFOLs would prefer something like the 4DBrix (or the SBrick, BuWizz, etc).

4DBrix also have a nice GUI program to use it, nControl, and I believe that's where they score extra points - you can design your own railway (or monorail) project and then control the train with this Wi-Fi controller and the fixed circuits through USB controllers. For pure Train AFOL's that's great.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.