Giter Site home page Giter Site logo

durip-profiler's Introduction

DURIP Profiler Code

This repository hosts code, schematics, and helper functions for controlling the DURIP profiler winch. The code is intended to be used on an Arduino Mega Rev 3 with AVR ATmega2560 chip. It includes additional hardware for a real time clock (DS3231), SD card reader, 5V relay module, voltage booster, and RS232 serial interface (MAX3231) for communications with the winch, assembled according to the included schematics.

Acknowledgements

Thanks to the entire staff at the Oregon State University Ocean Observatories Initiative for critical assistance in prototyping and developing this instrument, especially Jon Fram, Steve Lambert, and Jeff Wood.

Winch Operation

The success of the winch operation depends on several key preparations before profiling can begin. Please take care to perform the following to ensure proper operation:

  • If the real time clock (RTC) is being set up for the first time, then the clock will need initialized. This must be done by changing the variable RTC_SYNC to true in durip-profiler-operation.ino. The code should then be compiled and quickly uploaded to the profiler. Finally, set RTC_SYNC back to false and reupload the code after initialization. This must be performed as efficiently as possible since the RTC will sync with the time of compiling, so any time difference between compiling, uploading, and running the code will be reflected in the times. As long as the 3V cell is not removed and does not run out of charge, this step should not need to be performed.
  • To take advantage of tide table functionality (changing surface line payout speed based on tidal cycle), a tide table must be uploaded to the SD card in the profiler. This tide table must be produced by the tide_table_downloader.py script, as the formatting must be very specific for the Arduino to properly parse it. Download the python script and run it, enter the prompts (a site number can be obtained by finding the closest NOAA tide station to deployment here) and a file "tides.txt" should be output to the active directory on the user's machine. An example of a successfully produced tide table can be found here. No changes should be made to the contents or file name of the tide table. Simply copy the output file to the SD card reader in the profiler winch controller and the tide table should be good to go. If successful, the surface velocity used will be a linear interpolation between maximum and minimum surface velocity, depending upon when in the tidal cycle the profile takes place. If unsuccessful, the surface velocity will default to halfway between maximum and minimum surface velocity.
  • A SubConn 8 pin to USB cable must be used to connect to the Arduino. Upon power up, the Arduino will not begin profiling until a serial connection is made and the user specifies to proceed with profiling. Serial connections must be made using a terminal program (I recommend CoolTerm) at 9600-8-N-1. During this time, the user can modify and check variables for the profiling. Typing "help" will return the possible values to change and the syntax to change them. Help on the syntax can also be found in the serial interface documentation. After the user enters "exit", the profiler will begin its first profile after a specified wait time. It is critical that after specifying exit, the user unplugs the cable to remove the terminal connection and does NOT first shut off the terminal program. If the terminal program shuts off the connection, the Arduino resets and the process must be repeated. Unplugging the connector then shutting off the terminal program does not reset the Arduino.
  • The Arduino saves current settings to an EEPROM and reloads them automatically during next reset. If resetting the profiler in a similar area, the variables should be setup with the previously correct values already and the user just needs to verify them and exit to begin profiling.

Serial Interface Documentation

A serial interface is used to change profiling variables. The connection should be set at 9600-8-N-1. Commands should be sent via terminal all at once and not one letter at a time (e.g., via the "send string" function in CoolTerm). All arguments should be integers except for 'factor', which can have up to one decimal place. Commands and arguments should be separated with a space. Trailing newlines and spaces are ignored.

Serial communication consists of a command, a variable, and an optional argument, all separated by a space. Syntax for commands, variables, and arguments is as follows:

  • Begin line with a command: 'g' to get current values or 's' to set values. Only the command 's' can include an argument.
  • Enter a space then the variable you wish to get or set. Available variables to change are:
    • 'upvel' (cm/s): The max velocity of the profiler on its upwards profile up to a set depth.
    • 'maxsurfvel' (cm/s): The maximum velocity in of line payout after the profiler hits the surface based on set depth. Surface velocity computed from tide tables uses this as the peak flood/ebb tide surface velocity.
    • 'minsurfvel' (cm/s): The minimum velocity of line payout after the profiler hits the surface based on set depth. Surface velocity computed from tide tables uses this as the slack tide surface velocity.
    • 'defsurfvel' (cm/s): The default surface velocity, taken as the average of maxsurfvel and minsurfvel. Cannot be set directly - must change maxsurfvel or minsurfvel to update defsurfvel.
    • 'downvel' (cm/s): The max velocity of the profiler on its downwards return.
    • 'bottvel' (cm/s): The velocity of the profiler on the final two meters of the descent.
    • 'depth' (m): The water depth. The profiler will move up at 'upvel' for this length.
    • 'factor': The water depth is multiplied by this factor and, once an amount of line equal to 'depth' is paid out, additional line is paid out equal to depth*(factor-1) at a slower rate determined by surface velocity (for a total line payout of depth*factor). Must be greater than or equal to one. Can have one decimal place.
    • 'surfwait' (min): The wait time at the surface after a total of depth*factor amount of line is paid out.
    • 'bottwait' (min): The wait time at the bottom. AKA, the time between profiles.
    • 'firstwait' (min): The wait time before beginning the first profile, after this setup is finished with 'exit'.
    • 'all': Get values for all user modifiable variables (only works with 'g'/get).
  • If setting a value with command 's', enter a space after the variable name and then input the argument that the variable will be set to.
    • Arguments must be integers, except if the variable is 'factor', then the argument can have one decimal place. Additional decimal places are ignored.
  • Wait for any responses to indicate success/failure.
  • The serial monitor will then reply to tell you when you can input the next command.
  • When finished, enter 'exit' to finish setup and begin profiling operations.

Examples of getting/setting values and their expected returns:

cmd: g maxsurfvel
res: Maximum surface velocity (cm/s): 20
res: Default surface velocity (cm/s): 15

Setting or getting maximum or minimum surface velocity also returns the default surface velocity, since the default depends on both the maximum and minimum.

cmd: s depth 30
res: Water depth (m): 30
res: Depth factor: 1.5

As for surface velocity, since both depth and factor are related to the amount of line paid out, getting or setting either will return both.

cmd: s depth30
res: Unrecognized variable name - no action taken.

There should be a space between variable 'depth' and argument '30', so the setting failed.

cmd: s surfwait q0
res: Invalid value input - no action taken.

Arguments should be only integers, except for 'factor' which can have up to one decimal places.

durip-profiler's People

Contributors

andrew-s28 avatar

Watchers

Jonathan Fram avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.