Shop OBEX P1 Docs P2 Docs Learn Events
help a old coot out..... — Parallax Forums

help a old coot out.....

zippyflounderzippyflounder Posts: 38
edited 2008-08-08 22:22 in BASIC Stamp
I am in a bit of a quandry, I have to build a digital clock (seven segment) but its output is through servos. What basic stuff would I need? I am new to this, havent played with a micro in over 10 years so its all really new to me. Thanks in advance


zippy
«1

Comments

  • JonathanJonathan Posts: 1,023
    edited 2008-08-07 18:40
    Zippy,

    We need a little more detail. I take it that the displays are mechanical? Do they need one servo per digit or 7? How many digits are to be in this clock? Do you need continous rotation servos or standard? How exactly do the display work? Give us as much detail as you can.

    Once we have a handle on the problem, then we get to solutions. [noparse]:)[/noparse]

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • SRLMSRLM Posts: 5,045
    edited 2008-08-07 18:55
    Do you have a picture of the clock part yet? Keep in mind that you'll need a time keeping chip since the BS2 doesn't have a real-time clock.

    Perhaps you could use a chip and a GPS: keep it tuned to the rest of the world...
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-07 19:05
    the output drives the servos which move steel cut plates·in and out to display the time, that part I have handled. I know paralax sells a servo driver boad for the stamp, and 2 of them (32 outputs) will do the job just fine. What I need to know is if I need that clock chip, and then how to code the whole beast togeather. No i dont want anything but the dang clock, thats it for now, down the road who knows.

    Post Edited (zippyflounder) : 8/8/2008 7:15:41 AM GMT
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-07 19:14
    I am using standard servos, with 90 degree rotation, 1 servo per segment of the 7 seg display for a total of 29 (one for the colon). I need to set the clock to real time so either a led display is mirrored or a "set" button is used to show the display. The display only shows on a programed time, some times its flush, others its in display mode where the servos move the steel plates up from flush. Here is something very like what I am looking to do.http://alvinaronson.com/ click on da clock, then on video.
  • JonathanJonathan Posts: 1,023
    edited 2008-08-07 19:29
    Ok, if you have the mechanical part dialed, as mentioned above the next thing to do is select a timebase. There are a number of Real Time Clocks available and code to use therm with. All you need to do is get one, get it working including setting it, then take the time and translate it to whatever the mechanical display requires.

    A GPS option was also mentioned above. That's actually what I do. I have a Propeller reading a Motorola Oncore GPS that I got dirt cheap on epay. THe GPS also has a backup RTC in case you can't get sats. I then retransmitt the time locally via RF so that any project I build can tap into this "universal" time base with a cheap RF receiver. Another cool thing about going this route is that you can automatically set for daylight saving, and you never need to set the clock so you don't need to deal with input to set it. It's great, plug the clock in and it sets itself! I have several nixie tube clocks that use the time base, plus my garden timer, solar hot tub controller etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-07 19:38
    Jonathan, all that gps stuff sound wonderful, however i have no need for it on this project. The part "all you need to do is"...where It all stops. I have not used a stamp in over 10 years, dont remember a dang thing about them (i am over 50) so consider me a total virgin in this world. I am stuck however, need to bang this sucker out fast or my client is going over the fence.
  • JonathanJonathan Posts: 1,023
    edited 2008-08-07 19:58
    Ok, go and get a DS1302, available on the Parallax website. Note that you need the crystal. On the same page as the DS1302 there are all the docs and sample code you will need.

    The docs and code will show you how to hook it up and get it outputting the time to the debug window. Once you have that going, it's time to figure out how to drive your servos. To help with that we are going to need exact details of how the diplay works. It sound like each single segment has a servo and each segment has 2 positions shown or unseen. Take a look at the LOOKUP command for starters.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-07 20:02
    thanks, and your right the servos have only 2 postions, flush and "up" hopefully parallax has got a little better at this stuff as one of my few memories of working with the stamp years ago was UGGGGGGGGGGGGGGGGGGG! WHY IS IT NOT WORKING lol.gif
  • JonathanJonathan Posts: 1,023
    edited 2008-08-07 20:07
    Actually, I guess while you wait for the DS1302 (since you are in a hurry) take a look at the format of the DS1302 output. I think it is HHMMSS. You can create the variables you will use with the RTC, and fill them with "dummy" data for now. Then you can work on getting your servo positioning right.

    For starters you need to seperate the tens and ones. For example, lets say that your variable "hours" contains 12. We need to seprate that into a 1 and a 2. For this we use the divide and mod functions, like this

    hours VAR byte
    hoursHi VAR byte
    hoursLo VAR byte

    hours = 12
    hoursHi = hours / 10
    hoursLo = hours // 10

    Now, hoursHi contains a 1 and hoursLo contains a 2. At this point is where the lookup table is involved and where we need to know more about the display.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • SRLMSRLM Posts: 5,045
    edited 2008-08-07 21:00
    You'll also want to figure out how you are going to program the chip. The best solution would probably be a couple of buttons on the back of the case, possibly with an LCD so that you don't have to flip the segments when setting the time. Alternately, you could preprogram the chip before you put it in, but then you have to make sure that it has contant power available.

    As a side note, you may want to add a power off button that pulls all the segments in for transportation.
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-07 21:44
    i was thinking of having the display funtion (its on a delay remember so the time is not always displayed only when "on" and flush when "off" ) with a button that just powers up the 2 servo driver boards by passing the basic stamp module. this is very close to what i am attemting

    http://alvinaronson.com/

    click on da clock

    then on video.
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 02:19
    what basic stamp kit should i get to get started on this beastie?
  • FranklinFranklin Posts: 4,747
    edited 2008-08-08 02:29
    If it's just two positions you might want to think about solinoids

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 02:31
    franklin, solinoids are quite noisy....bang on bang off, and oddly servos are cheaper now too.
  • SRLMSRLM Posts: 5,045
    edited 2008-08-08 04:19
    The regular BS2 would probably be the best. You don't need processor speed, and the RAM and EEPROM should be plenty large enough for your application. I'd recomend using the BOE to build and test your cicuit, then going to a· permanent solution. Question: for your clock, are you going to provide a pulse to the servos all the time, or just when you move the segments?· Also, is it going to have a wall plug, or is it going to run on batteries? You may want to check the current for moving a servo, and see how much your battery can provide. My guess is that it can drain the battery pretty fast.
    zippyflounder said...
    i was thinking of having the display funtion (its on a delay remember so the time is not always displayed only when "on" and flush when "off" ) with a button that just powers up the 2 servo driver boards by passing the basic stamp module. this is very close to what i am attemting
    Also, how will you program when to display the time? It sounds like you want to do it manually. If you want the BS2 to have an "alarm clock" function, then you'll need some sort of input. You have enough pins for a couple of buttons and an LCD to set things, if that fits your design.

    ·
  • SRLMSRLM Posts: 5,045
    edited 2008-08-08 04:19
    Do you have any pictures of the mechanical part? I am curious what yours looks like...
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 04:29
    the uint will be powerd by a wall brick, 9 v 1 amp so it should be ok. the servos will have 2 postions with the pulse strings defining them. There is no alarm function and setting the unit will be either with a mirrored led display or a button that puts the energized segments into the up postion irregardless of the display timer.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-08-08 06:18
    One amp is awfully light for powering 29 servos, if a good many of them move simultaneously. I would opt for a lower voltage and a lot more current. A hefty 6V switching power supply would not be out of the question here to power the servos (and BOE), so you don't have any linear regulators overheating.

    You will need to compute a power budget, based on the maximum current draw of one servo, multiplied by the maximum number of servos moving simultaneously, then times 1.5 for a margin of safety.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 07:09
    SRLM said...
    The regular BS2 would probably be the best. You don't need processor speed, and the RAM and EEPROM should be plenty large enough for your application. I'd recomend using the BOE to build and test your cicuit, then going to a· permanent solution. Question: for your clock, are you going to provide a pulse to the servos all the time, or just when you move the segments?· Also, is it going to have a wall plug, or is it going to run on batteries? You may want to check the current for moving a servo, and see how much your battery can provide. My guess is that it can drain the battery pretty fast.
    zippyflounder said...
    i was thinking of having the display funtion (its on a delay remember so the time is not always displayed only when "on" and flush when "off" ) with a button that just powers up the 2 servo driver boards by passing the basic stamp module. this is very close to what i am attemting
    Also, how will you program when to display the time? It sounds like you want to do it manually. If you want the BS2 to have an "alarm clock" function, then you'll need some sort of input. You have enough pins for a couple of buttons and an LCD to set things, if that fits your design.

    would the bs2pe http://parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/CategoryID/9/List/0/SortField/0/Level/a/ProductID/451/Default.aspx·be up to the task?
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 07:10
    Phil Pilgrim (PhiPi) said...
    One amp is awfully light for powering 29 servos, if a good many of them move simultaneously. I would opt for a lower voltage and a lot more current. A hefty 6V switching power supply would not be out of the question here to power the servos (and BOE), so you don't have any linear regulators overheating.

    You will need to compute a power budget, based on the maximum current draw of one servo, multiplied by the maximum number of servos moving simultaneously, then times 1.5 for a margin of safety.

    -Phil

    the elements are on·guide pins, so the servos really have very little load on them in my testing I was seeing 20 ma for full out and in.
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 17:35
    i was looking at the paralax servo drivers, wonder if i could just rig the bs2 as a led 7 seg clock then take the annode leads and jumper them over to the servo contollers........
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-08-08 18:34
    The least risk way of doing this is to use the two servo boards you called out in the beginning, driven by one BS2 on a BOE board which has a DS1302 clock chip, with a CR2032 coin-cell for battery backup, and a 32 Khz crystal can oscillator for the DS1302 time-base.

    The code will be something more-or-less simple like (in pseudocode):

    NextUpdateTime VAR WORD

    · gosub ReadClockValue
    · NextUpdateTime = ClockValue + 60 Seconds

    Main:
    · While ClockValue < NextUpdateTime DO
    ··· Pause 100
    ··· GOSUB ReadClockValue
    · END WHILE
    · NextUpdateTime = ClockValue + 60 Seconds

    · For each segment DO
    ··· Figure Out New Segment Servo Patterns
    · NEXT

    · For each Segment Do ' This is separate to allow you 'cool' change patterns
    ··· Send out New Segment Servo Patterns
    · Next
    GOTO MAIN

    The reason you'll need the Servo boards is that you're going to want to 'refresh' 32 servo's. The BS2 doesn't have enough PINS to refresh that many servo's, not to mention the memory or cycle time.

    With the boards, all you have to do is figure out the position, have the BS2 send it ONCE per servo change, and the board handles the rest.

    And yes, you really should 'refresh' the servo positions to insure they "hold position". I suppose you COULD design it such that each segment has a tiny little bit of friction holding it either "IN" or "OUT" while it's at rest, in which case you wouldn't HAVE to refresh them.

    20 mA * 32 servos == 640 mA which I agree is pretty good. All it takes is some wise-guy kid to hold in a couple of segments, and you could brown-out your power and get a reset. If this isn't a possibility, you should be good.

    Oh, and I should say, this project looks really cool!


    Post Edited (allanlane5) : 8/8/2008 6:41:02 PM GMT
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 18:37
    allanlane5 said...
    The least risk way of doing this is to use the two servo boards you called out in the beginning, driven by one BS2 on a BOE board which has a DS1302 clock chip, with a CR2032 coin-cell for battery backup, and a 32 Khz crystal can oscillator for the DS1302 time-base.

    The code will be something more-or-less simple like (in pseudocode):

    NextUpdateTime VAR WORD

    · gosub ReadClockValue
    · NextUpdateTime = ClockValue + 60 Seconds

    Main:
    · While ClockValue < NextUpdateTime DO
    ··· Pause 500
    · · GOSUB ReadClockValue
    · END WHILE
    · NextUpdateTime = ClockValue + 60 Seconds

    · For each segment DO
    ··· Figure Out New Segment Servo Patterns
    · NEXT

    · For each Segment Do ' This is separate to allow you 'cool' change patterns
    ··· Send out New Segment Servo Patterns
    · Next
    GOTO MAIN

    The reason you'll need the Servo boards is that you're going to want to 'refresh' 32 servo's. The BS2 doesn't have enough PINS to refresh that many servo's, not to mention the memory or cycle time.

    With the boards, all you have to do is figure out the position, have the BS2 send it ONCE per servo change, and the board handles the rest.

    And yes, you really should 'refresh' the servo positions to insure they "hold position". I suppose you COULD design it such that each segment has a tiny little bit of friction holding it either "IN" or "OUT" while it's at rest, in which case you wouldn't HAVE to refresh them.

    20 mA * 32 servos == 640 mA which I agree is pretty good. All it takes is some wise-guy kid to hold in a couple of segments, and you could brown-out your power and get a reset. If this isn't a possibility, you should be good.
    thanks, the next fun thing after i get this one working is going min production..about 1k units a year wheeeeeeee.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-08-08 18:46
    Oh, really?

    Then you're probably going to want to look at an SX implementation of the above. The Parallax 'SX48' boards (not to be confused with the BS2SX, that's a different beast) will provide you sufficient horsepower AND I/O pins on a single board. Program it with SX/Basic, and you may be able to produce ALL the Servo control signals from a single $10 board. I think the DS1302 will mount on the board, as well.

    That's one of the difficulties of building prototypes -- if you're only building one or two "production" units, the BS2 is a superior prototyping platform. If you're building a thousand, then it can be much cheaper to 'move' some of the functionality off of hardware onto the processor.

    http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/362/List/1/Default.aspx?SortField=ProductName,ProductName

    That's the·SX48 board.· Now, you WILL have to invest another $100 or so to purchase the "download" hardware to support that board.· And programming it is slightly more difficult.· I think that's offset by reducing the hardware cost per unit you build by $50 or more.

    Post Edited (allanlane5) : 8/8/2008 6:55:21 PM GMT
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 18:50
    allanlane5 said...
    Oh, really?

    Then you're probably going to want to look at an SX implementation of the above. The Parallax 'SX48' boards (not to be confused with the BS2SX, that's a different beast) will provide you sufficient horsepower AND I/O pins on a single board. Program it with SX/Basic, and you may be able to produce ALL the Servo control signals from a single $10 board. I think the DS1302 will mount on the board, as well.

    That's one of the difficulties of building prototypes -- if you're only building one or two "production" units, the BS2 is a superior prototyping platform. If you're building a thousand, then it can be much cheaper to 'move' some of the functionality off of hardware onto the processor.
    thanks for the heads up, was hoping that there were some chips out there with the Io's i needed, will be fun though doing board design and debugging (NOT).
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-08-08 18:57
    http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/362/List/1/Default.aspx?SortField=ProductName,ProductName

    Parallax has done 99% of the board design and build for you, in this $10 module. Solder in an 8-pin socket for the DS1302, add a few wires, solder in connections for 32 servo's, add a few more wires, and you're good to go.

    Now, as I edited in earlier, you'll need the SX development system for $100 or so. But this would dramatically lower your CPU hardware costs.

    Here's a development system (WITH the absolutely needed "SX-Key" tool) for you to evaluate the above solution:
    http://www.parallax.com/Store/Microcontrollers/SXProgrammingKits/tabid/140/CategoryID/17/List/0/SortField/0/Level/a/ProductID/364/Default.aspx


    Post Edited (allanlane5) : 8/8/2008 7:02:32 PM GMT
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 19:36
    allanlane5 said...
    http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/362/List/1/Default.aspx?SortField=ProductName,ProductName

    Parallax has done 99% of the board design and build for you, in this $10 module. Solder in an 8-pin socket for the DS1302, add a few wires, solder in connections for 32 servo's, add a few more wires, and you're good to go.

    Now, as I edited in earlier, you'll need the SX development system for $100 or so. But this would dramatically lower your CPU hardware costs.

    Here's a development system (WITH the absolutely needed "SX-Key" tool) for you to evaluate the above solution:
    http://www.parallax.com/Store/Microcontrollers/SXProgrammingKits/tabid/140/CategoryID/17/List/0/SortField/0/Level/a/ProductID/364/Default.aspx
    thanks that looks like the ticket and with the 2 processors i have more than enough i/0's
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-08-08 19:38
    For production units, this seems like an ideal application for muscle wire instead of servos, since the range of motion is so short, and there's hardly any mechanical load. It'd be way cheaper, whisper quiet, and more compact. However, your power requirements would go up substantially.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • zippyflounderzippyflounder Posts: 38
    edited 2008-08-08 19:41
    Phil Pilgrim (PhiPi) said...
    For production units, this seems like an ideal application for muscle wire instead of servos, since the range of motion is so short, and there's hardly any mechanical load. It'd be way cheaper, whisper quiet, and more compact. However, your power requirements would go up substantially.

    -Phil

    phil, I have worked a lot with muscle wire and your right on all points however fabing the little buggers up makes them more expensive than chinese servos (i get them for 3 bucks a pop). thanks for your thoughts though.
  • SRLMSRLM Posts: 5,045
    edited 2008-08-08 22:15
    If you choose to stick with the BS2, you can get a good board here:

    http://parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/CategoryID/12/List/0/SortField/0/Level/a/ProductID/121/Default.aspx

    However, If you can figure out the SX, it would drive down your cost by quite a·bit.

    As for the servo power requirement, They probably do not have to be refreshed. My guess is that the internal resistance to movement (in an unpower state) will hold the plate in position. Plus, it could allow for kits pushing or pulling on the segements. This probably won't work if the steel plates are moved verticall, but in the nature of clocks it should most likely move horizontally. True? False?
Sign In or Register to comment.