How to turn on light using 11 different shields?


Hey Guys, today I’m gonna show you 11 different ways to turn on light using 1Sheeld.

Among all the +45 virtual shields supported in 1Sheeld, I have picked up 11 shields for controlling lights. In this tutorial I will walk you through each shield and show how to use them, and by the end of this tutorial I will merge all the codes together so you will be having all 11 controllers in 1 project 🙂 .

Lets start gathering components and connecting the hardware.

Components:

1- Arduino board
2- 1Sheeld+ board
3- Android or iOS device
4- Tiny Breadboard
5- LED
6- 330 ohm Resistance
7- Two Jumpers
8- 9V battery

Hardware connections:


Now after setting up the connections, lets start coding each shield to control the led…

1- Accelerometer Shield

Accelerometer Shield measures the acceleration of your phone on 3-axis (X, Y and Z), so I have made a condition on the accelerometer x-axis if the acceleration of the smartphone crossed 15 m/s2 then turn on the LED else just turn it off.

Actually using Gesture control in an application is making it more exciting and more fun just like here in the Orientation shield video tutorial:

2- Clock Shield:

Using the Clock Shield  gives the ability to turn the light on and off on certain times,making it easy to turn on home lights when it’s near 6PM or turn it off when it’s 6AM.

Adding the time factor is important in many projects specifically these which affects our daily usage, like controlling a coffee maker here in the clock shield video tutorial:

3- Color Shield:

Color Shield used to indicate the red color detected by the Smartphone camera on an LED, so this time the hardware connections will be slightly different, placing the LED on pin 11 instead of pin 13 making use of the PWM controlling the ambient light.

Note: in this code I am using the 3-bit RGB palette with a red LED connected to arduino,but you can replace the red LED with an RGB LED to represent all the available colors from the RGB just like this project.

4- Face Detection Shield:

And now it’s the time for the Face Detection shield which is one of the latest shields and it’s a little bit weird to control an LED with detecting faces but what if we control it with a wink 😉

In this code, we are checking for a face and after we find it we check again if this face is winking so if the face is winking using the left eye we turn the light on and if it’s winking with the right eye we turn it back off. Cool, isn’t it?

 

5- Light Sensor Shield:

The fifth shield is the Light Sensor shield which is detecting the light intensity in your environment and like most of the home automation projects or even like Lampposts in the street you want to turn on the light when it’s dark and turn it off when light intensity is good.

And that’s exactly what we have done in this code, we made the LED to turn on when the light intensity is below 50 Lux and turn it off other than that so it’s maybe the same idea of the clock shield example but it’s a bit smarter.

6- Mic Shield:

Mic Shield uses the mic inside your smartphone to detect noise in surrounding environment, so this time I will turn on an LED when the noise level exceeds a certain threshold,for example 80 decibels.

Just like the example of the getting started tutorial here:

(//Line not needed//)Moreover you can use it in an analog way where you can indicate the level of noise on the LED but you will just need to change the hardware a little bit and put the LED control pin on a PWM pin just like the color shield example.

7- SMS Shield:

SMS Shield gives the ability to send/receive messages  through the smartphone, so i will control the led by receiving a certain SMS (“Turn ON” or “Turn Off”) from another phone to turn on/off the LED.

As coded SMS shield can check if there’s a new received SMS by only 1Line of code, moreover sending SMS is actually much easier:

8- Terminal Shield:

Time for one of the most powerful 1Sheeld shields, the Terminal Shield, which turns the smartphone as a serial terminal for debugging and data display.

In this code, I will send commands from the smartphone so the Arduino board compares them  with the commands saved in the code,for example, if I send “turn on” the LED will turn on, and if I send “turn off” the LED will turn off plus printing the current state of the LED.

By using terminal shield to send text messages back and forth between the smartphone and the Arduino board, so what about making a digital voltmeter and display the readings on your smartphone like this lovely idea voltset ?

9- Toggle Button Shield:

The special thing about the Toggle Button Shield is that it can be used without the intervention of 1Sheeld library, just like a hardware switch in your connections. So with a simple code of  a normal hardware button controlling an LED,I will use the toggle shield by pressing the Arduino logo after choosing the shield,then an arduino schematic view will pop up, and by swiping my finger I could choose any pin to be controlled.

 

10- Twitter Shield:

For me, the Twitter Shield is one of the coolest ways to control things, imagine you want to turn on an LED every time your school or favorite team name mentioned on Twitter. Cool, Right? 1Sheeld is giving you the ability to track any work you want on all tweets posted since you have operated the system.

And as I’m a big fan of Game of Thrones series  I have added it as my tracking keyword cause season 7 is approaching in the next July so everytime the LED turned on I will know that the “Winter is Coming”  🙂

But what about tweeting using Arduino, actually, it’s even more simple and as always with 1Line of code, checkout this video tutorial for this thirsty plant tweeting:

11- Voice Recognition Shield:

Last but not least, our beloved Voice Recognition Shield which is giving you the ability to control things just with using voice commands and it can be activated also with 1Line of code: “VoiceRecognition.start();”

In this code you will find that I saved two commands “Turn on” and  “turn off” and when the Arduino detect a voice commands it will compare it to them and then it decides the action to be taken in each state.

Many devices are running into the market nowadays for controlling homes with voice commands like Amazon echo and Google home, so why to buy one of them while you can make them yourself, just like this Amazon Echo clone made using 1Sheeld:

Integration

Time for code integration, I have combined all the codes together in one project so you can use up to 11 shields to control the LED or even more you can add peripherals as much as you want.

The only difference will be in controlling the LED with the color shield as we were using it as an analog but now I turned it to digital so it can fit within the rest shields.

 

At the end of this tutorial, hope I covered all the needed points to operate it yourselves and of course, if you have any questions just leave them bellow in the comments 🙂 .

 




Related Blogs

Arduino IoT

Arduino IoT Shield Functions Explainer

Arduino makers …. you can connect your Arduino to MQTT brokers(servers) and launch your IoT with Arduino IoT Shield! It’s the 1Sheeld IoT shield that will do the job for you. It’s one of the most important but recent Arduino shields in 1Sheeld. Simply, it turns your Arduino into MQTT client where you can publish and …

Arduino Temperature Humidity System

IoT Arduino Temperature and Humidity System

Monitor my home environmental parameters remotely is one of the most desirable things I have ever wanted to make. It’s not about purchasing such a system that can get the job done for me. But, passion to create it myself. So, today, I am going to connect the popular DHT sensor to an online MQTT …

Arduino Door Lock

IoT Arduino Door Lock using 1Sheeld and Smartphone

  “Oh God! … It seems like I have forgotten the door lock open, again” … the normal saying whenever I am in hurry to go out! Have you encountered this problem before? It always confuses me since I may even think that I have left the door lock opened, and once I go back, …

IoT Fan Control

Arduino IoT Fan Control using 1Sheeld and Smartphone

Here I am with another IoT-based home automation project; Arduino IoT Fan Control. Every day, I get back from work tired and feeling hot. No air conditioner here and the fan takes much time to start cooling the room, sadly! So, I was thinking why not controlling the fan from outside my home with my …

Arduino Light Control

IoT Arduino Light Control using 1Sheeld and Smartphone

Have you ever forgotten to turn your home lights off when you got outside? Sadly, it happens to me all the time. And this causes confusion once I get my bills! Furthermore, here is one secret about me; I am a lazy man. I always want to control my room lamp from my sweet bed. …

mqtt-protocol

MQTT Protocol – How it Works

MQTT is one of the most commonly used protocols in IoT projects. It stands for Message Queuing Telemetry Transport. In addition, it is designed as a lightweight messaging protocol that uses publish/subscribe operations to exchange data between clients and the server. Furthermore, its small size, low power usage, minimized data packets and ease of implementation …