Send SMS with PIC Microcontroller & SIM900
Hello friends, in today's post I am gonna show how to send SMS with PIC Microcontroller and SIM900. In my previous posts, we have seen how to Send SMS with Arduino and SIM900D and have also seen how to Receive SMS with Arduino and sim900D, both of them were using Arduino board. So, today I thought to post same project using PIC Microcontroller. The logics I am gonna use are exactly the sameas I did for Arduino but the only thing gonna change is the programming syntax. I am using MikroC Pro for PIC compiler for PIC Microcontroller and PIC18F452 is gonna use here. I have also posted on How to Receive SMS with AT Commands using SIM900 & PIC Microcontroller, so check it out as well if you are planning to work on PIC Microcontroller and SIM900.
There are different GSM modules available in the market but they all work on the same principal. They all are operated via Serial port, also known as UART, and are controlled via AT commands. You need to connect the PIC Microcontroller with GSM module via TX / RX pins and you are ready to start working on it. Today, I am gonna share how to send SMS with PIC Microcontroller and SIM900 and in the next post I will share how to receive SMS with SIM900 on PIC Microcontroller. So, lets start with it.
Send SMS With PIC Microcontroller & SIM900
- Sim900 shield I am gonna use is shown below, but if you don't have this one then no need to panic, simply find the TX and RX pins from your Sim900 shield.
- As you can see above I have mentioned the TX and RX pins, so you are gonna just need these two pins and connect them with PIC Microcontroller. The connections will be:
- RX pin of Sim900 into Pin # 25 (TX) of PIC Microcontroller.
- TX pin of Sim900 into Pin # 26 (RX) of PIC Microcontroller.
- One more thing you will also need the basic circuit of PIC Microcontroller, which is as follows:
- Finally, don't forget to make the GND common for PIC Microcontroller and Sim900, as PIC Microcontroller is working on 5V while the GSM module is working on 12V. There are also GSM modules available which work on 5V or 3.3V. So, whatever the case, just make sure their GND is common with GND of PIC Microcontroller.
- So, now I hope you are done with the connections and ready to start with programming, so open your MikroC Pro for PIC compiler and upload the below code into it.
void Initialization()
{
UART1_Init(9600); // Initialize Serial Port at 9600 baud rate
}
void SendSms()
{
Delay_ms(2000);
UART1_Write_Text("ATE0rn"); // AT command for Echo OFF
Delay_ms(1000);
UART1_Write_Text("ATrn");
Delay_ms(1000);
UART1_Write_Text("AT+CMGF = 1rn");
Delay_ms(1000);
UART1_Write_Text("AT+CNMI=1,2,0,0,0rn");
Delay_ms(1000);
UART1_Write_Text("AT+CMGS="+923326062060"rn");
delay_ms(500);
UART1_Write_text("www.TheEngineeringProjects.com rn");
UART1_Write(26);
}
void main() {
delay_ms(5000);
delay_ms(5000);
Initialization();
SendSms();
do
{
} while(1);
}
- Its quite a simple code, in which I first initialized the serial port at 9600 bad rate and after that I sent AT commands to our SIM900 module, which will then send the SMS.
- In the above code, change the mobile number which I have highlighted and also change the message body, change it with whatever you wanna send. Right now I am sending www.TheEngineeringProjects.com which is my website. :P
- The AT commands description is as follows:
- ATE0: It is used to turn off the Echo of Sim900 module.
- AT: It is used to test the Sim900 module.
- AT+CMGF = 1: This command is converting our Sim900 module to text mode.
- AT+CNMI=1,2,0,0,0: This command is configuring our Sim900 module. Its not compulsary but is better to use, its actual benefit will be in the next tutorial of receving sms.
- AT+CMGS: This is the actual command to send the SMS. It gets number and SMS body and then send the sms.
Note:
- In all AT commands, we need to press Enter in order to send that command to SIM900, that's why I have used rn after every command.
- But for AT+CMGS command, we have to use Cntrl+Z after sending the command and thaat's why I have used UART1_Write(26); where 26 is the ascii code for Cntrl+Z.
That's all for today, hope it will help you in some way. I have also posted on How to Receive SMS with AT Commands using SIM900 & PIC Microcontroller, so check it out as well if you are planning to work on PIC Microcontroller and SIM900. Till then have fun. :)
What is Arduino ?
Hello friends, today I am posting a very basic tutorial on what is Arduino ??? In this tutorial I am gonna explain the basics of Arduino for the beginners. I am writing this tutorial because I got a lot of requests from the engineers in which they ask questions like what is Arduino ? What's the difference between Arduino and PIC? How to use Arduino? etc etc. So I thought of writing this topic. It's a very basic tutorial so if you are already familiar with this board and know the answer of this simple question
What is Arduino ??? then you can skip this tutorial but again you must read it once, may be you get something out of it. :)
I have posted a tutorial on Arduino Projects, in which I gave all the links of Arduino projects and tutorials posted on my blog, that's another reason for posting this tutorial. I am treating that Arduino Projects page as an ebook on Arduino so I am gonna post everything about Arduino as much as I can. And an ebook must have an intro chapter, which will be this one. So, let's get started.
What is Arduino ???
- Arduino is nothing but a simple microcontroller board which is normally used in engineering projects where there's a need to automate something.
- You can interface sensors with this board, can drive motors with this board, can plug switches in it etc.
- In old ages ( not old enough :P ), people used simple switches for turning ON a bulb so like you click the switch and the bulb is ON, it was quite a simple circuit, after that relays are invented and then engineers used 555 timer circuits in order to turn ON lights on some specific time. But the 555 timer circuits are quite big in size, so finally engineers discovered Microcontrollers in which there are simple OUTPUT and INPUT pins, so now if you want to turn on light at some certain time then you just simply plug the blub on output pin of microcontroller and then do some programming and add a timer to automatically turn on the bulb.
- So, the benefit of microcontroller is the circuit is quite simple and small in size.Moreover, its flexible, suppose you want to change the time of turning ON bulb then what you need to do is simply change the coding and it will be changed, but in 555 timer circuits you need to change the components in order to do so.
- Now, we know the use of microcontroller and also their benefit but thing is what is Arduino ??? In microcontrollers like PIC or Atmel, there's a small drawback.
- Suppose you want to work on PIC then you have to first design its basic circuit also need to design a power circuit to supply power to it and after that in order to upload the code in it, you have to buy a programmer/ burner as well. So, first of all you need to write the code for PIC Microcontroller and after that you need to upload code in it using a programmer and then plce PIC microcontroller back into the circuit and test, which is quite lengthy plus also got hectic when you are working on some project because you have to test code again and again.
- By the way, now advance programmers like PICkit2 and PICkit3 can be plugged on board but still you have to design the basic circuit so coming to bottom line, in order to do project with PIC or Atmel microcontroller you have to do soldering etc.
- But that's not the case with Arduino Board, Arduino has built in programmer and the basic circuit in it. So what you need to do is simply plug in Arduino with your computer via usb cable, get its software and start uploading code and also start testing.
- So, you don't need to plug unplug or do anything, simply upload the code and test. Moreover, it also has some very efficient tools using which you can test your output as well quite easily. Arduino board also has the pins on which you can simply plug your devices and can turn them ON or OFF. So, hats off to Arduino team for providing us a simple board which has everything on it.
- Another advantage of Arduino is that, because of its popularity all the electronic components also have the Arduino libraries which are free and using them you can operate that electronic component quite easily with Arduino. Its open source and hence its developing day by day.
Types of Arduino Boards
- There's a long range of Arduino boards available online, the basic Arduino board is named as Arduino UNO which is most widely used in projects.
- Arduino UNO has total 13 digital pins and 6 analog pins which are used for connecting sensors with them.
- Suppose you have a project in which you want to interface 30 sensors, then what you need to do ?? Now you need to buy another Arduino board named as Arduino Mega 2560. This board has around 70 pins on it which can be used as output or input and hence you can plug your sensors quite easily.
- Moreover, Arduino have also developed different shields like Arduino Ethernet shield. Using this shield you can provide internet access via Ethernet to your project.
- Then they have Arduino Wifi shield which is used for providing Wifi access to your project.
- They have also developed Arduino GSM shield for GSM or GPRS purposes, in short there's a wide range of Arduino boards available online.
- So which Arduino board you need to buy depends on the requirements of your project.
How to use Arduino ??
- Now I think you have got the basic idea of what is Arduino ? and why is it so popular ? So now lets have a look at how to use Arduino.
- When you order for your Arduino board, you will get a package similar to the image below:
- Along with this box, you will also have the USB cable, now take your Arduino board out of this box and plug the cable in it, connect the Arduino with your computer and you are ready to start working on it.
- In order to connect Arduino with your computer you have to install the Arduino drivers in Windows.
That's all for today, hope I have conveyed some knowledge and you now know the basics of Arduino i.e. what is Arduino ? and why to use Arduino.
Arduino Projects
Hello friends, I hope you all are fine and having fun with your lives.Today I am not gonna post a new topic or tutorial, instead I am going to arrange all my
Arduino Projects and tutorials in this post, as its better to have all of them in one place. I recently posted a
PIC Microcontroller Projects post and it was highly appreciated by the followers so I thought to do the same with Arduino as well because I have posted more Arduino projects as compared to PIC Microcontroller.
I will post all the Arduino Projects & Tutorials links below in sequence i.e. from easy to pro level so if you are a new user and want to get command over Arduino projects then read all of them one by one. Moreover, I will also keep on updating this post whenever I am gonna add any new Arduino Project or Tutorial. If you feel problem in any of the below tutorials then ask in comments and I will try my level best to solve your queries. As I always say learning is all about practise and patience. So while doing Arduino Projects, you have to be patient and practical, don't just read these articles, always test these arduino Projects and tutorials. Because when you practically perform some project then you will do mistakes and get the chance to learn from them. You should also have a look at these
Arduino Project for Beginners.
Arduino Introductory Tutorials
If you have already run your first code on Arduino then you can skip this section. This section is for the beginners who don't know anything about Arduino. I have explained in detail how to get started with Arduino board and at the end of this section, you will have the complete idea of how Arduino works and how to program arduino. You must visit the
Official Arduino Site and join their forum because they have posted a lot of Arduino Projects there.
Arduino Tutorials - Basics
What is Arduino ???
Here's our first tutorial where I have explained the very basics of Arduino i.e. what is Arduino and how to use it?
Arduino Vs Raspberry Pi
In this tutorial, I have explained the difference between Arduino and Raspberry Pi in detail. I have discussed their Pros and Cons in detail. So, give it a try if you are confused in choosing between them.
Installation of Arduino driver in Windows
When you run your Arduino board for the first time on your laptop or computer then you have to install Arduino drivers. Without installing Arduino drivers, you can't upload your Arduino code in Arduino board.
How to get Hex File from Arduino ???
When you are using Proteus software for simulating your Arduino Projects then its necessary to upload Hex File in it.
How to Upload Bootloader in Atmega328 ???
Arduino UNO board uses Atmega328 microcontroller so if you wanna use Arduino as a programmer and want to upload code in your Atmega328 microcontroller then you need to upload the Bootloader in it, which is explained in this post.
Getting Started With Arduino Software
Now I suppose that you have installed the Arduino drivers in previous tutorial so now you are ready to get an overview of Arduino software.
Getting Started with Arduino Programming
In this tutorial, I have mentioned basic concepts of Arduino Programming and have also written a very small code to get you familiar with Arduino Programming.
How to Reset Arduino Programmatically ???
In some Arduino projects we have to reset the Arduino board programmatically instead of manually so I have shared this small trick in this tutorial.
Arduino Boards - Introduction
Here I am gonna give you the basic Introduction of all Arduino boards one by one. I would suggest you to at least read that one, on which you are working. I have shared detailed Pinouts, Pin Description and features.
Introduction to Arduino UNO
In this tutorial, I have discussed the detailed overview of Arduino UNO alongwith its Pinout. That's the most commonly used Arduino Board.
Introduction to Arduino NANO
In this tutorial, I have discussed the detailed overview of Arduino NANO alongwith its Pinout. It is used because of its small size.
Introduction to Arduino Pro Mini
In this tutorial, I have discussed the detailed overview of Arduino Pro Mini alongwith its Pinout and design. That's the smallest Arduino Microcontroller board.
Introduction to Arduino Mega 2560
In this tutorial, I have discussed the detailed overview of Arduino Mega 2560 alongwith its Pinout. It's famous because of its large number of I/O Pins.
Introduction to Arduino DUE
In this tutorial, I have discussed the detailed overview of Arduino DUE alongwith its Pinout. If you are working on it, then must read that tutorial.
Introduction to Arduino Lilypad
In this tutorial, I have discussed the detailed overview of Arduino Lilypad alongwith its Pinout. That's the most stylish Arduino board. :)
Introduction to ATmega328
Atmega328 is the Microcontroller used in Arduino UNO, NANO and Pro Mini. So I would suggest you to read about it as well.
Arduino Libraries
I always advise students to work on simulation first. If you are working on Arduino Projects, then Proteus is the best software for simulations. You should have a look at these New Proteus Libraries for Engineering Students, but here I have only posted Arduino Libraries, which are free to download directly from our site.
[TEPImg17]
Arduino Library For Proteus
Using this Arduino Library for Proteus, you can easily simulate your Arduino boards in Proteus software and can easily design any Arduino Project in Proteus. This Library includes five Arduino boards.
Arduino UNO PCB Design for Proteus ARES
In this post, I have shared the PCB design of Arduino UNO board in Proteus ARES, which you can easily download from this post and then can import it in your Proteus ISIS software.
Arduino Lilypad Library For Proteus
This Library includes the Arduino Lilypad Library for Proteus. Using this library you can easily simulate your Arduino Lilypad board in Proteus ISIS. This Library contains only the Arduino Lilypad board.
Arduino Projects
Now you know the basics of Arduino board and also have the idea how to use arduino software and write code in it. So, now let's get started with Arduino Projects. I have divided this section in several sections depending on which Arduino board I am using in the project. These arduino projects are designed by our team and are designed after quite a lot of efforts but are free here for the readers, so if you wanna share them then do mention us. :)
Arduino Tutorials - Basic
These are few basic Arduino Tutorials, which are very essential for you, if you are a beginner. So, follow them one by one and also design their basic Proteus simulations so that you learn more. So, let's get started with them:
Arduino UNO Projects
- Circuit Designing of LCD With Arduino in Proteus .? Now you have understood the basics of Arduino board and have also installed the Proteus Library of Arduino board so now you are ready for designing small Arduino Projects.In this tutorial, I have interfaced LCD with Arduino baord and I have done it in Proteus ISIS software.
- Interfacing of Keypad with Arduino in Proteus ISIS.? After the interfacing of LCD, next thing you should interface with Arduino is Keypad which is done in this tutorial. So, in this tutorial I have interfaced the Keypad with Arduino and then have shown the keypad characters on LCD.
- Display ADC value on LCD using Arduino in Proteus ? Now that we have interfaced the LCD with Arduino so now its time to display something on it. So, for that purpose I have displyed the ADC value of Arduino analog Pin on LCD. This Project is also designed in Proteus ISIS software.
- Ultrasonic Sensor with Arduino Simulation in Proteus ? In this tutorial, I have interfaced Ultrasonic Sensor with Arduino board in Proteus ISIS software.Remember, we have installed the Ultrasonic Sensor Library for Proteus in the previous section. So, using that Library now I have interfaced this Utrasonic Sensor with Arduino Board.
- Interfacing of Ultrasonic Sensor with Arduino ? In this tutorial, I have interfaced the Ultrasonic Sensor with Arduino in hardware. I have designed a circuit on Vero Board and then tested it. Distance of obstacle from Ultrasonic Sensor is displayed on LCD in cm.
- Interfacing of Multiple Ultrasonic Sensors with Arduino ? In the previous tutorial, I have interfaced single ultrasonic sensor with Arduino but in this post I have interfaced multiple ultrasonic sensors with Arduino board and displayed their values via Serial Terminal in Proteus ISIS.
- Interfacing of Temperature Sensor 18B20 with Arduino ? In this project, I have interfaced the Temperature Sensor 18B20 with Arduino and displayed the atmospheric temperature on LCD. Its a one wire Temperature sensor and gives quite accurate value.
- How to use Temperature Sensor 18B20 with Arduino in Proteus ISIS ? In this project, I have interfaced the Temperature Sensor 18B20 with Arduino and displayed the atmospheric temperature on LCD. Its a one wire Temperature sensor and gives quite accurate value. This Arduino Project is designed in Proteus ISIS.
- Interfacing of Temperature Sensor LM35 with Arduino ? In this project, I have interfaced the Temperature Sensor LM35 with Arduino and displayed the atmospheric temperature on LCD. Its an analog Temperature sensor and gives quite accurate value. This Arduino Project is designed in Proteus ISIS.
- Interfacing of Seven Segment With Arduino in Proteus ? In this project, I have interfaced the Seven Segment Display with Arduino and displayed different alphanumeric value on this Seven Segment Display. This Project is also designed in Proteus ISIS software.
- Interfacing PIR Sensor with Arduino ? In this project, I have interfaced the PIR Sensor with Arduino. I have used the PIR Sensor Library for Proteus in order to design this Arduino Project. PIR Sensor is used for motion detection and it displayed the results on LCD.
- Interfacing of Flame Sensor with Arduino ? In this project, I have interfaced the Flame Sensor with Arduino and used it for Fire Detection. Its an analog Sensor used for Flame detection, on the basis of which we decides whether there's Fire or not. This Arduino Project is designed in Proteus ISIS.
- Interfacing of NRF24L01 with Arduino ? In this project, I have interfaced the NRF24L01 RF module with Arduino and designed two nodes among which data is transferred wirelessly. First Node acted as a Transmitter while the second node acted as a Receiver. This was one of the toughest Arduino Projects.
- NRF24L01+ with Arduino - Response Timed Out ? While using NR24L01, I have encountered a problem named as Response timed Out and in this post I have shown a small trick on How to remove this error and after that it worked perfectly fine. If you are working on NRF24L01 then you must check it out.
- Interfacing of RFID RC522 with Arduino ? In this project, I have interfacedRFID RC522 with Arduino and detected different RFID cards with this RFID module. I have designed it on hardware as this sensor is not yet available in Proteus ISIS.
- Arduino Bluetooth communication using HC-05 ? In this project, I have done a Bluetooth communication using HC-05 bluetooth module. This bluetooth module was connected with Arduino board and then data is sent from Arduino to mobile via Bluetooth.
- Control Servo Motor with Arduino in Proteus ? In this project, I have controlled the Servo Motor with Arduino in Proteus ISIS. Its quite a quick tutorial but is very hepful if you are working on Servo Motors. Servo Motors are controlled via single Pin and are used in Arduino Projects where accuracy is required.
- Traffic Signal Control Project Using Arduino ? Its a small Arduino Project which is normally designed by students in their first or second semesters. In this Project I have modeled a complete Traffic Signal Control. This Project is designed in Proteus ISIS.
- Scrolling Text on LED Matrix 8×8 using Arduino in Proteus ISIS ? In this project, I have interfaced LED Matrix 8x8 with Arduino and then I have displayed a scrolling text on these LED Matrices. This Project is designed in Proteus ISIS.
- Intelligent Energy Saving System ? In this Arduino project, I have designed an Intelligent Energy Saving System. In this project, the system automatically turns ON or OFF the lights & Fans depending on presence of person in the room. Its YouTube video is also given in this tutorial.
- USB Communication between Android and Arduino ? In this project, I have communicated between Arduino & Android via USB. The Android phone is connected with Arduino via USB cable and then data is sent from Android phone to Arduino via USB.
- Home Automation Project using XBee & Arduino ? In this project, I have designed a complete Home Automation Project in which the Loads of a room are controlled via remote. For wireless communcation between remote and the loads I have used XBee module.
- GSM Based Home Security System ? In this project, I have designed a Home Security System and used seven sensors for security purposes and when any of those sensors gave warning then a tet message is sent over to user's mobile phone.
GSM Module (SIM900) With Arduino:
EasyVR Shield With Arduino:
- Voice Recognition Project Using EasyVR Shield ? Its a series of tutorials on EasyVR shield and its the first tutorial in this series. In this tutorial, I have given an overview of the Project named as Voice Recognition Project using EasyVR Shield.
- Getting Started with EasyVR Commander ? Its the second tutorial in the series of EasyVR Shield. In this tutorial, I have explained how to get started with EasyVR Commander which is a software for uploading voices in EasyVR shield.
- Interfacing of EasyVR Shield with Arduino UNO ? Its the third tutorial in the series of EasyVR Shield. In this tutorial, I have interfaced EasyVR shield with Arduino UNO and then recognized the commands said by the user. It's quite an interesting Arduino Project.
- How to solve Training Error: Recognition Failed in EasyVR ? Its the fourth tutorial in the series of EasyVR Shield. While working on EasyVR shield I encountered this error so I thought to share its solution with your guys. So, if you encountered such error then check this tutorial.
XBee Module With Arduino:
Pixy Camera With Arduino:
Motor Interfacing With Arduino:
Arduino Wifi Projects
Arduino YUN Projects
These Arduino Projects and tutorials I have yet posted on my blog, I hope these will help you in some way. I will keep on updating this post with more Arduino Projects. So stay tuned and remember me in your prayers. Take care!!! :)
[/vc_column_text][/vc_column][vc_column][/vc_column][vc_column][/vc_column][/vc_row]
Access Linux Server of Arduino YUN with Putty
In today's post we are gonna see how to connect Arduino YUN with Putty and access the files on Linux OS in Arduino YUN. In my last post Getting Started With Arduino YUN, I have explained in detail about basics of Arduino YUN. I am recall few important things here. Arduino YUN is a very powerful board with two processors on it. One is Arduino microcontroller used to control the output / input pins. The other processor is named as Atheros and it has Linus operating system on it, so one can easily run python scripts on it and can do any server or client side coding in it.
So, today we are gonna see ow to access this Linux operating system of Arduino YUN using Putty software in Windows. Putty is a third party software used for accessing serial terminal, perform telnet or SSH communication etc. So using this software we can easily access the Linux OS on Arduino YUN. So let's have a look how we are gonna do this.
Access Linux Server of Arduino YUN with Putty
- First of all, download the putty software. Its a free software and you can download it quite easily using google.
- After downloading the software, open it and you will have a screen similar to below image:
- Now first of all select the SSH, which is shown in above figure by # 2, then give the IP address of your arduino YUN and Port will remain 22. If you don't know how to get the IP address of Arduino YUN then read Getting Started With Arduino YUN.
- After adding this information, click on the Open button and for the first time, it will show a window similar to below image, simply click on YES.
- This above Window will appear only when you are using putty for the first time, it won't appear afterwards.
- After clicking YES, the below Window will open up asking for Login as:
- When it asks for login, give log in as "root" and the default password is "arduino".
Note:
- If you have changed the password in first tutorial Getting Started With Arduino YUN, then give that password now.
- When you will be typing the password, nothing will appear on putty that's common so you just simply type the password and hit ENTER.
- Now once you entered the password, it will get connected and you will get the below window.
- Now you are in the root folder of your Arduino YUN Linux operating system, now its just like a command prompt or Linux Command Line.
- Let's write some commands and test it out. Check out the below image:
- In the above figure, you can see the first command sent is "cd .." to go into previous folder.
- After that I send the command "cd mnt/sda1" to access the sd card, its the default folder for sd card.
- Next command I sent is "ls", it will show all the files or folder present in the sd card. Currently I have just one folder in my sd card named as Shell.
- After that I updated the opkg package by giving command "opkg update".
- As I am connected with internet on my Arduino YUN sield, so its automatically downloaded and updated and finally I got "Signature check passed".
- Next I installed a new package named as nano. In order to install it I used the command "opkg install nano". Nano is kind of notepad in Linux.
- Now we are gonna write a python script, so I typed "nano TEP.py", and after entering this command the below window will open up.
- In this window, you can write your python script and press Cntrl+X to Exit and it will ask for the save. Hit Y to save and N to No, and when you press Y then it will be saved.
- Let's check it out whether its saved or not, and in order to do so we have to again send the same command "ls" and it will give us the folders and files as shown below:
- You can see now we have TEP.py as well along with Shell folder.
- So, today we have seen how to connect Arduino YUN with putty and access the Linux side of YUN. Afterwards we tested few commands and also check how to write a python code in YUN.
That's all for today, in the coming post of Arduino YUN I will show you how to connect Arduino YUN automatically with Wifi using python scripts. Till then take care and have fun. :)
PIC Microcontroller Projects
Hello everyone, hope you are fine and having fun with you life.Here I am gonna post all the PIC Microcontroller Projects links, which I have posted on my blog. I am gonna make it as guide, in which I will start from very beginning and slowly will move into the pro projects. First of all, I am gonna post about basics of PIC Microcontroller, how it works? how you can write program in it? What are the software used for PIC Microcontroller Programming? Which compilers are available for PIC Microcontroller Programming? etc. So, if you are new to PIC Microcontroller and you wanna design PIC Microcontroller Projects, then here's the guide for you. Follow all these tutorials from beginning and if you feel any problem then ask in comments and I will try my best to resolve your issues.
One more thing, don't just read the posts here, instead make them practically run on your boards. Its the best way of learning because just reading the posts won't help you in understanding the problems occurred while designing PIC Microcontroller Projects. So, the best way of learning about PIC Microtroller is by reading and then implementing. Another thing electronic projects and particularly PIC Microcontroller Projects never work perfectly in the first run, and it will happen that you will thought you are doing everything perfectly fine but still not getting the required output, which is quite common. So be patient while implementing your PIC Microcontroller Projects and if you are not getting the required output then just test and test again because you must be making some slightest mistake and not realizing it. :)
All the tutorial links below are completely designed by TEP team and thus TEP owns all the rights for these projects. They are for educational purposes and if you wanna share it then do mention us, that will be a great favor. And I am mentioning again that when you got into some trouble then do ask in comments and I will surely help you out.Moreover, you can also share your PIC Microcontroller projects with us and we will post them on our blog for the others to learn. So, now let's started.
Basics of PIC Microcontroller - Must Read
Below tutorials are the basic tutorials for PIC Microcontroller, which are must learn for the engineer who are planning to work on PIC Microcontroller. Just read and understand them as they will go you the basic information about PIC Microcontrollers. If you already know the basics then you can skip this section but still I recommend you to read them once at least.
- Getting Started With Microcontrollers ? In this tutorial, I have given an overview of Microcontrollers. Its a very basic tutorial so if you are already familiar with the concept of microcontrollers then you don't need to read this article but its always good to have a taste of basics. :)
- Getting Started With PIC Microcontrollers ? After covering the basics of Microcontrollers, next thing I have covered is the basics of PIC Microcontroller, because we are dealing with PIC Microcontroller Projects here. So, first we will have the basic intro of PIC Microcontroller and then we will move forward.
- Functions available in PIC 18F452 Microcontroller ? In this tutorial, I have discussed the basic functions available in PIC18F452 Microcontroller. I have used this PIC Microcontroller in most of my tutorials so that's why I have first highlighted its main features.
- Top 3 PIC C Compilers ? Now, we have decided which Microcontroller we are gonna use so now let's discuss the C Compilers for PIC Microcontroller. So, I have discussed top 3 PIC C Compilers in this post and have a given kind of a comparison here. Its a must read post.
Compiler Installation guide for PIC Microcontroller - MPLAB
These tutorials are about compiler installation for PIC Microcontroller, Compilers are used to design the programming code for PIC Microcontroller. There are numerous Compilers available in market. The most commonly used compilers are :
- MPLAB
- MikroC Pro For PIC
- CCS Compiler For PIC
MPLAB is official compiler from Microchip and thus is free to use while the other compilers are paid but they have trial versions for testing. Personally I like MPLAB compiler as it gives the complete control over PIC Microcontrollers. After MPLAB, I work on MikroC Pro For PIC Compiler, as it has many built in functions and libraries which reduces the codes and thus efforts quite a lot.
- How to Install MPLAB Software in Windows ? MPLAB is official compiler of PIC Microcontroller so in this post, I have discussed in detail how to install this MPLAB software in Windows. Using this software you can only design assembly language code for PIC Microcontroller.
- How to Install MPLAB C18 Compiler in Windows ? Now that you have installed the MPLAB software so now its time to install its C18 Compiler so that we can write our codes for PIC Microcontroller Projects in C Language instead of Assembly Language.
- Getting Started With MPLAB ? Now that we are done with the installation of compilers so now its time to get started with MPLAB software so that's why I have given an overview of how to get started with MPLAB compiler.
PIC Microcontroller Projects
Below are different projects designed on PIC Microcontroller, I have posted them in sequence from basics to pro. The list is quite short rite now because I haven't posted much on PIC Microcontroller yet but it will keep on increasing, whenever I am gonna post any new project on PIC Microcontroller, I will add the link below.
How to use LDR Sensor in Proteus
In today's post, I am gonna share how to use LDR sensor in Proteus. Proteus, as we all know, is a very handy software and is used for circuit and PCB designing. It is also used for circuit and programming testing. It is normally used by engineers in their projects and contains a vast list of built-in components. I have posted a lot of tutorials on Proteus and I have got quite a positive feedback from the reader about these tutorials. So, I thought to share another component in Proteus which is quite hidden and I haven't seen much posts on it available online.
So, in today's post, first I am gonna explain what is LDR sensor? and we will see where it is used and how it is used. After that I will design a simple circuit in Proteus in which I will turn control a LED using LDR sensor andwill make it ON and OFF. So, as usual let's start from the beginning so that the newcomers could also get benefit from it.
What is LDR Sensor?
- LDR is an abbreviation of Light dependent resistor. It is also known as photoresistor or photocell.
- Its symbol is shown in the below figure:
- LDR Sensor is used for the detection of light, internally it has a resistance which is sensitive to light as shown in the symbol.
- Whenever light falls on the LDR sensor, its resistance start decreasing and when it comes to dark then its resistance start increasing. Using the value of resistance one can easily detect whether there's light or not.
- It is normally used in light activated switches.For instance, you have seen the automatic street lights, which go ON when its night and automatically go OFF when its day time. In those street lights, LDR sensors are used.
Working of LDR Sensor
- As I explained above, it has an internaal resistance which is very sensitive to light intensity and varies according to it.
- So, one thing is quite clear that LDR sensor is an analog sensor. It gives us different values depending on the light intensity falling on it.
- Let's have a look on the simplest circuit of LDR sensor, which is shown in the below figure:
- Now if you check the above image you can see we have placed a resistor in series with the LDR sensor and have applied a voltage source across them.
- Now when the light will fall on the LDR sensor, its resistance will go LOW and in return the voltage across the LDR will also go LOW and as the LDR will come in dark, the resistance will go HIGH and in return the voltage will also go HIGH.
- Its the simplest working phenomena of LDR sensor. Now if you are using the LDR sensor with some microcontroller then what you need to do is simply give this intermediate connection of resistor and LDR to microcontroller.
Circuit Designing of LDR Sensor in Proteus
- Now we know the basics of LDR sensor and have also seen how it works so now let's design its circuit in Proteus.
- There are two types of LDR sensors available in Proteus which are exactly the same in functioning but are different in operating. Both are shown in the below figure:
- The first one has a digital display along with it on which the voltage value is displayed while the second one a bit more animated and has a torch with it, so when you press the up arrow the torch will come closer and in other words the light is falling on the LDR and when you press the down arrow the the torch will go away and your LDR is in dark now.
- Both of these states are shown in below figure:
- Now you can see both the states quite clearly, in the first state torch is away so LDR is in dark while in second state, torch is close so LDR is ON.
- So, now let's design their circuit to control a LED with LDR Sensor in Proteus. In order to do so, design this simple circuit in Proteus as shown in below figure:
Note:
- I have also designed this circuit on hardware and tested, it works perfectly as shown in the simulation.
- Its a very simple circuit in which I am using a comparator and then giving output to LED. When the LDR is in dark then the LED will remain OFF and when the LDR will go into light then the LED will turn ON.
- Both of these states are shown in below figure:
- Now you can see when the voltage on the digital display of LDR were LOW then the LED was OFF and when Iincreased the voltage then the LED went ON.
- Now let's check both of these states with the second LDR sensor in Proteus, which are shown in the below figure:
- Again quite obvious, when the torch was away then LDR was in dark and the LED was OFF but in second state when I moved the torch close the LED went ON.
- Here's the Proteus Simulation of LDR sensor attached below, download and play with it. :)
Download LDR Sensor in Proteus Simulation
That's all for today, if you have any problem ask in comments and I will reply them. Take care and have fun !!! :)
Interfacing of Seven Segment with Arduino in Proteus
Hello friends, today we are gonna have a look on how to interface Seven Segment with Arduino in Proteus. In my last post, I have posted an Arduino Library for Seven Segment Display, which is designed by our team and is quite basic in functionality. So, if you haven't checked that post then first of all check that one and download the Arduino Library for Seven Segment Display as I am gonna use that library in today's post. Moreover, in order to run this library you are also gonna need to download Arduino Library for Proteus, using this library you will be able to use Arduino board in Proteus so also read that post and download this library and install it in your Proteus.
Again I am mentioning that its the first library designed by our team so its in basic stages, it has few functions and will only display the numeric on the seven segment display which is normally required. I am planning on adding more examples in the library for future use, which will increase the functionality. Anyways that's a future talk, let's start today's post.
What is Seven Segment Display?
Let's first have a look at what is Seven Segment Display. Seven Segment display is nothing but an electronic device used for displaying the numeric data. It's a complex form of LED matrix and is normally used in clocks, LCD displays, calculators etc where there's a need to display the numeric data. It has total seven leds in it which you can also count from above image and by turning these LEDs ON or OFF we can display any numeric on it. For example, have a look at the below image. In this image I have shown numeric 0 on seven segment. Now in order to do so, I just simply turn OFF the centered LED and turn ON all the corner LEDs and it becomes 0.
How does Seven Segment Work?
Now, let's have look at how it works. So, we have seen that Seven Segment is named seven segment because it has total seven LEDs on it so now what we need to do is to control these seven LEDs, also named as segments, and then we can display any character on it. There are two types of seven segments available in the market and named as:
- Common Cathode
- Common Anode
They both work exactly the same and has only a slight difference. They both has total seven pins and each pin is used to control each led and they have an extra pin which is named as Common Pin. In Common Cathode you have to GND this Common Pin, while in common Anode, you have to give +5V to this Common Pin. Have a look at this below image, we have labelled leds with respect to the pins.
Interfacing of Seven Segment with Arduino in Proteus
- Now we know all about Seven Segment Display and know how it works so let's interface Seven Segment with Arduino in Proteus.
- Now, I am assuming that you have installed the Arduino Library for Proteus and have also installed the Arduino Library for Seven Segment display.
- So, now open your Arduino Software and go to File>Examples>SevenSegment>Counting.
- Open this example, in this example I have added a counter which will start counting from 0 to 9 and once it reached 9 then it will start counting again.
- If you can't find this example then you must be making some mistake in installing the library, anyways the code is shown below.
Note:
- In order to run this example you will need two libraries, the inks are given below to download:
/*
Counting
This Arduino example is for Seven Segent display.
It will start the counter from 0 and will end up at 9
and will start again from 0.
This example code is in the public domain.
Created by Syed Zain Nasir at 14 March 2015.
You can get the explanation and latest version of this library at:
http://www.TheEngineeringProjects.com/
*/
#include "SevenSegment.h"
SevenSegment tep = SevenSegment(0,1,2,3,4,5,6);
char arr [10] = {'0','1','2','3','4','5','6','7','8','9'};
int index;
void setup(){
index = 0;
}
void loop(){
tep.display(arr[index++]);
delay(1000);
if(index == 11)
index = 0;
}
- Now open you Proteus Software and design the circuit in it as shown in below figure, I have also attached the file for download at the end.
- Now compile the code and gt the hex file and upload it in your Arduino Properties.
- Now Run the Proteus software, and you will see the seven segment display will start counting, a glimpse of it is shown in the below figure:
- Below is attached the Proteus file and the hex file for the counting example which you simply start and run but again I suggest that you should design it by yourself so that you get something out of it.
Download Proteus Simulation of Seven Segment with Arduino
- One last thing, any kind of contribution to this library from the readers is highly appreciated, design your projects and share codes with us and we will post them on our blog for other readers to get knowledge as knowledge is all about sharing.
That's all for today, hope it will help you in some way. Take care and have fun. :)
Arduino Library for Seven Segment Display
In today's post, I am gonna share a new Arduino Library for Seven Segment Display. In my recent project, I got a chance to work on seven segment displays, I have worked on them using PIC microcontroller but haven't got a chance to use them with Arduino. So, now as usual when I started working on them, I started searching for Arduino Library but I kind of got disappointed after getting quite heavy libraries for seven segments, and after a lot of search I thought of designing my own Arduino library for seven segment display, which I am gonna share in this post. :)
It's not very advanced library as we know seven segment displays are not too complex, so its quite simple and using it you can quite easily display any numerical digit on the seven segment display. Moreover, I have also included an example with the library which will start the counter from zero on seven segment display and keep on incrementing till 9 and after that it will start again from zero. Moreover, I have also posted the example about Interfacing of Seven Segment Display with Arduino in Proteus using this library, it will help you in better understanding of How this library works. You can download the working Proteus Simulation as well as hex file from that post.
Download Arduino Library for Seven Segment Display
- As I stated earlier, its a very simple Arduino Library for Seven Segment Display and it will only print the numeric on seven segment display, but I will work on it in future and will update it by adding more features in it.
- So, first of all click the below button to download the Arduino library for seven segment display.
Download Arduino Library for Seven Segment Display
- After downloading the library, place it in the libraries folder of your Arduino software.
- Now close your Arduino software and open it again.
- Go to File and then Examples and you will find SevenSegment in it and it will have an example which is named as Counting.
Functions in Arduino Library for Seven Segment Display
- I have added quite few function in it which are very basic and are very easy to use.
- The first function I have used is:
SevenSegment(int a,int b,int c,int d,int e,int f,int g);
- In this function, you need to give the pins of Arduino with which you are attaching your seven segment display. It will called as shown below:
SevenSegment tep = SevenSegment(0,1,2,3,4,5,6);
- Now tep is our seven segment object and we are gonna use it in rest of the example.
- The next function used in this arduino library for seven segment display is:
display(char c);
- This function will display the numeric on seven segment display which you will provide it.
- Moreover, it will automatically clear the screen before displaying any new character on the seven segment.
- It is called in the example as shown below:
tep.display('1');
That's all for today, in this next post you can download the example of how to
Interface Seven Segment Display Using Arduino in Proteus, it will help you in understanding of this library in detail.
Send data to Serial Port in MATLAB
Hello friends, hope you all are having fun and enjoying life. In today's post we are gonna see how to send data to serial port in MATLAB. Its a requested tutorial, asked by a follower and after giving him the code, I thought to share it on our blog so that others could also get benefit from it. We have discussed serial port many times and have seen how to communicate with it using different software but we haven't yet discussed how to send data to serial port in MATLAB. So, in today's post I am gonna share the complete code for sending data to serial port in MATLAB.
Serial port is most common way of communication, we can send or receive data using serial port. Normally, in engineering projects there's a need to send or receive data from microcontrollers to computer and in such projects, we used serial communication as its easy and quite quick in communication.
Send data to Serial Port in MATLAB
- Its a quite simple project in which I am gonna send character over the serial port in MATLAB.
- In order to do so first of all, I am gonna create an object and assign it to serial port object in MATLAB.
- After that I am gonna set the properties of that serial port object.
- After setting the properties, what we need to do is simple start our serial port object.
- Once its started, now you can send any character via that serial port object.
- After sending your desired characters, now what you need to do is simply close the serial port.
- Closing the serial port is very essential in MATLAB because if its left open then you can't open it again in MATLAB and you need to restart your computer so be careful.
- Here's the simplest code for sending the data:
tep=serial('COM1', 'BaudRate', 9600);
fopen(tep);
fprintf(tep,'a');
fclose(tep);
- Now you can see, its too simple, we just set the com port with which we want to communicate and after that we gave the bud rate.
- In the next line, we open our serial port object.
- Now as our serial port is open, we can send any character to it. In this code, I am sending 'a' to serial port in MATLAB.
- And finally I closed the serial port, which is very necessary as otherwise when you run this code again, it will start giving error.
- Here's a bit explanatory code and much more flexible as you can change any property of Serial Port in MATLAB, you want to change.
- Here's the code:
clc
clear all
close all
disp(' Welcome to TEP!!!');
disp(' ');
disp(' www.TheEngineeringProjects.com');
disp(' ');
tep=serial('COM1'); % assign serial port object
set(tep, 'BaudRate', 9600); % set BaudRate to 9600
set(tep, 'Parity', 'none'); % set Parity Bit to None
set(tep, 'DataBits', 8); % set DataBits to 8
set(tep, 'StopBit', 1); % set StopBit to 1
%display the properties of serial port object in MATLAB Window
disp(get(tep,{'Type','Name','Port','BaudRate','Parity','DataBits','StopBits'}));
fopen(tep); % Open Serial Port Object
fprintf(tep,'a'); %Print character 'a' to the serial port
disp('Charater sent to Serial Port is "a".');
fclose(tep); %Close Serial Port Object
- The code is quite self explanatory plus I have also added the comments in the code which will help you in understanding the code but still if you have any problem, then ask in comments.
- Here's a screen shot of the above code:
- Wen you run this code, you will get a below response in your MATLAB window:
- Till now, we have seen how to send a single character defined in the m file of MATLAB, now let's make it a bit complex and send user defined data.
- Now before sending the data, we will first ask the user to enter the data, he wants to send to serial port. Tis data could be a single character or could also be a combination of characters.
- In order to do so, we are gonna use Input command in MATLAB and code is as follows:
clc
clear all
close all
disp(' Welcome to TEP!!!');
disp(' ');
disp(' www.TheEngineeringProjects.com');
disp(' ');
tep=serial('COM1'); % assign serial port object
set(tep, 'BaudRate', 9600); % set BaudRate to 9600
set(tep, 'Parity', 'none'); % set Parity Bit to None
set(tep, 'DataBits', 8); % set DataBits to 8
set(tep, 'StopBit', 1); % set StopBit to 1
%display the properties of serial port object in MATLAB Window
disp(get(tep,{'Type','Name','Port','BaudRate','Parity','DataBits','StopBits'}));
fopen(tep); % Open Serial Port Object
data = input('Enter character: ', 's'); %Ask user to Enter character
fprintf(tep,data); %Print character 'a' to the serial port
disp('Charater sent to Serial Port is:');
disp(data);
fclose(tep); %Close Serial Port Object
- The screenshot of code is as follows: (I am adding the screen shot of code because its colored and thus helps better in understanding the code)
- Now when you run this m file, you will get results as shown in below figure and now you can see I have sent my blog url via serial port in Matlab.
- I think we have played enough with sending data via serial port in MATLAB, now you can send any data via serial port in MATLAB, for example you can also create an infinite loop and keep on sending data to serial port.
- That's all for today, in the coming post I will show how to receive data via serial terminal in MATLAB, so stay tuned and also subscribe us via email to get these exciting tutorials straight in your mailbox. Take care. :)
Temperature Sensor 18B20 with Arduino
Hello everyone, in today's post we are gonna have a look at how to interface temperature sensor Dallas 18B20 with Arduino. There are many temperature sensors available in market like LM35, DHT11 etc but personally I like Dallas18B20 most of all, as it gives the most accurate result up to four decimal points. It operates on single wire and sends all data through this wire. Another advantage of this wire is you can interface multiple sensors with a single data line. You should also have a look at How to use 18B20 in Proteus ISIS.
In today's post, we are gonna get value from this sensor and then print it over the Serial Terminal as well as LCD. We will get the values in degree centigrade. Its not much difficult to interface 18B20 with arduino and also an Arduino library is also availble, using which you can quite easily interface 18B20 with Arduino. Let's get started with interfacing of 18B20 with Arduino.
Note:
Interfacing of Temperature Sensor 18B20 with Arduino
- As I explained earlier, it works on single wire and hence we are gonna need 1-wire library for Arduino along with 18B20 arduino library.
- Download both of these libraries by clicking on the below buttons:
Download One Wire Library Download Dallas Temperature Library
- After downloading the library, place it in the libraries folder of your Arduino Software.
- Now restart your Arduino software and you will find the Arduino folder in the Examples section.
- Next we need to interface our sensor 18B20 with Arduino so design your circuit as shown in below figure:
- So, connect the sensor 18B20 with Arduino as shown in the above figure, connections are quite simple and are as follows:
- Pin # 1 of 18B20 with GND
- Pin # 2 of 18B20 with Pin # 2 of Arduino.
- Pin # 3 of 18B20 with GND of Arduino.
- Add a pull up resistor of 4.7k ohm at pin # 2 of 18B20.
- Here's the images of hardware, we designed for this project, its a 20 x 4 lcd we have used:
- Below image shows the small 18B20 sensor, used in this project, it looks small but very efficient.
- Here's the image showing the complete project:
- Now, copy below code and upload it in your Arduino board and open your serial terminal.
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
void setup(void)
{
Serial.begin(9600);
Serial.println("Welcome to TEP !!!");
Serial.println("www.TheEngineeringProjects.com");
Serial.println();
sensors.begin();
lcd.begin(20, 4);
lcd.setCursor(5,0);
lcd.print("Welcome to:");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
delay(5000);
}
void loop(void)
{
sensors.requestTemperatures();
Serial.print("Temperature : ");
Serial.println(sensors.getTempCByIndex(0));
//lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temperature: ");
lcd.print(sensors.getTempCByIndex(0));
lcd.print("C");
delay(1000);
}
- After uploading the code, when I start the project, it started showing the temperature values as shown below:
- As you can see, its giving the temperature of my room which is 23.56 degree centigrade.
- I have also designed a video for more demonstration which is given below:
- It's quite a simple code and is self explanatory but still if you need help ask in comments and I will help you out.