Voice and Wi-Fi controlled Lamp

Today, I’m very excited to share a tutorial how to control your lamp or any electronic appliance with voice either cross-platform application created with Xamarin.Forms. So, did you find yourself a very lean person who don’t want to stand up to turn on or off the light or just wanna be the boss no matter what? If yes, follow the steps in this tutorial and any physical activity can be spared!


First of all, let’s see how it works!

Sure, no world-changing technology was invented here, however, imagine the feeling when you to tap a button on your phone or just say “Hello” to your #nomorestupid / #smart lamp:

Ok! Now I have your attention, so we can start making this dream come true.

Things you need

Making of Power Socket extension controlled with 5V Relay

Our lamp is going to be switched in a way of plugging / unplugging a device directly into / from a power socket. This can be achieved by creating a power socket extension, which will have a relay connected to our Raspberry Pi.


Cut the power extension in the middle and connect a relay inside a junction box:


In the next step, connect the diode, transistor, and resistor as following image shows:



Controlling the lamp from UWP application

Now we are ready to start coding UWP application for Raspberry Pi in order to control GPIO pin connected to our relay. It’s the very easy thing, but don’t forget to add the IoT extension reference to your project. Initializing the GPIO pin should look like this:

Now, when the pin is initialized,  we just need to set it’s value in order to switch the lamp on or off.

Aaand that’s it!

Next time, we are going to add voice recognition to our application, so stay tuned.



Leave a Reply