Posted by Bazyle on 27/05/2020 23:17:58:
Have you allowed for the vibration of the hard disc and fan in the computer?
I have now! I've switched to a RaspberryPi3B, which is vibration free – no disc or fan!
The breadboarded device at right is an MPU6050 6-axis Accelerometer and Gyroscope Module. It connects to the Raspberry's GPIO pins. Quite easy to use. There are two outputs,
- binary frames sent serial at 115200 baud which can be converted to USB with an adaptor or connected directly to the RX pin on an Arduino or Raspberry UART. This data is integrated on the module by a digital motion processor, ie the two sensors are corrected relative to each other by black magic.
- The module also allows raw sensor data to be read directly over I2C.
The module's DMP continuously sends acceleration, spin rate and attitude data, all in x,y & z dimensions. And temperature. Conceptually the module's accelerometer can detect lathe vibration in three planes, to answer:
- Is lathe vibration cause for concern, and in which planes is it vibrating?
- At what frequencies is the lathe vibrating?
No problem getting the Arduino to work, but I got into trouble by writing Python3 on the Raspberry to decode the binary stream. After several tantrums and false clues, the answer turned out to be easy. Python's integers aren't directly compatible with signed 16 bit shorts. Fortunately Python's ctypes module supports the binary sent by the MPU6050.
That sorted out, I did a few trial recordings expecting great results. Nope! Either my lathe doesn't vibrate, or more likely it's not vibrating enough for the module to detect it. Another cause for concern is the relatively low sample rate. More research needed, but looks like I've bought the wrong accelerometer.
There is a Plan B. Anticipating trouble I ordered a Keyes 801S Vibration Sensor at the same time. Although much simpler than the MPU6050, I'm hoping it will be more sensitive. Not betting the farm on it though – I couldn't find a detailed specification.
The advantage of hosting on a RaspberryPi is they run headless, on a battery if necessary, can store large logfiles, could be used to do the number crunching, and the logs (or graphics) can be accessed over wifi from Apple, Windows or Linux.
In the prototype the unboxed Raspberry and sensor are powered up resting on the lathe's headstock and then the Python program is started from a remote terminal. Logging to file is started and stopped at the lathe by grounding the green wire. Each start opens a new logfile, so many recordings can be done per session. If the sensor can be made to produce meaningful data, the computer and sensor would be boxed up and provided with push-button controls.
Dave