So the idea:
- Pick an MCU (in my case it is an ATTINY85)
- A three digit LED display to see the beats per minute
- Two buttons to change the speed
- Four LEDs (in my case four RGB LEDs to be able to change the color from code)
- Power Supply, and the usual things needed for such circuit.
If you check the things above, you can quickly realize, that there is not a chance to drive the things above from an ATTINY85.
Here come into the picture an article I wrote earlier: http://pakahuszar.blogspot.hu/2018/01/tm16xx-arduino-library.html
The library I wrote for the Titan Microelectronics display drivers originally made for this project. So you can add a TM1637 to the picture above. It able to drive 6x8 LED segments, plus read 2x6 buttons. It is more than enough for LEDs, display, and the buttons.
After writing the library, the actual code of the Metronome was quite simple.
First I built the whole thing on breadboard, but using an Arduino UNO instead of the ATTINY85:
After the successfull test, I designed and ordered the board for it.
It arrived in a week:
Started to populate it - here comes the problems:
- I chosen a wrong size package for the ATTINY85, so I have to bend the pins to be able to solder in
- The micro USB connector wasn't far enough from the edge
- The 3.5 Jack had two missing holes.
Those was easily correctable.
So the build (without the display):
After resoldering the ATTINY for a few times, I was able to download the code, but nothing appeared on the display or the LEDs.
Scratching my head. Then I realized, that the ISP connector has all of the pins required to drive the TM1637. So I connected this external display to it:
It was working.
I started to measure the board, and instantly realized the problem.
The VCC and GND pins of the TM1637 was swapped. How this happened?
I mirrored the TM1637 part in the KiCAD. After this the GND pin went to the top of the drawing and the VCC to the bottom. After this I connected the power pins as usual. The VCC to the top and the GND to the bottom. IDIOT!!!!
I categorized this error as uncorrectable, So I made some design changes: the three issues from above and this, plus added the pinout table for the ISP.
New order, one week waiting, board arrived:
Built it once more.
There were some numbers on the display, but it didn't work as expected. I realized two more design errors:
- The display anodes were swapped so the number was readable from right to left
- The LEDs didn't lid - It was rotated by 180 degrees
Rewrote the code for the display, desoldered the LEDs and added new ones rotated (those LEDs are unable to withstand the heat fro the heathgun)
Now it is working as expected.
In the meantime I designed and printed the plastic box:
The mounting hardware still need some work, but the device is working now:
There are a few comments to add:
- The mounting hardware still need some work, so you can expect some writing about it
- The two currently used buttons also has remote capability through a 3.5mm Jack. The external buttons drive the internal ones through optocouplers. This is not isolated just there for providing some noise immunity.
- There are place on the board for crystal. I don't know if such precision is required, but I didn't populated yet.
I'm thinking about selling this device if somebody is interested in. I try to find out if there is demand for such device. I've a few idea for further development. If you have suggestions regarding this please leave it in the comment.