Author Topic: Traffic light circuit with 556 timer: UPDATE!  (Read 867 times)

0 Members and 1 Guest are viewing this topic.

Offline phennesseyTopic starter

  • Contributor
  • Posts: 36
  • Country: us
Traffic light circuit with 556 timer: UPDATE!
« on: January 03, 2020, 07:50:01 pm »
Original thread: https://www.eevblog.com/forum/beginners/traffic-light-circuit-with-556-timer/

Well...after much ado, here's my first functioning traffic light circuit! I tried (and failed) to build this circuit with a 556 timer. I was only getting two LEDs to blink. Hopefully, SmokeyTheElectrician can weigh in on this. I think my schematic was wrong, despite being told it was correct. Perhaps someone can take a look at my old schematic?

https://www.eevblog.com/forum/beginners/traffic-light-circuit-with-556-timer/?action=dlattach;attach=895598;image

Since I just wanted to make the damn thing work, I used an Attiny85 for now. Here's the result:



Code: [Select]
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
while(1)
{
DDRB= 0xff; // set all pins to output
PORTB=0b00000001; // set pin 1 high
_delay_ms(3000); // delay 3 seconds
PORTB=0b00000010; // set pin 2 high
_delay_ms(1000); // delay 1 second
PORTB=0b00000100; // set pin 3 high
_delay_ms(3000); // delay 3 seconds
}
}
« Last Edit: January 03, 2020, 11:06:50 pm by phennessey »
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1134
  • Country: us
Re: Traffic light circuit with 556 timer: UPDATE!
« Reply #1 on: January 03, 2020, 09:12:02 pm »
Excellent!
 

Online ebastler

  • Super Contributor
  • ***
  • Posts: 7375
  • Country: de
Re: Traffic light circuit with 556 timer: UPDATE!
« Reply #2 on: January 04, 2020, 01:45:19 pm »
 :-+

And you have some pins to spare, so you could make a traffic light for both directions of an intersection. (With proper delays/safety times between the green phases for either side.) Or use one pin as an analog input to adjust the cycle time. Or cater to European tastes and implement a "red, red/yellow, green, yellow, ..." cycle. Or use two pins as a sensor input and a trigger output for a red-light camera. ;) 

Microcontrollers are neat; loads of flexiblity in small, simple and cheap packages.  :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf