|
RP2040 |
x 1 | |
|
NSI50350AST3Gonsemi
|
x 1 | |
|
AQY212GSZPanasonic Electric Works
|
x 1 |
|
Arduino IoT CloudArduino
|
Control your Home Devices using Arduino and Personal Assistant
Introduction
In the previous video, we build an Alexa-controlled Door Locking System. So many people loved the project and we got so many positive responses! Today we are going to turn on and off electronic devices using your favorite personal assistant.
For the demo purposes, we will be connecting some LED strips but you can connect whatever you want to this circuit. So let’s take a look at the circuit.
The Circuit
The Altium designer environment has loaded. This is where we will be connecting the input voltage. A 7805 regulator is linked to the input power. The 7805 can take an input voltage of 7–32V and regulate it down to a constant 5V DC supply. LEDs serve as indicators at key spots to make troubleshooting easier.
Here I will be using an Arduino Nano with WiFi connectivity for this project. This board operating voltage is 3.3V so you have to keep in mind that, the maximum voltage that can be sent to Arduino GPIO pins is 3.3V, and make sure that you will not be connecting any voltage greater than 3.3V to Arduino GPIO as it may damage the board.
Here, If you take a closer look, you should be able to see two voltage inputs right? The Arduino and other onboard components can be powered from one voltage input, while the electronic devices attached to the relay can be powered from the other voltage input.
The relays are wired to four different Arduino GPIO pins. Relays are circuits or elements that can open and close switches in an electrical circuit. In this case, I’ll be making use of a Solid State Relay (SSR), a special kind of relay that doesn’t require any sort of mechanical trigger.
Getting the PCBs Done
I ordered my PCBs from PCBWay. PCBWay is a PCB manufacturer specializing in PCB prototyping, low-volume production, and neat and tidy PCB Assembly. To order your PCBs from PCB way, Go to the PCBWay website and fill in the basic board details in the instant order form.
And in the next screen, you can completely customize your PCB. You can change the thickness, change the solder mask color as well as the silkscreen color, materials used, you can customize it in every way possible. Corresponding prices will be updated here in real-time. In PCBWay, you can even manufacture your PCBs with TG 150-160 for the same prices as that of TG 130-140 which means your PCB will be able to operate at high temperatures without any damage.
On the next screen, you should be able to upload your Gerber file and submit it for review. Once the review is completed, all that is left is to add to the cart, make the payment, and wait for your PCBs to arrive.
Once you get all the components and the PCB, it’s time for you to solder them together. Solder all the components onto the board and make sure to check the polarity of the components. After soldering the PCB looks like this. And this is it. This one is small and I think it will fit nicely on top of the glove
Coding
Let’s move on to the programmatic details now. In this instance, I’ll be utilizing Arduino IoT Cloud to write the board’s code.
Go to things, then pick the “make a thing” tab. Everything pertinent to your project is listed here. This is where you can view all of the information related to your project in one place, including the circuit board, variables, network, sketch, etc. The first step is to name the project. The complete setup for the project can be seen below.
Now let’s take a look at the code. Arduino IoT cloud is helpful because after you’ve set up your thing and all the variables, it will automatically build a skeleton code that includes all the variables and critical function that is needed to run the code. More variables and operations need only be added.
Now I will be removing all unnecessary comments so that it will look, neet. And here are our final code guys now let’s take a deeper look into it.
#include "thingProperties.h" void setup() { Serial.begin(9600); delay(1500); initProperties(); ArduinoCloud.begin(ArduinoIoTPreferredConnection); setDebugMessageLevel(2); ArduinoCloud.printDebugInfo(); } void loop() { ArduinoCloud.update(); } void onBedRoomLightChange() { if (bed_Room_Light == 1) { digitalWrite(5, HIGH); Serial.println(" Bed Room Light ON! "); } else { digitalWrite(5, LOW); Serial.println(" Bed Room Light OFF! "); } } void onStudyRoomLightChange() { if (study_Room_Light == 1) { digitalWrite(5, HIGH); Serial.println(" Study Room Light ON! "); } else { digitalWrite(5, LOW); Serial.println(" Study Room Light OFF! "); } } void onStudyRoomFanChange() { if (bed_Room_Light == 1) { digitalWrite(5, HIGH); Serial.println(" Study Room Fan ON! "); } else { digitalWrite(5, LOW); Serial.println(" Study Room Fan OFF! "); } } void onStairCaseLightChange() { if (stair_Case_Light == 1) { digitalWrite(5, HIGH); Serial.println(" Stair Case Light ON! "); } else { digitalWrite(5, LOW); Serial.println(" Stair Case Light OFF! "); } }
In the setup function, we will initialize the serial communication, and communication with the Arduino cloud set the pin mode, and then prepare the carrier to run the remaining code.
For each of these four variables, the associated function will be executed whenever there is a change. The corresponding function will be executed whenever one of the values changes. For instance, the onlight1Change function will be executed whenever the light1 variable is updated. Turns on light 1 if its value is 1, otherwise turn it off. It’s the same with lights 2 and 3 and 4. Yes, I think you’ll agree that was dead easy.
How do we alter this variable now? We’ll use Alexa to flip the switch, you’re right about that. You can now upload your code to your board because it is complete.
Configuring Alexa
Now, take out your smartphone and launch Alexa App. Go ahead and install the Arduino Skill for Alexa and log in with your credentials.
Now tap on discover devices. It will start scanning for any IoT-based Alexa-supported devices. Once the scan is completed, it will show you all the variables we created earlier. Setup those devices and click done. That’s it, guys.
Testing
The devices should now respond to voice commands issued through Alexa. The Alexa app on your phone, as well as Echo Dot and other Amazon devices, can be used to communicate with Alexa and command these devices.
Please subscribe to our channel if you enjoyed this build and are interested in seeing more incredible DIY builds. Let’s begin work on the project right away.
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
delay(1500);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
}
void onBedRoomLightChange() {
if (bed_Room_Light == 1)
{
digitalWrite(5, HIGH);
Serial.println(" Bed Room Light ON! ");
}
else
{
digitalWrite(5, LOW);
Serial.println(" Bed Room Light OFF! ");
}
}
void onStudyRoomLightChange() {
if (study_Room_Light == 1)
{
digitalWrite(5, HIGH);
Serial.println(" Study Room Light ON! ");
}
else
{
digitalWrite(5, LOW);
Serial.println(" Study Room Light OFF! ");
}
}
void onStudyRoomFanChange() {
if (bed_Room_Light == 1)
{
digitalWrite(5, HIGH);
Serial.println(" Study Room Fan ON! ");
}
else
{
digitalWrite(5, LOW);
Serial.println(" Study Room Fan OFF! ");
}
}
void onStairCaseLightChange() {
if (stair_Case_Light == 1)
{
digitalWrite(5, HIGH);
Serial.println(" Stair Case Light ON! ");
}
else
{
digitalWrite(5, LOW);
Serial.println(" Stair Case Light OFF! ");
}
}
Control your Home Devices using Arduino and Personal Assistant
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Krishna S
- DIY Home Automation using Arduino UNO R4 Welcome to this beginner's guide to making your own home automation system, leveraging the prowess o...
- Getting Plants Watered Automatically: A Guide to Scheduling In this guide, we'll explore how using a scheduler in your DIY electronic projects can automate your...
- DIY Motion Triggered Halloween Prop using Arduino/Digispark Having Halloween decorations that come to life is absolutely fun. Unfortunately, there are significa...
- Control your Home Devices using Arduino and Personal Assistant IntroductionIn the previous video, we build an Alexa-controlled Door Locking System. So many people ...
- Making A Gesture Controller Glove using Hall Effect Sensor StoryHey guys, in this video, we will be making a compact circuit that can be fitted in a glove to c...
- Voice Controlled Door Lock using Alexa and Arduino Voice Controlled Door Lock: An OverviewHey, everyone! Welcome back. In this video, we'll make an Ale...
- Making a DIY Soldering Fume Extractor with Lighting IntroductionSoldering is awesome, right? It's fun to make our own PCB for our project, but there are...
- Driving 4 High Current Motors in your Robot using a Simple L293D Piggy Backed Arduino Nano Shield StoryHey, guys welcome back, In this post, I will show you how you can make your own high current mo...
- USB Joystick using Arduino for Robotics and Computer Game Hey guys, in this video, we are going to make an amazing compact joystick using Arduino. We can use ...
- How to make an Arduino UNO at Home? DIY Arduino In this project, we are going to be making our own customized Arduino Uno board and I will be showin...
- Beating Heart PCB for Valentines Day | Love is in the Circuit Hey guys it’s valentine’s day! So let me ask you a question. what gift are you going to give to your...
- 5V – 3.3V Logic Level Shifter IC for Arduino and Raspberry Pi 5V – 3.3V Logic Level Shifter IC for Arduino and Raspberry PiHey, Guys welcome back to RootSaid. In ...
- Lets make an IOT based plant watering system using Arduino Nano 33 IoT, some pumps and an Android Smart Phone. IntroductionHome automation is a popular subject these days and with excellent cause. Our smart devi...
- DIY Photoshop Editing Console using Arduino Nano RP 2040 Making a DIY Photoshop Editing ConsoleWhat if there was something that we could use to quickly chang...
- DIY Halloween Pumpkin using Arduino It’s time to get ready for Halloween! We’re going to be doing a lot of DIY stuff this month, so stay...
- Drink Like James Bond! DIY Cocktail Mixer Using Arduino Robotic BartenderThis weekend you can make your next cocktail party an even bigger success by buildi...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
122 0 0 -
DIY Laser Power Meter with Arduino
172 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
162 0 2 -