Showing posts with label Teensy. Show all posts
Showing posts with label Teensy. Show all posts

Saturday, 20 January 2024

Satellite Communications - Part 2

 

Satellite Communications - Part 2

The Teensy 3.6 microcontroller has reached the end of production and the Teensy 4.1 is now the suggested device for projects with large I/O requirements. So the Voyager Controller PCB has been updated to V4.0 and then V4.1 as part of accommodating the Teensy 4.1 with connections for the additional serial port supporting the Astronode device as well as a general update.

The Teensy 4.1 is not pin-compatible with the Teensy 3.6, and also required some software changes. Once the new boards arrived, it required a few days to update, integrate and test the updated libraries, and verify their operation, and verify the new board.

Voyager Controller V4.0 - Integration Testing


The integration of the Astrocast Astronode S+ has gone well.
It now supports periodic upload of telemetry data from the vessel, as well as the ability to receive commands to amend the current mission, by inserting new waypoints in the list, or updating existing waypoints. This includes the currently active waypoint.
The aim is to be able to change the route in response to weather systems.



New Version 4.1 controller installed - ready for on water trials



Flip-top Antenna Deck to access hidden components

The satellite telemetry is currently configured to be recorded every 2 hours and uploaded to the satellite at the next available opportunity.

The satellite telemetry data that is uploaded is as follows:
            Date and Time
            Battery Voltage
            Battery Current
            Wing Sail Battery Voltage
            Average Roll angle
            COG
            COG Average 
            Wing Sail Angle
            SOG Average 
            SOG m/s
            Heading Magnetic
            BTW
            DTW
            CTE (cross track error)
            Max CTE (allowed for this waypoint)
            Deck Temp 
            Equipment Temp
            Barometric Pressure
            Wing Sail Time Since Last Response
            Mission index (way point number)
            Current Position
            Previous waypoint
            Next waypoint


Update January 2024 - bad news with the Satellite Comms:
I've been testing and integrating the Astrocast Astronode S+ devices into the Voyager hardware and software since April 2023.
I have an Astrocast account that I've been operating in trial mode to allow the integration testing to proceed before the account is activated and billing commences.
It looks like there's been a misunderstanding about the monthly fees once billing commences.
I thought it would a few dollars per month, as per their web site (which has now been updated in the last 24 hours after I pointed out the pricing I was expecting.).

The Astrocast website previously displayed the following data plans shown in the screenshot below. These prices are very attractive, with no activation fee and with no hidden fee.

The data plans have been removed from one page of the Astrocast website. That's the page I cited during our discussion.
But the data plans with no activation fee and no hidden fee are still present on two other pages:




It seems that this pricing only applies once a service fee of around CHF 50/month or CHF 500/month is paid, depending on the service contract.
They have directed me to a reseller, Soracom.
I'm currently waiting on a response from Soracom. Let's see how that goes...

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