--- title: "Edifier R1700BT Remote Control" date: 2020-10-01T14:44:25+02:00 draft: false description: "Use a Wemos to create an mqtt-based remote control" tags: ["WeMos", "Arduino", "Blog"] categories: ["Electronics"] startpage: true lang: gb --- After I got the Edifier R1700BT Speaker I notice that i want to control them like all my other stuff with my moile phone and MQTT. So i got some IR reciver and LEDs to simulate the Edifier Remote with a Wemos who is connected to my MQTT Server. {{< tweet 1310694353187344385 >}} I figure out the IR-Codes used: * 149389439 -> power on/off * 149356799 -> mute * 149369039 -> Volume Up * 149393519 -> Volume Down * 149377199 -> Switch input to Bluetooth * 149399639 -> Switch input to Line In ## Hardware I connected the IR-LED to the D4 Pin of a Wemos. I used [this question](https://antwortenhier.me/q/wie-steuere-ich-die-ir-led-mit-esp8266-pint-bei-3-3-v-und-mosfet-um-einen-62376266277) as basic idea. {{< figure src="/img/2020/10/ir-remote/plan.png" >}} ## Software With this Numbers, and the [pubsubclient](https://github.com/knolleary/pubsubclient) and [IRremoteESP8266](https://github.com/crankyoldgit/IRremoteESP8266) i just can subscripe to some topics, and every time a message aravid at one of the topics i could send the code to the speaker: ``` if(String(topic)=="musik/power") { irsend.sendNEC(149389439, 32); Serial.println("EDIFIER: Power"); } if(String(topic)=="musik/mute") { irsend.sendNEC(149356799, 32); Serial.println("EDIFIER: Mute"); } if(String(topic)=="musik/down") { irsend.sendNEC(149369039, 32); Serial.println("EDIFIER: Down"); } if(String(topic)=="musik/up") { irsend.sendNEC(149393519, 32); Serial.println("EDIFIER: UP"); } if(String(topic)=="musik/bluetooth") { irsend.sendNEC(149377199, 32); Serial.println("EDIFIER: Bluetooth"); } if(String(topic)=="musik/line") { irsend.sendNEC(149399639, 32); Serial.println("EDIFIER: Line"); } ``` ## Final Result After solder everything to a perforated board I got the following result. {{< figure src="/img/2020/10/ir-remote/result.jpg" >}} Maybe I will create another smaller version to hide next to the speaker. For now it works. ## Complete Code You can got the complete code here: [Complete Code](/code/ir-wemos-mosfet.txt) {{< load-photoswipe >}}