help to make a timer

Mejlby

Member
Hi all
My names are Tonny and live in Denmark.

I am totally newbie within the programming of PIAXE but I think it is VERY interesting.

Is there anyone who can help me with the following?

I want to make a timer where I can adjust the time via a potentiometer. I would like to regulate the time from 0 to 5 minutes.
I would be happy if someone has a program for this and tell me how to do:)

Best regard
Tonny
 
Last edited:

MPep

Senior Member
Hello Tonny,

Welcome to the Forum.

Some questions first, how accurate does it need to be? To what resolution, ie 1ms accuracy? What are you using this for, what type of output? LED indication, motor control, etc?

Simple enough to do. Use commands such as READADC and WAIT, PAUSE.

MPep.
 

Mejlby

Member
Hello PBep
Thanks for your response - I want a timer for my UV-maskine when I make diagram of electronics chart . timer must have a præssision of about 1 second within 3 minutes.
I use a 5A relay to turn the UV light. I have created a timer with a 555 and a kapacitor but it is not accurate and I want to be able to regulate the time from 0 to 5 minutes

Greetings
Tonny
 
Last edited:

Mejlby

Member
ohhhh hello again

i have read that:

main:
readadc C.1,b1 ; read value into b1
if b1 > 50 then flsh ; jump to flsh if b1 > 50
goto main ; else loop back to start
flsh:
high B.1 ; switch on output 1
pause 5000 ; wait 5 seconds
low B.1 ; switch off output 1
goto main ; loop back to start

What is > 50 ? is its ohm ? ( resistance ) or Volts ?

Best regard

Tonny
 
Last edited:

MPep

Senior Member
The 50 in this case is a voltage measurement.
50/256 steps @, say, 5V supply. The program you posted switches something ON for 5s when an analogue sensor reaches a minimum level.

Try the following code. Use the simulator to test. Hope it makes sense to you. Good luck.

MPep.

Code:
#picaxe 08M

Symbol ControlIP = 2
Symbol LightOP = 4
Symbol ControlADC = B1
Symbol LoopCount = B0

main:
LoopCount = 0
readadc ControlIP,ControlADC     ; Read value into b1
high LightOP             ; Switch on output 4

for LoopCount = 1 to ControlADC
    pause 1000            ; Wait in 1 second periods
next

low LightOP             ; Switch off output 4
end                    ; Finish the program once done
 

Haku

Senior Member
Something to think about in the future once you've got things running; if you wanted more accuracy you could use two potentiometers, one for minutes and another for seconds.
 

boriz

Senior Member
Did you read the manuals yet?

You will need some sort of display of the programmed time. You need to read the position of the potentiometer and display that as a time on whatever display you use. Then the UV light comes on and the timer begins counting down when you press the START button.

So the first part of your program is – scan potentiometer, calculate time, display time, check START button, loop. Until the START button is pressed, then the UV light is turned on and control passes to the second part.

Then you presumably want a live countdown, and a STOP button. So the second part of your program is – count interval, display time, check STOP button, check if time over, loop. Until the STOP button is pressed or the time is over, then the UV light is turned off. Then go back to the beginning.

Is this a fair assessment?
 

manuka

Senior Member
Surely you don't need within a second for a 3 minute exposure? At that interval my PCB experiences indicate perhaps to within 10 seconds as quite tolerable. You'll get drift anyway if a simple carbon/metal film potentiometer is used, & of course the UV lamp may have warm up & aging issues.

The simplest inbuilt resonator PICAXEs time to within 1% (~1 minute in an hour), but this is influenced by temperature and perhaps supply voltage. It'll be more reliable than a 555 however, but for tighter timings try something like a cheap digital clock/watch hack, or use a DS1307 IC. Stan.
 
Last edited:

SAborn

Senior Member
If you are electronic knowledgeable and dont mind a hack with a little effort, the front control panel from a discarded microwave oven makes for a excelent countdown timer control.

If you have no knowledge of working with mains power than you best not take this approach.

The front panels normally have their own transformer on the board and a relay switching for the secondary transformer.
If you run them on full power setting the relay will remain latched for the full time countdown.
You can select from hours down to seconds.
 

hippy

Technical Support
Staff member
timer must have a præssision of about 1 second within 3 minutes.
That could be achievable with a PICAXE but the biggest difficulty will be setting the time on a pot with equal accuracy; a 270 degree pot would be about one second for every 1.5 degree of turn if it covered 0-3 minutes.

You could increase accuracy by having the pot select 2-3 minutes giving around one second per 5 degree turn.
 

Dippy

Moderator
How accurate do you really need it?
As mentioned by others the UV exposure is not +/- 1 second critical.

My little box (made in UK in 1997 and still working) has a buzzy clcockwork rotary timer.
Exposure time typically 2 minutes is fine for Fotoboard and give or take 10 seconds can easily be allowed for at the developing stage.

Reproducibility is important.

If I were making a timer, I'd be tempted to use a rotary switch to select minutes and a pot for the seconds.
Or keypad or up/down buttons plus display.
 

MartinM57

Moderator
My little box (made 2009 with loads of cheapy chinese UV LEDs) typically takes 13 minutes give or take 30 seconds for Fotoboard (told you they were cheapy chinese UV LEDs :D) and has flying leads into my power supply.

...and then I use one of these...and when it goes off I pull the leads out of the power supply and it all goes dark
 

Attachments

Mejlby

Member
preliminary thank you to all who have contributed with help for my little project. Now I will test some of all the proposals and I hope that I can learn a little of everything as everyone has contributed. I am very grateful that so many are willing to help .... and maybe one day I become expert in programming :):):)
 

SAborn

Senior Member
.... and maybe one day I become expert in programming :):):)
Well best you hurry it up as the forum needs an expert so Hippy, Dippy, BB, and Westy, can all have a long over due break.

The world needs more experts, we dont have enough, unless you are a lawyer or a wife.

Good luck with your project.
 
Top