Search for clock with ATtiny in Topics


ATTINY As A Clock?

Will using time library with an Attiny/45/85/84 ( http://playground.arduino.cc/Code/Time ) create an accurate clock? I keep on seeing people using these external crystal things. Do I need one? Isn't millis pretty dang accurate? How would I sync the clock with real time?

Topic by HavocRC    |  last reply


How to get an ATtiny to run an accurate clock? Answered

I'm making a clock with an ATtiny and I would like to know how to make it tell accurate time. I'm already pretty sure it would require an external crystal or resonator, but I just don't know the frequency or if there are any code requirements. I'll be programming the chip with an Arduino, if that helps with code. Thanks!

Question by GenAap    |  last reply


Ghetto programmer and 16Mhz

First off, Hello everyone. I built the ghetto parallel port programmer, adjusting the pinouts to work with a attiny26 and it works flawlessly.Kudos to the author.My problem is that when I drop in an external crystal rated at 16Mhz I avrdude quits because of a faulty signature; I assume this means the timings are off.At firs I thought I had misconfigured the fuses, but ,thankfully, when I dropped an 8Mhz crystal in it worked again. I know this uC can be clocked this high, so what's the problem? thanks

Topic by hacim  


Circuitry help needed - microcontroller in binary clock

Ok, so I am currently working on a project which involves some circuitry and programming. I am planning to make a simple binary watch. Now with my current plan I am planning on making 2-3 circuit boards depending on what I can get. The first circuit board will connect the leds for the time read. It will be a standard four column hour and minute binary clock readout. The second board will contain an ATtiny85 microcontroller, a 74HC595 8-bit shift register, two push buttons, two 10k ohm resistors, and four 220 ohm resistor. The third board will be glued to the bottom of the second board for the battery holder and some extra space to add wire tracing. Now I plan to design and etch my own pcb boards and solder them together. Though for the second and third board being glued together would add a bit of thickness so I am wondering if I can buy a dual sided pre-sensitized circuit board to etch?Thes plans are based off the work of another user on here, link to his clock below: https://www.instructables.com/id/Simple-Binary-Cl... Credit to him for this great and simple system. With my very limited knowledge and understanding of circuitry and programming, this is one of the most straightforward clocks I have found. This is general format I will try to follow, though I do wish to make some modifications to the circuit or program based on what is possible with the circuit setup. First I am concerned about the power consumption of the system and how I can reduce the supplied power to make it run on a watch battery and run for about a year if possible or longer. Second I know that adding a crystal oscillator can improve the accuracy of the clock by synchronizing the internal clock on a set frequency. So with that, how would I add a 16 Mhz crystal oscillator to the circuit? The program that is given in the project runs based on the internal 16 Mhz internal clock of the ATtiny85. Third question is what system works best to program the ATtiny85? I have a Raspberry Pi 3B+ and I also have Syper IDE and I am fairly good at programming with python. So could I program the ATtiny85 with my Raspberry pi and use python? Or would I have to use a different board and language to program the micocontroller?

Topic by Tman179    |  last reply


Circuitry help needed!

So I'm working on a project to build a binary clock style watch. I have found a fairly simple system to replicate though I plan to downsize the circuit to fit within roughly a 40x40mm area, the height I am not too concerned about right now. Here is the link to the project I plan to replicate:https://www.instructables.com/id/Simple-Binary-Clo...Now with the circuit presented I plan to break it into two boards(possibly three). The top board would utilize 2.8x3.2mm LED chips and connect them properly for the ATtiny and shift register. The second board would house the resistors, ATtiny, shift register, and buttons. It would connect to the LED board via vertical wires that would pass through the LED board and hold it directly above. On the bottom of the second board would be the battery holder and wires to directly connect the positive and negative leads to the needed inputs from the backside of the board. This would result in the second and third boards being back to back. (And I do plan on designing and etching my own boards for this project)So my questions for you are:I want to add a 16.000 Mhz crystal oscillator to the circuit to increase the accuracy of the internal clock of the ATtiny, so where would I add it in?How could I reduce the output power from the battery to run the system on minimal power so that my battery can last a year or longer?And is there such thing as a dual sided pre-sensitized pcb board I could use to make the circuits?

Question by Tman179    |  last reply


programming a stealth USB caps locker problems? Answered

I have a problem programming my stealth USB caps locker (link)  the PCB is ready, the components soldered on, and ive made connections to my ghetto programmer. now, i opened programmers notepad and wanted to program it, but now it just gives a whole load of errors: > "make.exe" program set -e; avr-gcc -MM -mmcu=attiny45 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.lst  -std=gnu99 main.c \     | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > main.d; \     [ -s main.d ] || rm -f main.d main.c:19:20: error: usbdrv.h: No such file or directory main.c:20:21: error: oddebug.h: No such file or directory Compiling: main.c avr-gcc -c -mmcu=attiny45 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.lst  -std=gnu99 main.c -o main.o In file included from main.c:16: c:/winavr-20090313/lib/gcc/../../avr/include/util/delay.h:85:3: warning: #warning "F_CPU not defined for " main.c:19:20: error: usbdrv.h: No such file or directory main.c:20:21: error: oddebug.h: No such file or directory main.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'reportBuffer' main.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'idleRate' main.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'reportCount' main.c:33: error: 'USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH' undeclared here (not in a function) main.c: In function 'buildReport': main.c:65: error: 'uchar' undeclared (first use in this function) main.c:65: error: (Each undeclared identifier is reported only once main.c:65: error: for each function it appears in.) main.c:65: error: expected ';' before 'key' main.c:68: error: 'reportCount' undeclared (first use in this function) main.c:69: error: 'key' undeclared (first use in this function) main.c:73: error: 'reportBuffer' undeclared (first use in this function) main.c: In function 'timerPoll': main.c:87: error: 'reportCount' undeclared (first use in this function) main.c: At top level: main.c:104: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'usbFunctionSetup' main.c: In function 'calibrateOscillator': main.c:143: error: 'uchar' undeclared (first use in this function) main.c:143: error: expected ';' before 'step' main.c:144: error: expected ';' before 'trialValue' main.c:149: error: 'trialValue' undeclared (first use in this function) main.c:149: error: 'step' undeclared (first use in this function) main.c:150: warning: implicit declaration of function 'usbMeasureFrameLength' main.c:157: error: 'optimumValue' undeclared (first use in this function) main.c: In function 'main': main.c:193: error: 'uchar' undeclared (first use in this function) main.c:193: error: expected ';' before 'i' main.c:194: error: expected ';' before 'calibrationValue' main.c:196: error: 'calibrationValue' undeclared (first use in this function) main.c:200: warning: implicit declaration of function 'odDebugInit' main.c:201: warning: implicit declaration of function 'usbDeviceDisconnect' main.c:202: error: 'i' undeclared (first use in this function) main.c:205: warning: implicit declaration of function 'usbDeviceConnect' main.c:211: warning: implicit declaration of function 'usbInit' main.c:215: warning: implicit declaration of function 'usbPoll' main.c:222: warning: implicit declaration of function 'usbInterruptIsReady' main.c:222: error: 'reportCount' undeclared (first use in this function) main.c:224: warning: implicit declaration of function 'usbSetInterrupt' main.c:224: error: 'reportBuffer' undeclared (first use in this function) make.exe: *** [main.o] Error 1 > Process Exit Code: 2 > Time Taken: 00:03 maybe its this: ""Download capslocker.hex and use AVR Studio or a standalone programming tool to write into the ATTiny45 Flash. Oh, you'll also need to select the fuse for PLL/1k clock source." thats what the maker of this thingie said, but what is the fuse for PLL/1k clock source? could it be that? when i use the .hex file, i get about the same. whats the problem? i didnt change anything.

Question by godofal    |  last reply


Programming help needed!

So I'm currently working on a project to build a binary clock style watch. I have found a pretty straight forward and simple project to replicate. The project does give a code to upload to an ATtiny85 so that the project will work. Now I noticed that he was programming his ATtiny with an Arduino board and I assume he used a different coding language than python(which is what I am familiar with). Here is the link to the project for more info:https://www.instructables.com/id/Simple-Binary-Clo...Now I have a Raspberry Pi 3B+, and I have Anaconda, Spyder, and Jupyter on my computer which I have used before to create standalone programs. My question is can I use my raspberry pi to program an ATtiny85 or would I need a different board to program it? And second how simple is it to program the ATtiny?

Question by Tman179    |  last reply


Help me make shiftOut faster (Arduino Function) Answered

I'm making a clock and I need an Attiny85 to output a "big" amount of data to a series of two shift registers. Using the shiftOut function that comes with the arduino lags the whole program down, making the clock annoying to the eye and reducing it's brightness.  I managed to reduce the lag a bit by substituting the digitalWrite functions from the whole program and creating a new function called shiftOutFast to replace the existing one, where I replaced two digitalWrite functions since I couldn't figure out much more.  void shiftOutFast(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val) {      for (i = 0; i < 8; i++)  {                                                 //could I change this to 16?            if (bitOrder == LSBFIRST)                  digitalWrite(dataPin, !!(val & (1 << i)));            else                       digitalWrite(dataPin, !!(val & (1 << (7 - i)))); //I guess here I should replace the 7 by a 15?                             PORTB |= _BV(PB0);                                         //there was a digitalWrite here            PORTB &= ~_BV(PB0);                                     //and also here (I believe this is called Port Manipulation)      } } This is the normal way I use the function, this whole operation is repeated 5 times, one for each digit position on the display and another one for the dots in the middle. As you can see I use it two times since shiftOut can only output 8 bits at a time. PORTB &= ~_BV(PB1); //latchPin low shiftOutFast(dataPin, clockPin, MSBFIRST, 8); //the values for the second shift register are sent first, this determines the digit that will be lit (1,2,3,4th position or the dots) shiftOutFast(dataPin, clockPin, MSBFIRST, numbers2[m]); //then pushed in place by the first one, this determines the number PORTB |= _BV(PB1); //LatchPin high //maybe I could reduce it to only one shiftOutFast (see 2nd question) I've reached the apex of what my programming skills can let me do, so I'll just simply ask two questions: Can I further optimize this function? I could remove the if since I won't be using the LSBFIRST If I changed the 8 by a 16 and the 7 by a 15 at the "for" inside the shiftOutFast function written above, could I reduce the use to only one function sending the 16 bits? Here's the whole program for the clock for further reference (this is actually a timer since attiny's aren't reliable when counting time) I would be extremely grateful if you found some way to optimize it or sent me a hint or two. http://pastebin.com/REcvbNhy Thank you!

Question by Victor805    |  last reply