3v 24hr timer w/ electromagnetic pulse(?)

Discussion in 'The Projects Forum' started by AlwaysLearningStuff, May 21, 2019.

  1. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
    Hi all,

    I'm probably your least favorite type of person to drop in around here. Super new to ee, no engineering background whatsoever, has silly idea!

    Been thinking about an ornamental timepiece for a while, and figured I would always design it mechanically like your regular automatic watch (using a mainspring). However, the longevity and no/low maintenance advantages of using a battery are now apparent, although I'm certainly more nostalgic for a nice winder.

    The idea is to send a brief .5 second electromagnetic pulse from one side of the clock to the other, once every 24 hours. Essentially it's a mantle clock that has digits 1-30 around the clock face in lieu of 1-12 (Yes, I realize not all months have 30 days). The quick pulse pushes a small magnet about 5-6 inches away, which gears the clock's single hand 1/30th of a revolution, which obviously needs to occur only once every 24 hours (preferably like clockwork!).

    I'm hoping to use a 3 or 6v lithium button battery. Not knowing much about electrical engineering, It feels like this shouldn't be too hard? I think i have a basic schematic that is maybe close, it goes like this: battery to something like a 555 to an rc oscillator to a capacitor (or two?) to the very small electromagnet (2lb force). Can't help but feel there's some redundancy here though. I like the electromagnetic route because of no actuating parts connected to the battery.

    As you know, I'm a bit out of my depth. Any light that could be shed with regards to any of this would be greatly appreciated! Thanks in advance.

    -A
     
  2. Daniel Sala

    Member

    May 28, 2015
    60
    13
    Hi,

    Nice to meet you.

    Sorry, really - unwise premise in several places: 555 is at best 1% reliable" like clockwork", capacitors are very un-"like clockwork".

    e.g. A once-every-12hr 0.5s pulse using a 555 ( for some timing reliability, let's make our 555 output a 1-second "clock" signal and we'd also need a few divide-by-10 integrated circuits to get to once every 12 hours) would be wildly and unpredictably inaccurate. A 24hr pulse is far worse to contemplate and such a circuit design is a waste of your time. I know, I do this kind of circuit often where e.g. 12hrs plus temp variations and long-term drift of +-20mins or worse is not important.

    555 is supposedly good for up to max. 30 mins or 1 hour some might say, but for practical, real reasons, a sandglass would be more repeatable, and I love the 555...

    Maybe consider an Arduino or Pi or PIC as a starting point for a real clock, anything else will be disappointing as a first project.
     
  3. Daniel Sala

    Member

    May 28, 2015
    60
    13
    Hi again,

    BTW, "...least favourite..."? Nonsense, we all start somewhere and many of us get "addicted" to electronics based on some project or other or need we have/had.

    I'm home now so I can show you a couple of things I mean and waffle on further. There are loads of supposed "long time delay" circuits with 555s and so on, but take them with a huge pinch of salt. It might have been a necessity in 1970-something and anything vaguely "like clockwork" was better than nothing, but it's 2019 now...

    Exhibit a) Fish clock circuit idea. Designed to go on for "quite precisely" 12 hours and off for "quite precisely" 12 hours. I didn't make it because it is too big and not as accurate as I wanted, and I have breadboarded this and sat through tedious days of checking reliability regarding just how close to 12on-12off it is. It drifts by a few minutes over a couple of days. Suitable if you go away for the wekend or a week or two but useless as "like clockwork". Just look how horrendously big it is, to begin with.

    Exhibit b) Cheap mains-based clock. Same premise as above. It could be used to turn a lamp (via a relay) on at night for my cats or as the fishes daytime lighting circuit for example if I ever had to go away for a few days. Was curious about how to use the 50Hz signal in Europe and get 1 second signal out of it. Again, not "like clockwork", horrendously big, would need battery back-up if mains went off and a whole load of other problems based on a badly-thought out premise. There is one more CD4017 mssing bottom right to get the 12-hour blip output.

    Instead of a warehouse-worth of CD4017s and logic devices and one 555, you could use one 555 and only two CD4060s (not my favourite divide-by IC when it has an external clock input), which are also called ripple counters, plus a few other bits and pieces to get your 24-hr blip output. I did the sums for you with these three ICs as the backbone of the circuit:

    24hrs = 86,400 seconds.
    let's use our 1% repeatably accurate 555 (forgetting that the timing capacitor will make that 1% more like 5% or more unpredictably inaccurate, excluding fluctuations in ambient temperature that will make that worse) as the "clock" signal: We could choose 0.1647 seconds as the timer interval and use 20 of the CD4060 outputs to get there or a totally drifty and not at all "like clockwork" 5.273 second timer interval signal and only use 15 of the CD4060 outputs to get to a hypothetical once every 24 hours.

    We could hope to circumvent some of these issues by using something which is also out of The Ark like the XR-2209 VCO and aim at a super 0.1Hz signal to make the starting point easier on ourselves, but there's still that capacitor thing happening that will make "like clockwork" unlikely, to say the least.

    Personally, I would say: don't do it, friend, it's a "wrong approach", both regarding accuracy and PCB real estate and the time it will take to make the blasted thing.

    I can't write code to save my life so the following is very wrong, but you'll get the gist. I have an analog brain, but I do know that if you have the patience to learn to write something vaguely along the lines of:
    Get GPIO
    GPIO 34 out

    Get Time from clock or whatever it'll be called


    While Time is not 00:00GMT,
    GPIO 34 = LOW
    If Time is 00:00GMT
    GPIO 34 = HIGH 500ms
    Repeat forever

    That is utter rubbish and not real code and people who can write Python or PIC stuff will be wetting their pants reading my infantile gibberish code example, but the point is that that's about as painful as it would be for what you need to do... Learn how to turn on an LED momentarily from a GPIO in Python (or whatever language is easiest for you to learn) and associate it with the real time and you're away!

    I really hope this helps. Welcome to the joys of "I had this idea that seems simple in principle but a bit harder than a battery, a switch and a light bulb."

    Good luck with your project, sounds lots of fun and well worth the time (no pun intended) and effort I hope you invest in it and succeed in making!
     
  4. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
    Daniel,

    Thank you for this feedback! Exactly what I was hoping to see. Not able to respond appropriately right now because I'm at work, but I did want to thank you and let this sink in and go back to the drawing board. I'm more than happy to use something like a pi or pic or ardrino logic chip. I'm not looking to reinvent the wheel, but do want battery power vs plug-in. Did a quick search and found a couple things I'll explore later when I am off work.

    The first is this PIC than runs off 3 or 5v, and out puts to a motor or solenoid. Wondering if a button electromagnet would work too...http://www.technologystudent.com/pics/pic5.htm

    The second was this trinket logic chip from adafruit https://www.adafruit.com/product/3500. Looks like these little guys can do a lot.

    I'm sure there are downsides here I'm unaware of at the moment, but that's part of the fun of learning! Both of these can be ran off battery power, I just don't know what my battery life would look like. If it burns it up in a week, I might be better off using a mainspring as originally planned.

    Obviously I could be sold on upgrading batter size/ quantity, and using whatever pre-existing chips would run the task of a timed electromagnetic pulse. Thanks again! I checked out your schematics too btw, wow. You were right; lots happening! my naivety glasses are coming into focus, ha!

    -A
     
  5. Daniel Sala

    Member

    May 28, 2015
    60
    13
    Hi,

    The Adafruit one looks preferable to the PIC, IMO. Good price for all the things you can do with it. Lots of nice walkthrough examples to learn how to use it in the pdf booklet, too. Shame it doesn't seem to say the power used (that'll appear in other documentation for that device, or for the ICs used on it, somewhere), but still, it clearly doesn't require a power station to run for quite sometime, especially just to go high for half a second every 24 hours. Sleep mode must be possible for the time it's doing nothing to save power, too. Must say, nice choice!

    Others may disagree but I think PICs look far more time-consuming to start using/get up and running with the basics, plus you need additional interface parts to insert the code you've written and debug the circuit/code, etc.

    No downside, only positives, all circuits require frustration and pulling a bit of hair out - otherwise, as you basically/sort of say, where's the fun in making something yourself and learning stuff? ;). It'll be nice to see the finished project when you have it, sounds interesting.
     
  6. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
  7. DickCappels

    Moderator

    Aug 21, 2008
    5,527
    1,726
    You can do that with an AVR ATTINY12 running with a 32768 Hz crystal. When not driving a load the average current is about 6 microamps. I can provide code for an application similar to yours, a drip watering timer.
     
    AlwaysLearningStuff likes this.
  8. Daniel Sala

    Member

    May 28, 2015
    60
    13
    Hi,

    Maybe Dick's offer could be a good one to take up and/or combine with your ideas and a suggestion I'll make lower down.

    The RTC looks maybe traumatic to start off with for a person who says they are just starting out but everything coming up rosy is down to the time and effort oneself puts in/you put in. I would take the coward's way out and not use that if possible.

    Programmable timer relay looks good as it can do 24hrs and is very user-friendly-looking with the LCD and button (s) interface.

    IMO, I don't get the real need for the electromagnet unless you want/need that design especially for some reason, it sounds like yet one more "nightmare to deal with"; circuits are fond of KISS, which removing the word "stupid" from the expression can be altered to KIaSaPwP (keep it as simple as possible, where possible...). Me, I'd forget the electromagnet and get a stepper motor with suitable steps (12º per step = 30 positions).
     
    AlwaysLearningStuff likes this.
  9. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
    Thank you both for the suggestions! Dick- that's very kind of you to offer provide code! You guys are awesome. I'll have to go back to the well to look at the AVR ATTINY 12 more closely. I assume we're talking strictly for the replacement of the adafruit RTC module? I see big advantages with a brief search; it will hold it's programming despite power lose, and it's extremely low overall power use. I'm under the impression if power cuts out to the adafruit RTC module, it requires a manual restart (which isn't the end of the world because it's just a button-press).

    The advantage of the af RTC module is it's high precision, so much so it registers temperature and adjusts accordingly to keep ridiculously accurate time. That's cool! Still, it would require it's own button cell bat, where the avr attiny could run off the timer relay power source (if I'm understanding it all correctly).

    Daniel- I know I'm making more work for myself with the electromagnet vs a stepper motor (and KISS is usually my fallback position on 99% of things!), but the design I'm thinking about would have a glass case, and hollow wooden base to hide the circuitry, and there's no way to get around seeing the wires. I guess I could just rethink the case entirely, but I love the idea of people saying "how does that even work!?" The aesthetics for me here is equally important to the functionality Plus if I can crack the electromagnet aspect, it opens up options for using it for a typical 12 hr clock with the same aesthetic design. I can't think of any other way to invisibly drive something which wouldn't require an additional power source, at say, the receiving end in the instances of RF. I'm definitely open to outside the box alternatives!

    It's all still up in the air (no pun intended), so I'm keep everything on the table as I continue my dd. Thanks for the advice, both of you!
     
  10. DickCappels

    Moderator

    Aug 21, 2008
    5,527
    1,726
    It a microcontroller. It needs a crystal for the timebase and a power supply capacitor.

    The function of emitting a 500 ms pulse once every 24 hours is extremely simple. The application that I am working on at the moment only takes about 150 bytes of code (before adding features), and a great deal of that is house keepiing.
     
  11. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
    Riiight! Sorry, my light bulb is slow to come on. I'll do some further research on this type of setup and get better educated.

    (Every time I learn something new regarding the capabilities of all these various electrical components, I feel like Lloyd from Dumb and Dumber discovering "we've landed on the moon!") This is probably a dumb question, but is there a power supply capacitor in particular that comes to mind for you regarding this application?? Thanks!
     
  12. Daniel Sala

    Member

    May 28, 2015
    60
    13
    Hi,

    It's all a lot of information to take on board (usually all at once) and normal.

    This is a battery circuit, isn't it? Without knowing the actual definite circuit, I wouldn't worry about minor details for now.

    To say a very provisional option, 10uF + 1uF + 100nF in parallel might be one choice for a circuit with low current demands.

    I'd finalise the circuit idea first.
     
  13. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
    Hmmm. I'm not familiar with "finalize the circuit"... I suppose I've been compartmentalizing all this stuff into one folder: Electronics stuff for Timepiece. It is a messy folder, no doubt. If I were to guess, you're saying first understand the output/ amps required (aka, the magnetic field strength of my required electromagnet), which will point to the adequate necessary voltage of the proper battery, then worry about the middle components last? Thanks for your patience.
     
  14. Daniel Sala

    Member

    May 28, 2015
    60
    13
    Hi,

    Pretty much, yes, that's correct. It's a bit like asking how much fuel is needed to reach an unknown destination - just can't be answered with certainty.

    Start with a block diagram, in your head or on paper (e.g. a once every 24-hrs pulse + relay + electromagnet). Then define the actual workhorses of choice (specific clock device, specific relay if any, specific electromagnet, etc) to make it happen and any additional components needed between them, if any. Then we can calculate the housekeeping power needed for it all to work when at rest and when doing something and for the latter, we should consider if there will be any sudden current draws (presumably the only one is the electromagnet) that may cause a dip in the supply voltage. Now we can choose a battery that fits this power requirement and reservoir capacitors to maintain a stable supply voltage - if they are actually needed.
     
  15. Kjeldgaard

    Member

    Apr 7, 2016
    362
    128
    Just over two years ago, I was part of a thread about turning on an LED once a day: Link

    And my contribution was probably what had the lowest Power consumption of the suggestions in that thread.

    The 24h00m00s timer section must be able to be used directly, and the two Nand gates Flip/Flop driving the LED can be arranged as a Monostable Multivibrator with a 0.5 second timeout.
     
  16. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
    Ok this is great stuff. I appreciate all three of you pointing me in the right direction.Time to brush up on some math! I'll be back to report progress (or to bug you with more questions) ;)
     
  17. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    5,014
    1,905
    I’m not familiar with the ATTiny12. But with an ATTiny45/85, outputting a 500mS pulse every 24 hours is just a few lines of code. Maybe 5?
     
  18. DickCappels

    Moderator

    Aug 21, 2008
    5,527
    1,726
    I considered the ATTINY25 but neither its idle current nor its crystal oscillator were characterized for 32768 Hz. Given that the basic architecture it looks like it would take as much code to perform this task with either. Setting up the timer, counting interrupts and generating pulses when the 24 hour counter overflowed takes most of the code.

    A 16 bit timer or different selection of prescaler options might allow the code to shrink, but hey, only aboyt 15% of the flash is being used.

    I think the most appropriate level for this project given the experience that AlwaysLearningStuff mentioned is the discreet logic version that @Kjeldgaard mentioned in post #15. No instruction set to learn, no assembler to learn,, etc. Only some logive to get working.

    Testing hint, use a much faster clock when checking the 24 hour cycle : -)
     
    Daniel Sala likes this.
  19. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    5,014
    1,905
    I’m replying not to proselytize, but to comment.

    ATTiny45 and ATTiny85 are supported by the Arduino IDE. There is an under-$20 USB programmer for then.

    Oscillator is built-in. No scaling nor pre-scaling is required. No counting interrupts. No overflow calculations. No setting up the timer. No assembly programming.

    So this would work on an ATTiny45/85. It took a few more lines than the 5 I originally had expected. But not much.
    Code (Text):
    1. const int outPin =  7;
    2.  
    3. setup() {
    4. }
    5.  
    6. Void loop() {
    7. unsigned long end=millis();
    8. const unsigned long day=86400000;
    9.  
    10. end = millis() + day;
    11. While (end-millis() >0);
    12.  
    13. end=millis()+day
    14.  
    15. digitalWrite(outPin,HIGH);
    16. delay(500)
    17. digitalWrite(outPin,LOW);
    18. }
    19.  
     
  20. AlwaysLearningStuff

    Thread Starter New Member

    May 21, 2019
    8
    0
    Hey guys, hoping to circle back on this. Thanks for all the feed back above!

    After experimenting with various electromagnets, it's become clear I will not be able to generate the amount of force required for my application given my limited space and the emp field distance. Essentially I'd need a much stronger magnet and a larger battery which would make my calendar clock too bulky.

    I revised the design to use a micro drone motor instead (at least in theory) and I'm hoping I could please get some insight into my flaws and gaps. I'd like to use a small button cell battery (3-6v) to power a single revolution.

    My main question... Is this ridiculous/ even feasible? Assuming the answer is "no it's not ridiculous/ yes it's feasible," what crucial components should I be considering? Calender clock mcu.png

    I'm attaching a sketch because I took the time to draw it, thinking it may be useful!?

    Thanks in advance for any replies!
     
Loading...