help a old coot out.....
zippyflounder
Posts: 38
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
zippy
Comments
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
Perhaps you could use a chip and a GPS: keep it tuned to the rest of the world...
Post Edited (zippyflounder) : 8/8/2008 7:15:41 AM GMT
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
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
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
As a side note, you may want to add a power off button that pulls all the segments in for transportation.
http://alvinaronson.com/
click on da clock
then on video.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
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.
·
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!
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
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
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
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
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?