Rotary Switch to Variable Timing Circuit?

Discussion in 'Mac Programming' started by Sdashiki, Mar 14, 2011.

  1. Sdashiki macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #1
    I need some EE help with a project I am trying.

    What I need is a timing chip whose time(s) are set by rotating a dial.

    Set the dial to 1sec. When you power the circuit (switch) you get a 1sec pulse of power to the output and then it stops.


    Im looking to have a 10-12 position rotary dial connected to a timing chip. How the hell do I go about even starting this project? How does one get EXACT timed pulses from the chip...do I need to program it?

    I need non-crazy times like 1s, 1/100th, 1/1000th etc.


    So, to reiterate my ranting unintelligible self:

    set dial to a certain time
    power on the circuit
    timing chip reads setting on dial and outputs appropriate amount of time in a power pulse


    This will allow me to turn on/off a device with perfect timing I can set.

    HELP!?
     
  2. McGordon macrumors member

    Joined:
    Dec 28, 2010
    Location:
    Scotland
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    Is this for production or for individual use?

    What do you mean by "exact"? Define the precision you need. You need to provide either a percentage of the total time, e.g. 1%, or a specific number of microseconds, nanoseconds, etc. Unless you buy a cesium clock, you're not going to get exact, so we need to know what amount of inexactness your application can tolerate.


    A 555 timer chip with 1% precision components should be adequate for 1% precision. Might be hard to find capacitors with 1%, so you'd probably have to use 5% caps and a trimpot, then calibrate it. This assumes you have a timebase or other timing reference with better precision than 1%. You can't possibly calibrate with any better accuracy than your worst reference instrument.
    http://en.wikipedia.org/wiki/555_timer_IC

    There are any number of other chips capable of producing timed pulse outputs. The 555 is just one of the simpler examples.


    Also, please explain how this is in any way related to Mac Programming.
     
  4. Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #4
    This is just for me and anyone else who asks me, which they do!

    The precision would be for photography, so in reality it should be like this:

    1 second needs to be somewhat exact
    then every other setting is half that
    1/2, 1/14, 1/8, 1/15, 1/30, 1/60, 1/125 etc

    So as long as the 1 second is just that, the rest can be calculated from it...if thats how these chips work?

    I really need it to use steps/detents, so a switch instead of a pot would possibly work best.

    Ive read alot about the 555, but cant seem to figure out how to get it to understand different positions on the switch as different times to output.

    maybe I put this in the wrong category...I assumed id need to program an EEPROM or something...EE is greek to me, so if this is all electrical without a lick of programming...woops!
     
  5. McGordon macrumors member

    Joined:
    Dec 28, 2010
    Location:
    Scotland
    #5
    You could have your selector switch put different values of resistor into the circuit to alter the timing.

    Your list of fractions isn't right, but I know what you mean.

    If electronics is like Greek to you (assuming you don't understand Greek) then wouldn't you be better just buying a timer:

    http://www.universaltimer.com/info3.html

    That one can trigger shutters, flash, solenoids or valves.
     
  6. Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #6
    Oh, this has to fit in a small space. But, dont let that concern you when it comes to a chip and switch dial, those components would fit no problem. But...

    The resistor bank idea, has been tried, but even with surface mount components, its not small enough to fit where it needs to. Or at least not easily.

    In essence this is what I am trying to do away with, resistor/cap combos for timing and replace with something more exact, or at least a little less fiddly and component heavy.

    While this has to do with photography, its electronic timing at is core really. I need a pulse of voltage across a circuit for a set period of time when a user presses a button to start after theyve chosen a setting on the dial.

    As for the fractions being off, thats how it is in photography. As long as one setting is half or double the one next to it, its fine. Should it be actually 1/16 and not 1/15, doesnt matter in the end.
     
  7. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #7
    Even if you need to program an EEPROM, you'll still need to design and build the digital circuit, so how was that going to happen?

    Next you'd have to design and write the program. If you've never written an embedded microcontroller program before, that will probably be Greek as much as electronic circuits are.

    You need to describe what kind of output drive the circuit needs to supply. Max voltage, min voltage, current source or sink, any isolation requirements, etc.

    Exactly what device is it driving?


    What dimensions does it need to fit into? Be specific.

    Not every microcontroller comes in tiny packages. Those that do may not be usable except with specialized equipment (surface-mount soldering).

    I'm wondering if one of the Atmel DIP-8 controller chips would fit, but even if it does, it may be impractical to use a rotary switch with it.

    I think you should describe the mechanical aspects in more detail, since it seems to be one of the more critical parts of the overall design.
     
  8. AustinZ macrumors member

    AustinZ

    Joined:
    Aug 6, 2008
    #8
    A simple microcontroller, like the Arduino (or even 8051) could very easily do what you'd like it to do. However, given what you've said about space requirements, it's very unlikely that a dev board would meet your requirements. The actual chips are small enough that you could probably lay out a PCB small enough for your application, but that would take at least a small amount of EE knowledge (although there are online PCB manufacturers who offer free, "easy to use" layout tools, and the sort of board you'd need would be relatively simple).
     
  9. Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #9
    The voltage across the system is 3v or 4.5v depending (there are 2 types of cameras).

    Supply this voltage to an electromagnet and it keeps the shutter open. Cut the power, and it closes the shutter.

    What I need is a way to control the timing of the power to the magnet.

    Im hacking this into an already designed from the 1970s IC. So most of the mechanics and electrical is there, I just want to change some things around by doing this project.

    Substituting a part from the IC for this timing control is key. I know this can be done with dev boards and the like (regardless of size restrictions), but its all too complex and expensive for such a simple undertaking...or as simple as a timed switch can be.

    We're talking a volume about the size of about 6 AAA batteries stacked 2x3 and thats being generous. A pot fits fine with room to spare. A rotary switch of the same general size (of which ive found plenty online) would still fit.


    I mean, if there is a way to get a click stop dial to cause a timing circuit to pulse length according to the dial's setting...awesome. I assumed this had to be done with hexadecimal dials which can give feedback to a chip on its position. Or with a log-pot feeding the chip, but thats not a click stop dial, too "analog" feeling i suppose.
     
  10. notjustjay, Mar 14, 2011
    Last edited: Mar 14, 2011

    notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #10
    If a switchable resistor is not going to work then the microcontroller approach is probably the next best. There are lots of different chips you could work with including the Arduino, PICs and Basic Stamps to name a few.

    I searched Google for "PIC variable pulse train" and found this link:

    http://books.google.ca/books?id=V4e...&resnum=1&ved=0CBYQ6AEwAA#v=onepage&q&f=false

    It describes a simple circuit and accompanying source code. You could probably adapt something similar such that the PIC receives input from a control and adjusts its timing accordingly.

    The control could be a pot with detents, a set of binary toggles, or even a single pushbutton that cycles between different intervals, depending on your needs.

    Here's an example of a (5-pack!) PICAXE microcontroller board that's really small and could probably do the job:

    http://www.robotshop.com/ca/picaxe-08m-school-experimenter-kit-5pk-axe092k.html

    Use the DIP switches to specify your frequency.
     
  11. balamw, Mar 14, 2011
    Last edited: Mar 14, 2011

    balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #11
    If the rotary actuator is preferable, use it as a kind of DIP. Tie the common end of the switch high and then tie the other ends to a 16 bit (or two 8 bit) inputs on your MCU. Depending on the position of the switch, the MCU will see a given word and can act appropriately.

    EDIT: There's an old-school logic chip that might actually be useful here called a ripple counter. It consists of a bunch of flip-flops in a ladder structure. For a given input clock frequency, you get a number of divisions of that frequency out on other pins.

    Look up the 74HC4060 it seems to give you 10 binary related frequencies from its many pins. e.g. http://starter-kit.nettigo.eu/2010/humidity-sensor/

    B
     
  12. chown33, Mar 14, 2011
    Last edited: Mar 14, 2011

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #12
    The heartbreak of the 4060 is its omission of a Q11 output.

    74HC4020, 14-stage, Q1, Q4-Q14
    74HC4040, 12-stage, Q1-Q12
    74HC4060, osc + 14-stage, Q4-Q10, Q12-Q14

    The 74HC4040 may be a better choice here. Or maybe not.


    I see two difficulties in using MSI chips for this:

    1. You have to add an oscillator, or you have to use a chip with omitted divider outputs, or maybe add a chip just to get the missing divider stage (what I did the last time I used a 4060).

    2. You have to gate something (the output, or the oscillator, or an input) in order to generate only a single output pulse.

    None of that is terribly difficult for a logic-circuit designer, but once you add the chips to accomplish those, you've got multiple 16-pin DIPs, and now you have to figure out how you're going to fit all that into the available space.

    If there weren't a space constraint, then 2 or 3 or even a half-dozen MSI HCMOS chips would be fine. Or if the builder could handle surface-mount chips, the size could be reduced by 1/2 to 2/3. But given the constraints, I'm still thinking that a single-chip microcontroller is the best approach here. Add a ceramic resonator or use internal R/C clocking (if precision is adequate), and maybe a transistor output driver. That would all easily fit with a rotary switch into the 2x3 AAA-cell allotted space, unless it has to share that space with something else.

    For reference, 2x3 AAA-cell dimensions are roughly:
    30mm x 45mm x 20mm

    A 20-pin DIP package is roughly: 30mm x 10mm x 7mm
    A 16-pin DIP package is roughly: 20mm x 10mm x 7mm


    At this point one other thing is unclear to me: is the OP mainly interested in having someone design a circuit for him to build, or is the OP mainly interested in using a circuit even if he has to buy a kit from someone?

    There are also unanswered questions remaining, such as the current drive needed on the output, or exactly what device this is intended to drive. There may already be a solution available that does exactly what's needed, or knowing what the driven device is, we could look up the specs and design a circuit accordingly. 3V or 4.5V is at best half the necessary information.
     
  13. Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #13
    Im just looking for help on figuring out a solution to this project. Dont need a circuit designed or anything of that nature.

    Hell, phidgets could probably do this thing. But thats just overkill s'all.

    I had mentioned this is all just to time the on/off of an electromagnet.

    The system runs on 3xAAA or 2xAA batteries. AFAIK, you take the voltage in, run it thru the timing circuit and to the electromagnet. So I assume in my naivety that the current needed is 3-4.5v

    As if holding the battery wires directly to the magnet for a set period of time. I believe thats what Im trying to accomplish in a nutshell. All the mechanics of the magnet, and the circuit for all of that, is part of the camera im hacking. i just modding the timing part of it all.


    If my solution requires a big long circuit diagram, lots of components, its definitely not worth it. Im looking to find a solution which uses, hopefully, just the dial (hexadecimal or something?) with around a few stop set positions and then a timing chip (with any extra parts attached). its gtting all of these things talking and doing what I want, and someone telling me "no freaking way" or "if you do this, definitely".

    I hope im not being too wanton in my wording... :D
     
  14. Flynnstone, Mar 14, 2011
    Last edited: Mar 14, 2011

    Flynnstone macrumors 65816

    Flynnstone

    Joined:
    Feb 25, 2003
    Location:
    Cold beer land
    #14
    I see 2 ways to go:
    Analog : 555 timer or other Monostable. Use rotary switch to switch capacitors or resistors.

    Digital : Use a microcontroller. Pic or similar. Could use a dev board some are the size of a credit card. Some board even smaller like Basic stamp & others but how to connect to outside world.

    I'm an EE, I can envision this about the size of a postage stamp.

    Do you want to use this as a good learning exercise?
    You can even create a low cost custom board.

    How much current does the electromagnet draw?
     
  15. Sdashiki, Mar 14, 2011
    Last edited: Mar 14, 2011

    Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #15
    A resistor bank might work, but requires lots of parts and is honestly on the backburner while I figure this other solution out.

    Creating a custom board is not an issue, so long as the size is ok including the rotary dial. I can follow a schematic well enough, I think. And I am ALL FOR learning!

    If theres a way to program a timing controller chip to read settings from a rotary dial, and then insert this dial and chip into my circuits, we are in business. If I need a larger dev board connected at all time, cant happen.

    I have no idea what the magnet draws...let me go run a quick multimeter on it while its got power....ok 5 minutes later, what a pain with those mechanical parts in the way...when I got the magnet powered on as if it was doing a long exposure, it read 0.99v, so Ill call that 1volt.

    So does this mean my understanding that I input a 3v source into the entire system, but only 1v ends up at the magnet?
     
  16. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #16
    Current is measured in amps or milliamps, not volts.

    If you have a multimeter of some kind, with an amps or milliamps range (A or mA), we could tell you how to measure the current.

    If your multimeter has an ohms or resistance measuring function, that would also work. Simply connect the meter's leads to the shutter's leads and read the measurement in ohms or kilohms and post it.

    If you can't provide the actual current needed, either by measuring it or by providing a spec, then at least identify what the camera is so we have some chance of looking it up.
     
  17. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #17
    What did you think of the size of the PICAXE board I linked to? I think that'll do everything you need it to do.
     
  18. Flynnstone macrumors 65816

    Flynnstone

    Joined:
    Feb 25, 2003
    Location:
    Cold beer land
    #18
    Since this is a programming forum ... I go with that solution.

    How many positions to this Rotary switch?

    Say its 8, these can go into a Pic input port pins, 2 output pins, 1 for electromagnet, & 1 for an LED (got to have some flynndicators ;^) )
    Use a dev board to get the firmware working the way you want. Make a custom board if you need it small.

    Now if I've got the task correct, set the dial to the time period wanted, say 1/4 second, apply power to circuit and it pulses the electro magnet on for desired period. Am I correct?
     
  19. Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #19
    The magnet took forever to get a reading on. The mechanics of the shutter mechanism aside, when I put the 2nd probe to the magnet, it would turn off.

    So I had to probe and quickly look at the screen. Before it dropped to zero, somewhat slowly, it said about 20mA


    The switch would do best with 10-12 settings, I can work with anything between. I havent chosen one yet since I dont know what to buy. Theyve got kinds with solder pins for a mechanical switch which would work for a resistor bank instead of a programmed chip:
    P-H390.GIF
    and kinds with hexadecimal im assuming...thats needed for a programmable chip to understand whats what.
    R7072908-01.jpg

    No need for any feedback LED, the shutter clacking is enough feedback for anyone. It clacks open, clacks closed. Which makes figuring out if the timing is doing anything when Im hacking, easier! Though, not exact. But Im not at that point yet.
     
  20. Flynnstone macrumors 65816

    Flynnstone

    Joined:
    Feb 25, 2003
    Location:
    Cold beer land
    #20
    Perhaps a switch like :
    360-2372-ND at Digikey.com

    You want logic level. Or 28VDC or there about. Stay away from 120VAC rated.
    The 2nd one you have, the hexadecimal one would work, but is it too small to use? Also it may not have a long life span.
     
  21. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #21
    To measure current, the meter must be in series with the load, not in parallel.

    If you're putting the meter's two probes across the electromagnet to measure current, you're doing it wrong. That's how you'd measure voltage, not current.

    When a multimeter is configured to measure current, it basically places a calibrated low-resistance resistor between the probes (it's called a shunt resistor). The meter then reports the small voltage drop across the shunt as milliamps (or amps), according to Ohm's law. A typical shunt resistor for a meter with 200 mA full-scale might be 1 ohm.

    http://en.wikipedia.org/wiki/Shunt_(electrical)#Use_in_current_measuring
     
  22. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #22
    Likewise. There was just something about the problem that reminded me of simpler times. ;) Besides the previously mentioned PICAXE and similar boards, Microchip has a couple of USB driven starter kits for the PIC32 series (overkill, I know) that are small and very easy to use. (USB) Wish they would do something like that built around one of the SMT 8 bit PICs.

    Just FWIW if I did go with logic I wouldn't get the logic chips in DIP/through-hole. Most come is SSOP or TSSOP form factors and there are standard little proto boards for putting these things together with maybe a few discretes that save a LOT of space. (e.g. http://www.beldynsys.com/kits.htm)

    B
     
  23. Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #23
    So should I attempt to get the real mA across the magnet or is that useless info now?

    Its looking like the best way is to get a cheapo tiny dev board which can program a chip/dial with me, but then be placed off the board into the circuit Ive already got?
     
  24. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #24
    You do need to know what that load is. You may need some additional circuitry beyond the logic level provided by the MCU to get enough current. There are specialized relay drivers (usually MOSFET) you could use.

    B
     
  25. Sdashiki thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #25
    I am having trouble finding the spot to place the probes. Im touching one end of the magnets solder joint to where I believe the +/- input for the circuit is...and I dont get any readings.
     

Share This Page