Tilt switch test rig

PhilHornby

Senior Member
It's just struck me, that it might be worth re-visiting your opening gambit: i.e. Testing the reliability/repeatability of tilt switches by means of a test rig.

The discussion has moved to overcoming imagined issues with the current tilt switches - that may or may not, actually be occurring...

If your test rig ran at a speed more akin to the actual clock implementation, all that would be required, is to detect that a 'tilt' hadn't been detected within a certain time (at which point, stop the test).

Running very slowly, but continuously, would still put the tilt switch through its paces at a far greater rate than the actual clock implementation. If it passes that test, then issues in the field must surely be to do with the implementation or environment.

(Between us, we can easily get that test rig working :) )
 

Rampz

Well-known member
Hi Rampz did you catch my previous note.
David looks like i missed the bottom part of your post, looking at those devices you can get one with PPA in the part number which is pre programmed analogue which seems to be a 0-5v output, i would assume the processing need for that is no greater than reading any other voltage, if programming were to be needed i can see it would be much more involved.

The one i posted above is by different manufacturer and looks like it could communicate by SPI but that could be very complicated too, an analogue output voltage seems the easiest route?
 

Rampz

Well-known member
It's just struck me, that it might be worth re-visiting your opening gambit: i.e. Testing the reliability/repeatability of tilt switches by means of a test rig.

The discussion has moved to overcoming imagined issues with the current tilt switches - that may or may not, actually be occurring...

If your test rig ran at a speed more akin to the actual clock implementation, all that would be required, is to detect that a 'tilt' hadn't been detected within a certain time (at which point, stop the test).

Running very slowly, but continuously, would still put the tilt switch through its paces at a far greater rate than the actual clock implementation. If it passes that test, then issues in the field must surely be to do with the implementation or environment.

(Between us, we can easily get that test rig working :) )
I will see if the manufacturer can build a test rig more on par with the tilt speed of real conditions, i have put forward a design sketch and will follow it up to see what he can do, the current test rig won't slow down far enough.

Yes your right that we are trying to overcome problems that currently we don't know exist or not

Thank you for your ongoing help on the subject Phil
 

David_Reynolds

Active member
David looks like i missed the bottom part of your post, looking at those devices you can get one with PPA in the part number which is pre programmed analogue which seems to be a 0-5v output, i would assume the processing need for that is no greater than reading any other voltage, if programming were to be needed i can see it would be much more involved.

The one i posted above is by different manufacturer and looks like it could communicate by SPI but that could be very complicated too, an analogue output voltage seems the easiest route?
Hi, Rampz I think you missed this one.
 

David_Reynolds

Active member
How stupid of me.
If you reverse the operating action of your switch then electrolytic action should not be a problem.
When the switch is properly made no etching can take place, so no bad contacts, so change it so that it is normaly closed, only operating the motor when the switch breaks, it will do this fairly quickly since when a current is flowing there should be very small attraction keeping it in place until the weight gets too much and the ball will break away.
Sorry it took me so long to think of it total tilt angle of the switch by this will not be altered.
I cannot tell you if the mercury ones will work in the same way but if you try a glass one you can see for yourself.
tilt it as slow as you can and see if it snaps cleanly away, the switch position ideally is dead centre of the drum shaft.
I like the Idea of the MLX positioner as well , as long as the program will fit on the Picaxe, I looked into the multiaxis ones and they need a lot of room on an CPU for their operation, way more than a small picaxe.
Do not take my word for it, look into it first.
As a famous waiter used to say " I know nothing ".


Regards,
Dave.

PS. put a small 10 to 22nF cap across the contact to divert current momentarily when it breaks.
Also the mercury ones may still benefit from being or pulsed DC
 

Rampz

Well-known member
I have a drive unit on test that uses a 555 timer currently that stops almost every week or so for no reason, would be worth making a pulsed dc set up with 08m2 and minimal code and put it inline with a currently failing setup unit, Hippy has done some code and i will build a circuit to try with, then nothing will have changed other than the pulse dc part, maybe have an output LED to show what state the tilt switch is in at all times?
 

David_Reynolds

Active member
I have a drive unit on test that uses a 555 timer currently that stops almost every week or so for no reason, would be worth making a pulsed dc set up with 08m2 and minimal code and put it inline with a currently failing setup unit, Hippy has done some code and i will build a circuit to try with, then nothing will have changed other than the pulse dc part, maybe have an output LED to show what state the tilt switch is in at all times?
I understand , but all you would be doing is turn the sensor 180 degrees and inverting the action of the signal from it, so essentially no hardware changes just software and a reverse of it's action.
 

Rampz

Well-known member
I understand , but all you would be doing is turn the sensor 180 degrees and inverting the action of the signal from it, so essentially no hardware changes just software and a reverse of it's action.
Yep but if you look at the post again i said its a 555 timer based version thats having the issue, so no software to be able to program so wondering if i can build an interface to work with the 555 timer setup, based along the pulsed dc route a something to try to work out its issue
 

rq3

Senior Member
Ok I have found a uk source for the MLX90316EDC-BCG-000 triaxis sensor any ideas for basic connection and ideas on code, I don't feel its use is overkill with all the problems we have had in the past and the positional accuracy I need coupled with repeatably of activation at exactly the same spot 100% of the time

Edit

i can see these are the unprogrammed version, i need the ones with PPA in the part number and i can get them too, PPA being pre programmed for an analogue output, that i assume a picaxe would use its readadc10 to give a change of angle detection
Yes, I use the analog version, which can also be user programmed for an angle range of less than 360 degrees. I use the full 360 degrees, and the output on a 5 volt supply is 0.5-4.5 volts. Using readadc10 that is 360/1024=0.35 degree resolution (approximately).
 

David_Reynolds

Active member
Yep but if you look at the post again i said its a 555 timer based version thats having the issue, so no software to be able to program so wondering if i can build an interface to work with the 555 timer setup, based along the pulsed dc route a something to try to work out its issue
Sorry I thought you were working with a 8pin Picaxe I am blaming it on the drugs!
 

Rampz

Well-known member
Yes, I use the analog version, which can also be user programmed for an angle range of less than 360 degrees. I use the full 360 degrees, and the output on a 5 volt supply is 0.5-4.5 volts. Using readadc10 that is 360/1024=0.35 degree resolution (approximately).
Thanks rq3 i assume not much code for basic operation and i assume not many components needed to connect and have it work with a PICaxe? Any help would be great, i would be interested to at least get something working even if in the end its not the route i end up going
 

Rampz

Well-known member
Sorry I thought you were working with a 8pin Picaxe I am blaming it on the drugs
I am with future versions of the product and i have a set of code that does what i want but with having a problem in a previous problem its a chance to fault find this current one
 

rq3

Senior Member
Thanks rq3 i assume not much code for basic operation and i assume not many components needed to connect and have it work with a PICaxe? Any help would be great, i would be interested to at least get something working even if in the end its not the route i end up going
The code necessary to read the output of the analog Melexis device is just readadc10 on the ADC pin of your choice. What you do with the resulting digital word is, of course, up to you!
 

Rampz

Well-known member
The code necessary to read the output of the analog Melexis device is just readadc10 on the ADC pin of your choice. What you do with the resulting digital word is, of course, up to you!
Yep great thank you rq3 its at least as expected and connections etc do you have something you can share for connecting one?
 

David_Reynolds

Active member
The code necessary to read the output of the analog Melexis device is just readadc10 on the ADC pin of your choice. What you do with the resulting digital word is, of course, up to you!
Hi, rq3 does it react to the earths field or does it require a magnetic target?

Dave.
 
Last edited:

Rampz

Well-known member
Code:
| ___ / ___
B.0 |----|___|---.---O O---.---|___|---.
| | | |
B.1 |------------' | |
| | |
B.2 |-----------------------' |
| |
B.3 |-----------------------------------'
|
Hippy i assume from your circuit the 2 top items either end are 10k resistors? It didn't copy and paste very well as a quote, i will head this way and then can always alter the set up to be always on going off to activate, will build with 5v regulator and relay output so not to alter the electrical setup of the existing drive units other than the operating current on the tilt switch and some extra current draw that can be supplied from else where.
 

David_Reynolds

Active member
Hello to both of you.
I have just found the blurb on the triaxis chip MLX90316EDC-BCG-000 triaxis and it would seem to need a small magnetic target that floats above it with a rotation angle or a distance from target.
Being that you are hanging the sensor on the moving part I wonder how it will work unless you can fit it in the existing detector body, or maybe design one to do the job.

Regards,
Dave.
 

Rampz

Well-known member
Being that you are hanging the sensor on the moving part I wonder how it will work
Hello Dave, i was looking at a horizontal shaft in bearing with a vertical part with a weight to keep it vertical, end of horizontal shaft has magnet attached and then the axis sensor, so we are measuring angle on-axis style, i would think i could position the motor at its top most position and read the adc measurement into eeprom with a switch, then work out what the 15 degrees either way was worth, and small caculation would then trigger the motor to drive, just my thought.

The chip above would need PPA in the part number to save having to program it for analogue output

Attached is my thrown together pdf of a circuit to play with alternating dc connections to the tilt switch to try with the current problem unit, seems right need to check it further and develop code to make it function as simple switch, then i can try it out to prove or disprove what could be happening with current microswitch etc

Since pins are going from inputs to outputs I assume I can't really use symbols for them since that would set them as one or the other?
 

Attachments

Last edited:

David_Reynolds

Active member
If it is built solid enough I think it would then work OK. I just wanted to see if you were aware that you had to have a moving target, even if you were to copy the existing switch carrier. that has a magnet in it.
 

Rampz

Well-known member
Yes David that's what I thought was so good about the idea, it seems the magnet can be off-axis too, so the shaft could run under the control box with the sensor in the bottom of the control box with a magnet drilled through the shaft as a slightly different arrangement
 

Rampz

Well-known member
The optocoupler I use is a PC817 forward current on the led is 20ma from your replies this will still be too much current on the tilt switch contacts, even if I get it to 10ma will be plenty. Even on my picaxe design I was looking to still use the optocoupler to make the product backward compatible, but I can see I will have to move away to make it work
 

rq3

Senior Member
Yes David that's what I thought was so good about the idea, it seems the magnet can be off-axis too, so the shaft could run under the control box with the sensor in the bottom of the control box with a magnet drilled through the shaft as a slightly different arrangement
Most of the Melexis devices are very tolerant of magnetic field strength and position, however, they do require that the field (north to south) go across the face of the device. The analog output (on a 5 volt supply) goes from 0.5 to 4.5 volts.

The device is designed to throw errors if the supply or ground is missing, or the magnetic field is too high or too low. It does this by forcing the output to within millivolts of the supply, or ground. A close reading of the data sheets is interesting.

Attached is a photo of one of my rotating vane assemblies. The two magnets are rare earth, 1/8" diameter and 1/4 inch long. They are mounted so that one exposed pole is north, the other south. The hole centered between them is for the pivot axel. The magnetic field reaches through an aluminum housing roughly 1/8" thick, and through the 1/16" thick printed circuit board that the Melexis sensor is mounted on. There is a hole in the PC board centered under the sensor for the end of the axel to keep the board in position while being potted.

Also attached are photos of the top and bottom of the sensor board.
 

Attachments

Last edited:

David_Reynolds

Active member
Well, I think thats just about the rest of it covered gentlemen, Rampz, I hope it all works out OK.

I dont know anything yet about programming but I keep on bashing the keys to try things out.
If I mull over something for long enough I usually find a way to make it work.
I have produced capacitor discharge stud welders in the past but the chips were linear so no programming, just a couple of logics , opto couplers and a phase angle triac trigger IC., extinct now but I could still build a set if I needed one.

Nice Job there rq3 , but can I be rude and ask exactly what they are used for ?
The pictures do not tell me enough, unless it is top secret !

PS. it's OK I can keep a secret. :censored:
 
Last edited:

Rampz

Well-known member
; Count tilts If TILT_PIN <> tiltWas Then tiltWas = tiltWas ^ 1 If tiltWas <> 0 Then tiltCount = tiltCount + 1 changed = 1 End If End If
Hello Hippy wondering how to change your code to read off's instead of on's along David's thought process, i have altered test rig so it turns off rather than turns on and thought if i can alter code to read the other way maybe it would be more reliable, in the real set up the change to on is really slow and the change to off really quickly, so hoping the change to off will be slow but more positive and the switch to on really quick
 

rq3

Senior Member
Well, I think thats just about the rest of it covered gentlemen, Rampz, I hope it all works out OK.

I dont know anything yet about programming but I keep on bashing the keys to try things out.
If I mull over something for long enough I usually find a way to make it work.
I have produced capacitor discharge stud welders in the past but the chips were linear so no programming, just a couple of logics , opto couplers and a phase angle triac trigger IC., extinct now but I could still build a set if I needed one.

Nice Job there rq3 , but can I be rude and ask exactly what they are used for ?
The pictures do not tell me enough, unless it is top secret !

PS. it's OK I can keep a secret. :censored:
It's the probe vane for an aircraft angle of attack indicator sold as the CYA-100. Hundreds of them flying.
 

PhilHornby

Senior Member
Hello Hippy wondering how to change your code to read off's instead of on's along
change
Rich (BB code):
If tiltWas <> 0 Then
to
Rich (BB code):
If tiltWas = 0 Then
Just a thought: Have you got some pull-up (or pull-down as appropriate) resistors on these pins? (To stop them picking up and responding to stray electrical noise)
 
Last edited:

David_Reynolds

Active member
Thanks RQ , Great use for such a sensor. I have found your site, although some of the links that you have used, may have been hijaked. I followed one link on a site that seemed to be your link to" FAA Doc" and it was nothing to do with it. You might want to look into it.

I have just found an APP for my phone that does a compass an inclinomter and a bulls eye level all in one, so it must have one of those multi axis chips on board, really cool as they say.

Phil, is there not a internal pullup comand for most of the input pins?
But if the pin is going to be forced high by an outside +Ve then the pullup would need to be changed to an external pulldown instead, somewhere 10 to 33K should do for that, so it does not conume to much battery power.

Rampz, the opto that you are using for isolation of the switch will still operate with 5 or 6 milliamps flowing through it, and bear in mind that if you are going to choose to use alternating current or reversing DC then the opto input needs to work with AC and DC. It has two leds facing both ways. If it is DC type, you could instead strap a LED in the opposing direction across pin 1 and 2 and leave the coupler as it is, any colour as long as it works around 2Vs. GN YW RD AM.
 
Last edited:

David_Reynolds

Active member
Just found an informative little video on how the church clock in a village not far from me is, wound and regulated.

Very upto date, thanks phil, I can see that it was a very costly setup but so worth it.
The electronic regulation means apart from cleaning and oiling maintenance is at a minimum.
Except of course the wear and tear over the years will mean sooner or later a major strip and rebuild.
 

David_Reynolds

Active member
Hello Dave, i was looking at a horizontal shaft in bearing with a vertical part with a weight to keep it vertical, end of horizontal shaft has magnet attached and then the axis sensor, so we are measuring angle on-axis style, i would think i could position the motor at its top most position and read the adc measurement into eeprom with a switch, then work out what the 15 degrees either way was worth, and small caculation would then trigger the motor to drive, just my thought.

The chip above would need PPA in the part number to save having to program it for analogue output

Attached is my thrown together pdf of a circuit to play with alternating dc connections to the tilt switch to try with the current problem unit, seems right need to check it further and develop code to make it function as simple switch, then i can try it out to prove or disprove what could be happening with current microswitch etc

Since pins are going from inputs to outputs I assume I can't really use symbols for them since that would set them as one or the other?
Rampz. I have had another look at you sketch, I do not quite know how your program is going to make the psuedo AC but, IMHO those pins should have a 330 Ohm resisters in series. The input pins then 10K Ohm down to zero Vs. As Phil Suggested, then when the switch breaks one of the inputs goes high and one goes low in turn with the frequency.
Under switch closed condition they are both high or low together. Consumption on the switch is going to be just a few milliAmps and if you short out the wires to the switch you will not damage output pins. Since there is no protection Via an opto on these, current limiting will do (unless the CPU has reliable limits built into itself).


Dave.
 
Last edited:

Rampz

Well-known member
Just a thought: Have you got some pull-up (or pull-down as appropriate) resistors on these pins? (To stop them picking up and responding to stray electrical noise)
Hello Phil yes i am all resistor-ed up as i should be, i don't want any floating pins and stray voltages
 

Rampz

Well-known member
Rampz. I have had another look at you sketch, I do not quite know how your program is going to make the psuedo AC but, IMHO those pins should have a 330 Ohm resisters in series. The input pins then 10K Ohm down to zero Vs. As Phil Suggested, then when the switch breaks one of the inputs goes high and one goes low in turn with the frequency.
David, it was the circuit design from Hippy, i just brought it into my circuit setup, if you look the pins, are in some times inputs and at other times outputs, don't see how i can resistor them for both uses?
 

Rampz

Well-known member
Rampz, the opto that you are using for isolation of the switch will still operate with 5 or 6 milliamps flowing through it, and bear in mind that if you are going to choose to use alternating current or reversing DC then the opto input needs to work with AC and DC. It has two leds facing both ways. If it is DC type, you could instead strap a LED in the opposing direction across pin 1 and 2 and leave the coupler as it is, any colour as long as it works around 2Vs. GN YW RD AM.
David, i use the opto in my current set up, if i was going for Hippy design and coding for reversing polarity i wouldn't be able to use an opto in my opinion, or there would be little point in doing, the tilt switch would just be direct on to the picaxe pins as hippy drew above, currently all my designs for this have been backward compatible, but i don't see this will be possible unless i use a second picaxe just for the tilt switch on maybe a p-channel mosfet because i would need a positive switch for the rest of the circuit and then i would stay backwards compatible
 

Rampz

Well-known member
Just found an informative little video on how the church clock in a village town! not far from me is, wound and regulated.

Great video Phil, the that style of auto winder is these days frowned upon because the drive is clamped to the winding drum, smiths don't do it quite like that in its current setup, the person i am helping is a competitor to smiths, main difference being the 10's of thousands difference in the price of the equipment doing just the same job betwwen the 2 companies, I repair the circuit boards for previous smiths winders since smiths would rather sell them a lovely new one that replace a few components, our local chucrch is still on a smiths unit of an older style to the one shown in the video, i think it cost me about £15 in components to completly repair the control unit, i did it for free, its saved the chruch over 14K for a new set of winders.
The automatic clock regulation is a direct copy in every way from a man called Richard who was the original designer of the motor units i am now trying to make more reliable, the PLC is identical, the hours sensor with its flashing led is identical, the means of speeding and slowing the pendulem is identical. its is possible to get the above set up to also change back and forth between summer and winter time, the one in the video doen't have that ability, The software in the PLC that smiths have written is not as good as richard's, smiths allow the clock to run fast and then slow it down to suit, Richard's design can handle a faster or slower clock and speed or slow the pendelum, smiths can't do that.

When I say we have reliability problems its not all that bad, currently I know of one clock that has an issue, and there is a unit on the test bench that has an issue, this style of winder has Been made for over 15years
 
Last edited:

Rampz

Well-known member
If tiltWas = 0 Then
Thank you Phil that works better than what I tried, the test rig as it stands has the tilt switch starting from the on position and there is still the multiple activations I guess at the point the ball starts to move, the drive motor on the rig does seem to vibrate a bit at slow speeds so I guess that's not helping either
 

David_Reynolds

Active member
David, i use the opto in my current set up, if i was going for Hippy design and coding for reversing polarity i wouldn't be able to use an opto in my opinion, or there would be little point in doing, the tilt switch would just be direct on to the picaxe pins as hippy drew above, currently all my designs for this have been backward compatible, but i don't see this will be possible unless i use a second picaxe just for the tilt switch on maybe a p-channel mosfet because i would need a positive switch for the rest of the circuit and then i would stay backwards compatible
Rampz, yes I see what you mean that you would not be able to do it as a backwards compatible thing. You said that you have on the old setup a 12VDC to the tilt switch thro an opto, it drives a NE55 timer. Well I don't think that could easily be changed but you can limit electrolytic action a little by ensuring that the current is limited thro the opto and switch to 5 or 6 or six milliamps. it should still trigger the timer when the switch opens.
I have had situations in the past when you expect something to happen and it does not, often due to capacitors dried out and not functioning properly, when all looks good to go.
But there is always something can be done you will just have to ponder on it bit more.


QUOTE="Rampz, post: 340002, member: 76404"]
Thank you Phil that works better than what I tried, the test rig as it stands has the tilt switch starting from the on position and there is still the multiple activations I guess at the point the ball starts to move, the drive motor on the rig does seem to vibrate a bit at slow speeds so I guess that's not helping either
[/QUOTE]

Rampz, you might try a few nF at the input to the CPU pin to 0V , when the ball moves and the motion starts it will filter the signal and instead of getting many spikes that read as separate switch actions it will smooth them out until you read only one. try 10nF and work you way up until you get the result you need, even if it is even a couple of uF it will not matter, at some point you will be able to filter out the jitter.
Dave.
 
Last edited:

Rampz

Well-known member
Rampz, you might try a few nF at the input to the CPU pin, when the ball moves and the motion starts it will filter the signal and instead of getting many spikes that read as separate switch actions it will smooth them out until you read only one. try 10nF and work you way up until you get the result you need.
Dave.
Dave I prefer doing debounce in software if possible, I have a 50ms delay currently without it I get almost twice as many activations
 

David_Reynolds

Active member
Rampz, I would as well but if you have to have very long debounce times it may be better to either smooth the circuitry. or if possible tell it to only count the first pulse in software and move on ignoring the pin until you are ready to scan it again.
That way you should get proper counts.
Dave
 
Top