# Controlling Relay using mqtt

**URL:** <https://discourse.nodered.org/t/controlling-relay-using-mqtt/62459>\
**Category:** General\
**Created:** [10 May 2022 14:43 UTC](https://discourse.nodered.org/t/controlling-relay-using-mqtt/62459 "2022-05-10T14:43:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [11 May 2022 16:37 UTC](https://discourse.nodered.org/t/controlling-relay-using-mqtt/62459/4 "2022-05-11T16:37:18Z")

</div>

One of my IoT students was asking about nearly the same question that you posted on the forum.  
He was using a Wemos D1 Mini - not sure what you are using. But I'm sure it could be adapted.

I've posted what we did on the forum as I think it might go some way to solving your problem.

> [@Controlling LEDs on a Wemos D1 Mini (Arduino code) via MQTT](https://discourse.nodered.org/t/controlling-leds-on-a-wemos-d1-mini-arduino-code-via-mqtt/62523):
>
> One of my IoT students was asking how to control a set of LEDs on a Wemos D1 Mini, that had been programmed using Arduino code, via MQTT commands from Node-RED. This is what the breadboard lash-up looks like... The red LED is connected to D8 (GPIO-15). The green LED is connected to D7 (GPIO-13) The yellow LED is connected to D6 (GPIO-12) This is the very simple test-flow we created in Node-RED. [Screen Shot 05-11-22 at 06.35 PM] [{"id":"bb2bbcc236726f09","type":"tab","label…

---

_[View the full topic](https://discourse.nodered.org/t/controlling-relay-using-mqtt/62459)._
