Dave it was the use of capacitors to give very long debounce times that got me involved in the project to start with, the charge current was almost welding the tilt switch
Dave, yep all my reference is to what was happening previously, it was a max ox 14v through a tilt switch onto the gate of a mosfet the capacitor and resistor network across the tilt switch was 47 ohm and 22uf from memory and it wasn't going well for the tilt switch, as well as contact bounce they were trying to extend the pulse.I see, but if you are current limiting the input pin Via a resistance so when it parts company with the switch contact all that happens is the bounce is smoothed out, no more current flows and the CPU pin stands stead at zero or 5V , assuming you are using pullup or pulldowns whichever way you are initiating the input.
I do know a little about welding caps, but trust me with five volts and the fact you are not charging up an open ended cap I see no problem .
Smoothing across an open contact is of course a little different and requires a resistor in series with the cap, gauged to snub only within the current limit of the switch, this is not a problem if you want to ignore the subsequent pulses in the program.
This is not your
do TIME = 0 ;reset timer tiltDetected = 1 ;say tilted do while TIME < 30 ;examine pin for 30 seconds if TiltPin <> tilted then ;not tilted tiltDetected = 0 ;say not tilted exit ;abandon check endif loop if tiltDetected then ;ramp-up motor for required time ;ramp-down motor for required time endif loop
Thanks Phil, only need to detect when it needs tensioning, and your right the may well be 30 seconds or longer when the tilt switch can't mak its mind up, from the test clocks i have worked on while testing it has often taken 15mins between drive pulses, you can't see the drum rotating, i don't think the current test rig at the start of the thread is capable of going slow enough to mimick the clock function, really it needs to be a slow motor driving a large diameter disc so we can really slow the whole thing down, then there is the issue that on a clock its very very slow till its triggered then the motor drives back to the starting position in about 400ms and i will struggle to get the test rig to do that unless its redesigned to mimick the clock action.or just that it needs tensioning
I was thinking more about the real implementation rather than the test rig - though I've an idea for the latter.I don't think the current test rig at the start of the thread is capable of going slow enough to mimic the clock function, really it needs to be a slow motor driving a large diameter disc so we can really slow the whole thing down, then there is the issue that on a clock its very very slow till its triggered then the motor drives back to the starting position in about 400ms and i will struggle to get the test rig to do that unless its redesigned to mimick the clock action.
Phil yep i understood that to be the case, do you think windscreen-wiper motors are ever driven PWM? would be trial and error i guess to get that right, PWM drive wasn't something that could be done previously, but can with the picaxe.BTW - the code above was pseudo-code, rather than anything practical.
Current motor because it is geared doesn't free run, in fact it can't be turned by hand, maybe a spring where you have an arrow, and allow the motor to wind and unwind the string
Yes.Current motor because it is geared doesn't free run, in fact it can't be turned by hand, maybe a spring where you have an arrow, and allow the motor to wind and unwind the string
I assume this is for tilt switch testing?
The experimenting's the fun bit!do you think windscreen-wiper motors are ever driven PWM? would be trial and error i guess to get that right
In fact only needs a recoil spring and you have cracked it!!
They tried various combinations but couldn't get it right, they were often burning mosfets out too, the gate pulldown resistor was set at 3.9k, as you say the mosfet possibly was slightly on would give a reason for burning them outIf they were trying to extend the pulse then it would have been better to have increased the resistor to a 280 R the cap could have stayed as was or even greater say up to 220 UF and the gate pulldown say 2.2K
The 555 allowed me to set the "on" time and disregard any unwanted false triggers from the tilt switch, the current on the tilt switch was very low too.Now I don't quite get what you are using the 555 for, I thought it gave the output for the mosfet and drive motor from the activation of the tilt switch
test rig is not so jittery but i can feel it and we don't get that on a clock, it was just a thought.Is you test rig really that jittery?
So much so that you cannot either smooth it.
What! 0 . 4 seconds to do the rewind , for a 15 min runtime ?
What is wrong with taking a few leisurely seconds to wind up.?
I thought we were getting away from those?Or a weight ?
Dave they will run for a week or 168hr from a 12v 10ah lead acid battery during mains fail.I will bet though they are not run when under battery power only.
Dave yep thats the problem at the moment i have 2 directions, the future of the product and problem solving at the moment, and a growing list of things to tryJust a rambling thoughts, once you have your new hardware in place you do not want to have to keep updating anything except the program.
Dave Tilt switch triggers timer, timer triggers motor via n-channel mosfet, they don't want the motor spluttering about so extend the ontime to even out the way the motor worksDaft questions. Does the tilt switch drive the motor ? Or does the timer drive it?
I cannot help but wonder why anyone would extend the opening of the original switch unless it was to extend the run of the motor.
Dave if you have a look at Hippy's post number #74 the pins b1 to b4 are along the lines of his sketch and the code to go with it, i am just copying it.Which pins are the supply pins to the switch and which are the input pins,
That could be quite advantageous, as far as a test rig is concerned. I thought it might be difficult striking a balance between the arm descending very, very slowly - and it not moving at all.Current motor because it is geared doesn't free run, in fact it can't be turned by hand...
Personally, I don't think you'll need to go to such lengths ... I reckon it's just the un-repeatability and lack of snap ON/OFF action that's causing the issues. Depending on when exactly it triggers, maybe 400mS isn't always long enough - even though most of the time it is.I will allow the tilt switch to be connected in 2 ways so it can be direct on a pin and an alternating pulsed DC as hippy surgested, I can use a spare pin for PWM drive so we can slow the motor when winding up, this will be ok on the clock side by where the chimes get driven from it's on most of the time when the clock is chiming, I don't have much space to slow it down before it falls behind, if you know what I mean, but still something could be done.
PWM is bread-and-butter stuff for the Picaxe - lots of expertise in using it on here! (Being on the 'wrong' pin might not be an issue ... there are ways to twiddle things behind the scenes (viaI have just had a look at my circuit for a picaxe to replace the 555, hoping that the pin that i use to drive the mosfet was a PWM pin seems its not but i can alter the circuit and re produce the pcb's to allow this, i guess i can just send PWM signal direct to the mosfet in the way i currently send an on signal? Never done anything with PWM
pokesfr) that might help).
Thanks Phil for ongoing ideas, the arm only wants to move through an arc of 15 degrees and needs to do that over a 15min period thats the hard bit its moving just so slowly, going to be a really fine balance, not sure i can drive the motor slow enough in the weight direction.Adjust the mass, until the arm descends at a rate that you see in the real world
i want to cover all bases if i am making a test pcb, i don't want to jump any further with a complete design until i can find more out about the cause, the current test rig has at least found that there are multiple triggers from the tilt switch, i had worked out there was sometime a second one, but we know that without contact bounce pause there can be upto 7 bouncesPersonally, I don't think you'll need to go to such lengths
if you look at my previous thread "switching issues" last post #82 you can find my current code for the picaxe circuit, in post #50 you can see a pic of the control box with a small sub board that has the 08m2, i need to alter the code to suit the 3 thoughts you have above, have a look see what you think? Currently its 400ms after the last pulse i think, assuming all the pulse are within 400ms of each other, if the pulses are slower than 400ms then it will drive twice as is needed on the part of the clock that drives the chimes.My feeling about the current tilt switch, is that you either trigger the motor
Whichever gives the most repeatable result.
- from the first detection of a change of state
- a fixed time after the first detection
- or when it's been solidly activated, for a set time.
Dave i am already doing more than this with a 08m2, so driving an led to mimick what the switch is doing must only be a few extra lines of code, look at my previous thread "switching issues" last post #82 you can find my current codeAs for LED driving, driving pseudo AC controlling from 2 switches and PWM from it really all these things at the same time from a 14 pin Picaxe chip, enough already.
Yes i am still interested in this too i hope to have a chat with the manufacturer this week and get some direction before i spend too much money for him, i just need to get him on board, at least we all have some great ideasAlso the magnetic position sensor seem to be something to consider instead of the tilt switches for your new builds.
Phil you laugh but my thread "Vmusic2 cockrill" is possibly the start of something exactly like that, its a project where there are multiple motor, i have not seen the project yet, but i started the tread because one item that was required was the playing of a cockrill track as required and wanted to be sure it could be doneI can't wait for phase 2, where it has to look after three tilt switches and three PWM motor outputs
I wasn't expecting the motor to have to be driven in reverse - with an appropriate mass, gravity should do the work. The aluminium arm will act as a lever, reducing the amount of mass required.the arm only wants to move through an arc of 15 degrees and needs to do that over a 15min period that's the hard bit its moving just so slowly, going to be a really fine balance, not sure I can drive the motor slow enough in the weight direction.
The base pic (PIC12(L)F1840) has a PWM module that can be 'steered' to C.4, but the Picaxe firmware only allows control of the one on C.2.Regards pins on the 08m2 for PWM currently the motor is controlled by pin C4 which currently does have PWM ability?
pwmoutstatement is standard 'Picaxe Basic' and would need adjusting to suit the motor).
#picaxe 08m2 #no_data symbol APFCON = %01011101 ;$11D - Alternate Pin Function symbol PSTR1CON= %10110110 ;$296 - PWM Steering Control Register symbol CCP1SEL = bit0 symbol P1BSEL = bit1 ; ; Use 'sfr magic' to start PWM on PinC.4 (this is not normally allowed by Picaxe firmware) ; ; We can redirect PWM P1B to RA4/C.4, rather than RA0/C.0 (where it doesn't work on Picaxe) ; Then we can configure PWM to use P1B on that pin. ; peeksfr APFCON,b0 P1BSEL = 1 ;P1B on RA4/C.4 instead of default RA0/C.0 ;See description of Register 12-1, Page 99 ;of PIC12(L)F1840 datasheet pokesfr APFCON,b0 ; ; Now reconfigure PWM to use P1B. ; pokesfr PSTR1CON,%00000010 ;Steer PWM to P1B (only). Steer ASAP (STR1SYNC=0) ;See description of Register 24-4, Page 181 ;of PIC12(L)F1840 datasheet pwmout pwmdiv64, C.2, 124, 249;Start PWM output = 1000Hz at 50% (@ 32MHz) output C.4 ;Allow the P1B PWM signal out on RA4/C.4 ;It now starts on C.4, despite that earlier *REQUIRED* reference to C.2! ;pwmout clearly just expects PSTR1CON to be in default state...
Phil yes looks like magic code, i would say i'm better altering my pins to allow the use of C4, since i am already usings C0, Oh and read the 382 page manual, thats some manual
My feelings too. Basically what there is works when it works, just that there seems to be a potential failure in the tilt switch, tilt switch activation, or the detection of that activation.Personally, I don't think you'll need to go to such lengths ... I reckon it's just the un-repeatability and lack of snap ON/OFF action that's causing the issues. Depending on when exactly it triggers, maybe 400mS isn't always long enough - even though most of the time it is.
I just wonder if the very very slow speed that i am tilting will it will sense it or not, the motor on the chiming side of the clock don't move at all till the clock chimes i'm quite sure it would pick up movement very well, just the clock side that might struggle as may any kind of sensor, i have ordered a few of the items in post #155 and an evaluation board all for £40 so will be a startPerhaps something like the ADXL345