LOGIN
Electrical and Electronics Engineering student (Project Leader)
 · New DelhiIndia
Share
Report
Get Link
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
6 likes 
Like
Award Contribution
Load 15 previous comments
Abhi Verma
38
Community Expert
ROBOToTHON 2017 Mentor, Electronics Engineer
 · DelhiIndia
Share
Report
Get Link

My pleasure bro

Like
0 like 
Award Contribution
Electrical and Electronics Engineering student (Project Leader)
 · New DelhiIndia
Share
Report
Get Link

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 ?

Like
0 like 
Award Contribution
Abhi Verma
38
Community Expert
ROBOToTHON 2017 Mentor, Electronics Engineer
 · DelhiIndia
Share
Report
Get Link

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.

Like
0 like 
Award Contribution
Engineer
 · LahorePakistan
Share
Report
Get Link

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

Like
0 like 
Award Contribution
Engineer
 · LahorePakistan
Share
Report
Get Link

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

Like
0 like 
Award Contribution
Electrical And Electronics Engineering
 · ChittoorIndia
Share
Report
Get Link

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

Like
1 like 
Award Contribution
Leave a reply...
DISCOVER
CHAT
HIRE
ACTIVITY
FEED
New Post
Help
Start Project
Online Users
Share Link