Thanks to the wide variety of shields offered by the ESP8266-based Wemos development board, we can recycle any toy that has a 5v DC motor and give it a new life!
In order to control our locomotive, we need to have knowledge about MQTT and know how to send commands to the Wemos with the EasyESP firmware (See section STEPS)
Materials:
Buzzer
IR Infrared Sensor
LED 3.3v
Diagram:
Steps:
Download EasyESP (Mega version for ESP8266) and flash our Wemos with the corresponding firmware.
Configure a broker MQTT with controller type "Home Assistant (openHAB) MQTT"
Add devices :
Motor shield: SDA: GPIO-4 (D2) SCL: GPIO-5 (D1)
Sensor IR: GPIO-16 (D0)
Execute commands to check that sensor it's okey:
Motor Shield:
WemosMotorShieldCMD,0,Forward,30
WemosMotorShieldCMD,0,Stop
LED
PWM,12,500
Buzzer
tone,14,1300,200
Open UI M5Flow and upload the example code for M5Stack Core 2 Download NOTE: Change connection parameters for broker MQTT