Thursday 19 October 2023

Using Astrocast Astronode S+ with Teensy Microcontroller

Using Astrocast Astronode S+ with Teensy Microcontroller

The Astrocast Arduino library can be found here:

The library provides functions to interact with the Astronode device. Most of the functions return an integer which is interpreted as an enumerated type.
A good response is 24834, meaning ANS_STATUS_SUCCESS.

When using the Astrocast Arduino library with the Teensyduino library, many of the responses are  24835 ANS_STATUS_TIMEOUT, or 1 ANS_STATUS_CRC_NOT_VALID.

Extensive testing was performed using software debugging, an oscilloscope, a logic analyzer and continual comparison with other Arduino compatible devices that did not yield communications errors.
It took a long time to find the actual problem.

The Astrocast Arduino library makes use of the function:

size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length)

This function terminates if:
  • "length" characters have been read,
  • timeout, or
  • terminator character  detected.
The Astrocast library calls this function with a precisely calculated length, but expects to return on finding the terminator character.

Unfortunately, the implementation of this function differs between the Teensyduino library and other Arduino libraries, with the primary functional difference being the handling of the length parameter.



Teensyduino: readBytesUntil

The Teensyduino implementation decrements the length parameter before using it in the "while" loop test.


Arduino: readBytesUntil

The Arduino implementation uses the length parameter without modification.

The Astrocast Arduino library passes in a precisely calculated length parameter, even though it expects it to terminate based on finding the terminator ETX (03).

When used with the Teensyduino library the function terminates due to length and does not find the terminator character, so the result is considered invalid.
Then the next call to the function immediately finds the terminator character and returns; so the next result is considered invalid also.

The solution is simple once understood.
The Astrocast library does not need to pass in the precisely calculated length parameter, so the simplest solution is to increment the length parameter before passing it in, and then it works with both the standard Arduino libraries and the Teensyduino library.

 
Code snippet from Astronode.cpp - unmodified.




Code snippet of modified Astronode.cpp 





Satellite Communications with Voyager - Part 1

 Satellite Communications - Part 1

Its always been the plan to add Satellite Communications to Voyager to allow for telemetry and re-routing whilst at sea.
The decision has been made to use the Astronode S+ from Astrocast.

https://www.astrocast.com/products/astronode-s-plus/

Astronode S+


The Astronode device allows for small telemetry messages to be uploaded from the vessel every few hours and simple commands to be received.
It will operate from 3V3, with an average current draw of less than 1mA while waiting to transmit its messages.
The peak current while transmitting is around 80mA. These power requirements can easily be supported onboard Voyager.

A new controller for Voyager has been designed with the key changes being a change from the Teeny3.6 to Teensy4.1, as well as support for the additional serial connection to the Astronode S+ Sat Comms device.

Prototype Voyager Controller V4.0

Astrocast provide a software library for interacting with the Astronode S+ within the Arduino C++ environment.



I used the Astrocast Arduino Library to exercise the Astronode S+ device using various Arduino compatible devices. These mostly worked ok, but I was having problems with the Teensy devices.

This was a problem because the Teensy device was only one that had to work.

The Teensy devices should have been the most capable of the microcontrollers in use, but they continually returned errors when communicating with the Astronode S+ device using simple 9600Baud serial data.

It took several months of part-time testing and debugging in hardware and software to eventually track down the reason for the communication errors between the Teensy devices and the Astronode devices.

In short, it is due to the Teensy Arduino Stream library, within Teensyduino, having a slight difference in implementation to other Arduino Stream libraries. 
The difference is only highlighted in edge cases, and would rarely become apparent. The Teensyduino Stream library is around 5 years old, and has always had this specific characteristic.
The Astrocast Arduino Library makes use of the Stream library, but it exercises the edge case that highlights the difference between the Teensyduino and other Arduino libraries.

The precise details of the problem with the interaction between the  Astrocast Arduino library and the Teensyduino library are covered in the next post, along with the solution.



Thursday 11 May 2023

Voyager 2.6 Conclusions

 Voyager 2.6 Conclusions

Detailed Analysis - What Happened ?

March 2023 Voyage 

Detailed analysis of the recovered vessel and the log files has yielded the following conclusions:

  • At 3 hours out, the vessel could not hold course. This was most likely due to some mechanical  damage to the sail.
  • At 8 hours out, the sail stopped responding to regular queries via Bluetooth. This was a sudden electrical failure. The battery was discharging at the normal rate, and remained close to fully charged.
  • Data from the wing angle sensor showed that the sail was feathering with the prevailing wind until the last few minutes as it entered the surf.
  • It appears that the steering was operational for the whole voyage. After communication with the sail was lost, the wind moved more aft, and the vessel was able to converge toward the rhumb line. with the wind in this quarter the boat could hold course regardless of the state of the sail.
  • Later the wind moved further toward a southerly driving the boat toward the lee shore near Blairgowrie.
So it appears that:
  • The hull, keel and rudder remined intact and operational at sea.
  • The mast was intact and the sail was feathering with the wind while at sea.
  • The sail lost the ability to drive at around 3 hours. This was either due to failure of the wing sail servo or mechanical damage to the tail. The servo continued to draw current in accordance with normal patterns so it is likely that it was fine, so mechanical damage to tail seem most likely.
  • The sail electronics did fail eventually.
  • The tiller was knocked out of place and hit the off-switch when the vessel washed ashore.
  • The sail and magnetic disk were rotating right up to when the power was switched off.
  • The sail and magnetic disk were not with the vessel when it was found, in dark with torch.
    It is likely that the sail was nearby on the beach or in the shallows, but at the time it was wrongly assumed that the mast and sail were lost at sea many hours earlier.

Next Steps - Stonger more Waterproof Sail

  • A new mast and sail are being built. The mast is much stronger than its predecessor, however this now appears unnecessary now that it has become apparent that the mast did not fail at sea.
  • The new sail is a lower profile with a longer chord, yielding a similar overall area to its predecessor, which should greatly increase its robustness.
  • The new sail is being built using heavier construction than before. with thicker 3D printed components, and larger diameter carbon tubing for the tail boom and counterweight boom.
  • The electronic components are being built with the intention of surviving under water for a reasonable length of time.


Wednesday 12 April 2023

Voyager Mission 2.6 - Good, but too rough for the sail! - 3rd Bass Strait Voyage

 Voyager Mission 2.6 - Good, but too rough for the sail!


Voyager was launched as version 2.6 from Torquay back beach at around 7:30am 30/3/2023.
The expected conditions were for south westerly winds over the coming few days of 15 to 25 knots, with a 2 to 3 metre south westerly swell.
Some breaking swells could be seen out to sea after the launch.
It was going to be rough.

Voyager 2.6 just prior to Launch at Torquay


It soon became apparent that Voyager was not holding course in the strong south westerly wind and swell. It looked like it was coming back to the rhumb line, but that was just wishful thinking, and it became clear she would wash ashore on the ocean side of Blairgowrie.

Voyager 2.6 only held course for a few hours.


The important question is to find out what has happened.


Typical appearance of the coastline near Blairgowrie (except it was dark at 8:30pm).


Standing on the coast as Voyager approached, it was very pleasing to receive telemetry signals.
This shows that the electronic systems were largely operational.

A new addition to the telemetry was measurement of range and bearing.
This relies on a GPS module that was added to the TFT Telemetry terminal which is used to compare with the reported position from the vessel to calculate range and bearing.


First Telemetry signals could be received at around 1.7km.


The vessel finally washed ashore at around 8:30pm.
It could not be seen visually as it came in, but could be tracked using telemetry, to provide range and bearing.
The shoreline appeared rocky and the seas were rough.
It appeared that the vessel was going to wash against rocks.
The telemetry signal was lost at about the time when the vessel reached the shoreline, and so it was assumed that it had been damaged against the rocks. Access to the area was difficult and dangerous in the dark. 
However, another position signal was received via satellite, and so there was evidence that it may have been intact.

It was eventually tracked down an hour later.
It was relatively intact.
The mast and sail had been lost.


Voyager 2.6 as found on the beach an hour after washing ashore, with the tide receding.


It was found that the electronics were in good order. They had been switched off when the vessel came ashore, and tiller was dislodged, flicking the power switch off.


The main electronics had been switched off when the vessel came ashore


The rudder post was found to be bent, as shown in the image below. This probably occurred as vessel was washed ashore. The rudder post was bent, but there was no damage to the plastic rudder bearings, which is good, given the load they must have endured.
It is likely that the magnetic coupling disk popped off its bolt and knocked the power switch off.
A retaining nut had not been fitted, because the disk appears difficult to remove due to the magnetic coupling with its counter-part.



View of Hull showing bent rudder, probably from being washed ashore




Remaining Mast stub covered in sand, extracted from hull.




General appearance of Mast and Bearings prior to mission.



Partially disassembled remnants of Mast showing overlap of inner tube



The mast was made from a length of 12mm pultruded carbon fibre tube.
A 10mm tube was inserted into to it, and projected down pas the top bearing to increase the strength at that point,

Examination of the mast stub showed that it had failed primarily around the point where the 10mm tube ended.