Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNSS v2 Updates #41

Merged
merged 14 commits into from
Feb 13, 2024
Binary file modified Design/banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Design/gnss-tracker-enclosure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Design/gnss-tracker-pcb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Design/gnss-tracker-store.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Design/gnss-tracker-v1-specs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Design/gnss-tracker-v2-specs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,35 +66,32 @@ public class MeadowApp : App<F7CoreComputeV2>

## Hardware Specifications

<img src="Design/gnss-tracker-specs.jpg" style="margin-top:10px;margin-bottom:10px" />
<img src="Design/gnss-tracker-v2-specs.jpg" style="margin-top:10px;margin-bottom:10px" />

<table>
<tr>
<th>Onboard Peripherals</th>
<td><strong>3.7V LiPo Rechargeable Battery</strong></td>
<td><strong>BMI270 Inertial Measurement Unit / Accelerometer</strong></td>
</tr>
<tr>
<td><strong>6V Solar Input</strong></td>
<td><strong>SCD40 CO2, Humidity and Temperature sensor</strong></td>
<td><strong>Off/On Switch</strong></td>
</tr>
<tr>
<td><strong>SSD1680 122x250 Adafruit E-Paper Display</strong></td>
</tr>
<tr>
<td><strong>NEO-M8 GNSS/GPS</strong></td>
</tr>
<tr>
<td><strong>GNSS/GPS Antenna</strong></td>
</tr>
<tr>
<td><strong>Solar Power/Battery Charging Add-on Module</strong></td>
<td><strong>USB-C, Boot, Reset Add-on Module</strong></td>
</tr>
<tr>
<td><strong>Meadow F7 Core-Compute Module (CCM)</strong></td>
<td><strong>Solar Power/Battery Charging Add-on Module</strong></td>
</tr>
<tr>
<td><strong>USB-C, Boot, Reset Add-on Module</strong></td>
<td><strong>6V Solar Input Connector</strong></td>
<td><strong>BME688 Temp, Pressure and Humidity sensor</strong></td>
</tr>
<tr>
<td><strong>3.7V Lipo Rechargeable Battery</strong></td>
<td><strong>GNSS/GPS Antenna</strong></td>
<td><strong>NEO-M8 GNSS/GPS</strong></td>
</tr>
</table>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using GnssTracker_SQLite_Demo.Models.Logical;
using Meadow;
using Meadow.Devices;
using Meadow.Logging;
using Meadow.Peripherals.Sensors.Location.Gnss;
using System;
using System.Threading.Tasks;
using WildernessLabs.Hardware.GnssTracker;

namespace GnssTracker_SQLite_Demo.Controllers
{
Expand All @@ -20,9 +20,9 @@

protected Logger Log { get => Resolver.Log; }

protected AtmosphericModel? LastAtmosphericConditions { get; set; }

Check warning on line 23 in Source/Additional Samples/GnssTracker_SQLite_Demo/Controllers/MainTrackerController.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 23 in Source/Additional Samples/GnssTracker_SQLite_Demo/Controllers/MainTrackerController.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

protected LocationModel? LastLocationInfo { get; set; }

Check warning on line 25 in Source/Additional Samples/GnssTracker_SQLite_Demo/Controllers/MainTrackerController.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

protected DisplayController DisplayController { get; set; }

Expand All @@ -41,10 +41,11 @@
await Task.Delay(TimeSpan.FromSeconds(20));
}

GnssController.Initialize(gnssTracker.Gnss);
GnssController.GnssPositionInfoUpdated += GnssPositionInfoUpdated;
}

public void Start()
public void Run()
{
if (GnssTracker.AtmosphericSensor is { } bme)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Meadow.Devices;
using System;
using System.Threading.Tasks;
using WildernessLabs.Hardware.GnssTracker;

namespace GnssTracker_SQLite_Demo
{
Expand All @@ -26,10 +25,6 @@ public override async Task Initialize()
Resolver.Log.Info($"Err bringing up database: {e.Message}");
}

//await Task.Delay(TimeSpan.FromSeconds(10));

GnssController.Initialize(gnssTracker.Gnss);

MainController = new MainTrackerController();
await MainController.Initialize(gnssTracker);
}
Expand All @@ -38,7 +33,7 @@ public override Task Run()
{
Resolver.Log.Info("Running");

MainController.Start();
MainController.Run();

return base.Run();
}
Expand Down
7 changes: 4 additions & 3 deletions Source/GnssTracker/DisplayConnector.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using static Meadow.Hardware.DisplayConnector;
using Meadow.Hardware;
using System;
using static Meadow.Devices.DisplayConnector;

namespace Meadow.Hardware;
namespace Meadow.Devices;

/// <summary>
/// Represents the display connector on GNSS Tracker
Expand Down
10 changes: 4 additions & 6 deletions Source/GnssTracker/GnssTracker.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Meadow;
using Meadow.Hardware;
using Meadow.Hardware;
using Meadow.Logging;
using System;

namespace WildernessLabs.Hardware.GnssTracker
namespace Meadow.Devices
{
/// <summary>
/// Represents a Gnss Tracker IoT acclerator
Expand Down Expand Up @@ -36,19 +35,18 @@ public static IGnssTrackerHardware Create()

try
{
logger?.Debug("Initializing I2CBus");
logger?.Debug("I2CBus Initializing...");

i2cBus = Resolver.Device.CreateI2cBus();

logger?.Debug("Initializing I2CBus initialized");
logger?.Debug("I2CBus initialized");
}
catch (Exception e)
{
logger?.Error($"Err initializing I2CBus: {e.Message}");
throw;
}


if (device is IF7CoreComputeMeadowDevice { } ccm)
{
try
Expand Down
89 changes: 57 additions & 32 deletions Source/GnssTracker/GnssTrackerHardareBase.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
using Meadow;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Accelerometers;
using Meadow.Foundation.Sensors.Atmospheric;
using Meadow.Foundation.Sensors.Environmental;
using Meadow.Foundation.Sensors.Gnss;
using Meadow.Hardware;
using Meadow.Logging;
using Meadow.Peripherals.Displays;
using Meadow.Peripherals.Leds;
using Meadow.Peripherals.Sensors;
using Meadow.Peripherals.Sensors.Atmospheric;
using Meadow.Peripherals.Sensors.Environmental;
using Meadow.Peripherals.Sensors.Motion;
using Meadow.Units;
using System;

namespace WildernessLabs.Hardware.GnssTracker
namespace Meadow.Devices
{
/// <summary>
/// Represents a Gnss Tracker Hardware base class
/// </summary>
public abstract class GnssTrackerHardwareBase : IGnssTrackerHardware
{
/// <inheritdoc/>
protected Logger Log = Resolver.Log;
protected Logger? Logger = Resolver.Log;

/// <inheritdoc/>
public II2cBus? I2cBus { get; protected set; }
Expand All @@ -28,26 +30,44 @@ public abstract class GnssTrackerHardwareBase : IGnssTrackerHardware
public ISpiBus? SpiBus { get; protected set; }

/// <inheritdoc/>
public PwmLed? OnboardLed { get; protected set; }
public IPwmLed? OnboardLed { get; protected set; }

/// <inheritdoc/>
public Bme688? AtmosphericSensor { get; protected set; }

/// <inheritdoc/>
public NeoM8? Gnss { get; protected set; }
public ITemperatureSensor? TemperatureSensor { get; protected set; }

/// <inheritdoc/>
public IHumiditySensor? HumiditySensor { get; protected set; }

/// <inheritdoc/>
public IBarometricPressureSensor? BarometricPressureSensor { get; protected set; }

/// <inheritdoc/>
public abstract Scd40? EnvironmentalSensor { get; protected set; }
public IGasResistanceSensor? GasResistanceSensor { get; protected set; }

/// <inheritdoc/>
public abstract Bmi270? MotionSensor { get; protected set; }
public NeoM8? Gnss { get; protected set; }

/// <inheritdoc/>
public IPixelDisplay? Display { get; protected set; }

/// <inheritdoc/>
public IAnalogInputPort? SolarVoltageInput { get; protected set; }

/// <inheritdoc/>
public abstract IGyroscope? Gyroscope { get; protected set; }

/// <inheritdoc/>
public abstract IAccelerometer? Accelerometer { get; protected set; }

/// <inheritdoc/>
public abstract ICO2ConcentrationSensor? CO2ConcentrationSensor { get; protected set; }

/// <inheritdoc/>
public abstract IAnalogInputPort? BatteryVoltageInput { get; protected set; }

/// <inheritdoc/>
public I2cConnector I2cHeader => (I2cConnector)Connectors[1]!;

Expand Down Expand Up @@ -82,7 +102,7 @@ public IConnector?[] Connectors

internal UartConnector CreateUartConnector()
{
Log?.Trace("Creating Uart connector");
Logger?.Trace("Creating Uart connector");

return new UartConnector(
"Uart",
Expand All @@ -96,7 +116,7 @@ internal UartConnector CreateUartConnector()

internal I2cConnector CreateI2cConnector()
{
Log?.Trace("Creating I2C connector");
Logger?.Trace("Creating I2C connector");

return new I2cConnector(
"I2C",
Expand All @@ -110,7 +130,7 @@ internal I2cConnector CreateI2cConnector()

internal DisplayConnector CreateDisplayConnector()
{
Log?.Trace("Creating display connector");
Logger?.Trace("Creating display connector");

return new DisplayConnector(
"Display",
Expand All @@ -133,52 +153,57 @@ internal DisplayConnector CreateDisplayConnector()
/// <param name="i2cBus">The I2C bus</param>
public GnssTrackerHardwareBase(IF7CoreComputeMeadowDevice device, II2cBus i2cBus)
{
Log.Debug("Initialize hardware...");
Logger?.Debug("Initialize hardware...");
_device = device;
I2cBus = i2cBus;

try
{
Log.Debug("Initializing Onboard LED");
Logger?.Debug("Onboard LED Initializing...");

OnboardLed = new PwmLed(device.Pins.D20, TypicalForwardVoltage.Green);

Log.Debug("Onboard LED initialized");
Logger?.Debug("Onboard LED initialized");
}
catch (Exception e)
{
Log.Error($"Err initializing onboard LED: {e.Message}");
Logger?.Error($"Err initializing onboard LED: {e.Message}");
}

try
{
Resolver.Log.Debug("Initializing GNSS");
Logger?.Debug("GNSS Initializing...");

Gnss = new NeoM8(device, device.PlatformOS.GetSerialPortName("COM4")!, device.Pins.D09, device.Pins.D11);

Resolver.Log.Debug("GNSS initialized");
Logger?.Debug("GNSS initialized");
}
catch (Exception e)
{
Resolver.Log.Error($"Err initializing GNSS: {e.Message}");
Logger?.Error($"Err initializing GNSS: {e.Message}");
}

try
{
Log.Debug("Initializing BME688");

AtmosphericSensor = new Bme688(I2cBus, (byte)Bme688.Addresses.Address_0x76);

Log.Debug("BME688 initialized");
Logger?.Debug("BME688 Initializing...");

var bme = new Bme688(I2cBus, (byte)Bme688.Addresses.Address_0x76);
AtmosphericSensor = bme;
TemperatureSensor = bme;
HumiditySensor = bme;
BarometricPressureSensor = bme;
GasResistanceSensor = bme;
Resolver.SensorService.RegisterSensor(bme);
Logger?.Debug("BME688 initialized");
}
catch (Exception e)
{
Log.Error($"Err initializing BME688: {e.Message}");
Logger?.Error($"Err initializing BME688: {e.Message}");
}

try
{
Resolver.Log.Debug("Initializing ePaper Display");
Logger?.Debug("ePaper Display Initializing...");

var config = new SpiClockConfiguration(new Frequency(48000, Frequency.UnitType.Kilohertz), SpiClockConfiguration.Mode.Mode0);
SpiBus = device.CreateSpiBus(
Expand All @@ -195,22 +220,22 @@ public GnssTrackerHardwareBase(IF7CoreComputeMeadowDevice device, II2cBus i2cBus
width: 122,
height: 250);

Resolver.Log.Debug("ePaper Display initialized");
Logger?.Debug("ePaper Display initialized");
}
catch (Exception e)
{
Resolver.Log.Error($"Err initializing ePaper Display: {e.Message}");
Logger?.Error($"Err initializing ePaper Display: {e.Message}");
}

try
{
Resolver.Log.Debug("Instantiating Solar Voltage Input");
Logger?.Debug("Solar Voltage Input Initializing...");
SolarVoltageInput = device.Pins.A00.CreateAnalogInputPort(5);
Resolver.Log.Debug("Solar Voltage Input up");
Logger?.Debug("Solar Voltage initialized");
}
catch (Exception ex)
{
Resolver.Log.Error($"Unabled to create the Switching Anemometer: {ex.Message}");
Logger?.Error($"Unabled to create Solar Voltage Input: {ex.Message}");
}
}
}
Expand Down
19 changes: 12 additions & 7 deletions Source/GnssTracker/GnssTrackerHardwareV1.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
using Meadow;
using Meadow.Foundation.Sensors.Accelerometers;
using Meadow.Foundation.Sensors.Environmental;
using Meadow.Hardware;
using Meadow.Hardware;
using Meadow.Peripherals.Sensors.Environmental;
using Meadow.Peripherals.Sensors.Motion;

namespace WildernessLabs.Hardware.GnssTracker
namespace Meadow.Devices
{
/// <summary>
/// Represents a Gnss Tracker Hardware V1
/// </summary>
public class GnssTrackerHardwareV1 : GnssTrackerHardwareBase
{
/// <inheritdoc/>
public override Scd40? EnvironmentalSensor { get => null; protected set => throw new System.NotImplementedException(); }
public override ICO2ConcentrationSensor? CO2ConcentrationSensor { get => null; protected set => throw new System.NotImplementedException(); }

/// <inheritdoc/>
public override Bmi270? MotionSensor { get => null; protected set => throw new System.NotImplementedException(); }
public override IGyroscope? Gyroscope { get => null; protected set => throw new System.NotImplementedException(); }

/// <inheritdoc/>
public override IAccelerometer? Accelerometer { get => null; protected set => throw new System.NotImplementedException(); }

/// <inheritdoc/>
public override IAnalogInputPort? BatteryVoltageInput { get => null; protected set => throw new System.NotImplementedException(); }

/// <summary>
/// Create a new GnssTrackerHardwareV1 object
Expand Down
Loading
Loading