LOGIN
Jayant Singh
Electrical and Electronics Engineering student (Project Leader)
 · New DelhiIndia
Share
Get Link
Report
STATUS

Arduino Uno

1st Concept

https://123d.circuits.io/circuits/2036226-smart-streetlight#schematic
Its our initial ardunio model for understanding working principle of smart streetlight.
There is LED (streetlight) in between 2 IR motion sensors . when IR1 will detect motion, then LED will be switch to Max. brightness until the vehicle crosses IR2 .

source code

int ldr= A0;
int led= 9;
int ir1= A1;
int ir2= A2;
int brit= 0; 
void setup() 
{
Serial.begin(9600); 
pinMode(led,OUTPUT);

}
void loop()
{
Serial.println(analogRead(ldr));
brit = analogRead(ldr);
if( brit < 300 ) // at night 
{
  if (digitalRead(A1)==HIGH) // IR1 detect motion 
  {
    do{
  analogWrite(led,255); // max brightness  
  }
    while(digitalRead(A2)==LOW); // vehicle is between IR1 and IR2
    }
 else if(digitalRead(A1)==LOW);
   {analogWrite(led,50); // no motion detected so, low brightness- dim 
   }
 }
 else{ // at daytime
 analogWrite(led,0);  
 }
 }

Arduino Uno
5 likes 
Like
Load 15 previous comments
Abhi Verma
Electronics Engineer
 · DelhiIndia
Share
Get Link
Report

My pleasure bro

0 like 
Jayant Singh
Electrical and Electronics Engineering student (Project Leader)
 · New DelhiIndia
Share
Get Link
Report

Abhi Verma Currently I am learning AVR programming for this project. could you please suggest the best method to program AVR (ATmega8) ? any source/link to learn ?

0 like 
Abhi Verma
Electronics Engineer
 · DelhiIndia
Share
Get Link
Report

You can use arduino instead. Which powered by atmega328p. And have a huge community.
For atmega8 you will need atmel studio for compiling the code and use an USBasp programmer to upload the hex file to atmega8.
These programmers are easily available online. And comes with a uploader software e.g. Progisp and others.

Writing code for avr is bit different from 8051. e.g. There are different registers for avr. In 8051 we assign a pin or port as i/p by simply writing 1s or 0s to them.
In avr DDRxn register is for assignment and PORTxn is for read and write to port. While PINx is used for pins instead of P1_1 in 8051.
For better understanding and quick learning, read various projects code available on web and try to understand them. You can also experiment the code with avr.
This is the way which taught me.

0 like 
Muhammad Ahmad
Engineer
 · LahorePakistan
Share
Get Link
Report

You should use Arduino because it is just a prototype and will be replaced . Workign with micro controllers is difficult and hectic.

0 like 
Muhammad Ahmad
Engineer
 · LahorePakistan
Share
Get Link
Report

Use sonar sensors for detecting vehicles . Easy to use and have good results

0 like 
Debraj Nath
Electrical And Electronics Engineering
 · ChittoorIndia
Share
Get Link
Report

codevision avr is a good software for programming atmega8 . You can directly program atmega 8 using usb asp programmer and breadboard. Codevision avr comes with some basic preinstalled set of codes

0 like 
Leave a reply...
DISCOVER
CHAT
ALERTS
DISCUSSIONS
FEED