Posts

Showing posts with the label Arduino Projects

Interfacing 2 Ultrasonic sensors with one Arduino

Image
( Representative image, Connections are different ) Ultrasonic sensors are widely used in the Arduino projects to detect objects, distances and system disturbances. Majority of peoples having some problems while trying to use Arduino to drive two HC-SR04 ultrasonic sensor. While trying to display two measured value from each sensor, one of them work fine but the other displays value 0.   The situation were two sensors works in parallel, but pulseIn functions are executed in serial. This is the reason why your code doesn't work. Let's image when you toss two balls by your right hand, and try catch them one by one with your right hand. When you catch one ball and put it in a box, another ball had been fallen on the ground. This is why first pulseIn can get correct value and second one fail to get correct value.   I have created a programme to display two distance values from different sensors and displays it in a 6x2 LCD. To sole the code problem, I have created a separa...

Millis Delay Example For Arduino

Image
What is delay () ? We all are familiar with delay() function in Arduino. For example delay(1000) will give a 1 second delay to the program code. The major disadvantage of this function is that it will pause the entire code from execution.  The delay()  function is known as 'Code Blocking'. What it does is pauses the code for a set amount of time. The time it pauses for is indicated within the brackets in milliseconds. Eg:  delay(1000)  will pause the code for 1 second.  This will affect some large code execution when some sensors or LCDs are interfaced.  Here comes the concept of millis delay function.  The millis()  function is nothing like delay(). It helps us time events without pausing the code. The  Arduino Reference for millis()  says it: Returns the number of milliseconds passed since the Arduino board began running the current program. How To Use millis() Instead of delay()? After reading above, we have cove...

Long Delay Timer Circuit for Refrigerators(Old Types)

Image
/ * My refrigerator does not have an automatic temperature cut-off system. So i made a long delay cut 0ff timer using 89c2051 micro controller . Here i am going to explain how it is made. */ Calculation: Crystal frequency Used in circuit = 12Mhz Frequency for 1 Machine cycle = 12/12 Mhz ie = 1Mhz ie Time period for 1 Machine cycle = 1Micro seconds Now Calculate for 50 Milli Seconds = (50x10^-3) / (1x 10^ -6) = 50000 We program Timer O in Mode1 (16 bit) ie maximum value is FFFF (H), or 65535 (10) 65535 - 50000 = 15535 Equivalent HEX value for Decimal 15535 = 3CAF So in program : TL0 = AF TH0 = 3C This will generate for 50 Milli Seconds, we need to calculate for 2 hours and Half an hours Now Moving to the Program: / **********************************************************************/ #include<AT89x051.h>   int i,j;      void delay1()     //Delay for 2 hours {      TMOD=0x01;  ...

BURN ARDUINO BOOT LOADER USING another ARDUINO (Arduino as an AVR ISP)

Image
This tutorial explains how to use an Arduino board as an AVR ISP (in-system programmer). This allows you to use the board to burn the bootloader onto an AVR . (e.g. the  ATmega168  or  ATmega328  used in Arduino). Instructions To use your Arduino board to burn a bootloader onto an AVR, you need to follow a few simple steps. 1. Open the  ArduinoISP  firmware (in  Examples ) to your Arduino board. 2.Note for Arduino 1.0:  you need to make one small change to the  ArduinoISP  code. Find the line in the heartbeat() function that says "delay(40);" and change it to "delay(20);". Select the items in the  Tools > Board  and  Serial Port  menus that correspond to the board you are using as the programmer (not the board being programmed). Upload the  ArduinoISP  sketch. Wire your Arduino board to the target as shown in the diagram below. ( Note for the Arduino Uno:  you'll need to add a 10 uF c...

Interfacing 16×2 LCD with 8051

Image
LCD display is an inevitable part in almost all embedded projects and this article is about  interfacing 16×2 LCD with 8051 microcontroller. Many guys find it hard to interface LCD module with the 8051 but the fact is that if you learn it properly, its a very easy job and by knowing it you can easily design embedded projects like digital voltmeter / ammeter, digital clock, home automation displays, status indicator display, digital code locks, digital speedometer/ odometer, display for music players etc etc. Thoroughly going through this article will make you able to display any text (including the extended characters) on any part of the 16×2 display screen. In order to understand the interfacing first you have to know about the 16×2 LCD module. 16×2 LCD module. 16×2 LCD module is a very common type of LCD module that is used in 8051 based embedded projects. It consists of 16 rows and 2 columns of 5×7 or 5×8 LCD dot matrices. The module were are talking about here is typ...