a timer that goes logic high or low every 15mins (hardware version)

Status
Not open for further replies.

sghioto

Joined Dec 31, 2017
8,634
ahh looks like i have to make the interface board using that cable? Hopefully i can find a US supplier BUT the next question is how bad shipping will be.
Robotshop.com.
They have several boards available plus a starter kit.
Alternatively you can make your own.
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
Certainly there are CMOS ICs already programmed: The CD4060 is programmed to divide by several power of two, likewise the CD 4040 and the CD4020. And the CD4017 is programmed to count up from zero to 9 and repeat. They are hard programmed, not changeable at all.
yes that is what i thought but other say won't work for 15 mins would need many chips to do that
 

MisterBill2

Joined Jan 23, 2018
27,591
It will indeed take probably three or maybe four of the 14 bit dividers, plus possibly one divide by ten counter,to count the mains power cycles exactly in 15 minutes. Nd there might be some "AND" gates needed, although that can also be done with simple diode logic. BUT that is not a huge number of IC devices, and the required count-up portion is rather simple.. So just because some folks panic when they see more than two connections is not a reason to give up. There are a lot of folks who read and provide good advice here.
 
The 4017 IC is a nice solution for dividing by numbers which are not a power of two, because feeding the output after the count you want back into the reset pin can give you divisions from 2 to 10

For 15 minutes from 60 Hz, as already mentioned, divide by 60 x 60 x 15 = 54,000. Cascade 3 x 4017s to divide by 1,000 then have 2 x 4017s both fed by that signal, one dividing by 9 and the other by 6. AND gate these two outputs
 
It always amuses me that a processor approach is considered "simple".
It may have the fewest parts, simple, but the execution is only simple if you already know/understand how to program (which is by no means simple to learn for many of us).
It often amuses me to see the great divide between those who understand analogue electronics - an increasingly rare skill - and those who reach for a processor every time, use available modules and who really have little understanding of the fundamentals.

In 1971, the year I completed my Engineering Science degree, Intel launched the 4004 processor and everything changed!

Arduino have made it so simple to make a start. Buy the Arduino UNO R3, download the IDE (Integrated Development Environment) and go through the examples provided with it. Change the code and see if it still compiles and whether it does what you expect it to do. Spend one day playing with it and you will never look back. You learn the 'grammar' quickly because the compiler fails to compile and shows you where the error is.

This project is really easy to code. There is a delay(); instruction where the number in the brackets is the the number of milliseconds that the processor does nothing. There is a "for" loop instruction which does the same thing over and over until it has done this as many times as you select.

The following pasted into a new "sketch" should do the trick. I've used pin 8 as the output and driven it high for one second which is why I've looped 899 times instead of 900.

int pin = 8;
int n = 0;

void setup() {

pinMode(pin,OUTPUT);
}

void loop() {

for (n=0;n<899;n++){
delay(1000);
}
digitalWrite(pin, HIGH);
delay(1000);
digitalWrite(pin,LOW);

}

The clock frequency is not perfect, you could be around 100mS out each 15 minutes and the code itself takes a very small amount of time. You can correct this with doing one less loop and adding a delayMicroseconds(); instruction in the loop which does what it says on the tin - or adjust the output pin high time by up to 100mS.
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
It often amuses me to see the great divide between those who understand analogue electronics - an increasingly rare skill - and those who reach for a processor every time, use available modules and who really have little understanding of the fundamentals.

In 1971, the year I completed my Engineering Science degree, Intel launched the 4004 processor and everything changed!

Arduino have made it so simple to make a start. Buy the Arduino UNO R3, download the IDE (Integrated Development Environment) and go through the examples provided with it. Change the code and see if it still compiles and whether it does what you expect it to do. Spend one day playing with it and you will never look back. You learn the 'grammar' quickly because the compiler fails to compile and shows you where the error is.

This project is really easy to code. There is a delay(); instruction where the number in the brackets is the the number of milliseconds that the processor does nothing. There is a "for" loop instruction which does the same thing over and over until it has done this as many times as you select.

The following pasted into a new "sketch" should do the trick. I've used pin 8 as the output and driven it high for one second which is why I've looped 899 times instead of 900.

int pin = 8;
int n = 0;

void setup() {

pinMode(pin,OUTPUT);
}

void loop() {

for (n=0;n<899;n++){
delay(1000);
}
digitalWrite(pin, HIGH);
delay(1000);
digitalWrite(pin,LOW);

}

The clock frequency is not perfect, you could be around 100mS out each 15 minutes and the code itself takes a very small amount of time. You can correct this with doing one less loop and adding a delayMicroseconds(); instruction in the loop which does what it says on the tin - or adjust the output pin high time by up to 100mS.
Thanks for the code. I am looking into the ttiny85 i believe this code would work on with that. I am trying to figure out what programmer I need to get for the ttiny85. Looks like if I get the wrong one, it won't program the bootloader onto the chip??? any help on this would be great.
 

tonyStewart

Joined May 8, 2012
238
you mean with the RC components that are being used? plus or minus 30 second is that possible?
<30 s error / 900 s cycle = ~ 3% is doable with a trimpot.

Using the rising edge of Q11 or the 1024th count and running the internal clock at 900/1024 of 1 second cycle will be the same as a 1000 ms cycle after the 900th count. Then using a short 1-shot circuit with RC and a gate for Reset and a 1 second 1-shot for the output into an XOR gate, you can choose normal or inverted pulse.
 

AnalogKid

Joined Aug 1, 2013
12,145
It often amuses me to see the great divide between those who understand analogue electronics - an increasingly rare skill - and those who reach for a processor every time, use available modules and who really have little understanding of the fundamentals.
"I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail."

- Abraham Maslow, Professor of Psychology at Brandeis University
"The Psychology of Science: A Reconnaissance", 1966

Hence, my tagline.

ak
 
Thanks for the code. I am looking into the ttiny85 i believe this code would work on with that. I am trying to figure out what programmer I need to get for the ttiny85. Looks like if I get the wrong one, it won't program the bootloader onto the chip??? any help on this would be great.
Are you using the raw IC or a development board like the Digispark development board which incorporates the 8 pin processor and can be plugged into the USB port on your PC? If this is your first foray into using processors I'd very much recommend the Digispark developement board which can be programmed using the Arduino IDE. See https://www.instructables.com/How-to-Program-an-ATtiny-85-Digispark/

I still favour the Seeeduino XIAO which is fairly inexpensive, with more I/O pins, one of which is a real 10 bit DAC, in case you are thinking of moving on to more ambitious projects.
 

Thread Starter

timtim1234

Joined Nov 30, 2023
246
Are you using the raw IC or a development board like the Digispark development board which incorporates the 8 pin processor and can be plugged into the USB port on your PC? If this is your first foray into using processors I'd very much recommend the Digispark developement board which can be programmed using the Arduino IDE. See https://www.instructables.com/How-to-Program-an-ATtiny-85-Digispark/

I still favour the Seeeduino XIAO which is fairly inexpensive, with more I/O pins, one of which is a real 10 bit DAC, in case you are thinking of moving on to more ambitious projects.
yes i want to use a raw ic. and program it using a usb programmer. I don't want to buy Arduino to use as a programmer. so with that being said maybe there is something out there that is a raw ic that is better??
 

MisterBill2

Joined Jan 23, 2018
27,591
A combination of decoded binary division and a decimal counter can do the job with fewer IC devices and just a bit of diode AND decoding. And that division can be exact, not just "close enough"..

The large advantage will be apparent if ever the logic needs to be replaced or duplicated: those little processors may not be available next year, while the IC devices will still be available thru most electronic distributors. That matters if one is creating a design considered to be worth repairing. I realize that many products are not considered to be worth repairing, leading to the mountains of electronic waste.
 
More amusement.
And who can understand that besides those who know whatever language that is, and what those cryptic commands and syntax mean? o_O
Have you simply stopped learning? Anyone who cares to read my post, downloads the Arduino IDE and works through the examples as I suggested will easily understand that code in a few hours at most. If you have something useful to contribute, let’s see it. If all you can do is laugh at what others write then shame on you

I’m neither a digital or analogue electronics expert and I don’t mind being corrected when I get things wrong. I’ve been impressed by your understanding of analogue and I have learned from your posts but I’m not impressed by your sense of humor
 

MisterBill2

Joined Jan 23, 2018
27,591
Some of us ARE very experienced as well as educated in both analog and digital electronics, as well as in power circuits. WE are used to supplying good advice to those in need of useful assistance.
And a few are experienced in developing products that would have a long lifetime, made with components that will continue to be available from multiple suppliers for years. Some products and designs are intended to not become obsolete in just six months.

And a few may even be biased against a supplier that has chosen alternative names for many aspects of a technology. That comes across as being as bad as those who use proprietary power connectors on their products.
 

panic mode

Joined Oct 10, 2011
5,003
well.... the nice thing is that one has a choice.... and there are many ways to do this.

anyone looking at 555 astable circuit to flash an LED for the first time is also going to say "what a heck is that". same goes for reading datasheet. i would argue that in same amount of time it takes one newb to do that with 555 another one flash LED using one of ready to use MCU kits - and probably MCU newb will be much faster as there are literally ready blink examples.

as for comparing readability of schematics and code, one can search through this very forum and see how many posts are deliberately avoiding to use schematics. they describe things using words because schematics is a language and like any language it need to be learned. programming language need to be learned too. and while C is an awful abomination in the eyes of many, the blink example etc are very simple and ... in ENGLISH.

what is hard to understand about something like

delay(1000);
or
digitalWrite(PinNumber,HIGH);

just how hard/nonintuitive it would be to modify them for average newb? is it really simpler to calculate RC time constant with all the many decimal places for R and C values? most people today cannot do even simple math like calculate correct change when shopping.

the whole point of using programmable system is that one does not need to reach for soldering iron or redesign PCB when something need to change. and today things are changing a lot... and fast...

making own MCU project from scratch (hardware AND software) for the first time is HARD. but barriers are lowered considerably with ready to use boards that plug into USB and all that is left is send example code. no soldering, no datasheets, no guessing... and once you have something working, try poking around... change the delay... use another pin,... and if something does not work change things back and try something else. or even read the article or tutorial. it is much easier compared to understanding datasheet packed with technobabble and cryptic terms.

just stop any random person on the street and ask them if delay(1000) means pause for one second, what should be used to pause for three seconds. and the digital write instruction uses word HIGH. what else could be used in place of HIGH?

do the same thing with also a random stranger using 555 example.... if R1 is 10k, R2 is 56k and C is 10uF, frequency is about 1Hz. what value for R2 is needed to make it 5Hz? and if 56k resistor color code is green-blue-orange, what colors should be on the new resistor?
 
Last edited:

Thread Starter

timtim1234

Joined Nov 30, 2023
246
ok sorry

So as I was saying in my last post I am open to other raw IC that can be programmed, maybe the ttiny85 is the best one for this project? Or maybe there is one better than the ttiny85?
 
Status
Not open for further replies.
Top