Git Product home page Git Product logo

getting-started's Introduction

Getting-Started with Swarm Evaluation Kit

All Eval Kit and additional information can be found in the Eval Kit Quickstart Guide or in our Developer Tools.

Simple code examples can be found in the Examples folder

Additional Helpful Links

Swarm Pass Checker
Swarm Eval Kit Quickstart Video
Activating your Swarm M138 Modem
HIVE Login
Swarm M138 Modem Product Manual

FAQ

Q: How do I stop the RSSI-Background from repeating?
A: Send $RT 0*16 via Telnet connection

Q: How do I calculate the checksum?
A: For testing, you can use the NMEA Checksum Calculator or for integration you can use the following C code found on pg. 34 of the manual.

Implementation of NMEA checksum in C

uint8_t nmeaChecksum (const char *sz, size_t len){
    size_t i = 0;
    uint8_t cs;

    if (sz [0] == '$')
        i++;

    for (cs = 0; (i < len) && sz [i]; i++)
        cs ^= ((uint8_t) sz [i]);

    return cs;
}

Implementation of NMEA checksum in Python

def nmea_checksum(command: str) -> int:
    i = 0
    cs = 0
    if command[0] == '$':
        i = 1

    bs = command.encode()
    for b in bs[i:]:
        cs ^= b

    return cs

Q: There are some differences with the POWERON message between the demo Swarm Modem, and the Swarm Modem in our card.

$M138 BOOT,POWERON,LPWR=n,WWDG=n,IWDG=n,SFT=Y,BOR=n,PIN=Y,OBL=n,FW=n*4e

vs. 

$M138 BOOT,POWERON,LPWR=n,WWDG=n,IWDG=n,SFT=n,BOR=Y,PIN=Y,OBL=n,FW=n*4e

A: SFT=Y/n and BOR=n/Y is for internal debug and can be disregarded. You can ensure your Swarm Modem is functioning correctly.

Q: What type of antenna cable do you recommend?
A: We recommend using LMR-240-UF

Where to find help

Email [email protected] with any questions!

getting-started's People

Contributors

liamgall123 avatar martinkist avatar rohan-swarm avatar ted-goyal avatar whilb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getting-started's Issues

WiFi doesn't reconnect

I think I am right in saying the WiFI STA mode doesn't reconnect.

This can be a bit of a pain if you are trying to move the device around to get WiFi connected up (e.g. setting up WiFi extenders) or just if connectivity goes down.

The solution currently seems to be to turn it off and turn it on again but it would presumably be quite straightforward to add in some code to reconnect

Can we support WebREPL

The nature of the eval kit is that it needs to be outside where there is good line of sight coverage

The nature of me is that I like to be inside in the warm :) So in theory I might be able to run some cables but USB cables really aren't designed to go the distances we are talking about and walls are involved and so on and so forth.

The USB drive update mechanism is nice but only really works with a cable connection and also isn't ideal for development work.

There is a CircuitPython "REPL" command line available over the USB C serial.

What would help is to have the Web-REPL facility available over a websocket.

ref: https://micropython.org/webrepl/

With this one could debug and upload files via WebREPL to a remote system over WiFi / IP

Now we've done quite a lot of work with this here. It works very well on the ESP8266 but hasn't been supported well on the ESP32 for some reason.

It's not supported for ESP32S2 from what I can see in the standard build or the latest CircuitPython repo.

It looks like it might be supported for ESP32 / S2 in the current MicroPython repo (CircuitPython is a fork of MicroPython)

So I am interested in

  • can we replace CircuitPython with MicroPython with WebREPL enabled (I tried but couldn't get it to boot. If this DID work there might be all sorts of driver issues...)
  • can we add WebREPL support into CircuitPython.

Further to this with WebREPL support we can actually do quite a lot. A colleague of mine @goatchurchprime has developed a "micro kernel" for the Jupyter Notebook product which allows us to develop in Python on a local or web browser and connect that to a target ESP device using WebREPL to run the code on the device, see the output, and transfer files.

This is a huge leap in ability to do uPython based development and debugging.

See https://github.com/goatchurchprime/jupyter_micropython_kernel

I am not certain it will work with an ESP32-S2 CircuitPython WebREPL but it should do or it shouldn't in theory be too much work to make it work as it uses basic and core MicroPython REPL support.

Adjust LED RSSI threshold for new device types

Check $CS string by way of new entry in device startup state table and adjust good/better/best LED lighting as follows.

If the devices responds DN=TILE, leave as is, if the device responds DN=M138, you'll need to add 4 to the values e.g. -90 becomes -86, etc.

This is because we had to disable the AGC in the new radio on the M138 because we use an external LNA, and as a result the internal calibration returns a higher (worse) number on the -M vs. the -S. This isn't an indication of sensitivity, just a numeric change on the -Ms

Tile Firmware Feature Request: $MM List with message IDs.

Hi

Something that would be very useful is the ability to list incoming messages (specifically the message_id) from the Tile via something like:

$MM L=ALL which would return a list of message IDs.

This would make it much easier for developers to build applications on top of the Tile as they wouldn't need to track all the unsolicited messages (and keep state).

Thanks in advance!

(ps. You might consider creating a placeholder tile-functionality repo to use the GitHub Issues functionality for your developer community to give you feedback.)

I can't connect modem 138 eval kit with esp32

Hi, I'm plugging an ESP32 into an evaluation kit.

[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
lib_deps = sparkfun/SparkFun Swarm Satellite Arduino Library@^1.1.10
monitor_speed = 115200

I have connected to the JTAG headers
Captura de pantalla de 2023-02-20 00-28-40

1-I have downloaded the swarm library for arduino. But I can't connect to the hardwareSerial or SoftwareSerial. I have tried in various ways to make it work without success.

2- When executing a simple HardwareSerial code defining the baud and the pins (RX, TX). I can connect to the modem without problems and read the information returned by the eval kit. But even so, I do not receive a response from the commands sent by the serial2 port, since if I send a $FV*10 I do not get the expected response. I only see a $RT RSSI=XXX message every 5 seconds in the serial2.read()

`/*!

  • @file Example5_GeospatialInformation.ino
  • @mainpage SparkFun Swarm Satellite Arduino Library
  • @section intro_sec Examples
  • This example shows how to:
  • Set the rate for the $GN geospatial information message
  • Set up a callback for the $GN message
  • Print the unsolicited geospatial information messages from the callback
  • Want to support open source hardware? Buy a board from SparkFun!
  • SparkX Swarm Serial Breakout : https://www.sparkfun.com/products/19236
  • @section author Author
  • This library was written by:
  • Paul Clark
  • SparkFun Electronics
  • February 2022
  • @section license License
  • MIT: please see LICENSE.md for the full license information

*/

#include <SparkFun_Swarm_Satellite_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_Swarm_Satellite

SWARM_M138 mySwarm;
#define swarmSerial Serial2 // Use Serial1 to communicate with the modem. Change this if required.

void printGeospatial(const Swarm_M138_GeospatialData_t *info)
{
Serial.print(F("New geospatial information received: Lat: "));
Serial.print(info->lat, 4);
Serial.print(F(" Lon: "));
Serial.print(info->lon, 4);
Serial.print(F(" Alt: "));
Serial.print(info->alt, 2);
Serial.print(F(" Course: "));
Serial.print(info->course, 2);
Serial.print(F(" Speed: "));
Serial.println(info->speed, 2);
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

void setup()
{
// Swarm Satellite Transceiver MicroMod Function Board PWR_EN
#ifdef swarmPowerEnablePin
pinMode(swarmPowerEnablePin, OUTPUT); // Enable modem power
digitalWrite(swarmPowerEnablePin, HIGH);
#endif

delay(1000);

Serial.begin(115200);
while (!Serial)
; // Wait for the user to open the Serial console
Serial.println(F("Swarm Satellite example"));
Serial.println();

//mySwarm.enableDebugging(); // Uncomment this line to enable debug messages on Serial

bool modemBegun = mySwarm.begin(swarmSerial); // Begin communication with the modem

while (!modemBegun) // If the begin failed, keep trying to begin communication with the modem
{
Serial.println(F("Could not communicate with the modem. It may still be booting..."));
delay(2000);
modemBegun = mySwarm.begin(swarmSerial);
}

// Just to prove it works, call getGeospatialInfo to request the most recent geospatial information
Swarm_M138_GeospatialData_t *info = new Swarm_M138_GeospatialData_t; // Allocate memory for the information

Swarm_M138_Error_e err = mySwarm.getGeospatialInfo(info);

while (err != SWARM_M138_SUCCESS)
{
Serial.print(F("Swarm communication error: "));
Serial.print((int)err);
Serial.print(F(" : "));
Serial.println(mySwarm.modemErrorString(err)); // Convert the error into printable text
Serial.println(F("The modem may not have acquired a valid GPS fix..."));
delay(2000);
err = mySwarm.getGeospatialInfo(info);
}

Serial.print(F("getGeospatialInfo returned: "));
Serial.print(info->lat, 4);
Serial.print(F(","));
Serial.print(info->lon, 4);
Serial.print(F(","));
Serial.print(info->alt);
Serial.print(F(","));
Serial.print(info->course);
Serial.print(F(","));
Serial.println(info->speed);
delete info; // Free the memory

// Set up the callback for the geospatial information message. Call printGeospatial when a new $GN message arrives
mySwarm.setGeospatialInfoCallback(&printGeospatial);

// Set the $GN message rate: send the message every 2 seconds
err = mySwarm.setGeospatialInfoRate(2);

if (err == SWARM_M138_SUCCESS)
{
Serial.println(F("setGeospatialInfoRate was successful"));
}
else
{
Serial.print(F("Swarm communication error: "));
Serial.print((int)err);
Serial.print(F(" : "));
Serial.print(mySwarm.modemErrorString(err)); // Convert the error into printable text
if (err == SWARM_M138_ERROR_ERR) // If we received a command error (ERR), print it
{
Serial.print(F(" : "));
Serial.print(mySwarm.commandError);
Serial.print(F(" : "));
Serial.println(mySwarm.commandErrorString((const char *)mySwarm.commandError));
}
else
Serial.println();
}

// Just to prove it works, call getGeospatialInfoRate to check the message rate
uint32_t rate;

mySwarm.getGeospatialInfoRate(&rate);

Serial.print(F("Message rate is "));
Serial.println(rate);
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

void loop()
{
mySwarm.checkUnsolicitedMsg();
}`

Response
Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting...

Simple serial hardware code

`#include <HardwareSerial.h>

#define RXD2 16
#define TXD2 17

void setup() {

Serial.begin(115200);

Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);

}

void loop() {
while (Serial2.available()) {
Serial.print(char(Serial2.read()));
}
}`

Response
$RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d

I send a $RT ?19 by Serial2.Println to stop the command from being sent by the modem. But the modem still sends me the response of $RT 513 (do you understand me??)

I followed the example of DHT20 sensor. But it didn't work for me.

Display of WiFi signal strength in STA mode

I've been doing a lot of tweaking to get a reliable WiFi connection to the gateway outdoors.

I've had borderline situations where the comms. drops out, and then recovers.

For positioning the device as an STA it would be useful to see a figure or bars, much like the Swam RSSI to check that the signal strength is reasonable.

Support for the MQtt protocol

Currently it is a little difficult to use the telnet interface to interact with the Tile as it's hard to see what one is typing and it's necessary to generate a NMEA format checksum for anything entered. (Useful and very sensible for programmatic control but not so easy for human beings).

We use the MQTT protocol a lot with our IoT products and this seems generally a good thing to support. There are two main options

  • simplest is an MQTT client on the FeatherS2 which connects to a "broker" in the cloud. Then messages can be "published" to the broker from anywhere and they will arrive on the Feather. Relevant actions can be taken such as forwarding a message to the satellite network, reconfiguring the device. publishing logging information to the broker in the cloud. (AWS/Google/IBM etc all have standard IoT broker solutions based around MQTT so this conceptually fits with cloud IoT well)

  • in the future I want to deploy these gateways where there is no other backhaul to the cloud. This obviously means the device can't have a client connecting out to a cloud broker. Instead I see a mechanism where the broker sits on the device. Sensors can then communicate locally to the gateway publishing to the broker and a set of data can then be sent up to the cloud via the Swam constellation. (This too is the way quite a lot of people are starting to understand that embedded gateway systems can operate).

I made a start with some changes to the python to support a simple message forwarding via MQTT broker which I show here. When I have tidied up a little I'll send a PR for you to look at.

https://www.youtube.com/watch?v=moLVpaa14Ls

Trouble rebuilding .uf2 CircuitPython firmware image

Hi,

I wanted to build my own CircuitPython firmware image for a couple of reasons

  • I like to know I can maintain firmware and change it's components if I want to
  • I think a WEBREPL facility would be a huge bonus for me to be able to develop remotely using e.g. Jupyter when the unit can't be wired directly to my development system.

I tried building the 7.0.0.alpha.5 release for installation on the unit. This build ok but

  • When I copied it to the USB driver as the instructions seem to say it wasn't installed correctly
  • I couldn't get the unit to boot into a boot mode with a boot drive

I'm not sure which is the correct procedure for the existing UF2 firmware image which is 7.0.0.alpha.3 I think

Then I tried building 7.0.0.alpha.3 and this build succesfully but I was again unable to get this into the board via the UF2 bootloader.

My own builds have both UF2 and .bin artifacts so I was able to use esptool.py to write my own builds to the board.

However there is no .bin file in the repo so I couldn't use this method to write the original firmware back.

  • it would be useful to have the bin file available for esptool.py recover where necessary

In the end I followed the instructions here https://learn.adafruit.com/adafruit-metro-esp32-s2/install-uf2-bootloader

This allowed me to blow a basic bootloader in with esptool.py then boot in "bootloader mode" and write the original UF2 alpha.3 image by copying it to the drive. So that got me back to where I started

The problem with both my own alpha.3 and alpha.5 images is that they don't drive the OLED display correctly. It is corrupted I will see if I can find an image.

So in recap

  • it would help to have the original .bin image in the repo too or a process to extract it from the uf2
  • there's some kind of issue building our own copies of the firmware.

getTime() function in EVAL-KIT/Examples/Example-Soil-Moisture/root/code.py

In line 127 - 132:

        # check if it has been ~30 minutes since the last datetime measurement
        if iDateTime - refDateTime >= 1800:
            # update the reference datatime value
            refDateTime = iDateTime
            # take a sensor measurement
            readSensor(refDateTime)

iDateTime and refDateTime are integer timestamps like 20230125193000 and 20230125190000. They do not have units of seconds.
Using this code gave me moisture measurements on the hour (e.g., 1900 UTC) and at 18 minutes past the hour (e.g., 1918 UTC), instead of on the hour and on the half hour.

It looks like the same is true for the other example programs which use the getTime() function.

The solution I found involves importing adafruit_datetime (after adding adafruit_datetime.mpy to the lib folder), which
allows expressing the difference between timestamps in total seconds.

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.