![]() |
Forum Index : Microcontroller and PC projects : Ball-switch vs Accelerometer....
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Further to the problems I was having with the ball-switch to sence a tilt in this thread, I have started taking a close look at using an Accelerometer for simple detection of a tilt to the left or the right. I am currently looking at the MPU-5060, which can be had as a module for only a buck or so from the likes of eBay here. Do the members think this would be an option worth pursuing? Has anyone used these sensors before? Anyone used ANY accelerometer chip before? If so, can those members throw any light on how hard or easy they were to use? In MY case, all I would want to know from the sensor, would be if it had been rotated 90' to the left or the right - it can ignore everything else, and I am not interested in any of it's advanced features. Just looking for options now, as the ball-switch has been a total failure, so I need to chuck that idea in the bin and redesign using something else. EDIT: I found this website which talks about using this module, and explains how it works etc - quite useful information here.... Smoke makes things work. When the smoke gets out, it stops! |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Don't know if this is a helpful solution or not, but you could load an Accelerometer App on a smart phone to see what sorts of output it gives for the movement you need to detect. Plenty of them about & avoids the wait for the module. Phil. |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
One I had loaded outputs G's in each axis, Moved my phone around a bit & got this. Cheers. Edit, Graph spans maybe 30 seconds. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Haven't used it for anything useful yet but here is some code to play with: I was going to mount one on the tractor but I decided that the old method works well enough: "if the back wheel is off the ground, the slope is too much" Peterm did a LOT of work with gyros etc to stop his plane falling out of the sky. Jim VK7JH MMedit |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Thanks guys, and Jim for the sample code. I might get a few then to play with as you have already done some demo code. [Quote=TassyJim]if the back wheel is off the ground, the slope is too much[/Quote] LOL!!! ![]() ![]() Well, quite. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Like this? |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
@matherp love how you make things just flow like water. Your other video too. so cooool And this option too. ADXL345 you can get better price on ebay ebay |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
@matherp - FANTASTIC HORIZON!!! Paul in NY |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
@ matherp - EXACTLY like that. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
redrok![]() Senior Member ![]() Joined: 15/09/2014 Location: United StatesPosts: 209 |
Hi Grogster; The simplest direct angle sensor, outside of the pair of mercury switches, would be a pot with a weighted pendulum connected to the shaft. This forms a variable voltage divider that can be read with the A2D on the uMITE. Standard linear pots can rotate about 270deg, more than enough for your +-90deg range. Choose one that has a loose action or you will need a heaver weight. redrok |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Here is more reference data for you. Single-axis Gyroscope Analog Gyro Module ENC-03RC seeedstudio Quazee137 |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Grogster I was wondering how this is going. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Thank you for your interest. ![]() I have designed a new PCB that replaces the ball-switch with two small mercury switches secured to the PCB using silicone sealer at roughly 45' angles via slots in the PCB. Silicone sealer was chosen over glue, as it is flexible, and should allow for a little bit of 'Mercury Switch Suspension', for want of another term. I have some 3mm and 5mm(diameter) mercury switches, and the board is designed to use the 5mm ones - slightly more mass(bigger blob of liquid mercury then the 3mm ones). These switches are connected between a standard 10k/1k pull-up arrangement to the I/O pin(no more PULLUP option) and ground, so that when either mercury switch is tilted, the I/O pin is pulled to ground. At least with the two external pull-up resistors, I can now play with values if for whatever reason, 10k/1k does not work with the mercury switches - but I am hopeful that they will work just fine in this application. The PCB's have been made, and I expect them in the next couple of days via DHL, and I plan to build a new prototype over the Christmas holidays. Smoke makes things work. When the smoke gets out, it stops! |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
Grogs, I assume you mean the glass tube mercury switches, I have some here somewhere that are round and will close or open (I can't remember) when tilted in any direction. They came out of column oil heaters in case they fell over. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Good to see some old tech reliable concepts in use. Hazardous stuff as we are all aware. It's well known that it can escape all restraints & go in wild rampages over entire suburbs & r@93, plunder & pillage. Chase people down for miles, before ripping people's hearts out... Dangerous stuff some of these elements... In the wrong context. Rant over.... Miss the day's where normal people could use the good stuff.... Phil. PS, An old MS sits in a display cabinet here.... Poised to track down & apprehend intruders... Just need that bag of Sulfur as the "Antidote Agent" in the event of a mishap. Long Day, Long Week, just venting a little dry Outback Humour. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
...and consuming the outback lager? ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
This may have been it.... Edit:- Don't worry, substance has been "Disposed" of. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Hahaha! ![]() Nice one. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
My new sensors from Digi-Key have arrived. The first one is a left-right tilt switch in a single package. Here is a photo of it's guts: ![]() This one is pendulum based, and there are actually three little pendulums inside there, stacked one on top of the other. I will hook up one later and test it out. The next one is another ball-switch unit, but it is indeed gold-plated. Here is a photo of it's guts: ![]() The gold-plated one will probably give the least trouble cos of the gold-plated contacts, ball and retaining cup. I will hook both of them up and have a play later tonight. As these ones are from a more reputable supplier, I hope to have less isses then I was having with the ones from China. Well, the ones from DigiKey are still made in China anyway, but I guess there is more quality control. Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Did you also order the optical ones that have a ball that blocks the light? Microblocks. Build with logic. |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |