Search for binary clock in Topics


Binary clock, anyone?

Hi, anyone knows how to do something like: http://www.thinkgeek.com/homeoffice/lights/59e0/Thanks

Topic by leech    |  last reply


Binary Arduino Alarm Clock HELP!

I am currently working on THIS INSTRUCTABLE:https://www.instructables.com/id/Arduino-Binary-Alarm-Clock/ I have had to modify the libraries to work with IDE 1.0 and newer because this was written 5 years ago. I'm using a push button momentary switch instead of the capacitive sensor for the snooze button. I've got everything working except for the Alarm/snooze. For some reason, the speaker is constantly beeping a high, then low tone, as though the snooze button is being held down, even when I completely disconnect the snooze button from the clock. Can anyone give me any ideas how to fix this problem? Here is my modified button code: void update_buttons_state() {   hour_button_state    = digitalRead(hour_button_pin);   minute_button_state  = digitalRead(minute_button_pin);   setTime_button_state = digitalRead(setTime_button_pin);   setAlarm_button_state = digitalRead(setAlarm_button_pin);   snooze_button_state = digitalRead(snooze_button);     } // "INTERNAL" VARIABLES FOR BUTTONS FUNCTION: boolean first_time_hour = true;   // these are used to make sure that the hours boolean first_time_minute = true; // and minutes only is increased once every keypress. unsigned long snooze_button_timer; // used to keep track of how long the snooze button has                                    // been held down. when the button has been held down                                    // a certain amount of time, the alarm will be turned                                    // of completely. void buttons() {   // LOW == button pressed   // HIGH == button released   // (this is because pullup resistors is used)     // Decide if we should set time or alarm:   // (this also makes the display show the alarm time)   if(setAlarm_button_state==LOW) // LOW = Set time   {     hours_p = &alarm;_hours;     minutes_p = &alarm;_minutes;   } else if(setTime_button_state==LOW) // LOW = Set Alarm   {     hours_p = &hours;     minutes_p = &minutes;   }   // If hour button is pressed, increase hours:   if(hour_button_state==LOW && first_time_hour) // only increase the hours once   {                                             // every button press.     if(*hours_p < 23)       (*hours_p)++;     else       *hours_p = 0;         first_time_hour = false;          }   else if(hour_button_state==HIGH)   {     first_time_hour = true; // reset when button is released,   }                         // so that the next press will be registerd.     // If minute button is pressed, increase minutes:   if(minute_button_state==LOW && first_time_minute) // only increase the minutes   {                                                 // once every button press.     if(*minutes_p < 59)       (*minutes_p)++;     else       *minutes_p = 0;           first_time_minute = false;   }   else if(minute_button_state==HIGH)   {     first_time_minute = true; // reset when button is released,   }                           // so that the next press will be registerd.     if(snooze_button_state==LOW)   {     if(signal_on)     {       // set the time when the alarm signal will start again,       // this will give 10 minutes snooze:       if(minutes<50)       {         snooze_off_minutes = minutes+10;         snooze_off_hours = hours;       }       else       {         snooze_off_minutes = minutes - 50;         snooze_off_hours = hours + 1;       }       snooze_on = true;       signal_on = false;     }     // if the snooze button has been held down for more than 3 seconds turn off/on the alarm     if((millis() - snooze_button_timer) > 5000)     {       if(alarm_on) // if on, turn off       {         signal_on = false;         alarm_on = false;         snooze_on = false;         // play tone so the user know the alarm turned off:         tone_maker.play(NOTE_A3, 100);       }       else if(alarm_on==false) // if off, turn on       {         alarm_on = true;         // play tone so the user know the alarm turned off:         tone_maker.play(NOTE_A7, 100);       }       //reset the snooze button timer       snooze_button_timer=millis();     }       }   else   {     //reset the snooze button timer     snooze_button_timer=millis();   } }

Topic by holidayv  


binary clock runs to slow, how do i speed it up? Answered

I made a binary clock from an instructable on this site: https://www.instructables.com/id/Binary-Marble-Clock/ but it turns out it runs WAY to slow.i wanted to know how good it ran, so i made the time 23:29 (current time then) and went to sleep. at 09:45 (not extactly) the clock gave about 00:30how do i make sure it runs like it should? couse now its being used as a light decoration...

Question by godofal    |  last reply


Is there anyway that someone could make me a .hex file from this .asm, or at least tell me how?

Hey, I have a .asm file. I have tried MPLAB, but I am not doing it right. ;-----------------------------------------------------------------------; ; BINCLOCK.ASM A clock that displays in bcd numbers ; ;-----------------------------------------------------------------------;         LIST P=16F84 ; tells which processor is used         INCLUDE "p16f84.inc" ; defines various registers etc. Look it over.         ERRORLEVEL -224 ; supress annoying message because of tris         __CONFIG _PWRTE_ON & _LP_OSC & _WDT_OFF ; configuration switches             CBLOCK 0CH                 sec ; seconds digit                 sec10 ; 10's of second digit                 mins ; minutes digit                 min10 ; 10's of minutes digit                 hr ; hours digit                 hr10 ; 10's of hours digit                 w_temp ; holds W during interrupt                 status_temp ; holds STATUS during interrupt                 fsr_temp ; holds FSR during interrupt                 button ; holds mask for pushbuttons               ENDC ;-----------------------------------------------------------------------; ; Here are some DEFINEs which give 'names' to pushbutton port bits ; ;-----------------------------------------------------------------------;             #DEFINE SETPB PORTB, 4             #DEFINE SELECTPB PORTB, 5             #DEFINE SHOWPB PORTB, 6             ORG 0 ; start at location 0             goto main ; jump over to main routine ORG 4 goto isr ; jump to interrupt routine ;-----------------------------------------------------------------------; ; High limit + 1 of digits at position W ; ;-----------------------------------------------------------------------; sethi: addwf PCL, f dt H'A',H'6',H'A',H'6',H'A',H'3' ;-----------------------------------------------------------------------; ; Delay routines ; ;-----------------------------------------------------------------------; msec250: ; enter here to delay for 250 milliseconds movlw D'250' nmsec: ; delay for # msec in W on entry nop ; each nop is 0.122 milliseconds nop nop ; each total loop is 8 X 0.122 = 0.976 msec nop addlw H'FF' ; same as subtracting 1 from W btfss STATUS, Z ; skip if result is zero goto nmsec ; this is 2 X 0.122 msec return ; back to calling point ;-----------------------------------------------------------------------; ; Delay for one second ; ;-----------------------------------------------------------------------; onesecond: ; a subroutine that delays for 1 seconds call msec250 call msec250 call msec250 call msec250 return ;-----------------------------------------------------------------------; ; Put value in W on LEDs for 1 second ; ;-----------------------------------------------------------------------; sendnbr: movwf PORTB ; light LEDs call onesecond ; wait 1 second clrf PORTB ; clear the LEDs movlw D'100' ; pause for 0.1 sec call nmsec return ;-----------------------------------------------------------------------; ; Send the current time out LEDs ; ;-----------------------------------------------------------------------; disptime: movf hr10, W call sendnbr movf hr, W call sendnbr movf min10, W call sendnbr movf mins, W call sendnbr return ;-----------------------------------------------------------------------; ; Wait until selected button is released ; ;-----------------------------------------------------------------------; waitup6: ; wait for show pushbutton up movlw B'01000000' ; RB6 mask movwf button goto wait waitup5: ; wait for select pushbutton up movlw B'00100000' ; RB5 mask movwf button goto wait waitup4: ; wait for set pushbutton up movlw B'00010000' ; RB4 mask movwf button wait: movf button, W ; mask into W andwf PORTB, W btfsc STATUS, Z ; skip if not zero (released) goto wait movlw D'10' call nmsec ; wait 10 msec for debounce movf button, W ; check for release again andwf PORTB, W btfsc STATUS, Z ; skip if selected button released goto wait return ; yes, finished ;-----------------------------------------------------------------------; ; Initilization Subroutine ; ;-----------------------------------------------------------------------; init: movlw B'0000000' ; all outputs port A tris PORTA movlw B'01110000' ; RB4 - RB6 inputs, others outputs tris PORTB ; on port B movlw H'0' ; all low (off) movlw PORTB movlw B'00000100' ; pull-ups enabled ; prescaler assigned to TMR0 ; prescaler set to 1:32 ; rolls over each second option movlw 0 movwf hr10 movlw H'9' ; initialize hrs, mins and secs movwf hr ; Do this before interrupts are movlw H'5' ; turned on because isr also acts movwf min10 ; on these registers movlw H'0' movwf mins movwf sec10 movwf sec movlw B'10100000' ; GIE & T0IE set, T0IF cleared movwf INTCON return ;-----------------------------------------------------------------------; ; Interrupt routine, increments time by one second (BCD) ; ;-----------------------------------------------------------------------; isr: movwf w_temp ; save W swapf STATUS,W ; save status movwf status_temp ; without changing flags swapf FSR,W ; save FSR movwf fsr_temp ; without changing flags movlw sec ; point at sec register movwf FSR newdigit: incf INDF, f ; current digit up one movlw sec ; get difference between sec and FSR subwf FSR, W call sethi ; use to get high limit + 1 subwf INDF, W ; reached that number yet? btfss STATUS, Z ; skip over if yes goto restore ; else exit isr clrf INDF ; set current digit to 0 incf FSR, f ; point at next digit btfss hr10, 1 ; has hr10 reached 2? goto newdigit ; no, increment the next digit btfss hr, 2 ; has hr reached 4? goto newdigit ; no clrf hr ; yes, set hour to 00 clrf hr10 ; and hour 10 restore: swapf status_temp,W ; get original status back movwf STATUS ; into status register swapf fsr_temp,W ; get original fsr back movwf FSR ; into status register swapf w_temp,f ; old no flags trick again swapf w_temp,W ; to restore W bcf INTCON,T0IF ; clear the TMR0 interrupt flag retfie ; finished reset GIE ;-----------------------------------------------------------------------; ; Increment and display digit pointed to by FSR ; ;-----------------------------------------------------------------------; updigit: incf INDF, f ; selected digit up one movlw mins ; set up to subtract mins address subwf FSR, W ; from address of current digit call sethi ; get maximum of digit + 1 into W subwf INDF, W ; is it = to current digit value? btfsc STATUS, Z ; gives zero if yes, skip if no clrf INDF ; reset value of digit to zero movf INDF, W ; get current value and .. movwf PORTB ; display it call onesecond ; pause for 1 second return ;-----------------------------------------------------------------------; ; increment selected digit until select pressed ; ;-----------------------------------------------------------------------; setdigit: movwf PORTB btfss SETPB ; set pressed? call updigit ; yes btfsc SELECTPB ; check if select pressed goto $ -3 ; repeat till select pressed again call waitup5 ; make sure select released incf FSR, f return ;-----------------------------------------------------------------------; ; Select and increment digits ; ;-----------------------------------------------------------------------; select: bcf INTCON, GIE ; no interrupts while setting time movlw mins ; point at minutes register movwf FSR call waitup5 ; wait on select pushbutton up movlw B'00000001' ; light right LED (mins) call setdigit movlw B'00000010' ; light min10 LED call setdigit movlw B'00000100' ; light hr LED call setdigit movlw B'00001000' ; hr10 LED on call setdigit clrf PORTB ; clear LEDs bsf INTCON, GIE ; enable interrupts again return ;-----------------------------------------------------------------------; ; The main routine ; ;-----------------------------------------------------------------------; main: call init ; set up initial conditions loop: btfss SHOWPB ; check for show pushbutton call disptime ; display the time btfss SELECTPB ; check for select call select goto loop ; do forever end     

Question by 16zzundel5    |  last reply


Binary Clock-LED not working, why?

I followed about everything on this plan https://www.instructables.com/image/FZQILLUFIM95W1L/Schematic-And-Parts.jpg But Instead I used a 555 in astable to run about 1Hz. I already tested the 555 on a individual led and it worked. Now I finally completed my work and my leds are not lighting up. I believe I should remove the resistor since the max output of the counter is only about 4mA so I would be limiting my current, ALOT. The thing is, I tested every LEDS with a multimeter both including resistors and not and they are all lighting up all fine, but when I install my counter, see that the led are not working and I try to make a diode test, they doesn't light up at all. I need to remove the counter in order to be able to light them up. What is the solution and why? Is it sinking current? But it design is not to sink, but to source..... Help please, thanks.

Question by sxdemon    |  last reply


What helps an instructable get featured?

I created my first instructable a week back which is a binary clock: https://www.instructables.com/id/Cwik-Clock-v10-An-Arduino-Binary-Clock/ I was hoping to get it featured as I thought it added on to the regular binary clock formula (using potentiometers, and analog meter, focusing on accuracy, etc.). Today I saw a binary clock get featured (this one https://www.instructables.com/id/Connect-4-Binary-Clock/ ) which actually uses my code (which I put that code in public domain), and only has a subset of the features mine does. I'm trying not to be a bit jealous here :P. For the future, what helps an instructable be featured? Thanks, Dennis

Topic by cwik    |  last reply


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


how to display time with 6 I/O lines? ( I want to build an at tiny 13 watch ) Answered

What kind of binary clock can I build with 6 LEDs? If I had 13 I could have done a normal binary clock, but charliplexing seems complicated... anybody with a brilliant idea?

Question by bzhwindtalker    |  last reply


Convert "C" code in to hex

Hello I want to built this binary watch but the code is in "C" here is code and i dont know to programm with this kind of code,cam someone convert the code in to hex please,and the micrchip is PIC16F688.

Question by macobt    |  last reply


Microcontroller help!

So I'm working on a project to build a binary clock style watch, though I have very limited experience and knowledge about circuitry and microcontrollers. As of right now I have found a relatively simple project on this site I wish to replicate and downsize to fit in the size of a watch. The design of the circuit is based off the layout in this project:https://www.instructables.com/id/Simple-Binary-Clo...Now I have read up on microcontrollers and microprocessors. I also read some stuff about oscillators and how they can work to essentially synchronize the internal clocks of microcontrollers making them more accurate for clock uses. First is this true that a crystal oscillator can improve the accuracy of a microcontroller? And if so, how could I add a 16.000 Mhz crystal oscillator to the circuit presented above? (I want to use a 16.000 Mhz oscillator because the code written for the microcontroller is based on the 16 Mhz internal clock, so this should line up fine)Thanks if you can answer these questions!

Topic by Tman179    |  last reply


what diodes do i need? Answered

I made a litle schematic (picture is in paint) as an extra for my binary clock, since the wart is a litle bit to handy (i can reverse polarity) and i dont want to destroy my precious attiny2313, so i thought of of some diodes and made a plan. but, i had 4 zenerdiodes lying around, and i tried it, but nothing happened, the clock didnt power on. i think the diodes are to heavy, so i was wondering which ones i needed. its all in the scheme and i think its pretty obvious (i made it in paint, so the quality isnt good, as wel as my english :P)

Question by godofal    |  last reply


Is there a way to decompile iPhone apps? Answered

I was wondering if there was a way to decompile apps on the iPhone that were made by apple (Clock, Calender, Stocks, etc.) in order to get the Obj-C source code (or any editable code if you cant get the Obj-C).  I can ssh into it to get the binaries, but dont know how to decompile them.  any help would be great.  Thanks.

Question by budabob07    |  last reply


LED-shirt v2.0 on its way!

Hey Instructablonians! So after thinking about it for a while, I realized that my original Beating Heart T-shirt was a bit.... restrictive... as to what you could display on your glorious torso. As a result, I decided to embark on a journey to make a fully programmable 14X7 LED array display on a t-shit, which I call LED-shirt v2.0! Also, since I was making this portable and re-programmable, I figured that you should be able to go everywhere and still have some nerd "bling", so I included a charlieplexed LED binary clock. I drew up the schematic on eagle, routed the board, etched it, drilled it, stuffed it, programmed the binary clock, then soldered ALL of the crimp beads onto all 91 LEDs and female header (it's got to be detachable). I tried sewing some of the LEDs on via a sewing machine, but I bought the wrong thickness conductive thread, and the machine kept jamming. Then I tried by hand, and it just takes too long v_v. (I'm using Leah Buechley's method)I'm going to order the thinner thread and find someone with a sewing machine they're willing to lend me. Until then, I have this awesome blue binary clock that I can carry around with me!Oh, it's atmega168-based, runs @ 12MHz, and as of now runs off of 3 AA's, but I have plans to make it LI-ion compatible. Also, I have to thank Zach for the idea to make the 14X7 matrix - it's really a demi-charlieplexed 7x7 array.Oh, and if you were wondering, that's an aluminum rod w/ a captive ring next to the battery pack. I love lathes.-Muffin

Topic by T3h_Muffinator    |  last reply


Anelace, Inc. - A glowing review

I hadn't even heard of this company before today, and I'm quite impressed with them. Anelace, Inc. makes those lovely binary LED clocks and distributes them to resellers. I got one of their "Crystal Blue" clocks under the Discovery Channel Store name five or six years ago as a birthday present, and recently one of the LEDs failed. Since they're surface-mount LEDs, I was having difficulty figuring out which of the hundreds of items on the dozens of pages in the DigiKey catalog to order, so I quickly found the manufacturer (Anelace) through Google and fired off an email hoping for information about the LED specs. I sent this email at 9:33 this morning. At 11:59, I received a reply from "Lyle" saying that it was unusual for two LEDs to fail in this fashion, and he wanted to mail me a new clock, and have me send back the mainboard from the old one so they could test it. Even after I explained that only one of the LEDs had actually failed, and I had clumsily crushed the other with a too-large caliper, he still wants to send me a new clock. I find this amazing for a number of reasons: Very prompt reply. I'm used to waiting days for customer service to get back to me. Under two and a half hours is phenomenal. Personal reply. This guy actually read my email and responded to it, rather than simply sending back a form letter. Interest in the problem. Rather than just sending me a new one to shut me up, they want to know what went wrong. As Lyle put it, "I'd like to see if there is anything we can learn to improve our design/quality/reliability." This one's the biggie. They want me to take it apart. In a world of epoxy-sealed cases and more security screws than anyone can keep track of, he was even willing to send me instructions on how to pull out the circuit board. I'm not writing this to encourage people to try to bum clocks off this company; rather, I'm writing this to encourage people to support them. Anelace doesn't sell these clocks directly, but there are several retailers that do. Consider this my unpaid endorsement of a customer-friendly and personable company.

Topic by CameronSS    |  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


Problem in arduino code... you'll have to run this one to understand - Word Clock? Answered

I have been writing this code for the Word clock. I am trying to customize the code to fit into an atmega8, and use DS1307 RTC. Both of these is fine, but what is wrong is that when I upload my code and try to set the time by using the buttons, the time is not setting properly. I can increment minutes with the minutes button to 16, but not further. Hours works fine, but if, lets say the time is 6:36 on the arduino, then If I press the hour button, I find that time changes to 7:31. Five minutes less than what I expected. What am I overlooking here?  I advise to run the code and understand the problem. On the other hand Binary sketch size: 7164 bytes (of a 7168 byte maximum), this is just 4 bytes short of max. Can that be a part of the problem Code: #include // Display output pin assignments #define MTEN  Display1=Display1 | (1<<0)  #define HALF Display1=Display1 | (1<<1) #define QUARTER Display1=Display1 | (1<<2) #define TWENTY Display1=Display1 | (1<<3) #define MFIVE Display1=Display1 | (1<<4) #define MINUTES Display1=Display1 | (1<<5) #define PAST Display1=Display1 | (1<<6) #define UNUSED1 Display1=Display1 | (1<<7) #define TO Display2=Display2 | (1<<0) #define ONE Display2=Display2 | (1<<1) #define TWO Display2=Display2 | (1<<2) #define THREE Display2=Display2 | (1<<3) #define FOUR Display2=Display2 | (1<<4) #define HFIVE Display2=Display2 | (1<<5) #define SIX Display2=Display2 | (1<<6) #define UNUSED2 Display2=Display2 | (1<<7) #define SEVEN Display3=Display3 | (1<<0) #define EIGHT Display3=Display3 | (1<<1) #define NINE Display3=Display3 | (1<<2) #define HTEN Display3=Display3 | (1<<3) #define ELEVEN Display3=Display3 | (1<<4) #define TWELVE Display3=Display3 | (1<<5) #define OCLOCK  Display3=Display3 | (1<<6) #define UNUSED3 Display3=Display3 | (1<<7) #define DS1307_I2C_ADDRESS 0x68  // This is the I2C address #if defined(ARDUINO) && ARDUINO >= 100   // Arduino v1.0 and newer   #define I2C_WRITE Wire.write   #define I2C_READ Wire.read #else                                   // Arduino Prior to v1.0   #define I2C_WRITE Wire.send   #define I2C_READ Wire.receive #endif int  hr=12, mn=00, scnd=0; static unsigned long msTick =0;  // the number of Millisecond Ticks since we last                                  // incremented the second counter int  count; boolean selftestmode; boolean  DS1307Present=false;       // flag to indicate that the 1307 is there..    1 = present char Display1=0, Display2=0, Display3=0; // hardware constants static unsigned int LEDClockPin=5;    //11 d5 ok static unsigned int LEDDataPin=3;    //5 d3 static unsigned int LEDStrobePin=4;   //6 d4 static unsigned int MinuteButtonPin=6;  //d6 12 static unsigned int HourButtonPin=7;    //d7 13 static unsigned int PWMPin = 11; char buf[50]; // time output string for debugging byte decToBcd(byte b) {  return ( ((b/10) << 4) + (b%10) );} // Convert binary coded decimal to normal decimal numbers byte bcdToDec(byte b) {  return ( ((b >> 4)*10) + (b%16) );} void getTime() {   //read from chip and store in hr, mn, scnd   Wire.beginTransmission(DS1307_I2C_ADDRESS);   I2C_WRITE((uint8_t) 0x00);   Wire.endTransmission();     Wire.requestFrom(DS1307_I2C_ADDRESS, 3);   scnd = bcdToDec(I2C_READ());   mn =  bcdToDec(I2C_READ());   hr =  bcdToDec(I2C_READ()); } void setTime() {   //to be paranoid, we're going to first stop the clock   //to ensure we don't have rollovers while we're   //writing:   writeRTCreg(0,0x80);   //now, we'll write everything *except* the second   Wire.beginTransmission(DS1307_I2C_ADDRESS);   I2C_WRITE((uint8_t) 0x01);   I2C_WRITE(mn);   I2C_WRITE(hr);   Wire.endTransmission();   //now, we'll write the seconds; we didn't have to keep   //track of whether the clock was already running, because   //scnd already knows what we want it to be. This   //will restart the clock as it writes the new seconds value.   writeRTCreg(0,scnd); } byte readRTCreg(byte adr) {    if(adr > 0x3F) { return 0xff; }   Wire.beginTransmission(DS1307_I2C_ADDRESS);   I2C_WRITE(adr);   Wire.endTransmission();   Wire.requestFrom(DS1307_I2C_ADDRESS, 1);   return I2C_READ(); } void writeRTCreg(byte adr, byte val) { if(adr > 0x3F) { return; }    Wire.beginTransmission(DS1307_I2C_ADDRESS);    I2C_WRITE(adr);    I2C_WRITE(val);    Wire.endTransmission(); } void print_DS1307time() {   /* Format the time and date and insert into the temporary buffer */   snprintf(buf, sizeof(buf), "RTC time: %02d:%02d:%02d",   hr, mn, scnd);   /* Print the formatted string to serial so we can see the time */   Serial.println(buf); } void setup() {   // initialise the hardware   // initialize the appropriate pins as outputs:   pinMode(LEDClockPin, OUTPUT);   pinMode(LEDDataPin, OUTPUT);   pinMode(LEDStrobePin, OUTPUT);       //pinMode(BrightnessPin, INPUT);   pinMode(MinuteButtonPin, INPUT);   pinMode(HourButtonPin, INPUT);   digitalWrite(MinuteButtonPin, HIGH);  //set internal pullup   digitalWrite(HourButtonPin, HIGH); //set internal pullup   pinMode(PWMPin, OUTPUT);     Serial.begin(9600);   Wire.begin();    // test whether the DS1302 is there   Serial.print("Verifying DS1307 ");   // start by verifying that the chip has a valid signature   if (readRTCreg(0x20) == 0x55) {     // Signature is there - set the present flag and mmove on     DS1307Present=true;     Serial.println("Valid Signature");   }   else   {     // Signature isnt there - may be a new chip -     //   do a write to see if it will hold the signature     writeRTCreg(0x20,0x55);     if (readRTCreg(0x20) == 0x55) {       // We can store data - assume that it is a new chip that needs initialisation /*      // Start by clearing the clock halt flag.           //"Bit 7 of register 0 is the clock halt (CH) bit.           //When this bit is set to a 1, the oscillator is disabled."             byte _reg0_sec = decToBcd(scnd);             _reg0_sec = _reg0_sec & ~0x80;             writeRTCreg(0,_reg0_sec); */       // Set the time and date on the chip       scnd = 0;       mn = 0;       hr = 12;       setTime();       // set the DS1302 present flag       DS1307Present=true;       Serial.println("present - new chip initialised.");     }     else  Serial.println("absent");   }    msTick=millis();      // Initialise the msTick counter     selftest();   selftestmode=false;   if (DS1307Present) {     // Get the current time and date from the chip    getTime();     }     displaytime();        // display the current time } void ledsoff(void) { Display1=0; Display2=0; Display3=0; } void WriteLEDs(void) { // Now we write the actual values to the hardware shiftOut(LEDDataPin, LEDClockPin, MSBFIRST, Display3); shiftOut(LEDDataPin, LEDClockPin, MSBFIRST, Display2); shiftOut(LEDDataPin, LEDClockPin, MSBFIRST, Display1); digitalWrite(LEDStrobePin,HIGH); delay(2); digitalWrite(LEDStrobePin,LOW); } void selftest(void){   Serial.print("TEST");   analogWrite(PWMPin, 255);     ledsoff(); MTEN; WriteLEDs(); delay(500);   ledsoff(); HALF; WriteLEDs(); delay(500);   ledsoff(); QUARTER; WriteLEDs(); delay(500);   ledsoff(); TWENTY; WriteLEDs(); delay(500);   ledsoff(); MFIVE; WriteLEDs(); delay(500);   ledsoff(); MINUTES; WriteLEDs(); delay(500);   ledsoff(); PAST; WriteLEDs(); delay(500);   ledsoff(); TO; WriteLEDs(); delay(500);   ledsoff(); ONE; WriteLEDs(); delay(500);   ledsoff(); TWO; WriteLEDs(); delay(500);   ledsoff(); THREE; WriteLEDs(); delay(500);   ledsoff(); FOUR; WriteLEDs(); delay(500);   ledsoff(); HFIVE; WriteLEDs(); delay(500);   ledsoff(); SIX; WriteLEDs(); delay(500);   ledsoff(); SEVEN; WriteLEDs(); delay(500);   ledsoff(); EIGHT; WriteLEDs(); delay(500);   ledsoff(); NINE; WriteLEDs(); delay(500);   ledsoff(); HTEN; WriteLEDs(); delay(500);   ledsoff(); ELEVEN; WriteLEDs(); delay(500);   ledsoff(); TWELVE; WriteLEDs(); delay(500);   ledsoff(); OCLOCK; WriteLEDs(); delay(500); } void displaytime(void){   // start by clearing the display to a known state   ledsoff();     Serial.print("It is ");   // now we display the appropriate minute counter   if ((mn>4) && (mn<10)) {     MFIVE;     MINUTES;     Serial.print("Five Minutes ");   }   if ((mn>9) && (mn<15)) {     MTEN;     MINUTES;     Serial.print("Ten Minutes ");   }   if ((mn>14) && (mn<20)) {     QUARTER;       Serial.print("Quarter ");   }   if ((mn>19) && (mn<25)) {     TWENTY;     MINUTES;     Serial.print("Twenty Minutes ");   }   if ((mn>24) && (mn<30)) {     TWENTY;     MFIVE;     MINUTES;     Serial.print("Twenty Five Minutes ");   }    if ((mn>29) && (mn<35)) {     HALF;     Serial.print("Half ");   }   if ((mn>34) && (mn<40)) {     TWENTY;     MFIVE;     MINUTES;     Serial.print("Twenty Five Minutes ");   }    if ((mn>39) && (mn<45)) {     TWENTY;     MINUTES;     Serial.print("Twenty Minutes ");   }   if ((mn>44) && (mn<50)) {     QUARTER;     Serial.print("Quarter ");   }   if ((mn>49) && (mn<55)) {     MTEN;     MINUTES;     Serial.print("Ten Minutes ");   }   if (mn>54) {     MFIVE;     MINUTES;     Serial.print("Five Minutes ");   }   if ((mn <5))   {     switch (hr) {     case 1:       ONE;       Serial.print("One ");       break;     case 2:       TWO;       Serial.print("Two ");       break;     case 3:       THREE;       Serial.print("Three ");       break;     case 4:       FOUR;       Serial.print("Four ");       break;     case 5:       HFIVE;       Serial.print("Five ");       break;     case 6:       SIX;       Serial.print("Six ");       break;     case 7:       SEVEN;       Serial.print("Seven ");       break;     case 8:       EIGHT;       Serial.print("Eight ");       break;     case 9:       NINE;       Serial.print("Nine ");       break;     case 10:       HTEN;       Serial.print("Ten ");       break;     case 11:       ELEVEN;       Serial.print("Eleven ");       break;     case 12:       TWELVE;       Serial.print("Twelve ");       break;     }   OCLOCK;   Serial.println("O'Clock");   }   else     if ((mn < 35) && (mn >4))     {       PAST;       Serial.print("Past ");       switch (hr) {     case 1:       ONE;       Serial.println("One ");       break;     case 2:       TWO;       Serial.println("Two ");       break;     case 3:       THREE;       Serial.println("Three ");       break;     case 4:       FOUR;       Serial.println("Four ");       break;     case 5:       HFIVE;       Serial.println("Five ");       break;     case 6:       SIX;       Serial.println("Six ");       break;     case 7:       SEVEN;       Serial.println("Seven ");       break;     case 8:       EIGHT;       Serial.println("Eight ");       break;     case 9:       NINE;       Serial.println("Nine ");       break;     case 10:       HTEN;       Serial.println("Ten ");       break;     case 11:       ELEVEN;       Serial.println("Eleven ");       break;     case 12:       TWELVE;       Serial.println("Twelve ");       break;       }     }     else     {       // if we are greater than 34 minutes past the hour then display       // the next hour, as we will be displaying a 'to' sign       TO;       Serial.print("To ");       switch (hr) {       case 1:         TWO;        Serial.println("Two ");        break;       case 2:         THREE;       Serial.println("Three ");         break;       case 3:         FOUR;       Serial.println("Four ");         break;       case 4:         HFIVE;       Serial.println("Five ");         break;       case 5:         SIX;       Serial.println("Six ");         break;       case 6:         SEVEN;       Serial.println("Seven ");         break;       case 7:         EIGHT;       Serial.println("Eight ");         break;       case 8:         NINE;       Serial.println("Nine ");         break;       case 9:         HTEN;       Serial.println("Ten ");         break;       case 10:         ELEVEN;       Serial.println("Eleven ");         break;       case 11:         TWELVE;       Serial.println("Twelve ");         break;       case 12:         ONE;       Serial.println("One ");         break;       }     }    WriteLEDs();    } void incrementtime(void){   // increment the time counters keeping care to rollover as required   scnd=0;   if (++mn >= 60) {     mn=0;     if (++hr == 13) {       hr=1;      }   }    // debug outputs   Serial.println(); //  if (DS1307Present) //  print_DS1307time(); //  else{ //  Serial.print("Arduino Time: " );   Serial.print(hr);   Serial.print(":");   Serial.print(mn);   Serial.print(":");   Serial.println(scnd); //  } } void loop(void) {     //selftest(); int aread = sq(analogRead(3)/4)+3;   //Uncomment the following line and comment the next one in order to   //  enable dimming via a potentiometer connected to pin 0:   analogWrite(PWMPin, aread>255 ? 255:aread);   //analogWrite(PWMPin, 255);       // heart of the timer - keep looking at the millisecond timer on the Arduino     // and increment the seconds counter every 1000 ms     if ( millis() - msTick >999) {         msTick=millis();         scnd++; /*        // Flash the onboard Pin13 Led so we know something is hapening!         digitalWrite(13,HIGH);         delay(100);         digitalWrite(13,LOW);    */    }                 //test to see if we need to increment the time counters     if (scnd==60)     {       incrementtime();       displaytime();     } if (DS1307Present) {     // Get the current time and date from the chip      getTime();     }     // test to see if a forward button is being held down     // for time setting     if ( (digitalRead(MinuteButtonPin) ==0 ) && scnd!=1)       // the forward button is down       // and it has been more than one second since we       // last looked     {       mn=(((mn/5)*5) +5);       scnd=0;       incrementtime();       scnd++;  // Increment the second counter to ensure that the name       // flash doesnt happen when setting time       if (DS1307Present) {       // Set the time on the chip       setTime();     }     delay(100);       displaytime();     }     // test to see if the back button is being held down     // for time setting     if ((digitalRead(HourButtonPin)==0 ) && scnd!=1)     {       /*       minute=(((minute/5)*5) -5);       second=0; // decrement the minute counter       if (minute<0) {         minute=55;         if (--hour <0) hour=12;       }       */             mn = (mn/5)*5;  //round minute down to previous 5 min interval       if (++hr == 13) {         hr=1;        }       incrementtime();       scnd++;  // Increment the second counter to ensure that the name       // flash doesnt happen when setting time        if (DS1307Present) {       // Set the time and date on the chip       setTime();     }     delay(100);       displaytime();     } }

Question by pro2xy    |  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


3 wire interface (GND, VCC, DATA)? Answered

Hi guys,   I'm trying to reverse the communications on a project I have at the moment which seems to be using a 3 wire serial interface (GND, VCC, DATA).  My goal would be to replicate the communications with an arduino or similar, however i'm not 100% sure what serial protocol it's using.   The device is using an Atmel ATMEGA168 and the pcb is covered in conformal coating, so I haven't had a whole lot of luck tracing the pins. I'm not overly aware of many one-wire communications protocols.  The datasheet says the ATMEGA supports various peripheral features, including SPI, USART, 2-wire serial (Philips I2C) (among others), however the GND, VCC, DATA configuration doesn't seem to fit with any of the supported protocols (i.e. there's no clock line and only a single data line).   The captures i'm getting seem to indicate that it's an 8-bit binary protocol.  I was going to try to decode it manually and attempt to reproduce it, however would be grateful if someone recognizes it and can point me in the right direction. Does anyone know any protocols / configurations this could be?  Example screenshot attached. Any help would be greatly appreciated!  Thanks!

Question by ikarus6    |  last reply


(Newsletter) Stormtrooper Kids, Amazing Transformer Costume, Steampunk Gatling Gun

Sign-up for this newsletter: Welcome back! NEW: As the nights get longer, stay visible for the Light Up the Night! Contest and win some cool clothes from Cordarounds with secret reflective powers! Mega Contest: Have some great pics from Halloween? Enter them in our most awesome Halloween Contest ever! Over 50 sweet prizes to win in six categories, including slideshow. Closes for entries this Sunday, Nov. 8! Arduino Contest - Make anything involving Arduino and win an Arduino Mega or a sweet prize from Evil Mad Science! Want a more convenient version of Instructables with fewer ads? Get a Pro Membership! Transformers Soundwave Costume Arduino Controlled Silly String Shooter Create Printed Circuit Boards with an Inkjet Sew a Newspaper Dress Make 20,000 Pints of Beer Cardboard Samurai Armor Candy Apples Laser Pumpkin Apple Cider Donuts Halloween Pirate Cannon Talking Arduino Halloween Skeleton Dessert Pizza Toga for Women Where the Wild Things Are Steampunk Gatling Gun Arm LED Binary Clock Kid's Stormtrooper Costume Bender Costume Helmet Mohawks in 10 Minutes Ludo from Labyrinth Costume Bar End Brake Light Chicken Parmesan Ghost Cupcakes Dexter Blood Slide Suckers Instructables.com - 82 2nd St. - San Francisco, CA Sign-up for this newsletter:

Topic by fungus amungus    |  last reply


How does a computer "write" something... to memory, a registry, etc...? Answered

I know that every computer has a CPU. I know that every CPU has it's own Instruction Set, or... set of things that it can do: CompareAddJump toInOutetc...I even know a fair amount about how a CPU interacts with RAM along the Data Bus and the Address Bus with Set wires etc, and how a CPU's ALU (Arithmetic Logic Unit) stores data temporarily in "registries" and uses "flags" to send things back to the Control Unit if the CPU. So, I know a fair amount about "How a computer works." But... it is all theoretical. I have memorized words and ideas like "ALU" and "Registry" and even RAM. But there is one thing that I do not understand and cannot seem to find anywhere on the internet. The verbs "write" and "store"...??? I know that a record cutter uses electrical current spread across metal plates with magnets that push a scoring tool into a soft "scratchable" medium to cut a long groove to make a record. Then a phonograph has a needle that that is likewise suspended between electrical currents with magnets that telegraph the grooves up a wire to replicate the sound through a horn (later a speaker). But as far as I know... RAM or a CPU's registries can have binary "words" somehow written to them for storage. I know it is happening at 3-4 billion times per second, but even if you slow it down to one time per minute... how does a CPU "write" 00110100 to RAM? There are no magnets in RAM like on a hard drive. RAM has no physical material that can be changed to represent a zero or a one... like... wax, or vinyl, or magnets. I don't even know who I can ask this to... so I'm asking here.

Question by Dolmetscher007    |  last reply


Neotech NT7086 display and arduino?

I found a couple of these older looking dot matrix LCDs in some electronic logbooks that didnt work. it was a 14 pin connector, so i figured why not try it out. i found the pinout of each pin using the chips that were on board, but i don`t know where to go from here, or if i should even bother. the display was made by or for hantronix, and they have a touch layer that could be used as well. each display has 7 of the NT7086PQ chips on it, a 74HC74D, a 74HC40103D, and an LM324. it was originally connected via a flat flex cable, but it had a convenient place for headers to plug it into a breadboard. the 74HC40103D is an 8-bit synchronous binary down counter: http://www.nxp.com/documents/data_sheet/74HC40103.pdf the 74HC74D is a Dual D-type flip-flop: http://www.mouser.com/ds/2/302/74HC_HCT74-225071.pdf the Neotech chips are LCD display drivers: http://www.crystalfontz.com/controllers/NT7086.pdf upon inspecting the physical properties of the display I can see there are the rubber/carbon edge contacts on two sides and a ribbon on one end. The pinout i figured out is: 14 is GND 13 is base on SOT23 transistor     (connected to 12 on parent board) 12 collector on a SOT23 transistor 11 gets pulled low at some point (pulled low on parent board) 10 is power 9 is cl2          (unactive high?) (on one set of neotech chips, assuming the edge contact drivers) 8 Clock input (74HC40103D) 7 does nothing 6 is d4 on one chip? 5 is display off  (active low) 4 is d4 3 is d3 2 is d2 1 is d1 So i would appreciate any input people have. I would ideally like to drive this using an arduino/atmega, and although i have not read the neotech datasheet to much depth it would appear to work similar to the popular parallel displays, but maybe with different syntaxes. so is this a possible thing, or is it a fruitless endeavor? thanks in advance.

Question by zack247    |  last reply


Brains for a robot?

It's time I turn yet again to the forums for advice, this time on recommended robot brains! [Serious] I have a project for a class requiring design, construction and programming of something. More than half of my fellow students are doing clocks of some sort, be they binary or nixie tube. A friend of mine is doing a holonomic robot, and my plan was to do a walking robot, based on ideas like the WowWee robosaurus, using a simple tail and head to balance and few motors to run it in comparison to any conventional biped. As far as servos, I was hoping to use something like the HerculeX or other serially connected servo, so I can just daisy chain the few I would need and simplify the wiring, as well as get experience with serially addressing things. Planned sensors are 2-4 IR rangefinders, 2-4 wire whiskers and one tilt switch to turn it off if it tips over. Sensors I'd love to add would be something like a super basic camera for simple machine vision if I ever learn to code that well, but I doubt that will be the case; and the LIDAR thing from the Neato XV-11 which is again unlikely. Things I was looking at for super basic use included: Arduino, HC11 MC (backplane type), BASIC Stamp, PIC. For a little more complexity I was seriously considering things like the Freescale Tower ARM, Gumstix or other. I'd love to have the serial servos, sensor assemblies and the camera and have integration with Robot operating system through an onboard computer, but I have no idea what to use to setup ROS or what would be best, or if my plan of parts to use is even good enough. In other words, what ideas should I throw out as impossible or what would I need for say, ROS use? Ideally i want to do a semi autonomous robot, so that i don't have to manually direct it everywhere, but I'd still be keeping an eye on it when it's running so it doesn't break something. If I understand ROS correctly I can use an external computer to control it, but I can also let it be autonomous? Coding math and logic in the machine language for a Z80 computer doesn't really prepare for robot building, although the class is basically a teach programming basics and throw you into the deep end. [/serious] Thank you in advance for your help!

Topic by Nyanman    |  last reply