Code to turn PyBoard with accelerometer into tilt current meter.
Assembly instructions and DIY project page:
https://hackaday.io/project/158083-cheap-underwater-tilt-current-sensor
This guide assumes that
- You are running Linux with Python 3 installed
- When connected PyBoard is available as
/dev/ttyACM0
- Connect battery
- Right after PyBoard launch sequence press and hold
USR
button until green led blinks - that means board switched into Storage/Serial device mode. If you missed and orange LED started blinking (meaning that PyBoard started logging) pressRST
followed by holdingUSR
button until green LED blinks a few times - Connect PyBoard to computer
- Execute
./setrtc.py
- this will set UTC time on the board based on computer time - Push RST button to recycle PyBoard. Press nothing else. If orange LED starts blinking that means PyBoard entered logging mode
- Assemble the meter
- Calibrate still vertical position by attaching meter tether to a bottom of a bucket/pool/container filled with water. Leave it like this to 10-20 logging cycles
- Deploy the meter underwater
- After desired period of time has been logged, unmount the meter and bring back to the surface
- Dry it out and open the housing
- Push
RST
button followed by pushingUSR
button to switch the board into Storage/Serial device mode - Execute
./checkpointrtc.py
- this will measure and record difference between your computer clock and PyBoard clock. (PyBoard Lite has cheap oscillator as real-time clock and it is not precise.setrtc.py
andcheckpoint.py
together establish cumulative error. That information will be used to calculate correction of record timestamps during log processing) - Download log *.csv files into some folder
- Proposed scripts to use for log processing
average-sample-series.py
- take all records within logging frame and average them to one recordaxes_to_angle.py
- convert axes values to angle between accelerometer (x,y,z) vector and vertical directionpyboard-to-posix-timestampe.py
- convert PyBoard timestamps to POSIX timestamps.