Propeller Clock.

shamu

Member
Hi all.

I have been working on a propeller clock for a few months now and I'am almost there.
The problem now is that as the speed of the motor varies so does the spacing of the display, too slow and there is a gap at the end of the display, too fast and the display isn't complete.
Each rotation of the display triggers an input on pin c.2 using a Hall effect switch. I have tried using PULSIN on the Hall effect to time each rotation and space the display in proportion but this doesn't work as I need the Hall switch to register the start position for the display also.

Using SETINT worked as a trigger but again wouldn't work with PULSIN.

I think the key lies in getting the Hall switch to work as a trigger to start the display and as an input to the PULSIN.

Any help or suggestions would be greatly appreciated, thanks.





Code:
main:

#picaxe 40X2
#no_data
#no_table

setfreq em16 ' This line sets th clock speed to 16 MHz.
             ' A 16MHz resonator needs to be connected to pins 13 & 14.

let dirsA = %11111111  ' Set port A as all outputs.
let dirsB = %11111111  ' Set port B as all outputs.
let dirsC = %11111011
let dirsD = %11111111  ' Set port D as all outputs.

SYMBOL wandspeed = w25
SYMBOL segmentgap = w26

low C.1 'Blue when high.
high C.5 'Red when high.


' Turn ports B & D off
let outpinsA =%11111111
let outpinsD =%11111111
let outpinsB =%11111111


high C.1 'Blue when high.
low C.5 'Red when high.

start:
      
  pulsin c.2,0,wandspeed
  segmentgap = wandspeed / 20
  
  let outpinsA = %00000000
  pause segmentgap
  let outpinsA = %11111111
  pause 30
  let outpinsA = %00000000
  pause segmentgap
  let outpinsA = %11111111 
          
         
goto start
 

Attachments

westaust55

Moderator
Rev Ed make the AXE135 'Space Writer' (aka propeller) kit which also uses the persistence of vision (POV) methods.
Have a look at the Datasheet and see how that works;
http://www.picaxe.com/docs/axe135.pdf

Other forum members have also built and posted about such PoV clocks etc so try a forum search for concepts and ideas.

This search in Google finds many POV threads on this forum:
site:http://www.picaxeforum.co.uk/ POV
Include the "site:" at the start


EDIT: a number of examples and links in this thread alone: http://www.picaxeforum.co.uk/showthread.php?10890-POV-Clock
 
Last edited:

vttom

Senior Member
Instead of measuring the pulse width, can you use the timer variable to time how long the spinner takes to make 1 revolution? (basically, when the hall effect triggers, sample the value of the timer variable then reset it)
 

westaust55

Moderator
Instead of measuring the pulse width, can you use the timer variable to time how long the spinner takes to make 1 revolution? (basically, when the hall effect triggers, sample the value of the timer variable then reset it)
The timer variable only counts in whole/integer seconds thus you would not know for example if it is exactly 2.0 or 2.99 seconds/increments.


In the OP's posted code:
#picaxe 40X2
#no_data
#no_table

setfreq em16 ' This line sets th clock speed to 16 MHz.
' A 16MHz resonator needs to be connected to pins 13 & 14.

Note that when an external resonator is used, the PICAXE internally operates at 4 time the resonator frequency thus a 16 MHz resonator will have the PICAXE operating at 64 MHz with any "em" parameter.
 
Last edited:

hippy

Technical Support
Staff member
Code:
start:
  pulsin c.2,0,wandspeed
  segmentgap = wandspeed / 20
  let outpinsA = %00000000
  pause segmentgap
  ::
goto start
The problem may be that the time to execute "segmentgap = wandspeed / 20" varies depending on value of wandspeed. This would cause the first "let outpinsA=" to execute at differing times after the sync sensor pulse.

You could move the "segmentgap = wandspeed / 20" to the end, before the "goto start", calculate what the gap should be for the next sequence based on the speed of the last. That should work if the motor speed does not vary too much between each revolution.

You might be able to get better results with using PAUSEUS and a less coarse division of 'wandspeed' but that depends on what speed the display rotates at. What is the speed and what values of 'wandspeed' are typically seen ?
 

Paix

Senior Member
Originally you mentioned that the motor speed appeared to vary, so once you are happy with your triggering of the display, might a bit of a flywheel be useful to iron out minor speed variations. I suspect that the secret there is to have a sufficiently powerful motor that won't be unduly influenced by minor fluctuations in the environment or power supply.
 
Top