How to Install Pixy Camera Software - PixyMon
[vc_row][vc_column][vc_column_text]
In the previous tutorial, we have seen how to Get Started with Pixy Camera, which was quite a basic tutorial and we have covered just the basic cables required to set up pixy camera. Now along with cables we are also gonna need software for training our Pixy Camera. So in this tutorial we are gonna see how to install Pixy Camera Software which is named as PixyMon. As I explained earlier in previous post that first of all, we need to connect our Pixy Camera with Computer or laptop and then using its software PixyMon we need to train our Pixy Camera so that it can recognize objects present in front of it.
PixyMon is quite a simple software and quite easy to use. In this post, we are not gonna check How to use PixyMon software (which is the topic for net tutorial) but we are gonna see How to install pixy Camera software successfully without any errors. So now I hope that you have bought the Pixy Camera and have also bought the USB to mini USB cable because we are gonna need to it in order to connect our Pixy Camera with computer and make it work with PixyMon software.
I could have covered the whole tutorial in a single post but then its gonna be real messy because we need to cover quite a lot of things that's why I thought to divide it in parts so that we cover each and every thing in detail and even a begineer can easily follow these tutorials and could work on PixyMon Camera Module. After checking the installation of PixyMon software, in the next tutorial we will have a look at How to upgrade the drivers for Pixy Camera Module. So now let's get started with installation of PixyMon.
Note:
- Don't connect your Pixy camera with computer, first we will install the PixyMon software which will also install the driver for USB cable and then we will plug our Pixy Camera with computer.
How to Install Pixy Camera Software - PixyMon
- As I mentioned above, PixyMon is a software which is used to train our Pixy Camera module using Computer.
- So, first of all download the PixyMon software by clicking on the below button:
- At the time of writing this post, the latest version of PixyMon released is 2.0.9 for Windows so either download the software by clicking above button or visit http://cmucam.org/projects/cmucam5/files (Official site for PixyMon) to download latest version of PixyMon.
- Now after downloading the PixyMon, double click it to open and the first window will show up is shown in below figure:
- Now when this window pop up, click on the Next button.
- When you click the Next Button, the below window will open up.
- Now here Browse to your folder where you wanna install the PixyMon software and then click the Next button and you will get the below screen:
- Now here simply click the Next button again unless you wanna change the folder for the shortcut, which is not necessary.
- Now finally when you hit the Next button, it will show you all the configurations you set and will ask you to install the software as shown in below figure:
- Now hit the Install button and your software will start to install as shown in below figure:
- Now during installation, a new window will pop up as shown in below figure:
- Simply press OK button, this pop up is asking for the driver to install for the USB cable which we will plug in after installation of this software.
- Now that's the last window for installation of PixyMon software. Simple click Finish and you are done with the installation of Pixy Camera software.
Now we are done with installation of Pixy Camera software, in the next tutorial we are gonna have a look at How to install latest firmware for Pixy Camera. So stay tuned. :)[/vc_column_text][vc_empty_space height="30px"][/vc_column][/vc_row][vc_row][vc_column width="1/2"][vc_column_text]
<< Getting Started with Pixy Camera[/vc_column_text][/vc_column][vc_column width="1/2"][vc_column_text]
Upgrade Pixy camera Firmware >>
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text][/vc_column_text][/vc_column][/vc_row]
Getting Started with Pixy Camera
Hello friends, hope you all are fine and having fun with your lives. Today's post is about getting started with pixy camera. Now, the first thing comes in mind is what is Pixy Camera so let's first have a little introduction about Pixy Camera on which I recently worked. Pixy Camera is a small camera board which uses NXP microcontroller. Its a very powerful board and can get easily interfaced with simple Arduino UNO board. So, now we can do image processing even on Arduino UNO. Image Processing needs a powerful board that's why we can't interface simple webcam with Arduino UNO or mega etc. Before using pixy camera, when I need to do on board image processing I always used either Arduino YUN, Raspberry Pi or Arduino USB host shield but still it was quite tough to do the image processing even on such powerful boards like Arduino YUN. But now with Pixy Camera module, one can quite easily do the image processing even on Arduino UNO.
Now question arises what this module does ? Actually this Pixy module has a NXP microcontroller on it which does all the image processing and is controlled by a computer. (We are gonna cover this in coming tutorials) Once you set its parameters like color detection or object detection etc then you simply unplug it from computer and plug it with Arduino or any other PIC Microcontroller. Now whenever that object comes in front of Pixy Camera it will automatically recognize it and will send the command to your microcontroller and will also send the parameters like X, Y coordinates or size etc of the object and what you need to do is to apply your algorithm on Arduino i.e. what you gonna do if the object is infront of the camera. Sounds complex, don't worry we are gonna follow everything in detail in coming tutorials. So, now we are gonna have a look at how to get started with Pixy Camera.
Getting Started with Pixy Camera
- So, when I ordered for my Pixy Camera, I got the box within 10 days.
- As I received the box I opened it and I got two items from it, one is the Pixy Camera board itself and second is the Serial to SPI cable which is used to connect Pixy Camera with Arduino or PIC Microcontroller.
- The Pixy Camera is shown in below figure:
- The Serial to SPI cable which is received has 9 pins on one end which is inserted in Pixy board while six pins on the other end which is inserted in Arduino Microcontroller.
- This cable is also shown in below figure:
- The black side of this cable is for microcontroller while the white side is for Pixy Camera board itself.
- Next cable you are gonna need is the USB to mini USB cable, which is not with the package so you need to get it on your own.
- I got mine as well and is shown in below figure:
- This cable is used to connect your Pixy Camera board with computer.
- Using this cable, we train our Pixy camera and let it know about colors and objects.
- We actually set signature using Pixy Camera Software, which I am gonna cover in my next tutorial and using this software we make pixy do incredible things.
Now we have all the tools to get started with Pixy Camera so now in the next tutorial, we will have a look at How to install Pixy Camera software in Windows. Click the below button to move to next tutorial. If you having questions please ask in comments below.
[vc_empty_space height="30px"]
How to Install Pixy Camera Software >>
Control Servo Motor with Arduino in Proteus
Hello friends, hope you all are fine and having fun with your lives. Today's post is about the Controlling of Servo Motor with Arduino in Proteus ISIS. Servo Motor is a common motor used in engineering projects for precise circular motion. We can move the servo motor at any desired angle, which is not possible in the case of other motors i.e. Stepper or DC.
For example, suppose I want to move an antenna at a precise angle of 47.5 degrees then if I use DC Motor, I have to use an encoder. So, in such cases instead of using a DC motor, I will prefer Servo Motor.
I have already posted Angle Control of Servo Motor using 555 Timer in which I have controlled servo motor using 555 timer and another tutorial about Controlling of Servo Motor using PIC Microcontroller in which I have controlled it with PIC16F877a. And today we are going to Control Servo Motor with Arduino and will design the simulation in Proteus ISIS.
First of all, we will have a look at simple control of servo motor with Arduino in Proteus ISIS and then we will check the control of the servo motor with Arduino using buttons in which we will move the servo motor to precise angles using buttons. So, let's get started with it. :)
Where To Buy? |
---|
No. | Components | Distributor | Link To Buy |
1 | Servo Motor | Amazon | Buy Now |
2 | Arduino Uno | Amazon | Buy Now |
Simple Control of Servo Motor with Arduino in Proteus
- First of all, open your Proteus ISIS software and design the below simple circuit.
- You should also have a look at these Proteus Libraries of Components.
- Servo Motor has three pins:
- First Pin is Vcc.
- Second Pin is Control Pin.
- Third Pin is GND.
- The center pin is the controlling pin and goes to any digital pin of Arduino. I have connected the control pin to pin # 4 of Arduino.
Arduino Code for Servo Motor Control
- The next thing we need to do is to design the code for Arduino. So, open your Arduino software and copy paste the below code in it.
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup()
{
myservo.attach(4);
}
void loop()
{
for(pos = 0; pos <= 180; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 180; pos>=0; pos-=1)
{
myservo.write(pos);
delay(15);
}
}
- Now compile this code and get your hex file.
- It's the same code as given in the Servo folder of Examples in Arduino software.
- Upload your hex file to your Proteus Arduino board.
Note:
Proteus Simulation Results
- Now, run your simulation and you will see that your Servo motor will start moving from 90 degrees to -90 degrees and then back to 90 degrees and will keep on going like this, as shown in the below figures:
- Now when you start it, first of all, it will show Position A in the above figure then will move anticlockwise and pass the position B and finally will stop at Position C and then it will move clockwise and comes back to Position A after passing Position B.
- In this way, it will keep on moving between Position A and C.
- Till now we have seen a simple control of Servo Motor with Arduino in Proteus ISIS, now let's have a look at a bit complex control of servo motor with Arduino.
Control Servo Motor with Arduino using Push Buttons
- In the previous section, we have seen a simple Control of Servo Motor with Arduino in which we simply moved Servo motor from 90 degrees to -90 degrees and vice versa.
- Now I am going to control Servo motor using five push buttons and each push button will move the Servo motor to a precise angle.
- So, first of all, design a small design as shown in the below figure:
- I have added five buttons with Arduino and now with these five buttons, I will move the Servo motor to 90, 45, 0, -45 and -90 degrees. So, each button has its precise angle and it will move the motor to that angle only.
Arduino Code
- So, now the next thing is the code, copy paste the below code in your Arduino software and get the hex file:
#include <Servo.h>
Servo myservo;
int degree90 = 8;
int degree45 = 9;
int degree0 = 10;
int degree_45 = 11;
int degree_90 = 12;
void setup()
{
myservo.attach(4);
pinMode(degree90, INPUT_PULLUP);
pinMode(degree45, INPUT_PULLUP);
pinMode(degree0, INPUT_PULLUP);
pinMode(degree_45, INPUT_PULLUP);
pinMode(degree_90, INPUT_PULLUP);
}
void loop()
{
if(digitalRead(degree90) == LOW)
{
myservo.write(180);
}
if(digitalRead(degree45) == LOW)
{
myservo.write(117);
}
if(digitalRead(degree0) == LOW)
{
myservo.write(93);
}
if(digitalRead(degree_45) == LOW)
{
myservo.write(68);
}
if(digitalRead(degree_90) == LOW)
{
myservo.write(3);
}
}
- Upload this hex file to your Arduino board in Proteus and run the simulation.
Proteus Simulation Results
- Now press these buttons from top to bottom and you will get the below results:
- The above figure is quite self-explanatory but still, I explain a little.
- In the first figure, I pressed the first button and the motor moved to -90 degrees.
- In the second figure, I pressed the second button and the motor moved to -45 degrees.
- In the third figure, I pressed the third button and the motor moved to 0 degrees.
- In the fourth figure, I pressed the fourth button and the motor moved to 45 degrees.
- In the fifth figure, I pressed the fifth button and the motor moved to 90 degrees.
- In the sixth figure, all buttons are unpressed and the motor remained at the last position.
It was quite simple and hope I explained it properly. If you still have any questions then ask in the comments and I will try to resolve them. That's all for today, will see you guys in the next tutorial. Take care !!! :)
How to Reset Arduino Programmatically
Hello friends, hope you all are fine and having fun with your lives. Today's post is about How to Reset Arduino Programmatically. Sounds a bit weird, yes it is :) but literally in some cases, this technique is the only choice you have. It recently happened to me in one of my projects, that's why I know How important it is. Before going into details, let's first have a look at the resetting feature of Arduino.
If you have worked on any Arduino board, then you must have noticed the RESET pin in Arduino and you may wonder what's the use of this pin. So, today this pin is gonna get useful. Moreover, you have also noticed that when you upload the code to your Arduino board then the Arduino resets, another way of resetting Arduino is by opening the Serial Terminal in Arduino software, while connecting your Arduino board to your computer. As you open the Serial Terminal, the Arduino automatically gets reset. The third way of resetting Arduino is by pressing the push button. When you press and release the push button, Arduino gets reset. You should also have a look at How to get Hex File from Arduino.
So till now we have seen three ways of resetting Arduino but you have noticed that all of these methods are manual, you have to manually push the button or to open the Serial Terminal or to upload the code. Now in some projects, we have to reset Arduino Programmatically, like we don't do anything and it just reset itself automatically. Now how can we do that, that's the topic of today's tutorial. So, I am gonna share two methods today using which we are gonna reset Arduino programmatically. So, let's start with them.
Where To Buy? |
---|
No. | Components | Distributor | Link To Buy |
1 | Jumper Wires | Amazon | Buy Now |
2 | Arduino Uno | Amazon | Buy Now |
Reset Arduino Programmatically using RESET Pin
- In the first method, we are going to reset Arduino Programmatically using the RESET Pin available on the Arduino board.
Note:
- If you haven't bought your Arduino UNO yet, then you can buy it from this reliable source:
- So, first of all, connect Arduino Reset Pin with any of the digital pins as I have connected it with Pin#4 shown in the below figure:
- Now upload the below code to your Arduino board:
int Reset = 4;
void setup() {
digitalWrite(Reset, HIGH);
delay(200);
pinMode(Reset, OUTPUT);
Serial.begin(9600);
Serial.println("How to Reset Arduino Programmatically");
Serial.println("www.TheEngineeringProjects.com");
delay(200);
}
void loop()
{
Serial.println("A");
delay(1000);
Serial.println("B");
delay(1000);
Serial.println("Now we are Resetting Arduino Programmatically");
Serial.println();
delay(1000);
digitalWrite(Reset, LOW);
Serial.println("Arduino will never reach there.");
}
- Once you have uploaded the code then and open your Arduino Serial Monitor and you will get something as shown in the below figure:
- As you can see in the above figure, our Arduino is not displaying the line "Arduino will never reach there" and got reset and then display from start. So that's how it's going to work.
- Now let's have a look at the second method of How to Reset Arduino Programmatically.
Reset Arduino Programmatically using reset Function
- In this method, we are not going to use any hardware pin, instead, we will do everything in programming.
- So, if you don't know much about Arduino Programming then you should have a look at Getting Started with Arduino Programming.
- Arduino has a built-in function named as resetFunc() which we need to declare at address 0 and when we execute this function Arduino gets reset automatically.
- So, no need of doing anything in hardware and simply upload the below code to your Arduino board.
void(* resetFunc) (void) = 0;
void setup() {
Serial.begin(9600);
Serial.println("How to Reset Arduino Programmatically");
Serial.println("www.TheEngineeringProjects.com");
delay(200);
}
void loop()
{
Serial.println("A");
delay(1000);
Serial.println("B");
delay(1000);
Serial.println("Now we are Resetting Arduino Programmatically");
Serial.println();
delay(1000);
resetFunc();
Serial.println("Arrduino will never reach there.");
}
- Now open your Arduino Serial Terminal and you will get the same output as we get in the first method and shown below:
- In the code you have seen that we defined the function resetFunc() and then where we call that function, our Arduino gets reset at that point.
It was quite a simple tutorial, but if you have any problems then ask in the comments and I will try to resolve them. So that's all for today and will meet in the next tutorial. Till then take care !!! :)
How to Upload Bootloader in Atmega328
Hello friends,hope you are fine and enjoying your lives. In today's tutorial, we will know How to Upload Bootloader in Atmega328 using Arduino UNO, which is quite simple and easy and a basic level tutorial. We all know that, Arduino UNO uses Atmega328 as a microcontroller and have you ever thought of using ATmega328 alone instead of using complete Arduino UNO. If you haven't thought yet then think now :) Yes we can use Atmega328 alone instead of using it as a whole with Arduino board. But that's not the topic of today's tutorial and I am gonna cover it soon that How can we use Atmega328 alone.
So now the questions arises that what we are gonna do with the rest of the Arduino board? As we have taken the Atmega328 out of it now there's no use of rest of the board. That's not quite right, we can buy another Atmega328 and can use it in this Arduino board. Now when you insert the new ATmega328 microcontroller in your Arduino UNO board then you will see that its not working? :( But no need to get sad because when it comes to technology then there's solution for everything. :)
Actually Arduino uses a bootloader installed on its Atmega328. It's kind of a driver for Atmega328 microcontroller, which makes it compatible with Arduino software. Normally in order to write code for Atmega328 we use AVR compiler but here because of this bootloader, we can quite easily upload the code into it simply from Arduino software. So, when you bought a new ATmega328 microcontroller then there's a need to upload bootloader in Atmega328. After installing the bootloader in Atmega328, now its ready to be plugged in Arduino UNO board and to be programmed. You should also have a look at How to get Hex File from Arduino. So, today we are gonna see How to upload Bootloader in ATmega328, let's start it.
How to Upload Bootloader in Atmega328 ???
- There are many ways to upload bootloader in ATmega328 and I am gonna share the easiest of them, which is using two Arduino UNO boards.
- So, now I suppose that you have two Arduino UNO boards and some jumper wires with you.
Note:
- If you haven't bought your Arduino UNO yet, then you can buy it from this reliable source:
- One of the Arduino board will be used as a programmer and it will upload the boatloader into second Arduino, while the second Arduino will be having the new ATmega328 microcontroller in which you wanna upload bootloader.
- So, first of all, what you need to do is to connect these two Arduino UNO boards as shown in the below figure:
- Now, in the above figure, Arduino B is acting as a programmer while Arduino A has the new ATmega328 Microcontroller in which we are gonna upload the bootloader.
- Now connect Arduino B with your computer via USB cable and both the Arduino boards will turn ON as we have connected their 5V and GND pins.
- Now open your Arduino software, and click on File menu and then Examples.
- In Examples, open ArduinoISP as shown in below figure:
- Now upload this ArduinoISP example in Arduino B board in first figure, which is acting as a programmer.
- Now Arduino B board is ready to upload the bootloader in Arduino A board.
- Now select the Arduino A board from Tools>Boards but I am not gonna do that as in our case we are using Arduino UNO for both programmer and the one getting programmed.
- Now click on Tools and then Programmer and select Arduino as ISP from the options as shown in below figure:
- Now we have done all the settings and finally we are ready to Upload Bootloader in ATmega328, so now click on Tools and then click on Burn Bootloader as shown in below figure:
- When you click on this Burn Bootloader, TX / RX leds on both the Arduino UNO boards are gonna blibk for around 30 seconds and when they are done then you will see a message on your Arduino software that Bootloader uploaded, which means you have successfully uploaded the bootloader in your ATmega328 microcontroller and now you can upload the code into it.
Note:
- After uploading the bootloader, go to Tools and the Programmer and change it back to AVRISP, otherwise you won't be able to upload the code in your Arduino UNO.
- You should also download this Arduino Library for Proteus, it will enable you to simulate your Arduino in Proteus software.
That's all for today. you should also have a look at these
Arduino Projects for Beginners. I think today's tutorial was not that difficult and if you have little knowledge of Arduino then you can quite easily do it, but if still having problems then ask in comments and I will solve them.
Arduino UNO PCB Design for Proteus ARES
Hello friends, hope you all are fine and having fun with your lives. Today's post, as the name suggests, is about Arduino UNO PCB Design in Proteus ARES. I have already posted Arduino Library for Proteus on my blog using which one can quite easily run Arduino simulation in Proteus.but what if you wanna do the Arduino UNO PCB design in Proteus, then you are lucky that you are reading this post. :)
In one of my projects, I have to design the PCB for Arduino in Proteus so I thought to also post it here so that others can download it as well. Normally PCB design is not required for Arduino and I usually get Atmega328 out of Arduino and use it separately but sometimes, depending on the requirements of your project, you may also need to place Arduino itself on the PCB so in such cases Arduino UNO PCB Design is required. Using this design you can place the Arduino on the PCB in upside down direction and then can take pins out and can use them as you want them to use. You should also have a look at How to do PCB Designing in Proteus ARES.
Let me give you a little introduction about Proteus ARES as I haven't posted much tutorials on it. When you install Proteus software in your computer then you get two exe files one is named as Proteus ISIS while the other one is named as Proteus ARES. If you need to test some electronic circuit i.e. need to design the simulation then you use Proteus ISIS and when you need to design the PCB design then its done in Proteus ARES. As here we are talking about the Arduino UNO PCB design so that's why we are using Proteus ARES. Here's the list of Top 10 PCB Design software. So, let's get started with it.
Arduino UNO PCB Design for Proteus ARES
- First of all, download this Arduino UNO PCB design, which I have designed in Proteus ARES.
Download Proteus ARES Design
- Once downloaded, then open the file and unrar it on your desktop.
- Now double click the file to open it, make sure you already installed the Proteus software.
- When you open it, it will look something as shown in below figure:
- Now select the whole PCB design, right click it and select Make package as shown in below figure:
- When you click on Make Package, a new pop up window will open up, as shown in below figure:
- Now in the New Package Name, you can give any name to it, as I have given Arduino Shield to it and can select any Package Category.
- After selecting these options, hit the OK button and this Arduino UNO PCB design will save in your Proteus ARES library as the name you gave it. Like mine is saved as Arduino shield.
- Now whenever you wanna use it, you simply need to search for it and it will come up.
- You can also attach it to your Arduino package in Proteus ISIS so that you simple design the circuit in Proteus ISIS and then design the PCB in Proteus ARES.
That's all for today, hope you got some knowledge out of it. It was quite easy but having any problems, ask in comments and I will help you out. Will see you guys in next tutorial. Till then take care :)
How to get Hex File from Arduino
Hello friends, hope you all are fine and having fun with your lives. In today's post, I am gonna share How to get Hex File from Arduino. It's quite a simple post and I have already explained it many times in my posts but still, I am getting a lot of messages regarding it that's why I thought to write a separate post for it. First of all, let's have a little introduction about it. If you have worked on PIC Microcontrollers or Atmel etc then you have seen that you always get hex files from their compilers and then you burn that hex file in the respective Microcontroller using their programmer or burner. But that's not the case with Arduino. In Arduino boards, you simply plug it with your computer and you hit the Upload button and the code automatically gets upload in Arduino boards. It doesn't create any hex file. You should also have a look at Arduino Library for Proteus in which you can upload this hex file.
So, now the question arises that why do we need the hex file in the first place, when we can upload the code without it? The answer to this question is, there are many cases when a hex file is required. For example, instead of using the Arduino board you just want to use the ATmega328 or Attiny microcontroller then the easiest way is to write the code in Arduino and then get its hex file and upload it in your microcontroller, which makes the task quite easy. Another example is Proteus simulation, when you want to simulate your Arduino board in Proteus software then you need to get the hex file so that you can upload it to your Arduino board. Another case is freelancing, when you are working on some project as a freelancer, then there are many cases when you don't wanna send your code to the client, instead you want to send the hex file to him so that he can test and verify the code, in such cases it also required. So let's get started with how to get hex file from Arduino.
- Here's the video in which I have shown How to get the hex file from Arduino, I hope it will help:
Where To Buy? |
---|
No. | Components | Distributor | Link To Buy |
1 | Arduino Uno | Amazon | Buy Now |
How to Get Hex File from Arduino ???
- First of all, open your Arduino software and write your code and test it.
Note:
- If you haven't bought your Arduino UNO yet, then you can buy it from this reliable source:
- Once you are confirmed that your code is ready and you want to generate the hex file, then click on the File option in the above menu and then Preferences as shown in below figure:
- In the above figure, I have used the simple blink example and I am gonna generate its hex file.
- Now when you click on the Preferences, a new window will pop up.
- In this new window, tick the compilation option as shown in the below figure:
- After ticking it, now click on the OK button and this dialog box will close.
Note:
- By ticking this option you are allowing the Arduino software to show verbose outputs in the output panel present at the end of Arduino software, which has a black background.
- So, you can also tick the upload option but then you need to upload the code to get these output commands.
- Now hit the compile button as we tick the compilation option, so it will compile the code and will give you all the commands as shown below:
- Now you can see clearly in the above figure that there are many commands in the black portion, these are the verbose outputs that Arduino is giving us.
- The last line of these verbose outputs, which I have also highlighted is the link to hex file, which in our case is:
C:UserszainAppDataLocalTempbuild7243111610766241365.tmp/Blink.cpp.hex
- Now, remove the name of the hex file from this link and it will become:
C:UserszainAppDataLocalTempbuild7243111610766241365.tmp
- Paste this link in the computer address bar and this folder will open up.
- In that folder search for your respective file and you easily get the hex file of your code.
Note:
- Actually, while uploading the code to Arduino boards, Arduino software creates the hex file of the code in the temporary folder and once the code is uploaded then it deletes that hex file.
- That's why, we don't get the hex file, but by clicking the option you can easily get the hex file and then can use it for any purpose.
That's all for today, and I think it was quite an easy tutorial but still if you having questions then ask in the comments and I will resolve them. till next tutorial, take care!!! :)
Intelligent Energy Saving System
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a complete project with you guys. Its an Intelligent Energy Saving System which I designed around two years ago. So, today I thought to share it so that others could also get benefit. In this project, I have used Arduino UNO board for programming purposes. Its not much complicated project but is the basic for many complex projects.
Energy, is a small word, but is the problem of whole world. Particularly when we are talking about electrical energy. IF you consume more electrical energy then you will get quite huge bill at the end of the month. :P So, there's always work done on reducing the consumption of electrical energy and also we compare energy costs from different providers. As a human, suppose you turn ON your room fan, then normally you forget to turn it OFF and thus your bill keeps on increasing. So in order to avoid this, automation is the only tool which comes in handy. Like there must be such system which automatically detects whether someone is still in the room or not and if there's no one then lights got OFF automatically. In this way, you can quite easily reduce your electricity cost. This same concept is presented in this project, let's have a complete look over it. :)
Overview of Intelligent Energy Saving System
- In this project, we have designed a complete room and used two inductive loads i.e. bulbs and one fan.
- Now the purpose of this project was to save the energy so we used two IR sensors for counting.
- Now, if there's no one present in the room then the loads will automatically turn OFF and when someone will enter in the room then the loads will automatically turn ON.
- Moreover, we have also added a counter functionality in it i.e. the project will also count the number of people present in the room.
- All these parameters will also display on the LCD attached with Arduino.
Components Used
I am mentioning here the components used in designing this project. I am not giving the exact values as you will get them in the circuit diagrams. Here's the list:
- Arduino UNO
- IR Sensors
- 16 x 2 LCD
- 100W Bulbs
- 12V Fan
- 2 Relay Board
- 7805 (IC Regulator)
- LED (Indication)
- Resistance
- Capacitors
Circuit Diagrams of Intelligent Energy Saving System
Suppose you are designing this project then the first thing you are gonna need is the circuit diagrams for the project so here I am gonna show you all the circuit diagrams step by step so let's start:
1: Interfacing of Arduino with LCD
- First thing we are gonna need is the interfacing of Arduino with LCD. LCD used in this project is 16 x 2.
- I have first designed the simulation in Proteus as its always better to design the simulation before going into real hardware.
- Now upload the below code into it, just to test that whether its working fine or not:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
lcd.print("www.TheEngineer");
lcd.setCursor(0,1);
lcd.print("ingProjects.com");
}
void loop() {}
- Now run it and if everything's gone fine then you will get something as shown in below figure:
Note:
2: Circuit diagram of 2 Relay Board
- Next thing we are gonna need is the two relay board. Using these relays we are gonna turn ON or OFF our loads.
- Here's the circuit diagram for 2 relay board.
- As you can see in the above figure, I have used two relay board, where both the relays are controlled bt simple logic operators.
- Now instead of these logic operators, you need to give Arduino Pins here.
- I have made the first relay ON while the second relay is OFF.
- In the above figure, relay outputs are open so you can place anything here as its gonna act as switch. So, in our case the loads will be placed after this relay.
3: Circuit Design of Buzzer
- Next circuit design which we need to understand is the buzzer circuit design.
- Its quite simple and similar to 2 relay board. I have also published a detailed post on How to Design a Buzzer in Proteus ISIS, which will be quite helpful.
- Here' I am gonna explain it lightly, so let's have a look at the circuit diagram of buzzer:
- You can quite easily understand the above figure, where I have shown both the ON and OFF states of buzzer.
4: Circuit Diagram of IR Sensor:
- In this project, I have used two IR sensors, both are placed on the door one after another. You can read more about the designing of IR Sensor on my post Circuit Diagram of IR Sensor using 555 Timer.
- I have named them Entering IR Sensor and Leaving IR Sensor.
- The logic behind these two sensors is that, when someone enters in the room then he will first pass the Entering IR Sensor and then will hit the Leaving IR Sensor and if someone is leaving the room then he will first pass the Leaving IR Sensor and then will cut the Entering.
- So, in this way I am counting the persons if someone entering in the room I simply increment and if someone's leaving then I decrement.
- Now, if number of people in the room becomes zero then I turn OFF all the lights and the fan, and if there even one person in the room then I turn ON the lights and fan.
- Here's the circuit diagram of IR Sensor:
- IR transmitter and Receiver are not available in Proteus so that's why I have used the button so when you press the button, its like someone cut the beam of IR sensor, and you will get below result:
5: Complete Circuit Diagram of Intelligent Energy Saving System
- Now that we have designed the individual circuit diagrams, next thing we are gonna do is the assembly of complete project.
- So, here's the complete circuit diagram of this project:
- As you can see in the above figure, I have used two IR Sensors. The first IR Sensor is for entering in the room while the IR sensor is for leaving the room.
- Next is the buzzer circuit which is also quite simple and I have explain in detail above.
- LCD will display the no of people in a room and will also display either the bulb is ON or OFF, and also about Fan status.
- I haven't shown the relay circuit in above figure as it will not fit in the space and I think you guys can place it easily.
Programming Code for Intelligent Energy Saving System
- The code designed for this project is developed in Arduino software.
- Code is as follows:
#include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
float celsius, fahrenheit;
int Sensor1 = A0;
int Sensor2 = A1;
int Bulb = A5;
int Fan = A4;
int Buzzer = A3;
int Counter = 0;
int Sen1Check = 0;
int Sen2Check = 0;
void setup(void)
{
Serial.begin(9600);
digitalWrite(Bulb, HIGH);
digitalWrite(Fan, HIGH);
digitalWrite(Buzzer, HIGH);
pinMode(Sensor1, INPUT);
pinMode(Sensor2, INPUT);
pinMode(Bulb, OUTPUT);
pinMode(Fan, OUTPUT);
pinMode(Buzzer, OUTPUT);
lcd.begin(20, 4);
lcd.setCursor(0, 1);
lcd.print("Temp = ");
lcd.setCursor(0, 0);
lcd.print("Counter = ");
lcd.setCursor(12, 0);
lcd.print("Persons");
}
void loop()
{
CheckEntry();
CheckLeaving();
lcd.setCursor(7, 1);
sensors.requestTemperatures();
lcd.println(sensors.getTempCByIndex(0));
lcd.setCursor(12, 1);
lcd.print(" degC");
lcd.setCursor(10, 0);
if(Counter >= 0){lcd.print(Counter);}
if(Counter < 0){Counter = 0;}
if(Counter > 0)
{
digitalWrite(Bulb, LOW);
digitalWrite(Fan, LOW);
digitalWrite(Buzzer, HIGH);
lcd.setCursor(0, 2);
lcd.print("Fan : ON ");
lcd.setCursor(0, 3);
lcd.print("Bulb : ON ");
}
if(Counter < 1)
{
digitalWrite(Bulb, HIGH);
digitalWrite(Fan, HIGH);
digitalWrite(Buzzer, HIGH);
lcd.setCursor(0, 2);
lcd.print("Fan : OFF");
lcd.setCursor(0, 3);
lcd.print("Bulb : OFF");
}
}
void CheckEntry()
{
if(((digitalRead(Sensor1) == LOW) || (Sen1Check == 1)) && (Sen2Check == 0))
{
while(digitalRead(Sensor1) == LOW);
Sen1Check = 1;
if(digitalRead(Sensor2) == LOW)
{
Counter++;
Sen1Check = 0;
while(digitalRead(Sensor2) == LOW);
}
}
}
void CheckLeaving()
{
if(((digitalRead(Sensor2) == LOW) || (Sen2Check == 1)) && (Sen1Check == 0))
{
while(digitalRead(Sensor2) == LOW);
Sen2Check = 1;
if(digitalRead(Sensor1) == LOW)
{
Counter = Counter - 1;
Sen2Check = 0;
while(digitalRead(Sensor1) == LOW);
}
}
}
- Coding isn't much difficult for this project, but still if you get into some trouble ask in comments and I will check it out.
- Here's the complete video for this Intelligent Energy Saving System, which will explain all about the project.
That's all for today. I hope I have helped you guys in some way. Till next tutorial, take care ALLAH HAFIZ :)
NRF24L01+ with Arduino - Response Timed Out
Hello friends, hope you all are fine and having fun with your lives. Today I am going to share a problem and also its solution with you guys. A few days ago, I bought new NRF24L01 modules as they were needed for a project. So, today when I started working on them, I encountered a very strange problem. When I interfaced my NRF24L01 with Arduino and uploaded the transmitting and receving codes in them, I couldn't get anything on my serial terminal as I explained in my previous post Interfacing of NRF24L01 with Arduino. That was quite strange for me as I have worked on this module many times and it never troubled me before. So I keep on working on it but no luck. I even changed my RF modules as I thought may be they are faulty modules but still no luck. :(
So, the next thing came to my mind is to upload the Getting Started example from the RF24 library which I have also given in my previous post Interfacing of NRF24L01 with Arduino, and now when I checked the serial terminal, I got this error:
- Failed, response timed out.
The screenshot of this response is as follows:
As you can see in the above figure, in the last lines we are getting error that "Now sending 4679...failed. Failed, response timed out." So, that was the problem which I encountered almost for half an hour and then I finally realized what I am missing and how to solve it. Before going to the solution, let me first tell you the types of this modules.
Types of NRF24L01 Module
- When I encountered this problem, and instead of lot of efforts and not being able to resolve it, I finally thought of using the old module, so I searched for it and luckily I found one of them.
- So, now I plugged this new module with another Arduino and I checked the properties of both these modules (i.e. the old one and the new one) and for that I simple uploaded the below sketch in both of my Arduino boards and opened the serial terminal.
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(9,10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
typedef enum { role_ping_out = 1, role_pong_back } role_e;
const char* role_friendly_name[] = { "invalid", "Ping out", "Pong back"};
role_e role = role_pong_back;
void setup(void)
{
Serial.begin(57600);
printf_begin();
radio.begin();
radio.setRetries(15,15);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
radio.printDetails();
}
void loop(void)
{
}
- In this sketch, I simple print the details of NR24L01 module, so I uploaded the above sketch in both the Arduinos, one with old NRF24L01 module and the one with new NRF24L01 module, and I got the below response.
- Now I got the reason that why I am not getting the response for the same code, which worked on the old one, because the old module model was NRF24L01 while this new module is NRF24L01+ which is slightly different from NRF24L01.
- So that's the reson why I was constantly getting the Failed, response timed out error for this module. So, now lets have a look on how to resolve this issue.
How to resolve "Failed, response timed out" for NRF 24L01+ with Arduino
- So, now one thing I knew that my module is NRF24L01+ and not NRF24L01 so I need to interface NRF24L01+ with Arduino. :)
- So, I started looking online and get its datasheet which helped a lot and finally I got the thing.
- NRF24L01+ draws more current than NRF24L01 while starting up and Arduino couldn't provide that required current to it. That's the reason NRF24L01+ failed to initialize and couldn't send or receive the response.
- So, in order to remove this issue, I simply placed a Capacitor of 100uF between 3.3V and GND of Arduino and it did the magic. :)
- Detailed circuit diagram is as follows:
- So, that's the simple solution which kept me on for around an hour and then I finally got it.
- As you can see in above figure, its exactly the same circuit diagram and the only addition is the capacitor placed between 3.3V and the GND.
- After that I uploaded both the codes for receiver and transmitter which I have already posted in my old post Interfacing of NRF24L01 with Arduino and it worked like charm. :)
That's all for today, will meet you guys in the next tutorial soon. Take care!!! :)
Interfacing of LM35 with Arduino in Proteus ISIS
Hello friends, I hope you all are fine and enjoying yourself. Today I am going to share a new project titled Interfacing of temperature sensor LM35 with Arduino UNO in Proteus ISIS. So far, I have only worked on temperature sensor DS18B20 for temperature measurements and I have also uploaded a tutorial on Interfacing of Temperature Sensor 18B20 with Arduino.
Recently I got a chance to work on a project regarding temperature sensing but the condition of this project was that to use only LM35 for temperature detection. Then, I get to know much about LM35, its operating conditions and features. So I thought I should also upload its tutorial as it will also be advantageous for engineering students. Because learning new things is always a charm.
An excellent thing about LM35 is that it's quite cheap as compared to other temperature sensors. And as it's cheap, that's why it's not very reliable, if you personally ask me then I will prefer DS18B20 over LM35 because of its accurate readings. Now, let's move towards its interfacing and its practical applications. First of all, let's have a quick look at the introduction of LM35 and then we will design it in Proteus ISIS.
Where To Buy? |
---|
No. | Components | Distributor | Link To Buy |
1 | LM35 | Amazon | Buy Now |
2 | Arduino Uno | Amazon | Buy Now |
Introduction of LM35 Temperature Sensor
- LM35 is an embedded sensor, used to measure the temperature of its surroundings and is famous because of its low cost.
- Its output is generated in the form of an Electrical signal and this electrical signal is proportional to the temperature, which it detects.
- Lm35 is much more sensitive than other temp measuring devices (not accurate).
- The internal circuitry of this embedded sensor is sealed inside a capsule.
- LM35 is a 3 pin IC and it is used for temperature detection. The physical appearance of LM35 is shown in the image given below:
- As you can see in the above image that LM35 is a 3 pin IC:
- The first pin is Vcc, so it should be connected to 5V.
- The center pin is its Data Pin and LM35 gives its output when it measures temperature.
- The third pin is GND and should be connected to the ground of the battery/source.
LM35 Arduino Interfacing
- As my today's tutorial is about interfacing LM35 with Arduino so let's start it.
- I have connected LM35 with Arduino microcontroller and it is shown in the image given below:
- As you can see in the above image, I have connected an LM35 sensor with Arduino UNO.
- The VCC pin of LM35 is connected to +5V of the Arduino board.
- Since LM35 generates an analog value at its output pin that's why I have connected this pin to the 'A0' pin of the Arduino board.
- This pin of Arduino board is used to receive analog data from an external source.
- And the last pin is connected to the GND pin of the Arduino board.
Arduino Code for LM35
- After connecting the circuit, now upload the below code to your Arduino board.
#define TempPin A0
int TempValue;
void setup()
{
Serial.begin(9600); // Initializing Serial Port
}
void loop()
{
TempValue = analogRead(TempPin); // Getting LM35 value and saving it in variable
float TempCel = ( TempValue/1024.0)*500; // Getting the celsius value from 10 bit analog value
float TempFarh = (TempCel*9)/5 + 32; // Converting Celsius into Fahrenhiet
Serial.print("TEMPRATURE in Celsius = "); //Displaying temperature in Celsius
Serial.print(TempCel);
Serial.print("*C");
Serial.print(" | ");
Serial.print("TEMPRATURE = "); // Displaying Temperature in Fahrenheit
Serial.print(TempFarh);
Serial.print("*F");
Serial.println();
delay(1000);
}
LM35 Arduino Simulation in Proteus ISIS
- Now let's do this project in Proteus. Proteus also has an LM35 sensor in its database which we are going to use here.
- Moreover, we also know about Arduino Library for Proteus V2.0, so using that library we are going to interface LM35 with Arduino in Proteus ISIS.
- First of all, design the same circuit as shown in the above figure in Proteus software as shown below:
- It's the same circuit as we designed before, the only addition is the virtual terminal. We are using it to check the values.
- It's simply like the Serial Monitor we use in Arduino software.
- So, now using the above code, create the hex file and upload it in Proteus.
- Now hit run and if everything goes fine then you will get results as shown in the below figure:
- You can see the Virtual Terminal is showing the same value as shown on the sensor which is 33 in Celsius and later I converted it to Fahrenheit.
It's quite simple and I have also commented on the code but still if you find trouble then ask in comments and I will resolve them. Will meet in the next tutorial, till then take care!!! :)