กลับไปหน้ารวมไฟล์
attiny85-bi-direction-traffic-stop-light-73e83e-en.md

Micro-Architecture Efficiency: Bi-Directional Traffic Control

This project explores the power of "bare-metal" style computing by creating a complex traffic control system on the ATtiny85—an 8-pin microcontroller with limited I/O. By integrating a 74HC595 Shift Register, the project demonstrates how to overcome pin constraints to drive multiple visual elements through a serial-to-parallel interface.

Overcoming I/O Limits: The 74HC595 Shift Register

The ATtiny85 only has 6 usable I/O pins, which would normally be insufficient for a dual-road traffic light (6 LEDs).

  1. Bit-Banging Data: The ATtiny85 sends 8 bits of data serially into the shift register using only three pins: Data, Clock, and Latch.
  2. Parallel Output: Once the latch is triggered, the shift register holds the state (Red/Yellow/Green for two directions) across its 8 output pins simultaneously.
  3. Synchronization: This allows the code to update both traffic signals in perfect unison, ensuring that one direction is always Red before the other turns Green.

Timing Logic and Safety States

The software, compiled using the ATTinyCore for the Arduino IDE, implements a rigid state machine to match real-world traffic safety protocols:

  • Phase Transitions: The code includes mandatory "All-Red" clearance intervals to ensure cars from the previous green phase have cleared the intersection.
  • Clock Calibration: Running at an internal 1MHz clock speed, the timing triggers are calibrated to provide realistic intervals for a model city or a tabletop simulation.
  • Power Optimization: To maintain stability on a breadboard, the system is powered by a 5V DC Buck Converter, ensuring that the high-current draw of multiple active LEDs doesn't brown out the sensitive microcontroller.

Educational Gateway to Custom Silicon

For students and hobbyists, this project is the ideal bridge between "using an Arduino Board" and "designing your own specialized electronics." Mastering the ATtiny85 allows makers to shrink their projects into permanent, professional-grade enclosures, proving that you don't need a large processor to handle complex, real-life logistics.

This is a simple project to learn how to use a shift register (74hc595) with an ATtiny85 chip.

The program was written for an ATtiny85 using Arduino IDE and the 'ATTinyCore' board found at: https://github.com/SpenceKonde/ATTinyCore

For more on the ATtiny85, see: https://www.microchip.com/wwwproducts/en/ATtiny85

The ATtiny85 was programed with the external programer, and is running is at a clock speed of 1MHz (internal).

The circuit is powered by an external DC buck converter running at 5v.

ข้อมูล Frontmatter ดั้งเดิม

title: "ATtiny85 - Bi-direction Traffic Stop Light"
description: "This is a simple Traffic Stop Light program written for an ATtiny85 & 74HC595 shift register."
author: "mattrude"
category: ""
tags:
  - "75hc595"
  - "shift register"
  - "transportation"
  - "attiny85"
views: 2377
likes: 0
price: 1120
difficulty: "Intermediate"
components:
  - "1x Tiny AVR Programmer"
  - "2x 5 mm LED: Yellow"
  - "2x 5 mm LED: Red"
  - "6x Resistor 220 ohm"
  - "1x Jumper wires (generic)"
  - "1x Solderless Breadboard Full Size"
  - "2x 5 mm LED: Green"
  - "1x ATtiny85"
  - "1x Shift Register- Serial to Parallel"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "2d004a76e04315fd926da77882b33b0ab3d808b5f0194029365c29a397f26d19"
encryptedPayload: "U2FsdGVkX18nFYwRmE9wtuC0wJpUvokyjAlp4TATDeZ5Xbb9JWGfBO6Yqf9KwBg887EHtQ3/bJ+jYclqrWJmY5M5aCXQD5h4oErSTi4sy1g="
seoDescription: "Simple Bi-direction Traffic Stop Light program using ATtiny85 and 74HC595 shift register."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/attiny85-bi-direction-traffic-stop-light-73e83e_cover.jpg"
lang: "en"