Editor Version ×
Standard

1.Easy to use and quick to get started

2.The process supports design scales of 300 devices or 1000 pads

3.Supports simple circuit simulation

4.For students, teachers, creators

Profession

1.Brand new interactions and interfaces

2.Smooth support for design sizes of over 5,000 devices or 10,000 pads

3.More rigorous design constraints, more standardized processes

4.For enterprises, more professional users

Ongoing

STD ATtiny13 TinyTacho

ATtiny13 TinyTacho

Project tags

License

CC-BY-SA 3.0

License: CC-BY-SA 3.0

Mode:

Mode

Editors' pick

Editors' pick

  • 8.1k
  • 6
  • 28
Update time: 2022-04-09 04:46:44
Creation time: 2020-10-30 09:57:06
Description

Description

# Overview Recently Great Scott built his [DIY version of a tachometer](https://youtu.be/6QZMt4yyylU) which I thought was very cool. But using an ATmega for this job, I found a bit overpowered. So I tried to force all tasks (measurement, calculation, I²C protocol and OLED display) into the huge 1KByte memory of an ATtiny13. - Firmware (Github): https://github.com/wagiminator/ATtiny13-TinyTacho - Project Video (Youtube): https://youtu.be/Iz7LjheLYKo ![pic1.jpg](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyTacho/main/documentation/TinyTacho_pic1.jpg) # Hardware Since the ATtiny13 does almost all of the tasks, the wiring is pretty simple: ![wiring.png](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyTacho/main/documentation/TinyTacho_Wiring.png) The IR LED emits light, which is reflected by the rotating object and detected by the IR photo diode. The photo diode changes its conductivity depending on the strength of the reflected light. If the rotating object has exactly one white stripe on an otherwise black surface, then the photo diode changes its electrical resistance twice per revolution and the voltage between the diode and the 10k resistor rises once above and falls once below a certain threshold, which is defined by the variable resistor. ![pic2.jpg](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyTacho/main/documentation/TinyTacho_pic2.jpg) If you want to use a coin cell to power the device, please remember that only the rechargeable LIR1220 Li-Ion batteries work. The "normal" CR1220s don't deliver enough power. # Software ## Implementation The IR photo diode is connected to the positive input of ATtiny's internal analog comparator, the variable resistor for calibration is connected to the negative input. An interrupt is triggered on every falling edge of the comparator output which saves the current value of timer0 and restarts the timer. The 8-bit timer is expanded to a 16-bit one by using the timer overflow interrupt. The saved timer value contains the timer counts per revolution. The RPM is calculated by utilizing the following equation: ``` RPM = 60 * F_CPU / prescaler / counter = 60 * 1200000 / 64 / counter = 1125000 / counter ``` The calculated RPM value is displayed on an I²C OLED display. The I²C protocol implementation is based on a crude bitbanging method. It was specifically designed for the limited resources of ATtiny10 and ATtiny13, but should work with some other AVRs as well. The functions for the OLED are adapted to the SSD1306 128x32 OLED module, but they can easily be modified to be used for other modules. In order to save resources, only the basic functionalities which are needed for this application are implemented. For a detailed information on the working principle of the I²C OLED implementation visit [TinyOLEDdemo](https://github.com/wagiminator/attiny13-tinyoleddemo). ```c // global variables volatile uint8_t counter_enable = 1; // enable update of counter result volatile uint8_t counter_highbyte = 0; // high byte of 16-bit counter volatile uint16_t counter_result = 0; // counter result (timer counts per revolution) // main function int main(void) { uint16_t counter_value; // timer counts per revolution uint16_t rpm; // revolutions per minute PRR = (1
Design Drawing

Design Drawing

schematic diagram
1 /
PCB
1 /
The preview image was not generated, please save it again in the editor.
ID Name Designator Footprint Quantity
1 MSK-11027 KEY1 SW_SMD_MSK-11027 1
2 OLED 0.91 OLED1 I2C OLED 0.91 1
3 10k R3,R1 0603 2
4 100R R2 0603 1
5 ATtiny13A U6 SOP-8_150MIL 1
6 100n C3,C1 0603 2
7 47u C2 1206 1
8 10k R4 TC33X 1
9 EXT H1 HEADER_2X1 1
10 IR PHOTO DIODE LED2 PD-3MM/2.54 1
11 IR LED LED1 LED-3MM/2.54 1
12 LIR1220 B1 CR1220-SMD 1

Unfold

Project Attachments

Project Attachments

Empty
Project Members

Project Members

Target complaint
Related Projects
Change a batch
Loading...

Comment

Add to album ×

Loading...

reminder ×

Do you need to add this project to the album?

服务时间

周一至周五 9:00~18:00
  • 0755 - 2382 4495
  • 153 6159 2675

服务时间

周一至周五 9:00~18:00
  • 立创EDA微信号

    easyeda

  • QQ交流群

    664186054

  • 立创EDA公众号

    lceda-cn