Search the Community
Showing results for tags 'mqtt'.
Found 2 results
-
4DBrix Wi-Fi Controller and Internet of Things with LEGO
MajorAlvega posted a topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
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 10.24.10.121 -t nControl/one -m "mot,f,1023" i am publishing a message on the broker (my laptop, 10.24.10.121) 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. -
Hi Guys, I got a bit carried away with my latest lighting setup and thought I would share my progress. I started off just wanting front and rear white/red lights but... well video's speak louder than words.. I have an ESP8266 onboard programmed with the Arduino IDE. The motor is controlled with a RC brushed motor ESC and the LED's (6 in total) are all programmable so they only need 1 output pin for all 6. It is communicating by MQTT and at the moment I am using Home Assistant just as a test controller but the plan is to use it with 4DBrix's nControl software as the features become available. A benefit of using Home Assistant lets me control it from my phone or PC. It will work across the web as well but I don't really have the need to control my trains from outside the house. Not yet anyway... I'll get some video's about the build up when I can Mike