Monday, January 24, 2011

Two microcontrollers for the task

1- BDMICRO MAVRIC-IIB Controller (ATmega128)  


This is the master controller.

Ten times per second (10 Hz rate), it goes through the following cycle:

- it measures both voltages from the wind vane and translates this into the measured apparent wind angle, correcting for the installed offset;
- it calculates the apparent wind speed from the time interval between the last two pulses from the anomometer, applying the appropriate calibration curve;
- it calculates the measured boat speed from the time interval between the last two pulses from the starboard transducer, applying the appropriate calibration curve;
- as an I2C master, it fetches the slave I2C Olimex microcontroller working in parallel for its current values of:
- heading
- heel angle
- pitch angle
- rate of rotation
- GPS position
- speed over ground (SOG);
- course over ground (COG);
- measured boat speed from the port transducer
- it corrects the measured apparent wind angle for the heel angle;
- it chooses the appropriate measured boat speed (port or starboard) depending on the heel angle;
- it calculates the leeway angle from the measured boat speed and heel angle, using the appropriate calibration curve;
- it calculates the boat speed through water (STW) corrected for leeway;
- it calculates the true wind speed (TWS) and true wind angle (TWA);
- it calculates the velocity made good (VMG);
- using the heading value, it calculates the wind direction;
- using the SOG and COG values, it calculates the speed and direction of the current;
- it updates a running average over the last four seconds of the following values : STW, VMG, TWS, AWA, speed of the current;
- it sends these running averages on the SeaTalk bus for the repeaters to show;
- it sends all measured and calculated values from this cycle (in binary form) on the USB port for the notebook to update the main displays at the 10 Hz rate;
- it waits(!) for a timer signal to initiate a new cycle.

The controller also accepts commands from a terminal program through the USB port. When it receives such a command, it pauses from its 10 Hz cycle to perform the required action and report back to the terminal program. Such commands are typically used to change calibration values stored in the controller EEPROM.



2- Olimex AVR-MT-128 Development Board (ATmega128)

This microcontroller manages the compass, the GPS and one of the boat speed transducer. The compass and the GPS require each their own serial port, and the 2 serial ports of the main controller are already taken by the USB converter and the SeaTalk bus.  Likewise, the second boat speed transducer requires its own input capture pin, and the 2 input capture pins of the main controller are already used for the anemometer and the other boat speed transducer. Furthermore, the parallel processing provided by this microcontroller helps to achieve the 10 Hz refresh rate of the system.
This microcontroller is interrupt-driven and continually :
- reads the characters from the compass ASCII stream, and when a NMEA sentence is complete, extracts the required fields and converts the numbers in floating-point binary form
- applies the deviation correction to the heading value 
- reads the characters from the GPS ASCII stream, and when a NMEA sentence is complete, extracts the required fields and converts the numbers in floating-point binary form
- at each new pulse of the speed transducer, calculates the time since the last pulse and converts it in speed value, using the appropriate calibration curve
- as an I2C client, at the request of the main controller, transmits its current values of : heading, heel angle, pitch angle, rate of rotation, GPS latitude and longitude, SOG,  COG and measured boat speed.



No comments:

Post a Comment