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 Robotics

Arduino Robotics Series, from a car to a robot arm

Arduino keeps standing out from the crowd of all-around development boards due too its ease of use and budget price. As a result, this has enabled almost anyone to get his own idea into life no matter how crazy or even useless to the whole world it was, except for its maker! Also, it has …

Arduino Robot Arm

How to build an Arduino Robot Arm placed on RC Car

Arduino robots are always funny and definitely more enjoyable when combined with robotic arm! And today, I will walk you through the making of a simple Arduino Robot Arm that’s made of cardboard and how you can attach it over your Arduino Bluetooth RC Car / Robot that you have made so far through this series. …

Arduino Line Following Robot

How to build an Arduino Line Following Robot using Cardboard

Arduino Line Following Robot is one of the easiest and most well-known projects that anyone can make to learn the basics of programming, electronics, and mechanics all in one project. It’s known that this project is common for most of the makers and tech students and today I am going to give it a revisit …

Arduino Obstacle Avoiding Robot

How to build an Arduino Obstacle Avoiding Robot using Cardboard

Back again with another Arduino Bluetooth RC Car tutorial but with an advanced feature that makes your car autonomous by adding ultrasonic sensors to the RC Car you have made before!. Yeah, I know that you may have seen other tutorials using ultrasonic to make the car/robot avoid obstacles ahead, but I am going to …

Arduino Bluetooth RC car

How to make an Arduino Bluetooth RC Car using Cardboard

  Cardboard crafts are one of the most popular and easy to make DIY stuff. Mixing this with the unmatchable enjoyment of RC Cars and the ease of using Arduino, I am going to show you how to make a Cardboard Arduino Bluetooth RC car that you can control via Bluetooth from your smartphone.  …

Arduino Security Camera

Arduino Security Camera System (Arduino Home Hacks #4)

Arduino Security Camera Have you ever wanted to check your home in real time? Afraid that maybe someone has stormed in, don’t remember if you shut the door or not or maybe wanna check if your Hyper-energetic dog has broken any of your dishes AGAIN!! 🙂 Then this is the perfect place for you cause today …