XBee Library for Proteus
Hello everyone, today I am going to share a new XBee Library for Proteus. I am quite excited while sharing it as we are the first developer for this XBee Library. Now you can quite easily use XBee module in your Proteus software using this XBee Library for Proteus.Wehave spent quite a lot of time in developing this and that's the reason I couldn't share new tutorials in the past few days. Anyways we are done with this new exciting XBee Library for Proteus, hope you are gonna enjoy this one. I have already sharede two libraried for Proteus which are Arduino Library for Proteus and GPS Library for Proteus. You can also interface this XBee module with Microcontrollers like Arduino, PIC Microcontroller and 8051 Microcontroller quite easily.
As its the first version of our XBee Library for Proteus so its not quite perfect and can't do the complex tasks such as analog inputs etc. It will just do the serial communication. This xbee module has two pins TX and RX and you can do your communication with it quite easily. We have designed this XBee Library for Proteus, after quite a lot of effort and we are quite proud that we are presenting it first time for Proteus. Other bloggers are welcome to share this library on their blogs to share the knowledge but do mention our blog post link in your post. :) You should also have a look at XBee Arduino Interfacing. So, let's get started with it.
XBee Library for Proteus
- First of all, download this XBee Library for Proteus by clicking on the below button:
XBee Library for Proteus
- Now once you click it you will get a zip file to download so download this zip and open it.
- In this zip file you will get two files named as:
- So, now place these two files in the libraries folder of your Proteus software.
Note:
- Now, start your Proteus ISIS software or restart it if its already running.
- Go to your components library and search for XBee Module as shown in below figure:
- Now place it in your workspace and it will look something as shown in below figure:
- If you don't know much about xbee module then you should also have a look at Introduction to XBee Module.
- As you can see in the above figure, its our xbee module in Proteus for the first time.
- As, I mentioned earlier, its a first version of xbee module so its not very advanced and it will do just the basic serial communication i.e. sending and receiving data.
- It has two pins on it which are TX and RX and using these two pins you can send and receive data quite easily.
- So, let's design a simple example and we will see How to do the Serial communication using this new XBee library for Proteus.
- Design a simple circuit as shown in below figure:
- Now what I did is, I simply place a Virtual terminal with both of these xbee modules.
- Now we need to change the Properties of one of these XBee module so double click on any one of these and you will get the below window:
- You should also have a look at Interfacing of XBee with Computer.
- Now, I have simply changed the Physical Port of this module to COM2 while the other module is at COM1.
- So, now one of my XBee module is at COM1 while the second module is at COM2.
- Now when I run my simulation then both XBee will start sending and receiving data on their respective COM Ports.
- So, what I need to do is to virtually combine these two ports and for that I have used a software named as Virtual Software Driver from Eltima and I combine these two ports.
- Now, run your simulation and whatever you type in the Virtual Terminal of first xbee will appear in the virtual terminal of second xbee. as shown in below figure:
- You can also interface this XBee modue with other microcontrollers like Arduino, PIC Microcontrollers or 8051 Microcontrollers etc.
- I have explained this whole tutorial in below video as well.
I hope you have enjoyed it and are gonna like it. Let me know if you got into any trouble and have problems in using this library. Also share your suggestions about improvement in this
XBee Library for Proteus. :)
GPS Library for Proteus
Hello friends, hope you all are fine and having fun with your lives. In today's tutorial, I am gonna share another awesome library designed by our team for Proteus, which is GPS Library for Proteus. It's my second library for Proteus, the first one was Arduino Library for Proteus which I have already shared. I am really enjoying designing these modules in Proteus because its a new and quite challenging thing. I haven't found even a single website who has designed these modules in Proteus already. So, now for the first time, you can have the GPS Library for Proteus using which you can easily simulate your GPS module in Proteus and can design your code for Arduino, PIC Microcontroller or 8051 Microcontroller.
Other bloggers are welcome to share this library and its my humble request that do mention our blog in credits. :) The GPS module, I have designed for Proteus is a simple GPS which has TX and RX pins and when you start the simulation, this module starts sending the NMEA data on its TX pin, which you can easily check using Virtual Terminal. I am gonna show you how to check it in today's post. Another important thing, obviously in Proteus Simulation we can't get the actual values of longitude,latitude etc, so in our model, I have used the dummy values for all these data. The benefit of this module is that you can easily design your code for GPS and can test it in your simulation. Plus, its design is cool as well. ;)
Note:
GPS Library for Proteus
- First of all, click on the below button and download GPS Library for Proteus.
GPS Library for Proteus
- After downloading, you will get a zip file containing three files in it.
- Now extract all these three files named as:
- GpsTEP.LIB
- GpsTEP.IDX
- GpsTEP.HEX
- Place these files in Libraries folder of your Proteus software.
Note:
- Now open your Proteus software, if you have already opened it then restart your Proteus software.
- Now in components list search for GPS Module and place it in your workspace.
- If everything's fine then you will get your module as shown in below figure:
- As you can see in the above figure, it has two pins in total which are TX and RX.
- Now double click this GPS module and you will get to its properties as shown in below figure:
- Now, one last thing you need to do is to upload the GpsTEP.HEX file, which you got in the downloaded zip file, in the Program File section.
- This GpsTEP.HEX file is essential for this model as its adding the functionality of GPS in this model.
- So, after adding the link of GpsTEP.HEX file in the Program File section, now your Gps module is ready to use in your circuit.
- So, now let's add a Virtual terminal and check the output of this GPS Module. If you haven't worked on Virtual Terminal before then you should read How to use Virtual Terminal in Proteus ISIS.
- Design a small circuit as shown in below figure:
Note:
- The baud rate of this GPS Module is 9600.
- The data sent by this GPS module is dummy as we can't get these values in simulation.
- Now let's run the simulation and check the Virtual Terminal and if everything goes fine then you will get results as shown in below figure:
- The first line is just the intro for this module and after that you will start receiving data which is in NMEA format.
- NMEA data will remain constant but will keep on coming.
- Now, instead of using this Virtual Terminal, you can use any microcontroller here like Arduino, PIC Microcontroller or 8051 Microcontroller etc. and can write your code easily and test it.
- In my coming tutorials, I am gonna share examples for this GPS module in which I will interface it with different Microcontroller.
- In the below video, I have explained this tutorial again so if you got any trouble then watch it as well.
That's all for today. You should also have a look at
Interfacing of GPS Module with Arduino in Proteus ISIS. I hope you guys have enjoyed today's post and are gonna get benefit from it. Let me know your views about today's tutorial and also give your suggestions and help us in making this GPS Library for Proteus more smarter. :)
Scrolling Text on LED Matrix 8x8 using Arduino
Buy This Simulation
Hello friends, Hope you all are fine and having fun with your lives. In today's post, I am going to show How to display a Scrolling Text on LED Matrix 8x8 using Arduino in Proteus ISIS. We all know about LED Matrix but if you don't know then google it. :P LED Matrix is used to display long messages, the best thing about LED Matrix is you can combine then in serial way and can make it of any size you want. Like in this post I have combined 8 LED matrices and then displayed my message on them. I have given all the details here but as you can see we have done a great effort in designing this simulation so I haven't posted it free but have placed a very small amount of $20 on it and you can buy it quite easily from our shop by clicking the above button.
I have used Proteus software for the simulation purposes and have use Arduino board as a microcontroller. We know that Proteus doesn't support Arduino but we have a library for it. So, first of all, read Arduino library for Proteus so that you can easily add the Arduino board in your Proteus software and then must also read How to get Hex file from Arduino which we will be uploading in our Proteus software. Its quite easy and you will get it don't in the first attempt. Anyways let's get started with Scrolling Text on LED Matrix 8x8 using Arduino in Proteus ISIS.
Hardware Design of LED Matrix 8x8 using Arduino in Proteus ISIS
- First of all let's have a look on the hardware design of LED Matrix 8x8 using Arduino in Proteus ISIS, which is shown in below figure:
- So, if you have a closer look on it by clicking it then you can see I have used 8 LED matrices and have used MAX7219.
- MAX7219 is a shift register which is of real importance here, it takes data serially in and parallel out.
- It is also known by the name serial in parallel out shift register. We send data to it using single pin which is the data pin and this data is edge triggered by the clock pulse.
- So when our clock pulse goes from low to high the data is sent to the shift register.
- We have connected these shift registers in a row as you can see in above figure, the first register is connected to second register via Dout pin.
- So suppose I have connected two shift register then in this case now I am sending data to two shift register and my output will be of total 16 bits.
- So, in this way we can add as many shift registers as we want and here I have added total 8 shift registers so my output is total of 64 bits and I am controlling these 64 bits via single pin of Arduino which is data pin of course.
- Clock Pin and Load Pin are also used here which are used to send the data and then load it in sequence so in short using just 3 pins of Arduino I can control any number of shift register.
- Now, each shift register is controlling each LED Matrix 8x8 and the reason I am using 8 shift registers is because I am using 8 LED Matrix 8x8.
- It's a bit tricky but quite simple. So, now we have complete overview of this shift register and how it works, now let's move on to our simulation.
Scrolling Text on LED Matrix 8x8 using Arduino in Proteus ISIS
- First of all, download the Arduino library for LED Matrix 8x8 by clicking on the below button.
- Now design a complete circuit as shown in below figure in your Proteus ISIS software:
- Next thing you are gonna need is the code for Arduino board which is posted below, so copy it and paste it in your Arduino software:
#include <MD_MAX72xx.h>
#define MAX_DEVICES 8
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
MD_MAX72XX mx = MD_MAX72XX(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
#define SCROLL_DELAY 200
#define CHAR_SPACING 1
#define BUF_SIZE 75
char curMessage[BUF_SIZE];
char newMessage[BUF_SIZE];
uint8_t scrollDataSource(uint8_t dev, MD_MAX72XX::transformType_t t)
{
static char *p = curMessage;
static uint8_t state = 0;
static uint8_t curLen, showLen;
static uint8_t cBuf[8];
uint8_t colData;
switch(state)
{
case 0:
showLen = mx.getChar(*p++, sizeof(cBuf)/sizeof(cBuf[0]), cBuf);
curLen = 0;
state++;
if (*p == '\0')
{
p = curMessage;
}
case 1:
colData = cBuf[curLen++];
if (curLen == showLen)
{
showLen = CHAR_SPACING;
curLen = 0;
state = 2;
}
break;
case 2:
colData = 0;
curLen++;
if (curLen == showLen)
state = 0;
break;
default:
state = 0;
}
return(colData);
}
void scrollText(void)
{
static uint32_t prevTime = 0;
if (millis()-prevTime >= SCROLL_DELAY)
{
mx.transform(MD_MAX72XX::TSR);
prevTime = millis();
}
}
void setup()
{
mx.begin();
mx.setShiftDataInCallback(scrollDataSource);
mx.control(MD_MAX72XX::INTENSITY, 10);
strcpy(curMessage, "www.TheEngineeringProjects.com");
newMessage[0] = '\0';
}
void loop()
{
scrollText();
}
- Now after uploading the code in Arduino software, get the Hex file for Arduino and upload it in your Arduino board in Proteus ISIS.
- Now when you upload it to your Arduino board and run your simulation you will get something as shown in below figure:
- Now let's have a look at How it scrolls, I really have to work hard to make the below figure but it looks cool isn't it. :)
- So, that's how our website link is gonna scroll from right to left and you can scroll any kind of text.
- You can buy the complete simulation along with Arduino code and hex file by clicking on below button.
Buy this Proteus Simulation
That's all for today. I hope you guys get some knowledge out of it. Let's meet in the next tutorial, till then take care!!! :)
Interfacing of Keypad with Arduino
Hello friends, hope you all are fine and having fun with your lives. In today's post we will have a look at How to interface keypad with Arduino in Proteus ISIS. Keypad is used almost in every engineering project. If you even look around you will find keypad in many electronic appliances. For example, a simple ATM machine has a keypad on it using which enter our pin code and give commands to the ATM machine. Similarly, calculator also has keypad on it. So, in short there are numerous applications of keypad. You should also read the Real Life examples of Embedded Systems and you will find Keypad in them as well.
Keypad is used where you need to used numerical buttons or you need to use lots of buttons for sending commands so like in some application I need to use 10 buttons so instead of using separate 10 buttons I would prefer to use keypad instead as it will save a lot of time both in hardware as well as programming. So today we will have a detailed look on How keypad works and How we can Interface keypad with Arduino in Proteus ISIS. Proteus also gives keypad component in its database using which we can easily simulate it in Proteus and can save our time. So first simulate it and then design the hardware. After today's post I will also share an Automatic Lock system project using keypad. Anyways let's get started with Interfacing of Arduino with keypad:
How keypad works ??
- Keypad uses matrix system in order to work.
- For example, I am using a keypad which has 12 buttons on it as shown in below figure:
- Now you can see its a 12 button keypad so it has total 3 columns and 4 rows and similarly there are 7 pins to control these 12 buttons.
- So, the simple formula is total number of pins = Number of Rows + Number of Columns.
- Now if we look at the internal circuitry of this 12 button keypad then it will look something as shown in below figure:
- Columns and rows are connected with each other now suppose I press button "1" on the keypad then first row and the first column will get short and I will get to know that button "1" is pressed.
- Same is the case with other buttons, for example I press button "8" then second column and the third row will get short so this code will remain unique for each button.
- In simple words, on each button press different column and row will get short we need to detect which one gets short in order to get the pressed button.
Quite simple, isn't it ?? You should also have a look at these
Arduino Projects for Beginners. So that's how a keypad works, now let's have a look at How to Interface this keypad with Arduino in Proteus ISIS.
Interfacing of Keypad with Arduino in Proteus ISIS
- So, now we are gonna interface this keypad with Arduino in Proteus ISIS which is as always my favorite simulator.
- In Proteus design a circuit as shown in below figure:
- So, we have an Arduino UNO board along with keypad and LCD.
- So I have done the programming in such way that whenever you press any button on the keypad, it will get displayed on the LCD.
Note:
- Now, copy the below code and paste it in your Arduino software and get the hex file from it.
#include <LiquidCrystal.h>
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[ROWS] = {10, 9, 8, 7}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {13, 12, 11}; //connect to the column pinouts of the keypad
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
lcd.setCursor(0,0);
}
void loop() {
char key = keypad.getKey();
if (key) {
lcd.print(key);
}
}
- Now upload the hex file in your Arduino UNO in Proteus ISIS and hit the RUN button.
- If everything goes fine then you will get something as shown in below figure:
- Now, when you press any button on the keypad it will also appear on the LCD as shown in below figure:
That's all for today. In the coming post I am gonna share a small project in which we will design a automatic locking system using this keypad. So stay tuned and have fun. :)
How to Train Pixy Camera with Computer
In today's post we are gonna have a look at How to Train Pixy Camera with Computer. We have yet posted three tutorials in the Pixy Camera series. In the first tutorial, we have seen How to Get Started with Pixy Camera in which we have studied the basics of Pixy Camera. After that that we have seen the Installation of Pixy Camera Software which is named as PixyMon and in the third tutorial we have covered How to Upload the Latest Firmware in Pixy Camera because its always the best strategy to deal with latest tools. So until now we have configured our Pixy Camera in all possible ways now the next thing is to train our Pixy Camera with Computer using PixyMon software.
Let's first discuss How the Pixy Camera works. Pixy Camera has on board NXP microcontroller which is used for image processing so what we need to do is to let our Pixy Camera remember some objects and whenever this object comes in the range of Pixy camera then it gives output to the microcontroller through SPI protocol. We can use any microcontroller like PIC microcontroller or Arduino etc. We will interface it with Arduino in the coming tutorial but in this tutorial we will have a look at How to train Pixy Camera with Computer using PixyMon. So, let's get started with it.
How to Train Pixy Camera with Computer ???
- First of all, connect your Pixy Camera with Computer using the Mini USB to USB converter cable which we have seen in the first tutorial.
- So, plug the mini USB side with your Pixy Camera and plug the USB in your Computer.
- Now, I suppose that you have already upgraded the Pixy Camera software to latest version.
- After pluging in Pixy Camera now open Pixy Camera software named as PixyMon, and you will start receving the live video for Pixy Camera in your PixMon as shown in below figure:
- So I am getting the live video from my Pixy Camera in PixyMon.
- I have placed a globe in front of the Pixy Camera which we are gonna select now.
- So, now what I am gonna do is to recognize this globe to the Pixy Camera.
- In order to do so click Actions and then Set Signature 1 as shown in below figure:
- Now when you click the Set Signature 1 then video will go static like it stopped and now you need to select a region which you want Pixy Camera to remember as shown in below figure:
- As you have seen in above figure, I have selected the blue region of globe and now this color is saved in Pixy Camera.
- After selecting this region, the video will again start but now whenever this blue color of globe comes in focus of Pixy Camera, it will detect this color as shown in below figure:
- Now you can see it has detected the blue region of globe completely and above it is mentioned s = 1 which means the signature is 1, now suppose you want to save any other color then you can save it in signature 2 or 3.
- But there's some problem in the image that we are also detecting small blue color in other parts of image as well and you can see at the left below corner it also mentioning s = 1.
- So, what we need to do is to refine our parameter so that it only detect the blue globe and ignore the other small objects.
- In order to do so, you have to click File and then Configure and a new Window will pop up which will have the Pixy Parameter range for all the signatures as shown in below figure:
- Now you can see in the above figure the range for Signature 1 is 2.02400 and we have many small blue blocks in the figure, so now let's reduce this range and check its effect on the video.
- Now you can see in above figure that our region got quite clear and now its detecting just the globe and all the other small detected regions are now gone.
So, that's how you train Pixy Camera with Computer using PixyMon. You can set other colors as well in other signatures. That's all for today. In the coming tutorial, we will see How to interface Pixy Camera with Arduino in which we will automatically detecting this blue region with Arduino and will be doing our task further. So, stay tuned and have fun. :)
Upload Latest Firmware in Pixy Camera
[vc_row][vc_column][vc_column_text]
Hello friends, hope you are fine and having fun with your lives. Till now we have seen two tutorials on Pixy Camera module, in the first tutorial we have seen How to Get started with Pixy Camera and after that we have seen How to Install Pixy Camera software which is named as PixyMon. So, now I hope that you have installed the Pixy camera software and have the Pixy Camera module in hand along with USB to Mini USB cable. Because in this tutorial we are gonna plug our Pixy Camera module with moduter and will upload the latest firmware in our Pixy Camera Module, which isn't much difficult and would be a piece of cake if you followed all the instructions carefully.
Pixy Camera comes with some old firmware which is uploaded in it at the time of its manufacturing. But with the passage of tme, the firmware keeps on upgrading and hence in order to make the Pixy Camera module compatible with new software, we have to upgrade the Pixy Camera firmware as well, which we are gonna do in this post.We haven't yet connected our Pixy Camera module with computer so when we plug it with our computer for the first time, it will first install the driver for the usb of pixy Camera board and then we will be able to upload our latest firmware in it. So, before uploading firmware in Pixy Camera first let's have a look at How to install the driver for Pixy Camera module.
How to Install Driver for Pixy Camera ???
- Plug your USB cable in Pixy Camera from USB mini side and plug the USB side into your computer.
- Now when you plug your Pixy camera for the first time, a small pop up will open up in the task bar as shown in below figure:
- And you don't need to do anything and it will get installed automatically. I have tested it on Windows 8 and it works like magic, no problem at all.
- Now once you installed the driver for Pixy Camera, unplug your pixy Camera USB and now we will see how to upload latest firmware in Pixy Camera.
Upload Latest Firmware in Pixy Camera
- So, now I hope you have unplugged your Pixy Camera USB from computer.
- Now download the latest firmware of Pixy Camera by clicking the below button.
- At the time of writing this post, the latest firmware available was 2.0.17 but you can download the latest firmware by clicking here.
- Now I hope you have downloaded the latest firmware for pixy Camera, so now open your PixyMon software and first time it will look something as shown in below figure:
- Now press the white button on your Pixy Camera and plug the USB in your computer while keep pressing the button.
- Once the USB plugged in and USB got detected, then release the button and you will get something like this in your PixyMon.
- As shown in above figure, our Pixy Camera got detected and because we pressed the button so that's why it went in programming state.
- Soon after this a pop up will open up as shown in below figure:
- Now Browse to your downloaded firmware, which in my case is pixy_firmware-2.0.17-general.hex , so I selected this one and press Open.
- It will automatically install the firmware and will restart the Pixy Camera and you will get something like this in your PixyMon.
- That's all, now you will start getting your video from Pixy Camera and you can see in the output pane that it installed the firmware first and then for reset and now ready to use.
Now we have uploaded the Latest Firmware in our Pixy Camera and have also plugged it with our computer and got it working with PixyMon. In the next tutorial, we will see How to train our Pixy Camera using this PixyMon. I am quite tired now so I don't think I am gonna post the next tutorial today, hopefully will post it tomorrow. So, till then take care :))
[/vc_column_text][vc_empty_space height="30px"][/vc_column][/vc_row][vc_row][vc_column width="1/2"][vc_column_text]
<< How to Install Pixy Camera Software [/vc_column_text][/vc_column][vc_column width="1/2"][vc_column_text]
How to Train Pixy Camera with PixyMon >>
[/vc_column_text][/vc_column][/vc_row]
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 !!! :)